/* =========================================================================
   AIS-PWA — design system
   Visual world: "academic instrument" — warm paper, precise typography, one
   indigo accent, burnt-orange reserved for the live "now" marker only.
   Operate mode. Mobile-first, real dark theme.
   ========================================================================= */

:root {
  /* palette — light (warm paper) */
  --paper: #f4f1ea;
  --surface: #fbf9f4;
  --surface-2: #efece3;
  --line: #ddd6c6;
  --line-strong: #c8bfa9;
  --ink: #17150f;
  --ink-2: #524d40;
  --ink-3: #6f6959;
  --accent: #3a35a8;         /* indigo */
  --accent-ink: #ffffff;
  --accent-soft: #e9e8f7;
  --accent-2: #0d6b64;       /* teal — cvičenia / semináre, so a week is readable at a glance */
  --accent-2-soft: #dcebe9;
  --now: #c2410c;            /* burnt orange — live/now only */
  --now-soft: #f7e6dc;

  /* semantic */
  --ok: #2f7d4f;
  --ok-soft: #e3f0e6;
  --warn: #8a5d0b;
  --warn-soft: #f6ecd6;
  --bad: #a52222;
  --bad-soft: #f4dede;

  /* type */
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', var(--sans);

  /* geometry */
  --r-sm: 8px;
  --r: 13px;
  --r-lg: 20px;
  --r-full: 999px;

  /* elevation — real offset + soft blur, tinted with ink */
  --sh-1: 0 1px 2px rgba(23, 21, 15, 0.05), 0 1px 3px rgba(23, 21, 15, 0.06);
  --sh-2: 0 4px 10px -2px rgba(23, 21, 15, 0.08), 0 2px 6px -2px rgba(23, 21, 15, 0.07);
  --sh-3: 0 18px 40px -12px rgba(23, 21, 15, 0.22), 0 6px 14px -8px rgba(23, 21, 15, 0.14);

  /* motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* entrances, exits, hover */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* on-screen movement */
  --tab-h: 66px;
  --maxw: 940px;
}

:root:not([data-theme='light']) {
  @media (prefers-color-scheme: dark) {
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #131210;
    --surface: #211e19;
    --surface-2: #2a2620;
    --line: #383229;
    --line-strong: #3d382f;
    --ink: #f3efe4;
    --ink-2: #b7b1a2;
    --ink-3: #98917f;
    --accent: #9b96ff;
    --accent-ink: #14130f;
    --accent-soft: #26243a;
    --accent-2: #63cfc2;
    --accent-2-soft: #16302d;
    --now: #f2884e;
    --now-soft: #362117;
    --ok: #5fbf85;
    --ok-soft: #17281d;
    --warn: #d6a54a;
    --warn-soft: #2b2415;
    --bad: #e87a7a;
    --bad-soft: #2c1919;
    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --sh-2: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
    --sh-3: 0 20px 44px -14px rgba(0, 0, 0, 0.66);
  }
}

[data-theme='dark'] {
  color-scheme: dark;
  --paper: #131210;
  --surface: #211e19;
  --surface-2: #2a2620;
  --line: #383229;
  --line-strong: #3d382f;
  --ink: #f3efe4;
  --ink-2: #b7b1a2;
  --ink-3: #98917f;
  --accent: #9b96ff;
  --accent-ink: #14130f;
  --accent-soft: #26243a;
  --accent-2: #63cfc2;
  --accent-2-soft: #16302d;
  --now: #f2884e;
  --now-soft: #362117;
  --ok: #5fbf85;
  --ok-soft: #17281d;
  --warn: #d6a54a;
  --warn-soft: #2b2415;
  --bad: #e87a7a;
  --bad-soft: #2c1919;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --sh-3: 0 20px 44px -14px rgba(0, 0, 0, 0.66);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}

/* browser surfaces themed from the palette */
::selection { background: var(--accent-soft); color: var(--ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-full); border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------------- App shell ---------------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px calc(var(--tab-h) + 28px);
}
@media (min-width: 860px) {
  .app { flex-direction: row; }
  .main { padding: 34px 40px 60px; }
}

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.32rem; letter-spacing: -0.03em; }
.topbar .sub { color: var(--ink-3); font-size: 0.82rem; margin-top: 1px; }
.topbar .grow { flex: 1; }
.iconbtn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 21px; height: 21px; }
@media (min-width: 860px) { .topbar { display: none; } }

/* sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 860px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    width: 246px; flex-shrink: 0;
    padding: 30px 18px; border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100dvh;
  }
  .brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
  .brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1rem; box-shadow: var(--sh-1); }
  .brand b { font-family: var(--display); font-size: 1.14rem; letter-spacing: -0.03em; }
  .brand span { display: block; font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.02em; }
  .navitem {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 13px; border-radius: var(--r); border: 1px solid transparent;
    color: var(--ink-2); font-weight: 500; text-decoration: none;
    transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out);
  }
  .navitem svg { width: 20px; height: 20px; flex-shrink: 0; }
  .navitem:hover { background: var(--surface-2); color: var(--ink); }
  .navitem.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in oklab, var(--accent) 22%, transparent); font-weight: 600; }
  .navitem .badge { margin-left: auto; }
  .sidebar .spacer { flex: 1; }
}

/* bottom tab bar (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); text-decoration: none; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.01em;
  position: relative; transition: color 0.16s var(--ease-out);
}
.tabbar a .ic { position: relative; display: grid; place-items: center; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--accent); }
.tabbar a .dot { position: absolute; top: -2px; right: -6px; }
@media (min-width: 860px) { .tabbar { display: none; } }

/* ---------------- Primitives ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.section-h { display: flex; align-items: baseline; gap: 10px; margin: 24px 2px 11px; }
.section-h:first-child { margin-top: 4px; }
.section-h h2 { font-size: 1.04rem; letter-spacing: -0.01em; }
.section-h .muted { color: var(--ink-3); font-size: 0.82rem; }
.section-h .grow { flex: 1; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--ink-2);
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.now { background: var(--now-soft); color: var(--now); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600;
  transition: transform 0.14s var(--ease-out), background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: var(--sh-1); }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.full { width: 100%; }

/* ---------------- Today ---------------- */
.hero {
  padding: 22px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 55%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--sh-2);
}
.hero .eyebrow { color: var(--ink-3); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.hero .big { font-family: var(--display); font-size: clamp(1.7rem, 6vw, 2.3rem); letter-spacing: -0.03em; margin-top: 6px; line-height: 1.08; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; color: var(--ink-2); font-size: 0.9rem; }
.hero .meta b { color: var(--ink); }
.hero.none .big { font-size: clamp(1.3rem, 4.5vw, 1.7rem); color: var(--ink-2); }

.glance { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 14px; }
.glance .g {
  padding: 15px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; text-decoration: none; transition: border-color 0.16s var(--ease-out), transform 0.14s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .glance .g:hover { border-color: var(--line-strong); transform: translateY(-1px); }
}
.glance .g .n { font-family: var(--display); font-size: 1.5rem; letter-spacing: -0.02em; }
.glance .g .l { color: var(--ink-3); font-size: 0.8rem; }

/* ---------------- Schedule ---------------- */
.dayswitch { display: flex; gap: 6px; overflow-x: auto; padding: 2px; margin: 0 -2px 14px; scrollbar-width: none; }
.dayswitch::-webkit-scrollbar { display: none; }
.dayswitch button {
  flex-shrink: 0; padding: 8px 15px; border-radius: var(--r-full); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 0.86rem;
  transition: background-color 0.16s var(--ease-out), border-color 0.16s var(--ease-out),
              color 0.16s var(--ease-out);
}
.dayswitch button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dayswitch button.today { border-color: color-mix(in oklab, var(--now) 45%, transparent); }
.dayswitch button.today.active { background: var(--now); border-color: var(--now); color: #fff; }

.agenda { display: flex; flex-direction: column; gap: 10px; }
.lesson {
  display: grid; grid-template-columns: 62px 1fr; gap: 14px; align-items: stretch;
  padding: 14px 16px; border-radius: var(--r);
  background: color-mix(in oklab, var(--type-color, var(--accent)) 5%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--type-color, var(--accent)) 20%, var(--line));
  position: relative; overflow: hidden;
}
.lesson .time { display: flex; flex-direction: column; gap: 2px; }
.lesson .time .from { color: color-mix(in oklab, var(--type-color, var(--accent)) 72%, var(--ink)); }
.lesson .time .from { font-family: var(--sans); font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.lesson .time .to { color: var(--ink-3); font-size: 0.8rem; }
.lesson .body .name { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.lesson .body .info { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: var(--ink-2); font-size: 0.84rem; }
.lesson .body .info .i { display: inline-flex; align-items: center; gap: 5px; }
.lesson .body .info svg { width: 14px; height: 14px; opacity: 0.7; }
.lesson.now { border-color: color-mix(in oklab, var(--now) 40%, transparent); box-shadow: 0 0 0 1px color-mix(in oklab, var(--now) 30%, transparent), var(--sh-1); }

.nowline { display: flex; align-items: center; gap: 8px; margin: 4px 0; color: var(--now); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; }
.nowline::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--now), transparent); }

/* week grid (desktop) */
.weekgrid { display: none; }
@media (min-width: 860px) {
  .weekgrid { display: grid; grid-template-columns: 54px repeat(5, 1fr); gap: 1px; background: var(--line);
    border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); }
  .weekgrid .cell { background: var(--surface); padding: 8px; min-height: 58px; position: relative; }
  .weekgrid .hh { background: var(--surface-2); font-size: 0.72rem; color: var(--ink-3); text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums; }
  .weekgrid .dh { background: var(--surface-2); font-weight: 600; text-align: center; padding: 10px 6px; font-size: 0.85rem; }
  .weekgrid .dh.today { color: var(--now); }
  .wk-lesson { position: absolute; left: 4px; right: 4px; border-radius: 9px; padding: 7px 9px; overflow: hidden;
    background: var(--type-soft, var(--accent-soft)); border: 1px solid color-mix(in oklab, var(--type-color, var(--accent)) 30%, transparent);
    box-shadow: var(--sh-1); }
  .wk-lesson .n { font-weight: 600; font-size: 0.8rem; line-height: 1.2; }
  .wk-lesson .m { color: var(--ink-2); font-size: 0.72rem; margin-top: 2px; }
  .agenda-wrap.desktop-hide { display: none; }
}
@media (max-width: 859px) { .weekgrid { display: none; } }

/* ---------------- Subjects / grades ---------------- */
.summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.summary .s { flex: 1; min-width: 120px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.summary .s .n { font-family: var(--display); font-size: 1.7rem; letter-spacing: -0.02em; }
.summary .s .l { color: var(--ink-3); font-size: 0.8rem; margin-top: 2px; text-wrap: nowrap; }

.rowlist { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.row:last-child { border-bottom: none; }
.grade {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 1rem;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.grade.g-A, .grade.g-B { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in oklab, var(--ok) 26%, transparent); }
.grade.g-C, .grade.g-D { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 26%, transparent); }
.grade.g-E { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 26%, transparent); }
.grade.g-FX { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in oklab, var(--bad) 26%, transparent); }
.grade.pending { background: transparent; color: var(--ink-3); border-style: dashed; border-color: var(--line-strong); }
.row .rbody { flex: 1; min-width: 0; }
.row .rbody .t { font-weight: 600; letter-spacing: -0.01em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .rbody .m { color: var(--ink-3); font-size: 0.82rem; margin-top: 2px; display: flex; gap: 10px; }
.row .rmeta { text-align: right; flex-shrink: 0; }
.row .rmeta .cr { font-weight: 700; font-variant-numeric: tabular-nums; }
.row .rmeta .cl { color: var(--ink-3); font-size: 0.72rem; }

/* ---------------- Payments ---------------- */
.owe { padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-2); margin-bottom: 14px; }
.owe .l { color: var(--ink-3); font-size: 0.82rem; }
.owe .n { font-family: var(--display); font-size: clamp(2rem, 8vw, 2.6rem); letter-spacing: -0.03em; margin-top: 4px; }
.owe .n.clear { color: var(--ok); }
.pay { display: flex; align-items: center; gap: 13px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.pay:last-child { border-bottom: none; }
.pay .pmark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.pay .pmark svg { width: 20px; height: 20px; }
.pay.paid .pmark { background: var(--ok-soft); color: var(--ok); }
.pay.due .pmark { background: var(--warn-soft); color: var(--warn); }
.pay .pbody { flex: 1; min-width: 0; }
.pay .pbody .t { font-weight: 600; }
.pay .pbody .m { color: var(--ink-3); font-size: 0.82rem; margin-top: 2px; }
.pay .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- Messages ---------------- */
.msg { display: flex; gap: 13px; padding: 13px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.msg:last-child { border-bottom: none; }
.msg .av { width: 40px; height: 40px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-family: var(--display); font-weight: 600; flex-shrink: 0; }
.msg .mbody { flex: 1; min-width: 0; }
.msg .mbody .t { font-weight: 600; letter-spacing: -0.01em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.msg .mbody .p { color: var(--ink-2); font-size: 0.86rem; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg .mbody .f { color: var(--ink-3); font-size: 0.78rem; margin-top: 5px; }
.msg.unread .t::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: middle; }

/* ---------------- Login ---------------- */
/* Two panes from 900px: a photograph on the left, the form on the right. On a phone
   the photograph becomes a band above the form. If the photo file is missing the
   gradient under it still paints, so the panel is never an empty grey box. */
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.login__art {
  position: relative; isolation: isolate;
  min-height: 34vw; max-height: 210px;
  border-bottom: 1px solid var(--line);
  /* Ruled paper is the floor: it shows while the photograph loads and if the file is
     ever missing. The photograph goes on top as its own layer (::after) rather than
     sharing a background-image list with gradients — a browser that cannot parse one
     layer of such a list throws away the whole property, photo included. */
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, rgba(23, 21, 15, 0.07) 25px 26px);
}
.login__art::after {
  content: ''; position: absolute; inset: 0;
  background-image: url('/photos/login-band.webp?v=2');
  background-size: cover; background-position: center; background-repeat: no-repeat;
}

.login__pane { display: grid; place-items: center; padding: 26px 22px 40px; }
.login .box { width: 100%; max-width: 400px; }

@media (min-width: 900px) {
  .login { grid-template-rows: none; grid-template-columns: minmax(0, 44%) minmax(0, 56%); }
  .login__art {
    min-height: 100dvh; max-height: none;
    border-bottom: none; border-right: 1px solid var(--line);
  }
  .login__art::after { background-image: url('/photos/login.webp?v=2'); }
  .login__pane { padding: 40px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .login__art { filter: brightness(0.74) saturate(0.9); }
}
[data-theme='dark'] .login__art { filter: brightness(0.74) saturate(0.9); }

.brandline { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.brandline .mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: var(--sh-1);
}
.brandline .mark svg { width: 21px; height: 21px; }
.brandline b { font-family: var(--display); font-size: 1.16rem; letter-spacing: -0.03em; display: block; }
.brandline span { display: block; font-size: 0.74rem; color: var(--ink-3); }

.login h1 { font-size: clamp(1.4rem, 5.2vw, 1.75rem); line-height: 1.16; }
.login p.sub { color: var(--ink-2); margin: 10px 0 24px; font-size: 0.94rem; line-height: 1.55; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input {

  width: 100%; padding: 13px 15px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login .err { color: var(--bad); font-size: 0.86rem; margin: 4px 0 14px; min-height: 1.1em; }

.check { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; font-size: 0.88rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

/* What the app is and what it does with the password — the questions a sign-in form
   that asks for university credentials has to answer before it is typed into. */
.trust { list-style: none; margin: 24px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 13px; }
.trust li { display: flex; gap: 10px; font-size: 0.82rem; line-height: 1.5; color: var(--ink-3); }
.trust svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.trust b { color: var(--ink-2); font-weight: 600; }
.trust a { color: var(--accent); text-underline-offset: 2px; }

/* ---------------- States ---------------- */
.empty { text-align: center; padding: 34px 20px 26px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 12px; }
.empty .t { font-weight: 600; color: var(--ink-2); }
.skel { background: var(--surface-2); border-radius: var(--r); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* entrance — near-imperceptible: tab switching happens all session long */
.view { animation: rise 0.14s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* live "now" marker — the one looping animation, and the only thing on screen
   that earns it: it says this is happening right now. */
.livedot { position: relative; width: 8px; height: 8px; border-radius: 50%;
  background: var(--now); flex-shrink: 0; }
.livedot i { position: absolute; inset: 0; border-radius: 50%; background: var(--now);
  animation: ping 2.4s var(--ease-out) infinite; }
@keyframes ping {
  0% { transform: scale(1); opacity: 0.45; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* theme flip would otherwise hard-cut every surface at once */
.theming, .theming *, .theming *::before, .theming *::after {
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
              color 0.2s var(--ease-out) !important;
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: fade 0.14s var(--ease-out) both; }
  .livedot i { animation: none; opacity: 0.35; transform: scale(2); }
  .skel { animation: none; opacity: 0.7; }
  .glance .g:hover { transform: none; }
  .btn:active { transform: none; }
  .toast, .toast.show { transform: translateX(-50%); transition: opacity 0.2s var(--ease-out); }
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: var(--r-full);
  font-size: 0.88rem; font-weight: 500; box-shadow: var(--sh-3); opacity: 0; pointer-events: none;
  transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Academic period ---------------- */
.period {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; padding: 10px 14px;
  border-radius: var(--r); background: var(--surface-2);
  color: var(--ink-2); font-size: 0.85rem;
}
.period .pname { font-weight: 600; color: var(--ink); }
.period .pdot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }

/* ---------------- Segmented control ---------------- */
.seg {
  display: flex; gap: 4px; padding: 4px; margin: 22px 0 4px;
  background: var(--surface-2); border-radius: var(--r-full);
}
.seg button {
  flex: 1; padding: 9px 14px; border: none; border-radius: var(--r-full);
  background: transparent; color: var(--ink-2); font-weight: 600; font-size: 0.88rem;
  transition: background-color 0.16s var(--ease-out), color 0.16s var(--ease-out);
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* credits earned / enrolled reads as one figure, not two */
.summary .s .n .of { color: var(--ink-3); font-size: 0.62em; font-weight: 500; }

/* exam / plan rows reuse .grade as a status chip */
.grade svg { width: 19px; height: 19px; }


/* ---------------- Page header (desktop) ---------------- */
/* The top bar is hidden from 860px up, which left four screens with no title at all
   and nowhere to say how fresh the data is. */
.pagehead { display: none; }
@media (min-width: 860px) {
  .pagehead {
    display: flex; align-items: flex-end; gap: 14px;
    margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
  }
  .pagehead h1 { font-size: 1.9rem; letter-spacing: -0.035em; }
  .pagehead .sub { color: var(--ink-3); font-size: 0.86rem; margin-top: 3px; }
  .pagehead .grow { flex: 1; }
  .pagehead .synced { color: var(--ink-3); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
}

.topbar .tb-txt { min-width: 0; }
.refreshbtn svg { transition: transform 0.2s var(--ease-out); }
.syncing .refreshbtn svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

/* ---------------- Quiet day / next lesson ---------------- */
/* An empty day is a fact, not a failure: the hero drops the indigo wash (which on an
   empty card reads as a skeleton that never finished) and takes a photograph instead. */
.hero.quiet {
  background-color: var(--surface);
  background-image: url('/photos/quiet.webp?v=2');
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  min-height: 108px;
}
/* The scrim that keeps the copy readable is a separate layer for the same reason:
   a gradient the browser cannot parse must not erase the photograph under it. */
.hero.quiet::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background-image: linear-gradient(100deg, var(--surface) 34%, rgba(255, 255, 255, 0) 78%);
}
.hero.quiet > * { position: relative; z-index: 1; }
.hero.quiet .big { font-size: clamp(1.25rem, 4.4vw, 1.65rem); color: var(--ink); max-width: 20ch; }
.hero.quiet .meta { color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .hero.quiet::before {
    background-image: linear-gradient(100deg, var(--surface) 34%, rgba(33, 30, 25, 0.55) 72%, rgba(33, 30, 25, 0.35));
  }
}
[data-theme='dark'] .hero.quiet::before {
  background-image: linear-gradient(100deg, var(--surface) 34%, rgba(33, 30, 25, 0.55) 72%, rgba(33, 30, 25, 0.35));
}

.nextcard {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
  text-decoration: none; color: inherit;
  transition: border-color 0.16s var(--ease-out), transform 0.14s var(--ease-out);
}
.nextcard:active { transform: scale(0.995); }
@media (hover: hover) and (pointer: fine) { .nextcard:hover { border-color: var(--line-strong); } }
.nextcard .when { display: flex; flex-direction: column; gap: 2px; min-width: 92px; }
.nextcard .when .d { font-weight: 700; font-size: 0.95rem; }
.nextcard .when .t { color: var(--ink-3); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.nextcard .body { flex: 1; min-width: 0; }
.nextcard .body .name { font-weight: 600; letter-spacing: -0.01em; }
.nextcard .body .info { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: var(--ink-2); font-size: 0.82rem; }
.nextcard .body .info .i { display: inline-flex; align-items: center; gap: 5px; }
.nextcard .body .info svg { width: 14px; height: 14px; opacity: 0.7; }
.nextcard .go { color: var(--ink-3); display: grid; place-items: center; flex-shrink: 0; }
.nextcard .go svg { width: 20px; height: 20px; }

/* ---------------- State cards ---------------- */
/* Replaces "0 / — / 0" and doubled empty states: one card that says what is true and
   when it changes. */
.statecard {
  padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
}
.statecard .t { font-family: var(--display); font-size: 1.22rem; letter-spacing: -0.02em; }
.statecard .s { color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; margin-top: 7px; max-width: 54ch; }
.statecard .m { color: var(--ink-3); font-size: 0.82rem; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.statecard.ok .t { color: var(--ok); }
.footnote { color: var(--ink-3); font-size: 0.78rem; line-height: 1.55; margin: 14px 2px 0; max-width: 60ch; }
.owe .m { color: var(--ink-3); font-size: 0.82rem; margin-top: 6px; }

/* ---------------- University news ---------------- */
.newslist { display: flex; flex-direction: column; gap: 10px; }
.newsitem {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 12px 13px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: inherit;
  transition: border-color 0.16s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .newsitem:hover { border-color: var(--line-strong); } }
.newsitem .thumb {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0;
  object-fit: cover; background: var(--surface-2);
}
.newsitem .thumb.ph { display: grid; place-items: center; color: var(--ink-3); }
.newsitem .thumb.ph svg { width: 22px; height: 22px; }
.newsitem .nbody { display: flex; flex-direction: column; min-width: 0; }
.newsitem .t { font-weight: 600; font-size: 0.92rem; line-height: 1.35; letter-spacing: -0.01em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.newsitem .s { color: var(--ink-2); font-size: 0.82rem; line-height: 1.45; margin-top: 4px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.newsitem .f { color: var(--ink-3); font-size: 0.75rem; margin-top: 6px; }

/* ---------------- Signed in as (sidebar) ---------------- */
.whoami { display: none; }
@media (min-width: 860px) {
  .whoami { display: flex; align-items: center; gap: 10px; padding: 12px 13px 14px; margin-bottom: 4px;
    border-top: 1px solid var(--line); }
  .whoami .av { width: 30px; height: 30px; border-radius: var(--r-full); flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; }
  .whoami .wb { min-width: 0; }
  .whoami .n { display: block; font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .whoami .m { display: block; font-size: 0.7rem; color: var(--ink-3); }
}

/* ---------------- Fixes on existing parts ---------------- */
/* A dashed ring with a dot reads as an image that failed to load, six rows in a row. */
.grade.pending { background: var(--surface-2); color: var(--ink-3); border-style: solid; border-color: var(--line); }
.grade.pending svg { width: 17px; height: 17px; opacity: 0.8; }

/* Practice sessions differ by edge, not by the alarm colour. */
.lesson.practice { border-left-width: 3px; }
.wk-lesson.practice { border-left-width: 3px; }

/* Days that actually carry lessons, and a 44px touch target. */
.dayswitch button { padding: 11px 16px; position: relative; }
.dayswitch button.has::after {
  content: ''; position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.45;
}
.dayswitch button.active.has::after { opacity: 0.7; }

/* Messages: category icon instead of the initials of a category, date and link. */
.msg { align-items: center; }
.msg .av { border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.msg .av svg { width: 20px; height: 20px; }
.msg .av.money { background: var(--warn-soft); color: var(--warn); }
.msg .av.doc { background: var(--surface-2); color: var(--ink-2); }
.msg .mbody .t { -webkit-line-clamp: 2; font-weight: 600; }
.msg .mbody .f { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.msg .mbody .f .when { color: var(--ink-3); font-size: 0.75rem; }
.msg .go { color: var(--ink-3); flex-shrink: 0; display: grid; place-items: center; }
.msg .go svg { width: 17px; height: 17px; }

/* The segmented control's active pill was darker than its own track after dark. */
.seg button.active { border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .seg { background: color-mix(in oklab, var(--ink) 6%, var(--paper)); }
  :root:not([data-theme='light']) .seg button.active { background: var(--surface-2); border-color: var(--line-strong); }
}
[data-theme='dark'] .seg { background: color-mix(in oklab, var(--ink) 6%, var(--paper)); }
[data-theme='dark'] .seg button.active { background: var(--surface-2); border-color: var(--line-strong); }

/* Black shadows do nothing on a near-black ground; a top highlight does. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .card,
  :root:not([data-theme='light']) .hero,
  :root:not([data-theme='light']) .owe,
  :root:not([data-theme='light']) .statecard,
  :root:not([data-theme='light']) .summary .s,
  :root:not([data-theme='light']) .glance .g,
  :root:not([data-theme='light']) .nextcard {
    box-shadow: var(--sh-1), inset 0 1px 0 color-mix(in oklab, var(--ink) 7%, transparent);
  }
}
[data-theme='dark'] .card,
[data-theme='dark'] .hero,
[data-theme='dark'] .owe,
[data-theme='dark'] .statecard,
[data-theme='dark'] .summary .s,
[data-theme='dark'] .glance .g,
[data-theme='dark'] .nextcard {
  box-shadow: var(--sh-1), inset 0 1px 0 color-mix(in oklab, var(--ink) 7%, transparent);
}

/* Three summary tiles wrapped 2 + 1 on a phone and the orphan stretched full width. */
@media (max-width: 519px) {
  .summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .s { min-width: 0; }
  .summary .s:nth-child(3) { grid-column: 1 / -1; }
  .summary .s .l { text-wrap: wrap; }
}

/* A row whose value sits 700px from its name is two unrelated things. */
@media (min-width: 860px) {
  .rowlist.card, .card .pay, .card .msg { max-width: 760px; }
}

/* The greeting is longer than a tab name: keep it off the three icon buttons. */
@media (max-width: 859px) {
  .topbar { align-items: flex-start; gap: 8px; }
  .topbar h1 { font-size: 1.18rem; line-height: 1.2; }
  .topbar .sub { font-size: 0.78rem; }
  .topbar .iconbtn { width: 38px; height: 38px; }
}
@media (max-width: 400px) {
  .topbar .sub .meniny { display: none; }
}

/* Inputs on paper: surface over paper is a 1.08:1 edge, which reads as a mock-up. */
.field input { background: color-mix(in oklab, var(--paper) 45%, var(--surface)); border-color: color-mix(in oklab, var(--ink-3) 38%, transparent); }


/* =========================================================================
   Language, and the phone's one header button
   ========================================================================= */
/* SK · RU · UA. Three codes, not a dropdown: with three options a menu costs a tap
   to find out what is inside, and the codes are shorter than the word "Language". */
.langsw { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full); background: var(--surface-2); }
.langsw button {
  min-width: 34px; padding: 5px 9px; border: 1px solid transparent; border-radius: var(--r-full);
  background: transparent; color: var(--ink-3); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em;
  transition: background-color 0.16s var(--ease-out), color 0.16s var(--ease-out);
}
.langsw button:hover { color: var(--ink); }
.langsw button.active { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--sh-1); }

.brandline .bgrow { flex: 1; }

/* the header menu */
.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 232px; padding: 12px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-3);
  animation: rise 0.14s var(--ease-out) both;
}
.menu__panel[hidden] { display: none; }
.menu__label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px; }
.menu__note { color: var(--ink-3); font-size: 0.75rem; line-height: 1.45; margin: 9px 0 4px; }
.menu__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 8px; margin-top: 2px; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); font-weight: 500; text-align: left;
}
.menu__item:first-of-type { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); padding-top: 12px; }
.menu__item:hover { background: var(--surface-2); color: var(--ink); }
.menu__item svg { width: 19px; height: 19px; flex-shrink: 0; }

/* sidebar row: the label on the left, the three codes on the right */
.navlang { display: none; }
@media (min-width: 860px) {
  .navlang { display: flex; align-items: center; gap: 10px; padding: 6px 13px 10px; }
  .navlang .l { flex: 1; color: var(--ink-3); font-size: 0.78rem; font-weight: 600; }
}

/* =========================================================================
   Lecture vs seminar
   ========================================================================= */
/* A lecture and a seminar are different kinds of hour — you sit through one and are
   called on in the other — so they carry different colours, indigo and teal. Burnt
   orange stays reserved for "now"; the type is still spelled out on the badge and the
   left edge still thickens, so the distinction survives without colour vision. */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 2px 12px; color: var(--ink-3); font-size: 0.78rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--legend-color, var(--accent)); }
@media (min-width: 860px) { .legend { margin-top: 14px; } }

/* =========================================================================
   Readability of the photograph heroes on a phone
   ========================================================================= */
/* At 390px the copy crossed into the middle of the picture: the 100deg scrim was cut
   for a wide card. Narrow screens get a scrim that clears the text column first. */
@media (max-width: 620px) {
  .hero.quiet::before {
    background-image: linear-gradient(115deg,
      var(--surface) 58%,
      color-mix(in oklab, var(--surface) 55%, transparent) 82%,
      color-mix(in oklab, var(--surface) 18%, transparent));
  }
  .hero.quiet .big { max-width: 15ch; }
}


/* =========================================================================
   Day switcher: five days, one row
   ========================================================================= */
/* Five loose ovals with a solid orange circle among them read as five unrelated
   buttons and one alarm. They are one control over one week: equal widths, one row,
   and "today" marked by a ring rather than by the colour reserved for "now". */
.dayswitch { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; overflow: visible; }
.dayswitch button {
  width: 100%; padding: 10px 4px; border-radius: var(--r);
  font-size: 0.82rem; letter-spacing: 0.01em;
}
.dayswitch button.today { border-color: color-mix(in oklab, var(--now) 55%, transparent); color: var(--now); }
.dayswitch button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dayswitch button.today.active { background: var(--now); border-color: var(--now); color: #fff; }
.dayswitch button.has::after { bottom: 4px; }

/* An empty day that is followed by the next real day does not need the full pillow. */
.empty.tight { padding: 22px 20px 18px; }
.empty.tight svg { width: 32px; height: 32px; margin-bottom: 8px; }

/* Two-line taglines: keep the second line close to the first. */
.brand span, .brandline span { line-height: 1.25; }
