/* =========================================================================
   AI Marketolog — dizayn tizimi (v2)
   Yo'nalish: Linear / Stripe — neytral kulrang, bitta ko'k aksent, 1px chegaralar,
   minimal soya, zich va o'qiladigan jadval/raqamlar. 4px to'r, 13.5px asosiy shrift.
   ========================================================================= */

:root {
  /* fon va yuzalar */
  --bg:            #f7f8fa;
  --surface:       #ffffff;
  --surface-2:     #f3f4f6;
  --surface-3:     #e9ebef;
  --overlay:       rgba(17, 24, 39, .42);

  /* chegaralar */
  --border:        #e5e7eb;
  --border-strong: #d1d5dc;

  /* matn */
  --text:          #14171f;
  --text-2:        #5b6472;
  --text-3:        #8a93a3;
  --text-inv:      #ffffff;

  /* brend — Stripe/Linear ko'ki */
  --brand:         #2563eb;
  --brand-hover:   #1d4ed8;
  --brand-active:  #1e40af;
  --brand-soft:    #eaf0fe;
  --brand-soft-2:  #d9e4fd;
  --brand-text:    #1e40af;
  --brand-ring:    rgba(37, 99, 235, .22);

  /* semantik */
  --ok:   #15803d; --ok-soft:   #e8f6ed; --ok-text:   #166534;
  --warn: #b45309; --warn-soft: #fdf3e4; --warn-text: #92400e;
  --bad:  #b91c1c; --bad-soft:  #fdecec; --bad-text:  #991b1b;
  --info: #0369a1; --info-soft: #e6f3fb; --info-text: #075985;

  /* soyalar — minimal, chegara asosiy */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .04);
  --sh-2: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .03);
  --sh-3: 0 6px 16px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --sh-4: 0 20px 48px rgba(16, 24, 40, .18), 0 6px 14px rgba(16, 24, 40, .08);

  --r-xs: 5px; --r-sm: 7px; --r: 9px; --r-lg: 12px; --r-xl: 16px;
  --sidebar: 248px;
  --beta-h: 32px;
  --topbar-h: 60px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg:            #090c14;
  --surface:       #0f131d;
  --surface-2:     #141927;
  --surface-3:     #1b2233;
  --overlay:       rgba(2, 4, 10, .7);

  --border:        #1e2638;
  --border-strong: #2a3450;

  --text:          #e9edf5;
  --text-2:        #9aa6bc;
  --text-3:        #66728a;
  --text-inv:      #ffffff;

  --brand:         #4f8cff;
  --brand-hover:   #6a9dff;
  --brand-active:  #3b78ef;
  --brand-soft:    #14213d;
  --brand-soft-2:  #1a2c52;
  --brand-text:    #9dbdff;
  --brand-ring:    rgba(79, 140, 255, .35);

  --ok:   #3ddc84; --ok-soft:   #0c2419; --ok-text:   #86efac;
  --warn: #f5b83d; --warn-soft: #2a1e08; --warn-text: #fcd34d;
  --bad:  #ff6b6b; --bad-soft:  #2d1418; --bad-text:  #fca5a5;
  --info: #38bdf8; --info-soft: #0b2232; --info-text: #7dd3fc;

  --sh-1: 0 1px 2px rgba(0,0,0,.45);
  --sh-2: 0 1px 3px rgba(0,0,0,.55);
  --sh-3: 0 8px 22px rgba(0,0,0,.55);
  --sh-4: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.03);
}

/* Qorong'i mavzu: chuqurlik — yumshoq nur va shisha yuzalar */
[data-theme="dark"] body {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(79,140,255,.14), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(124,92,255,.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="dark"] .sidebar { background: rgba(15,19,29,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
[data-theme="dark"] .topbar { background: rgba(12,16,24,.7); }
[data-theme="dark"] .card { background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 40%), var(--surface); }
[data-theme="dark"] .card.handover, [data-theme="dark"] .plan-card.hot { background: linear-gradient(180deg, rgba(79,140,255,.12), var(--surface) 70%); }
[data-theme="dark"] .brand-mark, [data-theme="dark"] .avatar.brain, [data-theme="dark"] .job-pill .pulse, [data-theme="dark"] .prep .pulse {
  background: linear-gradient(135deg, #4f8cff, #7c5cff); box-shadow: 0 0 18px rgba(79,140,255,.35);
}
[data-theme="dark"] .btn.primary { background: linear-gradient(180deg, #5a95ff, #3f7ef5); border-color: #3f7ef5; box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 0 16px rgba(79,140,255,.22); }
[data-theme="dark"] .btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #6aa0ff, #4a87f8); }
[data-theme="dark"] .metric .val { text-shadow: 0 0 24px rgba(79,140,255,.12); }
[data-theme="dark"] .jstep.now { background: linear-gradient(180deg, rgba(79,140,255,.18), rgba(79,140,255,.06)); }
[data-theme="dark"] .chat-row.owner .bubble { background: linear-gradient(135deg, #4f8cff, #5f7cff); border-color: transparent; }
[data-theme="dark"] .tcard { background: var(--surface-2); }
[data-theme="dark"] .col { background: rgba(20,25,39,.6); }
[data-theme="dark"] .bar i, [data-theme="dark"] .conf-bar i { background: linear-gradient(90deg, #4f8cff, #7c5cff); }
[data-theme="dark"] ::selection { background: rgba(79,140,255,.35); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select.sel { background: var(--surface-2); }
[data-theme="dark"] .md, [data-theme="dark"] .doc { background: rgba(20,25,39,.7); }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding-top: var(--beta-h);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11" 1, "ss01" 1, "calt" 1;
  overflow-x: hidden;
}

::selection { background: var(--brand-soft-2); }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* fokus — klaviatura uchun ko'rinadigan halqa */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }
button:focus-visible, .btn:focus-visible { outline-offset: 1px; }

/* ------------------------------------------------------- beta ogohlantirish */
.beta-bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--beta-h); z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px; font-size: 12px; line-height: 1.3;
  background: var(--surface); color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.beta-bar b { font-weight: 600; color: var(--text); }
.beta-bar .ic { flex: 0 0 auto; color: var(--warn); }
@media (max-width: 700px) { .beta-bar .long { display: none; } }

.ic { flex: 0 0 auto; }
.hidden { display: none !important; }
/* `display: flex` kabi qoidalar brauzerning [hidden] uslubini bosib ketmasin */
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.dim   { color: var(--text-3); }
.small { font-size: 12.5px; }
.xs    { font-size: 11.5px; }
.mono  { font-variant-numeric: tabular-nums; }
.num   { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.tr    { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================================================== KARKAS ===== */
#app { display: flex; min-height: calc(100vh - var(--beta-h)); }

/* ---------------------------------------------------------- yon panel --- */
.sidebar {
  position: fixed; top: var(--beta-h); left: 0; bottom: 0;
  width: var(--sidebar); z-index: 30;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  gap: 14px;
  overflow-y: auto;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 2px 4px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.brand-txt { flex: 1; min-width: 0; }
.brand-name { font-weight: 600; letter-spacing: -.01em; font-size: 14px; line-height: 1.25; }
.brand-sub {
  font-size: 11px; color: var(--text-3); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* biznes tanlagich */
.switcher { position: relative; }
.switcher-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-align: left; color: inherit; box-shadow: var(--sh-1);
  transition: border-color .15s, background .15s;
}
.switcher-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.switcher-btn .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.switcher-btn .t1 { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-btn .t2 { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#switcherChev { display: flex; color: var(--text-3); transition: transform .18s; }
.switcher.open #switcherChev { transform: rotate(180deg); }
#switcherIcon {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand-text); flex: 0 0 auto;
}

.switcher-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-4);
  padding: 5px; max-height: 340px; overflow-y: auto;
  animation: pop .14s ease-out;
}
.switcher-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer; text-align: left; color: inherit;
  font-family: inherit;
}
.switcher-item:hover { background: var(--surface-2); }
.switcher-item.active { background: var(--brand-soft); color: var(--brand-text); }
.switcher-item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.switcher-item .t1 { display: block; font-weight: 540; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-item .t2 { display: block; font-size: 11.5px; color: var(--text-3); }
.switcher-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.switcher-item.danger { color: var(--bad); }
.switcher-item.danger .t2 { color: var(--bad); opacity: .75; }
.switcher-item.danger:hover { background: var(--bad-soft); }

/* navigatsiya */
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); font-weight: 600; padding: 8px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 13.25px; font-weight: 500;
  font-family: inherit; text-align: left; width: 100%;
  transition: background .12s, color .12s;
}
.nav-item .ic { color: var(--text-3); transition: color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .ic { color: var(--text-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav-item.active .ic { color: var(--brand); }
.nav-item .badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 20px; font-size: 10.5px; font-weight: 650;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
  background: var(--bad); color: #fff;
}
.nav-item.active .badge { background: var(--brand); }
.nav-item .kbd { margin-left: auto; }

.plan-badge {
  display: flex; flex-direction: column; gap: 6px; padding: 9px 10px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
}
.plan-badge:hover { border-color: var(--border-strong); }
.plan-badge:empty { display: none; }
.plan-badge .pb-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.plan-badge .bar { height: 3px; }

/* tarif kartalari */
.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1200px) { .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .plans-grid { grid-template-columns: 1fr; } }
.pc-example {
  margin-top: 12px; padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  font-size: 11.75px; color: var(--text-2); line-height: 1.45;
  display: flex; gap: 6px; align-items: flex-start;
}
.pc-example .ic { margin-top: 2px; }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.plan-card.hot { background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 60%); }
.pc-top { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.pc-price { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.pc-price small { font-size: 12.5px; color: var(--text-3); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.pc-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.pc-feats li { display: flex; gap: 7px; align-items: center; }
.pc-feats .ic { color: var(--ok); }

/* onboarding */
.onb { max-width: 720px; margin: 24px auto 0; }
.onb-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.onb-step { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.onb-step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; border: 1.5px solid var(--border-strong); color: var(--text-3); flex: 0 0 auto; }
.onb-step.now { border-color: var(--brand); background: var(--brand-soft); }
.onb-step.now b { background: var(--brand); border-color: var(--brand); color: #fff; }
.onb-step .t1 { font-size: 13px; font-weight: 600; }
.onb-step .t2 { font-size: 11.5px; color: var(--text-3); }
.onb-card .card-body { padding: 24px; }
@media (max-width: 640px) { .onb-steps { grid-template-columns: 1fr; } .onb-card .card-body { padding: 16px; } }

/* ------------------------------------------------ marketolog brifingi -- */
.brief {
  display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface);
  box-shadow: var(--sh-1); position: relative; overflow: hidden;
}
.brief-av {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand); color: #fff;
}
.brief-main { flex: 1; min-width: 0; }
.brief-hi { font-size: 12.5px; color: var(--text-3); font-weight: 520; }
.brief-text { font-size: 17px; line-height: 1.45; font-weight: 560; letter-spacing: -.012em; margin: 3px 0 12px; }
.brief-text b { color: var(--brand-text); font-weight: 650; }
.brief-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.brief-ask {
  display: flex; gap: 8px; align-items: center; padding: 5px 5px 5px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2);
  transition: border-color .12s, box-shadow .12s;
}
.brief-ask:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.brief-ask input { border: none !important; box-shadow: none !important; background: transparent !important; padding: 6px 0; min-height: 30px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 20px; padding: 4px 11px; font-size: 12.25px; cursor: pointer; font-family: inherit;
  transition: border-color .12s, color .12s, background .12s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-text); background: var(--brand-soft); }
[data-theme="dark"] .brief {
  background: linear-gradient(135deg, rgba(79,140,255,.14), rgba(124,92,255,.06) 55%, transparent), var(--surface);
  border-color: rgba(79,140,255,.25);
}
[data-theme="dark"] .brief-av { background: linear-gradient(135deg, #4f8cff, #7c5cff); box-shadow: 0 0 22px rgba(79,140,255,.4); }
@media (max-width: 640px) {
  .brief { padding: 16px; gap: 10px; flex-direction: column; align-items: stretch; }
  .brief-av { width: 34px; height: 34px; border-radius: 10px; align-self: flex-start; }
  .brief-text { font-size: 15.5px; }
  /* telefonda tezkor savollar bitta suriladigan qatorda — ekranni egallamasin */
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .chat-chips .chips { margin-left: 0; margin-right: 0; padding: 0; }
}

/* KPI ro'yxati: uzun matn o'qiladigan bo'lsin */
.kpi-list { display: flex; flex-direction: column; }
.kpi-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 16px; border-top: 1px solid var(--border); }
.kpi-item:first-child { border-top: none; }
.kpi-item .ic { color: var(--brand); margin-top: 2px; }
.kpi-item .k1 { font-size: 13.25px; font-weight: 560; line-height: 1.4; }
.kpi-item .k2 { font-size: 12.5px; color: var(--text-2); line-height: 1.45; margin-top: 2px; }

/* chatdagi tizim hodisalari — pufak emas, ixcham qator */
.chat-event {
  display: flex; gap: 8px; align-items: flex-start; align-self: center; max-width: 640px; width: 100%;
  padding: 7px 12px; border-radius: var(--r); font-size: 12.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}
.chat-event .ic { color: var(--ok); margin-top: 1px; }
.chat-event .t { flex: 1; min-width: 0; line-height: 1.45; }
.chat-event time { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.chat-chips { max-width: 860px; margin: 0 auto 8px; }
.chat-chips .chips { margin-top: 0; }

/* kanban: ko'p kartali ustunni yig'ish */
.col-more {
  width: 100%; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2);
  border-radius: var(--r); padding: 8px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.col-more:hover { border-color: var(--brand); color: var(--brand-text); }

/* ogohlantirish lentasi */
.banner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 11px 14px; margin-bottom: 14px;
  border-radius: var(--r-lg); background: var(--warn-soft); color: var(--warn-text);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner .t { flex: 1; min-width: 220px; font-size: 13px; line-height: 1.45; }
.banner b { font-weight: 650; }

/* analitika: mini ustunli grafik */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 6px; }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 18px; }
.barcol i { display: block; width: 100%; max-width: 28px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; }
.barcol span { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* hisobotni chop etish — faqat hujjat qoladi */
@media print {
  .sidebar, .topbar, .tabbar, .beta-bar, .working, .toasts, .page-head .actions, #modal { display: none !important; }
  body { padding-top: 0; background: #fff; color: #000; }
  .main { margin-left: 0; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* admin */
#admTable tr.blocked td { opacity: .6; }

.side-user { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.user-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 8px;
  border-radius: var(--r-sm); background: none; border: none; cursor: pointer; color: inherit; font-family: inherit; text-align: left;
}
.user-btn:hover { background: var(--surface-2); }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: 0 0 auto; }
.user-btn .txt { min-width: 0; display: flex; flex-direction: column; }
.user-btn .t1 { font-size: 12.75px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .t2 { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; align-items: center; gap: 6px; }
.side-foot .model {
  flex: 1; font-size: 11px; color: var(--text-3); min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono);
  display: flex; align-items: center; gap: 6px;
}
.side-foot .model i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.side-foot .model i.off { background: var(--bad); }

/* ------------------------------------------------------------- asosiy --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar); }

.topbar {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: var(--beta-h); z-index: 20;
}
.topbar-title { flex: 1 1 0; min-width: 0; }
.topbar h1 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.012em; line-height: 1.25; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar-stats { display: flex; gap: 6px; }

.stat-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-chip b { color: var(--text); font-weight: 600; }
.stat-chip .ic { color: var(--text-3); }
.stat-chip.alert { background: var(--bad-soft); border-color: transparent; color: var(--bad-text); }
.stat-chip.alert b, .stat-chip.alert .ic { color: var(--bad); }
.stat-chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.stat-chip.warn b, .stat-chip.warn .ic { color: var(--warn); }

.page { padding: 24px 28px 64px; flex: 1; min-width: 0; max-width: 1280px; width: 100%; }
.page.wide { max-width: none; }
.page-head { margin-bottom: 18px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.012em; }
.page-head .desc { font-size: 12.75px; color: var(--text-2); margin-top: 3px; }
.page-head .spacer { flex: 1; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================ KARTALAR == */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.card + .card, .card + .grid, .grid + .card, .card + .section, .section + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  min-height: 46px;
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.card-head .ic { color: var(--text-3); }
.card-head .spacer { flex: 1; }
.card-head .meta { font-size: 12px; color: var(--text-3); }
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 16px; }
.card-body.flush { padding: 0; }
.card-foot {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card.subtle { background: var(--surface-2); box-shadow: none; }
.card.flat { box-shadow: none; }

/* ------------------------------------------------ yo'l xaritasi (stepper) */
.journey {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden; box-shadow: var(--sh-1);
}
.jstep {
  position: relative; display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 14px; border-right: 1px solid var(--border);
  background: none; border-top: none; border-bottom: none; border-left: none;
  cursor: pointer; text-align: left; color: inherit; font-family: inherit;
  transition: background .12s;
}
.jstep:last-child { border-right: none; }
.jstep:hover { background: var(--surface-2); }
.jstep .n {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 650;
  border: 1.5px solid var(--border-strong); color: var(--text-3); background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.jstep .t { min-width: 0; }
.jstep .t1 { font-size: 12.75px; font-weight: 600; line-height: 1.3; }
.jstep .t2 { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.35; }
.jstep.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.jstep.done .t1 { color: var(--text-2); }
.jstep.now  { background: var(--brand-soft); }
.jstep.now .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.jstep.now .t1 { color: var(--brand-text); }
.jstep.now .t2 { color: var(--brand-text); opacity: .8; }
.jstep.now::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand);
}
.jstep.todo .t1 { color: var(--text-2); }

/* ------------------------------------------------- ko'rsatkich (KPI) ---- */
.metric { padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; min-height: 96px; }
.metric .lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.metric .lbl .ic { color: var(--text-3); }
.metric .val { font-size: 24px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 2px; }
.metric .val small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 2px; }
.metric .hint { font-size: 11.75px; color: var(--text-3); margin-top: auto; }
.metric.accent .val { color: var(--brand-text); }
.metric.ok .val   { color: var(--ok-text); }
.metric.warn .val { color: var(--warn-text); }
.metric.bad .val  { color: var(--bad-text); }
.metric .bar { margin-top: 6px; }

/* progress chizig'i */
.bar { height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .4s ease; }
.bar.ok i { background: var(--ok); }
.bar.warn i { background: var(--warn); }
.bar.bad i { background: var(--bad); }

/* ------------------------------------------------- intervyu (savollar) -- */
.guess {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--brand-soft); color: var(--brand-text);
  border-radius: var(--r); padding: 10px 12px; font-size: 13px; line-height: 1.45;
}
.guess .ic { margin-top: 2px; flex: 0 0 auto; }
.guess .dim { color: var(--brand-text); opacity: .72; }

.prep {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--brand-soft); color: var(--brand-text);
  border-radius: var(--r); padding: 12px 14px; font-size: 13px;
}
.prep .pulse {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  animation: breathe 1.5s ease-in-out infinite;
}
.prep .dim { color: var(--brand-text); opacity: .75; }

.qcard { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; background: var(--surface); }
.qcard + .qcard { margin-top: 8px; }
.qcard:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.qcard .q { display: flex; gap: 9px; align-items: flex-start; font-weight: 560; font-size: 13.25px; line-height: 1.4; }
.qcard .q .n {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; margin-top: 0;
  background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 650;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.qcard .why { font-size: 12px; color: var(--text-3); margin: 5px 0 8px 29px; }
.qcard textarea { margin-bottom: 0; background: var(--surface-2); border-color: transparent; }
.qcard textarea:focus { background: var(--surface); border-color: var(--border-strong); box-shadow: none; }

details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "+"; color: var(--text-3); font-size: 16px; margin-left: auto; line-height: 1;
}
details.card[open] > summary::after { content: "−"; }
details.card > summary h3 { flex: 0 1 auto; }

/* ------------------------------------------------------- kontent-reja --- */
.card.handover { border-color: var(--brand-soft-2); }
.card.handover .card-head { background: var(--brand-soft); color: var(--brand-text); border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom-color: var(--brand-soft-2); }
.card.handover .card-head .ic { color: var(--brand); }
.handover-text { font-size: 13.5px; line-height: 1.6; }

.owner-act { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.owner-act:last-child { border-bottom: none; }
.owner-act > .ic { color: var(--brand); margin-top: 2px; flex: 0 0 auto; }
.owner-act > div { flex: 1; min-width: 0; }
.owner-act .tag { flex: 0 0 auto; }

.citem { display: flex; gap: 12px; align-items: flex-start; }
.citem + .citem { padding-top: 12px; border-top: 1px solid var(--border); }
.cday {
  flex: 0 0 auto; width: 42px; text-align: center; padding: 5px 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.cday b { display: block; font-size: 15px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cday span { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.cbody { flex: 1; min-width: 0; }
.cmeta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-bottom: 5px; }
.ctopic { font-weight: 560; font-size: 13.5px; margin-bottom: 5px; }
.chook {
  display: flex; gap: 7px; align-items: flex-start; font-size: 12.75px;
  background: var(--surface-2); border-left: 2px solid var(--warn);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 6px 10px;
}
.chook .ic { color: var(--warn); flex: 0 0 auto; margin-top: 2px; }

/* xavfli amallar */
.card.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.card.danger .card-head { color: var(--bad-text); }
.card.danger .card-head .ic { color: var(--bad); }
.danger-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.danger-row .txt { flex: 1; min-width: 200px; font-size: 12.75px; color: var(--text-2); }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } .span2 { grid-column: span 2; } }
@media (max-width: 780px)  { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* ============================================================ TUGMALAR == */
button, input, textarea, select { font-family: inherit; font-size: 13.5px; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm); min-height: 34px;
  border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-weight: 540; font-size: 13px; line-height: 1.2;
  box-shadow: var(--sh-1); white-space: nowrap; color: var(--text);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn .ic { color: inherit; opacity: .9; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--sh-1), inset 0 1px 0 rgba(255,255,255,.12); }
.btn.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.primary:active:not(:disabled) { background: var(--brand-active); }
.btn.ok   { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-soft { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); color: var(--bad-text); box-shadow: none; }
.btn.danger-soft:hover:not(:disabled) { background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); box-shadow: none; }
.btn.soft:hover:not(:disabled) { background: var(--brand-soft-2); }
.btn.sm { padding: 5px 9px; font-size: 12.5px; min-height: 28px; border-radius: var(--r-xs); }
.btn.icon { padding: 7px; width: 34px; }
.btn.icon.sm { padding: 5px; width: 28px; }
.btn.block { width: 100%; }
.btn.lg { padding: 10px 16px; font-size: 14px; min-height: 40px; border-radius: var(--r); }

.btn .spin { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* segmentli tanlagich */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button {
  border: none; background: none; padding: 4px 10px; border-radius: 5px; cursor: pointer;
  font-size: 12.5px; font-weight: 520; color: var(--text-2); font-family: inherit; min-height: 26px;
  transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh-2); font-weight: 600; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3); background: var(--surface);
}

/* ============================================================ MAYDONLAR = */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 560; color: var(--text); }
.field .help { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

input[type="text"], input[type="date"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"], input[type="tel"],
input:not([type]), textarea, select.sel {
  width: 100%; padding: 8px 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-1); outline: none; resize: vertical; min-height: 34px;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, textarea:hover, select.sel:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
input:focus, textarea:focus, select.sel:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
::placeholder { color: var(--text-3); }
/* Brauzer avtoto'ldirishi maydonni oq qilib, mavzuni buzmasin */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
select.sel {
  width: auto; cursor: pointer; padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6.5 9.5l5.5 5.5 5.5-5.5'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
select.sel.block { width: 100%; }
input[type="date"] { font-variant-numeric: tabular-nums; }

/* ============================================================= YORLIQ === */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 540; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.tag .ic { width: 12px; height: 12px; }
.tag.ok      { background: var(--ok-soft);    color: var(--ok-text);    border-color: transparent; }
.tag.warn    { background: var(--warn-soft);  color: var(--warn-text);  border-color: transparent; }
.tag.bad     { background: var(--bad-soft);   color: var(--bad-text);   border-color: transparent; }
.tag.info    { background: var(--info-soft);  color: var(--info-text);  border-color: transparent; }
.tag.accent  { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.tag.solid   { background: var(--brand); color: #fff; border-color: transparent; }
.tag.neutral { background: var(--surface-2); color: var(--text-2); }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

/* ============================================================== RO'YXAT = */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 6px; }
.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.bullets li::marker { color: var(--text-3); }

.deflist { display: grid; grid-template-columns: 148px 1fr; gap: 8px 16px; font-size: 13.25px; }
.deflist dt { color: var(--text-3); font-weight: 500; }
.deflist dd { margin: 0; }
@media (max-width: 640px) { .deflist { grid-template-columns: 1fr; gap: 1px 0; } .deflist dd { margin-bottom: 8px; } }

/* qator ro'yxati (Linear list) */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 11px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: none; border-left: none; border-right: none; border-bottom: none;
  width: 100%; text-align: left; color: inherit; font-family: inherit; cursor: default;
}
.row:first-child { border-top: none; }
button.row { cursor: pointer; transition: background .1s; }
button.row:hover { background: var(--surface-2); }
.row .ric {
  width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.row .ric.accent { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.row .ric.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.row .ric.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.row .ric.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.row .rt { flex: 1; min-width: 0; }
.row .rt1 { font-size: 13.25px; font-weight: 560; line-height: 1.35; }
.row .rt2 { font-size: 12px; color: var(--text-3); margin-top: 1px; line-height: 1.4; }
.row .rr { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; color: var(--text-3); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 8px 14px; font-size: 10.75px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
table.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.card > table.tbl:last-child tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }

.section-label {
  font-size: 10.75px; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600; color: var(--text-3); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.section { margin-top: 18px; }

/* ============================================================ BO'SH HOLAT */
.empty { text-align: center; padding: 48px 24px; }
.empty .ico {
  width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 14px;
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.empty h4 { margin: 0 0 5px; font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; }
.empty p { margin: 0 auto 16px; max-width: 400px; color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* ================================================================= CHAT = */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--beta-h) - var(--topbar-h)); }
.chat-log {
  flex: 1; overflow-y: auto; padding: 24px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-inner { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.chat-row { display: flex; gap: 10px; max-width: 720px; }
.chat-row.owner { align-self: flex-end; flex-direction: row-reverse; }
.avatar {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; margin-top: 1px;
}
.avatar.brain { background: var(--brand); color: #fff; }
.avatar.owner { background: var(--surface-3); color: var(--text-2); }

.bubble {
  padding: 10px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--sh-1); white-space: pre-wrap; font-size: 13.5px; line-height: 1.55;
}
.chat-row.brain .bubble { border-top-left-radius: 5px; }
.chat-row.owner .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-top-right-radius: 5px; }
.chat-meta { font-size: 11px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.chat-row.owner .chat-meta { justify-content: flex-end; }

.chat-form {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 12px 28px;
}
.chat-form-inner {
  max-width: 860px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  padding: 6px 6px 6px 12px; box-shadow: var(--sh-1); transition: border-color .12s, box-shadow .12s;
}
.chat-form-inner:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.chat-form textarea {
  flex: 1; max-height: 160px; border: none; box-shadow: none; padding: 7px 0; background: transparent; min-height: 30px;
}
.chat-form textarea:focus { box-shadow: none; }
.chat-hint { max-width: 860px; margin: 6px auto 0; font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; align-items: center; }

.next-steps { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
/* keyingi qadamlar to'liq jumla — bitta qatorga sig'masa o'ralsin, ekrandan chiqmasin */
.next-steps .tag { white-space: normal; align-items: flex-start; line-height: 1.4; padding: 4px 10px; border-radius: 12px; text-align: left; }
.next-steps .tag .ic { margin-top: 2px; }
.basis-row { margin-top: 6px; }
.basis-row .tag { font-size: 11px; }

.chat-row.pending { opacity: .55; }
.chat-row.pending .chat-meta .ic { vertical-align: -1px; }

.bubble.typing { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12.75px; }
.bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.25s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .18s; }
.bubble.typing i:nth-child(3) { animation-delay: .36s; }
.bubble.typing span { margin-left: 4px; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2.5px); } }

.bubble.err { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); color: var(--bad-text); background: var(--bad-soft); }
.avatar.err { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------------------------- tanqid --- */
.audit { margin-top: 10px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.audit-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.audit-head .ttl { font-weight: 600; font-size: 13.25px; flex: 1; line-height: 1.35; }
.audit-body { padding: 14px; display: flex; flex-direction: column; gap: 16px; }

.conf-bar { height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; width: 64px; }
.conf-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

.claim { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 13px; border-left: 3px solid var(--brand); }
.claim .c { font-weight: 600; font-size: 13.25px; margin-bottom: 3px; line-height: 1.4; }
.claim .w { font-size: 13px; color: var(--text); line-height: 1.5; }
.claim .e { font-size: 12.25px; color: var(--text-2); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); line-height: 1.45; }
.claim.warn { border-left-color: var(--warn); }
.claim.ok { border-left-color: var(--ok); }

.risk { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.risk:last-child { border-bottom: none; }
.risk > .ic { color: var(--text-3); margin-top: 2px; }
.risk .r-body { flex: 1; }
.risk .r-t { font-size: 13px; font-weight: 540; line-height: 1.4; }
.risk .r-d { font-size: 12.25px; color: var(--text-2); line-height: 1.45; }

.plan-box { border-radius: var(--r); padding: 12px 14px; border: 1px solid transparent; }
.plan-box.alt    { background: var(--brand-soft); border-color: var(--brand-soft-2); }
.plan-box.insist { background: var(--warn-soft); }
.plan-box .pb-h { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.plan-box.alt .pb-h    { color: var(--brand-text); }
.plan-box.insist .pb-h { color: var(--warn-text); }
.plan-box .pb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.plan-box .fact { background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; border: 1px solid var(--border); }
.plan-box .fact .k { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.plan-box .fact .v { font-size: 13px; font-weight: 560; }

.decide { display: flex; gap: 8px; padding: 12px 14px; flex-wrap: wrap; background: var(--surface-2); border-top: 1px solid var(--border); align-items: center; }
.decide .q { flex: 1; font-size: 13px; font-weight: 560; min-width: 180px; display: flex; align-items: center; gap: 6px; }

/* ============================================================== KANBAN == */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1280px) { .board { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px)  { .board { grid-template-columns: 1fr; } }

.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; padding: 2px 4px; }
.col-head .nm { font-size: 12.5px; font-weight: 600; letter-spacing: .005em; display: flex; align-items: center; gap: 7px; }
.col-head .nm::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.col-head .ct { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0 7px; min-width: 22px; text-align: center; }
.col.ok   .col-head .nm::before { background: var(--ok); }
.col.warn .col-head .nm::before { background: var(--warn); }
.col.info .col-head .nm::before { background: var(--info); }

.tcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 11px 12px; margin-bottom: 8px;
  box-shadow: var(--sh-1); cursor: pointer; position: relative;
  transition: box-shadow .14s, border-color .14s, transform .08s;
}
.tcard:hover { box-shadow: var(--sh-3); border-color: var(--border-strong); }
.tcard:active { transform: translateY(.5px); }
.tcard-top { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.role-ic { width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; border: 1px solid var(--border); }
.tcard .ttl { font-size: 13px; font-weight: 560; line-height: 1.4; margin-bottom: 8px; }
.tcard .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tcard .foot span { display: inline-flex; align-items: center; gap: 4px; }
.tcard .acts { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tcard.overdue { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
.tcard .prio { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.prio.yuqori { background: var(--bad); }
.prio.orta { background: var(--warn); }
.prio.past { background: var(--text-3); }

.score { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.score.ok  { background: var(--ok-soft);   color: var(--ok-text); }
.score.mid { background: var(--warn-soft); color: var(--warn-text); }
.score.bad { background: var(--bad-soft);  color: var(--bad-text); }

/* vazifa filtri paneli */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

/* =============================================================== MODAL == */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: var(--overlay); backdrop-filter: blur(3px); }
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-4);
  width: min(840px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .16s ease-out;
}
.modal-box.narrow { width: min(520px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.995); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head .ic { color: var(--text-3); }
.modal-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; flex: 1; letter-spacing: -.01em; line-height: 1.35; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; }

.doc {
  white-space: pre-wrap; font-size: 13.25px; line-height: 1.65;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; max-height: 460px; overflow-y: auto;
}

/* ------------------------------------------------------------ markdown -- */
.md { font-size: 13.5px; line-height: 1.62; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; max-height: 520px; overflow-y: auto; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 6px; line-height: 1.3; letter-spacing: -.01em; font-weight: 600; }
.md h1 { font-size: 16px; } .md h2 { font-size: 15px; } .md h3 { font-size: 14px; } .md h4 { font-size: 13.5px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 2px 0; }
.md li::marker { color: var(--text-3); }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--brand); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2); }
.md code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
.md pre code { background: none; padding: 0; font-size: 12px; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12.75px; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--surface); font-weight: 600; }
.md strong { font-weight: 600; }
.md a { color: var(--brand-text); }

/* ================================================== YUKLASH / BILDIRISH == */
.topload { position: fixed; top: var(--beta-h); left: 0; right: 0; height: 2px; z-index: 100; overflow: hidden; }
.topload i { display: block; height: 100%; width: 40%; background: var(--brand); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

.toasts { position: fixed; top: calc(var(--beta-h) + 14px); right: 18px; z-index: 110; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-4); padding: 10px 13px;
  font-size: 13px; line-height: 1.45; animation: pop .16s ease-out;
}
.toast .ic { color: var(--brand); margin-top: 1px; }
.toast.ok .ic  { color: var(--ok); }
.toast.bad .ic { color: var(--bad); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* AI ishlayotganini ko'rsatuvchi panel — fon vazifalari ro'yxati */
.working {
  position: fixed; bottom: 20px; left: calc(var(--sidebar) + 24px); z-index: 105;
  display: flex; flex-direction: column; gap: 6px; max-width: 420px;
}
.job-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-4); padding: 9px 12px 9px 10px;
  font-size: 12.75px; animation: pop .16s ease-out; min-width: 280px;
}
.job-pill .pulse {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  background: var(--brand); display: grid; place-items: center; color: #fff;
  animation: breathe 1.5s ease-in-out infinite;
}
.job-pill .jt { flex: 1; min-width: 0; }
.job-pill .jt1 { font-weight: 600; font-size: 12.75px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-pill .jt2 { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.job-pill .bar { margin-top: 5px; height: 3px; }
.job-pill .pct { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: 0 0 auto; text-align: right; line-height: 1.5; }
.job-pill .job-acts { display: flex; flex-direction: column; gap: 2px; margin-right: -4px; }
.job-pill .job-acts .btn { padding: 3px; width: 24px; min-height: 24px; }
.job-pill.batch { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }

/* jonli yozish oynasi */
.live-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: breathe 1.2s ease-in-out infinite; }
.live-md { max-height: 60vh; }
.caret { display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--brand); animation: blink 1s steps(2) infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.9); opacity: .8; } }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* uzun matn/havolalar konteynerdan chiqib ketmasin */
.bubble, .doc, .md, .claim, .risk, .metric, .tcard .ttl, .deflist dd, .row .rt { overflow-wrap: anywhere; }

/* inline tahrirlash qatori (vazifa modali) */
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.edit-grid .field { margin-bottom: 0; }
.edit-grid label { font-size: 11.5px; color: var(--text-3); font-weight: 560; }

/* tab sarlavhalari (modal ichida) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -18px 16px; padding: 0 18px; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 10px; margin-bottom: -1px;
  font-size: 13px; font-weight: 540; color: var(--text-2); cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand-text); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button .ct { font-size: 10.5px; background: var(--surface-3); border-radius: 10px; padding: 0 6px; color: var(--text-2); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* =============================================== MOBIL KOMPONENTLAR ===== */
.only-mobile { display: none !important; }

.drawer-scrim { position: fixed; inset: 0; z-index: 75; background: var(--overlay); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .22s; }
.tabbar { display: none; }
button { -webkit-tap-highlight-color: transparent; }

/* ---------------------------------------------------- planshet (o'rta) -- */
@media (max-width: 1150px) {
  :root { --sidebar: 212px; }
  .page { padding: 20px 18px 56px; }
  .topbar { padding: 0 18px; }
  .chat-log, .chat-form { padding-left: 18px; padding-right: 18px; }
  .journey { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .jstep { padding: 11px 10px; gap: 8px; }
  .jstep .t2 { display: none; }
}

/* ------------------------------------------------------------- mobil ---- */
@media (max-width: 900px) {
  :root { --tabbar-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px); --topbar-h: 54px; }

  .only-mobile { display: inline-flex !important; }
  #app { display: block; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 286px; max-width: 84vw; z-index: 80;
    padding: calc(var(--beta-h) + 14px) 12px 16px;
    border-right: 1px solid var(--border);
    transform: translateX(-101%);
    transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  }
  body.drawer-open .sidebar { transform: none; box-shadow: var(--sh-4); }
  body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }

  .nav { flex: 1; gap: 2px; }
  .nav-item { padding: 11px 12px; font-size: 14px; min-height: 44px; }
  .nav-item .kbd { display: none; }

  .main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b);
  }
  .tab-item {
    position: relative; height: var(--tabbar-h);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: none; cursor: pointer; padding: 0 3px;
    color: var(--text-3); font-family: inherit; font-size: 10px; font-weight: 560;
    transition: color .13s;
  }
  .tab-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-item.active { color: var(--brand-text); }
  .tab-item.active::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 2px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tab-item .badge {
    position: absolute; top: 7px; left: calc(50% + 6px);
    min-width: 15px; height: 15px; padding: 0 4px; border-radius: 20px;
    background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 700;
    display: grid; place-items: center;
  }

  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; height: auto; min-height: var(--topbar-h); }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { font-size: 11.5px; }
  .topbar .spacer { display: none; }
  .topbar-stats { order: 3; width: 100%; flex-wrap: wrap; }
  .stat-chip { font-size: 11.5px; padding: 4px 9px; }
  #btnNewBiz span { display: none; }
  #btnNewBiz { padding: 7px; width: 34px; }

  .page { padding: 14px 12px 32px; }
  .page-head { gap: 10px; }
  .page-head input, .page-head .sel { width: 100% !important; }
  .page-head .actions { width: 100%; }
  .grid { gap: 12px; }
  .card-body { padding: 14px; }
  .card-head { padding: 11px 14px; flex-wrap: wrap; row-gap: 6px; }
  /* keng jadval sahifani emas, faqat o'z kartasini gorizontal suradi */
  .card:has(> table.tbl) { overflow-x: auto; }
  table.tbl th, table.tbl td { padding: 8px 10px; font-size: 12.5px; }

  .journey { grid-template-columns: 1fr; }
  .jstep { border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .jstep:last-child { border-bottom: none; }
  .jstep .t2 { display: block; }
  .jstep.now::after { width: 3px; height: auto; top: 0; bottom: 0; right: auto; }

  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  input[type="text"], input[type="date"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="url"], input[type="tel"],
  input:not([type]), textarea, select.sel { font-size: 16px; }

  .chat { height: auto; }
  .chat-log { overflow: visible; padding: 16px 12px; gap: 14px; }
  .chat-row { max-width: 100%; }
  .chat-form { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); padding: 8px 10px calc(8px + var(--safe-b)); }
  .chat-hint { display: none; }

  .board { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 2px 12px 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .board::-webkit-scrollbar { display: none; }
  .col { flex: 0 0 84%; scroll-snap-align: center; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-box, .modal-box.narrow { width: 100%; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheet .22s cubic-bezier(.4, 0, .2, 1); }
  @keyframes sheet { from { transform: translateY(26px); opacity: .5; } }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { border-radius: 0; padding: 12px 16px calc(12px + var(--safe-b)); }
  .tabs { margin: 0 -16px 14px; padding: 0 16px; overflow-x: auto; }

  .toasts { left: 12px; right: 12px; align-items: stretch; top: calc(var(--beta-h) + 10px); }
  .toast { max-width: none; }
  .working { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); max-width: none; }
  .job-pill { min-width: 0; }
}

/* -------------------------------------------------------- kichik telefon */
@media (max-width: 480px) {
  .topbar h1 { font-size: 14.5px; }
  .metric { padding: 12px 14px; min-height: 84px; }
  .metric .val { font-size: 21px; }
  .decide { flex-direction: column; align-items: stretch; }
  .decide .btn { width: 100%; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .modal-foot .left { margin-right: 0; }
  .plan-box .pb-facts { grid-template-columns: 1fr; }
  .col { flex-basis: 88%; }
  .tab-item { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
