/* ========================================
   DASHBOARD — Shared Styles
   ======================================== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1328;
    --bg-card: #141832;
    --bg-card-hover: #1a1f3a;
    --bg-elevated: #1e2344;
    --text-primary: #e8eaf6;
    --text-secondary: #8b90b0;
    --text-muted: #5a5f7c;
    --accent-cyan: #00f0ff;
    --accent-purple: #7b2fff;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --gradient-main: linear-gradient(135deg, #00f0ff 0%, #7b2fff 100%);
    --border-color: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.3);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

/* ── Layout ─────────────────────────────── */
.dash {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 800;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar__logo-dot { color: var(--accent-cyan); }

.sidebar__nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar__section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.sidebar__link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.sidebar__link--active {
    color: var(--accent-cyan);
    background: rgba(0,240,255,0.06);
}
.sidebar__link--active .sidebar__icon { color: var(--accent-cyan); }
.sidebar__icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-muted); }
.sidebar__badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(0,240,255,0.1);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 100px;
}

.sidebar__user {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #0a0e1a;
    flex-shrink: 0;
}
.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 11px; color: var(--text-muted); }

.sidebar__logout {
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.sidebar__logout:hover { color: var(--accent-red); background: rgba(239,68,68,0.1); }

/* ── Main content ───────────────────────── */
.dash__main {
    grid-column: 2;
    padding: 32px;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}
.topbar__title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.topbar__title small {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 4px;
}
.topbar__actions { display: flex; gap: 12px; align-items: center; }

/* ── Stat Cards ─────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover { border-color: rgba(0,240,255,0.1); transform: translateY(-2px); }
.stat-card__label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stat-card__value {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
    margin-bottom: 8px;
}
.stat-card__value--cyan { color: var(--accent-cyan); }
.stat-card__value--green { color: var(--accent-green); }
.stat-card__value--purple { color: var(--accent-purple); }
.stat-card__value--orange { color: var(--accent-orange); }
.stat-card__change {
    font-size: 12px;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
}
.stat-card__change--up { color: var(--accent-green); background: rgba(16,185,129,0.1); }
.stat-card__change--down { color: var(--accent-red); background: rgba(239,68,68,0.1); }
.stat-card__glow {
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.12;
}

/* ── Data Table ─────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 32px;
}
.panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}
.panel__title { font-size: 16px; font-weight: 700; }
.panel__body { padding: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead { background: rgba(255,255,255,0.02); }
.data-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 20px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr { transition: background 0.15s; }

/* ── Badges ─────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    white-space: nowrap;
}
.badge--active  { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.badge--paused  { background: rgba(245,158,11,0.12); color: var(--accent-orange); }
.badge--draft   { background: rgba(139,144,176,0.12); color: var(--text-secondary); }
.badge--blocked { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.badge--admin   { background: rgba(123,47,255,0.12); color: var(--accent-purple); }
.badge--client  { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.badge--dot::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Buttons ────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    transition: all 0.25s;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}
.btn--primary {
    background: var(--gradient-main);
    color: #0a0e1a;
    box-shadow: 0 2px 12px rgba(0,240,255,0.2);
}
.btn--primary:hover { box-shadow: 0 4px 20px rgba(0,240,255,0.35); transform: translateY(-1px); }
.btn--outline {
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-primary);
}
.btn--outline:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.btn--ghost { color: var(--text-secondary); background: rgba(255,255,255,0.04); }
.btn--ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--lg { padding: 14px 32px; font-size: 16px; }
.btn--danger { background: rgba(239,68,68,0.1); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }
.btn--danger:hover { background: rgba(239,68,68,0.2); }
.btn--block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* ── Forms in dashboard ────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field--full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-field input,
.form-field select,
.form-field textarea {
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0,240,255,0.08);
}
.form-field textarea { resize: vertical; min-height: 80px; }
.form-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b90b0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Chart placeholder ──────────────────── */
.chart-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    min-height: 300px;
    position: relative;
}
.chart-wrap__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.chart-wrap__title { font-size: 16px; font-weight: 700; }
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 200px;
    padding-top: 20px;
}
.chart-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    background: var(--gradient-main);
    opacity: 0.7;
    transition: opacity 0.2s;
    position: relative;
    min-width: 12px;
}
.chart-bar:hover { opacity: 1; }
.chart-bar__label {
    position: absolute;
    bottom: -22px; left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* ── Empty state ────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.empty-state__icon {
    width: 64px; height: 64px;
    margin: 0 auto 20px;
    background: rgba(0,240,255,0.06);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
}
.empty-state__title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-state__text { font-size: 14px; margin-bottom: 24px; max-width: 360px; margin-left: auto; margin-right: auto; }

/* ── Modal ──────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modal-box__close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.2s;
}
.modal-box__close:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.modal-box__title { font-size: 20px; font-weight: 800; margin-bottom: 24px; }

/* ── Tariff badge ───────────────────────── */
.tariff-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    font-family: var(--font-mono);
}
.tariff-badge--razvedchik { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.tariff-badge--okhotnik { background: rgba(0,240,255,0.12); color: var(--accent-cyan); }
.tariff-badge--khischnik { background: rgba(123,47,255,0.12); color: var(--accent-purple); }

/* ── Alert ──────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert--success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: var(--accent-green); }
.alert--error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--accent-red); }
.alert--info { background: rgba(0,240,255,0.06); border: 1px solid rgba(0,240,255,0.15); color: var(--accent-cyan); }

/* ── Responsive ─────────────────────────── */
.sidebar__toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    width: 40px; height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .dash { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar__toggle { display: flex; }
    .dash__main { grid-column: 1; padding: 24px 16px; padding-top: 72px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ── Knowledge base cards ──────────────── */
a.panel:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0,240,255,0.08);
    transform: translateY(-2px);
}
a.panel { transition: all 0.25s; }
