/* Nordic International University brend qo'llanmasi asosida (1-versiya, mart 2026) */
:root {
  --hornavan: #0B5C60;
  --tundra: #0C4446;
  --borealis: #132142;
  --obsidian: #1D1F22;
  --beige: #F8F3E5;
  --aurora: #1FB5A9;
  --zenith-blue: #59B6FF;
  --zenith-yellow: #FEEA74;
  --salmon: #F0815F;

  --bg: var(--beige);
  --card: #FFFFFF;
  --ink: var(--obsidian);
  --ink-2: #4B5254;
  --muted: #7A8183;
  --line: rgba(11, 92, 96, .14);
  --line-soft: rgba(29, 31, 34, .06);
  --accent: var(--hornavan);
  --accent-ink: #FFFFFF;
  --mark: var(--hornavan);
  --grid: rgba(29, 31, 34, .08);
  --field: #FFFFFF;

  --serif: "Roboto Serif", Georgia, serif;
  --sans: "Finlandica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
}

body.dark {
  --bg: var(--obsidian);
  --card: #26292C;
  --ink: var(--beige);
  --ink-2: #C9C6BC;
  --muted: #8E9294;
  --line: rgba(248, 243, 229, .12);
  --line-soft: rgba(248, 243, 229, .06);
  --accent: var(--aurora);
  --accent-ink: var(--obsidian);
  --mark: var(--aurora);
  --grid: rgba(248, 243, 229, .08);
  --field: #1F2225;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------ header */
.brand {
  display: flex; align-items: center; gap: 14px;
  background: var(--hornavan); color: #fff;
  padding: 18px 20px 20px;
}
.brand-mark { width: 40px; height: 40px; filter: brightness(0) invert(1); flex: none; }
.brand-title { font: 500 20px/1.2 var(--serif); letter-spacing: .1px; }
.brand-sub { font-size: 13px; opacity: .75; margin-top: 2px; }

main { padding: 20px 16px 8px; max-width: 720px; margin: 0 auto; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.3; }
.lead { color: var(--ink-2); margin: 6px 0 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ------------------------------------------------------------ cards & lists */
.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
.list { display: grid; gap: 10px; }
.item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 14px 16px;
}
.item:active { transform: scale(.995); }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-num { font: 500 17px/1.3 var(--serif); }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item-text {
  color: var(--ink-2); margin-top: 8px; font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-icon { font-size: 32px; margin-bottom: 8px; }

/* ------------------------------------------------------------ status chip (rang + belgi + matn) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 13px; font-weight: 500; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink);
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.new { background: rgba(89, 182, 255, .18); }
.chip.new::before { background: var(--zenith-blue); }
.chip.in_progress { background: rgba(254, 234, 116, .45); }
.chip.in_progress::before { background: #D9B800; }
.chip.resolved { background: rgba(31, 181, 169, .18); }
.chip.resolved::before { background: var(--aurora); }
.chip.rejected { background: rgba(240, 129, 95, .2); }
.chip.rejected::before { background: var(--salmon); }
body.dark .chip.in_progress { background: rgba(254, 234, 116, .16); }

/* ------------------------------------------------------------ form */
.field { margin-bottom: 18px; }
.label { display: block; font-weight: 500; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; display: flex; justify-content: space-between; }
.input, .textarea, .select {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.textarea { min-height: 140px; resize: vertical; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.option[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.option-icon { font-size: 20px; }
.error { color: #C2410C; font-size: 14px; margin: -6px 0 14px; }
body.dark .error { color: var(--salmon); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 18px; cursor: pointer; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); width: 100%;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: #C2410C; border: 1px solid rgba(240, 129, 95, .5); }
body.dark .btn.danger { color: var(--salmon); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ------------------------------------------------------------ segmented / filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.segmented { display: inline-flex; background: var(--line-soft); border-radius: 10px; padding: 3px; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--ink-2);
}
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filters .select { width: auto; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.filters .input { flex: 1 1 160px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }

/* ------------------------------------------------------------ detail */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.quote { white-space: pre-wrap; border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin: 0; }
.answer { background: rgba(31, 181, 169, .1); border-radius: 12px; padding: 14px; white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child { padding-bottom: 0; }
.stack { display: grid; gap: 14px; }

/* ------------------------------------------------------------ statistika */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { color: var(--ink-2); font-size: 14px; }
.kpi-value { font: 500 30px/1.15 var(--serif); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.alert {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: rgba(240, 129, 95, .14); border: 1px solid rgba(240, 129, 95, .35); color: var(--ink);
}
.alert b { white-space: nowrap; }
.alert .go { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 14px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis-label { fill: var(--muted); font: 400 11px var(--sans); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--mark); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: pointer; }

.hbars { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.hbar-name { font-size: 15px; }
.hbar-val { font-weight: 600; }
.hbar-val .muted { font-weight: 400; margin-left: 4px; }
.hbar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.hbar-fill { height: 100%; background: var(--mark); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-fill.zero { min-width: 0; }

details.table-view { margin-top: 10px; font-size: 14px; }
details.table-view summary { cursor: pointer; color: var(--muted); }
details.table-view table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
details.table-view td, details.table-view th { padding: 4px 0; border-bottom: 1px solid var(--line-soft); text-align: left; }
details.table-view td:last-child, details.table-view th:last-child { text-align: right; }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--obsidian); color: var(--beige); font-size: 13px; line-height: 1.35;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
body.dark .tooltip { background: var(--beige); color: var(--obsidian); }
.tooltip b { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; display: grid; justify-items: center; gap: 2px; cursor: pointer;
  border: 0; background: transparent; padding: 6px 2px; color: var(--muted); font-size: 12px; position: relative;
}
.tab-icon { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tab[aria-current="page"] .tab-icon { filter: none; opacity: 1; }
.badge {
  position: absolute; top: 2px; left: calc(50% + 6px);
  background: var(--salmon); color: #fff; font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: grid; place-items: center;
}

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--obsidian); color: var(--beige); padding: 10px 16px; border-radius: 10px; z-index: 30;
  font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
body.dark .toast { background: var(--beige); color: var(--obsidian); }

.success { text-align: center; padding: 32px 8px; }
.success-num { font: 500 34px/1.2 var(--serif); color: var(--accent); margin: 8px 0 4px; }
.skeleton { height: 76px; border-radius: var(--radius); background: var(--line-soft); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.motto { text-align: center; font: italic 400 13px var(--serif); color: var(--muted); margin: 28px 0 8px; letter-spacing: .3px; }
