/* ══════════════════════════════════════════════════════════════
   EXECUTIVE DASHBOARD v2 — Enterprise URCOD Dark Theme
   Charcoal background · Single green accent · Restrained typography
   ══════════════════════════════════════════════════════════════ */

/* ── PALETTE ──────────────────────────────────────────────── */
:root {
    --ed-bg: #0F1620;
    --ed-surface: #1A2333;
    --ed-surface-2: #1F2B3D;
    --ed-surface-3: #243244;
    --ed-border: rgba(255,255,255,0.08);
    --ed-border-strong: rgba(255,255,255,0.12);
    --ed-text: #F5F7FA;
    --ed-text-dim: #C8CED8;
    --ed-text-muted: #9CA3AF;
    --ed-accent: #00A651;
    --ed-accent-dim: rgba(0,166,81,0.15);
    --ed-fleet1: #00A651;
    --ed-fleet2: #5B8FA8;
    --ed-fleet3: #B8924A;
    --ed-npt: #DC3545;
    --ed-dead: #E67E22;
    --ed-radius: 10px;
    --ed-radius-sm: 6px;
    --ed-font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

/* Light theme overrides */
[data-theme="light"] {
    --ed-bg: #F3F4F6;
    --ed-surface: #FFFFFF;
    --ed-surface-2: #F9FAFB;
    --ed-surface-3: #E5E7EB;
    --ed-border: rgba(0,0,0,0.08);
    --ed-border-strong: rgba(0,0,0,0.12);
    --ed-text: #111827;
    --ed-text-dim: #374151;
    --ed-text-muted: #6B7280;
    --ed-accent-dim: rgba(0,166,81,0.08);
}

/* ── LAYOUT ───────────────────────────────────────────────── */
.ed-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px 80px;
    font-family: var(--ed-font);
}

/* ── HEADER ───────────────────────────────────────────────── */
.ed-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 0 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.ed-header-left h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ed-text);
    margin: 0;
    letter-spacing: -0.02em;
}

.ed-header-left p {
    font-size: 0.72rem;
    color: var(--ed-text-muted);
    margin: 4px 0 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ed-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ed-month-nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-sm);
    overflow: hidden;
}

.ed-month-btn {
    background: none;
    border: none;
    color: var(--ed-text-muted);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.15s;
    border-right: 1px solid var(--ed-border);
}
.ed-month-btn:last-child { border-right: none; border-left: 1px solid var(--ed-border); }
.ed-month-btn:hover { background: var(--ed-accent-dim); color: var(--ed-accent); }

.ed-month-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ed-text);
    padding: 0 14px;
    min-width: 110px;
    text-align: center;
}

.ed-target-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--ed-text-muted);
}
.ed-target-group label { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.ed-target-input {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    color: var(--ed-text);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 8px;
    border-radius: var(--ed-radius-sm);
    width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s;
}
.ed-target-input:focus { border-color: var(--ed-accent); outline: none; }

.ed-action-btn {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    color: var(--ed-text-muted);
    padding: 7px 12px;
    border-radius: var(--ed-radius-sm);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ed-action-btn:hover { border-color: var(--ed-accent); color: var(--ed-accent); }

/* ── KPI STRIP ────────────────────────────────────────────── */
.ed-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.ed-kpi-tile {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 16px 18px;
    position: relative;
}

.ed-kpi-tile::after {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ed-accent);
}

.ed-kpi-tile-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ed-text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.ed-kpi-tile-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ed-text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ed-kpi-tile-sub {
    font-size: 0.68rem;
    color: var(--ed-text-dim);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

.ed-kpi-delta {
    color: var(--ed-accent);
    font-weight: 700;
    font-size: 0.7rem;
}
.ed-kpi-delta.negative { color: var(--ed-npt); }

/* ── FLEET STATUS CARDS ───────────────────────────────────── */
.ed-fleet-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.ed-fleet-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 18px;
    position: relative;
}

.ed-fleet-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 2px;
    border-radius: 0 0 2px 2px;
}
.ed-fleet-card:nth-child(1)::before { background: var(--ed-fleet1); }
.ed-fleet-card:nth-child(2)::before { background: var(--ed-fleet2); }
.ed-fleet-card:nth-child(3)::before { background: var(--ed-fleet3); }

.ed-fc-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ed-text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ed-fc-name .status-chip {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--ed-accent-dim);
    color: var(--ed-accent);
}

.ed-fc-location {
    font-size: 0.72rem;
    color: var(--ed-text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.ed-fc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ed-fc-stat {
    padding: 8px 10px;
    background: var(--ed-surface-2);
    border-radius: var(--ed-radius-sm);
}

.ed-fc-stat-label {
    font-size: 0.6rem;
    color: var(--ed-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 2px;
}

.ed-fc-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ed-text);
    font-variant-numeric: tabular-nums;
}

.ed-fc-stat-value.accent { color: var(--ed-accent); }
.ed-fc-stat.span-2 { grid-column: span 2; }

/* ── CHART SECTION ────────────────────────────────────────── */
.ed-chart-section {
    margin-bottom: 24px;
}

.ed-chart-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 18px;
}

.ed-chart-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ed-text);
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ed-chart-title .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    background: var(--ed-accent);
}

.ed-chart-wrap {
    position: relative;
    height: 260px;
    width: 100%;
}

/* ── SECTION TITLE ────────────────────────────────────────── */
.ed-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ed-text);
    margin: 28px 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ed-section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--ed-accent);
    border-radius: 2px;
}

/* ── DAILY BREAKDOWN TABLE ────────────────────────────────── */
.ed-breakdown-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.ed-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.ed-breakdown-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.ed-breakdown-table thead th {
    text-align: right;
    padding: 10px 10px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ed-text-muted);
    background: var(--ed-surface-2);
    border-bottom: 1px solid var(--ed-border-strong);
    white-space: nowrap;
}

.ed-breakdown-table thead th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--ed-surface-2);
}

.ed-breakdown-table tbody td {
    padding: 8px 10px;
    color: var(--ed-text);
    border-bottom: 1px solid var(--ed-border);
    text-align: right;
    white-space: nowrap;
    cursor: default;
}

.ed-breakdown-table tbody td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--ed-text-dim);
    position: sticky;
    left: 0;
    background: var(--ed-surface);
    z-index: 1;
}

.ed-breakdown-table tbody tr:hover td { background: rgba(0,166,81,0.03); }
.ed-breakdown-table tbody tr:last-child td { border-bottom: none; }

.ed-breakdown-table .total-row td {
    font-weight: 700;
    border-top: 1px solid var(--ed-border-strong);
    color: var(--ed-accent);
}

.ed-breakdown-table .zero { color: var(--ed-text-muted); opacity: 0.4; }

/* editable cell */
.ed-editable {
    cursor: pointer;
    position: relative;
    transition: background 0.1s;
    min-width: 32px;
}
.ed-editable:hover { background: var(--ed-accent-dim); }

.ed-editable-input {
    background: var(--ed-surface-2);
    border: 1px solid var(--ed-accent);
    color: var(--ed-text);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    width: 48px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    outline: none;
}

.ed-edited-chip {
    display: inline-block;
    font-size: 0.5rem;
    background: rgba(0,166,81,0.15);
    color: var(--ed-accent);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 4px;
    vertical-align: middle;
    cursor: help;
}

.ed-reset-btn {
    display: inline-block;
    font-size: 0.5rem;
    color: var(--ed-text-muted);
    cursor: pointer;
    margin-left: 2px;
    opacity: 0.6;
    vertical-align: middle;
}
.ed-reset-btn:hover { color: var(--ed-npt); opacity: 1; }

/* ── FLEET PERFORMANCE TABLE ──────────────────────────────── */
.ed-perf-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.ed-perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.ed-perf-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ed-text-muted);
    background: var(--ed-surface-2);
    border-bottom: 1px solid var(--ed-border-strong);
    white-space: nowrap;
}

.ed-perf-table thead th.num { text-align: right; }

.ed-perf-table tbody td {
    padding: 12px;
    color: var(--ed-text);
    border-bottom: 1px solid var(--ed-border);
    white-space: nowrap;
}

.ed-perf-table tbody td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ed-perf-table tbody tr:last-child td { border-bottom: none; }
.ed-perf-table tbody tr:hover td { background: rgba(0,166,81,0.03); }

.ed-perf-table .fleet-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}

.ed-perf-table .fleet-name-cell {
    font-weight: 700;
    display: flex;
    align-items: center;
}

.ed-perf-table .total-row td {
    font-weight: 800;
    border-top: 1px solid var(--ed-border-strong);
    color: var(--ed-accent);
}

.ed-perf-table .notes-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
    color: var(--ed-text-dim);
}

/* ── MONTHLY TOTALIZER ────────────────────────────────────── */
.ed-totalizer-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.ed-totalizer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.ed-totalizer-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ed-text-muted);
    background: var(--ed-surface-2);
    border-bottom: 1px solid var(--ed-border-strong);
}

.ed-totalizer-table thead th.num { text-align: right; }

.ed-totalizer-table tbody td {
    padding: 12px;
    color: var(--ed-text);
    border-bottom: 1px solid var(--ed-border);
}

.ed-totalizer-table tbody td.num {
    text-align: right;
    font-weight: 600;
}

.ed-totalizer-table tbody td.total-cell {
    font-weight: 800;
    color: var(--ed-accent);
}

.ed-totalizer-table tbody tr:last-child td { border-bottom: none; }
.ed-totalizer-table tbody tr:hover td { background: rgba(0,166,81,0.03); }

.ed-totalizer-table .current-month td {
    background: var(--ed-accent-dim);
}

/* ── FOOTER ───────────────────────────────────────────────── */
.ed-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.65rem;
    color: var(--ed-text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-top: 1px solid var(--ed-border);
    margin-top: 20px;
}

/* ── LOADING ──────────────────────────────────────────────── */
.ed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
    color: var(--ed-text-dim);
    font-size: 0.82rem;
}

.ed-loading .ed-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--ed-border);
    border-top-color: var(--ed-accent);
    border-radius: 50%;
    animation: ed-spin 0.7s linear infinite;
}

@keyframes ed-spin { to { transform: rotate(360deg); } }

/* ── MOBILE BREAKDOWN CARDS ───────────────────────────────── */
.ed-mobile-days { display: none; }

.ed-mobile-day-card {
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
}

.ed-mobile-day-card .day-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ed-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ed-border);
}

.ed-mobile-day-card .day-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.76rem;
}

.ed-mobile-day-card .day-row-label { color: var(--ed-text-dim); }
.ed-mobile-day-card .day-row-val { font-weight: 700; color: var(--ed-text); font-variant-numeric: tabular-nums; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .ed-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .ed-fleet-cards { grid-template-columns: 1fr; }
    .ed-chart-wrap { height: 200px; }
    .ed-header { flex-direction: column; align-items: stretch; }
    .ed-header-right { flex-wrap: wrap; }
    .ed-breakdown-card { display: none; }
    .ed-mobile-days { display: block; }
    .ed-kpi-tile-value { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .ed-kpi-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
    .ed-wrapper { padding: 0 10px 80px; }
}

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
    .ed-month-nav, .ed-action-btn, .ed-target-group { display: none !important; }
    .ed-wrapper { max-width: 100%; padding: 0; }
    .ed-kpi-tile, .ed-chart-card, .ed-perf-card, .ed-breakdown-card { break-inside: avoid; }
    .ed-mobile-days { display: none !important; }
    .ed-breakdown-card { display: block !important; }
}
