/* ══════════════════════════════════════════════════════
   WhatsApp API — dashboard di gestione
   Tema scuro
   ══════════════════════════════════════════════════════ */

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

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-card-hover: #1f2537;
    --bg-elevated: #252b3b;
    --bg-input: #0d1117;

    --border: #2a3141;
    --border-light: #343d50;
    --border-focus: #6366f1;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;

    --green: #10b981;
    --green-dim: rgba(16, 185, 129, 0.15);
    --green-glow: rgba(16, 185, 129, 0.4);

    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);

    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.15);

    --indigo: #6366f1;
    --indigo-dim: rgba(99, 102, 241, 0.15);
    --indigo-glow: rgba(99, 102, 241, 0.3);

    --cyan: #06b6d4;
    --cyan-dim: rgba(6, 182, 212, 0.15);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-full: 9999px;

    --font-mono: 'SF Mono', SFMono-Regular, 'Cascadia Code', 'Fira Code', Consolas, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ───────────────────────────────────────────── */
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}

/* Top accent line */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--indigo), var(--cyan), var(--green));
    z-index: 100;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    position: relative;
    z-index: 1;
}

/* ── Header ─────────────────────────────────────────── */
.header {
    margin-bottom: 28px;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header h1 .logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.header .desc {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

/* ── Badges ─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
}

.badge-amber {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-green {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-red {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-indigo {
    background: var(--indigo-dim);
    color: var(--indigo);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-pulse::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── API Key Bar ────────────────────────────────────── */
.apikey-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 6px 6px 14px;
    margin-bottom: 20px;
    transition: border-color var(--transition);
}

.apikey-bar:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--indigo-dim);
}

.apikey-bar .key-icon {
    color: var(--text-dim);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.apikey-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: transparent;
    font-family: var(--font-mono);
    min-width: 0;
}

.apikey-bar input::placeholder { color: var(--text-dim); }

.apikey-bar .key-tag {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    white-space: nowrap;
}

.apikey-bar .key-tag.ok { color: var(--green); }

/* ── Status Banner ──────────────────────────────────── */
.status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    transition: all var(--transition);
}

.status-banner.connected {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.05));
}

.status-banner.disconnected {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.05));
}

.status-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
    position: relative;
}

.dot.green {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow), 0 0 2px var(--green);
}

.dot.red {
    background: var(--red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.dot.yellow {
    background: var(--amber);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
    50% { opacity: 0.4; box-shadow: 0 0 2px rgba(245, 158, 11, 0.2); }
}

.status-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.status-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.provider-chip {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
}

.version-chip {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

/* ── Cards ──────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-head {
    padding: 16px 20px 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
}

.card-head .card-icon {
    font-size: 0.9rem;
    opacity: 0.6;
}

.card-body {
    padding: 16px 20px 20px;
}

/* ── Layout Grid ────────────────────────────────────── */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.grid .span-left {
    grid-row: 1 / 3;
}

.full-width {
    grid-column: 1 / -1;
}

/* ── QR Area ───────────────────────────────────────── */
.qr-area {
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Corner decorations */
.qr-area::before,
.qr-area::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--indigo);
    border-style: solid;
    opacity: 0.4;
}

.qr-area::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
    border-radius: 4px 0 0 0;
}

.qr-area::after {
    bottom: 8px;
    right: 8px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

.qr-area img {
    max-width: 260px;
    width: 80%;
    height: auto;
    border-radius: 8px;
    filter: brightness(1.05);
}

.qr-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 20px;
    text-align: center;
}

.qr-state .icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.icon-circle.green {
    background: var(--green-dim);
    color: var(--green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}
.icon-circle.amber {
    background: var(--amber-dim);
    color: var(--amber);
}
.icon-circle.red {
    background: var(--red-dim);
    color: var(--red);
}

.qr-state .title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.qr-state .desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 240px;
    line-height: 1.6;
}

.qr-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.progress-track {
    flex: 1;
    max-width: 120px;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.progress-track .bar {
    height: 100%;
    border-radius: 2px;
    background: var(--indigo);
    transition: width 1s linear;
}

.qr-steps {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.9;
}

.qr-steps ol { margin-left: 18px; }
.qr-steps strong { color: var(--text-primary); font-weight: 600; }

/* ── Stats ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-box:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
}

.stat-box .val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

.stat-box .lbl {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-top: 4px;
    font-family: var(--font-mono);
}

.stat-box.highlight .val { color: var(--green); }
.stat-box.error-highlight .val { color: var(--red); }

/* ── Send Form ──────────────────────────────────────── */
.send-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.field input,
.field textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    transition: all var(--transition);
    font-family: var(--font-mono);
}

.field input:focus,
.field textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--indigo-dim);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

.field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.char-count {
    font-size: 0.62rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    transition: color var(--transition);
}
.char-count.warn   { color: var(--amber); }
.char-count.danger { color: var(--red); }

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

.form-hint {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* ── Filter Pills ───────────────────────────────────── */
.filter-pills {
    display: flex;
    gap: 3px;
    align-items: center;
}

.pill {
    font-size: 0.6rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
}

.pill:hover { color: var(--text-muted); border-color: var(--border-light); background: var(--bg-elevated); }

.pill.active {
    background: var(--indigo-dim);
    color: var(--indigo);
    border-color: rgba(99, 102, 241, 0.3);
}

/* ── Health Indicators ──────────────────────────────── */
.health-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    flex: 1;
    min-width: 140px;
}

.health-item .h-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.health-item .h-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.health-item .h-dot.warn { background: var(--amber); }
.health-item .h-dot.fail { background: var(--red); }

.health-item .h-label {
    color: var(--text-muted);
}

.health-item .h-value {
    margin-left: auto;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
    background: var(--indigo);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) {
    background: #7c7ff7;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--red);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: #f87171;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 12px;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.btn-sm { padding: 7px 14px; font-size: 0.78rem; }

/* ── Spinner ────────────────────────────────────────── */
.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--indigo);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Toast ──────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: 0.82rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(80px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
    z-index: 9000;
    max-width: 360px;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 3px solid var(--green); }
.toast.success::before { content: '\2713'; color: var(--green); font-weight: 700; }
.toast.error { border-left: 3px solid var(--red); }
.toast.error::before { content: '\2717'; color: var(--red); font-weight: 700; }

/* ── Modal ──────────────────────────────────────────── */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-bg.active { opacity: 1; visibility: visible; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 400px;
    width: 92%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-bg.active .modal-card { transform: scale(1) translateY(0); }

.modal-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-actions .btn { min-width: 110px; }

/* ── Footer ─────────────────────────────────────────── */
.footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.footer a:hover { color: var(--indigo); }

.footer-shortcuts {
    color: var(--text-dim);
    opacity: 0.6;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .page { padding: 20px 14px 60px; }
    .header h1 { font-size: 1.2rem; }
    .grid { grid-template-columns: 1fr; }
    .grid .span-left { grid-row: auto; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .form-hint { display: none; }
    .status-banner { flex-direction: column; gap: 10px; align-items: flex-start; }
    .status-right { width: 100%; justify-content: flex-start; }
    .apikey-bar { flex-wrap: wrap; }
    .health-row { flex-direction: column; }
    .footer { flex-direction: column; gap: 6px; text-align: center; }
    .footer-shortcuts { display: none; }
    .filter-pills { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-box { padding: 10px 8px; }
    .stat-box .val { font-size: 1.1rem; }
}

/* ── DB History Table ───────────────────────────────── */
.hist-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

.hist-meta {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.msg-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.msg-table-header {
    display: grid;
    grid-template-columns: 110px 110px 70px 1fr 90px;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
    font-family: var(--font-mono);
    min-width: 540px;
}

#msgTable {
    min-width: 540px;
}

.msg-row {
    display: grid;
    grid-template-columns: 110px 110px 70px 1fr 90px;
    gap: 8px;
    padding: 7px 12px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    border-top: 1px solid var(--border);
    transition: background var(--transition);
    border-left: 3px solid transparent;
}

.msg-row:hover { background: var(--bg-elevated); }
.msg-row.ok   { border-left-color: var(--green); }
.msg-row.fail { border-left-color: var(--red); }

.mc-time  { color: var(--text-muted); }
.mc-phone { color: var(--text-secondary); font-weight: 600; }
.mc-status { font-weight: 700; }
.mc-status.ok   { color: var(--green); }
.mc-status.fail { color: var(--red); }
.mc-err {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mc-prov { color: var(--text-dim); }

.msg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 16px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Selection ──────────────────────────────────────── */
::selection {
    background: var(--indigo-dim);
    color: var(--text-primary);
}

/* ── Activity Chart ─────────────────────────────────── */
.mini-chart { margin-top: 14px; }
.mini-chart svg { display: block; width: 100%; height: auto; }
.mini-chart .m.ok  { fill: #199e70; }
.mini-chart .m.err { fill: #e66767; }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chart-legend .key {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: 0;
}

.chart-legend .key.ok   { background: #199e70; }
.chart-legend .key.fail { background: #e66767; }
.chart-legend .legend-note { margin-left: auto; color: var(--text-dim); }

.chart-empty {
    font-size: 0.76rem;
    color: var(--text-dim);
    text-align: center;
    padding: 14px 0;
}
