/* =========================================================================
   Burberry Catalog Builder — UI
   Palette inspired by burberry.com: cream, black, camel, subtle check accent.
   ========================================================================= */

:root {
    --bg:         #F5F0E6;   /* Burberry beige */
    --surface:    #FFFFFF;
    --ink:        #0A0A0A;   /* near-black */
    --ink-soft:   #2A2A2A;
    --muted:      #6E6E6E;
    --muted-2:    #9A9A9A;
    --line:       #E5DFD3;
    --line-soft:  #EFE9DE;

    --camel:      #A37E55;   /* Burberry camel accent */
    --camel-dark: #8B6941;
    --camel-tint: #EFE2CE;
    --check-red:  #B22222;
    --success:    #2F6F3F;
    --error:      #A83232;
    --warning:    #A16207;

    --radius: 4px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow:    0 2px 8px rgba(0, 0, 0, 0.06);
}

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

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
                 Helvetica, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: "Times New Roman", Georgia, "Playfair Display", serif;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 14px;
}
h1 { font-size: clamp(24px, 3.2vw, 30px); }
h2 { font-size: clamp(18px, 2.2vw, 21px); }
h3 { font-size: 16px; }

a { color: var(--camel-dark); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }

code {
    font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.88em;
    background: var(--camel-tint);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--ink);
}

/* =========================================================================
   Top bar — thin, black, uppercase serif wordmark like the real site
   ========================================================================= */
.topbar {
    background: var(--ink);
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.topbar .brand {
    font-family: "Times New Roman", Georgia, serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 3px;
    color: white;
    text-transform: uppercase;
}
.topbar .brand .sub {
    font-family: -apple-system, "Helvetica Neue", Helvetica, sans-serif;
    color: var(--camel);
    font-weight: 400;
    margin-left: 10px;
    letter-spacing: 0.5px;
    font-size: 11px;
    text-transform: uppercase;
}
.topbar nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 13px;
}
.topbar nav a, .topbar nav button {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    padding: 4px 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.15s;
}
.topbar nav a:hover, .topbar nav button:hover { color: var(--camel); }
.topbar nav a.active {
    color: var(--camel);
    border-bottom: 1px solid var(--camel);
    padding-bottom: 2px;
}
.topbar .who {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0.2px;
}
.topbar .who em { color: var(--camel); font-style: normal; }


/* =========================================================================
   Layout
   ========================================================================= */
.container {
    max-width: 960px;
    margin: 32px auto;
    padding: 0 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card.narrow {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}
.card h1 { margin-bottom: 18px; }
.card h2 { margin-bottom: 14px; color: var(--ink); }

/* =========================================================================
   Forms
   ========================================================================= */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-soft);
    letter-spacing: 0.2px;
}

input, select, textarea {
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--camel);
    box-shadow: 0 0 0 3px rgba(163, 126, 85, 0.12);
}
input[type="file"] {
    padding: 8px;
    background: var(--bg);
    cursor: pointer;
}
input[type="checkbox"] {
    width: auto;
    accent-color: var(--camel);
    margin: 0;
    cursor: pointer;
}

label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    padding: 6px 0;
    min-height: 32px;
}

/* =========================================================================
   Buttons
   ========================================================================= */
button, .btn {
    font: inherit;
    padding: 11px 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: var(--radius);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
button:hover { border-color: var(--ink); }

button.primary, .btn.primary {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
}
button.primary:hover { background: var(--camel); border-color: var(--camel); }

button.primary.small { padding: 6px 14px; font-size: 10px; min-height: 32px; }

button.link, .btn.link {
    background: none;
    border: none;
    padding: 0;
    color: var(--camel-dark);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    min-height: auto;
}
button.link:hover { color: var(--ink); border: none; }

button.ghost {
    background: transparent;
    border: 1px solid var(--line);
}

/* =========================================================================
   Rows, alerts, meta
   ========================================================================= */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.muted { color: var(--muted); }

.err {
    color: var(--error);
    background: #FBEAEA;
    border: 1px solid #F0D0D0;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 14px;
}

/* =========================================================================
   Sheet picker
   ========================================================================= */
.sheet-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
    background: var(--bg);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 12px;
}

/* =========================================================================
   Tables (desktop) → cards (mobile)
   ========================================================================= */
.joblist {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 14px;
}
.joblist th, .joblist td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}
.joblist th {
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}
.joblist tbody tr:hover { background: var(--bg); }
.joblist td.actions {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.inline-form input { padding: 6px 10px; font-size: 13px; }

/* =========================================================================
   Status pills
   ========================================================================= */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid transparent;
}
.status-queued  { background: #FBF3D6; color: #7A5B0A; border-color: #F0E3B0; }
.status-running { background: #E0EEFB; color: #1E4A78; border-color: #C6DEF3; }
.status-done    { background: #E1F0E6; color: var(--success); border-color: #C7E2CF; }
.status-error   { background: #FBEAEA; color: var(--error); border-color: #F0D0D0; }
.status-cancelled { background: #E8E8E8; color: #555; border-color: #D0D0D0; }

/* NEW badge on the Invites nav item and on the Invite page title */
.nav-new {
    background: var(--camel);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
    margin-left: 4px;
    vertical-align: 2px;
}
/* Invite maker */
.color-row {
    display: flex; gap: 8px; align-items: center;
}
.color-row input[type="color"] {
    width: 44px; height: 36px; padding: 0; border-radius: var(--radius);
    border: 1px solid var(--line); cursor: pointer; background: var(--surface);
}
.color-row input[type="text"] {
    flex: 1;
    font-family: "SF Mono", Menlo, monospace;
    text-transform: uppercase;
}
.preview-frame {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    min-height: 100px;
    display: flex; align-items: center; justify-content: center;
}
.preview-frame img { max-width: 100%; height: auto; border: 1px solid var(--line-soft); }

.style-grid { display: flex; flex-direction: column; gap: 6px; }
.style-row {
    display: grid;
    grid-template-columns: 1fr 90px 60px;
    gap: 10px;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.style-row .style-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.style-row input[type="number"] { padding: 6px 8px; text-align: center; }
.style-row input[type="color"] {
    width: 100%; height: 32px; padding: 0;
    border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
}

/* Clients filters + timeline */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--camel); color: var(--ink); text-decoration: none; }
.filter-pill.on {
    background: var(--ink); color: white; border-color: var(--ink);
}
.filter-pill.on .muted { color: rgba(255, 255, 255, 0.7); }
.filter-pill.tier { background: var(--camel-tint); border-color: transparent; color: var(--camel-dark); }
.filter-pill.tier.on { background: var(--camel); color: white; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}
.timeline li:last-child { border-bottom: none; }
.tl-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.tl-when { margin-left: auto; font-size: 12px; }
.tl-amt {
    background: var(--camel-tint); color: var(--camel-dark);
    padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 12px;
}
.tl-notes {
    margin-top: 6px;
    color: var(--muted); font-size: 13px;
    padding-left: 8px; border-left: 2px solid var(--line);
}

.sa-list { list-style: none; padding: 0; margin: 0; }
.sa-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
}
.sa-list li:last-child { border-bottom: none; }
.sa-list li .hint { margin-top: 2px; }

/* Clickable cards + stat tiles */
.card.card-link,
.stat.stat-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.card.card-link:hover,
.stat.stat-link:hover {
    border-color: var(--camel);
    box-shadow: 0 2px 12px rgba(163, 126, 85, 0.15);
    text-decoration: none;
}
.card.card-link:active,
.stat.stat-link:active { transform: translateY(1px); }
.card.card-link h2 { display: flex; justify-content: space-between; align-items: baseline; }

/* Progress bars for sales targets */
.progress {
    width: 100%;
    height: 8px;
    background: var(--line-soft);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--camel), var(--camel-dark));
    border-radius: 999px;
    transition: width 0.3s;
}

/* Sales chart */
.chart {
    width: 100%; height: auto;
    max-height: 260px;
    margin-top: 10px;
}
.chart-legend {
    display: flex; gap: 18px; font-size: 12px; color: var(--muted);
    margin: 4px 0 0 4px;
}
.chart-legend .dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 2px;
    margin-right: 6px; vertical-align: -1px;
}
.chart-legend .dot-team { background: #c9c1b0; }
.chart-legend .dot-mine { background: #A37E55; }

/* ============ Insights ============ */
.ins-card { padding: 22px 24px; }

.legend-list { list-style: none; padding: 0; margin: 0; }
.legend-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; font-size: 14px;
}
.legend-list li a { color: var(--ink); text-decoration: none; flex: 1; }
.legend-list li a:hover { color: var(--camel-dark); text-decoration: underline; }
.lg-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: inherit;
    padding: 4px 0;
}
.funnel-row:hover .funnel-bar { transform: translateX(2px); }
.funnel-label { min-width: 90px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.funnel-bar {
    display: flex; align-items: center; justify-content: flex-end;
    min-height: 32px; padding: 0 14px;
    border-radius: 4px; color: white; font-weight: 600; font-size: 13px;
    transition: transform 0.15s;
    min-width: 30px;
}
.funnel-count { text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* Team YTD bars */
.team-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.team-bar-row { display: flex; align-items: center; gap: 12px; }
.team-bar-label { min-width: 80px; font-size: 13px; font-weight: 500; }
.team-bar-track {
    flex: 1; height: 20px; background: var(--line-soft);
    border-radius: 4px; overflow: hidden;
}
.team-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--camel), var(--camel-dark));
    transition: width 0.4s;
}
.team-bar-amt { font-size: 13px; font-weight: 600; min-width: 90px; text-align: right; }

/* Heatmap */
.heat { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.heat-hours {
    display: grid; grid-template-columns: 32px repeat(24, 1fr); gap: 2px;
    color: var(--muted); align-items: center;
    padding-left: 4px;
}
.heat-row {
    display: grid; grid-template-columns: 32px repeat(24, 1fr); gap: 2px;
    align-items: center;
}
.heat-day { font-size: 11px; color: var(--muted); font-weight: 500; padding-left: 4px; }
.heat-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: var(--line-soft);
    transition: transform 0.1s;
}
.heat-cell:hover { transform: scale(1.4); }

/* LTV histogram */
.ltv { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ltv-row { display: flex; align-items: center; gap: 10px; }
.ltv-label { min-width: 100px; font-size: 12px; color: var(--ink-soft); }
.ltv-track {
    flex: 1; height: 18px; background: var(--line-soft);
    border-radius: 3px; overflow: hidden;
}
.ltv-fill { height: 100%; background: var(--camel); }
.ltv-count { font-size: 12px; font-weight: 600; min-width: 28px; text-align: right; }

/* Tag cloud + chips */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--camel-tint);
    color: var(--camel-dark);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s;
}
.tag-chip:hover { background: var(--camel); color: white; text-decoration: none; }
.tag-chip:hover .muted { color: rgba(255,255,255,0.8); }
.tag-chip.small { font-size: 11px; padding: 2px 8px; font-weight: 500; }

/* Bulk action bar */
.bulk-bar {
    position: sticky; bottom: 12px; margin-top: 12px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--ink); color: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 10;
}
.bulk-bar select, .bulk-bar input {
    padding: 6px 10px; font-size: 13px; min-width: 140px;
    background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2);
}
.bulk-bar select option { color: var(--ink); background: white; }
.bulk-bar input::placeholder { color: rgba(255,255,255,0.6); }
.bulk-count { color: white; font-weight: 600; font-size: 13px; }
.bulk-bar button.small { padding: 6px 14px; font-size: 11px; min-height: 30px; }

.bulk-cb { transform: scale(1.15); cursor: pointer; }
.preview-frame #inv-preview-loading { color: var(--muted); font-style: italic; }

.new-badge {
    background: var(--camel);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 3px;
    letter-spacing: 1px;
    margin-left: 10px;
    vertical-align: 6px;
    font-family: -apple-system, "Helvetica Neue", Helvetica, sans-serif;
}

/* =========================================================================
   Meta strip on job page
   ========================================================================= */
.meta {
    color: var(--muted);
    font-size: 13px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}
.meta strong { color: var(--ink-soft); font-weight: 600; }

/* =========================================================================
   Live log console
   ========================================================================= */
.log {
    background: #0F0F0F;
    color: #E8E4DC;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 16px 18px;
    border-radius: var(--radius);
    max-height: 520px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    border: 1px solid #2A2A2A;
}
.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* =========================================================================
   Downloads list
   ========================================================================= */
#downloads {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#downloads li {
    padding: 12px 14px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
    border: 1px solid transparent;
}
#downloads li:hover {
    background: var(--bg);
    border-color: var(--line);
}
#downloads a {
    color: var(--ink);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    word-break: break-all;
}
#downloads a:hover { color: var(--camel-dark); text-decoration: none; }
#downloads .file-icon {
    width: 28px; height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--camel-tint);
    color: var(--camel-dark);
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.5px;
}
#downloads .file-icon.err { background: #FBEAEA; color: var(--error); }
#downloads .file-icon.zip { background: var(--ink); color: white; }
#downloads .file-note { color: var(--muted); font-size: 12px; }

.download-all {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--camel-tint);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.download-all .count {
    color: var(--ink);
    font-size: 14px;
}
.download-all .count strong { font-weight: 600; }

/* =========================================================================
   Details / summary (used in admin reset password)
   ========================================================================= */
details { margin: 0; }
details summary {
    list-style: none;
    cursor: pointer;
    color: var(--camel-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 13px;
    display: inline-block;
}
details summary::-webkit-details-marker { display: none; }
details[open] summary { color: var(--ink); }

/* =========================================================================
   Mode chooser — big radio "cards". Uses :has() where supported, plus
   sibling-based fallback so it works everywhere.
   ========================================================================= */
.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}
.mode-tab {
    /* This IS a <label>, not a button, so no generic-button CSS bleeds in. */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 18px 20px 18px 46px;   /* extra left room for the radio dot */
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    min-height: 78px;
    transition: all 0.15s;
    position: relative;
    user-select: none;
}
.mode-tab:hover {
    border-color: var(--camel);
    background: var(--camel-tint);
}

/* Hide the native radio visually; keep it accessible + keyboard-focusable */
.mode-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px; height: 1px;
    margin: 0;
}

/* The visible custom "dot" */
.mode-tab::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    transition: all 0.15s;
    box-sizing: border-box;
}

/* Selected state via :has() (Chrome/Safari/FF 121+) */
.mode-tab:has(input[type="radio"]:checked) {
    background: var(--ink);
    border-color: var(--ink);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.mode-tab:has(input[type="radio"]:checked)::before {
    background: var(--camel);
    border-color: var(--camel);
    box-shadow: inset 0 0 0 4px var(--ink);
}
.mode-tab:has(input[type="radio"]:checked) .mode-desc { color: rgba(255, 255, 255, 0.7); }

/* Keyboard focus ring on the label */
.mode-tab:focus-within {
    outline: none;
    box-shadow: 0 0 0 3px rgba(163, 126, 85, 0.28);
}

.mode-tab .mode-title {
    font-family: "Times New Roman", Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.2;
}
.mode-tab .mode-desc {
    font-size: 12.5px;
    color: var(--muted);
    letter-spacing: 0;
    font-weight: 400;
}

.advanced { margin-top: 4px; }
.advanced summary {
    padding: 6px 0;
    font-size: 13px;
    color: var(--camel-dark);
}

/* =========================================================================
   Cache page stats
   ========================================================================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.stat {
    padding: 18px 20px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.stat-value {
    font-family: "Times New Roman", Georgia, serif;
    font-size: 32px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1;
}
.stat-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.purge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.purge-grid form { margin: 0; }
.purge-grid button { width: 100%; }

/* =========================================================================
   Mobile
   ========================================================================= */
@media (max-width: 720px) {
    .container { margin: 20px auto; padding: 0 14px; }

    .topbar {
        padding: 12px 16px;
        gap: 10px;
    }
    .topbar .brand { font-size: 15px; letter-spacing: 2px; }
    .topbar .brand .sub { display: block; margin: 4px 0 0; }
    .topbar nav {
        gap: 14px;
        width: 100%;
        justify-content: flex-end;
    }
    .topbar .who { display: none; }

    .card { padding: 22px 18px; border-radius: 4px; }
    .card.narrow { max-width: none; }

    .sheet-list {
        grid-template-columns: 1fr;
        max-height: 220px;
    }

    .mode-tabs { grid-template-columns: 1fr; }

    button, .btn { width: 100%; }
    button.primary.small,
    .row button,
    .inline-form button,
    details button { width: auto; }

    /* Table → stacked cards */
    .joblist thead { display: none; }
    .joblist, .joblist tbody, .joblist tr, .joblist td { display: block; width: 100%; }
    .joblist tr {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 12px 14px;
        margin-bottom: 12px;
        background: var(--surface);
    }
    .joblist td {
        border: none;
        padding: 4px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
    .joblist td::before {
        content: attr(data-label);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--muted);
        font-weight: 600;
    }
    .joblist td.actions {
        justify-content: flex-start;
        gap: 16px;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--line-soft);
    }
    .joblist td.actions::before { display: none; }

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

@media (max-width: 420px) {
    body { font-size: 14px; }
    .topbar .brand { font-size: 14px; }
    .topbar nav { gap: 10px; }
    .card { padding: 18px 14px; }
    .log { font-size: 11px; padding: 12px; }
}
