/* ============================================================
   eAsistent app dashboard - dark only.
   Design tokens and components follow the "root" dashboard:
   flat panels, hairline borders, orange for what you can act on.
   ============================================================ */
:root {
  color-scheme: dark;
  --bg: #121212;
  --side: #0e0e0e;
  --surface: #1a1a19;
  --surface-2: #222221;
  --surface-3: #2b2b29;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #898781;

  --accent: #ff9500;
  --accent-hover: #ffa62b;
  --accent-soft: rgba(255, 149, 0, 0.13);
  --on-accent: #1a1a19;

  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;

  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;

  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --font-display: "Syne", "IBM Plex Sans", sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --side-w: 248px;
  --top-h: 56px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
code, kbd { font-family: var(--font-mono); }
kbd {
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text-3);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex-shrink: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); }
.sep { display: inline-block; width: 3px; height: 3px; margin: 0 10px; border-radius: 50%; background: var(--text-3); vertical-align: middle; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ——— shell ——— */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app.bare { display: block; }
.col { min-width: 0; display: flex; flex-direction: column; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
  overflow-y: auto; z-index: 60;
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 20px; flex-shrink: 0; text-decoration: none; }
.brand img { display: block; width: 26px; height: 26px; }
.brand b { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand b span { color: var(--accent); }
.nav-h { padding: 18px 20px 6px; font-size: 12px; color: var(--text-3); }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  height: 36px; margin: 1px 10px; padding: 0 10px;
  border-radius: 7px; color: var(--text-2); font-weight: 500; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; text-align: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 16px 20px 20px; border-top: 1px solid var(--line); color: var(--text-3); }
.side-foot small { font-size: 12px; }
.scrim { display: none; }

.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 20px;
  background: rgba(18, 18, 18, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
.app.side-collapsed .side { display: none; }
.conn {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); cursor: pointer;
  transition: border-color 0.15s;
}
.conn:hover { border-color: rgba(255, 255, 255, 0.28); }
.conn-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.conn-text small { font-size: 11.5px; color: var(--text-3); }
.search-btn {
  display: flex; align-items: center; gap: 10px;
  width: min(330px, 28vw); height: 36px; padding: 0 8px 0 11px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--text-3); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.search-btn:hover { border-color: rgba(255, 255, 255, 0.28); color: var(--text-2); }
.search-btn span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.lang { display: flex; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; }
.lang button { height: 28px; padding: 0 9px; border: 0; border-radius: 6px; background: none; color: var(--text-3); font-size: 12px; font-weight: 500; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.user {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px 0 5px;
  border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer;
}
.user:hover { background: var(--surface-3); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px; text-transform: uppercase; }

.main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 24px 24px 72px; outline: none; transition: opacity 0.15s; }
.main.is-loading { opacity: 0.55; }

/* ——— page ——— */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.page-sub { margin-top: 6px; color: var(--text-2); }
.page-actions, .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.grid > * { min-width: 0; }
.grid > [class*="span-"]:not(.stack) > * { height: 100%; }   /* single panels fill their cell; stacks keep natural heights */
.stack > * + * { margin-top: 16px; }
.sub-h { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.sub-h:first-child { margin-top: 0; }
.page-actions + .setting, .page-actions + .notice { margin-top: 14px; }
.hero-day { margin-bottom: 4px; }
.sessions { margin-top: 24px; }
.panel-body > .page-actions { margin-top: 14px; }
.page-actions + .sub-h { margin-top: 24px; }
.chk { margin: 4px 0 12px; }
.seg + .hint { margin-top: 12px; }
.field-err { margin-bottom: 4px; }

/* ——— panels ——— */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; padding: 14px 16px 0; }
.panel-titles h2 { font-size: 15px; font-weight: 600; line-height: 1.3; }
.panel-titles p { margin-top: 1px; font-size: 12.5px; color: var(--text-3); }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 14px 16px 16px; }
.panel.danger { border-color: rgba(208, 59, 59, 0.4); }

/* ——— buttons ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 500; font-size: 13.5px; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn.danger { background: transparent; border-color: rgba(208, 59, 59, 0.55); color: #ef7d7d; }
.btn.danger:hover:not(:disabled) { background: rgba(208, 59, 59, 0.12); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.wide { width: 100%; height: 42px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12.5px; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ——— segmented switch ——— */
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-3); font-size: 12.5px; cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.seg.full { display: flex; } .seg.full .seg-btn { flex: 1; justify-content: center; height: 32px; }

/* ——— status, pills ——— */
.status { display: inline-flex; align-items: center; gap: 8px; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sdot.ok { background: var(--good); } .sdot.warn { background: var(--warn); } .sdot.bad { background: var(--crit); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.accent { border-color: rgba(255, 149, 0, 0.45); color: var(--accent); background: var(--accent-soft); }
.pill.good { border-color: rgba(12, 163, 12, 0.5); color: #4cc84c; }
.pill.warn { border-color: rgba(250, 178, 25, 0.45); color: var(--warn); }
.pill.bad { border-color: rgba(208, 59, 59, 0.5); color: #ef7d7d; }
.pill.info { border-color: rgba(57, 135, 229, 0.5); color: #6aa6ee; }

/* ——— banner / notice ——— */
.banner { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 12px 10px 14px; border: 1px solid rgba(250, 178, 25, 0.32); border-radius: var(--r-md); background: rgba(250, 178, 25, 0.07); }
.banner > .icon { color: var(--warn); }
.banner.bad { border-color: rgba(208, 59, 59, 0.4); background: rgba(208, 59, 59, 0.08); }
.banner.bad > .icon { color: #ef7d7d; }
.banner-text { flex: 1; color: var(--text-2); }
.banner-text strong { color: var(--text); }
.notice { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.notice .icon { margin-top: 1px; color: var(--text-3); }

/* ——— tiles ——— */
.tile { height: 100%; padding: 14px 16px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.tile-num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-unit { color: var(--text-3); font-size: 14px; }
.tile-delta { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.tile-delta.good { color: var(--good); } .tile-delta.warn { color: var(--warn); }

/* ——— lists ——— */
.rows { margin: -10px 0; }
.rowi { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rowi:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--text-3); }
.feed { margin: -9px 0; }
.feed-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.feed-ico.add { color: var(--good); } .feed-ico.chg { color: var(--warn); } .feed-ico.del { color: var(--serious); }
.feed-time { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.feed-sum { overflow-wrap: anywhere; }
.empty { padding: 28px 12px; text-align: center; color: var(--text-3); }
.empty .icon { display: block; margin: 0 auto 10px; opacity: 0.6; }
.day-h { margin: 18px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.day-h:first-child { margin-top: 0; }

/* ——— lessons ——— */
.les { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.les:last-child { border-bottom: 0; }
.les-time { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.les-time small { display: block; color: var(--text-3); font-weight: 400; font-size: 12px; }
.les-title { font-weight: 600; font-size: 15px; }
.les-meta { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.les-test { margin-top: 6px; color: var(--accent); font-size: 12.5px; font-weight: 500; }
.les-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.les.cancelled .les-title { text-decoration: line-through; color: var(--text-3); }
.les.event .les-title { font-weight: 500; color: var(--text-2); }
.hero-day { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-day h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }

/* ——— timetable grid ——— */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label { min-width: 150px; text-align: center; font-weight: 500; }
.tt { display: grid; grid-template-columns: 78px repeat(var(--cols, 5), minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.tt > div { padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.tt-h { background: var(--surface-2); text-align: center; font-weight: 600; padding: 10px 8px !important; }
.tt-h small { display: block; color: var(--text-3); font-weight: 400; font-size: 12px; }
.tt-h.today { color: var(--accent); }
.tt-hr { background: var(--surface-2); color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.tt-hr b { display: block; color: var(--text); font-size: 13px; }
.tt-cell.today { background: rgba(255, 149, 0, 0.04); }
.lcard { padding: 6px 8px; border-radius: 6px; background: var(--surface-2); border-left: 3px solid var(--s1); font-size: 13px; }
.lcard + .lcard { margin-top: 5px; }
.lcard b { display: block; font-weight: 600; }
.lcard span { display: block; color: var(--text-3); font-size: 12px; }
.lcard.test { border-left-color: var(--accent); background: var(--accent-soft); }
.lcard.sub { border-left-color: var(--warn); }
.lcard.cancelled { border-left-color: var(--crit); opacity: 0.6; }
.lcard.cancelled b { text-decoration: line-through; }
.lcard.event { border-left-color: var(--text-3); }
.tt-allday { grid-column: 1 / -1; background: var(--surface-2); color: var(--text-2); }
.tt-mobile { display: none; }

/* ——— tests ——— */
.month-h { margin: 22px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.month-h:first-child { margin-top: 0; }
.trow { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.tdate { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 48px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); line-height: 1.1; }
.tdate b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tdate span { color: var(--text-3); font-size: 11px; text-transform: uppercase; }
.trow.soon .tdate { border-color: rgba(255, 149, 0, 0.5); background: var(--accent-soft); }
.trow.soon .tdate b { color: var(--accent); }
.trow-title { font-weight: 600; }
.trow-meta { color: var(--text-3); font-size: 12.5px; }

/* ——— forms ——— */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .ctl-label-txt { color: var(--text-2); font-size: 12.5px; }
.field-input {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text); outline: none; min-width: 0; width: 100%;
  transition: border-color 0.15s;
}
.field.big .field-input { height: 40px; }
.field-input:focus { border-color: var(--accent); }
.field-input[aria-invalid="true"] { border-color: var(--serious); }
.field-input:disabled { opacity: 0.5; }
.field-input[readonly] { color: var(--text-2); }
.field-err { color: var(--serious); font-size: 12.5px; }
.hint { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.form-row { display: flex; gap: 12px; } .form-row > * { flex: 1; min-width: 0; }
.chk { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); cursor: pointer; }
.chk input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }
.chk small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.copybox { display: flex; flex-wrap: wrap; gap: 8px; }
.copybox .field-input { flex: 1 1 220px; }
.copybox .field-input { font-family: var(--font-mono); font-size: 12.5px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting-text { flex: 1; min-width: 0; }
.setting > :last-child { flex-shrink: 0; }
.setting .field-input { width: auto; min-width: 150px; }
.setting-text strong { display: block; font-weight: 500; }
.setting-text small { color: var(--text-3); font-size: 12.5px; }
.switch { position: relative; flex-shrink: 0; width: 38px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background 0.2s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch:disabled { opacity: 0.4; cursor: not-allowed; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform 0.2s var(--ease); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(16px); background: var(--on-accent); }
.steps { counter-reset: s; display: grid; gap: 8px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--text-2); font-size: 13px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }

/* ——— tables ——— */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 8px 12px; background: var(--surface-2); color: var(--text-3); font-weight: 500; text-align: left; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table td.actions { text-align: right; white-space: nowrap; }
.data-table td.actions .btn + .btn { margin-left: 6px; }

/* ——— popover / menu ——— */
.popover { position: fixed; z-index: 200; min-width: 220px; padding: 6px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); animation: pop 0.14s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--surface-3); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-user { display: flex; flex-direction: column; padding: 6px 10px; }
.menu-user small { color: var(--text-3); }

/* ——— modal ——— */
.modal-overlay, .pal-overlay { position: fixed; inset: 0; z-index: 300; display: flex; justify-content: center; background: rgba(8, 8, 8, 0.66); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.18s; }
.modal-overlay { align-items: center; }
.modal-overlay.in { opacity: 1; }
.modal { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); transform: translateY(8px); transition: transform 0.2s var(--ease); }
.modal-overlay.in .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0 20px; }
.modal-head h2 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 14px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }

/* ——— command palette ——— */
.pal-overlay { align-items: flex-start; padding-top: 13vh; opacity: 1; }
.palette { width: min(580px, calc(100vw - 24px)); max-height: 60vh; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); overflow: hidden; animation: pop 0.14s var(--ease); }
.pal-top { display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.pal-input { flex: 1; height: 52px; border: 0; background: none; outline: none; color: var(--text); font-size: 15px; }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); text-align: left; cursor: pointer; }
.pal-item.sel { background: var(--accent-soft); color: var(--text); }
.pal-item.sel .icon { color: var(--accent); }
.pal-label { flex: 1; }
.pal-hint { color: var(--text-3); font-size: 12.5px; }
.pal-empty { padding: 22px; color: var(--text-3); text-align: center; }

/* ——— toasts ——— */
.toasts { position: fixed; top: 66px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(380px, calc(100vw - 36px)); padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-3); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.2s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast.ok .icon { color: var(--good); } .toast.error .icon { color: var(--serious); }

/* ——— sign-in / register: split screen ——— */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.auth-art { display: flex; flex-direction: column; justify-content: space-between; gap: 36px; padding: 40px clamp(32px, 5vw, 72px); background: var(--side); border-right: 1px solid var(--line); }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.auth-brand img { width: 30px; height: 30px; }
.auth-brand span { color: var(--accent); }
.auth-pitch h2 { max-width: 13em; font-family: var(--font-display); font-size: clamp(2rem, 3.3vw, 3rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.025em; }
.auth-lead { max-width: 34em; margin-top: 16px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.auth-preview { width: min(470px, 100%); margin-top: 32px; pointer-events: none; user-select: none; }
.auth-preview .panel-body { padding: 4px 18px 6px; }
.auth-prev-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 8px; }
.auth-prev-head strong { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
.auth-preview .les { opacity: 0; animation: rise 0.55s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.auth-cap { margin-top: 12px; color: var(--text-3); font-size: 12.5px; }
.auth-feats { display: grid; gap: 10px; color: var(--text-2); font-size: 13.5px; }
.auth-feats li { display: flex; align-items: center; gap: 10px; }
.auth-feats .icon { color: var(--accent); }

.auth-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-lang { position: absolute; top: 18px; right: 20px; }
.auth-card { width: min(396px, 100%); }
.auth-mbrand { display: none; margin-bottom: 28px; }
.auth-card h1 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; }
.auth-sub { margin: 8px 0 24px; color: var(--text-2); line-height: 1.5; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .field-input { height: 44px; font-size: 15px; }
.auth-card .btn.wide { height: 44px; font-size: 14.5px; }
.auth-card .field > label { font-weight: 500; }
.pw-wrap { position: relative; }
.pw-wrap .field-input { padding-right: 46px; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.meter { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.meter i { flex: 0 0 38px; height: 4px; border-radius: 2px; background: var(--surface-3); transition: background 0.2s; }
.meter.l1 i:nth-child(-n+1) { background: var(--serious); }
.meter.l2 i:nth-child(-n+2) { background: var(--warn); }
.meter.l3 i:nth-child(-n+3) { background: var(--s3); }
.meter.l4 i:nth-child(-n+4) { background: var(--good); }
.meter span { margin-left: 8px; color: var(--text-3); font-size: 12.5px; }
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.progress .bars { display: flex; flex: 1; gap: 6px; }
.progress .bars i { flex: 1; height: 3px; border-radius: 2px; background: var(--surface-3); }
.progress .bars i.on { background: var(--accent); }
.progress small { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.alert { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding: 10px 12px; border: 1px solid rgba(208, 59, 59, 0.4); border-radius: 8px; background: rgba(208, 59, 59, 0.08); font-size: 13px; line-height: 1.45; }
.alert .icon { color: #ef7d7d; margin-top: 1px; }
.alert.info { border-color: rgba(250, 178, 25, 0.35); background: rgba(250, 178, 25, 0.07); }
.alert.info .icon { color: var(--warn); }
.optin { margin: 4px 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.optin-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.optin-row strong { display: block; font-weight: 500; }
.optin-row small { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.optin details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.optin summary { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); cursor: pointer; }
.optin details p { margin-top: 6px; }
.btn-row { display: flex; gap: 10px; } .btn-row .btn { flex: 1; } .btn-row .btn.ghost { flex: 0 0 auto; padding: 0 18px; }
.auth-card > .hint { margin-bottom: 22px; }
.auth-switch { margin-top: 22px; color: var(--text-3); font-size: 13.5px; }
.auth-switch .link { font-size: 13.5px; }
.spin { width: 15px; height: 15px; border: 2px solid rgba(26, 26, 25, 0.35); border-top-color: var(--on-accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 20px; border: 1px solid rgba(255, 149, 0, 0.4); border-radius: 14px; background: var(--accent-soft); color: var(--accent); }

.loading-screen { display: grid; place-items: center; min-height: 100vh; color: var(--text-3); }

/* ——— responsive ——— */
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-mbrand { display: inline-flex; }
  .auth-main { justify-content: flex-start; padding-top: 72px; }
}
@media (max-width: 1180px) {
  .span-8, .span-4 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .side-open .side { transform: none; box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6); }
  .side-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.55); }
  .app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app.side-collapsed .side { display: flex; }
  .span-6, .span-7, .span-5 { grid-column: span 12; }
  .user-name, .conn-text small { display: none; }
}
@media (max-width: 720px) {
  .main { padding: 16px 14px 60px; }
  .top { padding: 0 12px; gap: 6px; }
  .search-btn { width: 36px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .tt { display: none; }
  .tt-mobile { display: block; }
  .les { grid-template-columns: 88px minmax(0, 1fr); }
  .les-time { white-space: nowrap; font-size: 13px; }
  .les-tags { grid-column: 2; justify-content: flex-start; }
  .form-row { flex-direction: column; gap: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .conn-text { max-width: 90px; }
}
@media (max-width: 520px) {
  .tile { padding: 12px 12px 14px; } .tile-num { font-size: 24px; }
  .span-3 { grid-column: span 6; }
  .lang button { padding: 0 7px; }
  .trow { grid-template-columns: 46px minmax(0, 1fr); } .trow > :last-child { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .auth-preview .les { opacity: 1; }
}

/* ——— tests: long eAsistent labels stay on one line ——— */
.trow .les-tags .pill { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.ctl-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; cursor: pointer; }
textarea.field-input { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.dl { margin: 0; }
.dl .kv { grid-template-columns: 110px minmax(0, 1fr); padding: 7px 0; }
.modal-foot .grow { flex: 1; }

/* ——— calendar: FullCalendar, themed with the dashboard tokens ——— */
.cal-panel { padding: 14px 16px 16px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--surface-2); --fc-neutral-text-color: var(--text-3);
  --fc-today-bg-color: rgba(255, 149, 0, 0.055); --fc-now-indicator-color: var(--accent); --fc-event-bg-color: var(--surface-3);
  --fc-event-border-color: var(--s1); --fc-event-text-color: var(--text); --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-highlight-color: var(--accent-soft); --fc-more-link-bg-color: var(--surface-3); --fc-more-link-text-color: var(--text-2);
  --fc-non-business-color: transparent; font-family: var(--font-ui); font-size: 13px; }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.fc .fc-toolbar-title::first-letter { text-transform: uppercase; }
.fc .fc-toolbar-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.fc .fc-button { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text);
  font: 500 13px var(--font-ui); text-transform: none; box-shadow: none !important; }
.fc .fc-button:hover { background: var(--surface-3); }
.fc .fc-button-primary:disabled { opacity: 0.45; background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--accent-soft); border-color: rgba(255, 149, 0, 0.45); color: var(--accent); }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.fc-theme-standard .fc-scrollgrid, .fc-theme-standard td, .fc-theme-standard th { border-color: var(--line); }
.fc .fc-scrollgrid { border-radius: 8px; overflow: hidden; }
.fc .fc-col-header-cell { background: var(--surface-2); }
.fc .fc-col-header-cell-cushion { padding: 10px 4px; color: var(--text-2); font-weight: 600; text-decoration: none; text-transform: capitalize; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--accent); }
.fc .fc-timegrid-slot { height: 2.3em; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.fc .fc-timegrid-slot-minor { border-top-style: dotted; border-top-color: rgba(255, 255, 255, 0.04); }
.fc .fc-daygrid-day-number { padding: 6px 8px; color: var(--text-2); text-decoration: none; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent); font-weight: 600; }
.fc .fc-day-other .fc-daygrid-day-top { opacity: 0.4; }
.fc .fc-timegrid-now-indicator-line { border-color: var(--accent); }
.fc .fc-timegrid-now-indicator-arrow { border-color: var(--accent); border-top-color: transparent; border-bottom-color: transparent; }
.fc .fc-highlight { background: var(--accent-soft); }
.fc .fc-popover { background: var(--surface-2); border-color: var(--line-2); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); }
.fc .fc-popover-header { background: var(--surface-3); color: var(--text); }
.fc .fc-more-link { color: var(--text-2); font-weight: 500; }
.fc-event { border-style: solid; border-width: 0 0 0 3px; border-radius: 6px; padding: 1px 4px; cursor: pointer; font-size: 12.5px; box-shadow: none; }
.fc-event .fc-event-main { color: inherit; }
.fc-daygrid-event { padding: 1px 6px; }
.ev-main b { display: block; font-weight: 600; line-height: 1.25; }
.ev-main span { display: block; color: var(--text-3); font-size: 11.5px; line-height: 1.3; }
.fc-event.ev-test { background: var(--accent-soft); border-color: var(--accent); }
.fc-event.ev-sub { border-color: var(--warn); }
.fc-event.ev-cancelled { border-color: var(--crit); opacity: 0.6; }
.fc-event.ev-cancelled .ev-main b, .fc-event.ev-cancelled .fc-event-title { text-decoration: line-through; }
.fc-event.ev-event { border-color: var(--text-3); }
.fc-event.ev-holiday { background: rgba(12, 163, 12, 0.14); border-color: var(--good); }
.fc-event.ev-custom { background: rgba(57, 135, 229, 0.16); border-color: var(--s1); }
.fc-event.ev-hidden { opacity: 0.4; }
.fc-event.ev-loose { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.fc .fc-list { border-color: var(--line); }
.fc .fc-list-day-cushion { background: var(--surface-2); }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--text-2); text-decoration: none; }
.fc .fc-list-day-text::first-letter { text-transform: uppercase; }
.fc .fc-list-event td { border-color: var(--line); }
.fc .fc-list-event-dot { border-color: var(--s1); }
.fc .fc-list-empty { background: transparent; color: var(--text-3); }
@media (max-width: 720px) {
  .cal-panel { padding: 10px; }
  .fc .fc-toolbar.fc-header-toolbar { justify-content: center; }
  .fc .fc-toolbar-title { font-size: 1.05rem; }
}

/* ——— subjects page ——— */
.modal.wide { width: min(800px, calc(100vw - 32px)); }
.spin.light { border-color: rgba(255, 255, 255, 0.18); border-top-color: var(--accent); }
.scanbox { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.scanbox .scan-info { flex: 1; min-width: 240px; }
.scanbox strong { display: block; font-weight: 600; }
.scanbox p { margin-top: 2px; color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.scan-state { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.subj-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0 12px; }
.subj-tools .field-input { width: min(320px, 100%); }
.subj { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.subj:last-child { border-bottom: 0; }
.subj-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.subj-title strong { font-weight: 600; }
.subj-title .orig { color: var(--text-3); font-size: 12.5px; }
.subj.is-hidden .subj-title strong { color: var(--text-3); text-decoration: line-through; }
.subj-meta { margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip.mod { border-color: rgba(57, 135, 229, 0.5); color: #6aa6ee; }
.chip.off { opacity: 0.5; text-decoration: line-through; }
.subj-actions { display: flex; align-items: center; gap: 12px; }
.srow { display: grid; grid-template-columns: minmax(130px, 1.3fr) 48px minmax(84px, 1fr) minmax(84px, 1fr) minmax(90px, 1.3fr); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.srow.head { padding: 0 0 6px; color: var(--text-3); font-size: 12px; border-bottom: 1px solid var(--line-2); }
.srow .field-input { height: 32px; padding: 0 8px; }
.srow .slot-name { font-variant-numeric: tabular-nums; }
.srow .slot-name small { display: block; color: var(--text-3); font-size: 12px; }
.srow.orphan { opacity: 0.75; grid-template-columns: minmax(0, 1fr) auto; }
.warns { display: grid; gap: 8px; margin-top: 14px; }
.warns .w { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; }
.warns .w .icon { margin-top: 1px; }
.warns .w.warn { border: 1px solid rgba(250, 178, 25, 0.35); background: rgba(250, 178, 25, 0.07); }
.warns .w.warn .icon { color: var(--warn); }
.warns .w.info { border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.warns .w.ok { color: var(--text-3); padding-left: 2px; }
.warn-list { margin: 8px 0 0; padding-left: 18px; list-style: disc; display: grid; gap: 6px; color: var(--text-2); font-size: 13px; }
.fc-event.ev-modified { border-left-style: dashed; }
@media (max-width: 720px) {
  .subj { grid-template-columns: 1fr; }
  .srow, .srow.head { grid-template-columns: 1fr 1fr; }
  .srow.head { display: none; }
}
