* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #f9fafb;

    --text: #15171a;
    --text-soft: #6c727c;
    --text-muted: #969ca5;

    --border: #e7e9ed;

    --dark: #17191c;
    --dark-soft: #24272b;

    --danger: #d84d4d;
    --danger-soft: #fff1f1;

    --warning: #c98622;
    --warning-soft: #fff7e8;

    --success: #27845c;
    --success-soft: #edf9f3;

    --purple: #6d5bd0;
    --purple-soft: #f2efff;

    --shadow:
        0 1px 2px rgba(0, 0, 0, 0.03),
        0 10px 30px rgba(0, 0, 0, 0.04);

    --radius: 18px;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* APP */

.app-shell {
    display: flex;
    min-height: 100vh;
}


/* SIDEBAR */

.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--dark);
    color: white;

    display: flex;
    flex-direction: column;

    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 8px 28px;
}

.brand-logo {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: white;
    color: var(--dark);

    font-weight: 800;
    font-size: 14px;
}

.brand-name {
    font-weight: 700;
    font-size: 16px;
}

.brand-subtitle {
    color: #8f949b;
    font-size: 10px;
    margin-top: 3px;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    min-height: 44px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 12px;

    border-radius: 10px;

    color: #aeb2b8;
    text-decoration: none;

    font-size: 14px;

    transition: 0.15s ease;
}

.nav-item:hover {
    color: white;
    background: var(--dark-soft);
}

.nav-item.active {
    color: white;
    background: #2b2e33;
}

.nav-item.disabled {
    opacity: 0.72;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-divider {
    height: 1px;
    background: #2d3035;
    margin: 12px 4px;
}

.sidebar-bottom {
    margin-top: auto;
}

.ask-ai-button {
    width: 100%;
    border: 1px solid #34383e;
    background: #23262a;
    color: white;

    border-radius: 14px;
    padding: 13px;

    display: flex;
    align-items: center;
    gap: 11px;

    text-align: left;
}

.ask-ai-icon {
    width: 35px;
    height: 35px;

    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: white;
    color: var(--dark);
}

.ask-ai-button strong {
    display: block;
    font-size: 13px;
}

.ask-ai-button small {
    display: block;
    color: #8f949b;
    margin-top: 2px;
}


/* MAIN */

.main {
    flex: 1;
    margin-left: 250px;
    min-width: 0;
}

.topbar {
    min-height: 92px;

    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);

    padding: 20px 34px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: sticky;
    top: 0;
    z-index: 20;

    backdrop-filter: blur(14px);
}

.page-label,
.section-eyebrow,
.hero-eyebrow {
    font-size: 10px;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--text-muted);
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 12px;
    color: var(--text-soft);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);

    box-shadow:
        0 0 0 4px var(--success-soft);
}

.salon-selector {
    min-width: 190px;

    border: 1px solid var(--border);
    background: white;

    border-radius: 12px;

    padding: 9px 12px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    text-align: left;
}

.salon-selector small {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
}

.salon-selector strong {
    display: block;
    margin-top: 2px;
    font-size: 13px;
}


/* CONTENT */

.content {
    padding: 30px 34px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.loading-card,
.error-card {
    padding: 30px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.error-card {
    color: var(--danger);
}


/* HERO */

.hero {
    background:
        linear-gradient(
            120deg,
            #17191c 0%,
            #22262b 100%
        );

    color: white;

    min-height: 180px;
    border-radius: 22px;

    padding: 30px 34px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    box-shadow: var(--shadow);
}

.hero-eyebrow {
    color: #8d949d;
}

.hero h2 {
    margin: 9px 0 8px;

    max-width: 700px;

    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.hero p {
    max-width: 650px;

    margin: 0;

    color: #aeb4bb;
    font-size: 14px;
    line-height: 1.6;
}

.hero-score {
    display: flex;
    align-items: center;
    gap: 14px;

    padding-left: 30px;
}

.hero-score span {
    font-size: 58px;
    line-height: 1;
    font-weight: 700;
}

.hero-score small {
    color: #969da5;
    line-height: 1.4;
}


/* KPI */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;

    margin-top: 18px;
}

.kpi-card {
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    padding: 20px;

    box-shadow: var(--shadow);
}

.kpi-label {
    color: var(--text-soft);
    font-size: 12px;
    min-height: 32px;
}

.kpi-value {
    margin-top: 12px;

    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.kpi-caption {
    margin-top: 7px;

    font-size: 11px;
    color: var(--text-muted);
}


/* DASHBOARD GRID */

.dashboard-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1.65fr)
        minmax(300px, 0.75fr);

    gap: 18px;

    margin-top: 18px;
}

.panel {
    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);

    padding: 22px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 18px;
}

.panel-header.compact {
    margin-bottom: 16px;
}

.panel h3 {
    margin: 5px 0 0;
    font-size: 17px;
    letter-spacing: -0.02em;
}

.counter {
    min-width: 32px;
    height: 32px;

    padding: 0 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: var(--surface-soft);
    border: 1px solid var(--border);

    font-size: 12px;
    font-weight: 700;
}


/* ACTION CARDS */

.action-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-card {
    border: 1px solid var(--border);
    border-radius: 15px;

    padding: 18px;

    transition: 0.15s ease;

    cursor: pointer;
}

.action-card:hover {
    border-color: #cfd3d9;

    transform: translateY(-1px);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.05);
}

.action-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.action-meta {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-bottom: 9px;
}

.badge {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 0 8px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 700;
}

.badge.high,
.badge.critical {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge.medium {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge.low {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.badge.status {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.action-card h4 {
    margin: 0;

    font-size: 16px;
    letter-spacing: -0.015em;
}

.action-reason {
    margin: 9px 0 0;

    color: var(--text-soft);

    font-size: 13px;
    line-height: 1.55;
}

.action-money {
    white-space: nowrap;
    text-align: right;
}

.action-money strong {
    display: block;
    font-size: 17px;
}

.action-money small {
    display: block;
    margin-top: 3px;

    color: var(--text-muted);
    font-size: 10px;
}

.recommendation {
    margin-top: 14px;

    padding: 12px 13px;

    background: var(--purple-soft);
    border-radius: 10px;

    font-size: 12px;
    line-height: 1.5;

    color: #4c4194;
}

.recommendation strong {
    display: block;
    margin-bottom: 3px;
}

.empty-state {
    padding: 36px 20px;

    text-align: center;

    color: var(--text-soft);

    border: 1px dashed var(--border);
    border-radius: 14px;
}


/* RIGHT */

.right-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.insight-list {
    display: flex;
    flex-direction: column;
}

.insight-row {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 14px 0;

    border-bottom: 1px solid var(--border);
}

.insight-row:last-child {
    border-bottom: 0;
}

.insight-icon {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: var(--surface-soft);
    color: var(--text-soft);

    font-weight: 700;
}

.insight-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.insight-row strong {
    display: block;
    font-size: 18px;
}

.insight-row span {
    color: var(--text-soft);
    font-size: 11px;
}

.result-panel {
    flex: 1;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 13px 0;

    border-bottom: 1px solid var(--border);

    font-size: 12px;
    color: var(--text-soft);
}

.result-row strong {
    color: var(--text);
    font-size: 15px;
}

.result-divider {
    height: 10px;
}

.result-money {
    margin-top: 10px;

    padding: 15px;

    border-radius: 12px;

    background: var(--success-soft);
}

.result-money span {
    display: block;

    color: #527264;
    font-size: 11px;
}

.result-money strong {
    display: block;

    margin-top: 5px;

    font-size: 23px;
    color: var(--success);
}

.result-money small {
    display: block;

    margin-top: 5px;

    font-size: 9px;
    color: #799286;
}


/* DRAWER */

.drawer-backdrop {
    position: fixed;
    inset: 0;

    background: rgba(18, 20, 23, 0.3);

    z-index: 90;

    backdrop-filter: blur(2px);
}

.case-drawer {
    position: fixed;

    top: 0;
    right: 0;
    bottom: 0;

    width: 520px;
    max-width: 92vw;

    background: white;

    z-index: 100;

    transform: translateX(100%);
    transition: transform 0.25s ease;

    box-shadow:
        -20px 0 60px rgba(0, 0, 0, 0.12);

    display: flex;
    flex-direction: column;
}

.case-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    min-height: 90px;

    padding: 22px 24px;

    border-bottom: 1px solid var(--border);

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 {
    margin: 5px 0 0;
    font-size: 20px;
}

.drawer-close {
    width: 38px;
    height: 38px;

    border: 1px solid var(--border);
    background: white;

    border-radius: 10px;

    font-size: 22px;
}

.drawer-content {
    overflow-y: auto;
    padding: 24px;
}

.case-section {
    margin-bottom: 24px;
}

.case-section-label {
    margin-bottom: 7px;

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;

    color: var(--text-muted);
}

.case-section p {
    margin: 0;

    font-size: 13px;
    line-height: 1.6;

    color: var(--text-soft);
}

.evidence-box {
    padding: 14px;

    border-radius: 12px;

    background: var(--surface-soft);
    border: 1px solid var(--border);

    font-size: 13px;
    line-height: 1.6;
}

.case-action-button {
    width: 100%;

    min-height: 44px;

    border: 0;
    border-radius: 11px;

    background: var(--dark);
    color: white;

    font-weight: 600;
}

.case-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-bottom: 24px;
}

.case-meta-item {
    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 10px;
}

.case-meta-item small {
    display: block;
    color: var(--text-muted);
    font-size: 9px;
}

.case-meta-item strong {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}




/* ============================================================
   MOBILE NAVIGATION V1
   ============================================================ */

.mobile-nav-toggle,
.mobile-nav-close,
.mobile-nav-backdrop {
    display: none;
}

/* RESPONSIVE */

@media (max-width: 1100px) {

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 780px) {

    .sidebar {
        display: flex;
        transform: translateX(-100%);
        transition: transform 220ms ease;
        z-index: 1100;
    }

    .sidebar.mobile-nav-open {
        transform: translateX(0);
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;

        width: 42px;
        height: 42px;

        margin-right: 12px;
        padding: 0;

        border: 1px solid var(--border);
        border-radius: 10px;

        background: var(--surface);
        color: var(--text-primary);

        font: inherit;
        font-size: 22px;
        line-height: 1;

        cursor: pointer;
    }

    .mobile-nav-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        position: absolute;
        top: 14px;
        right: 14px;

        width: 36px;
        height: 36px;

        padding: 0;

        border: 0;
        border-radius: 9px;

        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;

        font: inherit;
        font-size: 25px;
        line-height: 1;

        cursor: pointer;
    }

    .mobile-nav-backdrop {
        display: block;

        position: fixed;
        inset: 0;

        z-index: 1050;

        background: rgba(11, 15, 20, 0.48);

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transition:
            opacity 220ms ease,
            visibility 220ms ease;
    }

    .mobile-nav-backdrop.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.mobile-nav-active {
        overflow: hidden;
    }

    .main {
        margin-left: 0;
    }

    .topbar {
        padding: 18px;
    }

    .content {
        padding: 18px;
    }

    .live-status {
        display: none;
    }

    .salon-selector {
        min-width: auto;
    }

    .hero {
        padding: 24px;

        align-items: flex-start;
    }

    .hero-score {
        padding-left: 15px;
    }

    .hero-score span {
        font-size: 42px;
    }

}

@media (max-width: 560px) {

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .salon-selector small {
        display: none;
    }

    .hero h2 {
        font-size: 22px;
    }

    .hero-score {
        display: none;
    }

}