/* H3.KZ — кабинет. Светлая/тёмная тема, motion — те же токены, что на лендинге. */
:root {
  --bg: #f5f7fb; --panel: #ffffff; --panel2: #f8fafd; --text: #0b1220; --muted: #64748b; --line: #e6ebf2; --line2: #eef2f7;
  --accent: #2563eb; --accent-2: #1d4ed8; --accent-soft: #eaf0ff; --violet: #7c3aed;
  --ok: #16a34a; --ok-soft: #e7f8ee; --warn: #c2410c; --warn-soft: #fff1e6; --bad: #dc2626; --bad-soft: #fdecec;
  --side: #ffffff; --side-text: #475569; --side-hover: #f1f5f9;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 24px -12px rgba(15,23,42,.10); --shadow-lg: 0 24px 60px -20px rgba(15,23,42,.35);
  --r: 16px; --r-sm: 10px;
  --ease-std: cubic-bezier(.2,0,0,1); --ease-in: cubic-bezier(.05,.7,.1,1); --ease-out: cubic-bezier(.3,0,1,1);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b16; --panel: #0e1526; --panel2: #0b1220; --text: #e6edf9; --muted: #93a4c0; --line: #1b2540; --line2: #151e33;
    --accent: #6ea0ff; --accent-2: #4f86f7; --accent-soft: #14213d; --violet: #a78bfa;
    --ok: #4ade80; --ok-soft: #0b2a19; --warn: #fb923c; --warn-soft: #34190a; --bad: #f87171; --bad-soft: #3a1212;
    --side: #0a1020; --side-text: #9fb0cc; --side-hover: #121b31;
    --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.55 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; color: var(--text); }
.brand b { font-weight: 800; } .brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg,#3b82f6,#8b5cf6); display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff; letter-spacing: -.5px; flex: none; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); opacity: .8; margin: 14px 10px 6px; }
nav a { display: flex; align-items: center; gap: 8px; color: var(--side-text); padding: 9px 10px; border-radius: 10px; margin-bottom: 2px; font-weight: 600; font-size: 14px;
  transition: background-color 120ms var(--ease-std), color 120ms var(--ease-std); }
nav a:hover { background: var(--side-hover); color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.badge { margin-left: auto; background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; font-weight: 700; }
.badge:empty { display: none; }
.side-foot { margin-top: auto; font-size: 12.5px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); line-height: 1.6; }
.side-user { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; color: var(--text); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none;
  background: linear-gradient(135deg,#0ea5e9,#6366f1); }
.side-user b { display: block; font-size: 13.5px; } .side-user span { color: var(--muted); font-size: 12px; word-break: break-all; }
.plan-line { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.side-foot .meter { margin: 6px 0 4px; }
.side-foot a { font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: #22c55e; } .dot.off { background: #ef4444; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar form { flex: 1; max-width: 520px; position: relative; }
.topbar form input { width: 100%; padding: 10px 14px 10px 38px; border-radius: 12px; background: var(--panel); }
.topbar form svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.burger { display: none; background: none; border: 0; padding: 6px; color: var(--text); }
.lang-sw { font: 600 12.5px var(--font); color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.lang-sw b { color: var(--accent); }
main { padding: 26px 28px 70px; max-width: 1400px; width: 100%; }
main > * { animation: viewIn 280ms var(--ease-in) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- типографика ---------- */
h1 { font-size: 24px; letter-spacing: -.4px; margin: 0 0 4px; font-weight: 800; } h2 { font-size: 16.5px; margin: 0 0 12px; font-weight: 800; }
h3 { font-size: 14.5px; margin: 16px 0 8px; font-weight: 700; }
.sub { color: var(--muted); margin-bottom: 20px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }

/* ---------- карточки и сетки ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.kpi { position: relative; overflow: hidden; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.6px; font-variant-numeric: tabular-nums; } .kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--accent-soft); opacity: .7; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- формы и кнопки ---------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  transition: border-color 120ms var(--ease-std), box-shadow 120ms var(--ease-std); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { width: 100%; min-height: 120px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
button, .btn { font: 600 14px var(--font); cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 9px 15px;
  display: inline-flex; gap: 6px; align-items: center; transition: border-color 120ms var(--ease-std), background-color 120ms var(--ease-std), transform 80ms var(--ease-std); }
button:hover, .btn:hover { border-color: var(--accent); }
button:active, .btn:active { transform: scale(.98); }
button.primary, .btn.primary { background: linear-gradient(135deg,#2563eb,#7c3aed); border-color: transparent; color: #fff; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.07); }
button.ghost { background: transparent; }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; border-radius: 8px; }
button:disabled { opacity: .55; cursor: progress; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---------- таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--panel); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#ecTable input, #ecTable select { padding: 5px 7px; font-size: 13px; }

/* ---------- метки ---------- */
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin: 2px 4px 2px 0; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.new { background: #ef4444; color: #fff; }
a.tag:hover { text-decoration: underline; }
.score { display: inline-grid; place-items: center; min-width: 34px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 12px; }
.lot-title { font-weight: 700; } .lot-sub { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 34px; }
.loader { color: var(--muted); padding: 34px; text-align: center; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .7s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- карточка лота (боковая панель) ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-bg { position: absolute; inset: 0; background: rgba(2,6,23,.45); animation: fadeIn 240ms var(--ease-std); }
.drawer-body { position: absolute; right: 0; top: 0; bottom: 0; width: min(900px, 100%); background: var(--bg); overflow-y: auto; padding: 22px 26px 70px;
  box-shadow: var(--shadow-lg); animation: slideIn 340ms var(--ease-in); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 7px 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
ul.clean { margin: 6px 0; padding-left: 18px; } ul.clean li { margin: 4px 0; }
.decision { font-size: 18px; font-weight: 800; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; white-space: nowrap; color: var(--muted); }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- ведение клиента ---------- */
.journey { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 4px 0 18px; counter-reset: j; }
.journey div { position: relative; padding: 0 6px; text-align: center; font-size: 12.5px; color: var(--muted); }
.journey div::before { counter-increment: j; content: counter(j); display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 6px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--panel); font-weight: 800; color: var(--muted); position: relative; z-index: 1; }
.journey div::after { content: ""; position: absolute; top: 15px; left: calc(50% + 15px); right: calc(-50% + 15px); height: 2px; background: var(--line); }
.journey div:last-child::after { display: none; }
.journey div.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.journey div.done::after { background: var(--ok); }
.journey div.cur { color: var(--text); font-weight: 700; }
.journey div.cur::before { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.coach { border: 0; background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(135deg,#2563eb,#7c3aed) border-box; border: 1.5px solid transparent; }
.coach-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.coach-head .ai { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg,#2563eb,#7c3aed); color: #fff; font-weight: 800; font-size: 13px; }
.act { display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line2);
  animation: viewIn 320ms var(--ease-in) both; }
.act:first-of-type { border-top: 0; }
.act .pr { align-self: stretch; border-radius: 3px; background: var(--accent); }
.act.p1 .pr { background: var(--bad); } .act.p3 .pr { background: var(--line); }
.act b { display: block; } .act .why { color: var(--muted); font-size: 13px; } .act .meta { font-size: 12.5px; color: var(--text); opacity: .85; margin-top: 2px; }
.plan-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.progress { height: 8px; border-radius: 5px; background: var(--line2); overflow: hidden; flex: 1; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg,#22c55e,#16a34a); border-radius: 5px; transform-origin: 0 50%; transition: transform 500ms var(--ease-in); }
.tgroup { margin-top: 14px; }
.tgroup h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tgroup.cur h4 { color: var(--accent); }
.tgroup h4 .now { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--accent); }
.task { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; border-radius: 10px; transition: background-color 120ms var(--ease-std); }
.task:hover { background: var(--panel2); }
.task input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ok); }
.task .tt { font-weight: 600; } .task.done .tt { color: var(--muted); text-decoration: line-through; }
.task .th { color: var(--muted); font-size: 12.5px; } .task .tm { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.task.crit .tt::before { content: "⛔ "; } .ai-src { font-size: 10.5px; font-weight: 800; color: var(--violet); margin-left: 6px; }

/* ---------- прочее ---------- */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; z-index: 60; max-width: 440px;
  box-shadow: var(--shadow-lg); animation: viewIn 240ms var(--ease-in); }
.toast.err { background: var(--bad); color: #fff; }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-height: 220px; }
.col h4 { margin: 2px 4px 10px; font-size: 13px; display: flex; justify-content: space-between; }
.col.drop { outline: 2px dashed var(--accent); }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin-bottom: 8px; cursor: grab; font-size: 13px; box-shadow: var(--shadow);
  transition: transform 160ms var(--ease-std); }
.kcard:hover { transform: translateY(-2px); }
.kcard textarea { min-height: 50px; font-size: 12.5px; margin-top: 6px; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 420px; }
.msgs { flex: 1; overflow-y: auto; padding: 4px; }
.msg { max-width: 85%; padding: 11px 15px; border-radius: 14px; margin: 8px 0; white-space: pre-wrap; animation: viewIn 240ms var(--ease-in); }
.msg.u { background: linear-gradient(135deg,#2563eb,#7c3aed); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.a { background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.trace { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { font-size: 12.5px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.chip:hover { border-color: var(--accent); }
.bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg,#2563eb,#7c3aed); }
.bars td { padding: 6px 8px; }
.meter { height: 7px; border-radius: 4px; background: var(--line2); overflow: hidden; margin: 10px 0 4px; }
.meter div { height: 100%; background: linear-gradient(90deg,#2563eb,#7c3aed); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: var(--panel); }
.seg button.on { background: var(--accent); color: #fff; }
.plan { border: 1px solid var(--line); border-radius: var(--r); padding: 20px; background: var(--panel2); display: flex; flex-direction: column; }
.plan.hot { border: 2px solid var(--accent); }
.plan .price { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.plan ul { flex: 1; } .plan button { margin-top: 10px; justify-content: center; }
.paybox { max-width: 540px; margin: 40px auto; }
.onboard { border: 2px dashed var(--accent); }

/* ---------- вход / регистрация ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; padding: 48px 6vw; align-items: center;
  background: radial-gradient(1100px 600px at 0% 0%, rgba(59,130,246,.13), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(124,58,237,.10), transparent 60%), var(--bg); }
.auth .brand { padding: 0 0 24px; }
.auth-hero h1 { font-size: 34px; line-height: 1.18; margin: 0 0 14px; max-width: 640px; letter-spacing: -.8px; }
.auth-hero .lead { font-size: 16px; color: var(--muted); max-width: 600px; }
.feat { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; max-width: 620px; }
.feat li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.auth-box { max-width: 440px; width: 100%; justify-self: center; }
.auth-box .card { padding: 26px; animation: viewIn 320ms var(--ease-in); }
.auth-foot { display: flex; justify-content: center; gap: 12px; align-items: center; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform 300ms var(--ease-std); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .side-scrim { position: fixed; inset: 0; background: rgba(2,6,23,.4); z-index: 25; }
  .burger { display: block; }
  .topbar { padding: 10px 16px; }
  main { padding: 18px 16px 60px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .journey div:nth-child(3)::after { display: none; }
  .auth { grid-template-columns: 1fr; padding: 24px 16px; } .auth-hero h1 { font-size: 24px; } .feat { display: none; }
  .drawer-body { padding: 16px 16px 60px; }
  .act { grid-template-columns: 6px 1fr; } .act > :last-child { grid-column: 2; justify-self: start; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr 1fr; } .kpi .v { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* inline SVG-иконки UI (вместо эмодзи) */
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }
h1 .ic, h2 .ic { width: 1.15em; height: 1.15em; }
#nav a .ic { margin-right: 2px; }
/* просмотр извлечённого текста документа */
details > pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; margin-top: 8px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
