/* =========================================================
   Direcom — boshqaruv paneli
   Shriftlar: Onest (matn) + Geist Mono (texnik yozuvlar)
   Standart — yorqin (kunduzgi) rejim. Tungi rejim faqat tugma bilan yoqiladi.
   ========================================================= */

:root {
  --ground: #efefeb;
  --surface: #ffffff;
  --subtle: #f6f6f2;
  --tint: #e9f9e1;
  --line: #e4e4de;
  --line-strong: #d3d3cb;
  --text: #111311;
  --text-soft: #242724;
  --muted: #5c605c;
  --faint: #8d918c;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-bright: #4fd060;
  --lime: #a6ec8a;
  --on-accent: #0d2a10;
  --mint: #c9f5b6;
  --teal: #14b8a6;
  --danger: #d92d20;
  --danger-tint: #fef1f0;
  --warning: #b54708;
  --warning-tint: #fff4e0;
  --info: #0369a1;
  --info-tint: #e0f2fe;
  --contrast-bg: #111311;
  --contrast-fg: #ffffff;
  --rail-group: #e6e6e0;
  --rail-text: #3a3e3a;
  --rail-strong: #111311;
  --rail-hover: rgba(255, 255, 255, .65);
  --float-bg: #ffffff;
  --float-fg: #111311;
  --float-line: #e4e4de;
  --term-bg: #fbfbf8;
  --term-line: #e4e4de;
  --term-chip: #f0f0eb;
  --term-text: #5c605c;
  --term-strong: #111311;
  --term-ok: #16a34a;
  --term-bad: #d92d20;
  --owner-bg: #e0f2fe;
  --owner-fg: #075985;
  --assistant-bg: #dcf7cf;
  --assistant-fg: #0d2a10;
  --phone-frame: linear-gradient(160deg, #ffffff, #e2e2dc);
  --brand-gradient: linear-gradient(135deg, #b4f09a 0%, #5fd36a 100%);
  --vivid-gradient: linear-gradient(180deg, #8de678 0%, #4fd060 100%);
  --shadow-lift: 0 1px 2px rgba(17, 19, 17, .04), 0 18px 40px -28px rgba(17, 19, 17, .18);
  --shadow-glow: 0 10px 24px -10px rgba(79, 208, 96, .65);
  --shadow-float: 0 30px 70px -28px rgba(17, 19, 17, .3);
  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 12px;
  --font-sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #0a0f0d;
  --surface: #121a17;
  --subtle: #17211d;
  --tint: #0f2a20;
  --line: #24302b;
  --line-strong: #33423b;
  --text: #edede8;
  --text-soft: #d6dbd8;
  --muted: #a3b1aa;
  --faint: #6f7d76;
  --accent: #6fdc6f;
  --accent-strong: #a6ec8a;
  --on-accent: #0d2a10;
  --danger: #f97066;
  --danger-tint: #2b1513;
  --warning: #fdb022;
  --warning-tint: #2a2010;
  --info: #7dd3fc;
  --info-tint: #0c2a3a;
  --contrast-bg: #edede8;
  --contrast-fg: #0a0f0d;
  --rail-group: #121a17;
  --rail-text: #c3cdc7;
  --rail-strong: #ffffff;
  --rail-hover: rgba(255, 255, 255, .05);
  --assistant-bg: #1d3a22;
  --assistant-fg: #d9f7cc;
  --float-bg: #1c2823;
  --float-fg: #edede8;
  --float-line: #2e3d36;
  --term-bg: #0a0f0d;
  --term-line: #24302b;
  --term-chip: #121a17;
  --term-text: #a3b1aa;
  --term-strong: #edede8;
  --term-ok: #34d399;
  --term-bad: #f97066;
  --owner-bg: #0c2a3a;
  --owner-fg: #bae6fd;
  --phone-frame: #0a0f0d;
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .03), 0 28px 56px -28px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Asos ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--text);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -0.04em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); }
code { background: var(--subtle); border: 1px solid var(--line); padding: 2px 7px; border-radius: 7px; font-size: 12.5px; word-break: break-all; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--mint); color: #053b2e; }
.dots { background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 22px 22px; }

/* ---------- Karkas ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }

/* Yon panel: guruhlangan menyu */
.rail {
  position: sticky; top: 0; height: 100vh; color: var(--rail-text);
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 14px 16px; overflow-y: auto; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; color: var(--rail-strong); text-decoration: none !important; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-gradient); color: var(--on-accent); box-shadow: var(--shadow-glow);
}
.brand-mark svg.i { width: 19px; height: 19px; }
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; }
.brand-name span { color: var(--accent); }

.account-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.account-card .avatar { width: 34px; height: 34px; font-size: 13px; border-radius: 10px; }
.account-card b { display: block; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card small { display: block; font-size: 12px; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.nav-group { background: var(--rail-group); border-radius: 18px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 12.5px; font-weight: 600; color: var(--faint); padding: 8px 10px 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px; color: var(--rail-text);
  font-weight: 500; font-size: 14.5px; text-decoration: none; transition: background .15s, color .15s, box-shadow .15s;
}
.nav a:hover { background: var(--rail-hover); color: var(--rail-strong); }
.nav a.active { background: var(--surface); color: var(--rail-strong); font-weight: 600; box-shadow: 0 0 0 1px var(--line-strong), 0 2px 8px -2px rgba(17, 19, 17, .08); }
.nav a .badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; font: 700 11px var(--font-mono); background: var(--lime); color: var(--on-accent); }
.nav a .badge.warn { background: #fdba74; color: #431407; }

.usage-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; font-size: 13.5px; }
.usage-card .row-between b { font-variant-numeric: tabular-nums; }
.usage-card .meter { height: 6px; }

.theme-dark-only { display: none; }
:root[data-theme="dark"] .theme-dark-only { display: inline; }
:root[data-theme="dark"] .theme-light-only { display: none; }

.pulse { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-bright); flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent-bright); opacity: .5; animation: ping 1.8s ease-out infinite; }
.pulse.off { background: #f04438; }
.pulse.off::after { border-color: #f04438; animation: none; opacity: 0; }
.pulse.warn { background: #f79009; }
.pulse.warn::after { border-color: #f79009; }
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }

.main { min-width: 0; padding: 14px clamp(14px, 2.4vw, 28px) 110px 4px; }
.container { max-width: 1180px; margin: 0 auto; }

/* Yuqori panel */
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 18px; flex-wrap: wrap; }
.topbar-title { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; margin-right: auto; }
.top-pill { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 8px 0 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14.5px; color: var(--text); cursor: pointer; text-decoration: none !important; }
.top-pill svg.i { color: var(--muted); }
.top-btn { position: relative; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-decoration: none !important; }
.top-btn:hover, .top-pill:hover { border-color: var(--line-strong); background: var(--subtle); }
.top-btn .dot-badge { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #f97316; box-shadow: 0 0 0 2px var(--surface); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { position: sticky; z-index: 30; min-width: 0; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; background: var(--ground); border-bottom: 1px solid var(--line); overflow: visible; }
  .account-card, .usage-card, .nav-group-label { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex-basis: 100%; gap: 4px; scrollbar-width: none; }
  .nav-group { display: contents; }
  .nav a { white-space: nowrap; padding: 8px 11px; }
  .main { padding: 14px 14px 100px; }
  .topbar-title { font-size: 22px; flex-basis: 100%; }
  .top-pill span.label { display: none; }
  .top-pill { height: 42px; padding: 0 6px 0 12px; }
  .top-btn { width: 42px; height: 42px; }
}

/* ---------- Sahifa sarlavhasi ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 640px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 12.5px var(--font-mono); color: var(--accent); margin-bottom: 10px; }
.eyebrow::before { content: "//"; opacity: .6; }

/* ---------- Kartochkalar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-lift); }
.card + .card, .stack > * + * { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt { margin-top: 18px; }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: 600 14px var(--font-sans);
  cursor: pointer; text-decoration: none !important; transition: transform .12s, filter .15s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--subtle); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--contrast-bg); border-color: transparent; color: var(--contrast-fg); box-shadow: 0 10px 22px -12px rgba(17, 19, 17, .55); }
.btn.primary:hover { filter: brightness(1.25); }
.btn.primary .go { width: 30px; height: 30px; margin-right: -10px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: var(--on-accent); }
.btn.primary .go svg.i { width: 16px; height: 16px; }
.btn.lime { background: var(--lime); border-color: transparent; color: var(--on-accent); }
.btn.lime:hover { filter: brightness(.96); }
.btn.ink { background: var(--contrast-bg); border-color: transparent; color: var(--contrast-fg); }
.btn.ink:hover { filter: brightness(1.25); }
.btn.soft { background: var(--tint); border-color: transparent; color: var(--accent-strong); }
.btn.soft:hover { filter: brightness(.97); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: var(--danger-tint); }
.btn.light { background: #fff; border-color: transparent; color: #047857; }
.btn.light:hover { background: #ecfdf5; }
.btn.glass { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; backdrop-filter: blur(8px); }
.btn.glass:hover { background: rgba(255, 255, 255, .26); }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 22px; border-radius: 16px; font-size: 15.5px; }
.icon-btn { width: 34px; padding: 0; }

/* ---------- Belgilar ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font: 600 12px var(--font-sans); background: var(--subtle); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.sent, .pill.on, .pill.info, .pill.won { background: var(--tint); color: var(--accent-strong); border-color: transparent; }
.pill.error, .pill.off, .pill.lost { background: var(--danger-tint); color: var(--danger); border-color: transparent; }
.pill.dry_run, .pill.paused, .pill.warn, .pill.new { background: var(--warning-tint); color: var(--warning); border-color: transparent; }
.pill.contacted { background: var(--info-tint); color: var(--info); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--subtle); font-size: 13px; font-weight: 500; color: var(--text-soft); }
.chip svg.i { width: 15px; height: 15px; color: var(--muted); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); }
.chip.mono { font: 12px var(--font-mono); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font: 600 10.5px var(--font-mono); background: var(--subtle); color: var(--muted); border: 1px solid var(--line); }
.tag.menejer, .tag.shikoyat { background: var(--warning-tint); color: var(--warning); border-color: transparent; }
.tag.buyurtma, .tag.vip { background: var(--tint); color: var(--accent-strong); border-color: transparent; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(440px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 14px;
  background: var(--float-bg); color: var(--float-fg); border: 1px solid var(--float-line); box-shadow: var(--shadow-float);
  font-weight: 500; animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2), toast-out .4s ease 6s forwards;
}
.toast svg.i { margin-top: 2px; }
.toast.success { border-left: 4px solid var(--accent-bright); }
.toast.success svg.i { color: var(--accent-bright); }
.toast.error { border-left: 4px solid #f04438; }
.toast.error svg.i { color: #f04438; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); visibility: hidden; } }

/* ---------- Ogohlantirish ---------- */
.notice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.notice.warn { background: var(--warning-tint); color: var(--warning); }
.notice.error { background: var(--danger-tint); color: var(--danger); }
.notice.info { background: var(--tint); color: var(--accent-strong); }
.notice .btn { margin-left: auto; }

/* ---------- Hero (bosh sahifa) ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: center;
  padding: clamp(24px, 3.4vw, 40px);
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(90deg, transparent 30%, #000); -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); }
.hero .blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); }
.hero .blob.a { width: 300px; height: 300px; top: -150px; right: 10%; background: rgba(166, 236, 138, .55); }
.hero .blob.b { width: 360px; height: 360px; right: -120px; bottom: -200px; background: rgba(95, 211, 106, .35); }
.hero .watermark { position: absolute; z-index: -1; right: 36%; bottom: -36px; font: 800 150px/1 var(--font-sans); letter-spacing: -0.06em; color: rgba(17, 19, 17, .035); pointer-events: none; }
.hero h1 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; }
.hero h1 em { font-style: normal; background: var(--lime); color: var(--on-accent); padding: 0 .16em; border-radius: .22em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hero-lead { color: var(--muted); max-width: 480px; margin-top: 14px; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.account { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.account img, .avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center; font-weight: 800; color: var(--on-accent); background: var(--brand-gradient);
}
.hero .account img, .hero .account .avatar { box-shadow: 0 0 0 3px var(--tint); }
.account small { display: block; font: 12px var(--font-mono); color: var(--faint); }

.float-phone { position: relative; height: 320px; }
.float-phone .window {
  position: absolute; right: 0; top: 4px; width: 92%; border-radius: 22px; overflow: hidden;
  background: #fff; color: #111311; border: 1px solid #e4e4de; box-shadow: 0 40px 80px -34px rgba(17, 19, 17, .35);
  animation: float 6s ease-in-out infinite;
}
.window-bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-bottom: 1px solid #e2e9e5; }
.window-bar i { width: 10px; height: 10px; border-radius: 50%; display: block; flex: none; }
.window-bar i:nth-child(1) { background: #ff5f57; }
.window-bar i:nth-child(2) { background: #febc2e; }
.window-bar i:nth-child(3) { background: #28c840; }
.window-bar span { margin-left: 8px; font: 10.5px var(--font-mono); color: #52605a; background: #f5f8f7; padding: 2px 10px; border-radius: 99px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.window-body .bubble.user { background: #f6f6f2; border-color: #e4e4de; color: #111311; }
.window-body .bubble.assistant { background: #dcf7cf; color: #0d2a10; }
.float-phone .tag-card {
  position: absolute; left: 0; bottom: 18px; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px 11px 12px; border-radius: 18px; background: #111311; color: #fff; box-shadow: 0 30px 60px -24px rgba(17, 19, 17, .5);
  animation: float 6s ease-in-out -3s infinite; font-size: 13px;
}
.float-phone .tag-card .go { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #a6ec8a; color: #0d2a10; }
.float-phone .tag-card b { display: block; font-size: 18px; letter-spacing: -0.03em; }
.float-phone .tag-card small { font: 11px var(--font-mono); color: #b7bdb8; }
@keyframes float { 50% { transform: translateY(-8px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .float-phone { height: 260px; }
}
@media (max-width: 600px) {
  .float-phone .tag-card { display: none; }
  .float-phone { height: 230px; }
  .float-phone .window { width: 100%; }
}

/* ---------- Statistika ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; overflow: hidden; box-shadow: var(--shadow-lift); color: inherit; text-decoration: none !important; display: block; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .label svg.i { width: 16px; height: 16px; color: var(--accent); }
.stat .value { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.stat .hint { font: 11.5px var(--font-mono); color: var(--faint); margin-top: 8px; }
.stat:hover { border-color: var(--line-strong); }
.stat.accent { background: var(--lime); border-color: transparent; }
.stat.accent .label, .stat.accent .hint, .stat.accent .label svg.i, .stat.accent .value { color: var(--on-accent); }
.stat.accent::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .45); filter: blur(30px); }

.chart-card { display: flex; flex-direction: column; }
.bars { display: flex; align-items: flex-end; gap: 5px; flex: 1; min-height: 150px; padding-top: 10px; }
.bar { flex: 1; min-width: 0; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; position: relative; }
.bar span { display: block; border-radius: 5px; min-height: 0; padding: 0; }
.bar .ok { background: var(--vivid-gradient); }
.bar .other { background: var(--line-strong); }
.bar .none { height: 4px; background: var(--line); }
.bars-empty { position: relative; }
.bars-empty::before { content: attr(data-empty); position: absolute; inset: 0 0 20px; display: grid; place-items: center; font: 12.5px var(--font-mono); color: var(--faint); }
.bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--float-bg); color: var(--float-fg); border: 1px solid var(--float-line); box-shadow: var(--shadow-float);
  font: 11px var(--font-mono); padding: 4px 8px; border-radius: 7px; white-space: nowrap; z-index: 2;
}
.bar-axis { display: flex; justify-content: space-between; font: 11px var(--font-mono); color: var(--faint); margin-top: 8px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Terminal oyna (holat) */
.terminal { background: var(--term-bg); color: var(--term-text); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lift); border: 1px solid var(--term-line); }
.terminal .window-bar { border-color: var(--term-line); }
.terminal .window-bar span { background: var(--term-chip); color: var(--term-text); }
.terminal-body { padding: 16px 18px 18px; font: 13px/1.9 var(--font-mono); }
.terminal-body .line { display: flex; gap: 10px; align-items: baseline; }
.terminal-body .line .fill { flex: 1; border-bottom: 1px dotted var(--line-strong); transform: translateY(-4px); min-width: 20px; }
.terminal-body .ok { color: var(--term-ok); font-weight: 600; }
.terminal-body .bad { color: var(--term-bad); font-weight: 600; }
.terminal-body .prompt { color: var(--term-ok); }
.terminal-body .cmd { color: var(--term-strong); }
.terminal .copy-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.terminal .copy-row code { flex: 1; background: var(--term-chip); border-color: var(--term-line); color: var(--term-strong); padding: 8px 10px; }

/* ---------- Hodisalar lentasi ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-item:first-child { padding-top: 0; }
.feed-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--subtle); color: var(--muted); border: 1px solid var(--line); }
.feed-icon.dm { background: var(--tint); color: var(--accent); border-color: transparent; }
.feed-icon.comment { background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); border-color: transparent; }
.feed-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.feed-meta b { color: var(--text); font-weight: 600; }
.feed-meta .mono { font-size: 11.5px; color: var(--faint); }
.feed-text { margin-top: 6px; display: grid; gap: 6px; }
.feed-text .in, .feed-text .out { padding: 8px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; max-width: 680px; }
.feed-text .in { background: var(--subtle); border: 1px solid var(--line); }
.feed-text .out { background: var(--tint); color: var(--text-soft); border: 1px solid color-mix(in srgb, var(--accent-bright) 22%, transparent); }
.feed-text .out small { display: block; font: 11px var(--font-mono); color: var(--accent-strong); margin-top: 4px; }
.feed-detail { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.feed-side { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.feed-side .mono { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
@media (max-width: 640px) {
  .feed-item { grid-template-columns: 38px minmax(0, 1fr); }
  .feed-side { grid-column: 2; flex-direction: row; align-items: center; text-align: left; }
}

.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-state .art { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--lime); color: var(--on-accent); }
.empty-state .art svg.i { width: 28px; height: 28px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- Formalar ---------- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.field small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 6px; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: 14.5px var(--font-sans); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 260px; }
textarea.mono, input.mono { font: 13px/1.6 var(--font-mono); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-bright); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-bright) 18%, transparent); }
::placeholder { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 0 18px; }
.counter { display: block; text-align: right; font: 11.5px var(--font-mono); color: var(--faint); margin-top: 6px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row b { display: block; font-weight: 600; }
.switch-row small { display: block; color: var(--faint); font-size: 13px; margin-top: 2px; }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + i { background: var(--accent-bright); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-bright) 25%, transparent); }

.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice > input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body { height: 100%; padding: 16px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.choice-body:hover { border-color: var(--faint); }
.choice > input:checked + .choice-body { border-color: var(--accent-bright); background: color-mix(in srgb, var(--tint) 60%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 18%, transparent); }
.choice > input:focus-visible + .choice-body { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-bright) 30%, transparent); }
.choice-top { display: flex; align-items: center; gap: 10px; }
.choice-top b { font-weight: 700; }
.choice-body p { color: var(--muted); font-size: 13px; margin-top: 8px; }
.choice .radio { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.choice > input:checked + .choice-body .radio { border: 5px solid var(--accent-bright); }
.monogram { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font: 700 14px var(--font-mono); color: #fff; flex: none; }
.monogram.claude { background: linear-gradient(135deg, #d97757, #f0a585); }
.monogram.openai { background: linear-gradient(135deg, #334155, #64748b); }
.monogram.gemini { background: linear-gradient(135deg, #3b82f6, #a78bfa); }

.segmented { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; border-radius: 14px; background: var(--subtle); border: 1px solid var(--line); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), inset 0 0 0 1px color-mix(in srgb, var(--accent-bright) 30%, transparent); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-bright); }

.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { position: relative; cursor: pointer; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: grid; place-items: center; width: 46px; height: 40px; border-radius: 11px; border: 1px solid var(--line-strong); font: 600 13px var(--font-mono); color: var(--muted); background: var(--surface); }
.days input:checked + span { background: var(--lime); color: var(--on-accent); border-color: transparent; }
.days input:focus-visible + span { outline: 2px solid var(--accent-bright); }

/* Sozlamalar: bo'limlar navigatsiyasi */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: flex; gap: 10px; padding: 9px 12px; border-radius: 11px; color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; }
.toc a span { font: 11.5px var(--font-mono); color: var(--faint); padding-top: 2px; }
.toc a:hover { background: var(--surface); color: var(--text); }
.section-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.section-title .num { font: 12.5px var(--font-mono); color: var(--accent); }
.section-lead { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
section[id] { scroll-margin-top: 20px; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}

.savebar {
  position: sticky; bottom: 18px; z-index: 20; margin-top: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 10px 10px 20px; border-radius: 18px; border: 1px solid var(--float-line);
  background: color-mix(in srgb, var(--float-bg) 88%, transparent); color: var(--float-fg);
  backdrop-filter: blur(14px); box-shadow: var(--shadow-float);
}
.savebar .state { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.savebar .state .pulse { display: none; }
.savebar.dirty { border-color: color-mix(in srgb, #f79009 50%, transparent); }
.savebar.dirty .state .pulse { display: block; }

/* ---------- Tablar ---------- */
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; box-shadow: var(--shadow-lift); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none !important; }
.tabs a:hover { color: var(--text); background: var(--subtle); }
.tabs a.active { background: var(--tint); color: var(--accent-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-bright) 30%, transparent); }
.tabs a .count { font: 11px var(--font-mono); opacity: .75; }

/* ---------- Postlar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 20px; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.post { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lift); transition: box-shadow .2s, border-color .2s, transform .2s; }
.post:hover { transform: translateY(-2px); }
.post.on { border-color: var(--accent-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 22%, transparent), var(--shadow-lift); }
.post-media { position: relative; aspect-ratio: 4 / 5; background: var(--subtle); overflow: hidden; }
.post-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.post:hover .post-media img { transform: scale(1.03); }
.post-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .3) 0%, transparent 30%, transparent 55%, rgba(0, 0, 0, .7) 100%); pointer-events: none; }
.post-media .no-img { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.post-type { position: absolute; z-index: 1; top: 12px; left: 12px; font: 600 11px var(--font-mono); letter-spacing: .04em; color: #fff; background: rgba(0, 0, 0, .4); backdrop-filter: blur(6px); padding: 4px 9px; border-radius: 8px; }
.ai-toggle { position: absolute; z-index: 2; top: 10px; right: 10px; display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 11px; border-radius: 99px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); color: #0b1210; font: 600 12px var(--font-mono); cursor: pointer; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35); }
.ai-toggle .switch { width: 38px; height: 22px; }
.ai-toggle .switch i::after { width: 16px; height: 16px; }
.ai-toggle .switch input:checked + i::after { transform: translateX(16px); }
.post-caption { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 12px; color: #fff; font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.post-stats { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font: 12px var(--font-mono); color: var(--muted); border-bottom: 1px solid var(--line); }
.post-stats span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.post-stats svg.i { width: 14px; height: 14px; }
.post details { padding: 0 16px; }
.post summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.post summary::-webkit-details-marker { display: none; }
.post summary::after { content: "+"; font: 18px var(--font-mono); color: var(--faint); }
.post details[open] summary::after { content: "−"; }
.post details .field { margin-bottom: 12px; }
.post details textarea { min-height: 76px; font-size: 13.5px; }
.post details input[type=text] { font-size: 13.5px; }
.post details .btn { width: 100%; margin-bottom: 16px; }
.post .has-extra { color: var(--accent); }
.post-flow { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none !important; }
.post-flow:hover { background: var(--subtle); color: var(--text); }
.post-flow.on { color: var(--accent-strong); background: var(--tint); }
.post-flow svg.i { width: 15px; height: 15px; flex: none; }
.post-flow span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-flow small { margin-left: auto; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11.5px var(--font-mono); opacity: .75; }

/* ---------- Ssenariylar ---------- */
.flow-list { display: grid; gap: 14px; }
.flow-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: center; }
.flow-card h3 { margin: 0; font-size: 17px; }
.flow-card h3 a { color: inherit; text-decoration: none; }
.flow-card h3 a:hover { color: var(--accent); }
.flow-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.flow-actions { display: flex; align-items: center; gap: 8px; }
.flow-actions .switch { display: block; cursor: pointer; }
.flow-funnel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.flow-funnel div { font-size: 12.5px; color: var(--muted); }
.flow-funnel b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .flow-card { grid-template-columns: minmax(0, 1fr); } }

.post-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.post-pick { position: relative; display: block; cursor: pointer; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: var(--subtle); border: 2px solid transparent; }
.post-pick input { position: absolute; opacity: 0; pointer-events: none; }
.post-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-pick .no-img { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.post-pick .tick { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; background: var(--lime); color: var(--on-accent); }
.post-pick .tick svg.i { width: 13px; height: 13px; }
.post-pick:has(input:checked) { border-color: var(--accent-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 22%, transparent); }
.post-pick:has(input:checked) .tick { display: grid; }
.post-pick:has(input:focus-visible) { outline: 2px solid var(--accent-bright); }

.flow-step { border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px 16px 4px; background: var(--surface); }
.flow-step + .flow-step { margin-top: 12px; }
.flow-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.flow-step-head .num { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; flex: none; font: 700 12.5px var(--font-mono); background: var(--lime); color: var(--on-accent); }
.flow-step-head b { margin-right: auto; }
.flow-step .field { margin-bottom: 12px; }
.flow-step textarea { min-height: 76px; }
.flow-link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 34px; gap: 8px; margin-bottom: 8px; }
.flow-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.flow-opening-note { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 190px); min-height: 560px; padding: 0; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.inbox-search { position: sticky; top: 0; padding: 14px 14px 0; background: var(--surface); z-index: 1; }
.inbox-search input { padding: 9px 12px; font-size: 14px; }
.inbox-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: sticky; top: 55px; background: var(--surface); z-index: 1; }
.inbox-tabs a { padding: 6px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; }
.inbox-tabs a:hover { background: var(--subtle); color: var(--text); }
.inbox-tabs a.active { background: var(--tint); color: var(--accent-strong); }
.inbox-tabs a .n { font: 11px var(--font-mono); }
.contact { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; transition: background .12s; }
.contact:hover { background: var(--subtle); }
.contact.active { background: var(--tint); box-shadow: inset 3px 0 0 var(--accent-bright); }
.contact .avatar { width: 44px; height: 44px; font-size: 16px; }
.contact b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact p { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); margin-left: 6px; vertical-align: 2px; }
.contact .tagline { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.contact .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font: 11px var(--font-mono); color: var(--faint); }
.contact .flag { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-bright); }
.contact .flag.paused { background: #f79009; }
.contact .flag.blocked { background: #f04438; }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-head .who { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.thread-head .avatar { width: 40px; height: 40px; }
.thread-head .back { display: none; }
.thread-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--warning-tint); color: var(--warning); font-size: 13.5px; font-weight: 500; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-banner form { margin-left: auto; }
.details-panel { border-bottom: 1px solid var(--line); background: var(--subtle); }
.details-panel > summary { list-style: none; cursor: pointer; padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.details-panel > summary::-webkit-details-marker { display: none; }
.details-panel > summary .tagline { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; }
.details-panel .body { padding: 4px 16px 16px; display: grid; gap: 12px; }
.tag-picker { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag-picker label { position: relative; cursor: pointer; }
.tag-picker input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.tag-picker span { display: inline-block; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-strong); font: 600 12px var(--font-mono); color: var(--muted); background: var(--surface); }
.tag-picker input:checked + span { background: var(--lime); color: var(--on-accent); border-color: transparent; }
.tag-picker input[type=text] { width: 150px; padding: 5px 10px; font-size: 12.5px; border-radius: 99px; }
.thread-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 8px; background-color: var(--ground); }
.thread-empty { flex: 1; display: grid; place-items: center; background-color: var(--ground); }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; background: var(--surface); }
.composer textarea { min-height: 52px; height: 56px; max-height: 220px; resize: vertical; }
.composer-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.composer-tools .spacer { flex: 1; }
.composer-tools label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.composer-tools input[type=checkbox] { accent-color: var(--accent-bright); }
.quick-chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.quick-chips button, .quick-chips a { flex: none; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--subtle); color: var(--text-soft); font: 500 12.5px var(--font-sans); cursor: pointer; text-decoration: none !important; }
.quick-chips button:hover { border-color: var(--accent-bright); color: var(--accent-strong); background: var(--tint); }
.new-msg { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; }
.live { display: inline-flex; align-items: center; gap: 8px; font: 12px var(--font-mono); color: var(--accent); }
.live .pulse { width: 7px; height: 7px; }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-thread .inbox-list { display: none; }
  .thread-head .back { display: inline-flex; }
  .thread-body { min-height: 380px; max-height: 60vh; }
}

.bubble { max-width: min(78%, 520px); padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.45; }
.bubble.user { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.assistant { align-self: flex-end; background: var(--assistant-bg); color: var(--assistant-fg); border-bottom-right-radius: 6px; }
.bubble.owner { align-self: flex-end; background: var(--owner-bg); color: var(--owner-fg); border-bottom-right-radius: 6px; }
.bubble.note { align-self: center; background: transparent; color: var(--faint); font: 12px var(--font-mono); padding: 4px; }
.bubble.handoff { align-self: center; background: var(--warning-tint); color: var(--warning); font-size: 12.5px; padding: 6px 12px; border-radius: 99px; }
.bubble .meta { display: block; font: 10.5px var(--font-mono); opacity: .75; margin-top: 4px; }
.day-sep { align-self: center; font: 11px var(--font-mono); color: var(--faint); background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; margin: 8px 0; }

/* ---------- Filtr chiplar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none !important; }
.fchip:hover { color: var(--text); border-color: var(--faint); }
.fchip.active { background: var(--tint); color: var(--accent-strong); border-color: var(--accent-bright); }
.fchip .n { font: 11px var(--font-mono); opacity: .75; }
button.fchip { font-family: inherit; cursor: pointer; }

/* ---------- Bilimlar bazasi ---------- */
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.kb-layout > aside { position: sticky; top: 24px; }
@media (max-width: 1100px) { .kb-layout { grid-template-columns: 1fr; } .kb-layout > aside { position: static; } }
.kb-list { display: grid; gap: 12px; }
.kb-item { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lift); scroll-margin-top: 20px; }
.kb-item.off { opacity: .6; }
.kb-item > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; }
.kb-item > summary::-webkit-details-marker { display: none; }
.kb-item > summary .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--accent); }
.kb-item > summary b { display: block; font-weight: 700; }
.kb-item > summary p { color: var(--muted); font-size: 13.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-item .price { font: 600 13px var(--font-mono); color: var(--accent-strong); white-space: nowrap; }
.kb-item .meta-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kb-item .edit { padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.kb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kb-actions .spacer { flex: 1; }
.prompt-view { background: var(--term-bg); color: var(--term-strong); border-radius: var(--radius); border: 1px solid var(--term-line); overflow: hidden; box-shadow: var(--shadow-lift); }
.prompt-view pre { margin: 0; padding: 18px 20px; max-height: 72vh; overflow: auto; font: 12.5px/1.7 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.prompt-view .window-bar { border-color: var(--term-line); }
.prompt-view .window-bar span { background: var(--term-chip); color: var(--term-text); }
.meter { height: 8px; border-radius: 99px; background: var(--subtle); overflow: hidden; border: 1px solid var(--line); }
.meter span { display: block; height: 100%; background: var(--vivid-gradient); border-radius: 99px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.mini-stats div { background: var(--subtle); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mini-stats b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mini-stats span { font: 11px var(--font-mono); color: var(--faint); }
.hint-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: grid; gap: 6px; }
.file-drop { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 13.5px; cursor: pointer; margin-bottom: 14px; background: var(--subtle); }
.file-drop:hover { border-color: var(--accent-bright); color: var(--accent-strong); background: var(--tint); }
.file-drop input { display: none; }

/* ---------- Model tanlash ---------- */
.model-row { display: flex; gap: 6px; margin-top: 12px; }
.model-row input { flex: 1; min-width: 0; font: 13px var(--font-mono); padding: 9px 11px; }
.model-row .btn { height: auto; }
.model-list { margin-top: 8px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.model-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: baseline; text-align: left; padding: 8px 11px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: 13px var(--font-sans); cursor: pointer; }
.model-list button:last-child { border-bottom: 0; }
.model-list button:hover, .model-list button.current { background: var(--tint); }
.model-list button code { background: transparent; border: 0; padding: 0; color: var(--muted); font-size: 11.5px; }
.model-status { font: 11px var(--font-mono); color: var(--faint); margin-top: 6px; }

/* ---------- Lidlar ---------- */
.lead-grid { display: grid; gap: 12px; }
.lead { display: grid; grid-template-columns: 44px minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lift); }
.lead.status-new { border-left: 4px solid #f79009; }
.lead .avatar { width: 44px; height: 44px; }
.lead b { display: block; }
.lead .lead-phone { font: 600 14px var(--font-mono); color: var(--accent-strong); display: inline-flex; gap: 6px; align-items: center; }
.lead .lead-phone svg.i { width: 15px; height: 15px; }
.lead p { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead .side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.lead select { width: auto; padding: 7px 10px; font-size: 13px; border-radius: 10px; }
.lead .mono { font: 11px var(--font-mono); color: var(--faint); }
@media (max-width: 760px) {
  .lead { grid-template-columns: 44px minmax(0, 1fr); }
  .lead > :nth-child(3), .lead .side { grid-column: 2; align-items: flex-start; }
}

/* ---------- Sinov (telefon) ---------- */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.phone { position: sticky; top: 24px; width: 100%; max-width: 380px; justify-self: center; height: min(740px, calc(100vh - 60px)); min-height: 560px; border-radius: 48px; padding: 10px; background: var(--phone-frame); box-shadow: var(--shadow-float), inset 0 0 0 1px var(--line-strong); }
.phone-screen { position: relative; height: 100%; border-radius: 39px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; box-shadow: 0 0 0 1px var(--line); }
.phone-notch { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 104px; height: 28px; border-radius: 99px; background: #0b1210; z-index: 2; }
.phone-head { display: flex; align-items: center; gap: 10px; padding: 50px 16px 12px; border-bottom: 1px solid var(--line); }
.phone-head .avatar { width: 34px; height: 34px; font-size: 13px; }
.phone-head b { display: block; font-size: 14px; line-height: 1.2; }
.phone-head small { font: 11px var(--font-mono); color: var(--accent); }
.phone-body { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--ground); }
.phone-body .bubble { max-width: 82%; font-size: 14px; }
.phone-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.phone-input textarea { min-height: 42px; height: 42px; max-height: 120px; border-radius: 22px; padding: 10px 16px; font-size: 14px; resize: none; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; flex: none; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--contrast-fg); background: var(--contrast-bg); }
.send-btn:disabled { opacity: .5; cursor: progress; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.steps { counter-reset: step; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.step::before { counter-increment: step; content: "0" counter(step); width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font: 600 12px var(--font-mono); background: var(--tint); color: var(--accent-strong); }
.step b { display: block; }
.step p { font-size: 13.5px; color: var(--muted); }
@media (max-width: 1000px) {
  .lab { grid-template-columns: 1fr; }
  .phone { position: relative; top: 0; }
}

/* ---------- Kirish sahifasi ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-art { position: relative; overflow: hidden; isolation: isolate; margin: 14px; border-radius: 32px; background: #e4f8d9; color: #111311; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgba(17, 19, 17, .12) 1px, transparent 1px); background-size: 22px 22px; }
.login-art .blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); }
.login-art .blob.a { width: 380px; height: 380px; top: -160px; right: -60px; background: rgba(166, 236, 138, .9); }
.login-art .blob.b { width: 420px; height: 420px; bottom: -220px; left: -120px; background: rgba(255, 255, 255, .8); }
.login-art h1 { font-size: clamp(32px, 4.4vw, 58px); line-height: 1.04; max-width: 560px; }
.login-art h1 em { font-style: normal; background: #111311; color: #a6ec8a; padding: 0 .16em; border-radius: .2em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.login-art .hero-lead { color: #3a3e3a; }
.login-art .brand { padding: 0; color: #111311; }
.login-art .chip { background: rgba(255, 255, 255, .7); }
.login-chat { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.login-chat .bubble { font-size: 14px; box-shadow: 0 24px 48px -22px rgba(17, 19, 17, .35); }
.login-chat .bubble.user { background: #fff; color: #111311; border: 0; animation: float 6s ease-in-out infinite; }
.login-chat .bubble.assistant { background: #111311; color: #fff; animation: float 6s ease-in-out -2s infinite; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.04em; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-chat { display: none; }
}

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