/* ============================================================
   TeacherOS — Unified Design System
   Palette merged from the TeacherOS Design System (purple/blue/
   chalk, Fraunces + Inter). Variable NAMES kept from the original
   IEPio build so every existing rule below repaints automatically —
   only the VALUES changed.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=JetBrains+Mono:wght@400;500&display=swap');
:root {
  /* Brand */
  --teal:        #6E56C7;   /* primary — TeacherOS purple-500 */
  --teal-hover:  #5A42B0;   /* purple-600 */
  --teal-soft:   #F3F0FB;   /* purple-50 */
  --teal-tint:   #F5F3EC;   /* chalk-100 */
  --coral:       #3A6AD4;   /* secondary — TeacherOS blue-500 */
  --coral-hover: #2C55B3;   /* blue-600 */
  --coral-soft:  #ECF2FE;   /* blue-50 */
  --bg:          #FBFAF7;   /* chalk-50 */
  --surface:     #FFFFFF;
  --surface-alt: #F7F8FB;   /* silver-50 */
  --navy:        #181C2C;   /* silver-900 */
  --navy-soft:   #5E6780;   /* silver-600 */
  --border:      #DEE2EB;   /* silver-200 */
  --border-mid:  #C6CCD9;   /* silver-300 */

  /* Semantic status */
  --green:       #3FA06B;
  --green-soft:  #DCEFE4;
  --yellow:      #D48A1F;
  --yellow-soft: #FBEED6;
  --red:         #C84A52;
  --red-soft:    #F7DADC;

  /* AI gradient — reserved for AI-generated content & drafting moments */
  --grad-ai: linear-gradient(135deg, #6E56C7 0%, #3A6AD4 100%);
  --grad-ai-soft: linear-gradient(135deg, #F3F0FB 0%, #ECF2FE 100%);
  --purple-200: #C9BCEE;
  --font-display: 'Fraunces', Georgia, serif;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(30,58,95,0.06), 0 1px 3px rgba(30,58,95,0.04);
  --shadow-md: 0 2px 8px rgba(30,58,95,0.08), 0 4px 16px rgba(30,58,95,0.05);
  --shadow-lg: 0 10px 40px rgba(30,58,95,0.14);

  --sidebar-w: 244px;
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--navy);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { color: var(--navy); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--teal); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  color: var(--navy);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-os { font-weight: 800; font-size: 1.02rem; color: var(--navy); letter-spacing: -0.02em; }
.brand-os .accent { color: var(--teal); }
.brand-product { font-size: 0.68rem; color: var(--navy-soft); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy-soft); padding: 14px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--navy-soft); font-size: var(--text-base); font-weight: 500;
  border: none; background: none; text-align: left; width: 100%;
  transition: background .13s, color .13s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--teal-soft); color: var(--teal-hover); }
.nav-item.active { background: var(--teal); color: #fff; }
.nav-badge { margin-left: auto; background: var(--coral); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; }
.sidebar-user .u-name { font-size: var(--text-sm); font-weight: 600; color: var(--navy); }
.sidebar-user .u-role { font-size: 0.7rem; color: var(--navy-soft); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar .menu-toggle { display: none; background: none; border: none; color: var(--navy); }
.page-title { font-size: var(--text-lg); font-weight: 700; }
.page-sub { font-size: var(--text-sm); color: var(--navy-soft); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.today-chip { font-size: var(--text-sm); color: var(--navy-soft); background: var(--surface-alt); padding: 6px 12px; border-radius: 20px; font-weight: 500; }

.content { padding: 26px 28px 60px; max-width: 1180px; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-base);
  border: 1px solid transparent; transition: background .13s, box-shadow .13s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); }
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { background: var(--coral-hover); }
.btn-ghost { background: var(--surface); color: var(--navy); border-color: var(--border-mid); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-sm { padding: 6px 11px; font-size: var(--text-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); gap: 12px; }
.card-head h3 { font-size: var(--text-md); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy-soft); font-weight: 700; }
.kpi-value { font-size: 2rem; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-value.teal { color: var(--teal); }
.kpi-value.red { color: var(--red); }
.kpi-value.yellow { color: var(--yellow); }
.kpi-value.green { color: var(--green); }
.kpi-sub { font-size: var(--text-sm); color: var(--navy-soft); margin-top: 2px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
table.data th {
  text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--navy-soft); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th.no-sort { cursor: default; }
table.data th .arrow { opacity: .4; font-size: 0.7rem; }
table.data th.sorted .arrow { opacity: 1; color: var(--teal); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--teal-tint); }
table.data tbody tr:last-child td { border-bottom: none; }
.student-cell { display: flex; align-items: center; gap: 11px; }
.student-cell .avatar { background: var(--teal); }
.student-name { font-weight: 600; }
.student-id { font-size: var(--text-xs); color: var(--navy-soft); }

/* ---------- Pills & badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 20px; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.01em; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill-green  { background: var(--green-soft);  color: #1E7040; }
.pill-green .dot { background: var(--green); }
.pill-yellow { background: var(--yellow-soft); color: #8A6000; }
.pill-yellow .dot { background: var(--yellow); }
.pill-red    { background: var(--red-soft);    color: #A82727; }
.pill-red .dot { background: var(--red); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: var(--text-xs); font-weight: 600; background: var(--surface-alt); color: var(--navy); border: 1px solid var(--border); }
.days-badge { font-weight: 700; font-variant-numeric: tabular-nums; }
.days-badge.green { color: var(--green); }
.days-badge.yellow { color: var(--yellow); }
.days-badge.red { color: var(--red); }

/* ---------- Filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 8px 12px; flex: 1; min-width: 200px; max-width: 340px; }
.search-box svg { width: 16px; height: 16px; color: var(--navy-soft); }
.search-box input { border: none; outline: none; background: none; font-size: var(--text-base); color: var(--navy); width: 100%; }
select.filter, input.field, textarea.field, select.field, input.date {
  font-family: inherit; font-size: var(--text-base); color: var(--navy);
  border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface);
  transition: border-color .13s, box-shadow .13s;
}
input.field:focus, textarea.field:focus, select.field:focus, select.filter:focus, input.date:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); outline: none;
}
textarea.field { width: 100%; resize: vertical; min-height: 90px; line-height: 1.5; }
input.field, select.field { width: 100%; }
label.flabel { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--navy); margin-bottom: 6px; }
label.flabel .req { color: var(--coral); }
.field-hint { font-size: var(--text-xs); color: var(--navy-soft); margin-top: 4px; }
.form-row { margin-bottom: 18px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* checkbox groups */
.check-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 16px; }
.check {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-base); background: var(--surface); transition: all .12s;
}
.check:hover { border-color: var(--teal); background: var(--teal-tint); }
.check input { accent-color: var(--teal); width: 16px; height: 16px; cursor: pointer; }
.check.checked { border-color: var(--teal); background: var(--teal-tint); font-weight: 600; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30,58,95,0.42); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: pop .18s ease; }
.modal.wide { max-width: 720px; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: var(--text-md); }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.icon-btn { background: none; border: none; color: var(--navy-soft); padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-alt); color: var(--navy); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Alert banner ---------- */
.alert-banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 22px; font-size: var(--text-base); }
.alert-banner svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-red { background: var(--red-soft); color: #932020; border: 1px solid #F3C4C4; }
.alert-yellow { background: var(--yellow-soft); color: #7A5400; border: 1px solid #EBD6A0; }
.alert-green { background: var(--green-soft); color: #1B6339; border: 1px solid #BEE6CD; }
.alert-teal { background: var(--teal-soft); color: #0A4A55; border: 1px solid #B9DDE2; }
.alert-banner strong { font-weight: 700; }
.warn-box { background: var(--red-soft); border: 1px solid #F3C4C4; color: #932020; border-radius: var(--radius-sm); padding: 12px 15px; font-size: var(--text-base); display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.warn-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.ok-box { background: var(--green-soft); border: 1px solid #BEE6CD; color: #1B6339; border-radius: var(--radius-sm); padding: 12px 15px; font-size: var(--text-base); display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.ok-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 6px; }
.tl-item { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.tl-item:last-child { border-bottom: none; }
.tl-date { font-weight: 700; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.tl-days { font-size: var(--text-xs); margin-top: 2px; }
.tl-body { display: flex; align-items: flex-start; gap: 12px; }
.tl-marker { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; border: 3px solid; }
.tl-marker.green { border-color: var(--green); background: var(--green-soft); }
.tl-marker.yellow { border-color: var(--yellow); background: var(--yellow-soft); }
.tl-marker.red { border-color: var(--red); background: var(--red-soft); }
.tl-title { font-weight: 600; }
.tl-cite { font-size: var(--text-xs); color: var(--navy-soft); margin-top: 2px; }

/* ---- IEP Draft v2: progress ribbon, flag rail, bracket tracker ---- */
.iep-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 920px) { .iep-layout { grid-template-columns: 1fr; } }
.ribbon { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ribbon-dot { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; background: var(--surface-alt); border: 1px solid var(--border); font-size: var(--text-xs); font-weight: 600; color: var(--navy-soft); transition: background .18s, color .18s, border-color .18s; }
.ribbon-dot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-mid); flex-shrink: 0; }
.ribbon-dot.done { background: var(--green-soft); border-color: #BEE6CD; color: #1B6339; }
.ribbon-dot.done .dot { background: var(--green); }
.ribbon-dot.active { background: var(--teal-soft); border-color: var(--purple-200,#C9BCEE); color: var(--teal-hover); }
.ribbon-dot.active .dot { background: var(--teal); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.flag-rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.flag-rail-item { border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--text-xs); line-height: 1.5; cursor: pointer; border-left: 3px solid; }
.flag-rail-item.action_required { background: var(--red-soft); border-color: var(--red); color: #7A2020; }
.flag-rail-item.note { background: var(--yellow-soft); border-color: var(--yellow); color: #6B4E00; }
.flag-rail-item.informational { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-hover); }
.bracket-tracker { display: flex; align-items: center; gap: 10px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--text-sm); font-weight: 600; margin-bottom: 16px; }
.bracket-tracker .count { background: var(--coral); color: #fff; border-radius: 20px; padding: 1px 9px; font-size: var(--text-xs); }
.iep-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin: 8px 0; }
.iep-table th, .iep-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.iep-table th { color: var(--navy-soft); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .03em; }
.goal-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; background: var(--surface-alt); }
.goal-card h5 { margin-bottom: 8px; }

/* ---- Planner: day/week/month views ---- */
.cal-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); cursor: default; }
.cal-item:last-child { border-bottom: none; }
.cal-item-body { flex: 1; }
.cal-item-title { font-weight: 600; font-size: var(--text-sm); color: var(--navy); }
.cal-dot { font-size: 12px; width: 18px; text-align: center; flex-shrink: 0; }
.cal-meeting .cal-dot { color: var(--teal); }
.cal-deadline .cal-dot { color: var(--red); }
.cal-todo-check { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.cal-item.cal-done .cal-item-title { text-decoration: line-through; color: var(--navy-soft); }
.cal-todo-del { margin-left: 8px; opacity: .5; }
.cal-todo-del:hover { opacity: 1; }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 760px) { .week-grid { grid-template-columns: repeat(7, minmax(90px,1fr)); overflow-x: auto; } }
.week-day-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 220px; display: flex; flex-direction: column; }
.week-day-col.week-today { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.week-day-head { display: flex; justify-content: space-between; padding: 8px 10px; font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--navy-soft); border-bottom: 1px solid var(--border); }
.week-day-items { padding: 6px 8px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.week-chip { font-size: 11px; padding: 4px 6px; border-radius: 5px; cursor: pointer; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-chip.cal-meeting { background: var(--teal-soft); color: var(--teal-hover); }
.week-chip.cal-deadline { background: var(--red-soft); color: #932020; }
.week-chip.cal-todo { background: var(--surface-alt); color: var(--navy); border: 1px solid var(--border); }
.week-chip.cal-done { opacity: .5; text-decoration: line-through; }

.month-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.month-grid-head div { text-align: center; font-size: var(--text-xs); font-weight: 700; color: var(--navy-soft); text-transform: uppercase; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 100px; gap: 6px; }
.month-cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; cursor: pointer; overflow: hidden; }
.month-cell:hover { border-color: var(--teal); }
.month-cell-outside { opacity: .4; }
.month-cell-today { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.month-cell-date { font-size: var(--text-xs); font-weight: 700; color: var(--navy-soft); margin-bottom: 3px; }
.month-chip { font-size: 10px; padding: 2px 4px; border-radius: 4px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-chip.cal-meeting { background: var(--teal-soft); color: var(--teal-hover); }
.month-chip.cal-deadline { background: var(--red-soft); color: #932020; }
.month-chip.cal-todo { background: var(--surface-alt); color: var(--navy); }
.month-chip.cal-done { opacity: .5; text-decoration: line-through; }
.month-chip-more { font-size: 10px; color: var(--navy-soft); }
@media (max-width: 760px) { .month-grid { grid-auto-rows: 70px; } .month-chip { display: none; } }

/* ---- Planner: color/emoji picker (to-do customization) ---- */
.td-swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform .1s; }
.td-swatch:hover { transform: scale(1.08); }
.td-swatch-active { border-color: var(--navy); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--navy); }
.td-emoji-btn { font-size: 18px; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-alt); cursor: pointer; line-height: 1; }
.td-emoji-btn:hover { background: var(--teal-soft); }
.td-emoji-active { border-color: var(--teal); background: var(--teal-soft); }

/* ---------- Generated document ---------- */
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; }
.doc-section { border-bottom: 1px solid var(--border); }
.doc-section:last-child { border-bottom: none; }
.doc-section-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--teal-tint); gap: 10px; }
.doc-section-head h4 { font-size: var(--text-base); color: var(--teal); text-transform: uppercase; letter-spacing: 0.03em; }
.doc-section-body { padding: 16px 20px; font-size: var(--text-base); line-height: 1.65; white-space: pre-wrap; }
.doc-section-body p { margin-bottom: 10px; }
.doc-section-body ul { margin: 8px 0 8px 20px; }
.doc-section-body li { margin-bottom: 6px; }
.doc-section-body h5 { color: var(--navy); font-size: var(--text-base); margin: 12px 0 4px; }
.letter { font-size: var(--text-base); line-height: 1.7; white-space: pre-wrap; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-family: "Inter", sans-serif; }

/* ---------- Empty & loading states ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--navy-soft); }
.empty svg { width: 48px; height: 48px; color: var(--border-mid); margin-bottom: 14px; }
.empty h3 { color: var(--navy); margin-bottom: 6px; }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.teal { border-color: var(--teal-soft); border-top-color: var(--teal); }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 50px; }
.gen-loading .msg { color: var(--navy-soft); font-size: var(--text-base); }
.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, #ECECE6 50%, var(--surface-alt) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--navy); color: #fff; padding: 13px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: var(--text-base); display: flex; align-items: center; gap: 10px; animation: slideIn .22s ease; max-width: 360px; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success svg { color: #6EDB9A; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-intro { margin-bottom: 22px; }
.page-intro h2 { font-size: var(--text-xl); margin-bottom: 4px; }
.page-intro p { color: var(--navy-soft); font-size: var(--text-base); max-width: 640px; }
.section-title { font-size: var(--text-md); font-weight: 700; margin: 26px 0 12px; }

/* ---------- Segment / tabs ---------- */
.copy-btn { background: none; border: 1px solid var(--border-mid); color: var(--navy-soft); border-radius: 6px; padding: 4px 10px; font-size: var(--text-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.copy-btn:hover { border-color: var(--teal); color: var(--teal); }
.copy-btn svg { width: 13px; height: 13px; }

.lang-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-btn { border: 1px solid var(--border-mid); background: var(--surface); border-radius: 20px; padding: 6px 14px; font-size: var(--text-sm); font-weight: 600; color: var(--navy); }
.lang-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.data-note { font-size: var(--text-xs); color: var(--navy-soft); background: var(--surface-alt); border-radius: 6px; padding: 6px 10px; display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .22s; width: var(--sidebar-w); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-toggle { display: grid; place-items: center; background: none; border: none; padding: 4px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; background: rgba(24,28,44,0.4); z-index: 85; display: none; }
  .scrim.open { display: block; }
}
@media (max-width: 560px) {
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: 6px; }
}

/* ============================================================
   v2 ADDITIONS — TeacherOS brand extended
   ============================================================ */
:root {
  --gold:       #D48A1F;   /* warnings */
  --gold-soft:  #FBEED6;
  --blue:       #3A6AD4;   /* mastered / info */
  --blue-soft:  #ECF2FE;
  /* chart palette derived from brand */
  --chart-teal:  #6E56C7;
  --chart-coral: #3A6AD4;
  --chart-gold:  #D48A1F;
  --chart-navy:  #181C2C;
  --chart-green: #3FA06B;
  --chart-blue:  #3A6AD4;
}

/* ---- Fraunces for editorial/heading moments; Inter stays for UI chrome ---- */
.page-title, .card-head h3, .modal-title, .brand-product, .page-intro h2,
h1, h2 { font-family: var(--font-display, 'Fraunces', Georgia, serif); font-weight: 500; letter-spacing: -0.01em; }

/* ---- AI-generated content card (purple->blue gradient rail + soft fill) ---- */
.ai-card { position: relative; background: var(--grad-ai-soft, linear-gradient(135deg,#F3F0FB,#ECF2FE)); border: 1px solid var(--purple-200, #C9BCEE); border-radius: var(--radius); }
.ai-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: var(--radius) 0 0 var(--radius); background: var(--grad-ai, linear-gradient(135deg,#6E56C7,#3A6AD4)); }
.ai-rail-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--text-sm); background: var(--grad-ai, linear-gradient(135deg,#6E56C7,#3A6AD4)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ai-rail-title svg { width: 14px; height: 14px; stroke: var(--teal); }

/* ---- Microsoft 365 header connect ---- */
.topbar-right .m365 { display: flex; align-items: center; gap: 8px; }
.m365-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: var(--text-sm); font-weight: 600; color: var(--navy); }
.m365-btn:hover { border-color: var(--teal); color: var(--teal); }
.m365-btn .ms-logo { width: 15px; height: 15px; display: inline-grid; grid-template-columns: 1fr 1fr; gap: 1.5px; }
.m365-btn .ms-logo i { display: block; width: 100%; height: 100%; }
.m365-btn .ms-logo i:nth-child(1){ background:#F25022; } .m365-btn .ms-logo i:nth-child(2){ background:#7FBA00; }
.m365-btn .ms-logo i:nth-child(3){ background:#00A4EF; } .m365-btn .ms-logo i:nth-child(4){ background:#FFB900; }
.m365-user { display: flex; align-items: center; gap: 9px; background: var(--teal-tint); border: 1px solid #B9DDE2;
  border-radius: 20px; padding: 5px 12px 5px 6px; }
.m365-user .avatar { width: 26px; height: 26px; font-size: 0.7rem; background: var(--teal); }
.m365-user .mu-name { font-size: var(--text-sm); font-weight: 700; line-height: 1.1; color: var(--navy); }
.m365-user .mu-org { font-size: 0.66rem; color: var(--navy-soft); }
.m365-user .mu-out { background: none; border: none; color: var(--navy-soft); padding: 2px; border-radius: 5px; display: grid; place-items: center; }
.m365-user .mu-out:hover { background: rgba(0,0,0,.06); color: var(--red); }
.m365-user .mu-out svg { width: 15px; height: 15px; }

/* CTA card when M365 not connected */
.connect-cta { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--teal-tint), var(--surface));
  border: 1px dashed var(--teal); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.connect-cta .cc-icon { width: 44px; height: 44px; border-radius: 10px; background: #fff; border: 1px solid var(--border);
  display: grid; place-items: center; flex-shrink: 0; }
.connect-cta h4 { font-size: var(--text-base); margin-bottom: 2px; }
.connect-cta p { font-size: var(--text-sm); color: var(--navy-soft); }

/* ---- Sidebar Upcoming IEP Events widget ---- */
.side-widget { margin-top: 14px; padding: 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.side-widget h5 { font-size: 0.66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--navy-soft); margin-bottom: 8px; font-weight: 700; }
.side-ev { font-size: 0.72rem; color: var(--navy-soft); padding: 6px 0; border-bottom: 1px solid var(--border); }
.side-ev:last-child { border-bottom: none; }
.side-ev .ev-t { font-weight: 600; color: var(--navy); display: block; }
.side-ev .ev-d { color: var(--navy-soft); }
.side-widget .empty-mini { font-size: 0.72rem; color: var(--navy-soft); }

/* ---- Model badge (AI transparency) ---- */
.model-badge { display: inline-flex; align-items: center; gap: 5px; background: var(--grad-ai-soft, var(--teal-soft)); color: var(--teal-hover);
  border: 1px solid var(--purple-200, #C9BCEE); border-radius: 20px; padding: 3px 10px; font-size: var(--text-xs); font-weight: 700; }
.model-badge svg { width: 12px; height: 12px; }

/* ---- Progress monitoring ---- */
.pill-blue { background: var(--blue-soft); color: #084C6E; } .pill-blue .dot { background: var(--blue); }
.pm-table td, .pm-table th { white-space: nowrap; }
.pm-quarter { cursor: pointer; text-align: center; font-variant-numeric: tabular-nums; border-radius: 6px; transition: background .1s; }
.pm-quarter:hover { background: var(--teal-tint); }
.pm-quarter.empty-cell { color: var(--border-mid); }
.chart-card { padding: 16px 18px; }
.chart-card h4 { font-size: var(--text-base); margin-bottom: 2px; }
.chart-card .chart-sub { font-size: var(--text-xs); color: var(--navy-soft); margin-bottom: 12px; }
.chart-box { position: relative; height: 200px; }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 20px; }
@media (max-width: 760px){ .charts-grid { grid-template-columns: 1fr; } }

/* Heatmap */
.heatmap { border-collapse: separate; border-spacing: 4px; }
.heatmap th { font-size: var(--text-xs); color: var(--navy-soft); font-weight: 700; padding: 4px 8px; text-align: center; }
.heatmap td.hm-name { text-align: left; font-weight: 600; font-size: var(--text-sm); white-space: nowrap; padding-right: 10px; }
.hm-cell { width: 92px; height: 40px; border-radius: 7px; text-align: center; vertical-align: middle; font-size: var(--text-xs);
  font-weight: 700; color: #fff; cursor: default; }
.hm-green  { background: var(--green); }
.hm-yellow { background: var(--gold); }
.hm-red    { background: var(--red); }
.hm-blue   { background: var(--blue); }
.hm-empty  { background: var(--surface-alt); color: var(--navy-soft); }

/* ---- Bulk actions ---- */
.bulk-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.bulk-btn { display: flex; align-items: flex-start; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; transition: border-color .12s, box-shadow .12s; }
.bulk-btn:hover:not(:disabled) { border-color: var(--teal); box-shadow: var(--shadow-md); }
.bulk-btn:disabled { opacity: .5; cursor: not-allowed; }
.bulk-btn .bb-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--teal-tint); color: var(--teal);
  display: grid; place-items: center; flex-shrink: 0; }
.bulk-btn .bb-icon svg { width: 18px; height: 18px; }
.bulk-btn .bb-title { font-weight: 700; font-size: var(--text-base); }
.bulk-btn .bb-desc { font-size: var(--text-xs); color: var(--navy-soft); margin-top: 2px; }
.sel-bar { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 16px; font-size: var(--text-sm); font-weight: 600; }
.sel-bar .sel-count { background: var(--coral); border-radius: 20px; padding: 2px 10px; font-weight: 800; }
.progress-bar { height: 8px; background: var(--surface-alt); border-radius: 20px; overflow: hidden; margin: 10px 0; }
.progress-bar > div { height: 100%; background: var(--teal); transition: width .3s; border-radius: 20px; }
.job-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.job-row:last-child { border-bottom: none; }
.job-row .job-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-alt); color: var(--navy-soft); display: grid; place-items: center; flex-shrink: 0; }
.job-row .job-ic svg { width: 16px; height: 16px; }
.sev-high { color: var(--red); font-weight: 700; }
.sev-med { color: var(--gold); font-weight: 700; }
.sev-low { color: var(--navy-soft); }

/* ---- Parent portal ---- */
.portal-frame { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.portal-head { background: var(--teal); color: #fff; padding: 18px 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.portal-head .avatar { background: rgba(255,255,255,.22); width: 44px; height: 44px; font-size: 1rem; }
.portal-head h3 { color: #fff; font-size: var(--text-md); }
.portal-head .ph-sub { color: #D6ECEF; font-size: var(--text-sm); }
.portal-lang { margin-left: auto; }
.portal-lang select { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius-sm); padding: 7px 10px; font-weight: 600; }
.portal-lang select option { color: var(--navy); }
.portal-body { padding: 22px; }
.portal-section { margin-bottom: 24px; }
.portal-section > h4 { font-size: var(--text-base); color: var(--teal); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.goal-plain { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.goal-plain .gp-title { font-weight: 700; margin-bottom: 4px; }
.goal-plain .gp-track { height: 8px; background: var(--surface-alt); border-radius: 20px; overflow: hidden; margin: 8px 0; }
.goal-plain .gp-track > div { height: 100%; border-radius: 20px; }

/* chat */
.chat-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.chat-scroll { max-height: 320px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: var(--text-sm); line-height: 1.5; position: relative; }
.bubble .b-meta { font-size: 0.62rem; opacity: .7; margin-top: 4px; }
.bubble.teacher { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.bubble.parent { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--navy); border-bottom-left-radius: 4px; }
.bubble .b-alt { font-size: 0.72rem; opacity: .75; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,.25); font-style: italic; }
.bubble.parent .b-alt { border-top-color: var(--border); }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.rtl { direction: rtl; text-align: right; }

/* share link box */
.share-link { display: flex; align-items: center; gap: 8px; background: var(--surface-alt); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 8px 12px; font-family: ui-monospace, monospace; font-size: var(--text-sm); }
.share-link input { border: none; background: none; flex: 1; font-family: inherit; font-size: inherit; color: var(--navy); outline: none; }

/* notif prefs */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; max-width: 340px; cursor: pointer; }
.pref-row .pref-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-alt); display: grid; place-items: center; color: var(--navy-soft); }
.pref-row .pref-ic svg { width: 16px; height: 16px; }
.pref-row .pref-name { display: inline-flex; align-items: center; gap: 10px; font-size: var(--text-base); color: var(--navy); }
.pref-row .pref-name svg { width: 18px; height: 18px; color: var(--navy-soft); flex-shrink: 0; }

/* voice profile */
.voice-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.voice-item:last-child { border-bottom: none; }
.voice-item svg { width: 16px; height: 16px; color: var(--teal); flex-shrink: 0; margin-top: 2px; }

/* editable AI output */
.editable-out { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 60px;
  font-size: var(--text-base); line-height: 1.6; white-space: pre-wrap; background: var(--surface); }
.editable-out:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); outline: none; }
.edit-hint { font-size: var(--text-xs); color: var(--navy-soft); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* checkbox cell in tables */
.row-check { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }

/* ---- v2 supplemental classes (progress, heatmap, bulk, parent portal) ---- */
/* progress monitoring tabs */
.pm-tabs { display: inline-flex; gap: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 18px; }
.pm-tab { border: none; background: none; padding: 7px 16px; border-radius: 5px; font-size: var(--text-sm); font-weight: 600; color: var(--navy-soft); cursor: pointer; }
.pm-tab.active { background: var(--surface); color: var(--teal); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pm-goal-metric { font-size: var(--text-xs); color: var(--navy-soft); }

/* chart card header */
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-head h4 { font-size: var(--text-base); }

/* small text link button */
.link-btn { background: none; border: none; color: var(--teal); font-size: var(--text-sm); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }

/* heatmap layout */
.hm-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: var(--text-xs); color: var(--navy-soft); }
.hm-key { display: inline-flex; align-items: center; gap: 6px; }
.hm-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.hm-swatch.hm-green { background: var(--green); } .hm-swatch.hm-yellow { background: var(--gold); }
.hm-swatch.hm-red { background: var(--red); } .hm-swatch.hm-blue { background: var(--blue, #006494); }
.hm-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hm-student { width: 150px; flex-shrink: 0; font-size: var(--text-sm); font-weight: 600; color: var(--navy); cursor: pointer; }
.hm-student:hover { color: var(--teal); text-decoration: underline; }
.hm-cells { display: flex; gap: 6px; flex-wrap: wrap; }
.hm-cell.hm-green { color: #fff; } .hm-cell.hm-yellow { color: #4a3600; } .hm-cell.hm-red { background: var(--red); color: #fff; } .hm-cell.hm-blue { background: var(--blue, #006494); color: #fff; }
.hm-cell.hm-none { background: var(--surface-alt); color: var(--navy-soft); border: 1px dashed var(--border-mid); }

/* bulk select bar */
.sel-actions { display: inline-flex; gap: 6px; align-items: center; }

/* bulk job history rows */
.job-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; flex-shrink: 0; }
.job-icon svg { width: 18px; height: 18px; }
.job-main { flex: 1; min-width: 0; }
.job-title { font-weight: 700; font-size: var(--text-base); display: flex; align-items: center; gap: 8px; }
.job-outcome { font-size: var(--text-sm); color: var(--navy-soft); margin-top: 2px; }
.job-detail { font-size: var(--text-xs); color: var(--navy-soft); margin-top: 2px; }
.job-meta { text-align: right; flex-shrink: 0; }
.job-time { font-size: var(--text-xs); color: var(--navy-soft); }

/* parent portal branding */
.portal-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.portal-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.portal-sub { font-size: var(--text-sm); color: var(--navy-soft); }
.portal-section { margin-top: 20px; }
.portal-meeting { display: flex; align-items: center; gap: 12px; background: var(--teal-tint); border: 1px solid var(--teal-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: var(--text-sm); }
.pm-meet-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--teal); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.pm-meet-icon svg { width: 20px; height: 20px; }

/* translated goal progress bar */
.goal-bar { height: 8px; background: var(--surface-alt); border-radius: 20px; overflow: hidden; margin: 8px 0; }
.goal-bar-fill { height: 100%; border-radius: 20px; background: var(--teal); }
.goal-bar-fill.goal-green { background: var(--green); } .goal-bar-fill.goal-yellow { background: var(--gold); }
.goal-bar-fill.goal-red { background: var(--red); } .goal-bar-fill.goal-blue { background: var(--blue, #006494); }

/* toggle switch (notification prefs) */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-mid); border-radius: 20px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--teal); }
.switch input:checked + .slider::before { transform: translateX(16px); }

@media (max-width: 560px){
  .bulk-actions { grid-template-columns: 1fr; }
  .portal-lang { margin-left: 0; width: 100%; }
  .portal-lang select { width: 100%; }
}
