/* StudyTokyo — dizayn tizimi v2 (DIZAYN.md). ERP uslubi: oq panel, bo'limli menyu, indigo kartochkalar. */
:root {
  --p: #4146E0; --p-dark: #2E33B8; --v: #8E5CF7; --y: #F2B53C; --t: #2FB8BE;
  --ink: #1E2139; --muted: #6B7089; --line: #ECEEF5; --bg: #F4F5FA; --card: #FFFFFF;
  --up: #1F9D61; --down: #D93A3F; --warn: #B76E00; --brand: #D9442B;
  --soft-p: #EDEEFD; --soft-ok: #E7F6EE; --soft-warn: #FFF4DE; --soft-bad: #FDECEC; --soft: #F0F1F6;
  --font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--ink); }
a { color: var(--p); }
a:hover { color: var(--p-dark); }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; }
svg.i { flex: none; }

/* ---------- shell ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; min-height: 60px; padding: 0 20px;
       background: #fff; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 5px; font-size: 20px; font-weight: 800; color: var(--p);
        text-decoration: none; letter-spacing: -.2px; }
.logo span { background: var(--p); color: #fff; border-radius: 4px; padding: 0 5px; font-size: 17px; line-height: 24px; }
.module { display: flex; align-items: center; gap: 8px; margin-left: 48px; font-size: 13px; font-weight: 800;
          letter-spacing: .6px; color: var(--p); text-transform: uppercase; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
            border-radius: 8px; color: #5B607E; position: relative; text-decoration: none; }
.icon-btn:hover { background: var(--soft); color: var(--p); }
.icon-btn .count { position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
                   border-radius: 8px; background: #E5484D; color: #fff; font-size: 10px; font-weight: 800;
                   display: flex; align-items: center; justify-content: center; }
.me { display: flex; align-items: center; gap: 10px; padding-left: 10px; }
.me .who { text-align: right; line-height: 1.2; }
.me .who b { display: block; font-size: 12px; }
.me .who small { font-size: 10px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #E4E5FB; color: var(--p); display: flex;
          align-items: center; justify-content: center; font-size: 12px; font-weight: 800; position: relative; }
.avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px;
                 border-radius: 50%; background: #2EAD6B; border: 2px solid #fff; }
.me form button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; }
.me form button:hover { background: var(--soft); color: var(--down); }

.body { display: flex; flex-wrap: wrap; min-height: calc(100vh - 61px); }
.side { flex: 1 1 220px; max-width: 100%; background: #fff; border-right: 1px solid var(--line);
        padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.side h4 { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .6px;
           text-transform: uppercase; color: var(--muted); }
.side a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border-radius: 5px;
          text-decoration: none; font-weight: 600; color: var(--ink); }
.side a:hover { background: var(--soft); color: var(--p); }
.side a.on { background: linear-gradient(90deg, var(--p), #6C5DF2); color: #fff; font-weight: 700;
             box-shadow: 0 2px 6px rgba(65, 70, 224, .35); }
.side a .n { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
             background: var(--soft-bad); color: #C2363B; font-size: 11px; font-weight: 800;
             display: inline-flex; align-items: center; justify-content: center; }
.side a.on .n { background: #fff; color: var(--p); }
.main { flex: 999 1 560px; min-width: 0; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; }
.page-head .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px;
        box-shadow: 0 1px 3px rgba(30, 35, 90, .06); padding: 16px 18px; display: flex; flex-direction: column;
        gap: 12px; min-width: 0; }
.ch { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--p); }
.det { font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #5B5FD6; text-decoration: none; }
.big { font-size: 32px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.unit { font-size: 18px; font-weight: 600; }
.delta { font-size: 12px; font-weight: 700; color: var(--muted); }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.wn { color: var(--warn); }
.delta small { font-weight: 400; color: var(--muted); font-size: 12px; }
.foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.foot span { display: inline-flex; align-items: center; gap: 5px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .grow { flex: 2 1 560px; min-width: 0; }
.split > .side-col { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); padding: 10px 0; }

/* list rows */
.lst { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lst:last-child { border-bottom: 0; }
.lst .s { font-size: 12px; color: var(--muted); }
.lst .r { text-align: right; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
          color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFAFE; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl td b a, .tbl td a b { text-decoration: none; }

/* ---------- controls ---------- */
.btn, button { font: 600 13px var(--font); height: 40px; padding: 0 14px; border-radius: 6px; border: 1px solid #D9DBE8;
               background: #fff; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
               text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover, button:hover { border-color: #BFC2D6; background: #FAFAFE; color: var(--ink); }
.btn.primary, button.primary { background: var(--p); border-color: var(--p); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--p-dark); border-color: var(--p-dark); color: #fff; }
button.ok { background: var(--up); border-color: var(--up); color: #fff; }
button.ok:hover { background: #17804F; color: #fff; }
button.danger { color: var(--down); border-color: #F3C2C3; }
button.sm, .btn.sm { height: 32px; padding: 0 10px; font-size: 12px; }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.row .field { margin-bottom: 0; }
label { font-size: 12px; font-weight: 700; color: #3C4160; }
input, select, textarea { font: 13px var(--font); height: 40px; padding: 0 10px; border: 1px solid #D9DBE8;
                          border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
input[type=file] { padding: 8px 10px; }
input[type=checkbox] { height: 18px; width: 18px; accent-color: var(--p); }
textarea { height: auto; min-height: 80px; padding: 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px var(--soft-p); }

/* ---------- badges, notices ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
         white-space: nowrap; background: var(--soft); color: #4B5070; }
.badge.ok { background: var(--soft-ok); color: #17804F; }
.badge.warn { background: var(--soft-warn); color: var(--warn); }
.badge.bad { background: var(--soft-bad); color: #C2363B; }
.badge.in { background: var(--soft-p); color: var(--p); }
.flash { padding: 10px 14px; border-radius: 6px; background: var(--soft-ok); color: #17804F; border: 1px solid #BFE6D0; font-weight: 600; }
.flash.error { background: var(--soft-bad); color: #C2363B; border-color: #F3C2C3; }
.secret { background: #FFFAF0; border: 1px solid #F7D9A6; padding: 12px 14px; border-radius: 6px; line-height: 1.8; }
.secret code { background: #fff; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); word-break: break-all; }
.note { padding: 10px 12px; border-radius: 6px; background: var(--soft-p); color: var(--p); font-size: 12px; }

/* ---------- charts ---------- */
.bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--p); border-radius: 4px; }
.funnel { display: grid; grid-template-columns: 170px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 13px; }
.funnel .track { height: 18px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.funnel .track i { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.donut { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
                       background: var(--c); margin-right: 8px; }

dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line); }
dl.kv dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline code { font-size: 11px; color: var(--muted); word-break: break-word; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
.login .logo { justify-content: center; font-size: 26px; margin-bottom: 18px; }
.login .logo span { font-size: 22px; line-height: 30px; }

@media (max-width: 900px) {
  .top { padding: 8px 14px; }
  .module { margin-left: 0; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .side h4 { display: none; }
  .main { padding: 16px; }
  dl.kv { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 120px minmax(0, 1fr) 70px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
