/* =========================================================
   Nespresso Checker - Dark Coffee/Gold Theme
   ========================================================= */

/* --- CSS Variables --- */
:root {
    --bg: #17120F;
    --surface: #221A15;
    --surface2: #2C2019;
    --border: #3A2C22;
    --text: #F3ECE4;
    --muted: #A8988A;
    --accent: #D69A3C;
    --accent-hi: #E9B65A;
    --coffee: #8A6244;
    --ok: #4FB477;
    --bad: #E5544B;
    --warn: #E0A63C;
    --info: #5AA6E0;

    --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "Consolas", "Monaco", "Courier New", monospace;
    --radius: 8px;
    --radius-sm: 4px;
    --nav-height: 56px;
    --container-max: 1200px;
}

/* --- Reset & Global --- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) { outline: none; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hi); }

img { max-width: 100%; display: block; }

::selection {
    background: var(--accent);
    color: var(--bg);
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Typography --- */
h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--text); font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

.font-mono { font-family: var(--font-mono); }

/* =========================================================
   NAVIGATION
   ========================================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent) !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 8px 14px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--accent); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-user {
    color: var(--muted);
    font-size: 13px;
}

/* Mobile nav footer (admin + logout duplicated inside hamburger menu) */
.nav-mobile-footer {
    display: none;
}

/* Hamburger toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--muted);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

.nav-toggle--active .hamburger:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle--active .hamburger:nth-child(2) { opacity: 0; }
.nav-toggle--active .hamburger:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
    padding-top: calc(var(--nav-height) + 24px);
    padding-bottom: 60px;
    min-height: calc(100vh - 40px);
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
    padding: 16px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-text {
    font-size: 12px;
    color: var(--muted);
}

/* =========================================================
   CARDS
   ========================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    animation: fadeIn .3s ease;
}

.card + .card { margin-top: 16px; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-stat {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
}

.card-stat--gold { color: var(--accent); }
.card-stat--green { color: var(--ok); }
.card-stat--blue { color: var(--info); }
.card-stat--red { color: var(--bad); }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--border); color: var(--text); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.disabled {
    opacity: .45;
    pointer-events: none;
}

.btn-primary, .btn-accent {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
.btn-primary:hover, .btn-accent:hover {
    background: var(--accent-hi);
    border-color: var(--accent-hi);
    color: var(--bg);
}

.btn-danger {
    background: var(--bad);
    color: #fff;
    border-color: var(--bad);
}
.btn-danger:hover { background: #d04440; border-color: #d04440; }

.btn-info {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
}
.btn-info:hover { background: #4a96d0; border-color: #4a96d0; }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent);
    color: var(--bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* =========================================================
   FORMS
   ========================================================= */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.form-input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, background .15s;
}
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    background: var(--surface);
}

textarea { resize: vertical; min-height: 80px; }

select {
    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 d='M6 8L1 3h10z' fill='%23A8988A'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* File input */
input[type="file"] {
    padding: 8px;
    font-size: 13px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    padding: 6px 14px;
    margin-right: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s;
}
input[type="file"]::file-selector-button:hover {
    background: var(--accent-hi);
}

/* Radio & Checkbox */
input[type="radio"],
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
    margin-right: 6px;
}

.form-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.form-row > * { flex: 1; }

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th,
.data-table thead th {
    background: var(--surface2);
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td,
.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover,
.data-table tbody tr:hover { background: var(--surface2); }

.actions-cell { white-space: nowrap; }
.actions-cell .link + .link { margin-left: 12px; }

.link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    transition: color .15s;
}
.link:hover { color: var(--accent-hi); }

/* =========================================================
   PROGRESS BAR
   ========================================================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width .4s ease;
    min-width: 0;
}

.progress-fill--ok { background: var(--ok); }
.progress-fill--bad { background: var(--bad); }

.progress-text {
    display: block;
    text-align: right;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--muted);
    margin-top: 4px;
}

/* =========================================================
   LOG AREA
   ========================================================= */
.log-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    color: var(--muted);
}

.log-line { margin: 2px 0; }
.log-hit, .log-ok { color: var(--ok); }
.log-error, .log-bad { color: var(--bad); }
.log-info { color: var(--info); }
.log-warn { color: var(--warn); }
.log-muted { color: var(--muted); }
.log-accent { color: var(--accent); }

/* =========================================================
   STATS GRID
   ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    animation: fadeIn .3s ease;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stat-value--gold { color: var(--accent); }
.stat-value--green { color: var(--ok); }
.stat-value--blue { color: var(--info); }
.stat-value--red { color: var(--bad); }
.stat-value--accent { color: var(--accent-hi); }

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* =========================================================
   TABS
   ========================================================= */
.tabs {}

.tab-header {
    display: flex;
    background: var(--surface2);
    border-bottom: 2px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content { display: none; padding: 16px 0; }
.tab-content.active { display: block; }

/* =========================================================
   BADGES / PILLS
   ========================================================= */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1.5;
    background: var(--surface2);
    color: var(--muted);
}

.badge--blue, .badge-running {
    background: rgba(90, 166, 224, .15);
    color: var(--info);
}
.badge--green, .badge-done {
    background: rgba(79, 180, 119, .15);
    color: var(--ok);
}
.badge--amber, .badge-stopped {
    background: rgba(224, 166, 60, .15);
    color: var(--warn);
}
.badge--red {
    background: rgba(229, 84, 75, .15);
    color: var(--bad);
}
.badge--gold {
    background: rgba(214, 154, 60, .15);
    color: var(--accent);
}
.badge--orange {
    background: rgba(230, 140, 50, .15);
    color: #e89040;
}
.badge--cyan {
    background: rgba(80, 190, 220, .15);
    color: #50bed8;
}
.badge--gray {
    background: rgba(160, 160, 160, .15);
    color: #999;
}

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-error, .alert-danger {
    background: rgba(229, 84, 75, .1);
    border-color: rgba(229, 84, 75, .3);
    color: var(--bad);
}

.alert-success {
    background: rgba(79, 180, 119, .1);
    border-color: rgba(79, 180, 119, .3);
    color: var(--ok);
}

.alert-warning {
    background: rgba(224, 166, 60, .1);
    border-color: rgba(224, 166, 60, .3);
    color: var(--warn);
}

.alert-info {
    background: rgba(90, 166, 224, .1);
    border-color: rgba(90, 166, 224, .3);
    color: var(--info);
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page {
    background: linear-gradient(160deg, var(--bg) 0%, #1a140f 50%, #0f0c09 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    animation: fadeIn .4s ease;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.login-form .form-group { margin-bottom: 20px; }

/* =========================================================
   SECTIONS
   ========================================================= */
.section { margin-bottom: 28px; }

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: -8px 0 12px;
}

/* =========================================================
   ACTIONS ROW
   ========================================================= */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.empty-text {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

/* =========================================================
   FILE LIST
   ========================================================= */
.file-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background .1s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--surface2); }

.file-name {
    font-family: var(--font-mono);
    color: var(--text);
    word-break: break-all;
}

.file-meta {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    margin-left: 12px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

/* =========================================================
   UPLOAD AREA
   ========================================================= */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: border-color .2s, background .2s;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(214, 154, 60, .05);
}

.upload-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 8px;
}

/* =========================================================
   SUMMARY BOX
   ========================================================= */
.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--surface2);
    border-radius: var(--radius);
    margin-top: 12px;
}

.summary-item { text-align: center; }
.summary-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}
.summary-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: 2px;
}

/* =========================================================
   MESSAGE (inline feedback)
   ========================================================= */
.msg {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-top: 10px;
    display: none;
}
.msg.show { display: block; animation: fadeIn .25s ease; }
.msg-ok { background: rgba(79, 180, 119, .12); color: var(--ok); }
.msg-err { background: rgba(229, 84, 75, .12); color: var(--bad); }
.msg-info { background: rgba(90, 166, 224, .12); color: var(--info); }

/* =========================================================
   UTILITY CLASSES
   ========================================================= */
/* Text colors */
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }
.text-warn { color: var(--warn); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--muted); }

/* Margins */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

/* Flex */
.flex { display: flex; gap: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Visibility */
.hidden { display: none !important; }

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}

.anim-pulse { animation: pulse 1.8s ease-in-out infinite; }

@keyframes progressStripe {
    0%   { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

.progress-fill--active {
    background-image: linear-gradient(
        -45deg,
        rgba(255,255,255,.08) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255,255,255,.08) 50%,
        rgba(255,255,255,.08) 75%,
        transparent 75%
    );
    background-size: 40px 40px;
    animation: progressStripe .8s linear infinite;
}

/* =========================================================
   SCROLLBAR (webkit)
   ========================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--coffee); }

/* =========================================================
   SAFE AREA (iPhone notch)
   ========================================================= */
html { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .btn, .nav-link, .tab-btn, .btn-export, input, select, textarea { min-height: 44px; }
    .btn-sm { min-height: 36px; }
}

/* =========================================================
   RESPONSIVE  (<768px)
   ========================================================= */
@media (max-width: 768px) {
    :root { --nav-height: 52px; }

    body { font-size: 14px; }

    .container { padding: 0 12px; }

    /* Nav: hamburger mode */
    .nav-toggle { display: flex; order: 3; }

    .nav-container {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 12px;
    }

    .nav-brand { font-size: 15px; order: 1; }

    .nav-menu {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
        gap: 0;
        z-index: 99;
        box-shadow: 0 8px 24px rgba(0,0,0,.4);
    }
    .nav-menu--open { display: flex; }

    .nav-link {
        padding: 14px 20px;
        border-radius: 0;
        font-size: 15px;
    }

    /* Hide desktop nav-right, show mobile footer inside menu */
    .nav-right { display: none; }

    .nav-mobile-footer {
        display: block;
        border-top: 1px solid var(--border);
        padding: 12px 20px;
        margin-top: 4px;
    }

    .nav-mobile-user {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 8px;
    }

    .nav-mobile-user .nav-user { display: inline; font-size: 14px; }

    .nav-mobile-user .btn { width: auto; }

    /* Stack cards */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    .form-row { flex-direction: column; }

    /* Only full-width buttons in dedicated action rows */
    .actions-row { flex-direction: column; }
    .actions-row .btn { width: 100%; }
    .btn-block { width: 100%; }

    .card { padding: 12px; }
    .card-header { flex-wrap: wrap; gap: 8px; }

    .stat-value { font-size: 20px; }

    /* Table scroll */
    .table-wrap {
        margin: 0 -12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tabs scrollable */
    .tab-header { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { padding: 10px 14px; font-size: 13px; flex-shrink: 0; }

    .summary-box { grid-template-columns: repeat(2, 1fr); }

    /* File list responsive */
    .file-item { flex-wrap: wrap; gap: 4px; }
    .file-meta { margin-left: 0; font-size: 11px; }

    /* Log area bigger touch scroll */
    .log-area { font-size: 12px; padding: 10px; -webkit-overflow-scrolling: touch; }

    /* Section spacing */
    .section { margin-bottom: 20px; }
    .section-title { font-size: 16px; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 10px 8px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 10px; }

    .nav-brand { font-size: 14px; }

    h1 { font-size: 20px; }
    h2 { font-size: 17px; }

    .card { padding: 10px; }

    .btn { padding: 10px 14px; font-size: 13px; }
    .btn-sm { padding: 8px 10px; font-size: 12px; }

    /* Full-width standalone buttons */
    .actions-row .btn,
    .submit-section .btn,
    .submit-section button { width: 100%; }

    .log-area { max-height: 250px; font-size: 11px; }

    .table-wrap { margin: 0 -10px; }
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary, #333);
    border-radius: 24px;
    transition: background .25s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent, #C4964C);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}
