/* CSS Variables matching premium F&B light-theme */
:root {
    --bg: #faf7f2;
    --sidebar-bg: #ffffff;
    --surface: #ffffff;
    --surface-recessed: #f3ece4;
    --border: #ebdcd0;
    --border-bright: #d4bfb0;
    --text: #2c1d11;
    --text-dim: #7d6b5e;
    --accent: #b05c2e; /* Terracotta / Copper */
    --accent-dim: rgba(176, 92, 46, 0.08);
    --green: #2c6b45; /* Emerald/Olive */
    --green-dim: rgba(44, 107, 69, 0.08);
    --gold: #b38600;
    --gold-dim: rgba(179, 134, 0, 0.08);
    --indigo: #b05c2e;
    --indigo-dim: rgba(176, 92, 46, 0.08);
    --glass-blur: blur(0px);
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at bottom right, #f2eae1, var(--bg));
    color: var(--text);
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    line-height: 1.6;
}

/* HEADER & TOP BAR */
.app-header {
    grid-column: 1 / -1;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    background: linear-gradient(135deg, var(--accent), #e08e60);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
}

.btn {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    transition: all 0.25s ease;
}

.btn:hover {
    color: var(--text);
    border-color: var(--border-bright);
    background: rgba(176, 92, 46, 0.04);
}

.btn-purple {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(176, 92, 46, 0.2);
}

.btn-purple:hover {
    background: var(--accent);
    color: white;
}

.btn-emerald {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(44, 107, 69, 0.2);
}

.btn-emerald:hover {
    background: var(--green);
    color: white;
}

/* SIDEBAR NAVIGATION */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin: 0.75rem 0 0.35rem 0.25rem;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    margin-bottom: 0.25rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(176, 92, 46, 0.03);
    color: var(--text);
    border-color: var(--border);
}

.nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(176, 92, 46, 0.2);
}

/* MAIN CONTENT SECTION */
.main-content {
    padding: 2rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

.alert-box {
    background: rgba(176, 92, 46, 0.03);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text);
    border-radius: 0 0.5rem 0.5rem 0;
    margin-bottom: 1.5rem;
}

section {
    scroll-margin-top: 80px;
    margin-bottom: 2.5rem;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* Glass Cards */
.ve-card {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(44, 29, 17, 0.02);
    margin-bottom: 1rem;
}

.ve-card--recessed {
    background: var(--surface-recessed);
    border-color: var(--border);
}

/* Tables */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #ffffff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.data-table th {
    background: rgba(176, 92, 46, 0.02);
    color: var(--text-dim);
    padding: 0.75rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(176, 92, 46, 0.01);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.muted-cell {
    color: var(--text-dim);
}

/* MERMAID INTERACTIVE SHELL */
.diagram-shell {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #ffffff;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.diagram-shell__hint {
    background: rgba(176, 92, 46, 0.02);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-size: 0.68rem;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mermaid-wrap {
    position: relative;
    height: 380px;
    width: 100%;
    overflow: hidden;
    background: #faf8f5;
}

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    gap: 4px;
    align-items: center;
}

.zoom-controls button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--border-bright);
    color: var(--text);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background: var(--accent);
    border-color: transparent;
    color: white;
}

.zoom-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-right: 8px;
    font-family: monospace;
}

.mermaid-viewport {
    width: 100%;
    height: 100%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mermaid-viewport:active {
    cursor: grabbing;
}

.mermaid-canvas {
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* Timeline phases */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    padding-left: 20px;
    margin-top: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(176, 92, 46, 0.3);
    z-index: 2;
}

.timeline-dot--inactive {
    background: var(--border-bright);
    box-shadow: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge--blue {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(44, 107, 69, 0.2);
}

pre {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    color: var(--text);
}

@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
    }

    .app-header {
        position: relative;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .header-nav {
        flex-wrap: wrap;
        gap: 0.35rem;
        width: 100%;
    }

    .header-nav .btn {
        flex-grow: 1;
        text-align: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.7rem;
    }

    .sidebar {
        height: auto;
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1rem;
        z-index: 11;
    }

    .sidebar-title {
        display: none;
    }

    .sidebar nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar nav::-webkit-scrollbar {
        height: 3px;
    }

    .sidebar nav::-webkit-scrollbar-thumb {
        background-color: var(--border-bright);
        border-radius: 99px;
    }

    .nav-link {
        display: inline-flex;
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        margin-bottom: 0;
    }

    .main-content {
        padding: 1rem;
    }

    .section-heading {
        font-size: 1.2rem;
    }

    .ve-card {
        padding: 1.25rem 1rem;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    .timeline-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .timeline-card p {
        font-size: 0.8rem;
    }
}
