/* Acadelta platform console. Light, calm, built for long working sessions. */
:root {
  --bg: #f7f8f9;
  --surface: #ffffff;
  --sidebar: #fbfbfc;
  --text: #172b4d;
  --muted: #5e6c84;
  --faint: #8590a2;
  --border: #dcdfe4;
  --border-strong: #b6bcc7;
  --hover: #f1f2f4;
  --accent: #0c66e4;
  --accent-hover: #0055cc;
  --accent-soft: #e9f2ff;
  --accent-ink: #09326c;
  --ok: #1f845a;
  --ok-bg: #dcfff1;
  --warn-ink: #7f5f01;
  --warn-bg: #fff7d6;
  --danger: #c9372c;
  --danger-bg: #ffecea;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-w: 264px;
  --rail-w: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 650; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--hover); padding: 1px 6px; border-radius: 4px; }
small { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.icon { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
html[data-collapsed="true"] .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 32px; background: rgba(247, 248, 249, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); min-height: 68px; }
.topbar-title { min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 28px 32px 64px; width: 100%; max-width: 1180px; }
.crumb { display: inline-block; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.crumb:hover { color: var(--accent); }

/* ---------------------------------------------------------------- sidebar */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); padding: 14px 12px; overflow: hidden; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 14px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 750; font-size: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 12px; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.sidebar-toggle .icon { transition: transform .18s ease; }
html[data-collapsed="true"] .sidebar-toggle .icon { transform: rotate(180deg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border-radius: var(--radius); color: #44546f; font-weight: 520; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.nav-item.is-active .icon { color: var(--accent); }
.nav-quiet { color: var(--muted); font-weight: 450; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px 2px; }
.user-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip form { margin: 0; }
html[data-collapsed="true"] .brand-text,
html[data-collapsed="true"] .nav-item span,
html[data-collapsed="true"] .user-name,
html[data-collapsed="true"] .user-chip form { display: none; }
html[data-collapsed="true"] .sidebar { padding-inline: 8px; }
html[data-collapsed="true"] .sidebar-head { flex-direction: column; padding-bottom: 10px; }
html[data-collapsed="true"] .nav-item { justify-content: center; padding: 0; }
html[data-collapsed="true"] .user-chip { justify-content: center; }

/* ---------------------------------------------------------------- avatars */
.avatar { flex: none; display: inline-grid; place-items: center; border-radius: 8px; color: hsl(var(--h) 55% 24%); background: hsl(var(--h) 80% 91%); font-weight: 700; letter-spacing: .02em; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; border-radius: 50%; }
.avatar-md { width: 34px; height: 34px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; border-radius: 10px; }

/* ---------------------------------------------------------------- buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #ae2a19; border-color: #ae2a19; }
.btn-danger-quiet { color: var(--danger); }
.btn-danger-quiet:hover { background: var(--danger-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
form { margin: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 650; color: #44546f; }
.field input, .field select, .field textarea { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.field textarea { height: auto; padding: 8px 11px; }
.field input:hover { border-color: #8c95a4; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field small { line-height: 1.4; }
.field .error { color: var(--danger); font-weight: 550; }
.has-error input { border-color: var(--danger); }
.field-with-action { display: flex; align-items: flex-end; gap: 10px; }
.field-with-action .field { flex: 1; }
.field-check { display: flex; align-items: center; gap: 8px; }
.field-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ---------------------------------------------------------------- cards and panels */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; }
.card + .card, .card + .columns, .columns + .card, .reveal + .tabs { margin-top: 20px; }
.columns > .card, .columns > .card + .card { margin-top: 0; }
.card-head { margin-bottom: 18px; }
.card-head p { color: var(--muted); margin-top: 3px; max-width: 62ch; }
.card-head-toggle { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 0; }
.card-head-toggle + .grid { margin-top: 18px; }
.card-actions { display: flex; gap: 10px; margin-top: 4px; }
.panel { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-empty { padding: 28px 20px; color: var(--muted); }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.lede { color: var(--muted); margin-bottom: 20px; max-width: 70ch; font-size: 14.5px; }
.link { color: var(--accent); font-weight: 550; }
.link:hover { text-decoration: underline; }

.row-link { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.row-link:last-child { border-bottom: 0; }
.row-link:hover { background: var(--hover); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.row-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.card .feed-item { padding-inline: 0; }
.feed-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }

/* ---------------------------------------------------------------- progress, lozenges */
.progress { display: block; width: 110px; height: 6px; border-radius: 99px; background: #e6e9ee; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress-lg { width: 100%; height: 8px; margin-bottom: 18px; }
.progress-wrap { display: flex; align-items: center; gap: 10px; flex: none; }
.lozenge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; background: var(--hover); color: #44546f; vertical-align: middle; }
.lozenge-ok { background: var(--ok-bg); color: #0b6644; }
.lozenge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.lozenge-danger { background: var(--danger-bg); color: #ae2a19; }
.lozenge-info { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------------------------------------------------------------- tables, filters, tabs */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
.table-wrap.flush { border: 0; border-radius: 0; margin: 0 -24px; background: transparent; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; justify-content: flex-end; gap: 8px; }
.cell-school { display: flex; align-items: center; gap: 12px; }
.cell-school span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filter { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 99px; color: #44546f; font-weight: 600; border: 1px solid transparent; }
.filter span { font-size: 12px; font-weight: 700; color: var(--muted); background: #e9ebef; border-radius: 99px; padding: 0 7px; }
.filter:hover { background: var(--hover); }
.filter.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.filter.is-active span { background: #cfe1fd; color: var(--accent-ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 20px; overflow-x: auto; }
.tab { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-color: var(--accent); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------------------------------------------------------------- school pages */
.school-title { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.school-title p { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .link, .checklist small { margin-left: auto; }
.check { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: #fff; }
.is-done .check { background: var(--ok); border-color: var(--ok); }
.checklist li:not(.is-done) > span:nth-child(2) { color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.semesters { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.semesters li { display: flex; gap: 10px; color: var(--muted); }
.semesters b { color: var(--text); }
.year + .year { margin-top: 12px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; }

/* ---------------------------------------------------------------- create form */
.create-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.create-main { display: flex; flex-direction: column; gap: 20px; }
.create-main .card + .card { margin-top: 0; }
.create-summary { position: sticky; top: 92px; }
.summary h2 { margin-bottom: 16px; }
.summary-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.summary-list li { display: flex; gap: 12px; }
.summary-list li > span { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.summary-list b { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.summary-list p { overflow-wrap: anywhere; font-weight: 550; }
.summary .small { margin-top: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; cursor: pointer; flex: none; }
.switch input { appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 99px; background: #b6bcc7; position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.is-off { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- result and credentials */
.success-head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.success-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); flex: none; }
.success-head p { color: var(--muted); max-width: 64ch; margin-top: 2px; }
.reveal { background: #fffdf2; border: 1px solid #f0d97a; border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 20px; }
.reveal header { display: flex; gap: 14px; margin-bottom: 14px; }
.reveal header p { color: #6f5a12; margin-top: 2px; max-width: 70ch; }
.reveal-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.credentials { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.credentials > div { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid #ecdfa6; border-radius: var(--radius); padding: 8px 8px 8px 14px; }
.credentials dt { width: 150px; color: var(--muted); font-size: 12.5px; flex: none; }
.credentials dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.credentials code { background: transparent; padding: 0; font-size: 14px; font-weight: 600; }
.steps { margin: 0 0 18px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; max-width: 70ch; }

/* ---------------------------------------------------------------- feedback */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius); border: 1px solid; }
.flash .icon { margin-top: 1px; }
.flash-success { background: var(--ok-bg); border-color: #a8e9cc; color: #0b5a3a; }
.flash-error { background: var(--danger-bg); border-color: #f5b5ae; color: #8a2217; }
.flash-warn { background: var(--warn-bg); border-color: #f0d97a; color: var(--warn-ink); }
.empty { text-align: center; padding: 56px 24px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.empty p { color: var(--muted); margin: 6px auto 18px; max-width: 46ch; }
.dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 12px 40px rgba(9, 30, 66, .28); color: var(--text); }
.dialog::backdrop { background: rgba(9, 30, 66, .45); }
.dialog p { color: var(--muted); margin: 8px 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--muted); }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); width: 190px; }

/* ---------------------------------------------------------------- sign in */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- smaller screens */
@media (max-width: 1100px) {
  .create-layout { grid-template-columns: minmax(0, 1fr); }
  .create-summary { position: static; }
  .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app, html[data-collapsed="true"] .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .brand-text, .nav-item span, .user-name, .user-chip form, .sidebar-toggle { display: none; }
  .sidebar { padding-inline: 8px; }
  .sidebar-head { justify-content: center; }
  .nav-item { justify-content: center; padding: 0; }
  .user-chip { justify-content: center; }
  .topbar, .content { padding-inline: 18px; }
  .search input { width: 120px; }
}
@media (max-width: 640px) {
  .grid, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .search { display: none; }
  .topbar { flex-wrap: wrap; }
  .credentials > div { flex-wrap: wrap; }
  .credentials dt { width: 100%; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
