/* ═══ IMPERIA KRASOTOK — Dark Analytics Theme ═══ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400&family=Great+Vibes&family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #161b22;
    --card: #1c2333;
    --border: rgba(255,255,255,0.07);
    --accent: #8B2020;
    --gold: #C8A96E;
    --text: #e6edf3;
    --muted: #8b949e;
    --sidebar-w: 240px;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --blue: #58a6ff;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #0d1117;
    border-right: 1px solid var(--border);
    padding: 24px 14px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

.logo {
    text-align: center;
    margin-bottom: 8px;
    padding: 0 4px;
}

.logo svg {
    margin-bottom: 10px;
}

.logo-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 20px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #fff;
    display: block;
}

.logo-sub {
    font-family: 'Great Vibes', cursive;
    color: var(--gold);
    font-size: 22px;
    display: block;
    margin-top: -2px;
}

.logo-tagline {
    font-size: 9px;
    color: #6e7681;
    letter-spacing: 0.1em;
    margin-top: 4px;
    display: block;
}

.nav-section {
    margin-top: 28px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #484f58;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
}

.nav-item.active {
    background: rgba(139,32,32,0.15);
    color: var(--text);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-dot.red { background: var(--accent); }
.nav-dot.green { background: var(--green); }
.nav-dot.yellow { background: var(--yellow); }
.nav-dot.blue { background: var(--blue); }
.nav-dot.gold { background: var(--gold); }

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ═══ MAIN CONTENT ═══ */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 20px 24px;
    max-width: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.mock-banner {
    background: rgba(210,153,34,0.1);
    border: 1px solid rgba(210,153,34,0.25);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--yellow);
    margin-bottom: 14px;
}

/* ═══ METRIC CARDS ═══ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px 10px;
    position: relative;
    overflow: hidden;
    aspect-ratio: auto;
}

.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
    opacity: 0.5;
}

.card:nth-child(1)::after { background: linear-gradient(90deg, var(--green) 0%, transparent 100%); }
.card:nth-child(2)::after { background: linear-gradient(90deg, var(--red) 0%, transparent 100%); }
.card:nth-child(3)::after { background: linear-gradient(90deg, var(--blue) 0%, transparent 100%); }
.card:nth-child(4)::after { background: linear-gradient(90deg, var(--yellow) 0%, transparent 100%); }
.card:nth-child(5)::after { background: linear-gradient(90deg, var(--gold) 0%, transparent 100%); }
.card:nth-child(6)::after { background: linear-gradient(90deg, var(--accent) 0%, transparent 100%); }

.card-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.card-value {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.1;
}

.card-value.negative { color: var(--red); }
.card-value.positive { color: var(--green); }

.card-change {
    font-size: 10px;
    margin-top: 3px;
    color: var(--muted);
}

.card-change a {
    color: var(--gold);
    text-decoration: none;
}

.card-change a:hover {
    text-decoration: underline;
}

/* ═══ FUNNEL — compact inline ═══ */
.funnel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.funnel h3 {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--muted);
    margin-right: 4px;
}

.funnel-bars {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

.funnel-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    transition: background 0.2s, border-color 0.2s;
}

.funnel-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
}

.funnel-count {
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
}

.funnel-item:nth-child(1) .funnel-count { color: var(--blue); }
.funnel-item:nth-child(3) .funnel-count { color: var(--green); }
.funnel-item:nth-child(5) .funnel-count { color: var(--red); }

.funnel-bar {
    display: none;
}

.funnel-label {
    font-size: 11px;
    color: var(--muted);
}

.funnel-arrow {
    flex-shrink: 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 16px;
    opacity: 0.5;
}

/* ═══ TABLE ═══ */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.table-wrap h3 {
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px 0;
    flex-shrink: 0;
}

.table-wrap table {
    flex: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

thead th:hover {
    color: var(--text);
}

thead th.sorted-asc::after { content: " ▲"; font-size: 9px; }
thead th.sorted-desc::after { content: " ▼"; font-size: 9px; }

tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

tbody tr:hover {
    background: rgba(88,166,255,0.06);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ═══ STATUS BADGES ═══ */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.status.lider { background: rgba(63,185,80,0.12); color: var(--green); }
.status.rabochiy { background: rgba(88,166,255,0.12); color: var(--blue); }
.status.problemny { background: rgba(210,153,34,0.12); color: var(--yellow); }
.status.otkluchit { background: rgba(248,81,73,0.12); color: var(--red); }

/* ═══ FILTERS ═══ */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.filter-btn:hover {
    border-color: rgba(255,255,255,0.15);
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ═══ RECOMMENDATIONS ═══ */
.rec-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rec-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.rec-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.rec-icon.critical {
    background: rgba(248,81,73,0.12);
    color: var(--red);
}

.rec-icon.warning {
    background: rgba(210,153,34,0.12);
    color: var(--yellow);
}

.rec-icon.success {
    background: rgba(63,185,80,0.12);
    color: var(--green);
}

.rec-text {
    font-size: 14px;
    line-height: 1.5;
}

.rec-text strong {
    color: #fff;
}

.rec-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

/* ═══ COSTS PAGE ═══ */
.cost-input {
    width: 120px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: border-color 0.15s;
}

.cost-input:focus {
    outline: none;
    border-color: var(--gold);
}

.cost-input::placeholder {
    color: #484f58;
    font-style: italic;
}

.costs-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.btn-save {
    padding: 10px 28px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-save:hover {
    background: #a52a2a;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .funnel { flex-direction: column; align-items: stretch; }
    .funnel-bars { flex-direction: column; }
    .funnel-arrow { transform: rotate(90deg); width: auto; padding: 2px 0; }
}

@media (max-width: 600px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 12px; }
    .cards-grid { grid-template-columns: 1fr; }
}
