﻿:root {
    --color-bg-base:     #13161a;
    --color-bg-surface:  #1a1d23;
    --color-border:        #2e333d;
    --color-text-main:  #e2e8f0;
    --color-text-muted: #8892a4;
    --color-active:      #4d94eb;
    --radius-ui:   4px;
    --radius-lg:   4px;

    --brand-accent: var(--color-active);
    --brand-text: var(--color-text-main);

    /* Typography tokens (mirrors base/variables.css for standalone pages) */
    --font-base:  'Inter', system-ui, sans-serif;
    --font-brand: 'Chakra Petch', 'Segoe UI', sans-serif;
    --font-mono:  'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* ── Module surface tokens ── */
    --module-radius-card: var(--radius-lg);
}

.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-ui);
    padding: 6px 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 999;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    width: auto;
    line-height: 1;
}

.theme-toggle:hover {
    background: transparent;
    color: var(--color-text-main);
}

.alzar-brand-logo {
    text-align: center;
}

.alzar-brand-icon {
    font-size: 2.5rem;
    color: var(--brand-accent);
    display: block;
    margin-bottom: 10px;
}

.alzar-brand-logo--hero .alzar-brand-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.alzar-brand-wordmark {
    font-family: var(--font-brand);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.15;
}

.alzar-brand-img {
    display: block;
    margin: 0 auto 12px;
    width: 48px;
    height: 48px;
}

.alzar-brand-logo--hero .alzar-brand-img {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
}

.alzar-brand-logo--hero .alzar-brand-wordmark {
    font-size: 2rem;
    letter-spacing: 0.06em;
}

.alzar-brand-tagline {
    font-family: var(--font-brand);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-active, var(--brand-accent));
    margin: 10px 0 0;
}

.alzar-brand-desc {
    font-size: 0.8125rem;
    color: var(--color-text-muted, #8892a4);
    line-height: 1.65;
    margin: 8px auto 0;
    max-width: 22rem;
}

.alzar-brand-icon {
    display: none;
}

.alzar-brand-alzar {
    color: var(--brand-text);
}

.alzar-brand-logic {
    color: var(--brand-accent);
}

.alzar-brand-mark {
    font-size: 0.38em;
    vertical-align: super;
    color: var(--brand-accent);
    font-weight: 400;
    line-height: 0;
    letter-spacing: 0;
}

/* ── CFO / HQ tab menu system — canonical definition ─────────── */
.cfo-tab-bar {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-surface);
    flex-shrink: 0;
}

.cfo-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-base);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    margin-bottom: -2px;
}

.cfo-tab:hover {
    color: var(--color-text-main);
}

.cfo-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.cfo-tab i {
    font-size: 1.05rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   MODULE SURFACE SYSTEM — canonical chrome for all new SPA modules
   KPI strips = ONE joined bar (.module-kpi-bar), not separate cards.
   Content blocks = .module-panel (single rounded container).
   ═══════════════════════════════════════════════════════════════════════ */

.module-panel,
.dashboard-panel {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--color-text-main);
}

.module-panel:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
}

/* ── Unified KPI strip — manufacturing dashboard pattern ──────────
   One outer shell; cells separated by vertical borders only.        */
.module-kpi-bar,
.dash-status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0;
    margin: 6px 0 20px;
    padding: 0;
    overflow: hidden;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.dash-status-bar {
    position: sticky;
    top: 0;
    z-index: 15;
}

.module-kpi-pill,
.dash-status-pill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    text-align: left;
    background: transparent;
    border: none;
    border-right: 1px solid var(--color-border);
    border-radius: 0;
    padding: 14px 18px;
    margin: 0;
    cursor: pointer;
    font-family: var(--font-base);
    color: var(--color-text-main);
    transition: background var(--transition-base);
    box-shadow: none;
    min-width: 0;
}

.module-kpi-pill:last-child,
.dash-status-pill:last-child {
    border-right: none;
}

.module-kpi-pill:hover,
.dash-status-pill:hover {
    background: var(--color-bg-hover);
}

.module-kpi-pill:focus-visible,
.dash-status-pill:focus-visible {
    outline: 2px solid var(--color-active);
    outline-offset: -2px;
}

.module-kpi-label,
.dsp-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    display: block;
}

.module-kpi-value,
.dsp-value {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text-main);
    line-height: 1.15;
    display: block;
}

.module-kpi-sub {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
    display: block;
}

.module-kpi-icon {
    font-size: 1rem;
    color: var(--color-active);
    margin-bottom: 4px;
    opacity: 0.85;
}

.dsp-delta {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 1px 5px;
    border-radius: var(--radius-control);
    margin-top: 3px;
    letter-spacing: 0.01em;
}
.dsp-delta:empty { display: none; }
.dsp-delta--up   { color: var(--color-success); background: var(--color-success-dim); }
.dsp-delta--down { color: var(--color-danger);  background: var(--color-danger-dim); }

.dsp-track {
    margin-top: 8px;
    width: 100%;
    height: 3px;
    border-radius: var(--radius-control);
    background: var(--color-bg-sunken);
    overflow: hidden;
}

.dsp-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: var(--radius-control);
    background: var(--color-primary);
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Segment tabs — ledger / filter controls (same corner as cards) */
.module-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.module-tab {
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    border-radius: var(--radius-control);
    padding: 5px 12px;
    font-size: var(--font-size-sm);
    font-family: var(--font-base);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
    text-transform: none;
    letter-spacing: normal;
}

.module-tab:hover {
    color: var(--color-text-main);
    border-color: var(--color-border-strong);
}

.module-tab.active {
    background: transparent;
    border-color: var(--color-active);
    color: var(--color-active);
}

[data-module-surface] {
    color: var(--color-text-main);
}

.module-panel-head h3 {
    font-family: var(--font-base);
    font-weight: 600;
    text-transform: none;
    letter-spacing: -0.01em;
    color: var(--color-text-main);
}

.module-panel-head h3 i {
    color: var(--color-active);
}

.panel-stub {
    background: var(--color-bg-sunken);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
    font-family: var(--font-base);
    text-align: center;
    padding: 20px;
}

@media (max-width: 768px) {
    .module-kpi-bar,
    .dash-status-bar {
        grid-template-columns: 1fr;
    }

    .module-kpi-pill,
    .dash-status-pill {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .module-kpi-pill:last-child,
    .dash-status-pill:last-child {
        border-bottom: none;
    }
}

/* Pattern B modal shell — fullscreen wrapper with inner .modal-container
   (pipeline New Deal, workspace provision, CFO dialogs, etc.)
   Reinforced here so module CSS cannot collapse it to position:relative. */
.alzar-modal:has(> .modal-container) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10001;
    background: transparent;
    border: none;
    border-radius: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 20px;
    margin: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.alzar-modal:has(> .modal-container) > .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: rgba(0, 0, 0, 0.5);
    padding: 0;
    display: block;
    cursor: pointer;
    pointer-events: auto;
}

.alzar-modal:has(> .modal-container) > .modal-container {
    position: relative;
    z-index: 1;
    pointer-events: auto;
}