/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e6e8ef;
  --border-strong: #d5d8e2;
  --text: #151821;
  --muted: #6a7081;
  --faint: #9aa0b0;
  --accent: #5454e8;
  --accent-hover: #4545d6;
  --accent-soft: #eeeefe;
  --accent-text: #3d3dc4;
  --danger: #dc3b3b;
  --shadow-sm: 0 1px 2px rgba(20, 22, 40, .05);
  --shadow: 0 1px 2px rgba(20, 22, 40, .04), 0 4px 16px rgba(20, 22, 40, .05);
  --shadow-lg: 0 12px 40px rgba(20, 22, 40, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 248px;
  /* Предел ширины контента: на широких мониторах страница не растягивается бесконечно,
     а поля по краям остаются симметричными. Дальше ширину добирают колонки сеток */
  --page-max: 1920px;

  --blue-bg: #e8f0ff;   --blue: #2d5fd3;
  --violet-bg: #f1ebff; --violet: #7042d6;
  --amber-bg: #fff4dc;  --amber: #a86800;
  --teal-bg: #dff7f3;   --teal: #0d8a79;
  --green-bg: #e3f6e9;  --green: #1b8a45;
  --red-bg: #fdeaea;    --red: #c73434;
  --gray-bg: #eff0f3;   --gray: #6a7081;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f14; --surface: #151820; --surface-2: #1a1e27; --border: #242935; --border-strong: #313746;
    --text: #e9ebf1; --muted: #9096a6; --faint: #646b7c;
    --accent: #7373ff; --accent-hover: #8585ff; --accent-soft: #23234a; --accent-text: #a9a9ff;
    --shadow-sm: none; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
    --blue-bg: #17264a; --blue: #8fb1ff; --violet-bg: #291d4a; --violet: #bda2ff;
    --amber-bg: #3a2a0c; --amber: #f5bf52; --teal-bg: #0f332f; --teal: #5bd6c3;
    --green-bg: #12331f; --green: #6bd690; --red-bg: #3d1717; --red: #ff8a8a;
    --gray-bg: #232833; --gray: #9aa0b0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f14; --surface: #151820; --surface-2: #1a1e27; --border: #242935; --border-strong: #313746;
  --text: #e9ebf1; --muted: #9096a6; --faint: #646b7c;
  --accent: #7373ff; --accent-hover: #8585ff; --accent-soft: #23234a; --accent-text: #a9a9ff;
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  --blue-bg: #17264a; --blue: #8fb1ff; --violet-bg: #291d4a; --violet: #bda2ff;
  --amber-bg: #3a2a0c; --amber: #f5bf52; --teal-bg: #0f332f; --teal: #5bd6c3;
  --green-bg: #12331f; --green: #6bd690; --red-bg: #3d1717; --red: #ff8a8a;
  --gray-bg: #232833; --gray: #9aa0b0;
  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; font-size: 13px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), #9a5cf5); color: #fff; font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 650; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; text-decoration: none; transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600; display: grid; place-items: center;
}
.nav .count.paid { background: var(--teal); }
.nav .count.review { background: var(--red); }
.nav-counts { margin-left: auto; display: flex; gap: 4px; }
.nav-counts .count { margin-left: 0; }
.nav .count[hidden] { display: none; }  /* иначе display: grid перебивает атрибут */
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.bot-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 0 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.me { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 13px; text-transform: uppercase;
}
.me-name { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 22px 32px 0; max-width: var(--page-max); width: 100%; margin-inline: auto;
}
.topbar-title { flex: 1; min-width: 200px; }
.topbar-title .sub { color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 20px 32px 48px; max-width: var(--page-max); width: 100%; margin-inline: auto; }
.btn.burger { display: none; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* ── Cards & grid ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
/* auto-fit: две колонки на ноутбуке, три-четыре на широком мониторе, одна на узком */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) clamp(300px, 20vw, 420px); align-items: start; }
/* Одиночная карточка в сетке не должна растягиваться на всю ширину монитора */
.grid-2 > .span-1 { max-width: 640px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.stat.hot { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
a.stat { color: inherit; text-decoration: none; transition: border-color .12s, transform .12s; }
a.stat:hover { border-color: var(--accent); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--gray-bg); color: var(--gray);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:focus-visible, .input:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.inline { display: inline; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field, .field-row + .field, .field + .field-row, .field-row + .field-row { margin-top: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.field-row > .field { margin-top: 0; }
.label { font-size: 13px; font-weight: 550; }
.label .req { color: var(--danger); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.mono { font-size: 13px; }
.input:hover { border-color: var(--faint); }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 44px; }
.input-group .suffix { position: absolute; right: 12px; color: var(--muted); pointer-events: none; }
.input-search { position: relative; flex: 1; min-width: 200px; }
.input-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-search .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.secret { border-style: dashed; background: var(--surface-2); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--amber-bg); color: var(--amber); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-red { background: var(--red-bg); color: var(--red); }
.alert-blue { background: var(--blue-bg); color: var(--blue); }

/* Segmented status picker */
.segments { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.segments label {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .12s;
}
.segments input { display: none; }
.segments label:hover { border-color: var(--faint); }
.segments input:checked + span { font-weight: 600; }
.segments label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.segments .emoji { font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 26px; padding: 3px 10px; border-radius: 13px; text-align: left; line-height: 1.4; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--faint); }

/* ── Toolbar / tabs ─────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; white-space: nowrap; text-decoration: none !important;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--border); }
.tab .n { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tab.active .n { color: var(--accent-text); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
/* Поля внутри таблицы не раздвигают колонки своей шириной по умолчанию */
.table .input { min-width: 0; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr[data-href] { cursor: pointer; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .check-col { width: 36px; padding-right: 0; }
.row-title { font-weight: 550; color: var(--text); }
.row-sub { font-size: 12.5px; color: var(--muted); }
.thumb {
  width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-2); flex: none;
  display: grid; place-items: center; font-size: 18px; border: 1px solid var(--border);
}
.cell-flex { display: flex; align-items: center; gap: 12px; min-width: 0; }
tr.is-new td:first-child { box-shadow: inset 3px 0 var(--accent); }
tr.is-paid td:first-child { box-shadow: inset 3px 0 var(--teal); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pagination .pages { display: flex; gap: 4px; }

.bulkbar {
  position: sticky; bottom: 16px; z-index: 5; margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--text); color: var(--bg); padding: 10px 12px 10px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.bulkbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.bulkbar .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.bulkbar .spacer { flex: 1; }

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 56px 24px; }
.empty-icon { font-size: 36px; margin-bottom: 8px; }
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty p { color: var(--muted); margin: 0 auto 16px; max-width: 380px; }

/* ── Key-value lists ───────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Timeline ───────────────────────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--surface); background: var(--faint); box-shadow: 0 0 0 1px var(--border); }
.tl-dot.blue { background: var(--blue); } .tl-dot.violet { background: var(--violet); } .tl-dot.amber { background: var(--amber); }
.tl-dot.teal { background: var(--teal); } .tl-dot.green { background: var(--green); } .tl-dot.red { background: var(--red); }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.tl-text { white-space: pre-wrap; margin-top: 2px; }

/* ── Chart ──────────────────────────────────────────────────────────────── */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 160px; padding-top: 8px; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar {
  width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--accent-soft); position: relative;
  min-height: 3px; transition: background .12s;
}
.chart-bar.has { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #9a5cf5)); }
.chart-col:hover .chart-bar.has { filter: brightness(1.1); }
.chart-label { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.list-row:last-child { border-bottom: none; }
a.list-row:hover { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }

/* ── Telegram preview (account form) ───────────────────────────────────── */
.tg-phone { background: #8fb3d2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1.5' fill='%23ffffff' fill-opacity='.18'/%3E%3C/svg%3E"); border-radius: var(--radius); padding: 18px 14px; }
:root[data-theme="dark"] .tg-phone { background-color: #1d2b3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-phone { background-color: #1d2b3a; } }
.tg-bubble { background: #fff; color: #000; border-radius: 14px 14px 14px 4px; overflow: hidden; max-width: 320px; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
:root[data-theme="dark"] .tg-bubble { background: #222e3c; color: #f3f5f7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-bubble { background: #222e3c; color: #f3f5f7; } }
.tg-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #d9e3ec; }
.tg-text { padding: 8px 12px 10px; font-size: 14px; line-height: 1.42; white-space: pre-wrap; word-break: break-word; }
.tg-buttons { display: grid; gap: 4px; margin-top: 4px; max-width: 320px; }
.tg-btn { background: rgba(40, 70, 100, .35); color: #fff; text-align: center; border-radius: 8px; padding: 8px; font-size: 13.5px; font-weight: 500; backdrop-filter: blur(4px); }

.photo-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.photo-drop:hover, .photo-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; }
/* Галерея лота: миниатюры с выбором обложки и отметкой на удаление */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photo-tile { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.photo-tile.is-cover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.photo-tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-tile.to-remove img { opacity: .35; filter: grayscale(1); }
.photo-cover {
  display: block; padding: 5px 8px; font-size: 12px; color: var(--muted); cursor: pointer; text-align: center;
  border-top: 1px solid var(--border); background: var(--surface);
}
.photo-cover input { display: none; }
.photo-tile.is-cover .photo-cover { color: var(--accent-text); font-weight: 600; }
.photo-drop-x {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 12px; line-height: 1;
}
.photo-drop-x input { display: none; }
.photo-tile.to-remove .photo-drop-x { background: var(--danger); }
.photo-drop .ph { width: 72px; height: 72px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); flex: none; }

.receipt { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.receipt img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: var(--surface-2); }
.copy-box { position: relative; }
.copy-box .btn { position: absolute; top: 6px; right: 6px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; font-weight: 500;
}
.toast .t-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; margin-top: 1px; }
.toast-success .t-icon { background: var(--green); color: #fff; }
.toast-error .t-icon { background: var(--red); color: #fff; }
.toast-warning .t-icon { background: #e9a100; color: #fff; }
.toast-info .t-icon { background: var(--accent); color: #fff; }
.toast a { color: inherit; text-decoration: underline; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 32px; }
.login-card .brand-logo { width: 48px; height: 48px; font-size: 22px; border-radius: 14px; margin-bottom: 18px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .btn.burger { display: inline-flex; }
  .topbar { padding: 16px 16px 0; }
  .content { padding: 16px 16px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .hide-sm { display: none; }
  .chart-label:nth-child(odd) { visibility: hidden; }
}
