/* EduCRM dizayn tizimi — AI Pos ranglari (aipos-android colors.xml).
   Ranglar FAQAT shu tokenlardan olinadi: redizayn = shu faylni o'zgartirish. */
:root {
  /* Yorug' (reception kompyuterlari, kunduz) */
  --bg: #F4F7F9; --surface: #FFFFFF; --surface2: #F0F3F6; --ink: #0E141C; --muted: #5A6778; --line: #E1E7EE;
  --primary: #11874B; --on-primary: #04160C; --accent: #0FA89C; --soft: #E3F6EC;
  --good: #11874B; --warn: #B7791F; --bad: #D64545;
  --grad: linear-gradient(90deg, #2ED47A, #38E0D0);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --r: 14px; --r-btn: 12px;
  --f: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0E14; --surface: #141B24; --surface2: #1C2530; --ink: #EDF2F8; --muted: #8D9AAC; --line: #28323F;
    --primary: #2ED47A; --accent: #38E0D0; --soft: #16261E; --good: #2ED47A; --warn: #F5B94A; --bad: #FF6B6B;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0E14; --surface: #141B24; --surface2: #1C2530; --ink: #EDF2F8; --muted: #8D9AAC; --line: #28323F;
  --primary: #2ED47A; --accent: #38E0D0; --soft: #16261E; --good: #2ED47A; --warn: #F5B94A; --bad: #FF6B6B;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.bad { color: var(--bad); } .good { color: var(--good); }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.grow small, .list-row small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Tugmalar: yupqa, tekis (egasi "qalin" tugmani rad etgan) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--r-btn); background: var(--grad); color: var(--on-primary); font-weight: 500; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: filter .12s, transform .12s; }
.btn:hover { filter: brightness(.95); }
.btn:active { transform: scale(.98); }
.btn:disabled { background: var(--surface2); color: var(--muted); cursor: not-allowed; filter: none; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface2); color: var(--ink); }

/* ── Belgilar ── */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--surface2); color: var(--muted); white-space: nowrap; }
.pill.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* ── Qobiq: kompyuterda yon menyu, telefonda pastki menyu ── */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand > div { min-width: 0; }
.logo { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 700; }
.side nav { display: grid; gap: 2px; }
.nav-a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav-a:hover { background: var(--surface2); color: var(--ink); }
.nav-a.on { background: var(--soft); color: var(--primary); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; padding: 0 6px; }
.me b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; }
.topbar, .bottom { display: none; }
.main { margin-left: 232px; padding: 28px 32px 48px; max-width: 1240px; }

@media (max-width: 860px) {
  .side { display: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 5;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .main { margin: 0; padding: 18px 16px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .bottom { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0 0; z-index: 5;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .bottom .nav-a { flex-direction: column; height: auto; gap: 2px; padding: 6px 2px; font-size: 11px; justify-content: center; }
  .bottom .nav-a.on { background: transparent; }
  h1 { font-size: 21px; }
}

/* ── Sahifa bloklari ── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p.muted { font-size: 13px; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.toolbar { margin-bottom: 14px; }
.loading { color: var(--muted); padding: 40px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols > .card { margin-bottom: 0; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
.empty { padding: 22px 8px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat small { color: var(--muted); font-size: 13px; }
.stat.hero { background: var(--grad); border-color: transparent; color: var(--on-primary); }
.stat.hero small { color: var(--on-primary); opacity: .75; }
.num { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.num-sm { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; min-height: 52px; }
a.list-row:hover { color: var(--primary); }
.list-row.dim { opacity: .55; }
ul.card.list { padding: 4px 14px; }
.time { font-weight: 600; font-variant-numeric: tabular-nums; width: 46px; }
.chev { color: var(--muted); font-size: 20px; }
.av { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--primary); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.av.lg { width: 52px; height: 52px; font-size: 17px; }
.link { color: var(--primary); font-size: 14px; }

.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stage { background: var(--surface2); border-radius: 12px; padding: 10px; display: grid; gap: 2px; }
.stage b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stage small { color: var(--muted); font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.tile:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.tile small { color: var(--muted); font-size: 13px; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── Kanban ── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface2); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.kcard small { font-size: 13px; }

/* ── Jurnal ── */
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.chip { flex: 0 0 auto; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.future { color: var(--muted); }
.att { border: 0; border-radius: 9px; height: 32px; min-width: 84px; font-size: 13px; font-weight: 500; cursor: pointer; }
.att[data-s="present"] { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.att[data-s="late"] { background: color-mix(in srgb, var(--warn) 17%, transparent); color: var(--warn); }
.att[data-s="absent"] { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.att[data-s="excused"] { background: var(--surface2); color: var(--muted); }
.att:disabled { opacity: .5; cursor: default; }
.grade { width: 76px; height: 32px; -moz-appearance: textfield; }
.grade::-webkit-inner-spin-button, .grade::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Forma va maydonlar ── */
input, select, textarea { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="search"] { max-width: 420px; }
.narrow { width: 70px; height: 32px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field.wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.form-err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 10px 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { width: 44px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; }
.day.on { background: var(--soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio.on { border-color: var(--primary); background: var(--soft); }
.radio input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: 0 0 auto; }
.radio span { display: grid; gap: 2px; }
.radio small { color: var(--muted); font-size: 13px; }

/* ── Modal va toast ── */
.modal-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(5, 8, 12, .55); display: grid; place-items: center; padding: 16px; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 18px; padding: 18px 20px 20px; border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; }
@media (max-width: 560px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
#toasts { position: fixed; z-index: 30; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 12px; font-size: 14px; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ── Kirish ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--grad); color: var(--on-primary); display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.login-card h1 { font-size: 26px; margin-top: 6px; }
.picker { display: grid; gap: 8px; }
.pick-acc { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.pick-acc:hover { border-color: var(--primary); }
.pick-acc span { color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Jadvallar (Hisobot, Xonalar jadvali) ── */
.tbl { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td small { color: var(--muted); }
.tbl tr:last-child td, .tbl tr:last-child th { border-bottom: 0; }
.sched { padding: 0; }
.sched table { min-width: 860px; table-layout: fixed; }
.sched tbody th { width: 120px; font-weight: 400; }
.sched tbody th small { color: var(--muted); font-size: 12px; }
.sched td { height: 64px; }
.sched .today { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.slot { display: grid; gap: 1px; padding: 6px 8px; margin-bottom: 4px; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 12px; }
.slot b { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Grafik (Moliya) ── */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart .bar { fill: color-mix(in srgb, var(--primary) 35%, transparent); }
.chart .bar.now { fill: var(--primary); }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart .lbl { fill: var(--muted); font-size: 12px; }
