/* ===================================================================
   Stundenplan Studio v8 – Premium Design System
   =================================================================== */

/* --- Design Tokens ------------------------------------------------- */
:root {
  /* Colors */
  --bg: #f0f3fa;
  --bg-gradient: linear-gradient(145deg, #e8edf8 0%, #f4f6fb 40%, #ffffff 100%);
  --panel: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.82);
  --text: #151b2e;
  --text-secondary: #5a6785;
  --muted: #8392ab;
  --line: #dde4f0;
  --line-light: #edf1f7;

  /* Brand */
  --primary: #4361ee;
  --primary-hover: #3451d1;
  --primary-soft: #eef2ff;
  --primary-glow: rgba(67, 97, 238, 0.15);

  /* Semantic */
  --ok: #10b981;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --warn: #f59e0b;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --bad: #ef4444;
  --bad-bg: #fee2e2;
  --bad-text: #991b1b;

  /* Surfaces */
  --shadow-sm: 0 1px 3px rgba(21, 27, 46, 0.04), 0 1px 2px rgba(21, 27, 46, 0.06);
  --shadow: 0 4px 24px rgba(21, 27, 46, 0.07), 0 1px 4px rgba(21, 27, 46, 0.04);
  --shadow-lg: 0 20px 60px rgba(21, 27, 46, 0.10), 0 4px 12px rgba(21, 27, 46, 0.04);
  --shadow-glow: 0 0 0 3px var(--primary-glow);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* Sidebar */
  --sidebar-w: 280px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* --- Reset & Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; }

h1, h2, h3 { margin: 0; line-height: 1.2; }


/* --- Buttons ------------------------------------------------------- */
button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: #c5cee0;
}
button:active {
  transform: translateY(0);
}

button.primary, .primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow), 0 4px 16px rgba(67, 97, 238, 0.3);
}

button.success {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
button.success:hover {
  background: #0ea571;
}

button.danger {
  color: var(--bad);
  border-color: #f3b7b0;
  background: #fff;
}
button.danger:hover {
  background: var(--bad-bg);
  border-color: var(--bad);
}

.full { width: 100%; margin-bottom: 10px; }
.big { font-weight: 800; padding: 13px 20px; font-size: 14px; }


/* --- Forms --------------------------------------------------------- */
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: #fff;
  min-height: 40px;
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
input::placeholder, textarea::placeholder {
  color: var(--muted);
}
input[type="color"] {
  padding: 4px;
  height: 40px;
  cursor: pointer;
}
select[multiple] {
  min-height: 130px;
  padding: 6px;
}

label {
  display: block;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}
label > input, label > select, label > textarea {
  margin-top: 5px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field label { display: block; }


/* --- App Shell ----------------------------------------------------- */
.appShell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}


/* --- Sidebar ------------------------------------------------------- */
.sidebar {
  padding: 24px;
  background: var(--panel-glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}
.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4361ee, #a78bfa);
  display: grid;
  place-items: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(67, 97, 238, 0.25);
}
.brand strong {
  font-size: 15px;
  display: block;
}
.brand small {
  color: var(--muted);
  font-size: 11px;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.sideTitle {
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.upload {
  display: block;
  text-align: center;
  border: 1.5px dashed #b7c5df;
  background: #f8faff;
  border-radius: var(--radius-sm);
  padding: 11px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}
.upload:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.upload input { display: none; }

.qualityBox {
  background: linear-gradient(135deg, #f8faff, #f0f4ff);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.projectList button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  font-size: 13px;
}

/* Mobile hamburger */
.menuToggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.menuToggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}


/* --- Main Area ----------------------------------------------------- */
.main {
  padding: clamp(20px, 3vw, 40px);
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}


/* --- Top Bar ------------------------------------------------------- */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}
.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text) 0%, #3d4a6b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar p {
  max-width: 700px;
  color: var(--text-secondary);
  font-size: 14px;
}
.topActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}


/* --- Step Navigation ----------------------------------------------- */
.steps {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.steps::-webkit-scrollbar { display: none; }

.step {
  flex: 0 0 auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-glass);
  border: 1px solid var(--line);
  font-size: 13px;
  border-radius: 999px;
  transition: var(--transition);
}
.step span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 11px;
  color: var(--primary);
  transition: var(--transition);
}
.step:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.step.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  box-shadow: var(--shadow);
}
.step.active span {
  background: #fff;
  color: var(--text);
}
.expertStep {
  margin-left: auto;
}


/* --- Layout Grid --------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}


/* --- Cards --------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: cardIn 0.35s ease-out;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.compact { margin-top: 20px; }
.editorCard { min-width: 0; }
.resultCard { margin-top: 24px; }

.cardHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.cardHead h2 {
  font-size: 18px;
  font-weight: 800;
}
.cardTools {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}


/* --- Form Grids ---------------------------------------------------- */
.formGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.formGrid.three {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}


/* --- Data Tables --------------------------------------------------- */
.tableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.dataTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.dataTable th,
.dataTable td {
  border-bottom: 1px solid var(--line-light);
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
}
.dataTable th {
  font-size: 11px;
  color: var(--muted);
  background: #f8faff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  position: sticky;
  top: 0;
}
.dataTable tr:last-child td { border-bottom: 0; }
.dataTable tr:hover td { background: #fafbfe; }

.rowActions { display: flex; gap: 6px; }


/* --- Summary Grid (Overview) --------------------------------------- */
.summaryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.summaryTile {
  background: linear-gradient(180deg, #fff 0%, #f8faff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  transition: var(--transition);
}
.summaryTile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.summaryTile b {
  font-size: 32px;
  display: block;
  color: var(--primary);
  margin-bottom: 4px;
}


/* --- Checklist ------------------------------------------------------ */
.checklist {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}
.checkItem {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  background: #fff;
  font-size: 13px;
  transition: var(--transition);
}
.checkItem:hover { background: #fafbfe; }


/* --- Badges -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #eef2f7;
  color: #465266;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn, .badge.warning { background: var(--warn-bg); color: var(--warn-text); }
.badge.bad, .badge.error { background: var(--bad-bg); color: var(--bad-text); }


/* --- Info Box ------------------------------------------------------ */
.infoBox {
  background: linear-gradient(135deg, #eef6ff, #f0f4ff);
  border: 1px solid #c5dcf5;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.infoBox b { color: var(--text); }

.addBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}


/* --- Teacher Cards ------------------------------------------------- */
.teacherList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 20px;
}
.teacherCard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: #fff;
  overflow: hidden;
  transition: var(--transition);
}
.teacherCard:hover {
  box-shadow: var(--shadow);
}
.teacherTop {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.teacherTop label {
  flex: 1 1 180px;
  min-width: 150px;
}
.teacherTop label:first-child {
  flex: 0 1 120px;
  min-width: 100px;
}
.teacherTop .danger {
  flex: 0 0 auto;
  align-self: flex-end;
}

.teacherLimits {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-top: 16px;
}
.teacherLimits label {
  flex: 1 1 160px;
  min-width: 130px;
}

.subjectPickers {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}
.subjectPickers label {
  flex: 1 1 240px;
  min-width: 200px;
}

/* Teacher flags row */
.teacherFlags {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #f8faff;
  border-radius: var(--radius-sm);
}

.switchLine {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.switchLine input {
  width: auto;
  min-height: auto;
  cursor: pointer;
  accent-color: var(--primary);
}


/* --- Availability Matrix ------------------------------------------- */
.availability {
  margin-top: 16px;
  background: linear-gradient(180deg, #f8faff, #f4f7fc);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--line-light);
}
.matrixWrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.matrix {
  display: grid;
  grid-template-columns: 72px repeat(var(--hours), 48px);
  gap: 6px;
  width: max-content;
  min-width: 100%;
  align-items: center;
}
.matrix .head {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
}
.matrix label {
  display: grid;
  place-items: center;
  min-height: 28px;
  min-width: 48px;
}
.matrix input {
  width: auto;
  min-height: auto;
  accent-color: var(--primary);
}


/* --- Lesson Cards -------------------------------------------------- */
.lessonHelp {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.miniCard {
  background: linear-gradient(180deg, #f8faff 0%, #fff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 90px;
  font-size: 13px;
  line-height: 1.5;
}
.miniCard b {
  font-size: 14px;
  color: var(--primary);
}

.lessonList { display: grid; gap: 16px; }

.lessonCard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
  transition: var(--transition);
}
.lessonCard:hover { box-shadow: var(--shadow); }

.lessonCardHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.lessonTitle {
  font-weight: 800;
  font-size: 15px;
}
.lessonFields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.lessonExtra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.lessonCard select[multiple] {
  min-height: 100px;
}


/* --- Analysis / Hints ---------------------------------------------- */
.analysis { font-size: 13px; line-height: 1.6; }

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 8px 0;
  background: #fff;
  font-size: 13px;
  transition: var(--transition);
}
.item.bad {
  border-color: #fecaca;
  background: #fff7f7;
}
.item.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.item.warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
}


/* --- Expert / JSON ------------------------------------------------- */
.jsonBox { min-width: 0; }
.jsonBox textarea {
  width: 100%;
  font-family: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  height: clamp(400px, 50vh, 700px);
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
  word-break: normal;
  overflow-wrap: normal;
  tab-size: 2;
  background: #1a1d27;
  color: #e0e6f0;
  border-color: #2a2e3d;
  border-radius: var(--radius);
  padding: 18px;
}
.jsonBox textarea:focus {
  border-color: var(--primary);
}

.expertWarning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
}


/* --- Timetable / Plan ---------------------------------------------- */
.planWrap {
  overflow: auto;
  margin-bottom: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.plan {
  border-collapse: collapse;
  width: 100%;
  min-width: 700px;
}
.plan th,
.plan td {
  border: 1px solid var(--line-light);
  padding: 8px 10px;
  text-align: center;
  vertical-align: top;
}
.plan th {
  background: #f3f6fc;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.plan td {
  min-width: 120px;
}

.lesson {
  border-radius: var(--radius-sm);
  padding: 10px;
  min-height: 56px;
  transition: var(--transition);
}
.lesson:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-sm);
}
.lesson b { font-size: 13px; }
.lesson small {
  display: block;
  color: #364156;
  margin-top: 3px;
  font-size: 11px;
}


/* --- Tabs (Varianten) ---------------------------------------------- */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tabs button.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}


/* --- Quick Grid ---------------------------------------------------- */
.quickGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quickGrid button {
  font-size: 12px;
  padding: 8px 12px;
}


/* --- Toast --------------------------------------------------------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}


/* --- Loading Overlay ----------------------------------------------- */
.loadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 27, 46, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 500;
  transition: opacity 0.25s;
}
.loadingOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loadingContent {
  text-align: center;
  color: #fff;
}
.loadingContent p {
  font-size: 16px;
  font-weight: 700;
  margin-top: 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}


/* --- Confirm Dialog ------------------------------------------------ */
.confirmOverlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 27, 46, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 600;
  transition: opacity 0.2s;
}
.confirmOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.confirmBox {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  text-align: center;
}
.confirmBox p {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
}
.confirmActions {
  display: flex;
  gap: 10px;
  justify-content: center;
}


/* --- Slider for weights ------------------------------------------- */
.weightGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.weightItem {
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.weightItem label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}
.weightItem input[type="range"] {
  flex: 1;
  min-height: auto;
  accent-color: var(--primary);
  padding: 0;
  border: none;
}
.weightItem input[type="range"]:focus {
  box-shadow: none;
}
.weightVal {
  font-weight: 800;
  font-size: 13px;
  color: var(--primary);
  min-width: 32px;
  text-align: right;
}


/* --- Gesperrte Slots Editor --------------------------------------- */
.slotGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.slotChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 4px 10px 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.slotChip button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--bad);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.slotChip button:hover {
  transform: none;
  box-shadow: none;
}


/* --- Fach Color preview ------------------------------------------- */
.fachColorCell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fachColorCell input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}
.fachColorPreview {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}


/* =================================================================
   Responsive Breakpoints
   ================================================================= */

/* Laptop: right rail goes below */
@media (max-width: 1400px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .rightRail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .rightRail .compact { margin-top: 0; }
  .expertStep { margin-left: 0; }
}

/* Tablet: sidebar collapses */
@media (max-width: 1100px) {
  .appShell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    transition: left 0.3s ease;
    z-index: 50;
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  .menuToggle {
    display: flex;
  }
  .main {
    padding-top: 64px;
  }
  .topbar {
    flex-direction: column;
  }
  .topActions {
    justify-content: flex-start;
    width: 100%;
  }
}

/* Narrow tablet */
@media (max-width: 860px) {
  .rightRail {
    grid-template-columns: 1fr;
  }
  .teacherList {
    grid-template-columns: 1fr;
  }
  .card { padding: 20px; }
  .main { padding: 16px; padding-top: 60px; }
  .topbar h1 { font-size: 28px; }
}

/* Phone */
@media (max-width: 640px) {
  .formGrid, .formGrid.three {
    grid-template-columns: 1fr;
  }
  .summaryGrid {
    grid-template-columns: 1fr 1fr;
  }
  .lessonHelp {
    grid-template-columns: 1fr;
  }
  .lessonFields, .lessonExtra {
    grid-template-columns: 1fr;
  }
  .teacherTop label,
  .teacherLimits label,
  .subjectPickers label {
    flex-basis: 100%;
    min-width: 0;
  }
  .topActions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .topActions button { width: 100%; }
  .steps { gap: 6px; }
  .step { padding: 6px 10px; font-size: 12px; }
  .matrix {
    grid-template-columns: 60px repeat(var(--hours), 40px);
  }
  .cardHead {
    flex-direction: column;
  }
  .cardTools { margin-top: 8px; }
}

/* Sidebar backdrop for mobile */
.sidebarBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 40;
}
.sidebarBackdrop.show {
  display: block;
}
