/* Izchil — shaxsiy rivojlanish paneli.
   Mobil birinchi: foydalanuvchilarning ko'pchiligi telefonda ochadi. */

:root {
  color-scheme: light;
  --surface-0: #f4f4f1;      /* sahifa foni */
  --surface-1: #fdfdfc;      /* karta */
  --surface-2: #ececea;      /* ichki blok */
  --border:    #e2e2dc;
  --border-strong: #c9c9c1;
  --text-primary:   #14140f;
  --text-secondary: #56564f;
  --text-muted:     #85857c;
  --accent:    #2a78d6;      /* yagona interaktiv rang */
  --accent-ink:#1f5ea9;
  --series-1:  #2a78d6;      /* kirim */
  --series-2:  #eb6834;      /* chiqim */
  --seq:       #2a78d6;
  --good:      #1baf7a;
  --warn:      #eda100;
  --bad:       #e34948;
  --grid:      #e9e9e4;
  --heat-0:    #e7e7e1;
  --heat-1:    #f3c9bb;
  --heat-2:    #2a78d6;
  --shadow:    0 1px 2px rgba(20,20,15,.05);
  --shadow-lift: 0 2px 4px rgba(20,20,15,.06), 0 12px 28px rgba(20,20,15,.07);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #101010; --surface-1: #191918; --surface-2: #232322;
    --border: #302f2c; --border-strong: #47463f;
    --text-primary: #f7f7f2; --text-secondary: #bfbeb4; --text-muted: #8b8a81;
    --accent: #3987e5; --accent-ink: #5b9dec;
    --series-1: #3987e5; --series-2: #d95926; --seq: #3987e5;
    --good: #199e70; --warn: #c98500; --bad: #e66767;
    --grid: #2a2a28; --heat-0: #262624; --heat-1: #6b3626; --heat-2: #3987e5;
    --shadow: 0 1px 2px rgba(0,0,0,.35);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.4), 0 14px 32px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #101010; --surface-1: #191918; --surface-2: #232322;
  --border: #302f2c; --border-strong: #47463f;
  --text-primary: #f7f7f2; --text-secondary: #bfbeb4; --text-muted: #8b8a81;
  --accent: #3987e5; --accent-ink: #5b9dec;
  --series-1: #3987e5; --series-2: #d95926; --seq: #3987e5;
  --good: #199e70; --warn: #c98500; --bad: #e66767;
  --grid: #2a2a28; --heat-0: #262624; --heat-1: #6b3626; --heat-2: #3987e5;
  --shadow: 0 1px 2px rgba(0,0,0,.35);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.4), 0 14px 32px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.015em; }

/* ---------- brend ---------- */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; }
.brand .mark { width: 22px; height: 22px; flex: 0 0 auto; }
.brand .mark rect { fill: var(--accent); }
.brand .mark rect:nth-child(1) { opacity: .35; }
.brand .mark rect:nth-child(2) { opacity: .65; }
.brand small { color: var(--text-muted); font-weight: 400; font-size: 13px; }

/* ---------- karkas ---------- */
header.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 11px 20px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
nav.tabs { display: flex; gap: 2px; }
nav.tabs a {
  padding: 7px 14px; border-radius: 999px; color: var(--text-secondary);
  font-weight: 500; font-size: 14px; white-space: nowrap;
}
nav.tabs a:hover { background: var(--surface-2); text-decoration: none; }
nav.tabs a.on { background: var(--accent); color: #fff; }
.spacer { flex: 1; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 20px 72px; }

/* pastdagi tab-panel — faqat telefonda */
nav.bottom { display: none; }

/* ---------- kartalar ---------- */
.grid { display: grid; gap: 14px; }
/* grid/flex bolasi standart holatda mazmunidan kichrayolmaydi — 720px li
   grafik butun sahifani kengaytirib yuboradi. min-width:0 buni to'xtatadi. */
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card {
  min-width: 0; overflow-wrap: break-word;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow);
}
/* asosiy karta — ko'z birinchi shu yerga tushsin */
.card.hero {
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}
.card h2 {
  margin: 0 0 14px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase;
}
.card h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 400; }
.card.hero h2 { color: var(--accent-ink); }

/* ---------- statistika plitkalari ---------- */
.tile { padding: 14px 16px; box-shadow: none; }
.tile .label { font-size: 12.5px; color: var(--text-secondary); line-height: 1.3; }
.tile .value {
  font-size: 24px; font-weight: 700; letter-spacing: -.025em; margin-top: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.value.pos { color: var(--good); }
.value.neg { color: var(--bad); }
.value.out { color: var(--series-2); }
.tile.row { display: flex; align-items: center; gap: 12px; }
.tile.row > div { min-width: 0; }

/* ---------- grafiklar ---------- */
.scroll-x {
  min-width: 0; max-width: 100%;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
}
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
svg.chart { display: block; max-width: none; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis-line { stroke: var(--border-strong); stroke-width: 1; }
svg.chart text.axis { fill: var(--text-muted); font-size: 11px; }
svg.chart .bar.s1 { fill: var(--series-1); }
svg.chart .bar.s2 { fill: var(--series-2); }
svg.chart .bar:hover { opacity: .82; }
svg.chart .hm { stroke: var(--surface-1); stroke-width: 2; }
svg.chart .hm-none { fill: var(--heat-0); }
svg.chart .hm-miss { fill: var(--heat-1); }
svg.chart .hm-done { fill: var(--heat-2); }

/* kategoriya ro'yxati — HTML, matn hech qachon kichraymaydi */
.catlist { display: flex; flex-direction: column; gap: 9px; }
.catrow { display: grid; grid-template-columns: minmax(84px, 116px) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.catname { font-size: 13.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cattrack { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.catbar { display: block; height: 100%; background: var(--seq); border-radius: 5px; }
.catval { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.catval em { font-style: normal; color: var(--text-muted); font-weight: 400; margin-left: 6px; }

svg.ring { width: 84px; height: 84px; flex: 0 0 auto; }
svg.ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 9; }
svg.ring .ring-fg { fill: none; stroke: var(--seq); stroke-width: 9; stroke-linecap: round; }
svg.ring .ring-text { fill: var(--text-primary); font-size: 20px; font-weight: 700; }

.legend { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.legend .k1 { background: var(--series-1); }
.legend .k2 { background: var(--series-2); }
.legend .k0 { background: var(--heat-0); }
.legend .km { background: var(--heat-1); }

/* ---------- jadval ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ---------- formalar ---------- */
input, select, textarea, button {
  font: inherit; color: inherit;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px;
}
input::placeholder { color: var(--text-muted); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.grow > input[type="text"] { flex: 1 1 220px; min-width: 0; }
button, .btn {
  cursor: pointer; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #fff; border-color: transparent;
}
button:hover, .btn:hover { background: var(--accent-ink); text-decoration: none; }
button.ghost, .btn.ghost { background: var(--surface-2); color: var(--text-primary); border-color: var(--border); }
button.ghost:hover, .btn.ghost:hover { background: var(--border); }
button.danger { background: transparent; color: var(--text-muted); border-color: transparent; padding: 4px 7px; font-size: 15px; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
button.mini { padding: 5px 10px; font-size: 13px; }
form.inline { display: inline; }
label { font-size: 13px; color: var(--text-secondary); }

/* ---------- ro'yxat ---------- */
.item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.item:last-of-type { border-bottom: 0; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 500; overflow-wrap: anywhere; }
.item .meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.item.done .title { text-decoration: line-through; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; }
.p1 { background: var(--bad); } .p2 { background: var(--warn); } .p3 { background: var(--border-strong); }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--text-secondary); }
.chip.late { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.chip.ok { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.empty { color: var(--text-muted); margin: 8px 0; font-size: 14px; }

/* tayyor davr tugmalari */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip-btn {
  padding: 7px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-secondary);
  border: 1px solid transparent; white-space: nowrap;
}
.chip-btn:hover { background: var(--border); text-decoration: none; }
.chip-btn.on { background: var(--accent); color: #fff; }

.login-mark { display: flex; justify-content: center; color: var(--accent); }
.login-mark svg { width: 44px; height: 44px; }

.tips { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 9px; color: var(--text-secondary); }
.bar-line { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar-line > span { display: block; height: 100%; background: var(--seq); border-radius: 4px; }
.bar-line.over > span { background: var(--bad); }
.bar-line.near > span { background: var(--warn); }

/* ---------- kirish sahifasi ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { max-width: 420px; width: 100%; text-align: center; padding: 30px 26px; box-shadow: var(--shadow-lift); }
.login-card h1 { font-size: 24px; margin: 14px 0 6px; }
.login-card .lead { color: var(--text-secondary); margin: 0 0 22px; }
.login-feats { text-align: left; display: flex; flex-direction: column; gap: 9px; margin: 0 0 24px; }
.login-feats div { font-size: 14px; color: var(--text-secondary); }
.login-note { font-size: 12.5px; color: var(--text-muted); margin-top: 20px; line-height: 1.5; }

/* ---------- telefon ---------- */
@media (max-width: 720px) {
  header.top { padding: 10px 14px; gap: 10px; }
  header.top nav.tabs { display: none; }          /* pastdagi panelga ko'chdi */
  main { padding: 14px 14px 84px; }
  .card { padding: 15px 14px; border-radius: 12px; }
  .grid { gap: 12px; }
  .g2 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }         /* 2x2 */
  .tile .value { font-size: 20px; }
  .tile.row { gap: 10px; }
  svg.ring { width: 62px; height: 62px; }
  .catrow { grid-template-columns: minmax(68px, 90px) minmax(0, 1fr) auto; gap: 8px; }
  .catval em { display: block; margin: 0; font-size: 11px; }

  nav.bottom {
    display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    background: color-mix(in srgb, var(--surface-1) 94%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  nav.bottom a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; font-size: 11px; color: var(--text-muted); font-weight: 500;
  }
  nav.bottom a:hover { text-decoration: none; }
  nav.bottom a.on { color: var(--accent); }
  nav.bottom svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.9; }

  /* jadval -> kartalar */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr {
    border: 1px solid var(--border); border-radius: 11px;
    padding: 10px 12px; margin-bottom: 9px; background: var(--surface-1);
  }
  table.cards tr:hover { background: var(--surface-1); }
  table.cards td { border: 0; padding: 3px 0; text-align: left; }
  table.cards td::before {
    content: attr(data-label); display: inline-block; min-width: 84px;
    color: var(--text-muted); font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .04em;
  }
  table.cards td.num { text-align: left; }
  table.cards td.actions { text-align: right; padding-top: 6px; }
  table.cards td.actions::before { content: none; }
  .table-wrap { overflow: visible; }
}
