/* ── Reset & basis ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:          #0a1628;
    --panel:       #111d32;
    --card:        #1a2a45;
    --card-hover:  #213352;
    --cyan:        #00C7F9;
    --text:        #e2e8f0;
    --muted:       #8892a6;
    --border:      rgba(255,255,255,0.08);
    --success:     #10b981;
    --danger:      #ef4444;
    --warning:     #f59e0b;
    --p1:          #ef4444;
    --p2:          #f59e0b;
    --p3:          #eab308;
    --p4:          #6b7280;
    --radius:      8px;
    --font:        'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:        'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--cyan);
}

.topbar-title {
    font-size: 15px;
    color: var(--muted);
    font-weight: 400;
}

.topbar-guide {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.topbar-guide:hover {
    color: var(--cyan);
    border-color: var(--cyan);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 14px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--cyan);
}

.btn-reset, .btn-demo {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--cyan);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--cyan);
}

.btn-demo {
    border-color: var(--success);
    color: var(--success);
}

.btn-demo:hover {
    background: var(--success);
    color: var(--bg);
}

.btn-reset:hover {
    background: var(--cyan);
    color: var(--bg);
}

.btn-reset:disabled, .btn-demo:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Main layout ──────────────────────────────────────── */
.main {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.panel:last-child { border-right: none; }

.panel-tickets  { width: 35%; min-width: 300px; }
.panel-detail   { width: 65%; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-select {
    padding: 4px 8px;
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 11px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

.sort-select:focus { outline: none; border-color: var(--cyan); }
.sort-select option { background: var(--panel); color: var(--text); }

.btn-new-ticket {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--success);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: all 0.2s;
}

.btn-new-ticket:hover {
    background: var(--success);
    color: var(--bg);
}

/* ── Scrollbare inner ─────────────────────────────────── */
.ticket-list-inner,
.detail-inner,
.compare-inner {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: none;
}

.ticket-list-inner::-webkit-scrollbar,
.detail-inner::-webkit-scrollbar,
.compare-inner::-webkit-scrollbar {
    display: none;
}

/* ── Ticket sectie labels ────────────────────────────── */
.ticket-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    padding: 8px 14px 4px;
}

.ticket-section-urgent {
    color: var(--p1);
}

.ticket-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

/* ── Ticket lijst items ───────────────────────────────── */
.ticket-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    margin-bottom: 6px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ticket-item:hover {
    background: var(--card-hover);
    border-color: var(--border);
}

.ticket-item.active {
    border-color: var(--cyan);
    background: var(--card-hover);
}

.ticket-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-id {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.ticket-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ticket-row-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ticket-customer {
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.badge-new        { background: rgba(107,114,128,0.25); color: #9ca3af; }
.badge-triaged    { background: rgba(245,158,11,0.2);   color: #fbbf24; }
.badge-awaiting   { background: rgba(245,158,11,0.25);  color: #f59e0b; }
.badge-dispatched { background: rgba(16,185,129,0.2);   color: #34d399; }
.badge-escalated  { background: rgba(239,68,68,0.2);    color: #f87171; }
.badge-resolved   { background: rgba(0,199,249,0.2);    color: var(--cyan); }

.badge-p1 { background: rgba(239,68,68,0.2);  color: var(--p1); }
.badge-p2 { background: rgba(245,158,11,0.2); color: var(--p2); }
.badge-p3 { background: rgba(234,179,8,0.2);  color: var(--p3); }
.badge-p4 { background: rgba(107,114,128,0.2);color: var(--p4); }

/* ── Detail paneel secties ───────────��────────────────── */
.section {
    margin-bottom: 16px;
    border-radius: var(--radius);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.section-body {
    padding: 16px;
}

/* Sectie kleuren */
.section-intake .section-header  { background: rgba(239,68,68,0.15);  color: #f87171; }
.section-intake .section-body    { background: rgba(239,68,68,0.05);  }

.section-enrich .section-header  { background: rgba(0,199,249,0.15);  color: var(--cyan); }
.section-enrich .section-body    { background: rgba(0,199,249,0.05);  }

.section-reason .section-header  { background: rgba(16,185,129,0.15); color: #34d399; }
.section-reason .section-body    { background: rgba(16,185,129,0.05); }

.section-verdict .section-header { background: rgba(255,255,255,0.08); color: var(--text); }
.section-verdict .section-body   { background: rgba(255,255,255,0.04); }

/* ── Info kaarten in enrichment ───────────────────────── */
.info-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px 14px;
}

.info-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cyan);
    margin-bottom: 8px;
}

.info-card-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.info-card-content .kv {
    display: flex;
    gap: 8px;
    margin-bottom: 2px;
}

.info-card-content .kv-label {
    color: var(--muted);
    flex-shrink: 0;
    min-width: 100px;
}

/* ── Intake velden ────────────────────────────────────── */
.intake-field {
    margin-bottom: 8px;
}

.intake-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 2px;
}

.intake-value {
    font-size: 14px;
    color: var(--text);
}

.intake-value.mono {
    font-family: var(--mono);
    font-size: 13px;
}

/* ── Redenering ───────────────────────────────────────── */
.reasoning-text {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    font-family: var(--font);
}

/* ── Verdict ──────────────────────────────────────────── */
.verdict-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.verdict-item {
    text-align: center;
    padding: 12px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.verdict-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.verdict-value {
    font-size: 18px;
    font-weight: 700;
}

.questions-list {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(245,158,11,0.1);
    border-radius: var(--radius);
    border: 1px solid rgba(245,158,11,0.2);
}

.questions-list-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.questions-list ol {
    padding-left: 20px;
    font-size: 13px;
    color: var(--text);
}

.questions-list li {
    margin-bottom: 4px;
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
    padding: 40px;
    text-align: center;
}

/* ── Stats button ────────────────────────────────────── */
.btn-stats {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #a78bfa;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #a78bfa;
}

.btn-stats:hover {
    background: #a78bfa;
    color: var(--bg);
}

.stat-value-sm {
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0;
}

/* ── Stats overlay ───────────────────────────────────── */
.stats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.stats-panel {
    width: 880px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--panel);
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.stats-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.stats-close:hover { color: var(--text); }

.stats-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.stats-run-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.stats-run-selector label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.stats-run-selector select {
    flex: 1;
    padding: 8px 12px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13px;
}

/* Summary cards */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stats-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}

.stats-card-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stats-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--cyan);
}

.stats-card-value.purple { color: #a78bfa; }
.stats-card-value.green  { color: var(--success); }
.stats-card-value.orange { color: var(--warning); }

/* Stats table */
.stats-table-wrap {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.stats-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
}

.stats-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

.stats-table .mono {
    font-family: var(--mono);
    font-size: 12px;
}

/* ── Ticket form ─────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--cyan);
}

.form-input::placeholder { color: var(--muted); opacity: 0.6; }

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-row {
    display: flex;
    gap: 12px;
}

.form-group-half { flex: 1; }

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

select.form-input option {
    background: var(--panel);
    color: var(--text);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text);
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--cyan);
    cursor: pointer;
}

.form-check label { cursor: pointer; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-form {
    padding: 10px 24px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.btn-form-cancel {
    background: transparent;
    color: var(--muted);
}

.btn-form-cancel:hover {
    background: var(--card);
    color: var(--text);
}

.btn-form-submit {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
}

.btn-form-submit:hover {
    background: #33d4ff;
}

.btn-form-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Utility ──────────────────────────────────────────── */
.hidden { display: none; }
