/* Školomat admin panel. Tokens are a copy of Brand/tokens.css; no colour is written anywhere else. */

@font-face {
  font-family: "Unageo";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/unageo-var.woff2") format("woff2");
}

:root {
  --ink: #12111a;
  --text: #22212b;
  --mute: #6b6a78;
  --line: rgba(11, 12, 18, .09);
  --bg: #ffffff;
  --bg2: #f6f5f8;
  --brand: #5b52c4;
  --brand2: #7468d2;
  --brand-ink: #4a42ad;
  --brand-soft: #efeef9;
  --grad: linear-gradient(135deg, #544bbb 0%, #6a60cf 100%);
  --bufet: #d9764a;
  --tlac: #2f9e8f;
  --ok: #3aa776;      --ok-ink: #2a8259;      --ok-soft: rgba(58, 167, 118, .15);
  --warn: #c98a2b;    --warn-ink: #8f5f14;    --warn-soft: rgba(201, 138, 43, .16);
  --bad: #c9504a;     --bad-ink: #a33a35;     --bad-soft: rgba(201, 80, 74, .13);
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(11, 12, 18, .05), 0 10px 24px -14px rgba(11, 12, 18, .3);
  --shadow-2: 0 1px 2px rgba(11, 12, 18, .04), 0 30px 60px -24px rgba(38, 34, 92, .26);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Unageo", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --side: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15.500px; line-height: 1.45; color: var(--text); background: var(--bg2); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2, h3 { color: var(--ink); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
h1 { font-size: clamp(1.75rem, 4vw, 2.375rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; display: flex; align-items: center; gap: 8px; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--mute); }
.small { font-size: 13.500px; }
.tiny { font-size: 12px; color: var(--mute); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.boot { min-height: 100vh; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.03em; }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-weight: 600; font-size: 14.500px; cursor: pointer; white-space: nowrap; transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, border-color .2s; }
.btn:hover { border-color: rgba(11, 12, 18, .2); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { box-shadow: 0 10px 24px -12px rgba(11, 12, 18, .6); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--bad-ink); }
.btn.danger.primary, .btn.danger:not(.ghost) { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost.danger:hover { background: var(--bad-soft); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 13.500px; }
.btn.icon-only { padding: 0; width: 40px; }

input, select, textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg); transition: border-color .2s, box-shadow .2s; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--brand); flex: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--mute); }
.field small { font-size: 12.500px; color: var(--mute); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg { min-height: 0; font-size: 14px; }
.msg.err { color: var(--bad-ink); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.500px; cursor: pointer; }
.code-input { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: .25em; }
.secret { padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg2); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.500px; overflow-wrap: anywhere; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes div { padding: 10px; border-radius: var(--r-sm); background: var(--bg2); text-align: center; font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.qr { width: 200px; max-width: 100%; padding: 14px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); justify-self: center; }
.qr svg { display: block; width: 100%; height: auto; }

/* ---------- sign-in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 600px at 50% -10%, rgba(91, 82, 196, .16), transparent 70%), var(--bg2); }
.auth-card { width: min(100%, 400px); display: grid; gap: 18px; padding: 32px 28px; border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-2); }
.auth-card.wide { width: min(100%, 480px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: block; }
.brand b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); line-height: 1.1; }
.brand span { display: block; font-size: 12.500px; color: var(--mute); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--side); padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 22px; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.side .brand { padding: 0 8px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text); font-weight: 550; font-size: 14.500px; transition: background-color .2s, color .2s; }
.nav a:hover { background: var(--bg2); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.nav-sep { height: 1px; margin: 10px 12px; background: var(--line); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; justify-items: start; }
.who { font-size: 13px; color: var(--mute); overflow-wrap: anywhere; }
.content { margin-left: var(--side); min-width: 0; }
.topbar { display: none; }
.scrim { display: none; }
.main { padding: clamp(20px, 3.500vw, 40px); max-width: 1240px; }

@media (max-width: 900px) {
  .side { transform: translateX(-102%); transition: transform .35s var(--ease); box-shadow: var(--shadow-2); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(11, 12, 18, .35); }
  .content { margin-left: 0; }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--line); }
  .topbar .brand-mark { width: 30px; height: 30px; }
  .topbar .brand span { display: none; }
  .main { padding: 18px 16px 40px; }
}

/* ---------- page ---------- */
.page { display: grid; gap: 18px; min-width: 0; }
.page > * { min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 4px; }
.page-head p { margin-top: 6px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { display: grid; gap: 16px; padding: clamp(18px, 2.400vw, 26px); border-radius: var(--r-lg); background: var(--bg); border: 1px solid rgba(11, 12, 18, .05); min-width: 0; animation: rise .5s var(--ease) both; }
.card > * { min-width: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
a.card.school { color: inherit; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
a.card.school:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.empty { padding: 28px 12px; text-align: center; color: var(--mute); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand-ink); font-size: 14.500px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { display: grid; gap: 4px; align-content: start; padding: 18px 20px; border-radius: var(--r-md); background: var(--bg); border: 1px solid rgba(11, 12, 18, .05); min-width: 0; animation: rise .5s var(--ease) both; }
.tile-label { font-size: 13px; font-weight: 600; color: var(--mute); }
.tile-value { font-size: clamp(1.375rem, 2.600vw, 1.750rem); font-weight: 700; letter-spacing: -.03em; color: var(--ink); line-height: 1.15; overflow-wrap: anywhere; }
.tile-sub { font-size: 12.500px; color: var(--mute); }
.tile.brand { background: var(--grad); border-color: transparent; }
.tile.brand .tile-label, .tile.brand .tile-sub { color: rgba(255, 255, 255, .78); }
.tile.brand .tile-value { color: #fff; }
.tile.ok .tile-value { color: var(--ok-ink); }
.tile.warn .tile-value { color: var(--warn-ink); }
.tile.bad .tile-value { color: var(--bad-ink); }

.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 8px 18px; font-size: 14.500px; }
.kv > span { color: var(--mute); }
.kv > b { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok-ink); font-size: 12.500px; font-weight: 600; }
.chip .ico { width: 14px; height: 14px; }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.off { background: var(--bg2); color: var(--mute); }
.pill { display: inline-block; padding: 4px 10px; border-radius: var(--r-pill); background: var(--bg2); color: var(--mute); font-size: 12.500px; font-weight: 650; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.amt { font-weight: 650; color: var(--ink); white-space: nowrap; }
.amt.plus { color: var(--ok-ink); }

/* ---------- tables: rows become labelled blocks on a phone ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14.500px; }
.table th { padding: 0 12px 10px 0; text-align: left; font-size: 12.500px; font-weight: 600; color: var(--mute); white-space: nowrap; }
.table td { padding: 12px 12px 12px 0; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.link { cursor: pointer; transition: background-color .15s; }
.table tr.link:hover td { background: var(--bg2); }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; padding-top: 0; }
  .table td { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 3px 0; border: 0; text-align: left; }
  .table td::before { content: attr(data-label); font-size: 12.500px; font-weight: 600; color: var(--mute); }
  .table td[data-label=""]::before { content: none; }
  .table td[data-label=""] { display: block; padding-top: 8px; }
  .table .num { text-align: left; white-space: normal; }
  .table tr.link:hover td { background: none; }
}

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters > select, .filters > input { width: auto; flex: 1 1 170px; max-width: 280px; }
.filters .field { flex: 0 1 170px; }
.filters .btn { min-height: 44px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stage { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--bg2); }
.stage b { font-size: 22px; font-weight: 700; color: var(--mute); letter-spacing: -.02em; }
.stage span { font-size: 13px; color: var(--mute); }
.stage.has { background: var(--brand-soft); }
.stage.has b, .stage.has span { color: var(--brand-ink); }
.alerts ul { display: grid; gap: 10px; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; }
.alerts .ico { color: var(--warn); margin-top: 2px; }

.installs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.install { display: grid; gap: 14px; align-content: start; padding: 18px; border-radius: var(--r-md); background: var(--bg2); min-width: 0; }
.install > * { min-width: 0; }
.access { display: grid; gap: 8px; }
.access-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line); font-size: 14.500px; }
.access-row > :first-child { flex: 1 1 140px; min-width: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.access-row select { width: auto; min-height: 36px; padding: 4px 10px; }

/* ---------- charts ---------- */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--mute); font-family: var(--font); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.chart-tip { position: fixed; z-index: 80; padding: 6px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 12.500px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ---------- modal, toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(11, 12, 18, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); overflow-y: auto; animation: fade .25s ease both; }
.modal { width: min(100%, 440px); display: grid; gap: 16px; padding: 24px; border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-2); animation: rise .35s var(--ease) both; }
.modal.wide { width: min(100%, 620px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--bg2); color: var(--mute); font-size: 20px; line-height: 1; cursor: pointer; }
.x:hover { color: var(--ink); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 18px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-size: 14.500px; font-weight: 550; text-align: center; box-shadow: var(--shadow-2); animation: rise .3s var(--ease) both; }
.toast.err { background: var(--bad); }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .cards, .installs { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv > b { margin-bottom: 8px; }
  .filters > select, .filters > input, .filters .field { flex: 1 1 100%; max-width: none; }
  .auth-card { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
