/* Дизайн-система: темна «хмарна консоль» — графітовий фон, картки з тонкою рамкою, червоно-помаранчевий акцент,
   жирні заголовки, сірі «таблетки»-мітки, вибране — помаранчевою рамкою. Inter, tnum для цифр. */
:root {
  --primary: #ee5a24;
  --primary-deep: #d9481a;
  --primary-press: #b83a12;
  --primary-soft: #ff7a45;
  --primary-tint: rgba(238, 90, 36, .14);
  --primary-subdued: #f4a582;
  --primary-ring: rgba(238, 90, 36, .28);
  --navy: #18181b;      /* бокове меню */
  --navy-2: #2c2c31;
  --ink: #f4f4f5;
  --ink-2: #d4d4d8;
  --mute: #a1a1aa;
  --canvas: #26262a;     /* картки */
  --canvas-soft: #1c1c1f; /* сторінка, «втоплені» ділянки */
  --raised: #303035;      /* ховер, мітки */
  --hairline: #36363c;
  --hairline-input: #4a4a52;
  --ruby: #e5484d;
  --chart-muted: #52525b;

  /* семантика продуктового UI */
  --ok: #4ade80;      --ok-bg: rgba(74, 222, 128, .12);
  --warn: #fbbf24;    --warn-bg: rgba(251, 191, 36, .12);
  --err: #f87171;     --err-bg: rgba(248, 113, 113, .12);
  --info: #ff7a45;    --info-bg: rgba(238, 90, 36, .14);
  --lead: #facc15;    --lead-bg: rgba(250, 204, 21, .12);  --lead-dot: #facc15;

  --r-xs: 4px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 9999px;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 12px 32px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --sidebar-w: 248px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas-soft); color: var(--ink);
  font: 400 15px/1.45 "Inter", "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased;
}
b, strong { font-weight: 600; }
a { color: var(--primary-soft); text-decoration: none; }
a:hover { color: var(--primary); }
code { font: 400 12.5px ui-monospace, "SF Mono", Consolas, monospace; background: var(--canvas-soft); border: 1px solid var(--hairline); padding: 1px 6px; border-radius: var(--r-xs); color: var(--ink-2); }
[hidden] { display: none !important; }
.ico { flex: none; display: block; }
.num, .tnum, td, .kpi-value { font-feature-settings: "tnum"; }
.num { text-align: right; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- каркас ------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--navy); color: var(--ink-2); display: flex; flex-direction: column; padding: 18px 12px 12px;
  border-right: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-deep)); color: #fff; box-shadow: 0 4px 14px rgba(238, 90, 36, .4); }
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 16px; letter-spacing: -.2px; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: 11px; color: #8b8b93; letter-spacing: .2px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #8b8b93; padding: 18px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background .12s, color .12s; }
.nav-item .ico { opacity: .75; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.active { background: var(--raised); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.nav-item.active .ico { opacity: 1; color: var(--primary-soft); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 6px 4px; border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 8px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; color: #fff; min-width: 0; }
.me:hover { color: #fff; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy-2); border: 1px solid rgba(255, 255, 255, .15); font-weight: 500; font-size: 13px; }
.me-text { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 400; line-height: 1.2; overflow: hidden; }
.me-text small { color: #8b8b93; font-size: 11.5px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-md); border: 0; background: transparent; color: inherit; cursor: pointer; }
.sidebar .icon-btn { color: var(--mute); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 68px;
  padding: 12px 32px; background: rgba(28, 28, 31, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--hairline); }
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--mute); font-weight: 400; margin-bottom: 2px; }
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--primary); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; color: var(--ink); }
.content { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }
/* старі сторінки: заголовок уже в topbar */
.content > h1, .content > .row-between > h1 { display: none; }
.content > .row-between { justify-content: flex-end; margin-bottom: 16px; }
.scrim { display: none; }

/* --- типографіка секцій --------------------------------------------------- */
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.25px; margin: 0; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--mute); }
.lede { color: var(--mute); margin: 4px 0 0; font-size: 14px; }

/* --- картки ------------------------------------------------------------- */
.card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 24px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.card-head .lede { margin: 2px 0 0; }
.card-head .spacer { flex: 1; }
.card-body { padding: 24px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--hairline); background: var(--canvas-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pad { padding: 16px 24px 0; }
.grid { display: grid; gap: 20px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-lg > .card { margin-bottom: 0; }
.mb { margin-bottom: 20px; }

/* --- KPI ---------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.kpi { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); font-weight: 400; }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.8px; line-height: 1.05; color: var(--ink); }
.kpi-sub { font-size: 12.5px; color: var(--mute); }
.kpi.accent { background: linear-gradient(160deg, #3a2018, var(--canvas) 70%); border-color: rgba(238, 90, 36, .55); color: #fff; box-shadow: var(--sh-2); }
.kpi.accent .kpi-label, .kpi.accent .kpi-sub { color: #f4b89f; }
.kpi.accent .kpi-value { color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.lead { background: var(--lead-dot); }
.dot.ok { background: #2fb36f; }
.dot.primary { background: var(--primary); }
.dot.mute { background: #71717a; }
.dot.live { background: #2fb36f; box-shadow: 0 0 0 0 rgba(47, 179, 111, .5); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(47, 179, 111, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 179, 111, 0); } }
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

/* --- кнопки ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; min-height: 36px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline-input); background: var(--canvas); color: var(--ink);
  font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.btn:hover { border-color: var(--primary); color: var(--primary-soft); }
.btn.primary { background: linear-gradient(180deg, #f46a33, var(--primary-deep)); border-color: var(--primary-deep); color: #fff;
  box-shadow: 0 4px 14px rgba(238, 90, 36, .28), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn.primary:hover { background: linear-gradient(180deg, #ff7a45, var(--primary)); border-color: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-press); }
.btn.dark { background: var(--raised); border-color: var(--hairline-input); color: #fff; }
.btn.dark:hover { background: #3a3a40; color: #fff; }
.btn.danger { color: var(--err); border-color: rgba(248, 113, 113, .4); }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--mute); }
.btn.ghost:hover { background: var(--raised); color: var(--ink); }
.btn.lg { min-height: 46px; padding: 12px 24px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 30px; padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: 2px; }
button.link { background: none; border: 0; padding: 0; color: var(--primary-soft); cursor: pointer; font: inherit; font-weight: 500; }
button.link.danger { color: var(--err); }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- форми -------------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.chk, label.radio, .check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; color: var(--ink); cursor: pointer; }
label.big { font-size: 15px; }
.inline-label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea {
  font: 400 14.5px/1.4 inherit; font-family: inherit; color: var(--ink); background: var(--canvas-soft);
  border: 1px solid var(--hairline-input); border-radius: var(--r-sm); padding: 8px 12px; min-height: 38px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input::placeholder, textarea::placeholder { color: #71717a; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--primary); flex: none; }
input[type=file] { padding: 6px; }
input[type=time] { width: auto; }
textarea { resize: vertical; min-height: 96px; }
.small-input { width: 150px; min-height: 30px; padding: 4px 8px; }
.field-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field-row > label { flex: 1; min-width: 160px; }
.help { font-size: 12.5px; color: var(--mute); font-weight: 400; margin: 0; }
fieldset { border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
legend { font-weight: 500; font-size: 13px; padding: 0 6px; }
.days { display: flex; gap: 14px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; margin-bottom: 20px; }
.cols > .card { margin-bottom: 0; }
.narrow { max-width: 520px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* --- повідомлення ------------------------------------------------------- */
/* звичайний текстовий блок, а не flex: інакше <b> і посилання всередині розлітались окремими колонками */
.flash, .banner { display: block; padding: 11px 16px; border-radius: var(--r-md); margin-bottom: 16px;
  font-size: 14px; font-weight: 400; border: 1px solid transparent; line-height: 1.5; }
.flash > .ico, .banner > .ico { display: inline-block; vertical-align: -3px; margin-right: 8px; }
.flash { background: var(--ok-bg); color: var(--ok); border-color: rgba(74, 222, 128, .3); }
.flash.error, .banner.error { background: var(--err-bg); color: var(--err); border-color: rgba(248, 113, 113, .35); }
.flash.warn, .banner.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(251, 191, 36, .35); }
.banner.info { background: var(--primary-tint); color: var(--primary-soft); border-color: rgba(238, 90, 36, .35); }
.warn-card { border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .05); }

/* --- таблиці ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--mute);
  padding: 10px 16px; background: var(--canvas-soft); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; letter-spacing: -.1px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .03); }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
tr.lead-row td { background: rgba(250, 204, 21, .07); }
tr.lead-row:hover td { background: rgba(250, 204, 21, .12); }
tr.json-row td { padding-top: 0; }
.cell-main { display: flex; flex-direction: column; gap: 1px; }
.cell-main b { font-weight: 500; color: var(--ink); }
.cell-main small { color: var(--mute); font-size: 12.5px; }
.phone { font-weight: 500; color: var(--ink); letter-spacing: -.2px; }
a.phone:hover { color: var(--primary); }
audio { height: 32px; width: 230px; max-width: 100%; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--hairline); }
.filters input, .filters select { width: auto; min-width: 150px; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 14px; font-size: 14px; color: var(--mute); }
.empty-state { text-align: center; padding: 40px 24px; color: var(--mute); }
.empty-state .ico { margin: 0 auto 10px; color: #71717a; }
.empty-state b { display: block; color: var(--ink); font-weight: 500; font-size: 15px; margin-bottom: 4px; }

/* --- бейджі ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  background: var(--raised); color: var(--ink-2); white-space: nowrap; line-height: 1.3; border: 1px solid var(--hairline-input); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { display: none; }
.s-lead { background: var(--lead-bg); color: var(--lead); }
.s-answered, .s-calling, .st-running { background: var(--primary-tint); color: var(--primary-soft); border-color: rgba(238, 90, 36, .3); }
.st-running { background: var(--ok-bg); color: var(--ok); border-color: rgba(74, 222, 128, .3); }
.s-no_answer, .s-busy, .s-queued, .st-paused, .st-draft, .st-finished { background: var(--raised); color: var(--mute); }
.s-failed, .s-refused, .st-stopped { background: var(--err-bg); color: var(--err); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--primary-tint); color: var(--primary-soft); }
.s-lead, .s-failed, .s-refused, .st-stopped, .badge.ok, .badge.warn { border-color: transparent; }

/* --- прогрес ------------------------------------------------------------ */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--raised); overflow: hidden; margin: 12px 0 8px; }
.progress > div { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--primary-soft), var(--primary)); transition: width .5s ease; }
.mini-progress { height: 4px; border-radius: var(--r-pill); background: var(--raised); overflow: hidden; width: 120px; }
.mini-progress > span { display: block; height: 100%; background: var(--primary); }

/* --- статистика кампанії -------------------------------------------------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden; margin-top: 16px; }
.metric { padding: 14px 16px; border-right: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 2px; }
.metric:last-child { border-right: 0; }
.metric b { font-size: 24px; font-weight: 700; letter-spacing: -.5px; font-feature-settings: "tnum"; }
.metric span { font-size: 12.5px; color: var(--mute); }
.metric.lead { background: rgba(250, 204, 21, .07); }
.metric.lead b { color: var(--lead); }

/* --- чек-лист налаштування ----------------------------------------------- */
.setup { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.setup-step { display: flex; gap: 12px; padding: 18px 20px; border-right: 1px solid var(--hairline); color: var(--ink); }
.setup-step:last-child { border-right: 0; }
.setup-step:hover { background: var(--canvas-soft); color: var(--ink); }
.step-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--hairline-input); font-size: 12px; font-weight: 500; color: var(--mute); flex: none; }
.setup-step.done .step-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-step b { display: block; font-weight: 500; font-size: 14px; }
.setup-step small { color: var(--mute); font-size: 12.5px; }

/* --- списки (ліди, статуси) ------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--hairline); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.status-row { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--hairline); }
.status-row:last-child { border-bottom: 0; }
.status-row .grow { flex: 1; }
.status-row b { font-weight: 500; display: block; }
.status-row small { color: var(--mute); font-size: 12.5px; }
.chart-box { position: relative; height: 260px; }

/* --- запис креативу -------------------------------------------------------- */
.recorder { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.rec-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center;
  cursor: pointer; flex: none; box-shadow: 0 6px 18px rgba(238, 90, 36, .35); transition: transform .12s, background .12s; }
.rec-btn:hover { background: var(--primary-deep); transform: scale(1.04); }
.rec-btn.recording { background: var(--ruby); box-shadow: 0 6px 18px rgba(234, 34, 97, .35); animation: rec 1.4s infinite; }
@keyframes rec { 50% { box-shadow: 0 0 0 10px rgba(234, 34, 97, .12), 0 6px 18px rgba(234, 34, 97, .35); } }
@media (prefers-reduced-motion: reduce) { .rec-btn.recording { animation: none; } }
.rec-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 200px; }
.rec-text b { font-size: 15px; }
.rec-timer { font: 400 20px ui-monospace, "SF Mono", Consolas, monospace; color: var(--ruby); font-feature-settings: "tnum"; }
.audio-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-md); background: var(--canvas-soft); border: 1px solid var(--hairline); margin-top: 16px; }
.audio-row audio { flex: 1; min-width: 220px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 10px 0; font-size: 14px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; flex: none; box-shadow: 0 0 0 4px var(--primary-tint); }

/* --- завантаження файлу -------------------------------------------------- */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 30px 20px;
  border: 1.5px dashed var(--hairline-input); border-radius: var(--r-lg); background: var(--canvas-soft); cursor: pointer; transition: border-color .12s, background .12s; font-weight: 400; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-tint); }
.drop.has-file { border-style: solid; border-color: var(--primary); background: var(--primary-tint); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--canvas); border: 1px solid var(--hairline); color: var(--primary); box-shadow: var(--sh-1); margin-bottom: 4px; }
.drop b { font-weight: 500; color: var(--ink); font-size: 14.5px; }
.drop span { color: var(--mute); font-size: 12.5px; }
details > summary { cursor: pointer; color: var(--primary-soft); font-size: 14px; font-weight: 500; }

/* --- вибір бази (запуск) --------------------------------------------------- */
.pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  cursor: pointer; font-weight: 400; color: var(--ink); transition: border-color .12s, box-shadow .12s, background .12s; }
.pick:hover { border-color: var(--hairline-input); }
.pick:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 0 5px var(--primary-ring); background: rgba(238, 90, 36, .06); }
.pick .grow { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pick b { font-weight: 500; font-size: 14.5px; }
.pick small { color: var(--mute); font-size: 12.5px; }
.pick .left { text-align: right; font-size: 12.5px; color: var(--mute); }
.pick .left b { display: block; font-size: 18px; font-weight: 700; color: var(--ink); font-feature-settings: "tnum"; }
.summary { position: sticky; top: 92px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0 0 20px; font-size: 14px; }
.summary dt { color: var(--mute); }
.summary dd { margin: 0; text-align: right; font-weight: 500; font-feature-settings: "tnum"; }
.big-input { font-size: 26px; font-weight: 600; letter-spacing: -.4px; padding: 10px 14px; min-height: 52px; max-width: 220px; font-feature-settings: "tnum"; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* --- старі допоміжні --------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; color: var(--ink); box-shadow: var(--sh-1); }
a.tile:hover { border-color: var(--primary); color: var(--ink); }
.tile span { color: var(--mute); font-size: 12.5px; }
.tile b { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-feature-settings: "tnum"; }
.tile small { color: var(--mute); font-size: 12px; }
.tile.accent b, .tile.s-lead b { color: var(--lead); }
.small-tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 14px 0 0; }
.small-tiles .tile { padding: 10px 12px; box-shadow: none; }
.small-tiles .tile b { font-size: 20px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 14px; font-size: 14px; }
dl.kv dt { color: var(--mute); }
dl.kv dd { margin: 0; }
ul.plain { margin: 0; padding-left: 18px; }
pre.json { font: 12px/1.45 ui-monospace, Consolas, monospace; background: var(--canvas-soft); border: 1px solid var(--hairline); padding: 12px; border-radius: var(--r-md); overflow: auto; max-height: 420px; margin: 8px 0 0; }
.danger-zone .inline { margin-right: 8px; }
.danger-zone summary { margin-bottom: 12px; }

/* --- вхід ------------------------------------------------------------------ */
.public { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--canvas-soft); position: relative; overflow: hidden; }
.mesh { position: absolute; inset: -20% -10% auto -10%; height: 70%; filter: blur(80px); opacity: .55; z-index: 0; pointer-events: none; }
.auth { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font-weight: 700; font-size: 18px; color: var(--ink); }
.auth-brand .brand-mark { width: 38px; height: 38px; }
.auth .card { padding: 32px; box-shadow: var(--sh-2); }
.auth h1 { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin: 0 0 4px; }
.auth .lede { margin-bottom: 22px; }
.auth-foot { text-align: center; color: var(--mute); font-size: 12.5px; margin-top: 18px; }

/* --- адаптив -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .setup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-step:nth-child(2) { border-right: 0; }
  .setup-step:nth-child(-n+2) { border-bottom: 1px solid var(--hairline); }
  .summary { position: static; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--sh-2); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 25; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; min-height: 60px; }
  .topbar h1 { font-size: 19px; }
  .content { padding: 18px 16px 48px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--hairline); }
  .card-head, .card-body { padding-left: 18px; padding-right: 18px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .list li, .status-row { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .setup { grid-template-columns: 1fr; }
  .setup-step { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .topbar-actions .btn span { display: none; }
}

/* таблиця баз */
.bases-table td:first-child { min-width: 220px; }
.bases-table .actions { flex-wrap: nowrap; justify-content: flex-end; }

.pick.picked { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 0 0 5px var(--primary-ring); background: rgba(238, 90, 36, .06); }
button.pick { font: inherit; font-weight: 400; }

/* багатоканальні лінії */
tr.line-extra td { background: var(--canvas-soft); padding-top: 14px; padding-bottom: 16px; }
tr.line-extra:hover td { background: var(--canvas-soft); }
.line-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.slider-label { flex-direction: row; gap: 6px; align-items: baseline; }
.slider-label output { font-size: 20px; font-weight: 700; color: var(--primary-soft); font-feature-settings: "tnum"; min-width: 36px; }
.slider-row { display: flex; gap: 10px; align-items: center; margin: 6px 0; }
.slider { flex: 1; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--primary); height: 24px; }
.slider:focus { box-shadow: none; }
@media (max-width: 900px) { .line-tools { grid-template-columns: 1fr; } }

/* --- меню «Ще» --- */
.nav-more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: "›"; font-size: 13px; transition: transform .2s; }
.nav-more[open] > summary::after { transform: rotate(90deg); }

/* --- рух --- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes glow { 0% { background: rgba(250, 204, 21, .2); } 100% { background: transparent; } }
.content > *, .kpis > .kpi, .grid > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.kpis > .kpi:nth-child(2), .grid > *:nth-child(2) { animation-delay: .05s; }
.kpis > .kpi:nth-child(3) { animation-delay: .1s; }
.kpis > .kpi:nth-child(4) { animation-delay: .15s; }
#live .kpis > .kpi, #live .grid > * { animation: none; }  /* живий блок оновлюється без «стрибків» */
.is-new { animation: glow 2.4s ease-out; }
.kpi, .card, .line-card { transition: box-shadow .2s, transform .2s; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn { transition: background .12s, border-color .12s, color .12s, transform .1s; }
.btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .content > *, .kpis > .kpi, .grid > *, .is-new { animation: none !important; }
  .kpi:hover { transform: none; }
}

/* --- картки ліній --- */
.line-list { display: flex; flex-direction: column; gap: 12px; padding: 16px 24px 20px; }
.line-card { border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 16px 18px; background: var(--canvas); }
.line-card.off { opacity: .6; }
.line-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.line-top .grow { flex: 1; min-width: 160px; }
.line-name { font-weight: 700; font-size: 15px; }
.line-sub { color: var(--mute); font-size: 12.5px; }
.usage { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; }
.usage .progress { flex: 1; margin: 0; height: 6px; }
.usage b { font-feature-settings: "tnum"; font-weight: 500; min-width: 54px; text-align: right; font-size: 13px; }
.line-more { margin-top: 10px; }
.line-more > summary { font-size: 13px; }
.line-more .slider-row { margin-top: 10px; }
.note-warn { color: var(--warn); font-size: 12.5px; margin: 6px 0 0; }
label.btn { flex-direction: row; font-weight: 400; color: var(--ink); }
label.btn:hover { color: var(--primary-soft); }

/* --- деталі «хмарної консолі» --------------------------------------------- */
.card-head h2, .card > h2:first-child { font-weight: 700; }
.setup-step.done .step-mark { box-shadow: 0 0 0 4px var(--ok-bg); }
.kpi:hover, a.tile:hover, .line-card:hover { border-color: #46464d; }
.line-card { background: var(--canvas-soft); }
::selection { background: rgba(238, 90, 36, .35); color: #fff; }
* { scrollbar-color: #46464d transparent; }
