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

/* AXIONARI — Light Editorial "Executive Briefing" system.
   Warm off-white, near-black SERIF headlines (Newsreader) + Inter for UI/data,
   gold used sparingly (logo, labels, rules, target lines), semantic red/green. */
:root {
    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* ── Brand palette (light editorial) ─────────────────────────── */
    --ax-bg: #FAF8F3;          /* warm off-white app bg */
    --ax-bg-2: #F4F1EA;        /* slightly deeper warm (tracks, table headers) */
    --ax-surface-1: #FFFFFF;   /* cards / charts / tables */
    --ax-surface-2: #FDFCFA;   /* elevated chips */
    --ax-gold: #C9A84C;        /* gold — logo, rules, icons, target lines (NOT small text) */
    --ax-gold-light: #E4C87A;
    --ax-gold-text: #8A6A1E;   /* gold-brown for label TEXT (AA on off-white) */
    --ax-ink: #1C1B19;         /* warm near-black */
    --ax-ink-soft: #4A463F;    /* secondary headings / dates */
    --ax-muted: #6F6B62;       /* muted body (AA for small) */
    --ax-faint: #9A958B;       /* faint labels (large only) */
    --ax-taupe: #A89C86;       /* neutral chart bars */
    --ax-red: #C0392B;         /* semantic problem */
    --ax-green: #3D8B5F;       /* semantic positive */
    --ax-hairline: rgba(140, 135, 125, 0.22);
    --ax-hairline-strong: rgba(140, 135, 125, 0.42);
    --ax-gold-hairline: rgba(201, 168, 76, 0.6);
    --ax-elevation: 0 1px 2px rgba(28, 27, 25, 0.05), 0 10px 30px rgba(28, 27, 25, 0.06);

    /* Re-pointed semantic aliases (consumed by components) */
    --content-bg: var(--ax-bg);
    --content-surface: var(--ax-surface-1);
    --text-primary: var(--ax-ink);
    --text-secondary: var(--ax-muted);
    --text-muted: var(--ax-muted);
    --text-inverse: #FFFFFF;
    --border: var(--ax-hairline);
    --primary: var(--ax-gold-text);     /* functional accent that must read as text/focus */
    --error: var(--ax-red);
    --surface: var(--content-surface);
    --surface-hover: var(--ax-bg-2);

    /* KPI sentiment */
    --kpi-blue-text: var(--ax-muted);
    --kpi-green-text: var(--ax-green);
    --kpi-yellow-text: var(--ax-gold-text);
    --kpi-red-text: var(--ax-red);

    /* Project status (progress bars) */
    --status-planning: #B6B0A4;
    --status-execution: var(--ax-taupe);
    --status-review: var(--ax-gold);
    --status-completed: var(--ax-green);
    --status-blocked: var(--ax-red);

    /* Fonts */
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;

    /* Transitions */
    --liquid-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --liquid-normal: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --liquid-slow: 0.45s cubic-bezier(0.23, 1, 0.32, 1);
    --liquid-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-capsule: 50px;
    --radius-full: 9999px;
}

body {
    background: var(--ax-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Header ─────────────────────────────────────────────────────── */
.app-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: clamp(16px, 2.4vw, 26px) clamp(20px, 3.6vw, 56px);
}

.header-left { display: flex; align-items: center; gap: var(--space-md); min-width: 0; }

.header-divider { width: 1px; height: 18px; background: var(--ax-hairline-strong); flex: none; }

.header-client {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ax-gold-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right { display: flex; align-items: center; gap: var(--space-md); flex: none; }
#header-date { font-size: var(--text-sm); color: var(--ax-ink-soft); white-space: nowrap; }
#header-time { font-size: var(--text-sm); white-space: nowrap; }

/* ── Stage (greeting vs briefing) ──────────────────────────────── */
.stage { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.dashboard-content { padding: clamp(16px, 2.2vw, 32px) clamp(20px, 3.6vw, 56px) clamp(32px, 4vw, 56px); }

.stage--greeting #dashboard-content { display: none; }
.stage--briefing #greeting { display: none; }
.stage--briefing #dashboard-content { display: block; }
.stage--greeting .app-footer { display: none; }

/* Greeting / idle */
.greeting {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xl);
    gap: 0;
}
.greeting-title {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(40px, 6vw, 68px);
    letter-spacing: -0.015em;
    color: var(--ax-ink);
    line-height: 1.05;
}
.greeting-sub {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--ax-muted);
    margin-top: var(--space-md);
}
.greeting-hint {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ax-faint);
    margin-top: var(--space-xl);
}

/* Hero mic with concentric rings */
.mic-rings {
    position: relative;
    width: 92px;
    height: 92px;
    margin-top: clamp(28px, 5vw, 52px);
    border-radius: 50%;
    border: 1.5px solid var(--ax-gold);
    background: var(--ax-surface-1);
    color: var(--ax-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--ax-elevation);
    transition: transform var(--liquid-fast), box-shadow var(--liquid-fast);
}
.mic-rings .mic-glyph { width: 34px; height: 34px; }
.mic-rings:hover { transform: translateY(-2px); }
.mic-rings::before, .mic-rings::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid var(--ax-gold);
    opacity: 0;
    pointer-events: none;
}

/* ── Footer / voice bar ────────────────────────────────────────── */
.app-footer {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: clamp(12px, 1.8vw, 22px) clamp(20px, 3.6vw, 56px) clamp(16px, 2vw, 26px);
}

.nav-pill {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--ax-ink-soft);
    background: transparent;
    border: 1px solid var(--ax-hairline-strong);
    border-radius: var(--radius-capsule);
    padding: 9px 18px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color var(--liquid-fast), color var(--liquid-fast), background var(--liquid-fast);
}
.nav-pill:hover:not(:disabled) { border-color: var(--ax-gold-hairline); color: var(--ax-ink); background: var(--ax-surface-2); }
.nav-pill:disabled { opacity: 0.35; cursor: default; }

.voice-cluster { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.voice-row { display: flex; align-items: center; gap: 14px; }

.mic-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1.5px solid var(--ax-gold);
    background: var(--ax-surface-1);
    color: var(--ax-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--ax-elevation);
    transition: transform var(--liquid-fast), background var(--liquid-fast), color var(--liquid-fast);
}
.mic-btn .mic-glyph { width: 24px; height: 24px; }
.mic-btn:hover { transform: translateY(-1px); }
.mic-btn.is-on { background: var(--ax-gold); color: #fff; border-color: var(--ax-gold); }

.waveform { display: flex; align-items: center; gap: 3px; height: 26px; }
.waveform .bar {
    width: 3px;
    height: 22px;
    border-radius: 2px;
    background: var(--ax-gold);
    opacity: 0.45;
    transform: scaleY(0.28);
    transform-origin: center;
    transition: transform var(--liquid-normal), opacity var(--liquid-normal);
}

.mic-prompt { font-size: var(--text-sm); color: var(--ax-muted); text-align: center; min-height: 1.2em; }

/* Waveform motion — gated on session state (and reduced-motion below) */
body.voice--listening .waveform .bar,
body.voice--speaking .waveform .bar { animation: ax-wave 1.1s ease-in-out infinite; opacity: 0.7; }
body.voice--speaking .waveform .bar { animation-duration: 0.62s; opacity: 0.95; }
.waveform .bar:nth-child(1) { animation-delay: 0s; }
.waveform .bar:nth-child(2) { animation-delay: 0.12s; }
.waveform .bar:nth-child(3) { animation-delay: 0.24s; }
.waveform .bar:nth-child(4) { animation-delay: 0.36s; }
.waveform .bar:nth-child(5) { animation-delay: 0.30s; }
.waveform .bar:nth-child(6) { animation-delay: 0.18s; }
.waveform .bar:nth-child(7) { animation-delay: 0.08s; }
.waveform .bar:nth-child(8) { animation-delay: 0.02s; }
@keyframes ax-wave { 0%, 100% { transform: scaleY(0.28); } 50% { transform: scaleY(1); } }

body.voice--listening .mic-rings::before { animation: ax-ring 2.4s ease-out infinite; }
body.voice--listening .mic-rings::after { animation: ax-ring 2.4s ease-out infinite 1.2s; }
body.voice--speaking .mic-rings::before { animation: ax-ring 1.5s ease-out infinite; }
body.voice--speaking .mic-rings::after { animation: ax-ring 1.5s ease-out infinite 0.75s; }
@keyframes ax-ring { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.9); opacity: 0; } }

/* ── Editorial screen head (eyebrow + serif headline + gold rule) ── */
.screen-head { margin-bottom: clamp(20px, 3vw, 34px); }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ax-gold-text);
}
.eyebrow-icon { display: inline-flex; color: var(--ax-gold); }
.eyebrow-icon svg { display: block; }
.screen-title {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(32px, 4.6vw, 54px);
    line-height: 1.05;
    letter-spacing: -0.012em;
    color: var(--ax-ink);
    margin-top: 12px;
}
.screen-subtitle { font-size: var(--text-lg); color: var(--ax-ink-soft); margin-top: 8px; }
.screen-subtitle .sub-soft { color: var(--ax-muted); font-size: var(--text-sm); display: block; margin-top: 2px; }
.gold-rule { width: 52px; height: 2px; background: var(--ax-gold); margin-top: 16px; border-radius: 2px; }

/* ── Executive brief: metric rows + recommendation card ─────────── */
.brief-layout { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(28px, 4vw, 64px); align-items: start; }
.metric-rows { display: flex; flex-direction: column; }
.metric-row { display: flex; align-items: flex-start; gap: 18px; padding: 20px 0; }
.metric-row + .metric-row { border-top: 1px solid var(--ax-hairline); }
.metric-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--ax-gold-hairline);
    color: var(--ax-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.metric-icon svg { display: block; }
.metric-body { min-width: 0; }
.metric-primary { font-size: 19px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.3; }
.metric-value { font-weight: 500; color: var(--ax-ink); }
.metric-row.metric-red .metric-value { color: var(--ax-red); }
.metric-row.metric-green .metric-value { color: var(--ax-green); }
.metric-label { color: var(--ax-ink); font-weight: 400; }
.metric-subtitle { font-size: var(--text-sm); color: var(--ax-muted); margin-top: 4px; }
.trend { font-size: 1rem; font-weight: 600; }
.trend-up { color: var(--ax-green); }
.trend-down { color: var(--ax-red); }
.trend-stable { color: var(--ax-gold-text); }

.rec-card {
    background: var(--ax-surface-1);
    border: 1px solid var(--ax-hairline);
    border-radius: var(--radius-lg);
    padding: clamp(24px, 3vw, 36px);
    box-shadow: var(--ax-elevation);
}
.rec-statement {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.22;
    color: var(--ax-ink);
    margin-top: 16px;
}
.rec-window { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.rec-window-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ax-muted); }
.rec-window-row { display: flex; align-items: center; gap: 10px; }
.rec-window-row .eyebrow-icon { width: 32px; height: 32px; border: 1px solid var(--ax-gold-hairline); border-radius: 50%; align-items: center; justify-content: center; }
.rec-window-value { font-size: var(--text-md); color: var(--ax-ink); }

/* ── Charts ─────────────────────────────────────────────────────── */
.chart-container {
    background: var(--ax-surface-1);
    border: 1px solid var(--ax-hairline);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 2.2vw, 30px);
    box-shadow: var(--ax-elevation);
    position: relative;
}
.chart-canvas { position: relative; height: clamp(260px, 42vh, 460px); }
.chart-canvas canvas { width: 100% !important; height: 100% !important; }

.legend-row { display: flex; justify-content: center; gap: 28px; margin-top: 18px; }
.legend-chip { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ax-muted); }
.legend-swatch { width: 22px; display: inline-block; }
.legend-swatch.solid { height: 3px; border-radius: 2px; background: var(--ax-red); }
.legend-swatch.dashed { height: 0; border-top: 2px dashed var(--ax-gold); }

/* Summary strip under a chart (objetivo / actual / note) */
.chart-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(16px, 3vw, 40px);
    margin-top: 16px;
    padding: 18px clamp(18px, 2.2vw, 28px);
    background: var(--ax-surface-1);
    border: 1px solid var(--ax-hairline);
    border-radius: var(--radius-lg);
}
.chart-summary .summary-stat { display: flex; flex-direction: column; }
.chart-summary .summary-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ax-muted); }
.chart-summary .summary-value { font-size: var(--text-xl); font-weight: 500; }

/* Gauge */
.gauge-wrap { position: relative; width: 100%; max-width: 440px; height: clamp(210px, 32vh, 320px); margin: 0 auto; }
.gauge-value {
    position: absolute;
    left: 50%;
    top: 62%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: var(--text-2xl);
    font-weight: 500;
    line-height: 1.1;
    pointer-events: none;
    color: var(--ax-ink);
}
.gauge-label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--ax-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: var(--space-xs); }
.gauge-target { display: block; font-size: var(--text-xs); color: var(--ax-muted); margin-top: 2px; }

/* ── Project tracker ────────────────────────────────────────────── */
.delivery-tracker { display: flex; flex-direction: column; gap: var(--space-md); }
.delivery-item {
    background: var(--ax-surface-1);
    border: 1px solid var(--ax-hairline);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--ax-elevation);
    transition: border-color var(--liquid-fast), transform var(--liquid-fast);
}
.delivery-item:hover { border-color: var(--ax-gold-hairline); transform: translateX(3px); }
.delivery-header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--ax-hairline); }
.delivery-id { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-lg); font-weight: 500; color: var(--ax-ink); }
.delivery-eta { font-size: var(--text-sm); color: var(--ax-muted); background: var(--ax-bg-2); border: 1px solid var(--ax-hairline); padding: 4px 12px; border-radius: var(--radius-capsule); white-space: nowrap; }
.delivery-route { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-md); font-size: var(--text-sm); color: var(--ax-ink); flex-wrap: wrap; }
.route-origin, .route-destination { display: inline-flex; align-items: center; gap: 8px; color: var(--ax-muted); }
.route-arrow { color: var(--ax-faint); }
.progress-row { display: flex; align-items: center; gap: var(--space-md); }
.progress-container { position: relative; flex: 1; height: 10px; background: var(--ax-bg-2); border-radius: var(--radius-capsule); overflow: hidden; border: 1px solid var(--ax-hairline); }
.progress-bar { height: 100%; border-radius: var(--radius-capsule); transition: width 0.6s var(--liquid-ease); background: var(--ax-taupe); }
.progress-bar.status-planning { background: var(--status-planning); }
.progress-bar.status-execution { background: var(--status-execution); }
.progress-bar.status-review { background: var(--status-review); }
.progress-bar.status-completed { background: var(--status-completed); }
.progress-bar.status-blocked { background: var(--status-blocked); }
.progress-pct { font-size: var(--text-sm); font-weight: 500; color: var(--ax-ink); min-width: 42px; text-align: right; }

/* ── Data table ─────────────────────────────────────────────────── */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.data-table { width: 100%; border-collapse: collapse; background: var(--ax-surface-1); border: 1px solid var(--ax-hairline); border-radius: var(--radius-md); overflow: hidden; }
.data-table th { background: var(--ax-bg-2); border-bottom: 1px solid var(--ax-hairline); padding: 14px 16px; text-align: left; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ax-ink-soft); position: sticky; top: 0; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--ax-hairline); font-size: var(--text-sm); color: var(--ax-ink); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--ax-bg-2); }

/* ── States ─────────────────────────────────────────────────────── */
.error-state, .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-2xl); text-align: center; gap: var(--space-md); }
.error-state { color: var(--ax-red); }
.empty-state { color: var(--ax-muted); }
.error-state .error-message { font-size: var(--text-lg); font-weight: 500; }
.error-state .error-details { font-size: var(--text-sm); color: var(--ax-muted); max-width: 400px; }
.empty-state .empty-message { font-size: var(--text-lg); font-weight: 500; color: var(--ax-ink-soft); }
.empty-state .empty-details { font-size: var(--text-sm); max-width: 400px; }

.loading { position: relative; pointer-events: none; opacity: 0.6; }
.loading::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; border: 2px solid var(--ax-hairline); border-top: 2px solid var(--ax-gold-text); border-radius: var(--radius-full); animation: ax-spin 1s linear infinite; }
@keyframes ax-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.retry-button { background: var(--ax-ink); color: #fff; border: none; padding: 10px 22px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; cursor: pointer; margin-top: var(--space-md); transition: filter var(--liquid-fast); }
.retry-button:hover { filter: brightness(1.15); }

/* Focus visibility (gold-brown ≥3:1 on light) */
button:focus-visible, .nav-pill:focus-visible, .mic-btn:focus-visible, .mic-rings:focus-visible {
    outline: 2px solid var(--ax-gold-text);
    outline-offset: 2px;
}

/* Scrollbar */
.stage::-webkit-scrollbar { width: 10px; }
.stage::-webkit-scrollbar-thumb { background: var(--ax-hairline-strong); border-radius: 6px; border: 3px solid var(--ax-bg); background-clip: padding-box; }
.stage::-webkit-scrollbar-thumb:hover { background: var(--ax-faint); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .brief-layout { grid-template-columns: 1fr; gap: var(--space-xl); }
}
@media (max-width: 768px) {
    .header-client { font-size: 11px; }
    .legend-row { gap: 18px; }
    .chart-summary { gap: var(--space-md); }
}
@media (max-width: 600px) {
    .app-header { flex-wrap: wrap; gap: var(--space-sm); }
    #header-date { display: none; }
    .header-divider { display: none; }
    .delivery-header { flex-direction: column; align-items: flex-start; gap: var(--space-xs); }
    .nav-pill { padding: 8px 12px; font-size: var(--text-xs); }
}
@media (max-width: 480px) {
    .greeting-title { font-size: 38px; }
    .mic-btn { width: 50px; height: 50px; }
    .waveform { display: none; }     /* keep the mic centered & uncrowded on phones */
    .app-footer { padding-left: var(--space-md); padding-right: var(--space-md); }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .waveform .bar { transform: scaleY(0.5); }
}
