/* ── Tarot Admin · современный скин (2026-07) ─────────────────────────────────
   Контракт классов сохранён: все старые страницы работают без правок.
   Сайдбар — тёмная слива с золотом (в тон бренду), контент — светлый. */

:root {
    --ink: #17111d;
    --ink-2: #221a2b;
    --gold: #d4a94e;
    --gold-light: #ecc878;
    --accent: #7c3aed;
    --accent-2: #6d28d9;
    --accent-soft: #ede9fe;
    --bg: #f6f4fa;
    --surface: #ffffff;
    --line: #e9e4f2;
    --border: #e9e4f2;          /* алиас для старых inline-стилей */
    --text: #241b2e;
    --muted: #756a85;
    --ok: #16a34a;
    --ok-soft: #dcfce7;
    --success: #16a34a;          /* алиас */
    --fail: #dc2626;
    --danger: #dc2626;           /* алиас */
    --fail-soft: #fee2e2;
    --warn: #d97706;
    --warn-soft: #fef3c7;
    --radius: 14px;
    --radius-s: 9px;
    --shadow: 0 1px 2px rgba(36, 27, 46, .04), 0 8px 24px -12px rgba(36, 27, 46, .10);
    --shadow-hover: 0 2px 4px rgba(36, 27, 46, .06), 0 14px 34px -12px rgba(36, 27, 46, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--accent); }
a:hover { color: var(--accent-2); }

/* ── каркас ── */
.layout { display: flex; min-height: 100vh; }

.main {
    flex: 1;
    min-width: 0;
    padding: 28px 34px 60px;
}

/* ── сайдбар ── */
.sidebar {
    width: 244px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--ink) 0%, #1b1424 100%);
    color: #cfc6dd;
    padding: 18px 12px 90px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3a2f47 transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a2f47; border-radius: 3px; }

body.nav-collapsed .sidebar { display: none; }

.brand {
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: .02em;
    color: var(--gold-light);
    padding: 6px 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand::before { content: "✦"; color: var(--gold); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
    color: #b9aecb;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(212, 169, 78, .10); color: var(--gold-light); }
.nav a.active { background: rgba(124, 58, 237, .30); color: #fff; }

.nav-group {
    margin: 16px 4px 4px;
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #6f6382;
    padding: 0 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}
.nav-group::after { content: "▾"; font-size: .6rem; opacity: .7; margin-left: auto; }
.nav-group.collapsed::after { content: "▸"; }
.nav a.group-hidden { display: none; }

/* скрытие пунктов меню (режим настройки) */
.nav a.nav-hidden { display: none; }
body.nav-edit .nav a.nav-hidden { display: flex; opacity: .38; }
.nav-hide-btn {
    display: none;
    margin-left: auto;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, .10);
    color: #cfc6dd;
    font-size: .72rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
body.nav-edit .nav-hide-btn { display: inline-flex; align-items: center; justify-content: center; }
.nav-hide-btn:hover { background: rgba(220, 38, 38, .55); color: #fff; }

.nav-tools {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 244px;
    padding: 10px 12px 14px;
    background: linear-gradient(0deg, #1b1424 72%, transparent);
    display: flex;
    gap: 8px;
    z-index: 5;
}
body.nav-collapsed .nav-tools { display: none; }
.nav-tools button {
    flex: 1;
    background: rgba(255, 255, 255, .07);
    color: #b9aecb;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: .78rem;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.nav-tools button:hover { background: rgba(212, 169, 78, .15); color: var(--gold-light); }
.nav-tools button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

#sidebarToggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 60;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 1rem;
    display: none;
    align-items: center;
    justify-content: center;
}
body.nav-collapsed #sidebarToggle { display: inline-flex; }
body.nav-collapsed .main { padding-left: 68px; }

/* ── типографика ── */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; margin: 4px 0 6px; }
h2 { font-size: 1.06rem; font-weight: 650; margin: 20px 0 12px; }
h3 { font-size: .95rem; font-weight: 600; }

.subtitle { color: var(--muted); margin: 0 0 20px; font-size: .93rem; }
.muted-inline { color: var(--muted); font-size: .84rem; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: .85rem; margin-bottom: 10px; }
.back-link:hover { color: var(--accent); }
.section-eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 6px; }
.section-divider { height: 1px; background: var(--line); margin: 26px 0; border: 0; }

/* ── карточки и сетки ── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 4px 0 20px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    transition: box-shadow .2s, transform .2s;
}
.stat:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(120deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-label { color: var(--muted); font-size: .8rem; margin-top: 3px; }

.dashboard-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dashboard-three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) {
    .dashboard-two-col, .dashboard-three-col { grid-template-columns: 1fr; }
}

.details-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; }
.details-grid dt { color: var(--muted); font-size: .86rem; }
.details-grid dd { margin: 0; font-size: .9rem; font-variant-numeric: tabular-nums; }

/* ── таблицы ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-s); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
table.data th, table.data td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 600;
    background: #faf8fd;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}
table.data th a { color: var(--muted); text-decoration: none; }
table.data th a:hover, table.data th a.sorted { color: var(--accent); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover td { background: #f6f2fc; }
table.data td { font-variant-numeric: tabular-nums; }

.scroll-table { max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-s); }
.scroll-table-tall { max-height: 640px; }

/* ── формы ── */
label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--muted); }

input[type="text"], input[type="number"], input[type="password"],
input[type="date"], input[type="email"], input[type="datetime-local"],
select, textarea, .input {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    padding: 8px 11px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    min-width: 0;
}
input:focus, select:focus, textarea:focus, .input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .14);
}
input[type="file"] { font-size: .85rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }

form.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 0; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }

/* ── кнопки ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    border: none;
    border-radius: var(--radius-s);
    padding: 8px 16px;
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px -4px rgba(124, 58, 237, .45);
    transition: transform .12s, box-shadow .15s, filter .15s;
    white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); box-shadow: 0 6px 16px -4px rgba(124, 58, 237, .55); color: #fff; }
.btn:active { transform: scale(.97); }
.btn-danger { background: linear-gradient(135deg, #ef4444, var(--fail)); box-shadow: 0 4px 12px -4px rgba(220, 38, 38, .4); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }

/* ── бейджи и баннеры ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-soft);
    color: var(--accent-2);
    border-radius: 999px;
    padding: 2.5px 9px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-fail { background: var(--fail-soft); color: var(--fail); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-platform-telegram { background: #dbeafe; color: #1d4ed8; }
.badge-platform-max { background: #ede9fe; color: #6d28d9; }

.error-banner, .success-banner {
    border-radius: var(--radius-s);
    padding: 11px 15px;
    margin-bottom: 16px;
    font-size: .88rem;
    border: 1px solid;
}
.error-banner { background: var(--fail-soft); color: #991b1b; border-color: #fecaca; }
.success-banner { background: var(--ok-soft); color: #166534; border-color: #bbf7d0; }
.error { color: var(--fail); }

/* ── логин ── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(60% 50% at 80% 10%, rgba(124, 58, 237, .18), transparent),
        radial-gradient(50% 40% at 10% 90%, rgba(212, 169, 78, .15), transparent),
        var(--ink);
}
.auth-card {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .5);
    padding: 34px 32px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── графики и старые виджеты ── */
.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.mini-chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.mini-chart-bar { background: linear-gradient(180deg, #a855f7, var(--accent)); border-radius: 5px 5px 0 0; min-height: 2px; }
.mini-chart-label { font-size: .62rem; color: var(--muted); margin-top: 4px; }
.mini-chart-value { font-size: .68rem; color: var(--text); font-variant-numeric: tabular-nums; }

.chart-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.chart-title { font-weight: 650; }
.chart-summary { color: var(--muted); font-size: .82rem; }
.chart-area, .line-chart { position: relative; }
.line-chart-svg { width: 100%; height: auto; display: block; }
.chart-line { stroke: var(--accent); }
.chart-dot { fill: var(--accent); }
.chart-grid-line { stroke: var(--line); }
.chart-stack { display: flex; flex-direction: column; gap: 14px; }
.chart-current { font-weight: 700; color: var(--accent); }
.line-chart-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; }

.funnel-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.funnel-label { width: 180px; color: var(--muted); font-size: .84rem; }
.funnel-value { font-variant-numeric: tabular-nums; font-weight: 600; }

.broadcast-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
@media (max-width: 1100px) { .broadcast-grid { grid-template-columns: 1fr; } }
.broadcast-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.choice-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.scope-box { border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 12px 14px; }

.user-picker { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.user-picker-toolbar { display: flex; gap: 8px; padding: 10px; background: #faf8fd; border-bottom: 1px solid var(--line); }
.user-picker-list { max-height: 300px; overflow: auto; }
.user-picker-item { display: flex; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.user-picker-item:hover { background: #f6f2fc; }
.user-picker-main { flex: 1; }
.user-picker-count { color: var(--muted); font-size: .8rem; padding: 8px 12px; }

/* ── адаптив ── */
@media (max-width: 900px) {
    .sidebar { position: fixed; z-index: 50; height: 100vh; width: 258px; box-shadow: 20px 0 60px rgba(0, 0, 0, .35); }
    .nav-tools { width: 258px; }
    .main { padding: 66px 16px 40px; }
    #sidebarToggle { display: inline-flex; }
}
