/* Davomat — "akademik daftar" uslubi: issiq qog'oz, siyoh, yashil muhr va qizil "nb". */
:root {
  --paper: #f4efe4;
  --paper-2: #ebe4d4;
  --card: #fffcf6;
  --ink: #1e1c17;
  --ink-2: #5d574b;
  --ink-3: #8b8475;
  --line: #dcd3c0;
  --line-2: #e9e2d2;
  --green: #1f5c3f;
  --green-2: #2c7a50;
  --green-soft: #e1eee4;
  --amber: #a86d0c;
  --amber-soft: #f8ebcd;
  --red: #b5361f;
  --red-soft: #f6dfd8;
  --blue: #2f5d8c;
  --blue-soft: #dfe8f2;
  --monitor: #121815;
  --monitor-2: #1b231e;
  --radius: 10px;
  --field: #fff;
  --side-bg: #18211c;
  --side-ink: #e9e3d4;
  --side-dim: #cfc8b8;
  --side-active-bg: #e9e3d4;
  --side-active-ink: #18211c;
  --hero-bg: linear-gradient(120deg, #1f5c3f, #18211c 80%);
  --hero-ink: #f1ead9;
  --btn-radius: 8px;
  /* kritik so'ndirilgan prujinaga yaqin egri chiziq (Apple: damping 1.0) va uning ko'zgu aksi —
     kirish va chiqish bir xil yo'ldan o'tadi */
  --ease-in: cubic-bezier(0.2, 0.9, 0.25, 1);
  --ease-out: cubic-bezier(0.75, 0, 0.8, 0.1);
  --shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(40, 32, 15, 0.35);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.55), transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .15 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------------- layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  padding: 22px 16px 18px;
  border-right: 1px solid #0d120f;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-mark { width: 38px; height: 38px; flex: none; color: var(--brand-mark, #8fc7a1); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: #a39d8e; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--side-dim); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav a.active { background: var(--side-active-bg); color: var(--side-active-ink); }
.nav a.active svg { opacity: 1; }
.nav .live-dot { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot button { background: none; border: 0; color: #a39d8e; padding: 0; cursor: pointer; text-decoration: underline; }

main { padding: 30px clamp(16px, 3.4vw, 48px) 64px; min-width: 0; position: relative; }
main::before { /* daftar hoshiyasi */
  content: ""; position: absolute; top: 0; bottom: 0; left: 10px; width: 3px;
  border-left: 1px solid rgba(181, 54, 31, 0.25); border-right: 1px solid rgba(181, 54, 31, 0.25);
  pointer-events: none;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-family: var(--display); font-size: clamp(28px, 3.2vw, 40px); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.page-head .sub { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.page-head .sub em { font-family: var(--display); font-style: italic; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 18px; }

/* ---------------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h2, .section-title {
  font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grid-2b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

/* ---------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--btn-radius); border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 100ms ease-out, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { box-shadow: 0 6px 16px -8px rgba(30, 28, 23, 0.6); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-3); background: rgba(255, 255, 255, 0.5); }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(181, 54, 31, 0.35); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 13px 22px; font-size: 16px; }
.btn.on-dark { background: #e9e3d4; color: #18211c; border-color: #e9e3d4; }
.btn.ghost-dark { background: transparent; color: #e9e3d4; border-color: rgba(233, 227, 212, 0.3); }
.btn.ghost-dark:hover { background: rgba(233, 227, 212, 0.08); }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); font-size: 15px; color: var(--ink); font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(44, 122, 80, 0.15); }
textarea.input { min-height: 160px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--green); }

/* ---------------- pills, chips, status */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  white-space: nowrap;
}
.pill.open { background: var(--green-soft); border-color: transparent; color: var(--green); }
.pill.closed { background: var(--paper-2); border-color: transparent; }
.pill.planned { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.pill.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.pill.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fbf6f; box-shadow: 0 0 0 0 rgba(63, 191, 111, 0.6); animation: pulse 1.6s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(63, 191, 111, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 191, 111, 0); } }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--field); }
.seg button {
  border: 0; background: transparent; padding: 5px 9px; font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--ink-3); min-width: 34px; border-right: 1px solid var(--line-2); font-family: var(--mono);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--paper); color: var(--ink); }
.seg button { transition: background-color 120ms ease-out, color 120ms ease-out, transform 100ms ease-out; touch-action: manipulation; }
.seg button:active { transform: scale(0.92); }
.seg button.on.present { background: var(--green); color: #fff; }
.seg button.on.late { background: var(--amber); color: #fff; }
.seg button.on.absent { background: var(--red); color: #fff; }
.seg button.on.excused { background: var(--blue); color: #fff; }

.st { font-family: var(--mono); font-weight: 700; font-size: 12px; }
.st-present { color: var(--green); }
.st-late { color: var(--amber); }
.st-absent { color: var(--red); }
.st-excused { color: var(--blue); }

/* ---------------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.kpi .value { font-family: var(--display); font-size: 38px; font-weight: 600; line-height: 1.05; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .value small { font-size: 18px; color: var(--ink-3); font-weight: 400; }
.kpi .kpi-note { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  padding: 22px 24px; margin-bottom: 22px;
  background: var(--hero-bg); color: var(--hero-ink); border: 0; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 2px dashed rgba(241, 234, 217, 0.18);
}
.hero h2 { font-family: var(--display); font-size: 24px; margin: 0 0 4px; font-weight: 600; }
.hero p { margin: 0; color: rgba(241, 234, 217, 0.75); }

/* ---------------- tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
  font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(235, 228, 212, 0.4);
  white-space: nowrap;
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(235, 228, 212, 0.35); }
.tbl .num { text-align: right; font-family: var(--mono); }

.bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--green-2); border-radius: 3px; }
.bar.warn > i { background: var(--amber); }
.bar.bad > i { background: var(--red); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--paper-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2);
  border: 1px solid var(--line);
}
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .nm { font-weight: 600; line-height: 1.25; }
.person .meta { font-size: 12px; color: var(--ink-3); }

/* ---------------- monitor (kamera paneli) */
.monitor { background: var(--monitor); color: #dfe7df; border-radius: 12px; overflow: hidden; border: 1px solid #0b0f0c; box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7); }
.monitor-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.monitor-top .rec { font-family: var(--mono); font-weight: 600; letter-spacing: 0.06em; font-size: 12px; }
.screen { position: relative; aspect-ratio: 16 / 9; background: #0a0d0b; display: grid; place-items: center; }
.screen img, .screen video { width: 100%; height: 100%; object-fit: contain; display: block; }
.screen .corner { position: absolute; width: 22px; height: 22px; border-color: rgba(143, 199, 161, 0.7); border-style: solid; pointer-events: none; }
.screen .tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; }
.screen .tr { top: 12px; right: 12px; border-width: 2px 2px 0 0; }
.screen .bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; }
.screen .br { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; }
.screen .empty { text-align: center; color: #8a978d; padding: 24px; max-width: 420px; }
.screen .empty b { color: #dfe7df; display: block; font-family: var(--display); font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.screen .pip { position: absolute; right: 14px; bottom: 14px; width: 26%; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.4); background: #000; }
.screen .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.screen .flash.go { animation: flash 0.4s ease-out; }
@keyframes flash { 0% { opacity: 0.18; } 100% { opacity: 0; } }
.screen img.swap { animation: frame-in 260ms ease-out; }
@keyframes frame-in { from { opacity: 0.55; } }
.monitor-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; font-family: var(--mono); font-size: 12px; color: #9fb0a3; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.monitor-stats b { color: #fff; font-weight: 600; }
.monitor-stats .g { color: #7fd39b; } .monitor-stats .y { color: #f0c066; } .monitor-stats .r { color: #f08a75; }
.monitor-ctrl { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; background: var(--monitor-2); align-items: center; }
.monitor-ctrl select { background: #0f1411; color: #dfe7df; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.monitor-err { padding: 8px 14px; background: rgba(240, 138, 117, 0.12); color: #f5ad9c; font-size: 13px; }

/* ---------------- counters */
.counters { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line-2); }
.counter { padding: 14px 6px 12px; text-align: center; border-right: 1px solid var(--line-2); }
.counter:last-child { border-right: 0; }
.counter .n { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; }
.counter .l { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-top: 4px; }
.counter.present .n { color: var(--green); } .counter.late .n { color: var(--amber); }
.counter.absent .n { color: var(--red); } .counter.excused .n { color: var(--blue); }

.roster { max-height: 720px; overflow-y: auto; }
.roster-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-2); }
.roster-row:last-child { border-bottom: 0; }
.roster-row .person { flex: 1; }
.roster-row.new { animation: newrow 1.6s var(--ease-in); }
@keyframes newrow { 0% { background: var(--green-soft); } 100% { background: transparent; } }
.flag { color: var(--amber); cursor: help; }

/* ---------------- tanilmagan / tasdiqlash yuzlari */
.faces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 16px; }
.face-card { border: 1px solid var(--line); border-radius: 10px; background: var(--field); overflow: hidden; display: flex; flex-direction: column; }
.face-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line-2); }
.face-pair img, .face-card > img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--paper-2); }
.face-pair .ph { aspect-ratio: 1; display: grid; place-items: center; color: var(--ink-3); font-size: 12px; background: var(--paper-2); }
.face-body { padding: 10px; display: grid; gap: 8px; font-size: 13px; }
.face-body .nm { font-weight: 600; }
.face-body select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: var(--field); color: var(--ink); }

/* ---------------- jurnal */
.journal { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.journal th, .journal td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 0; }
.journal thead th { position: sticky; top: 0; background: var(--paper-2); z-index: 2; font-weight: 600; }
.journal .name { position: sticky; left: 0; background: var(--card); z-index: 1; padding: 8px 14px; min-width: 220px; text-align: left; white-space: nowrap; }
.journal thead .name { z-index: 3; background: var(--paper-2); }
.journal .lh { padding: 6px 4px; min-width: 42px; font-family: var(--mono); font-size: 11px; line-height: 1.2; text-align: center; }
.journal .lh span { display: block; color: var(--ink-3); font-family: var(--body); }
.journal td.c { text-align: center; font-family: var(--mono); font-weight: 700; cursor: pointer; height: 34px; }
.journal td.c:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.journal td.c.present { background: var(--green-soft); color: var(--green); }
.journal td.c.late { background: var(--amber-soft); color: var(--amber); }
.journal td.c.absent { background: var(--red-soft); color: var(--red); }
.journal td.c.excused { background: var(--blue-soft); color: var(--blue); }
.journal td.c.pending { color: var(--ink-3); }
.journal td.s { padding: 6px 10px; text-align: right; font-family: var(--mono); white-space: nowrap; }
.journal tr.risk .name { box-shadow: inset 3px 0 0 var(--red); }
.journal tfoot td { background: var(--paper-2); font-family: var(--mono); font-size: 11px; text-align: center; padding: 6px 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 22px; text-align: center; border-radius: 4px; font-style: normal; font-family: var(--mono); font-weight: 700; margin-right: 4px; }

.popover { transform-origin: top left; animation: pop-in 180ms var(--ease-in) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } }
.popover { position: fixed; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.35); padding: 6px; display: grid; gap: 2px; min-width: 150px; }
.popover button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.popover button:hover { background: var(--paper); }

/* ---------------- chart */
.chart { width: 100%; height: 220px; display: block; }
.chart .gridline { stroke: var(--line-2); }
.chart text { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }

/* ---------------- dialog, toast */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45); }
dialog.modal.wide { width: min(920px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(24, 33, 28, 0.55); backdrop-filter: blur(2px); }
/* oyna «materializatsiya» bo'ladi: shaffoflik, masshtab va xiralik birga; yopilishda xuddi shu yo'l teskari */
dialog.modal[open] { animation: sheet-in 320ms var(--ease-in) both; }
dialog.modal[open]::backdrop { animation: fade-in 240ms ease-out both; }
dialog.modal.closing { animation: sheet-out 200ms var(--ease-out) both; }
dialog.modal.closing::backdrop { animation: fade-out 200ms ease-in both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.modal-head h3 { font-family: var(--display); font-size: 22px; margin: 0; font-weight: 600; }
.modal-head .x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.modal-body { padding: 16px 22px; display: grid; gap: 14px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line-2); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); animation: toastin 300ms var(--ease-in) both; max-width: 380px; }
.toast.out { animation: toastout 200ms var(--ease-out) both; }
@keyframes toastout { to { transform: translateY(10px) scale(0.98); opacity: 0; } }
.toast.err { background: var(--red); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }
@keyframes toastin { from { transform: translateY(10px) scale(0.98); opacity: 0; } }
.face-card { transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.face-card.leaving { opacity: 0; transform: scale(0.96); pointer-events: none; }
/* mavzu almashganda yorug'lik keskin sakramasin */
html.theme-anim, html.theme-anim * { transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important; }

.note { padding: 12px 14px; border-radius: 8px; background: var(--paper); border: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); }
.note.warn { background: var(--amber-soft); border-color: rgba(168, 109, 12, 0.3); color: #6b4708; }
.note.ok { background: var(--green-soft); border-color: rgba(31, 92, 63, 0.25); color: var(--green); }
.note.bad { background: var(--red-soft); border-color: rgba(181, 54, 31, 0.3); color: #7c2414; }
.empty-state { padding: 34px 20px; text-align: center; color: var(--ink-2); }
.empty-state b { display: block; font-family: var(--display); font-size: 20px; color: var(--ink); margin-bottom: 6px; font-weight: 600; }
.ready { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.ready .bar { flex: 1; min-width: 160px; height: 10px; border-radius: 5px; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--paper-2); padding: 1px 6px; border-radius: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--field); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chips button:hover { border-color: var(--ink-3); }

/* ---------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); padding: 30px 28px; }
.auth-card h1 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 14px 0 4px; letter-spacing: -0.02em; }
.auth-card .brand-mark { width: 52px; height: 52px; color: var(--green); }

.loading { padding: 60px; text-align: center; color: var(--ink-3); }
.fade-in > * { animation: rise 0.35s ease-out both; }
.fade-in > *:nth-child(2) { animation-delay: 0.04s; } .fade-in > *:nth-child(3) { animation-delay: 0.08s; }
.fade-in > *:nth-child(4) { animation-delay: 0.12s; } .fade-in > *:nth-child(5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 1080px) {
  .grid-2, .grid-2b { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; overflow-x: auto; }
  .brand { padding: 0 6px 0 0; }
  .brand-sub, .side-foot, .brand-name { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 10px; white-space: nowrap; font-size: 13px; }
  .nav a svg { display: none; }
  main::before { display: none; }
  main { padding-top: 20px; }
  .hero { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .counters { grid-template-columns: repeat(3, 1fr); }
  .counter:nth-child(n + 4) { border-top: 1px solid var(--line-2); }
}
/* Kamroq harakat: siljish va masshtab o'rniga faqat qisqa shaffoflik o'tishi — fikr-mulohaza saqlanadi */
@media (prefers-reduced-motion: reduce) {
  @keyframes rise { from { opacity: 0; } }
  @keyframes sheet-in { from { opacity: 0; } }
  @keyframes sheet-out { to { opacity: 0; } }
  @keyframes toastin { from { opacity: 0; } }
  @keyframes toastout { to { opacity: 0; } }
  @keyframes pop-in { from { opacity: 0; } }
  .live-dot, .dot { animation: none !important; }
  .screen .flash.go { animation: none; }
  .btn:active, .seg button:active { transform: none; }
  .face-card.leaving { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  dialog.modal::backdrop { backdrop-filter: none; background: rgba(24, 33, 28, 0.78); }
}


/* =====================================================================
   MAVZULAR (Kombai galereyasidan ilhomlangan). <html data-theme="…">
   ===================================================================== */

/* --- Ledger — «Solo Ledger»: iliq tahririyat daftari, chiziqli kartalar, katta mono raqamlar */
html[data-theme="ledger"] {
  --paper: #f3eee3; --paper-2: #e8e1d2; --card: #fbf8f1; --ink: #14201d; --ink-2: #4c5753; --ink-3: #7d8681;
  --line: #14201d; --line-2: #d9d2c2;
  --green: #1d4d47; --green-2: #2f6f66; --green-soft: #dcebe6; --amber: #b5651d; --amber-soft: #f6dfc6;
  --red: #c2462e; --red-soft: #f4d6cc; --blue: #2b5c74; --blue-soft: #d9e7ec;
  --radius: 4px; --btn-radius: 999px; --shadow: none;
  --display: "Bricolage Grotesque", "Onest", system-ui, sans-serif;
  --side-bg: #fbf8f1; --side-ink: #14201d; --side-dim: #4c5753; --side-active-bg: #f2c9b5; --side-active-ink: #14201d;
  --hero-bg: #1d4d47; --hero-ink: #f3eee3;
}
html[data-theme="ledger"] body { background-image: none; }
html[data-theme="ledger"] main::before { display: none; }
html[data-theme="ledger"] .side { border-right: 1.5px solid var(--ink); }
html[data-theme="ledger"] .brand-mark { color: var(--green); }
html[data-theme="ledger"] .brand-sub, html[data-theme="ledger"] .side-foot button { color: var(--ink-3); }
html[data-theme="ledger"] .side-foot { border-top-color: var(--line-2); }
html[data-theme="ledger"] .side-foot .who { color: var(--ink); }
html[data-theme="ledger"] .nav a:hover { background: var(--paper-2); color: var(--ink); }
html[data-theme="ledger"] .card { border: 1.5px solid var(--ink); }
html[data-theme="ledger"] .kpi .value, html[data-theme="ledger"] .counter .n { font-family: var(--mono); font-weight: 700; letter-spacing: -0.04em; }
html[data-theme="ledger"] .kpi:nth-child(1) { background: #dcebe6; } html[data-theme="ledger"] .kpi:nth-child(2) { background: #f6dfc6; }
html[data-theme="ledger"] .kpi:nth-child(3) { background: #e3e6f0; } html[data-theme="ledger"] .kpi:nth-child(4) { background: #f4d6cc; }
html[data-theme="ledger"] .kpi .label, html[data-theme="ledger"] .tbl th { font-family: var(--mono); letter-spacing: 0.04em; }
html[data-theme="ledger"] .page-head h1 { font-weight: 700; letter-spacing: -0.03em; }
html[data-theme="ledger"] .hero::after { border-color: rgba(243, 238, 227, 0.25); border-radius: 0; transform: rotate(12deg); }
html[data-theme="ledger"] .tbl th { background: transparent; border-bottom: 1.5px solid var(--ink); }
html[data-theme="ledger"] .pill { border-radius: 999px; border: 1px solid var(--ink); }

/* --- Aniq — «Northbeam»: oq kanvas, zich ma'lumot, elektr ko'k, yashil/qizil deltalar */
html[data-theme="aniq"] {
  --paper: #f7f7f5; --paper-2: #eef0f3; --card: #ffffff; --ink: #111318; --ink-2: #4a5160; --ink-3: #8a91a0;
  --line: #e3e6ec; --line-2: #eef0f3;
  --green: #2f55ff; --green-2: #2f55ff; --green-soft: #e7ecff; --amber: #c27a00; --amber-soft: #fff1d6;
  --red: #e5484d; --red-soft: #fde8e8; --blue: #0f9d6b; --blue-soft: #dcf5ea;
  --radius: 8px; --btn-radius: 6px; --shadow: 0 1px 2px rgba(17, 19, 24, 0.04);
  --display: "Archivo", "Onest", system-ui, sans-serif; --body: "Archivo", "Onest", system-ui, sans-serif;
  --side-bg: #ffffff; --side-ink: #111318; --side-dim: #4a5160; --side-active-bg: #eef1ff; --side-active-ink: #2f55ff;
  --hero-bg: #111318; --hero-ink: #ffffff;
}
html[data-theme="aniq"] body { background-image: none; font-size: 14px; }
html[data-theme="aniq"] main::before { display: none; }
html[data-theme="aniq"] .side { border-right: 1px solid var(--line); }
html[data-theme="aniq"] .brand-mark { color: #2f55ff; }
html[data-theme="aniq"] .brand-sub, html[data-theme="aniq"] .side-foot button { color: var(--ink-3); }
html[data-theme="aniq"] .side-foot { border-top-color: var(--line); }
html[data-theme="aniq"] .side-foot .who { color: var(--ink); }
html[data-theme="aniq"] .nav a:hover { background: var(--paper-2); color: var(--ink); }
html[data-theme="aniq"] .page-head h1 { font-weight: 700; letter-spacing: -0.035em; }
html[data-theme="aniq"] .kpis { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
html[data-theme="aniq"] .kpi { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
html[data-theme="aniq"] .kpi:last-child { border-right: 0; }
html[data-theme="aniq"] .kpi .value { font-family: var(--display); font-weight: 600; font-size: 34px; }
html[data-theme="aniq"] .kpi .label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); }
html[data-theme="aniq"] .counter .n { font-family: var(--display); font-weight: 600; }
html[data-theme="aniq"] .hero::after { display: none; }
html[data-theme="aniq"] .btn.green { background: #2f55ff; border-color: #2f55ff; }
html[data-theme="aniq"] .seg button.on.present { background: #0f9d6b; }
html[data-theme="aniq"] .bar > i { background: #2f55ff; }
html[data-theme="aniq"] .st-present { color: #0f9d6b; }
html[data-theme="aniq"] .journal td.c.present { background: #dcf5ea; color: #0f9d6b; }
html[data-theme="aniq"] .counter.present .n { color: #0f9d6b; }
html[data-theme="aniq"] .counter.excused .n { color: #2f55ff; }

/* --- Tun — «Cointrail»: qorong'i nazorat xonasi, yalpiz-yashil, qizil yo'qotishlar, sariq trend */
html[data-theme="tun"] {
  color-scheme: dark;
  --paper: #0b0f0d; --paper-2: #151c18; --card: #111714; --ink: #e8efe9; --ink-2: #a3b1a8; --ink-3: #6d7b72;
  --line: #222c26; --line-2: #1a221e; --field: #0e1411;
  --green: #3ddc97; --green-2: #3ddc97; --green-soft: rgba(61, 220, 151, 0.12); --amber: #f3c14b; --amber-soft: rgba(243, 193, 75, 0.14);
  --red: #ff6464; --red-soft: rgba(255, 100, 100, 0.13); --blue: #6fa8ff; --blue-soft: rgba(111, 168, 255, 0.14);
  --radius: 12px; --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --side-bg: #080b0a; --side-ink: #e8efe9; --side-dim: #8e9c93; --side-active-bg: #16211b; --side-active-ink: #3ddc97;
  --hero-bg: radial-gradient(600px 200px at 0% 0%, rgba(61, 220, 151, 0.22), transparent), #111714; --hero-ink: #e8efe9;
  --monitor: #070a09; --monitor-2: #0c110e;
}
html[data-theme="tun"] body { background-image: none; }
html[data-theme="tun"] main::before { display: none; }
html[data-theme="tun"] .side { border-right-color: var(--line); }
html[data-theme="tun"] .brand-mark { color: #3ddc97; }
html[data-theme="tun"] .btn { background: var(--ink); color: #0b0f0d; border-color: var(--ink); }
html[data-theme="tun"] .btn.green { background: #3ddc97; border-color: #3ddc97; color: #04140c; }
html[data-theme="tun"] .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
html[data-theme="tun"] .btn.ghost:hover { background: var(--paper-2); }
html[data-theme="tun"] .btn.danger { background: transparent; color: var(--red); border-color: rgba(255, 100, 100, 0.35); }
html[data-theme="tun"] .btn.on-dark { background: #3ddc97; color: #04140c; border-color: #3ddc97; }
html[data-theme="tun"] .hero { border: 1px solid var(--line); }
html[data-theme="tun"] .hero p { color: var(--ink-2); }
html[data-theme="tun"] .hero::after { border-color: rgba(61, 220, 151, 0.2); }
html[data-theme="tun"] .kpi .value, html[data-theme="tun"] .counter .n { font-family: var(--mono); font-weight: 600; letter-spacing: -0.03em; }
html[data-theme="tun"] .tbl th { background: rgba(255, 255, 255, 0.02); }
html[data-theme="tun"] .seg button.on.present, html[data-theme="tun"] .seg button.on.late { color: #04140c; }
html[data-theme="tun"] .note { background: var(--paper-2); }
html[data-theme="tun"] dialog.modal::backdrop { background: rgba(0, 0, 0, 0.65); }
html[data-theme="tun"] .toast { background: #e8efe9; color: #0b0f0d; }

/* mavzu tanlash kartalari */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.theme-opt { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; background: var(--field); text-align: left; display: grid; gap: 8px; color: var(--ink); }
.theme-opt.on { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.theme-opt .sw { display: flex; height: 38px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.08); }
.theme-opt .sw i { flex: 1; }
.theme-opt b { font-size: 14px; } .theme-opt span { font-size: 12px; color: var(--ink-3); }
html[data-theme="aniq"] .btn.on-dark { background: #fff; color: #111318; border-color: #fff; }
html[data-theme="aniq"] .tbl th { background: #fafafb; }
html[data-theme="tun"] .btn.ghost-dark { background: transparent; color: var(--ink); border-color: rgba(232, 239, 233, 0.25); }
