﻿:root {
    --sidebar-width: 296px;
    --brand-primary: #0d1321;
    --brand-secondary: #F5F5DC;
    --brand-tertiary: #E8D9BB;
    --primary: #0d1321;
    --primary-strong: #1b263b;
    --primary-soft: rgba(13, 19, 33, 0.18);
    --bg: #f5f5dc;
    --bg-soft: #fffaf0;
    --bg-card: rgba(255, 250, 240, 0.94);
    --bg-panel: #efe2c8;
    --text: #2c1c14;
    --text-soft: #6d5848;
    --text-inverse: #f5f5dc;
    --line: rgba(74, 48, 35, 0.14);
    --sidebar-bg: #0d1321;
    --sidebar-line: rgba(44, 28, 20, 0.12);
    --sidebar-text: #f5f5dc;
    --sidebar-muted: #e8d9bb;
    --sidebar-active-bg: rgba(245, 245, 220, 0.92);
    --success: #2f7a4e;
    --warning: #9a5a14;
    --danger: #9f2d1f;
    --info: #81511f;
    --muted: #927764;
    --shadow: 0 24px 60px rgba(83, 53, 37, 0.14);
}

:root[data-theme="dark"] {
    --bg: #261913;
    --bg-soft: #30211b;
    --bg-card: rgba(56, 38, 29, 0.94);
    --bg-panel: rgba(245, 245, 220, 0.08);
    --text: #f5f5dc;
    --text-soft: #e8d9bb;
    --text-inverse: #f5f5dc;
    --line: rgba(245, 245, 220, 0.12);
    --sidebar-bg: #0d1321;
    --sidebar-line: rgba(44, 28, 20, 0.12);
    --sidebar-text: #f5f5dc;
    --sidebar-muted: #e8d9bb;
    --sidebar-active-bg: rgba(245, 245, 220, 0.92);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    background:
        radial-gradient(circle at top, rgba(13, 19, 33, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(232, 217, 187, 0.38), transparent 38%),
        var(--bg);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: .92rem; }
.text-xs { font-size: .82rem; }
.text-muted { color: var(--text-soft); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.rounded-xl { border-radius: 1rem; }
.rounded-2xl { border-radius: 1.4rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.page-shell {
    min-height: 100vh;
}
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 1.15rem;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #1b263b 100%);
    border-right: 1px solid var(--sidebar-line);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    box-shadow: 22px 0 48px rgba(74, 36, 14, 0.12);
}
.sidebar-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.9rem;
    padding: .6rem .4rem 1rem;
    color: var(--sidebar-text);
    text-align: center;
}
.sidebar-brand > div {
    width: 100%;
}
.brand-logo {
    display: block;
    height: auto;
}
.brand-logo-sidebar {
    width: min(100%, 168px);
    margin: 0 auto .9rem;
}
.brand-logo-login {
    width: min(100%, 260px);
    margin: 0 auto 1.15rem;
}
.brand-logo-login-mobile {
    width: min(100%, 180px);
    margin: 0 auto .85rem;
}
.sidebar-brand-title {
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--sidebar-text);
    text-transform: uppercase;
}
.sidebar nav {
    display: flex;
    flex-direction: column;
}
.menu-link {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .92rem 1rem;
    border-radius: 1rem;
    color: var(--sidebar-text);
    transition: .25s ease;
    margin-bottom: .4rem;
    font-weight: 600;
}
.menu-link:hover,
.menu-link.active {
    background: var(--sidebar-active-bg);
    color: #0d1321;
    transform: translateX(2px);
    box-shadow: inset 0 0 0 1px rgba(44, 28, 20, 0.06);
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(32, 20, 14, 0.48);
    opacity: 0;
    visibility: hidden;
    transition: .25s ease;
    z-index: 40;
}
.content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    padding: 1.5rem;
}
.topbar {
    position: sticky;
    top: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    z-index: 20;
}
.panel,
.card,
.metric {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.metric {
    padding: 1.4rem;
}
.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: .35rem 0;
}
.grid-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 1rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-body { padding: 1.4rem; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    padding: .82rem 1.1rem;
    cursor: pointer;
    transition: .2s ease;
    font-weight: 700;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1b263b);
    color: var(--text-inverse);
    border-color: rgba(44, 28, 20, 0.10);
}
.btn-secondary {
    background: var(--bg-panel);
    color: var(--text);
    border-color: var(--line);
}
.btn-danger {
    background: rgba(159, 45, 31, 0.12);
    color: #8f2317;
    border-color: rgba(159, 45, 31, 0.24);
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 700;
    padding: .45rem .72rem;
    border-radius: 999px;
    letter-spacing: .02em;
}
.badge-success { background: rgba(47, 122, 78, .14); color: #225639; }
.badge-warning { background: rgba(154, 90, 20, .14); color: #74400a; }
.badge-danger { background: rgba(159, 45, 31, .14); color: #882418; }
.badge-info { background: rgba(129, 81, 31, .14); color: #6b4317; }
.badge-muted { background: rgba(109, 88, 72, .14); color: #5c473c; }
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 .8rem;
}
.table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-soft);
    text-align: left;
    padding: 0 .95rem .25rem;
}
.table td {
    background: rgba(255, 250, 240, 0.58);
    padding: 1rem .95rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] .table td {
    background: rgba(245, 245, 220, 0.03);
}
.table td:first-child {
    border-left: 1px solid var(--line);
    border-radius: 1rem 0 0 1rem;
}
.table td:last-child {
    border-right: 1px solid var(--line);
    border-radius: 0 1rem 1rem 0;
}
.table tbody tr:hover td { background: rgba(13, 19, 33, 0.08); }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: .45rem; }
.form-group.full { grid-column: 1 / -1; }
.label { font-size: .9rem; color: var(--text-soft); }
.input,
.select,
.textarea {
    width: 100%;
    padding: .9rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: rgba(255, 250, 240, 0.78);
    color: var(--text);
    outline: none;
    transition: .2s ease;
}
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea {
    background: rgba(245, 245, 220, 0.04);
}
.input:focus,
.select:focus,
.textarea:focus {
    border-color: rgba(13, 19, 33, 0.55);
    box-shadow: 0 0 0 4px rgba(13, 19, 33, 0.12);
}
.textarea { min-height: 120px; resize: vertical; }
.alert {
    padding: .95rem 1rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: rgba(47, 122, 78, .12); color: #225639; border-color: rgba(47, 122, 78, .2); }
.alert-error { background: rgba(159, 45, 31, .12); color: #882418; border-color: rgba(159, 45, 31, .2); }
.kpi-trend { color: var(--text-soft); font-size: .84rem; }
.timeline { display: flex; flex-direction: column; gap: 1rem; }
.timeline-item {
    position: relative;
    padding-left: 1.2rem;
    border-left: 1px solid var(--line);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    background: linear-gradient(135deg, #0d1321, #1b263b);
}
.login-side {
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #2c1c14;
}
.login-brand-block {
    width: min(100%, 420px);
    margin: auto;
    text-align: center;
}
.login-brand-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: .18em;
    color: #f5f5dc;
    text-transform: uppercase;
}
.login-mobile-brand {
    display: none;
    margin-bottom: 1.25rem;
    text-align: center;
}
.login-mobile-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--primary);
}
.auth-panel {
    background: var(--bg-soft);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}
.filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--text);
    font-weight: 700;
    border: 1px solid rgba(44, 28, 20, 0.08);
}
.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-soft);
}
.mobile-toggle { display: none; }
.link-accent {
    color: var(--primary-strong);
    font-weight: 700;
}
.hero-copy {
    color: rgba(44, 28, 20, 0.86);
}
@media (max-width: 1180px) {
    .grid-metrics, .grid-3, .filters, .form-grid, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    .mobile-toggle { display: inline-flex; }
    body.sidebar-open {
        overflow: hidden;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }
    .grid-metrics, .grid-3, .filters, .form-grid, .grid-2 { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-side {
        display: none;
    }
    .login-mobile-brand {
        display: block;
    }
}
@media (min-width: 981px) {
    .sidebar {
        transform: translateX(0) !important;
    }
    .sidebar-backdrop {
        display: none;
    }
}
