/* Sellbyte — дизайн-система адмінки.
   Світле тепле тло, темний сайдбар, лаймовий акцент, пастельні плитки, великі радіуси. */

:root {
  --bg: #f3f3ee;
  --surface: #ffffff;
  --surface-2: #f8f8f4;
  --ink: #1c1b29;
  --ink-2: #4a4b5c;
  --muted: #8a8b9a;
  --line: #e8e8e1;
  --line-2: #dcdcd3;

  --sidebar: #1d1c2b;
  --sidebar-2: #272637;
  --sidebar-ink: #c9c9d6;

  --lime: #bdf04a;
  --lime-2: #8fd52a;
  --lime-soft: #eefad5;
  --lime-grad: linear-gradient(135deg, #c6f550 0%, #7ccb1e 100%);

  --peach: #ffe7da;   --peach-ink: #d9683c;
  --lav: #e9e6ff;     --lav-ink: #6355e6;
  --mint: #dcf5e8;    --mint-ink: #178a56;
  --sky: #dfeeff;     --sky-ink: #2c74d6;
  --rose: #ffe2e5;    --rose-ink: #d23c50;
  --amber: #fff1cf;   --amber-ink: #a86d0c;
  --grey: #ececea;    --grey-ink: #6b6c7a;

  --r-xl: 24px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 27, 41, .04), 0 10px 30px -12px rgba(28, 27, 41, .10);
  --shadow-lg: 0 24px 60px -20px rgba(28, 27, 41, .30);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 500 14.5px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, svg { display: block; }
::selection { background: var(--lime); color: var(--ink); }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 16px;
}
.sidebar-inner {
  height: 100%;
  background: var(--sidebar);
  border-radius: var(--r-xl);
  padding: 22px 14px 14px;
  display: flex; flex-direction: column; gap: 6px;
  color: var(--sidebar-ink);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; color: #fff; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.brand-name b { background: var(--lime-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }

.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6f6e83; padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--sidebar-2); color: #fff; }
.nav-link.active { background: var(--lime); color: var(--sidebar); }
.nav-link .count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 99px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: var(--peach); color: var(--peach-ink);
}
.nav-link .count.calm { background: var(--sidebar-2); color: var(--sidebar-ink); }
.nav-link.active .count { background: var(--sidebar); color: var(--lime); }

.sidebar-status {
  margin-top: auto;
  background: var(--lime); color: var(--sidebar);
  border-radius: 20px; padding: 16px;
  position: relative; overflow: hidden;
}
.sidebar-status.dry { background: #f3d58a; }
.sidebar-status .mode { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.sidebar-status .mode i { width: 8px; height: 8px; border-radius: 99px; background: var(--sidebar); display: inline-block; animation: pulse 1.8s infinite; }
.sidebar-status .big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 0; }
.sidebar-status small { font-weight: 600; opacity: .75; }
.sidebar-status a { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 99px; background: var(--sidebar); color: var(--lime); display: grid; place-items: center; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

.logout { margin-top: 8px; }
.logout button { width: 100%; background: transparent; color: #8d8ca2; border: 0; justify-content: flex-start; }
.logout button:hover { background: var(--sidebar-2); color: #fff; }

.main { min-width: 0; padding: 26px 32px 64px 16px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.topbar h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.topbar .sub { color: var(--muted); font-weight: 600; margin-top: 4px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 99px; padding: 0 16px; height: 46px;
  width: 300px; box-shadow: var(--shadow);
  color: var(--muted);
}
.search input { border: 0; outline: 0; background: transparent; padding: 0; height: 100%; width: 100%; font: inherit; color: var(--ink); box-shadow: none; }
.avatar-me {
  width: 46px; height: 46px; border-radius: 99px; background: var(--sidebar); color: var(--lime);
  display: grid; place-items: center; font-weight: 800;
}
.burger { display: none; }

/* ---------- типографіка ---------- */
h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h3 { font-size: 15px; font-weight: 800; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 800; }
.ok { color: var(--mint-ink); } .bad { color: var(--rose-ink); } .warn { color: var(--amber-ink); }

/* ---------- сітки ---------- */
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.svc-foot { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.svc-foot b { color: var(--ink); font-weight: 700; }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 20px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 20px; } .mb-s { margin-bottom: 10px; }

/* ---------- картки ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.tight { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head .link { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.card.dark { background: var(--sidebar); color: #fff; }
.card.dark .muted { color: #9998ad; }
.card.lime { background: var(--lime); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-title:first-child { margin-top: 0; }

/* пастельні плитки-іконки */
.tile {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
}
.tile.sm { width: 36px; height: 36px; border-radius: 11px; }
.tile.lg { width: 56px; height: 56px; border-radius: 18px; }
.t-lime { background: var(--lime-soft); color: #6a8a07; }
.t-peach { background: var(--peach); color: var(--peach-ink); }
.t-lav { background: var(--lav); color: var(--lav-ink); }
.t-mint { background: var(--mint); color: var(--mint-ink); }
.t-sky { background: var(--sky); color: var(--sky-ink); }
.t-rose { background: var(--rose); color: var(--rose-ink); }
.t-amber { background: var(--amber); color: var(--amber-ink); }
.t-dark { background: var(--sidebar); color: var(--lime); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 14px; }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-top .tile { width: 40px; height: 40px; border-radius: 12px; }
.kpi-label { color: var(--ink-2); font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi-value small { font-size: 15px; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.trend { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; font-weight: 800; font-size: 12px; }
.trend.up { background: var(--mint); color: var(--mint-ink); }
.trend.down { background: var(--rose); color: var(--rose-ink); }
.trend.flat { background: var(--grey); color: var(--grey-ink); }

/* ---------- кнопки ---------- */
button, .btn {
  font: 700 14px/1 var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 99px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff;
  transition: transform .08s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: #2d2c3f; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: progress; }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: var(--lime-2); }
.btn-ghost, button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn-ghost:hover, button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--rose); color: var(--rose-ink); }
.btn-danger:hover { background: #ffd2d7; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-plus { width: 34px; height: 34px; padding: 0; border-radius: 99px; background: var(--lime); color: var(--ink); }

/* ---------- форми ---------- */
label, .label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 0 0 7px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
input, select, textarea {
  font: 600 14px/1.45 var(--font); color: var(--ink);
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 4px rgba(189, 240, 74, .45); }
textarea { min-height: 96px; resize: vertical; }
textarea.short { min-height: 60px; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231c1b29' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=file] { padding: 9px; }
input[readonly] { background: var(--grey); color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* перемикач */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink); margin: 0; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--lime); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(212, 240, 106, .6); }

/* вибір-картки (чекбокси як плитки) */
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; margin: 0; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--line-2); }
.choice input { margin-top: 3px; accent-color: var(--ink); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--lime-soft); }
.choice b { display: block; font-size: 14px; }
.choice span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- чипи / бейджі ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; background: var(--grey); color: var(--grey-ink); }
.chip.sm { height: 24px; padding: 0 10px; font-size: 12px; }
.chip .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.c-lime { background: var(--lime-soft); color: #5d7a05; }
.c-mint { background: var(--mint); color: var(--mint-ink); }
.c-lav { background: var(--lav); color: var(--lav-ink); }
.c-sky { background: var(--sky); color: var(--sky-ink); }
.c-peach { background: var(--peach); color: var(--peach-ink); }
.c-amber { background: var(--amber); color: var(--amber-ink); }
.c-rose { background: var(--rose); color: var(--rose-ink); }
.c-amber { background: var(--amber); color: var(--amber-ink); }
.c-grey { background: var(--grey); color: var(--grey-ink); }
.c-dark { background: var(--sidebar); color: var(--lime); }

/* таби-пілюлі */
.tabs { display: flex; gap: 6px; flex-wrap: nowrap; background: var(--surface); padding: 6px; border-radius: 99px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 99px; text-decoration: none; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; }
button.tab { background: transparent; color: var(--ink-2); padding: 0 14px; font-size: 13px; height: 34px; }
button.tab:hover { background: var(--surface-2); color: var(--ink); }
button.tab.active, button.tab.active:hover { background: var(--ink); color: #fff; }
.tab .n { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--grey); color: var(--grey-ink); }
.tab.active .n { background: var(--lime); color: var(--ink); }

/* ---------- таблиці / списки ---------- */
.table-wrap { overflow-x: auto; margin-left: -6px; margin-right: -6px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 12px 10px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover td { background: var(--surface-2); }
tr.dim td { opacity: .55; }
td input, td select, td textarea { padding: 8px 11px; border-radius: 11px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-top: 1px solid var(--line); text-decoration: none; }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item .main-line { font-weight: 800; }
.list-item .sub-line { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.list-item:hover .main-line { text-decoration: underline; text-underline-offset: 3px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.avatar { width: 42px; height: 42px; border-radius: 99px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-weight: 600; }
.empty .tile { margin: 0 auto 12px; }

/* ---------- алерти ---------- */
.flash { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-md); font-weight: 700; margin-bottom: 20px; background: var(--mint); color: #11603d; }
.flash.error { background: var(--rose); color: #a2283a; }
.flash.warn { background: var(--amber); color: #7c500a; }
.flash.info { background: var(--sky); color: #1d559f; }
.flash .x { margin-left: auto; cursor: pointer; opacity: .6; }
.error { background: var(--rose); color: #a2283a; padding: 14px 18px; border-radius: var(--r-md); font-weight: 700; margin-bottom: 20px; white-space: pre-wrap; }

pre, .code { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 14px; border-radius: var(--r-md); margin: 0; }
details > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---------- графік ---------- */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: var(--gap, 10px); height: 210px; padding-top: 18px; position: relative; }
.bars .bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; min-height: 0; position: relative; }
.bars .bar-wrap { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bars .x { height: 16px; line-height: 16px; flex: none; font-size: 11.5px; white-space: nowrap; overflow: visible; }
.bars .bar { width: var(--bw, 12px); }
.bars .bar-wrap { gap: var(--bgap, 4px); }
.promo > *:not(.deco) { position: relative; z-index: 1; }
.bars .bar { width: 12px; border-radius: 99px; background: var(--ink); min-height: 4px; position: relative; transition: background .15s; }
.bars .bar.hi { background: var(--lime-2); }
.bars .bar-col:hover .bar { background: var(--lime-2); }
.bars .bar-col .tip { display: none; position: absolute; bottom: calc(100% - 6px); background: var(--sidebar); color: #fff; padding: 7px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; z-index: 2; transform: translateY(-6px); }
.bars .bar-col:hover .tip { display: block; }
.bars .x { font-size: 12px; font-weight: 700; color: var(--muted); }
.bars .stack-bar { display: flex; flex-direction: column-reverse; gap: 3px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 99px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.progress { height: 10px; border-radius: 99px; background: var(--grey); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.progress.lime > i { background: var(--lime-2); }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 60px; align-items: center; gap: 14px; padding: 9px 0; }
.funnel-row .label { margin: 0; }

.ring { --p: 0; width: 56px; height: 56px; border-radius: 99px; background: conic-gradient(var(--lime-2) calc(var(--p) * 1%), var(--grey) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: attr(data-label); width: 44px; height: 44px; border-radius: 99px; background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 800; }

/* ---------- промо-картка (як Go Premium) ---------- */
.promo { position: relative; overflow: hidden; }
.promo h2 { font-size: 24px; color: #fff; }
.promo p { color: #b9b8cc; margin: 8px 0 18px; font-weight: 600; max-width: min(260px, 70%); }
.promo .deco { position: absolute; right: -46px; bottom: -46px; width: 170px; height: 170px; border-radius: 99px; border: 26px solid var(--lime); opacity: .9; }
.promo .stat-line { display: flex; gap: 22px; margin-top: 4px; }
.promo .stat-line b { display: block; font-size: 26px; color: #fff; letter-spacing: -.02em; }
.promo .stat-line span { color: #9998ad; font-size: 12.5px; font-weight: 700; }

/* ---------- месенджер ---------- */
.messenger { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 20px; height: calc(100vh - 140px); min-height: 560px; }
.messenger.two { grid-template-columns: minmax(0, 1fr) 360px; }
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex: none; }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.panel-body.pad { padding: 18px 20px; }

.convo { display: flex; gap: 12px; padding: 13px 16px; text-decoration: none; border-left: 3px solid transparent; }
.convo:hover { background: var(--surface-2); }
.convo.active { background: var(--lime-soft); border-left-color: var(--ink); }
.convo .who { font-weight: 800; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.convo .who .t { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.convo .prev { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 99px; flex: none; display: inline-block; }

.chat-area { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 6px; background:
  radial-gradient(circle at 1px 1px, rgba(28,27,41,.05) 1px, transparent 0) 0 0 / 22px 22px, var(--surface-2); }
.day-sep { align-self: center; margin: 12px 0; font-size: 11.5px; font-weight: 800; color: var(--muted); background: var(--surface); padding: 5px 12px; border-radius: 99px; box-shadow: var(--shadow); }
.bubble-row { display: flex; flex-direction: column; max-width: 76%; position: relative; }
.bubble-row.in { align-self: flex-start; align-items: flex-start; }
.bubble-row.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 11px 15px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; font-weight: 600; line-height: 1.5; box-shadow: 0 1px 1px rgba(28,27,41,.05); }
.bubble-row.in .bubble { background: var(--surface); border-bottom-left-radius: 6px; }
.bubble-row.out .bubble { background: var(--sidebar); color: #f1f1f6; border-bottom-right-radius: 6px; }
.bubble-row.out.op .bubble { background: var(--lav-ink); color: #fff; }
.bubble-row.sys .bubble { background: var(--amber); color: #7c500a; }
.bubble-meta { font-size: 11.5px; color: var(--muted); font-weight: 700; margin: 4px 8px 6px; display: flex; gap: 8px; align-items: center; }
.bubble-meta .who-ai { color: #6a8a07; }
.bubble-meta .who-op { color: var(--lav-ink); }
.coach { position: relative; }
.coach > summary { font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; opacity: 0; transition: opacity .15s; }
.bubble-row:hover .coach > summary, .coach[open] > summary { opacity: 1; }
.coach > summary:hover { color: var(--ink); }
.coach-pop { position: absolute; right: 0; top: 22px; z-index: 20; width: min(420px, 80vw); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 18px; }
.coach-pop h3 { margin-bottom: 4px; }
.coach-pop .field { margin-bottom: 12px; }

.composer { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-end; flex: none; background: var(--surface); }
.composer textarea { min-height: 46px; max-height: 180px; border-radius: 22px; padding: 12px 18px; resize: none; }
.composer .modes { display: flex; gap: 6px; margin-bottom: 8px; }
.new-pill { position: sticky; bottom: 8px; align-self: center; display: none; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; font-weight: 700; text-align: right; word-break: break-word; }
.receipt-line { display: flex; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line-2); font-weight: 700; }
.receipt-line:first-child { border-top: 0; }
.receipt-line .q { color: var(--muted); }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 4px; border-top: 2px solid var(--ink); font-weight: 800; font-size: 18px; }

/* ---------- редактор оффера ---------- */
.editor { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-radius: var(--r-lg); padding: 10px; box-shadow: var(--shadow); }
.toc a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; font-weight: 700; color: var(--ink-2); font-size: 13.5px; }
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.on { background: var(--lime-soft); color: var(--ink); }
.toc .toc-ico { color: var(--muted); }
.form-section { scroll-margin-top: 20px; }
.form-section .card-head .tile { width: 40px; height: 40px; border-radius: 12px; }
.form-section .card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.savebar { position: sticky; bottom: 16px; z-index: 30; margin-top: 24px; display: flex; align-items: center; gap: 12px; background: var(--sidebar); color: #fff; padding: 12px 12px 12px 22px; border-radius: 99px; box-shadow: var(--shadow-lg); }
.savebar .muted { color: #9998ad; }
.repeat-table td { border-top: 0; padding: 6px; vertical-align: top; }
.repeat-table th { padding: 0 6px 6px; }
.upsell-pick { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(150px, 200px) 76px; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface-2); margin-bottom: 10px; }
.upsell-pick:has(input[type=checkbox]:checked) { border-color: var(--ink); background: var(--lime-soft); }
.upsell-pick .pick input { width: 20px; height: 20px; accent-color: var(--ink); }
.upsell-pick textarea { min-height: 44px; grid-column: 2 / -1; }
.upsell-pick .pick input:disabled { opacity: 1; cursor: not-allowed; }

/* ---------- логін ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { margin: 16px; border-radius: var(--r-xl); background: var(--sidebar); color: #fff; padding: 44px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: auto 0 14px; max-width: 460px; }
.auth-art h1 em { font-style: normal; color: var(--lime); }
.auth-art p { color: #b9b8cc; font-weight: 600; max-width: 400px; margin: 0; }
.auth-art .orb { position: absolute; border-radius: 99px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .card { width: 100%; max-width: 400px; padding: 34px; }

/* ---------- адаптив ---------- */
@media (max-width: 1280px) {
  .messenger { grid-template-columns: 260px minmax(0, 1fr); }
  .messenger .details { display: none; }
  .messenger.two { grid-template-columns: minmax(0, 1fr) 320px; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-5 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .g-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-105%); transition: transform .25s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(28,27,41,.35); z-index: 40; }
  .burger { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
  .topbar h1 { font-size: 24px; }
  .search { display: none; }
  .g-2, .g-3, .g-main-side { grid-template-columns: minmax(0, 1fr); }
  .messenger, .messenger.two { grid-template-columns: 1fr; height: auto; }
  .messenger .convos { display: none; }
  .messenger .chat-panel { height: calc(100vh - 120px); }
  .messenger .details { display: flex; }
  .editor { grid-template-columns: 1fr; }
  .toc { display: none; }
  .form-grid, .form-grid.g3 { grid-template-columns: 1fr; }
  .upsell-pick { grid-template-columns: auto 1fr; }
  .upsell-pick > *:nth-child(n+3) { grid-column: 1 / -1; }
  .upsell-pick textarea { grid-column: 1 / -1; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 560px) {
  .g-4, .g-5 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; }
  .bubble-row { max-width: 90%; }
  .savebar { border-radius: var(--r-lg); flex-wrap: wrap; }
}
.min0 { min-width: 0; }
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; }
  .topbar > .min0 { flex: 1; }
  .topbar-actions { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .topbar-actions .avatar-me { display: none; }
  .chat-panel .panel-head .chip { display: none; }
}

/* сегментний вибір (радіо як пілюлі) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 99px; padding: 4px; width: fit-content; max-width: 100%; }
.seg-opt { margin: 0; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 99px; font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg-opt:hover span { color: var(--ink); }
.seg-opt input:checked + span { background: var(--ink); color: #fff; }
.seg-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(189,240,74,.6); }

/* великий редактор тексту в попапі */
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md p, .md ul, .md ol, .md blockquote, .md h4 { margin: 0 0 8px; }
.md > :last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 20px; }
.md li { margin: 2px 0; }
.md h4 { font-size: 15px; }
.md blockquote { border-left: 3px solid var(--line-2); padding-left: 10px; color: var(--ink-2); }
.md code { background: var(--surface-2); border-radius: 6px; padding: 1px 5px; font-size: .92em; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.md .ph { color: var(--ink-2); opacity: .7; }
.md-preview { cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 12px 16px; max-height: 200px; overflow: hidden; font-size: 14px; transition: border-color .15s; }
.md-preview:hover, .md-preview:focus { border-color: var(--ink); outline: none; }
.md-preview.long { -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
dialog.expand { border: 0; padding: 0; border-radius: 24px; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(20, 20, 40, .28); }
dialog.expand::backdrop { background: rgba(28, 27, 41, .45); backdrop-filter: blur(3px); }
dialog.expand form { display: flex; flex-direction: column; gap: 14px; padding: 22px; height: min(720px, calc(100vh - 48px)); }
dialog.expand h3 { margin: 0; font-size: 18px; }
dialog.expand .head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
dialog.expand .head .tabs { margin-left: auto; }
dialog.expand .md-view { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; font-size: 15px; }
dialog.expand .hint-md { font-size: 12px; color: var(--ink-2); opacity: .75; }
@media (max-width: 640px) { dialog.expand .hint-md { display: none; } }
dialog.expand textarea { flex: 1; min-height: 240px; resize: none; font-size: 15px; line-height: 1.6; padding: 16px 18px; }
dialog.expand .foot { display: flex; align-items: center; gap: 10px; }
dialog.expand .count { font-size: 12.5px; color: var(--ink-2); margin-right: auto; }
dialog.expand .count.over { color: #d9534f; font-weight: 700; }
@media (max-width: 640px) { dialog.expand { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; } dialog.expand form { height: 100dvh; padding: 16px; } }
dialog.expand .tabs.sm { box-shadow: none; background: var(--surface-2); padding: 4px; } dialog.expand .tabs.sm .tab { padding: 6px 14px; font-size: 13px; }

/* ⭐ постійні допродажі */
.star-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; display: inline-grid; place-items: center; background: var(--surface-2); color: #b9b9ad; border: 1px solid var(--line); box-shadow: none; transition: color .15s, background .15s, transform .15s; }
.star-btn:hover { color: #e3a008; background: #fff7df; transform: scale(1.06); }
.star-btn.on { color: #e3a008; background: #fff3c7; border-color: #f5d77a; }
.star-btn.on svg { fill: currentColor; }
.upsell-card.pinned { box-shadow: inset 0 0 0 2px #f5d77a, var(--shadow); }
.star-mini { color: #e3a008; display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.star-mini svg { fill: currentColor; }

/* ідеї допродажу з імпорту: редаговані картки */
.idea { background: #2a2939; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.idea input, .idea select, .idea textarea { background: #1f1e2c; border-color: #3a394c; color: #fff; padding: 9px 12px; font-size: 13.5px; }
.idea input::placeholder, .idea textarea::placeholder { color: #8d8ca0; }
.idea input:focus, .idea select:focus, .idea textarea:focus { background: #1f1e2c; border-color: #bdf04a; }
.idea textarea { min-height: 70px; }
.idea select { width: auto; }
.idea.done { box-shadow: inset 0 0 0 1.5px #bdf04a; }
