/* Informatika jurnali — uslublar
   Palitra: katak daftar qog'ozi + ko'k ruchka; sinf ranglari dars jadvalidan (5 ko'k, 6 yashil, 7 to'q sariq, 8 sariq) */
:root {
  --bg: #F2F5F9;
  --grid: #E3E9F1;
  --surface: #FFFFFF;
  --surface-2: #EEF2F7;
  --ink: #152033;
  --muted: #5A6579;
  --line: #D9E0EA;
  --accent: #2350C8;
  --accent-soft: #E3EAFB;
  --on-accent: #FFFFFF;

  --c5: #3E73C3; --c5-soft: #E2ECF8;
  --c6: #4E9E46; --c6-soft: #E4F2E1;
  --c7: #DC8C22; --c7-soft: #FBEEDB;
  --c8: #D8BE16; --c8-soft: #FAF4CF; --c8-ink: #3B3300;

  --ok: #1E8449;  --ok-soft: #DDF3E6;
  --warn: #B96B00; --warn-soft: #FDF0D8;
  --bad: #C4372C;  --bad-soft: #FBE3E0;
  --ex: #6B5BB5;  --ex-soft: #ECE8FA;

  --g-hi: #16804A;  --g-hi-bg: #DDF3E6;
  --g-mid: #5F7D0E; --g-mid-bg: #EEF4D6;
  --g-low: #B66700; --g-low-bg: #FDEFD7;
  --g-bad: #C4372C; --g-bad-bg: #FBE3E0;

  --need1: #FFF6E2; --need1-line: #E7A43A;
  --need2: #FDE9E7; --need2-line: #D8473C;

  --shadow: 0 1px 2px rgba(21, 32, 51, .06), 0 4px 16px rgba(21, 32, 51, .05);
  --radius: 10px;
  --f-ui: "Onest", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-disp: "Unbounded", "Onest", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E121A; --grid: #151B26; --surface: #161C28; --surface-2: #1D2432;
    --ink: #E6EAF2; --muted: #98A2B5; --line: #2A3243;
    --accent: #7B9CFF; --accent-soft: #1E2A4A; --on-accent: #0E1424;
    --c5: #6C9BE0; --c5-soft: #1B2840; --c6: #72C06A; --c6-soft: #1A2E1C;
    --c7: #F0A847; --c7-soft: #33261A; --c8: #E8D24A; --c8-soft: #302C14; --c8-ink: #1E1A00;
    --ok: #5CCB88; --ok-soft: #173026; --warn: #F2B24C; --warn-soft: #33281A;
    --bad: #F07A6F; --bad-soft: #3A1E1E; --ex: #A898F0; --ex-soft: #26223E;
    --g-hi: #5CCB88; --g-hi-bg: #173026; --g-mid: #B7D35A; --g-mid-bg: #262E17;
    --g-low: #F2B24C; --g-low-bg: #33281A; --g-bad: #F07A6F; --g-bad-bg: #3A1E1E;
    --need1: #2B2415; --need1-line: #E0A040; --need2: #33191B; --need2-line: #E0605A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E121A; --grid: #151B26; --surface: #161C28; --surface-2: #1D2432;
  --ink: #E6EAF2; --muted: #98A2B5; --line: #2A3243;
  --accent: #7B9CFF; --accent-soft: #1E2A4A; --on-accent: #0E1424;
  --c5: #6C9BE0; --c5-soft: #1B2840; --c6: #72C06A; --c6-soft: #1A2E1C;
  --c7: #F0A847; --c7-soft: #33261A; --c8: #E8D24A; --c8-soft: #302C14; --c8-ink: #1E1A00;
  --ok: #5CCB88; --ok-soft: #173026; --warn: #F2B24C; --warn-soft: #33281A;
  --bad: #F07A6F; --bad-soft: #3A1E1E; --ex: #A898F0; --ex-soft: #26223E;
  --g-hi: #5CCB88; --g-hi-bg: #173026; --g-mid: #B7D35A; --g-mid-bg: #262E17;
  --g-low: #F2B24C; --g-low-bg: #33281A; --g-bad: #F07A6F; --g-bad-bg: #3A1E1E;
  --need1: #2B2415; --need1-line: #E0A040; --need2: #33191B; --need2-line: #E0605A;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--f-ui);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.mono, .num, .tl-time, .clock, .stats b { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, button, textarea { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=time], select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; max-width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small, .ghost.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.danger.confirm { background: var(--bad); color: #fff; border-color: var(--bad); }
a.ghost.small { border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }

/* ---------- Yuqori menyu ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--f-disp); letter-spacing: .02em;
}
.brand-mark.big { width: 52px; height: 52px; font-size: 20px; border-radius: 12px; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.mainnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.mainnav a.on { background: var(--accent-soft); color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.clock { font: 600 18px/1 var(--f-disp); letter-spacing: .02em; }
.banner { padding: 10px 16px; font-weight: 500; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

.wrap { max-width: 1280px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.wrap.narrow { max-width: 860px; }

/* ---------- Sinf belgisi ---------- */
.chip {
  display: inline-grid; place-items: center; min-width: 38px; padding: 3px 8px; border-radius: 6px;
  font: 700 12px/1.2 var(--f-disp); letter-spacing: .02em; color: #fff; background: var(--c5);
}
.chip.lv6 { background: var(--c6); } .chip.lv7 { background: var(--c7); } .chip.lv8 { background: var(--c8); color: var(--c8-ink); }
.chip.lg { font-size: 15px; padding: 6px 10px; min-width: 52px; border-radius: 8px; }
.chip.xl { font-size: 26px; padding: 10px 14px; min-width: 84px; border-radius: 12px; }
.chip-sub { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--muted); vertical-align: middle; } /* bir sinf ikki fanda */
.wcell small { margin-left: 3px; font-size: 10px; opacity: .85; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.warn-t { color: var(--warn); } .bad-t { color: var(--bad); }

/* ---------- Sahifa sarlavhasi ---------- */
.day-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.day-title { font: 700 clamp(26px, 4vw, 38px)/1.1 var(--f-disp); letter-spacing: -.01em; }
.day-head p { margin: 6px 0 0; }
.day-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.sec-head h2 { font-size: 19px; }
.sec-head p { margin: 0; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.empty-big { font-size: 20px; font-weight: 600; margin: 0 0 6px; }

/* ---------- Bugungi darslar ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: stretch; }
.tl-time { display: flex; flex-direction: column; align-items: flex-end; padding-top: 14px; }
.tl-t1 { font: 700 26px/1 var(--f-disp); }
.tl-t2 { font: 500 15px/1.4 var(--f-disp); color: var(--muted); margin-top: 4px; }
.tl-per { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tl-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  border-left: 5px solid var(--c5);
}
.tl-item.lv6 .tl-card { border-left-color: var(--c6); } .tl-item.lv7 .tl-card { border-left-color: var(--c7); } .tl-item.lv8 .tl-card { border-left-color: var(--c8); }
.tl-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tl-state { font-size: 13px; color: var(--muted); }
.tl-topic { font-size: 20px; line-height: 1.3; }
.tl-meta { margin: 0; display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.tl-meta b { color: var(--ink); }
.tl-progress { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.tl-progress b { color: var(--ink); }
.pbar { width: 120px; height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--ok); border-radius: 9px; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tl-item.is-past { opacity: .62; }
.tl-item.is-past:hover { opacity: 1; }
.tl-item.is-now .tl-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); border-left-width: 5px; }
.tl-item.is-now .tl-card::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: var(--prog, 0%); background: var(--accent);
}
.tl-item.is-now .tl-state { color: var(--accent); }
.tl-item.is-now .tl-t1 { color: var(--accent); }
.tl-item.is-next .tl-state { color: var(--ink); font-weight: 600; }

/* ---------- Haftalik jadval ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.weekgrid { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.weekgrid th, .weekgrid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px; text-align: center; }
.weekgrid thead th { padding: 10px 6px; font-weight: 700; background: var(--surface-2); }
.weekgrid thead th span { display: block; }
.weekgrid thead th small { color: var(--muted); font-weight: 500; }
.weekgrid th.is-today, .weekgrid td.is-today { background: var(--accent-soft); }
.weekgrid .shift-row th { background: var(--surface-2); text-align: left; padding: 6px 12px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.weekgrid .per { width: 104px; text-align: left; padding: 6px 10px; }
.weekgrid .per b { font: 700 15px var(--f-disp); margin-right: 6px; }
.weekgrid .per small { color: var(--muted); font-size: 11.5px; }
.weekgrid td { height: 42px; }
.weekgrid td.is-now { box-shadow: inset 0 0 0 2px var(--accent); }
.wcell {
  display: block; padding: 7px 4px; border-radius: 6px; font: 700 13px var(--f-disp); color: #fff; background: var(--c5);
}
.wcell:hover { text-decoration: none; filter: brightness(1.08); }
.wcell.off { opacity: .35; outline: 1px dashed currentColor; outline-offset: -3px; } /* 2 haftada bir: bu hafta yo'q */
.wcell.lv6 { background: var(--c6); } .wcell.lv7 { background: var(--c7); } .wcell.lv8 { background: var(--c8); color: var(--c8-ink); }

/* ---------- Dars ekrani ---------- */
.lesson-head {
  display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow);
}
.lh-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lh-line { display: flex; align-items: center; gap: 14px; }
.lh-when { display: flex; flex-direction: column; }
.lh-when b { font-size: 17px; }
.lh-when span { color: var(--muted); font-size: 14px; }
.lh-topic { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; }
.lh-hw { margin: 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 16px; }
.lh-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.lh-nav { display: flex; gap: 6px; align-items: center; }
.lh-nav select { max-width: 280px; }
.lh-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.savestate { font-size: 12.5px; color: var(--muted); }
.savestate.ok { color: var(--ok); } .savestate.busy { color: var(--accent); } .savestate.bad { color: var(--bad); font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--ok); }

.lesson-bar { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg .on { background: var(--accent); color: var(--on-accent); }
.seg small { opacity: .75; font-weight: 500; }
.counters { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ct { font-size: 13px; padding: 5px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.ct b { font-size: 15px; color: var(--ink); margin-left: 2px; }
.ct.ok b { color: var(--ok); } .ct.bad b { color: var(--bad); } .ct.warn b { color: var(--warn); } .ct.acc b { color: var(--accent); }

.roster { display: flex; flex-direction: column; gap: 6px; }
.gsep { font: 700 12px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 4px 2px; }
.row {
  display: grid; grid-template-columns: 34px minmax(200px, 1fr) auto auto 48px; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid transparent; border-radius: 10px;
  padding: 8px 12px 8px 8px; transition: background .15s, border-color .15s;
}
.row.need1 { background: var(--need1); border-left-color: var(--need1-line); }
.row.need2 { background: var(--need2); border-left-color: var(--need2-line); }
.row.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.row.need1.sel { border-left-color: var(--need1-line); } .row.need2.sel { border-left-color: var(--need2-line); }
.row .num { font: 600 14px var(--f-disp); color: var(--muted); text-align: right; }
.who { min-width: 0; }
.nm { font-size: 17px; line-height: 1.3; }
.nm .fn { font-weight: 700; }
.nm .pt { color: var(--muted); font-size: 14px; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; min-height: 20px; }
.gtag { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.flag { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.flag.f1 { background: var(--warn-soft); color: var(--warn); }
.flag.f2 { background: var(--bad-soft); color: var(--bad); }
.hist { display: inline-flex; gap: 3px; }
.hist i, .avg { font-style: normal; font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.hist i.nb { color: var(--bad); font-weight: 600; }
.avg { border: 1px dashed var(--line); background: transparent; }
.att, .grades { display: flex; gap: 4px; }
.ab, .gb {
  height: 38px; min-width: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; cursor: pointer; padding: 0 6px; transition: background .1s, color .1s, border-color .1s, transform .05s;
}
.ab:active, .gb:active { transform: scale(.94); }
.ab { color: var(--muted); font-size: 13px; min-width: 40px; }
.ab:hover { border-color: var(--ink); }
.ab-p.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.ab-a.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.ab-l.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.ab-e.on { background: var(--ex); border-color: var(--ex); color: #fff; }
.gb { font: 700 15px var(--f-disp); min-width: 34px; color: var(--ink); }
.gb.g-hi { color: var(--g-hi); } .gb.g-mid { color: var(--g-mid); } .gb.g-low { color: var(--g-low); } .gb.g-bad { color: var(--g-bad); }
.gb:hover { border-color: currentColor; }
.gb.on.g-hi { background: var(--g-hi); border-color: var(--g-hi); color: #fff; }
.gb.on.g-mid { background: var(--g-mid); border-color: var(--g-mid); color: #fff; }
.gb.on.g-low { background: var(--g-low); border-color: var(--g-low); color: #fff; }
.gb.on.g-bad { background: var(--g-bad); border-color: var(--g-bad); color: #fff; }
.ballin { width: 78px; height: 38px; font: 700 16px var(--f-disp); text-align: center; }
.cur { font: 700 22px/1 var(--f-disp); text-align: center; }
.cur.g-hi { color: var(--g-hi); } .cur.g-mid { color: var(--g-mid); } .cur.g-low { color: var(--g-low); } .cur.g-bad { color: var(--g-bad); }
.row.is-absent .cur { font-size: 14px; color: var(--bad); }
.row.is-absent .grades { opacity: .3; }
.row.is-absent .fn { color: var(--muted); }
.kbd-help { font-size: 13px; margin: 0; }
kbd { font: 600 11.5px var(--f-ui); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; margin: 0 1px; }

/* To'liq ekran (proyektor) rejimi */
body.screen .topbar, body.screen .kbd-help, body.screen .lh-nav, body.screen .savestate { display: none; }
body.screen .wrap { max-width: none; padding-block: 16px; gap: 14px; }
body.screen .nm { font-size: 21px; }
body.screen .nm .pt { display: none; }
body.screen .ab, body.screen .gb { height: 44px; min-width: 44px; font-size: 17px; }
body.screen .cur { font-size: 28px; }
body.screen .lh-topic { font-size: clamp(28px, 3vw, 44px); }

/* ---------- Jurnal ---------- */
.j-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; min-width: 96px; }
.stats span { font-size: 12px; color: var(--muted); }
.stats b { font: 700 20px var(--f-disp); }
.jtable-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.jtable { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.jtable th, .jtable td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; }
.jtable thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 2; }
.jtable .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 240px; max-width: 320px; }
.jtable thead .sticky-col { z-index: 3; background: var(--surface-2); }
.jtable .sname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jtable .sname .n { display: inline-block; width: 22px; color: var(--muted); font-size: 12px; }
.jtable th.lc a { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; color: var(--ink); min-width: 52px; }
.jtable th.lc a:hover { text-decoration: none; background: var(--accent-soft); }
.jtable th.lc small { color: var(--muted); font-size: 11px; }
.jtable th.lc span { font-weight: 700; font-size: 13px; }
.jtable th.lc em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--warn); }
.jtable th.lc em.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-top: 3px; }
.jtable th.is-today { box-shadow: inset 0 -3px 0 var(--accent); }
.jtable td.cell a { display: grid; place-items: center; height: 36px; font: 700 14px var(--f-disp); color: var(--ink); position: relative; }
.jtable td.cell a:hover { text-decoration: none; background: var(--accent-soft); }
.jtable td.cell.late a::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 8px 8px 0; border-color: transparent var(--warn) transparent transparent; }
.jtable td.num { text-align: center; padding: 0 8px; white-space: nowrap; font-size: 13px; }
.jtable th.num { padding: 6px 8px; font-size: 12px; }
.jtable tr.grp td { background: var(--surface-2); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 12px; }
.jtable tr.need2 .sname { box-shadow: inset 4px 0 0 var(--need2-line); background: var(--need2); }
.jtable tr.need1 .sname { box-shadow: inset 4px 0 0 var(--need1-line); background: var(--need1); }
.g-hi { color: var(--g-hi); } .g-mid { color: var(--g-mid); } .g-low { color: var(--g-low); } .g-bad { color: var(--g-bad); }
td.cell.g-hi { background: var(--g-hi-bg); } td.cell.g-mid { background: var(--g-mid-bg); } td.cell.g-low { background: var(--g-low-bg); } td.cell.g-bad { background: var(--g-bad-bg); }
td.cell.g-hi a { color: var(--g-hi); } td.cell.g-mid a { color: var(--g-mid); } td.cell.g-low a { color: var(--g-low); } td.cell.g-bad a { color: var(--g-bad); }
td.cell.att-a a { color: var(--bad); font-family: var(--f-ui); font-weight: 600; }
td.cell.att-e a { color: var(--ex); font-family: var(--f-ui); font-weight: 600; }
td.cell.att-p a { color: var(--muted); }
.legend { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-size: 12.5px; margin: -14px 0 0; }
.lg { padding: 1px 8px; border-radius: 5px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.lg.g-hi { background: var(--g-hi-bg); } .lg.g-mid { background: var(--g-mid-bg); } .lg.g-low { background: var(--g-low-bg); } .lg.g-bad { background: var(--g-bad-bg); }
.lg.att-a { color: var(--bad); } .lg.att-e { color: var(--ex); } .lg.late { position: relative; }

/* Boshqaruv jadvallari */
.manage { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.ltable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ltable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.ltable td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ltable input[type=text] { width: 100%; min-width: 180px; }
.ltable .w-num { width: 70px; }
.ltable .row-actions { display: flex; gap: 6px; }
.ltable .row-actions form, .ltable td > form { margin: 0; }
.ltable tr.addrow td { background: var(--accent-soft); }
.ltable tr.inactive { opacity: .55; }
.ltable tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 12.5px; }
.logt .old { color: var(--muted); text-decoration: line-through; }

/* Sinflar */
.level { display: flex; flex-direction: column; gap: 12px; }
.level-h { font: 700 18px var(--f-disp); display: flex; align-items: center; gap: 8px; }
.level-h span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--c5); color: #fff; }
.level-h.lv6 span { background: var(--c6); } .level-h.lv7 span { background: var(--c7); } .level-h.lv8 span { background: var(--c8); color: var(--c8-ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ccard { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c5); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.ccard.lv6 { border-top-color: var(--c6); } .ccard.lv7 { border-top-color: var(--c7); } .ccard.lv8 { border-top-color: var(--c8); }
.ccard header { display: flex; gap: 12px; align-items: center; }
.ccard header div { display: flex; flex-direction: column; min-width: 0; }
.ccard header small { color: var(--muted); font-size: 12.5px; }
.ccard dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.ccard dt { font-size: 11px; color: var(--muted); }
.ccard dd { margin: 0; font: 700 16px var(--f-disp); }
.ccard dd small { font: 500 11px var(--f-ui); color: var(--muted); }
.ccard .next { margin: 0; font-size: 13.5px; color: var(--muted); }
.ccard .next b { color: var(--ink); }
.ccard footer { display: flex; gap: 8px; margin-top: auto; }

/* Sozlamalar */
.bells { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.bells fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.bells legend { font-weight: 700; padding: 0 6px; }
.bell-row { display: flex; align-items: center; gap: 8px; }
.bell-row > span:first-child { width: 58px; color: var(--muted); font-size: 13px; }
.form-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.files { display: flex; flex-direction: column; gap: 8px; }
.files > div { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files span { color: var(--muted); font-size: 13.5px; }
.backups { margin-top: 12px; }
.backups summary { cursor: pointer; font-weight: 600; }
.backups ul { columns: 2; font-size: 13.5px; }
.pwform { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.pwform label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

/* Kirish */
body.login { display: grid; place-items: center; min-height: 100vh; padding-inline: 16px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { font: 700 22px var(--f-disp); margin-top: 6px; }
.login-card p { margin: 0 0 6px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card input { width: 100%; padding: 10px 12px; font-size: 16px; }
.login-card .btn { margin-top: 8px; padding: 11px; }
.err { color: var(--bad); font-weight: 600; }

/* Xabar */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }


/* ---------- Telegram ---------- */
.tgpanel { display: flex; flex-direction: column; gap: 6px; }
.tgpanel:empty { display: none; }
.tg-unit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.tg-meta { color: var(--muted); font-size: 13px; }
body.screen .tgpanel { display: none; }
.ok-t { color: var(--ok); font-weight: 700; }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 320px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }
.bot-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.bot-status > div { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
.bot-status span { font-size: 12px; }
.callout { margin-top: 14px; background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; word-break: break-all; }
.small-p { font-size: 13px; margin: 10px 0 0; word-break: break-word; }
pre.code { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 13px; margin: 6px 0 10px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline dotted; }
.ltable .center, .ltable th.center { text-align: center; }
.ltable input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.ltable.users input[type=text] { min-width: 160px; }
.matrix td, .matrix th { white-space: nowrap; }
.rules { display: flex; flex-direction: column; gap: 12px; }
.rules fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rules legend { font-weight: 700; padding: 0 6px; }
.rules label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rules input[type=radio], .rules input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.rules .w-num { width: 74px; }
.seg-radio { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-radio label { cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; font-size: 14px; }
.seg-radio small { font-weight: 500; color: var(--muted); font-size: 12px; }
.seg-radio input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg-radio input:checked + span small { color: var(--on-accent); opacity: .85; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.teachers { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.tcard { border: 1px solid var(--line); border-left: 5px solid var(--warn); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); min-width: 0; }
.tcard.is-linked { border-left-color: var(--ok); }
.tcard header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard header b { font-size: 16px; }
.tunits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.tunits .unit { display: inline-flex; align-items: center; gap: 4px; }
.tlink { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tlink code { flex: 1 1 100%; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; word-break: break-all; font-size: 12.5px; }
.auto { font-size: 12px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.uunits { font-size: 13px; max-width: 260px; }

/* ---------- Moslashuv ---------- */
@media (max-width: 1100px) {
  .row { grid-template-columns: 34px 1fr 48px; grid-template-areas: "n who cur" "n att att" "n gr gr"; row-gap: 8px; }
  .row .num { grid-area: n; align-self: start; padding-top: 3px; }
  .row .who { grid-area: who; } .row .cur { grid-area: cur; } .row .att { grid-area: att; } .row .grades { grid-area: gr; flex-wrap: wrap; }
  .lesson-head { grid-template-columns: 1fr; }
  .lh-side { align-items: flex-start; }
  .counters { margin-left: 0; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; }
  .brand-txt { display: none; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tl-item { grid-template-columns: 1fr; gap: 6px; }
  .tl-time { flex-direction: row; align-items: baseline; gap: 8px; padding-top: 0; }
  .tl-t1 { font-size: 20px; } .tl-t2 { margin: 0; }
  .gb { min-width: 30px; height: 36px; font-size: 14px; }
  .ab { min-width: 38px; }
  .lh-side { align-items: stretch; width: 100%; }
  .lh-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .lh-nav select { grid-column: 1 / -1; grid-row: 1; width: 100%; max-width: 100%; }
  .lesson-head { padding: 14px; }
  .chip.xl { font-size: 20px; min-width: 64px; padding: 8px 10px; }
  .files > div { grid-template-columns: 1fr auto; }
  .files span { grid-column: 1 / -1; grid-row: 2; }
  .ccard dl { grid-template-columns: repeat(2, 1fr); }
  .jtable .sticky-col { min-width: 170px; }
}
/* ---------- Ko'p ustoz: sinf qo'shish, jadval, ro'yxat bilan qo'shish, admin ---------- */
textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; resize: vertical; line-height: 1.45; }
textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.classform { display: flex; flex-direction: column; gap: 14px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.cf-grid label, .group-row label, .bulk-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cf-grid label[hidden] { display: none; }
.slots-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.slots-box legend { font-weight: 700; padding: 0 6px; }
.slots { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.slot-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.group-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr); gap: 10px; width: 100%; }
.cf-foot { justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bulk { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.bulk summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.bulkform { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.bulk-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.banner.view { background: var(--accent-soft); color: var(--ink); }
.banner.view a { font-weight: 700; margin-left: 6px; }
.who-me { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.tmeta b { color: var(--ink); }
.tstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.tstats dt { font-size: 11px; color: var(--muted); }
.tstats dd { margin: 0; font: 700 15px var(--f-disp); }
.tstats dd small { display: block; font: 500 11px var(--f-ui); color: var(--muted); }
.tedit summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.tedit form { margin-top: 10px; }
.pwform .grow { flex: 1 1 260px; }
.pwform .grow input { width: 100%; }
/* Ko'rish rejimi: tahrirlash tugmalari yashiriladi */
.ro form[data-api] button[type=submit], .ro .addrow, .ro [data-del-lesson], .ro .bulk, .ro #allPresent, .ro .lh-tools .switch { display: none !important; }
.ro .ltable input, .ro .ltable select, .ro .roster button { pointer-events: none; }
@media (max-width: 720px) {
  .tstats { grid-template-columns: repeat(2, 1fr); }
  .group-row { grid-template-columns: 1fr; }
  .who-me { display: none; }
}
/* ---------- Dars rejasini fayldan yuklash ---------- */
.ktp .ktp-step { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ktp .ktp-step[hidden] { display: none; }
.ktp input[type=file] { max-width: 100%; }
.ktp-peek table { font-size: 12.5px; }
.ktp-peek td { padding: 4px 8px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.ktp-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; }
.ktp-opts { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.ktp-opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ktp-check, .ktp-opts .ktp-check { flex-direction: row !important; align-items: center; gap: 6px; color: var(--ink); }
.ktp-table input[type=text] { min-width: 320px; }
.ktp-table tr.inactive td { opacity: .55; }
.ktp-table .ktp-hw { min-width: 110px; }
.ktp-table td small { display: block; font-size: 11px; }
.ktp-table .pill { margin: 1px 0; }
.ai-status { margin-bottom: 10px; font-size: 14px; }
.ktp-sample { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.ktp-sample .small-p { margin: 0; }
/* ---------- Maktab dars jadvali va hisobot oluvchi ustoz ---------- */
.tt-hint { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; }
.tt-hint.ok { background: var(--ok-soft); color: var(--ink); }
.tt-hint.warn { background: var(--warn-soft); color: var(--ink); }
.rec-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); width: 100%; max-width: 420px; }
.rec-row[hidden] { display: none; }
.rec-missing { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 10px; }
.rec-missing h3 { margin: 0; font-size: 15px; }
.rec-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rec-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.rec-form .grow { flex: 1 1 240px; }
.tt-upload { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.tt-sheets { display: flex; flex-direction: column; gap: 6px; }
.tt-sheet { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.tt-table td { vertical-align: top; font-size: 13px; }
.tt-sub { display: inline-block; margin: 0 12px 4px 0; }
.tt-sub i { color: var(--muted); font-style: normal; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
