/* HoReCa Hunter CRM — тёмная тема KATYSHEV, mobile-first */
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("/static/fonts/manrope-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("/static/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #000000;
  --panel: #0A1730;
  --panel-2: #0E1E3D;
  --accent: #2F7DFF;
  --accent-soft: rgba(47, 125, 255, 0.14);
  --text: #FFFFFF;
  --text-2: #A9B8D0;
  --caption: #6B7C99;
  --line: #17233D;
  --ok: #3DD68C;
  --warn: #F5B544;
  --danger: #FF5C6C;
  --radius: 14px;
  --font: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--caption); margin-bottom: 12px; }
p { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: -9999px; }

/* шапка */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 16px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
.topnav { display: none; gap: 4px; }
.topnav a { color: var(--text-2); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.topnav a.on { color: var(--text); background: var(--panel); }
.logout { margin-left: auto; position: relative; }
.logout summary { list-style: none; }
.logout summary::-webkit-details-marker { display: none; }
.logout-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; display: grid; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
.btn-danger.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }

/* нижние вкладки (телефон) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(5, 10, 22, 0.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; color: var(--caption); font-size: 11px; font-weight: 600; border-radius: 10px; }
.tabbar a.on { color: var(--text); }
.tabbar a.on svg { stroke: var(--accent); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.page { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; }
.page-wide { max-width: none; }
.page-head { margin-bottom: 16px; }
.page-head p { margin-top: 4px; }

/* кнопки */
button, .btn-primary, .btn-ghost, .btn-danger, .btn-accent {
  font: inherit; font-weight: 700; font-size: 14px; border-radius: 12px; cursor: pointer;
  min-height: 44px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: 1px solid transparent; text-align: center; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
button:active, .btn-primary:active, .btn-ghost:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4A8EFF; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: #2A3A5C; background: var(--panel-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 92, 108, 0.35); }
.btn-accent { background: var(--accent-soft); color: #8DB6FF; border-color: rgba(47, 125, 255, 0.35); }
.small.btn-ghost, button.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* поля */
input, select, textarea {
  font: inherit; color: var(--text); background: #050C1C; border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; width: 100%; min-height: 44px; font-size: 16px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.field { display: grid; gap: 6px; margin: 18px 0; }
.field span { color: var(--text-2); font-size: 13px; font-weight: 600; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; margin-bottom: 10px; }
.row select { flex: 1; }

/* вход */
.page-login { display: grid; place-items: center; min-height: calc(100vh - 140px); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; }
.login-card h1 { margin: 6px 0 6px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.alert { background: rgba(255, 92, 108, 0.1); border: 1px solid rgba(255, 92, 108, 0.35); color: #FFB3BB; padding: 10px 12px; border-radius: 12px; margin: 12px 0; font-size: 14px; }
.flash { background: rgba(61, 214, 140, 0.1); border: 1px solid rgba(61, 214, 140, 0.3); color: #9FF0C6; padding: 10px 12px; border-radius: 12px; margin: 12px 0; font-size: 14px; }

/* пауза отправки */
.pause-banner { display: grid; gap: 12px; background: rgba(245, 181, 68, 0.08); border: 1px solid rgba(245, 181, 68, 0.4); border-radius: 16px; padding: 14px 16px; margin-bottom: 18px; }
.pause-banner strong { color: var(--warn); font-size: 16px; }
.pause-banner p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.pause-banner .btn-primary { width: 100%; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; }
.kpi b { display: block; font-size: 22px; font-weight: 800; }
.kpi b small { font-size: 13px; color: var(--caption); font-weight: 600; }
.kpi span { color: var(--caption); font-size: 12px; }

/* карточки */
.block { margin-bottom: 28px; }
.count { display: inline-block; min-width: 22px; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); font-size: 12px; text-align: center; letter-spacing: 0; vertical-align: middle; }
.count.danger { background: rgba(255, 92, 108, 0.15); color: var(--danger); }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; color: var(--text); }
.card:hover { border-color: #24365A; }
.card.compact { padding: 12px 14px; }
.card-reply { border-left: 3px solid var(--accent); }
.card-failed { border-left: 3px solid var(--danger); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-top strong { font-size: 16px; font-weight: 700; line-height: 1.3; }
.card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; align-items: center; }
.subject { color: var(--text); font-weight: 600; margin-top: 8px; font-size: 14px; }
.snippet { color: var(--text-2); margin-top: 6px; font-size: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--caption); font-size: 13px; }
.empty-line { color: var(--caption); padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; text-align: center; }
.error-text { color: #FF9AA5; font-size: 13px; margin-top: 8px; }
.tag { color: var(--warn); font-size: 13px; font-weight: 700; align-self: center; }

/* пилюли статусов */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.pill.s-replied, .pill.s-interested, .pill.s-call_booked { background: var(--accent-soft); color: #8DB6FF; }
.pill.s-opened, .pill.s-custom_kp { background: rgba(245, 181, 68, 0.14); color: var(--warn); }
.pill.s-won { background: rgba(61, 214, 140, 0.14); color: var(--ok); }
.pill.s-do_not_contact, .pill.s-rejected, .pill.s-lost { background: rgba(255, 92, 108, 0.12); color: #FF9AA5; }
.score { display: inline-grid; place-items: center; min-width: 32px; height: 26px; padding: 0 7px; border-radius: 8px; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.score.hot { background: var(--accent); color: #fff; }
.score.warm { background: var(--accent-soft); color: #8DB6FF; }
.score.cold { background: var(--panel-2); color: var(--caption); }
.chan { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--caption); }
.chan.c-email { color: #8DB6FF; }
.chan.c-telegram { color: #5EC8FF; }
.chan.c-whatsapp { color: #3DD68C; }

/* фильтры и канбан */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.stage-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.stage { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 12px; font-weight: 600; }
.stage b { color: var(--text-2); font-weight: 800; }
.stage-empty { opacity: 0.45; }
.kanban { scroll-padding: 0 16px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; -webkit-overflow-scrolling: touch; }
.col { flex: 0 0 82%; max-width: 320px; scroll-snap-align: start; background: #050C1C; border: 1px solid var(--line); border-radius: 16px; padding: 12px; align-self: flex-start; }
.col header { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.col header .count { margin-left: auto; }
.col-empty { opacity: 0.6; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--caption); }
.dot.s-qualified, .dot.s-draft_ready, .dot.s-contacted { background: var(--text-2); }
.dot.s-opened, .dot.s-custom_kp { background: var(--warn); }
.dot.s-replied, .dot.s-interested, .dot.s-call_booked { background: var(--accent); }
.dot.s-won { background: var(--ok); }
.dot.s-rejected, .dot.s-lost, .dot.s-do_not_contact { background: var(--danger); }
.kcard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; color: var(--text); }
.kcard strong { font-size: 14px; }
.kcard .meta { display: block; margin-top: 4px; font-size: 12px; }
.col .empty-line { padding: 10px; font-size: 13px; }

/* карточка лида */
.backlink { color: var(--text-2); font-size: 14px; display: inline-block; margin-bottom: 12px; }
.lead-head { margin-bottom: 14px; }
.lead-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lead-title h1 { font-size: 26px; line-height: 1.15; }
.lead-title .score { height: 32px; min-width: 40px; font-size: 15px; }
.lead-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel.empty { text-align: center; }
.panel.empty p { margin-top: 10px; }
.addr { color: var(--text-2); font-size: 14px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #050C1C; color: var(--text); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.chip.muted { color: var(--text-2); font-weight: 500; min-height: 28px; padding: 4px 10px; font-size: 12px; }
.kp-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; align-items: center; }
.kp-row .label { grid-column: span 2; }
.kp-input { min-height: 34px; padding: 6px 10px; font-size: 13px; color: var(--text-2); }
.label { display: block; color: var(--caption); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.facts { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.facts li { position: relative; padding-left: 18px; color: var(--text); font-size: 14px; }
.facts li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }

/* лента */
.feed { margin: 22px 0; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 92%; border-radius: 18px; padding: 12px 14px 10px; position: relative; }
.bubble.out { align-self: flex-end; background: #0F2A5C; border: 1px solid #1A3C7A; border-bottom-right-radius: 6px; }
.bubble.in { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.st-draft { background: #07142C; border: 1px dashed var(--accent); }
.bubble.st-approved { border-color: var(--warn); }
.bubble.st-failed { border-color: var(--danger); }
.bubble-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.bubble .state { color: var(--caption); font-size: 11px; font-weight: 700; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; margin-top: 4px; }
.bubble .subject { margin-top: 2px; }
.when { display: block; text-align: right; color: var(--caption); font-size: 11px; margin-top: 6px; }
.sys { align-self: center; color: var(--caption); font-size: 12px; background: #050C1C; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.sys.ev-kp_open { color: var(--warn); }
.sys.ev-unsubscribe, .sys.ev-bounce { color: #FF9AA5; }
.note { align-self: stretch; background: rgba(245, 181, 68, 0.06); border: 1px solid rgba(245, 181, 68, 0.2); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.note .label { color: var(--warn); margin-bottom: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.actions form { margin: 0; }
.actions .btn-primary { flex: 1 1 100%; }
.edit { flex: 1 1 100%; }
.edit summary { list-style: none; width: auto; display: inline-flex; }
.edit summary::-webkit-details-marker { display: none; }
.edit[open] summary { margin-bottom: 10px; border-color: var(--accent); }
.edit:not([open]) { flex: 0 0 auto; }

/* статистика */
.funnel-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step-line { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.step-line span { flex: 1; color: var(--text-2); }
.step-line b { font-size: 16px; }
.step-line em { font-style: normal; color: var(--accent); font-size: 13px; font-weight: 700; min-width: 44px; text-align: right; }
.bar { height: 8px; background: #050C1C; border-radius: 6px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-2); font-size: 12px; margin-bottom: 12px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.sent, .bars .sent { background: var(--accent); }
.lg.opened, .bars .opened { background: var(--warn); }
.lg.replied, .bars .replied { background: var(--ok); }
.daily { display: grid; gap: 8px; }
.day { display: grid; grid-template-columns: 44px 1fr 64px; gap: 8px; align-items: center; font-size: 12px; }
.day .d { color: var(--caption); }
.day .n { color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 2px; }
.bars i { display: block; height: 4px; border-radius: 2px; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .page { padding-top: 32px; }
  .filters { grid-template-columns: 200px 200px 140px auto; justify-content: start; }
  .col { flex: 0 0 280px; }
  .actions .btn-primary { flex: 0 0 auto; }
}

/* ширины полос статистики: w0…w100 (без inline style из-за CSP) */
.w0 { width: 0%; }
.w1 { width: 1%; }
.w2 { width: 2%; }
.w3 { width: 3%; }
.w4 { width: 4%; }
.w5 { width: 5%; }
.w6 { width: 6%; }
.w7 { width: 7%; }
.w8 { width: 8%; }
.w9 { width: 9%; }
.w10 { width: 10%; }
.w11 { width: 11%; }
.w12 { width: 12%; }
.w13 { width: 13%; }
.w14 { width: 14%; }
.w15 { width: 15%; }
.w16 { width: 16%; }
.w17 { width: 17%; }
.w18 { width: 18%; }
.w19 { width: 19%; }
.w20 { width: 20%; }
.w21 { width: 21%; }
.w22 { width: 22%; }
.w23 { width: 23%; }
.w24 { width: 24%; }
.w25 { width: 25%; }
.w26 { width: 26%; }
.w27 { width: 27%; }
.w28 { width: 28%; }
.w29 { width: 29%; }
.w30 { width: 30%; }
.w31 { width: 31%; }
.w32 { width: 32%; }
.w33 { width: 33%; }
.w34 { width: 34%; }
.w35 { width: 35%; }
.w36 { width: 36%; }
.w37 { width: 37%; }
.w38 { width: 38%; }
.w39 { width: 39%; }
.w40 { width: 40%; }
.w41 { width: 41%; }
.w42 { width: 42%; }
.w43 { width: 43%; }
.w44 { width: 44%; }
.w45 { width: 45%; }
.w46 { width: 46%; }
.w47 { width: 47%; }
.w48 { width: 48%; }
.w49 { width: 49%; }
.w50 { width: 50%; }
.w51 { width: 51%; }
.w52 { width: 52%; }
.w53 { width: 53%; }
.w54 { width: 54%; }
.w55 { width: 55%; }
.w56 { width: 56%; }
.w57 { width: 57%; }
.w58 { width: 58%; }
.w59 { width: 59%; }
.w60 { width: 60%; }
.w61 { width: 61%; }
.w62 { width: 62%; }
.w63 { width: 63%; }
.w64 { width: 64%; }
.w65 { width: 65%; }
.w66 { width: 66%; }
.w67 { width: 67%; }
.w68 { width: 68%; }
.w69 { width: 69%; }
.w70 { width: 70%; }
.w71 { width: 71%; }
.w72 { width: 72%; }
.w73 { width: 73%; }
.w74 { width: 74%; }
.w75 { width: 75%; }
.w76 { width: 76%; }
.w77 { width: 77%; }
.w78 { width: 78%; }
.w79 { width: 79%; }
.w80 { width: 80%; }
.w81 { width: 81%; }
.w82 { width: 82%; }
.w83 { width: 83%; }
.w84 { width: 84%; }
.w85 { width: 85%; }
.w86 { width: 86%; }
.w87 { width: 87%; }
.w88 { width: 88%; }
.w89 { width: 89%; }
.w90 { width: 90%; }
.w91 { width: 91%; }
.w92 { width: 92%; }
.w93 { width: 93%; }
.w94 { width: 94%; }
.w95 { width: 95%; }
.w96 { width: 96%; }
.w97 { width: 97%; }
.w98 { width: 98%; }
.w99 { width: 99%; }
.w100 { width: 100%; }
