:root {
    --bg: #1c1f23;
    --bg-panel: #22262b;
    --bg-inset: #191c20;
    --bg-dark: #141618;
    --border: #2e3338;
    --border-y: #8a7320;
    --yellow: #f5c518;
    --yellow-dk: #c9a010;
    --red: #d94f4f;
    --green: #3a9e6a;
    --text: #d8d2c6;
    --text-dim: #7a8290;
    --text-hd: #ede8e0;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* subtle grid background */
    background-image: 
        linear-gradient(rgba(255, 255, 255, .02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
    background-size: 40px 40px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 18px;
    border: none;
    cursor: pointer;
    transition: all .15s;
    border-radius: 3px;
    text-decoration: none;
}
.btn-primary {
    background: var(--yellow);
    color: #111;
    border: 2px solid var(--yellow);
}
.btn-primary:hover {
    background: var(--yellow-dk);
    border-color: var(--yellow-dk);
}
.btn-outline {
    background: transparent;
    color: var(--yellow);
    border: 1px solid var(--border-y);
}
.btn-outline:hover {
    background: #2a2400;
}
.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* HEADER */
.demo-header {
    background: var(--bg-dark);
    border-bottom: 3px solid var(--yellow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.back-link:hover {
    color: var(--yellow);
}
.brand {
    font-size: 1.1rem;
    color: var(--text-hd);
    font-weight: 800;
    letter-spacing: -.01em;
}
.brand strong {
    color: var(--yellow);
}

/* LAYOUT */
.demo-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    margin-top: 40px;
    margin-bottom: 80px;
    align-items: start;
}
@media (max-width: 900px) {
    .demo-layout {
        grid-template-columns: 1fr;
    }
}

/* SIDEBAR / TABS */
.demo-sidebar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 0;
    position: sticky;
    top: 88px;
}
.demo-tabs {
    display: flex;
    flex-direction: column;
}
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    text-align: left;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-hd);
}
.tab-btn.active {
    background: #2a2400;
    color: var(--yellow);
    border-left-color: var(--yellow);
}

/* MAIN CONTENT */
.demo-section {
    display: none;
    animation: fadeIn 0.3s ease;
}
.demo-section.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.demo-header-info {
    margin-bottom: 24px;
}
.demo-header-info h2 {
    font-size: 28px;
    color: var(--text-hd);
    font-weight: 900;
    letter-spacing: -.02em;
    margin-bottom: 8px;
}
.demo-header-info p {
    color: var(--text-dim);
    font-size: 15px;
}
.demo-footer-cta {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* DASHBOARD COMMON */
.dashboard-area {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-height: 500px;
    position: relative;
    overflow: hidden;
}
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* NOTIFICATION TOAST */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-panel);
    border-left: 4px solid var(--yellow);
    color: var(--text-hd);
    padding: 16px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    animation: slideIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 12px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; }
}

/* SYSTEM 1: PIPELINE */
.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.pipeline-stage {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.stage-header {
    padding: 12px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}
.stage-cards {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 300px;
}
.lead-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 4px;
    cursor: grab;
    transition: border-color .15s;
}
.lead-card:hover { border-color: var(--yellow); }
.lead-card h4 { font-size: 14px; color: var(--text-hd); margin-bottom: 4px; }
.lead-card p { font-size: 12px; color: var(--text-dim); }
.lead-value { margin-top: 8px; font-weight: 700; color: var(--green); font-size: 13px; }

/* SYSTEM 2: ESTIMATING */
.estimate-queue {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.estimate-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 4px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: center;
    gap: 16px;
}
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.badge.new { background: rgba(58, 158, 106, .1); color: var(--green); border: 1px solid rgba(58, 158, 106, .2); }
.badge.draft { background: rgba(245, 197, 24, .1); color: var(--yellow); border: 1px solid rgba(245, 197, 24, .2); }
.badge.sent { background: rgba(122, 130, 144, .1); color: var(--text-dim); border: 1px solid rgba(122, 130, 144, .2); }

.progress-container {
    margin-top: 24px;
    background: var(--bg-panel);
    padding: 24px;
    border-radius: 4px;
    border: 1px dashed var(--border);
    display: none; /* revealed on interaction */
}
.progress-bar-bg {
    background: var(--bg-inset);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-bar-fill {
    background: var(--yellow);
    height: 100%;
    width: 0%;
    transition: width 2s ease;
}

/* SYSTEM 3: BID INTELLIGENCE */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 12px;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 16px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-hd);
}
.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.risk-flag {
    display: flex;
    align-items: center;
    gap: 6px;
}
.risk-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.risk-dot.red { background: var(--red); }
.risk-dot.yellow { background: var(--yellow); }
.risk-dot.green { background: var(--green); }
.score { font-family: 'Courier New', monospace; font-weight: 700; }

.insights-panel {
    position: absolute;
    top: 0; right: -400px;
    width: 400px;
    height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 24px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    transition: right 0.3s ease;
    overflow-y: auto;
}
.insights-panel.open { right: 0; }

/* SYSTEM 4: CASH FLOW */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.metric-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 4px;
}
.metric-card.alert { border-color: var(--red); background: rgba(217, 79, 79, .05); }
.metric-val { font-size: 24px; font-weight: 900; margin-top: 8px; }
.metric-val.red { color: var(--red); }
.metric-val.green { color: var(--green); }
.metric-label { font-size: 12px; color: var(--text-dim); }

/* SYSTEM 5: VENDOR COORDINATION */
.task-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.task-row {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.task-info { display: flex; align-items: center; gap: 16px; }
.avatar {
    width: 32px; height: 32px;
    background: #353a40;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: #fff;
}
.checklist {
    display: flex; gap: 8px; margin-top: 8px;
}
.check-item {
    font-size: 12px; color: var(--text-dim);
    display: flex; align-items: center; gap: 4px;
}
.check-item.done { color: var(--green); text-decoration: line-through; }

/* SYSTEM 6: OPS DASHBOARD */
.chart-container {
    height: 200px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    gap: 16px;
}
.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.bar {
    width: 100%;
    background: var(--yellow);
    border-radius: 2px 2px 0 0;
    transition: height 1s ease;
    min-height: 10px;
}
.bar-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
}
