/* ---------- DXR-inspired dark mode ---------- */
:root {
    --bg:          #0a0f1a;
    --bg-soft:     #10172a;
    --surface:     #131b2e;
    --surface-2:   #1a2238;
    --border:      #232d47;
    --border-soft: #1c2540;

    --text:        #e6eaf2;
    --text-muted:  #8f9bb3;
    --text-dim:    #5b6887;

    --accent:      #00CA72;
    --accent-dim:  rgba(0, 202, 114, 0.14);
    --accent-glow: rgba(0, 202, 114, 0.4);
    --blue:        #3B82F6;
    --blue-dim:    rgba(59, 130, 246, 0.14);
    --blue-glow:   rgba(59, 130, 246, 0.4);
    --purple:      #8B5CF6;
    --amber:       #F59E0B;
    --red:         #ef4444;

    --radius:      10px;
    --radius-lg:   14px;
    --shadow:      0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #f5f7fa;
    margin: 0;
}

.table-section-heading {
    margin: 28px 0 12px;
}
.table-section-heading h2 {
    font-size: 16px;
    color: #cbd5e1;
}
.table-section-heading .th-sub {
    color: #64748b;
    font-weight: 400;
    font-size: 14px;
    margin-left: 4px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #60a5fa; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-soft);
}

/* ---------- Topbar with primary tabs ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 14px 28px;
    background: rgba(19, 27, 46, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand strong {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #f5f7fa;
}
.logo-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}
.demo-badge {
    margin-left: 8px;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #1c1002;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.primary-tabs {
    display: flex;
    gap: 8px;
    flex: 1;
}
.primary-tab {
    padding: 10px 24px;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
    transition: all 0.18s ease;
    position: relative;
}
.primary-tab:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    border-color: var(--border);
}
.primary-tab.setting.active {
    background: linear-gradient(135deg, var(--accent), #00a35d);
    color: #062a1a;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(0,202,114,0.3), 0 6px 18px var(--accent-glow);
}
.primary-tab.closing.active {
    background: linear-gradient(135deg, var(--blue), #2563EB);
    color: #fff;
    border-color: var(--blue);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.3), 0 6px 18px var(--blue-glow);
}

.topbar-right { display: inline-flex; gap: 18px; align-items: center; }
.meta-link { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.meta-link:hover { color: var(--text); text-decoration: none; }

/* ---------- Sync status badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    margin-right: 6px;
    border: 1px solid transparent;
}
.badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge.ok      { background: rgba(0,202,114,0.12); color: #34d399; border-color: rgba(0,202,114,0.3); }
.badge.running { background: rgba(59,130,246,0.14); color: #60a5fa; border-color: rgba(59,130,246,0.35); }
.badge.idle    { background: rgba(92,104,135,0.14); color: var(--text-muted); border-color: var(--border); }
.badge.error   { background: rgba(239,68,68,0.14); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.next          { color: var(--text-dim); font-size: 11.5px; }

/* ---------- Layout ---------- */
main {
    padding: 28px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ---------- Hero / period row ---------- */
.hero {
    margin-bottom: 24px;
}
.hero-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 14px;
}
.period-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.tabs {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 4px;
    gap: 2px;
}
.tabs .tab {
    padding: 7px 16px;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tabs .tab:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}
.period-tabs .tab.active {
    background: var(--surface-2);
    color: #fff;
    border: 1px solid var(--border);
    font-weight: 600;
}
.range-info {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 12px;
    text-align: right;
    line-height: 1.45;
}
.range-info strong {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { margin-bottom: 10px; }
.breadcrumb a { color: var(--text-muted); font-size: 13px; }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }

.detail-head { margin-bottom: 24px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding: 16px 20px 0;
    margin-bottom: 16px;
}

/* ---------- Stats grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.05), transparent 40%);
    pointer-events: none;
}
.stat-card.accent::before {
    background: linear-gradient(135deg, rgba(0,202,114,0.09), transparent 45%);
}
.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-sub {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.stat-card.accent .stat-value { color: var(--accent); }

/* ---------- Chart ---------- */
.chart-wrap {
    padding: 16px 18px;
    margin-bottom: 20px;
    height: 220px;
}

/* ---------- Buttons ---------- */
button, .preset-btn {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
}
button:hover { background: var(--border); border-color: #334155; }
button.primary {
    background: var(--accent);
    color: #062a1a;
    border-color: var(--accent);
    font-weight: 600;
}
button.primary:hover { background: #00b765; border-color: #00b765; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

.sync-trigger-form { margin: 0; padding: 0; display: inline-flex; }
.sync-trigger-btn {
    background: var(--accent);
    color: #062a1a;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.sync-trigger-btn:hover { background: #00b765; border-color: #00b765; }

/* ---------- Tables ---------- */
.table-card { padding: 0; }
.kpi-table, .runs {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}
.kpi-table th, .kpi-table td,
.runs th, .runs td {
    padding: 6px 9px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}
.kpi-table thead th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    line-height: 1.25;
    vertical-align: bottom;
}
.kpi-table thead th.num { white-space: normal; }
.kpi-table thead th:first-child { white-space: nowrap; }
.kpi-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s ease;
}
.kpi-table th.sortable:hover { color: var(--text); }
.kpi-table th .sort-indicator {
    display: inline-block;
    width: 10px;
    margin-left: 2px;
    opacity: 0.35;
    font-size: 10px;
    transition: opacity 0.12s ease;
}
.kpi-table th .sort-indicator::before { content: "↕"; }
.kpi-table th.sorted-asc  .sort-indicator::before { content: "↑"; }
.kpi-table th.sorted-desc .sort-indicator::before { content: "↓"; }
.kpi-table th.sorted-asc, .kpi-table th.sorted-desc { color: var(--accent); }
.kpi-table th.sorted-asc .sort-indicator,
.kpi-table th.sorted-desc .sort-indicator { opacity: 1; color: var(--accent); }
.kpi-table td.num, .kpi-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.kpi-table td.num { color: var(--text); font-weight: 500; }
.kpi-table td.zero { color: var(--text-dim); font-weight: 400; }
.kpi-table td.none { color: var(--text-dim); }
.kpi-table td.pct { color: var(--accent); font-weight: 600; }
.kpi-table td.pct.zero { color: var(--text-dim); font-weight: 400; }
.kpi-table td.money { color: #fff; font-weight: 600; }
.kpi-table td.money.zero { color: var(--text-dim); font-weight: 400; }
.kpi-table td.money.stacked { padding-top: 4px; padding-bottom: 4px; line-height: 1.25; }

/* Inline goal progress bar under KPI values */
.goal-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    height: 6px;
}
.goal-track {
    flex: 1;
    height: 4px;
    background: var(--bg-soft);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
}
.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.goal-bar.reached .goal-fill {
    background: linear-gradient(90deg, #00CA72, #10B981);
    box-shadow: 0 0 6px rgba(0, 202, 114, 0.6);
}
.goal-check {
    color: var(--accent);
    font-weight: 700;
    font-size: 11px;
    text-shadow: 0 0 6px rgba(0, 202, 114, 0.7);
    animation: goalGlow 2s ease-in-out infinite;
}
@keyframes goalGlow {
    0%, 100% { text-shadow: 0 0 6px rgba(0, 202, 114, 0.5); }
    50% { text-shadow: 0 0 12px rgba(0, 202, 114, 0.9); }
}

/* Primary tab: Challenges variant */
.primary-tab.challenges.active {
    background: linear-gradient(135deg, #A855F7, #7C3AED);
    color: #fff;
    border-color: #A855F7;
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.3), 0 6px 18px rgba(168, 85, 247, 0.4);
}
.primary-tab.projections.active {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #1c1002;
    border-color: #F59E0B;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3), 0 6px 18px rgba(245, 158, 11, 0.4);
}
.primary-tab.call-analysis.active {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    color: #03222a;
    border-color: #06B6D4;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.3), 0 6px 18px rgba(6, 182, 212, 0.4);
}

/* Call-analysis cards */
.call-card { padding: 20px 22px; margin-bottom: 16px; }
.call-head {
    display: flex; justify-content: space-between; gap: 20px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border-soft);
    margin-bottom: 16px; flex-wrap: wrap;
}
.call-eyebrow {
    color: var(--text-muted); font-size: 11.5px; font-weight: 500;
    letter-spacing: 0.04em; margin-bottom: 6px;
}
.call-title { font-size: 18px; margin: 0 0 4px; }
.call-contact { color: var(--text-muted); font-size: 13px; }
.call-contact .sep { color: var(--text-dim); margin: 0 6px; }
.call-status { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.call-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.call-duration {
    font-family: 'Poppins', sans-serif; font-size: 28px; font-weight: 700;
    color: #06B6D4; font-variant-numeric: tabular-nums;
}
.call-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-lead, .btn-call {
    padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
    border: 1px solid; white-space: nowrap;
}
.btn-lead {
    background: rgba(59,130,246,0.14); color: var(--blue);
    border-color: rgba(59,130,246,0.4);
}
.btn-lead:hover { background: var(--blue); color: #fff; text-decoration: none; }
.btn-call {
    background: rgba(6,182,212,0.16); color: #67E8F9;
    border-color: rgba(6,182,212,0.45);
}
.btn-call:hover { background: #06B6D4; color: #03222a; text-decoration: none; }

.call-body {
    display: grid; grid-template-columns: minmax(280px, 1fr) 2fr;
    gap: 24px;
}
.rec-label {
    color: var(--text-muted); font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.call-recording audio { width: 100%; max-width: 320px; }
.rec-none { color: var(--text-dim); font-size: 13px; font-style: italic; }
.transcript-html, .transcript-text {
    background: var(--bg-soft); border: 1px solid var(--border-soft);
    border-radius: 8px; padding: 12px 14px; color: var(--text);
    font-size: 13px; line-height: 1.5; max-height: 360px; overflow-y: auto;
}
.transcript-html p { margin: 0 0 8px; }
.transcript-html br { content: ""; display: block; margin: 4px 0; }
.transcript-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: pre-wrap; }
.transcript-empty {
    color: var(--text-dim); font-size: 13px; padding: 12px 0;
    font-style: italic;
}
.transcript-empty a { font-style: normal; }

.transcript-speakers {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.speaker-chip {
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px;
    font-weight: 600; border: 1px solid;
}
.speaker-chip.side-close-user {
    background: rgba(6,182,212,0.14); color: #67E8F9; border-color: rgba(6,182,212,0.4);
}
.speaker-chip.side-contact {
    background: rgba(168,85,247,0.14); color: #C4B5FD; border-color: rgba(168,85,247,0.4);
}
.transcript-summary, .transcript-full {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
}
.transcript-summary summary, .transcript-full summary {
    cursor: pointer; color: var(--accent); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.transcript-summary[open] summary, .transcript-full[open] summary { margin-bottom: 10px; }
.transcript-summary-body { color: var(--text); line-height: 1.6; }
.transcript-summary-body ul { padding-left: 20px; margin: 0; }
.transcript-summary-body li { margin-bottom: 4px; }

.transcript-utterances { max-height: 420px; overflow-y: auto; padding-right: 4px; }
.utterance { margin-bottom: 10px; padding: 8px 12px; border-radius: 6px; }
.utterance.side-close-user { background: rgba(6,182,212,0.08); border-left: 2px solid #06B6D4; }
.utterance.side-contact { background: rgba(168,85,247,0.08); border-left: 2px solid #A855F7; }
.utterance-meta {
    display: flex; justify-content: space-between; margin-bottom: 3px;
    font-size: 11px; color: var(--text-muted);
}
.utterance-speaker { font-weight: 600; color: var(--text); font-size: 11.5px; }
.utterance-time { font-variant-numeric: tabular-nums; }
.utterance-text { color: var(--text); font-size: 13px; line-height: 1.5; }

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

/* ---------- Long-calls tab (Calls): list + transcript master/detail ---------- */
.primary-tab.long-calls.active {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    color: #03222a;
    border-color: #06B6D4;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.3), 0 6px 18px rgba(6, 182, 212, 0.4);
}

/* ---------- Provisionsrechner tab: calculator + matrix + params editor ---------- */
.primary-tab.commission-calc.active { color: var(--accent); }

.calc-layout {
    display: grid;
    grid-template-columns: minmax(320px, 380px) 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 1000px) {
    .calc-layout { grid-template-columns: 1fr; }
}

.calc-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.calc-card h2 {
    margin: 0 0 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
}

.calc-grid { display: flex; flex-direction: column; gap: 12px; }

/* Modell-Umschalter (Setting Provisionierung / 3 Monate Ramping) */
.model-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.model-opt {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}
.model-opt:hover { color: var(--text); }
.model-opt.active {
    background: var(--accent-dim);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.model-opt input { position: absolute; opacity: 0; pointer-events: none; }
.calc-grid label {
    display: flex; flex-direction: column; gap: 5px;
    font-size: 13px; color: var(--text-muted);
}
.calc-grid input {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 9px 11px;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.calc-grid input:focus { outline: none; border-color: var(--accent); }
.calc-grid .primary { margin-top: 4px; }

/* Euro-Eingabe: gruppierte Zahl mit fixem €-Suffix */
.eur-input { position: relative; display: block; }
.eur-input input { width: 100%; padding-right: 30px; }
.eur-suffix {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}

/* Schieberegler unter jedem Zahlenfeld */
.calc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: var(--border);
    cursor: pointer;
}
.calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #062a1a;
    box-shadow: 0 2px 6px rgba(0, 202, 114, 0.5);
    cursor: pointer;
}
.calc-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #062a1a;
    box-shadow: 0 2px 6px rgba(0, 202, 114, 0.5);
    cursor: pointer;
}
.calc-slider:focus { outline: none; }
.calc-slider:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(0, 202, 114, 0.25); }

.calc-breakdown { margin-top: 18px; border-top: 1px solid var(--border-soft); }
.calc-line {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border-soft);
}
.calc-label { color: var(--text-muted); font-size: 13px; display: flex; flex-direction: column; }
.calc-sub { color: var(--text-dim); font-size: 11.5px; margin-top: 2px; }
.calc-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.calc-line.calc-total { border-bottom: none; padding-top: 14px; }
.calc-line.calc-total .calc-label { color: var(--text); font-weight: 600; font-size: 14px; }
.calc-line.calc-total .calc-val { color: var(--accent); font-size: 20px; }

/* Cost / unit-economics overview */
.cost-overview { border-top: none; }
.cost-block { margin-top: 14px; }
.cost-block:first-child { margin-top: 0; }
.cost-block-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
}
.calc-line.cost-revenue .calc-val { color: var(--text); font-size: 18px; }
.calc-line.calc-subtotal { border-top: 1px solid var(--border-soft); }
.calc-line.calc-subtotal .calc-label,
.calc-line.calc-subtotal .calc-val { color: var(--text); font-weight: 600; }
.calc-line.cost-profit.is-negative .calc-val { color: #ff5d5d; }

.matrix-scroll { overflow-x: auto; }
.commission-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}
.commission-matrix th, .commission-matrix td {
    padding: 7px 9px;
    border: 1px solid var(--border-soft);
    text-align: right;
    white-space: nowrap;
}
.commission-matrix thead th {
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 600;
    position: sticky; top: 0;
}
.commission-matrix .mx-rate, .commission-matrix .mx-appts {
    text-align: left;
    color: var(--text-muted);
    background: var(--bg-soft);
    position: sticky; left: 0;
}
.commission-matrix tbody tr:hover td { background: rgba(0, 202, 114, 0.06); }
.commission-matrix th .col-pct {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 500;
    color: var(--accent);
}
.commission-matrix tbody td.num { color: var(--text); }

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.param-block h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    color: var(--text);
}
.param-table input {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 6px 8px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.param-table input:focus { outline: none; border-color: var(--accent); }

.calls-split {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 1.5fr;
    gap: 20px;
    align-items: start;
}
.calls-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: calc(100vh - 230px);
    overflow-y: auto;
    padding-right: 4px;
}
.call-row {
    text-align: left; width: 100%; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: 10px; padding: 12px 14px; color: var(--text);
    font-family: inherit; transition: all 0.15s ease;
}
.call-row:hover { background: var(--surface-2); border-color: var(--border); }
.call-row.active {
    border-color: #06B6D4;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.08);
}
.call-row-top { display: flex; justify-content: space-between; align-items: baseline; }
.call-row-date { color: var(--text-muted); font-size: 12px; }
.call-row-duration {
    font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 15px;
    color: #06B6D4; font-variant-numeric: tabular-nums;
}
.call-row-lead { font-size: 14.5px; font-weight: 600; margin: 4px 0 2px; }
.call-row-meta { color: var(--text-muted); font-size: 12px; }

.transcript-panel-wrap { position: sticky; top: 20px; }
.transcript-panel {
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg); padding: 18px 20px;
    min-height: 420px; max-height: calc(100vh - 230px); overflow-y: auto;
}
.transcript-panel-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; gap: 12px;
}
.transcript-placeholder {
    color: var(--text-dim); font-size: 14px; font-style: italic;
    padding: 48px 0; text-align: center;
}
.transcript-textarea {
    width: 100%; min-height: 340px; resize: vertical;
    background: var(--bg-soft); border: 1px solid var(--border-soft);
    border-radius: 8px; padding: 12px 14px; color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px; line-height: 1.55; margin-bottom: 8px;
}
.transcript-loading {
    display: none; color: #67E8F9; font-size: 13px; margin-bottom: 8px;
}
.transcript-loading.htmx-request { display: block; }

@media (max-width: 900px) {
    .calls-split { grid-template-columns: 1fr; }
    .transcript-panel-wrap { position: static; }
    .calls-list { max-height: none; }
}

/* Projections page */
.projections-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 10px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.projections-meta .sep { color: var(--text-dim); }
.projections-meta strong { color: var(--text); font-variant-numeric: tabular-nums; }
.projections-meta code {
    background: var(--bg-soft);
    padding: 2px 8px;
    font-size: 11.5px;
    color: var(--accent);
}

.projections-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.month-picker select, .new-month-form input[type=month] {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
}
.new-month-form { display: inline-flex; gap: 8px; align-items: center; margin-left: auto; }

.projection-card { padding: 0; margin-bottom: 18px; }

/* Two-level header */
.projections-table th.kpi-group {
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 10px 8px;
}
.projections-table th.kpi-group + th.kpi-group {
    border-left: 1px solid var(--border);
}
.projections-table tr.sub-head th {
    text-align: center;
    font-size: 10.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 7px 8px;
}
/* Divider between KPI groups (every 3rd sub-header starting from 2nd) */
.projections-table tr.sub-head th.sub-ziel { border-left: 1px solid var(--border); }
.projections-table tr.sub-head th.sub-ziel:nth-child(2) { border-left: 1px solid var(--border); }

.projections-table td.user {
    font-weight: 600;
    color: #fff;
    font-size: 13.5px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
}
.projections-table td.proj-sub {
    padding: 8px 10px;
    text-align: center;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.projections-table td.proj-sub.ziel { border-left: 1px solid var(--border); text-align: center; }
.projections-table td.proj-sub.aktuell { color: var(--text); font-weight: 500; }
.projections-table td.proj-sub.pace { color: var(--text-dim); }
.projections-table td.proj-sub.pace.active { color: #F59E0B; font-weight: 700; }
.projections-table td.proj-sub.pace.reached { color: var(--accent); }
.projections-table td.proj-sub.reached { background: rgba(0,202,114,0.06); }

.projections-table td.proj-sub a.drill {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    padding-bottom: 1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.projections-table td.proj-sub a.drill:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Strip the native number-spinner arrows everywhere — they don't fit the
   monochrome dashboard look and clutter narrow inputs. */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.proj-input {
    width: 100px;
    background: var(--bg-soft);
    color: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.proj-input::placeholder { color: rgba(255,255,255,0.25); }
.proj-input:hover { border-color: rgba(255,255,255,0.18); }
.proj-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,202,114,0.04);
    box-shadow: 0 0 0 3px rgba(0,202,114,0.18);
}

.role-select {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12.5px;
    font-family: inherit;
}

/* Goals table tweak */
.goals-table input[type=number] {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    text-align: right;
}

/* Challenge form grid */
.challenge-form { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 18px 20px; }
.challenge-form .edit-banner {
    margin: -18px -20px 16px;
    padding: 10px 20px;
    background: rgba(168, 85, 247, 0.14);
    color: #d8b4fe;
    border-bottom: 1px solid rgba(168, 85, 247, 0.35);
    font-size: 13px;
}
.challenge-form .edit-banner a { color: #d8b4fe; text-decoration: underline; }
.btn-ghost {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 500;
    background: transparent;
    margin-left: 6px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.challenge-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.challenge-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}
.challenge-form input, .challenge-form select {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
}

/* Challenge card + leaderboard */
.challenge-card { padding: 22px 24px 24px; margin-bottom: 20px; }
.challenge-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}
.challenge-eyebrow {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.challenge-title {
    font-size: 22px;
    margin: 0 0 6px;
}
.challenge-desc {
    color: var(--text-muted);
    font-size: 13px;
}
.challenge-meta {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.challenge-meta .meta-label {
    color: var(--text-muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.challenge-meta .meta-value {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.challenge-meta .meta-value.bonus {
    background: linear-gradient(135deg, #FFD54A, #F6B73C);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.challenge-board { display: flex; flex-direction: column; gap: 6px; }
.board-row {
    display: grid;
    grid-template-columns: 38px 1fr 2fr 140px;
    gap: 14px;
    align-items: center;
    padding: 10px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.015);
    transition: background 0.15s ease;
}
.board-row:hover { background: rgba(255,255,255,0.03); }
.board-row.reached {
    background: linear-gradient(90deg, rgba(0,202,114,0.1), rgba(0,202,114,0.02));
    border: 1px solid rgba(0,202,114,0.25);
}
.board-rank { text-align: center; }
.board-rank .rank-num {
    color: var(--text-dim);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 13px;
}
.board-name {
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.board-row.reached .board-name { color: #fff; font-weight: 600; }
.board-progress .progress-track {
    height: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    overflow: hidden;
}
.board-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
    border-radius: 5px;
    transition: width 0.4s ease;
}
.board-progress .progress-bar.reached {
    background: linear-gradient(90deg, #00CA72, #10B981);
    box-shadow: 0 0 10px rgba(0,202,114,0.55);
}
.board-value {
    text-align: right;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.board-value .board-pct {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}
.board-row.reached .board-value { color: var(--accent); }
.kpi-table td.money.stacked .money-primary { font-weight: 600; }
.kpi-table td.money.stacked a.money-primary { display: block; }
.kpi-table td.money.stacked .money-sub { color: var(--text-muted); font-size: 11.5px; font-weight: 400; }
.kpi-table td.money.stacked.zero .money-primary { color: var(--text-dim); font-weight: 400; }
.kpi-table th .th-sub { color: var(--text-dim); font-size: 9.5px; font-weight: 500; letter-spacing: 0.04em; }
.kpi-table tbody tr:hover { background: rgba(59,130,246,0.04); }
.kpi-table tr.total td {
    font-weight: 700;
    background: var(--bg-soft);
    color: #fff;
    border-top: 2px solid var(--border);
    border-bottom: none;
}
.kpi-table tr.total td.pct { color: var(--accent); }

.kpi-table td.user {
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}
.user-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 500;
}
.user-link:hover { color: var(--accent); text-decoration: none; }
.user-arrow { color: var(--text-dim); font-size: 15px; transition: all 0.15s ease; }
.user-link:hover .user-arrow { color: var(--accent); transform: translateX(2px); }

.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #1c1304;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.medal-1 {
    background: linear-gradient(135deg, #FFD54A 0%, #F6B73C 50%, #C48A18 100%);
    box-shadow: 0 0 0 1px rgba(246, 183, 60, 0.35), 0 0 12px rgba(246, 183, 60, 0.4);
}
.medal-2 {
    background: linear-gradient(135deg, #E8EEF5 0%, #C3CFDC 50%, #7F8C99 100%);
    box-shadow: 0 0 0 1px rgba(195, 207, 220, 0.35), 0 0 10px rgba(195, 207, 220, 0.3);
    color: #0e1726;
}
.medal-3 {
    background: linear-gradient(135deg, #E39055 0%, #C97435 50%, #8C4A1E 100%);
    box-shadow: 0 0 0 1px rgba(201, 116, 53, 0.35), 0 0 10px rgba(201, 116, 53, 0.35);
    color: #2a1106;
}

.kpi-table .empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    font-style: italic;
}

/* ---------- Funnel ---------- */
.funnel-card { padding-bottom: 22px; margin-bottom: 20px; }
.funnel-wrap {
    padding: 8px 20px 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.funnel-svg {
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,0.45));
}
.funnel-stage-label {
    fill: rgba(255,255,255,0.88);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.funnel-stage-value {
    fill: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 26px;
    font-weight: 700;
}
.funnel-conv-name {
    fill: var(--accent);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.funnel-conv-formula {
    fill: rgba(255,255,255,0.7);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 400;
}
.funnel-conv-value {
    fill: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    dominant-baseline: middle;
}

/* used by split section */
.funnel-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.funnel-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.funnel-value {
    font-family: 'Poppins', sans-serif;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.funnel-track {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    height: 32px;
    overflow: hidden;
    position: relative;
}
.funnel-bar {
    height: 100%;
    border-radius: 7px;
    transition: width 0.3s ease;
    opacity: 0.92;
}

.funnel-split {
    margin-top: 24px;
    padding: 18px 28px 4px;
    border-top: 1px solid var(--border-soft);
}
.split-title {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
}
.split-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.split-item .funnel-track { height: 28px; }
.split-item .funnel-value { font-size: 18px; }

/* ---------- KPI mini grid ---------- */
.detail-kpis { padding: 0 0 20px 0; }
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--border-soft);
    border-top: 1px solid var(--border-soft);
}
.kpi-mini {
    background: var(--surface);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-mini-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.kpi-mini-value {
    font-family: 'Poppins', sans-serif;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.kpi-mini-value.pct { color: var(--accent); }
.kpi-mini-sub { color: var(--text-dim); font-size: 11px; margin-top: 2px; }

/* Clickable KPI mini cards + drill links */
.kpi-mini-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
}
.kpi-mini-link:hover { background: var(--surface-2); text-decoration: none; }
.kpi-mini-link:hover .kpi-mini-value { color: var(--accent); }
.kpi-mini-link::after {
    content: "›";
    position: absolute;
    right: 14px; top: 14px;
    color: var(--text-dim);
    font-size: 14px;
    transition: all 0.15s ease;
}
.kpi-mini-link:hover::after { color: var(--accent); transform: translateX(2px); }

.kpi-table td.num a.drill {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    padding-bottom: 1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.kpi-table td.num a.drill:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.funnel-stage-link { cursor: pointer; }
.funnel-stage-link:hover path { filter: brightness(1.1); }

.split-item { display: block; }
.split-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 8px;
    margin: -8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.split-link:hover { background: var(--surface-2); text-decoration: none; }

/* Leads drill-down list */
.leads-list .contact-cell { line-height: 1.3; }
.leads-list .contact-name { color: var(--text); font-weight: 500; }
.leads-list .contact-sub { color: var(--text-muted); font-size: 12px; }
.leads-list .status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 12px;
    font-weight: 500;
}
.leads-list .close-link {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    font-size: 12.5px;
    border: 1px solid rgba(0, 202, 114, 0.35);
    white-space: nowrap;
}
.leads-list .close-link:hover {
    background: var(--accent);
    color: #062a1a;
    text-decoration: none;
}

/* ---------- Settings ---------- */
.settings h1 { margin-top: 0; margin-bottom: 8px; font-size: 26px; }
.settings h2 { margin-top: 36px; margin-bottom: 14px; font-size: 17px; color: var(--text); }
.actions-row { display: flex; gap: 10px; margin-bottom: 20px; }
.hint { color: var(--text-muted); font-size: 13px; line-height: 1.65; }
.hint ul, ul.hint { padding-left: 20px; }
.hint li { margin-bottom: 6px; }

.runs { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; }
.runs thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.runs tr.error td { background: rgba(239, 68, 68, 0.08); }
.runs td.err { max-width: 400px; color: #fca5a5; font-size: 12px; }

/* Login page */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    background: #0b0d12;
}
.login-card {
    background: #14181f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 32px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #e5e7eb;
    font-family: 'Inter', system-ui, sans-serif;
}
.login-card h1 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Poppins', system-ui, sans-serif;
}
.login-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #9ca3af;
}
.login-card input[type="password"] {
    background: #0b0d12;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
    color: #e5e7eb;
    font-size: 14px;
    font-family: inherit;
}
.login-card input[type="password"]:focus {
    outline: none;
    border-color: #6366F1;
}
.login-card button {
    background: #6366F1;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    font-size: 14px;
}
.login-card button:hover { background: #4f46e5; }
.login-error {
    margin: 0;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #fca5a5;
    font-size: 13px;
}

/* DB stats page */
.db-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0 24px 32px;
}
.db-card {
    background: var(--bg-soft, #14181f);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 10px;
    padding: 16px 20px;
    overflow-x: auto;
}
.db-card-wide { grid-column: 1 / -1; }
.db-card h2 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
}
.db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.db-table th, .db-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.db-table th {
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
}
.db-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.db-table tr.error td { background: rgba(239,68,68,0.06); }
.db-table td.err { color: #fca5a5; max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-table td.err:hover { white-space: normal; }
@media (max-width: 900px) {
    .db-grid { grid-template-columns: 1fr; }
}

/* ---------- Date range picker ---------- */
.dp-root {
    position: relative;
    display: inline-block;
}
.dp-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    min-width: 240px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dp-trigger:hover {
    border-color: var(--accent);
    background: var(--surface-2);
}
.dp-trigger[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--surface-2);
}
.dp-icon { color: var(--text-muted); flex: 0 0 auto; }
.dp-trigger-label { flex: 1 1 auto; text-align: left; font-weight: 500; }
.dp-caret { color: var(--text-muted); font-size: 11px; }

.dp-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 180px 1fr;
    width: 580px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    overflow: hidden;
}
.dp-popover[hidden] { display: none; }

.dp-presets {
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    gap: 2px;
}
.dp-preset, .dp-reset {
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.dp-preset:hover {
    background: var(--surface-2);
}
.dp-preset.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}
.dp-reset {
    margin-top: auto;
    color: var(--red);
    font-weight: 500;
}
.dp-reset:hover {
    background: rgba(239, 68, 68, 0.12);
}

.dp-calendar {
    padding: 14px 16px 16px;
    background: var(--surface);
}
.dp-cal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.dp-nav {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 18px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, color 0.12s ease;
}
.dp-nav:hover {
    background: var(--surface-2);
    color: var(--text);
}
.dp-month-label {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    font-family: 'Poppins', 'Inter', sans-serif;
    letter-spacing: 0.01em;
}

.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    padding: 4px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dp-day {
    aspect-ratio: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text);
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 0;
    transition: background 0.1s ease, color 0.1s ease;
}
.dp-day:hover:not(.disabled) {
    background: var(--surface-2);
}
.dp-day.outside {
    color: var(--text-dim);
    opacity: 0.55;
}
.dp-day.today:not(.range-start):not(.range-end) {
    box-shadow: inset 0 0 0 1px var(--text-muted);
}
.dp-day.in-range {
    background: var(--accent-dim);
    border-radius: 0;
    color: var(--text);
}
.dp-day.range-start,
.dp-day.range-end {
    background: var(--accent);
    color: #06140c;
    font-weight: 600;
}
.dp-day.range-start { border-radius: 8px 0 0 8px; }
.dp-day.range-end   { border-radius: 0 8px 8px 0; }
.dp-day.range-start.range-end { border-radius: 8px; }
.dp-day.disabled {
    color: var(--text-dim);
    cursor: not-allowed;
    opacity: 0.35;
}

@media (max-width: 640px) {
    .dp-popover {
        grid-template-columns: 1fr;
        width: min(94vw, 380px);
    }
    .dp-presets {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 8px;
    }
    .dp-presets .dp-preset,
    .dp-presets .dp-reset {
        flex: 0 0 auto;
        padding: 7px 10px;
        font-size: 12px;
    }
    .dp-reset { margin-top: 0; }
    .dp-trigger { min-width: 200px; }
}


/* ---------- Commissions dashboard ---------- */
.commissions-table th,
.commissions-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.commissions-table .num { text-align: right; }
.commissions-table .lock-col { white-space: nowrap; }
.commissions-table select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    min-width: 140px;
}
.commissions-table select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.commissions-table tr.row-locked {
    opacity: 0.55;
}
.commissions-table tr.row-locked td {
    color: var(--text-muted);
}
.commissions-table tr.row-locked a {
    color: var(--text-muted);
}
.commissions-table tr.row-locked select:disabled {
    background: transparent;
    border-color: var(--border-soft);
}
.lock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 8px;
}
.lock-toggle input[type="checkbox"] {
    accent-color: var(--accent);
}
.lock-badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.lock-badge.locked {
    background: var(--accent-dim);
    color: var(--accent);
}
.btn-mini {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}
.btn-mini:hover { border-color: var(--accent); }
.commissions-table form.inline-form {
    /* Each row has one <form> wrapping a few <td>s. Display contents lets the
       form blend into the row layout without breaking the table grid. */
    display: contents;
}
.commissions-summary th,
.commissions-summary td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
}
.commissions-summary .totals-row td {
    font-weight: 600;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.primary-tab.commissions.active { color: var(--accent); }
