:root {
    --bg: #eef3f7;
    --panel: rgba(255, 255, 255, 0.88);
    --ink: #152033;
    --muted: #6a7588;
    --line: rgba(21, 32, 51, 0.08);
    --shadow: 0 18px 40px rgba(27, 39, 56, 0.08);
    --sidebar: linear-gradient(180deg, #162131 0%, #253243 100%);
    --active: #f1b34f;
    --blue: linear-gradient(135deg, #1d4ed8 0%, #3294ff 100%);
    --dark: linear-gradient(135deg, #151c28 0%, #2b3441 100%);
    --brown: linear-gradient(135deg, #885822 0%, #a8723a 100%);
    --green: linear-gradient(135deg, #0f8a54 0%, #25a65b 100%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(64, 145, 255, 0.08), transparent 28%),
        linear-gradient(180deg, #f6f8fb 0%, var(--bg) 100%);
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: white;
    padding: 28px 22px;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.brand-mark {
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.54);
}

.sidebar h1 {
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
    margin: 0.2rem 0 1.75rem;
}

.sidebar hr {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 1.2rem 0 1.5rem;
}

.nav-label {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
}

.nav-link {
    color: #c4ced8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
    margin-bottom: 0.35rem;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.nav-link.active::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--active);
    box-shadow: 0 0 0 6px rgba(241, 179, 79, 0.16);
}

.content { padding: 32px 28px 40px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(21, 32, 51, 0.06);
    color: #526072;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.8rem;
}

.page-header h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 0;
}

.page-header p {
    color: #5e6a7d;
    max-width: 60rem;
    margin: 0.5rem 0 0;
}

.panel,
.loading,
.empty,
.card {
    border-radius: 28px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.loading,
.empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--muted);
}

.context-grid,
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 18px;
}

.context-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 20px 22px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.context-item small,
.metric small {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.hero,
.mini,
.insight {
    padding: 24px;
    color: white;
}

.hero { background: var(--blue); }
.mini.dark { background: var(--dark); }
.mini.brown { background: var(--brown); }
.mini.green { background: var(--green); }

.hero-value,
.mini-value {
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    font-weight: 800;
    line-height: 1;
    margin: 0.65rem 0 0.8rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.metric-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric strong {
    display: block;
    margin-top: 0.2rem;
}

.section { margin-top: 24px; }

.section-title { padding: 18px 22px 0; }

.section-title h3 {
    margin: 0;
    font-size: 1.45rem;
}

.section-title p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.table-wrap {
    padding: 18px 22px 22px;
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(21, 32, 51, 0.06);
}

th {
    color: #5d6980;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    background: rgba(21, 32, 51, 0.06);
    color: #223045;
    font-weight: 700;
    font-size: 0.82rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.42rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge.success { background: rgba(37, 166, 91, 0.12); color: #127244; }
.badge.warning { background: rgba(217, 158, 44, 0.14); color: #8b5d11; }
.badge.danger { background: rgba(214, 72, 72, 0.14); color: #a32626; }
.badge.secondary { background: rgba(115, 128, 149, 0.14); color: #516072; }

.stack {
    display: grid;
    gap: 14px;
}

.stack-item {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(248, 250, 253, 0.92);
    border: 1px solid rgba(21, 32, 51, 0.06);
}

.muted { color: var(--muted); }

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .context-grid,
    .grid-4,
    .grid-3,
    .grid-2,
    .metric-grid { grid-template-columns: 1fr; }
}
