:root {
    --bg: #faf8f2;
    --surface: #ffffff;
    --surface-2: #f5f1e8;
    --surface-3: #ede8db;
    --border: #e2ddd0;
    --text: #2d2a24;
    --text-muted: #8a8477;
    --gold: #d4a017;
    --gold-light: #f0d060;
    --gold-dim: rgba(212, 160, 23, 0.10);
    --gold-glow: rgba(240, 208, 96, 0.25);
    --green: #2e9e5a;
    --green-light: #e8f5ee;
    --green-dim: rgba(46, 158, 90, 0.10);
    --blue: #4a7ff7;
    --blue-dim: rgba(74, 127, 247, 0.10);
    --error: #d94040;
    --error-dim: rgba(217, 64, 64, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
}

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

body {
    background: var(--bg);
    background-image:
        radial-gradient(circle at 20% 50%, rgba(212, 160, 23, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(46, 158, 90, 0.03) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4a017' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.logo {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), #e6b422, var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.logo span { font-weight: 400; opacity: 0.6; }

main { flex: 1; padding: 24px 24px 100px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Bottom tab bar */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding: 6px 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
    z-index: 100;
    box-shadow: 0 -1px 8px rgba(0,0,0,0.04);
}
.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    min-width: 56px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tab svg { transition: transform 0.15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); font-weight: 700; }
.tab.active svg { transform: scale(1.1); }

/* Scan FAB in center of tab bar */
.tab-scan { position: relative; }
.scan-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 16px var(--gold-glow);
    transition: transform 0.15s;
}
.scan-fab svg { color: #2d2a24; }
.tab-scan:hover .scan-fab { transform: scale(1.05); }
.tab-scan.active .scan-fab { box-shadow: 0 4px 20px rgba(212, 160, 23, 0.5); }
.tab-scan span { margin-top: 2px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; margin-bottom: 8px; }
.stat-card .value { font-size: 32px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.stat-card .value.money { color: var(--green); }
.stat-card .sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Section */
.section { margin-bottom: 32px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); }

/* Table */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

.thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-2);
    border: 2px solid var(--gold-dim);
}
.thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold-glow));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-espcam { background: var(--green-dim); color: var(--green); }
.badge-iphone { background: var(--blue-dim); color: var(--blue); }
.badge-upload { background: var(--gold-dim); color: var(--gold); }

.conf-bar {
    width: 80px;
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}
.conf-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--green));
    border-radius: 4px;
}

/* Scan cards */
.scan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.scan-card-idle {
    text-align: center;
    padding: 40px 20px;
}
.coin-icon-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 2px dashed var(--gold);
    transition: all 0.2s;
}
.scan-card:hover .coin-icon-ring {
    background: var(--gold-glow);
    transform: scale(1.05);
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--gold); background: var(--gold-dim); }
.drop-zone p { color: var(--text-muted); font-size: 14px; margin-top: 8px; }

/* Scanning animation */
.scanning-state { text-align: center; padding: 48px 20px; }
.scan-anim { position: relative; width: 140px; height: 140px; margin: 0 auto 24px; }
.scan-coin-spin {
    width: 120px;
    height: 120px;
    margin: 10px auto;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold-glow));
    animation: coin-wobble 1.2s ease-in-out infinite;
    box-shadow: 0 4px 20px var(--gold-glow);
}
.scan-coin-spin img { display: block; }
.scan-ring-pulse {
    position: absolute;
    inset: 0;
    border: 2px solid var(--gold);
    border-radius: 50%;
    animation: scan-pulse 1.5s ease-out infinite;
}
@keyframes coin-wobble {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.02) rotate(1deg); }
    75% { transform: scale(0.98) rotate(-1deg); }
}
@keyframes scan-pulse {
    0% { transform: scale(0.85); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}
.scan-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Results card */
.results-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    animation: results-in 0.3s ease-out;
}
@keyframes results-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.results-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.added-badge {
    background: var(--green-dim);
    color: var(--green);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    animation: results-in 0.3s ease-out;
}
.auto-saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-dim);
    color: var(--green);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
    animation: results-in 0.4s ease-out;
}
.value-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
    color: var(--text-muted);
}

input[type="file"] { display: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    min-height: 44px;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold), #e6b422);
    color: #2d2a24;
}
.btn-primary:hover { box-shadow: 0 4px 16px var(--gold-glow); }
.btn-success {
    background: linear-gradient(135deg, var(--green), #38b265);
    color: white;
}
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* Mode switcher */
.mode-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
}
.mode-tab {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    border: none;
    background: transparent;
    min-height: 44px;
}
.mode-tab.active {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow);
}

/* Camera */
.camera-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 4/3;
}
.camera-wrap video, .camera-wrap canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.camera-ring {
    width: 200px;
    height: 200px;
    border: 3px dashed rgba(212, 160, 23, 0.6);
    border-radius: 50%;
    animation: pulse-ring 2s ease-in-out infinite;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.15);
}
.camera-hint {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
@keyframes pulse-ring {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}
.camera-controls {
    display: flex;
    gap: 16px;
    padding: 16px;
    justify-content: center;
    align-items: center;
    background: var(--surface);
}
.capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    border: 4px solid var(--surface);
    box-shadow: var(--shadow-lg), 0 0 20px var(--gold-glow);
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.capture-btn-inner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--gold);
}
.capture-btn:hover { transform: scale(1.05); }
.capture-btn:active { transform: scale(0.92); }
.capture-btn:active .capture-btn-inner { background: var(--gold-dim); }
.cam-btn-secondary {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.cam-btn-secondary:hover { color: var(--text); background: var(--surface-3); }
.cam-btn-secondary.torch-on { background: var(--gold); color: #2d2a24; border-color: var(--gold); }

/* Station */
.station-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.station-stream {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.station-stream img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.station-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--error); }

/* Results */
.result-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.result-panel h3 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 16px; }

.match-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.match-row:last-child { border-bottom: none; }
.match-rank {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-2);
}
.match-rank.top {
    background: linear-gradient(135deg, var(--gold-dim), var(--gold-glow));
    color: var(--gold);
}
.match-info { flex: 1; }
.match-name { font-weight: 700; font-size: 15px; }
.match-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.match-value { font-weight: 800; color: var(--green); font-size: 18px; }

/* Loading */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Clickable stat cards */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.stat-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card-link:active { transform: scale(0.97); }

/* Scan list (mobile-friendly) */
.scan-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.scan-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.15s;
}
.scan-item:active { box-shadow: var(--shadow-lg); }
.scan-item-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}
.scan-item-info { flex: 1; min-width: 0; }
.scan-item-detail {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
    margin-top: 0;
    padding-top: 16px;
}
.scan-detail-img {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius-sm);
    margin: 0 auto 12px;
    display: block;
    border: 2px solid var(--gold-dim);
}
.scan-detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.scan-detail-meta strong {
    color: var(--text);
    font-weight: 600;
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-icon { font-size: 56px; margin-bottom: 16px; }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

[x-cloak] { display: none !important; }

/* Hero / banner */
.hero-banner {
    background: linear-gradient(135deg, #fef6d8, #f8edb8, #f0e0a0);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}
.hero-icon { font-size: 48px; }
.hero-text h2 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.hero-text p { font-size: 14px; color: var(--text-muted); }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Value indicator — colored border glow around match cards */
.match-row {
    border-left: 4px solid transparent;
    padding-left: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}
.match-row.value-high {
    border-left-color: var(--green);
    background: var(--green-dim);
}
.match-row.value-face {
    border-left-color: var(--error);
    background: var(--error-dim);
}
.match-row.value-mid {
    border-left-color: var(--gold);
    background: var(--gold-dim);
}

/* Coin card (grid view) */
.coin-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 4px solid transparent;
    transition: border-color 0.2s;
}
.coin-card.value-high { border-color: var(--green); }
.coin-card.value-face { border-color: var(--error); }
.coin-card.value-mid { border-color: var(--gold); }

/* Value indicator dot */
.value-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}
.value-indicator.high { background: var(--green); box-shadow: 0 0 6px var(--green); }
.value-indicator.face { background: var(--error); box-shadow: 0 0 6px var(--error); }
.value-indicator.mid { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* Settings */
.settings-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.settings-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 14px 20px 8px;
}
.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    min-height: 56px;
}
.settings-row:hover { background: var(--surface-2); }
.settings-label { flex: 1; min-width: 0; }
.settings-name { font-size: 15px; font-weight: 600; color: var(--text); }
.settings-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.settings-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
    min-height: 36px;
    cursor: pointer;
}
.settings-input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
    min-height: 36px;
    width: 180px;
}

/* Toggle switch */
.toggle {
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle-knob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}
.toggle.on .toggle-knob { transform: translateX(20px); }

/* Responsive */
@media (max-width: 640px) {
    header { padding: 0 16px; }
    main { padding: 16px 16px 110px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .value { font-size: 24px; }
    .hero-banner { flex-direction: column; text-align: center; padding: 20px; }
    .camera-ring { width: 150px; height: 150px; }

    /* Dashboard table → card layout on mobile */
    .table-wrap table thead { display: none; }
    .table-wrap table, .table-wrap table tbody, .table-wrap table tr, .table-wrap table td {
        display: block;
        width: 100%;
    }
    .table-wrap table tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .table-wrap table tr:last-child { border-bottom: none; }
    .table-wrap table td {
        padding: 0;
        border-bottom: none;
    }
    .table-wrap table td:first-child { flex-shrink: 0; }
    .table-wrap table td:nth-child(3),
    .table-wrap table td:nth-child(6) { font-size: 12px; }

    /* Settings responsive */
    .settings-row { flex-wrap: wrap; }
    .settings-input { width: 100%; }
    .settings-select { min-width: 120px; }

    /* Results on mobile */
    .results-header { flex-direction: column; text-align: center; gap: 12px; }
    .results-actions { flex-direction: column; }
    .results-actions .btn { width: 100%; justify-content: center; }
}
