@font-face {
    font-family: 'Geist';
    src: url('/static/fonts/Geist-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('/static/fonts/Geist-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/* ── Design tokens (shadcn/ui scale) ──────────────────────────────── */
:root {
    --background:          #ffffff;
    --foreground:          #111827;
    --card:                #ffffff;
    --card-foreground:     #111827;
    --muted:               #f7f8fa;
    --muted-foreground:    #64748b;
    --border:              #e5e7eb;
    --input:               #e2e8f0;
    --primary:             #111827;
    --primary-dark:        #111827;
    --primary-light:       #f3f4f6;
    --primary-foreground:  #ffffff;
    --secondary:           #f1f5f9;
    --secondary-foreground:#334155;
    --accent:              #f5f6f8;
    --accent-foreground:   #111827;
    --destructive:         #dc2626;
    --destructive-light:   #fef2f2;
    --destructive-border:  #fca5a5;
    --success:             #16a34a;
    --success-light:       #f0fdf4;
    --success-border:      #86efac;
    --warning:             #d97706;
    --warning-light:       #fffbeb;
    --warning-border:      #fcd34d;
    --ring:                #111827;
    --radius:              0.5rem;

    /* Legacy aliases — used by older inline styles */
    --primary-blue:        #111827;
    --text-primary:        #0f172a;
    --text-secondary:      #64748b;
    --background-primary:  #f8fafc;
    --background-secondary:#f1f5f9;
    --bg:                  #f7f8fa;
    --card-bg:             #ffffff;
    --white:               #ffffff;
    --border-light:        #e2e8f0;
    --border-blue:         #d1d5db;
    --light-blue:          #f5f6f8;
    --accent-blue:         #111827;
    --monospace:           var(--sans-serif);
    --sans-serif:          'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--sans-serif);
    background: #f5f7fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--foreground);
    line-height: 1.6;
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.main-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    padding: 1.6rem 2rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.main-card:has(> .app-nav) {
    display: block;
    padding: 0;
    overflow: hidden;
    min-height: 100vh;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.main-card:has(> .app-nav) > :not(.app-nav) {
    min-width: 0;
    margin-left: calc(240px + 2rem);
    margin-right: 2rem;
}

.main-card:has(> .app-nav) > :not(.app-nav):first-of-type {
    margin-top: 1.75rem;
}

.main-card:has(> .app-nav) > :last-child:not(.app-nav) {
    margin-bottom: 2rem;
}

/* ── Page header ───────────────────────────────────────────────────── */
.header {
    text-align: left;
    margin: 2rem 0 1.75rem;
}

.header h1,
.page-header h1 {
    font-family: var(--sans-serif);
    color: var(--foreground);
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header p,
.page-header p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin: 0;
}

.page-header {
    text-align: left;
    margin: 2rem 0 1.75rem;
}

/* ── Heading cleanup ─────────────────────────────────────────────────
   Keep icons for actions/statuses, but remove decorative icons from
   page and section headings. */
.header h1 > i:first-child,
.header-actions h1 > i:first-child,
.page-header h1 > i:first-child,
h1 > i:first-child,
h2 > i:first-child,
h3 > i:first-child,
h4 > i:first-child,
h5 > i:first-child,
h6 > i:first-child,
.section-title > i:first-child,
.section-title-sm > i:first-child,
.endpoint-label > i:first-child,
.preview-title > i:first-child,
.card-header h5 > i:first-child,
.dashboard-panel-title h3 > i:first-child {
    display: none !important;
}

.section-title,
.section-title-sm {
    color: var(--foreground) !important;
    font-size: 1rem !important;
    font-weight: 650 !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    margin-bottom: 1.15rem !important;
}

.section-title::after {
    content: none !important;
    display: none !important;
}

/* ── Colour restraint ────────────────────────────────────────────────
   Neutral chrome by default; reserve green/amber/red for data meaning. */
.filter-btn,
.toggle-btn,
.filter-pill,
.status-badge,
.score-badge,
.em-score-badge,
.em-above-badge,
.badge-clean,
.badge-split {
    box-shadow: none !important;
}

.filter-btn.active,
.toggle-btn.active,
.filter-pill.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--primary-foreground) !important;
}

.badge-clean,
.badge-split,
.status-off,
.sc-none {
    background: var(--secondary) !important;
    color: var(--muted-foreground) !important;
    border-color: var(--border) !important;
}

.em-trend-badge,
.badge-rising,
.badge-stable,
.badge-falling,
.badge-dormant {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(17, 24, 39, 0.12) !important;
    color: var(--foreground) !important;
}

.badge-rising { color: var(--success) !important; }
.badge-falling { color: var(--destructive) !important; }
.badge-stable,
.badge-dormant { color: var(--muted-foreground) !important; }

.score-a,
.score-b,
.score-c,
.score-d,
.score-f,
.above-high,
.above-mid {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--foreground) !important;
}

.rising-callout {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--foreground) !important;
}

.rising-callout i {
    color: var(--success) !important;
}

.chart-callout,
.method-box,
.info-box,
.warning-box {
    border-left-width: 1px !important;
    border-left-color: var(--border) !important;
    border-radius: var(--radius) !important;
}

.chart-callout {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--muted-foreground) !important;
}

.stat-card.exact,
.stat-card.clean,
.stat-card.split {
    border-left: 1px solid var(--border) !important;
}

.sc-a,
.sc-b,
.sc-c,
.sc-d,
.sc-f,
.pct-mid {
    background: var(--secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--foreground) !important;
}

.region-metric,
.stat-row,
.metric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: baseline;
    gap: 0.75rem;
}

.region-metric > :first-child,
.stat-row > :first-child,
.metric-row > :first-child {
    min-width: 0;
}

.region-metric > :last-child,
.stat-row > :last-child,
.metric-row > :last-child {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── Typography ────────────────────────────────────────────────────── */
.h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

/* ── Form elements ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--foreground);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-family: var(--sans-serif);
    background: var(--background);
    color: var(--foreground);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

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

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17,24,39,0.10);
}

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

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--sans-serif);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    gap: 0.375rem;
    letter-spacing: 0;
}

.btn-primary {
    background: var(--primary-dark);
    color: var(--primary-foreground);
    border-color: var(--primary-dark);
}
.btn-primary:hover {
    background: #374151;
    border-color: #374151;
}
.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(17,24,39,0.12);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
}
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-outline-primary {
    background: transparent;
    color: var(--primary-dark);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--secondary); color: var(--foreground); }

.btn-destructive {
    background: var(--destructive);
    color: #ffffff;
    border-color: var(--destructive);
}
.btn-destructive:hover { background: #b91c1c; }

.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.625rem 1.5rem; font-size: 1rem; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.card-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h5 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* ── Progress ──────────────────────────────────────────────────────── */
.progress {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    background: var(--primary);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-foreground);
    font-size: 0.7rem;
    font-weight: 600;
}

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 500;
}

.badge-admin   { background: var(--destructive-light); color: var(--destructive); border: 1px solid var(--destructive-border); }
.badge-user    { background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border); }

/* ── Tables ────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
    text-align: left;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: var(--muted);
}
.table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table-hover tr:hover td { background: var(--muted); }

/* ── Lot cards (results page) ──────────────────────────────────────── */
.lot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.lot-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.lot-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.lot-image { width: 100%; height: 200px; object-fit: cover; background: var(--secondary); }
.lot-content { padding: 1rem; }
.lot-number {
    display: inline-block;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.625rem;
}
.lot-artist { font-weight: 600; color: var(--foreground); margin-bottom: 0.25rem; font-size: 0.9rem; }
.lot-title { color: var(--muted-foreground); font-style: italic; margin-bottom: 0.625rem; font-size: 0.85rem; line-height: 1.4; }
.lot-estimate { color: var(--success); font-weight: 500; font-size: 0.875rem; }

/* ── Flash / alert messages ────────────────────────────────────────── */
.flash-messages { margin-bottom: 1.25rem; }
.flash-message {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    border-width: 1px;
    border-style: solid;
}
.flash-error   { background: var(--destructive-light); border-color: var(--destructive-border); color: var(--destructive); }
.flash-success { background: var(--success-light); border-color: var(--success-border); color: var(--success); }
.flash-info    { background: var(--secondary); border-color: var(--border); color: var(--foreground); }
.flash-warning { background: var(--warning-light); border-color: var(--warning-border); color: var(--warning); }

/* ── Utility classes ───────────────────────────────────────────────── */
.d-flex          { display: flex; }
.d-inline-block  { display: inline-block; }
.d-block         { display: block; }
.d-none          { display: none; }
.d-grid          { display: grid; }
.flex-wrap       { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-2           { gap: 0.5rem; }
.gap-3           { gap: 0.75rem; }
.text-end        { text-align: right; }
.text-center     { text-align: center; }
.text-muted      { color: var(--muted-foreground); }
.text-success    { color: var(--success); }
.text-danger     { color: var(--destructive); }
.text-primary    { color: var(--primary-dark); }
.text-truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm         { font-size: 0.875rem; }
.small           { font-size: 0.8125rem; color: var(--muted-foreground); }
.fw-600          { font-weight: 600; }
.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1.25rem; }
.ms-auto{ margin-left: auto; }
.me-1  { margin-right: 0.25rem; }
.me-2  { margin-right: 0.5rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4  { padding-top: 1rem; padding-bottom: 1rem; }
.py-5  { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.p-0   { padding: 0; }
.h-100 { height: 100%; }
.w-100 { width: 100%; }
.row   { display: flex; flex-wrap: wrap; margin: -0.5rem; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; padding: 0.5rem; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; padding: 0.5rem; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; padding: 0.5rem; }
code {
    background: var(--secondary);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-family: var(--sans-serif);
    font-size: 0.85em;
    color: var(--foreground);
}

/* ── Two-level app nav ──────────────────────────────────────────────── */
.app-nav {
    grid-column: 1;
    grid-row: 1 / span 80;
    width: 240px;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 1.25rem 1rem 1rem;
    border-right: 1px solid var(--border);
    border-bottom: none;
    background: #fbfbfc;
    font-size: 0.8125rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.app-nav::before {
    content: "Auction Data Tool";
    display: block;
    margin-bottom: 0.35rem;
    color: var(--foreground);
    font-size: 0.95rem;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: none;
}

.app-nav:not(:has(.app-nav-sub))::after {
    content: none;
}

/* Primary bar: mode tabs (left) + profile (right) */
.app-nav-primary {
    display: contents;
}

/* Mode tabs */
.nav-modes {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    order: 1;
}
.nav-mode {
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 0.5rem 0.65rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    font-weight: 540;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.nav-mode:hover {
    color: var(--foreground);
    background: var(--secondary);
}
.nav-mode.active {
    color: var(--foreground);
    font-weight: 650;
    background: var(--secondary);
    border-color: transparent;
}

.nav-mode[href*="insights"].active {
    background: var(--primary);
    color: #ffffff;
}

/* Profile area (right side) */
.nav-profile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    order: 3;
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.user-info {
    color: var(--muted-foreground);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.35rem 0.55rem;
}
.nav-profile a {
    color: var(--muted-foreground);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.12s;
    padding: 0.42rem 0.55rem;
    border-radius: calc(var(--radius) - 2px);
}
.nav-profile a:hover {
    color: var(--foreground);
    background: var(--secondary);
}

/* Sub-nav row — Sales Data pages only */
.app-nav-sub {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.2rem;
    order: 2;
    position: relative;
    padding: 0 0 0 1.25rem;
    margin: -0.35rem 0 0.6rem 0.75rem;
    border-top: none;
    border-left: 1px solid var(--border);
}
.app-nav-sub a {
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 0.5rem 0.7rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 560;
}
.app-nav-sub a:hover { color: var(--foreground); background: var(--secondary); }
.app-nav-sub a.active {
    color: var(--foreground);
    font-weight: 650;
    background: #f1f3f6;
    border-color: transparent;
}

@media (max-width: 1100px) {
    .main-card:has(> .app-nav) {
        display: block;
    }
    .app-nav {
        width: 220px;
    }
    .main-card:has(> .app-nav) > :not(.app-nav) {
        margin-left: calc(220px + 1.5rem);
        margin-right: 1.5rem;
    }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .main-card:has(> .app-nav) {
        display: block;
        padding: 1.25rem;
    }
    .main-card:has(> .app-nav) > :not(.app-nav) {
        margin-left: 0;
        margin-right: 0;
    }
    .app-nav {
        position: static;
        width: auto;
        height: auto;
        min-height: 0;
        overflow: visible;
        margin-bottom: 1.5rem;
        padding: 0 0 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: transparent;
    }
    .app-nav-primary { gap: 0.75rem; }
    .nav-profile {
        border-top: 1px solid var(--border);
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }
    .nav-modes,
    .app-nav-sub {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .app-nav-sub {
        margin: 0;
        padding: 0.75rem 0 0;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* ── Tag / pill for admin role ─────────────────────────────────────── */
.role-pill {
    font-size: 0.65rem;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    font-weight: 600;
    border: 1px solid transparent;
}
.role-pill-admin { background: var(--destructive-light); color: var(--destructive); border-color: var(--destructive-border); }
.role-pill-user  { background: var(--secondary); color: var(--muted-foreground); border-color: var(--border); }

/* ── Checkbox group ────────────────────────────────────────────────── */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border);
}
.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-group label { margin: 0; cursor: pointer; font-size: 0.875rem; }

/* ── Toggle label (lot details) ────────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--muted);
    cursor: pointer;
}
.toggle-label:hover { border-color: var(--primary); }
.toggle-label input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }

/* ── Progress / debug log ──────────────────────────────────────────── */
.debug-logs {
    font-family: var(--sans-serif);
    font-size: 0.75rem;
    max-height: 180px;
    overflow-y: auto;
    background: var(--muted);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    margin-top: 0.75rem;
    color: var(--foreground);
}
.debug-logs .log-header { color: var(--primary-dark); font-weight: 600; margin-bottom: 0.35rem; }
#progressText { color: var(--muted-foreground); font-size: 0.875rem; }

/* ── Inline content block preview (results) ────────────────────────── */
.block-item {
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.85rem;
}

/* bootstrap-compat utility stubs for results.html ─────────────────── */
.table-responsive { overflow-x: auto; }
.bg-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.bg-primary   { background: var(--primary); color: var(--primary-foreground); }
.bg-success   { background: var(--success); color: #fff; }
.bg-info      { background: #0ea5e9; color: #fff; }
.text-info    { color: #0284c7; }
.card-title   { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.card-text    { font-size: 0.85rem; }
.fa-3x        { font-size: 2rem !important; }

/* ── Nav links (users / user_form pages) ────────────────────────────── */
.nav-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; align-items: center; }
.nav-link {
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    transition: background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-link:hover { background: var(--secondary); color: var(--foreground); }

/* ── Section headings (admin pages) ────────────────────────────────── */
.section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
    margin-bottom: 0.875rem;
}

/* ── Warning / info boxes ──────────────────────────────────────────── */
.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: var(--warning-light);
    border: 1px solid var(--warning-border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-bottom: 1.25rem;
}
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--foreground);
    margin-bottom: 1.25rem;
}

/* ── Password hint ─────────────────────────────────────────────────── */
.password-hint { font-size: 0.8rem; color: var(--muted-foreground); margin-top: 0.375rem; }

/* ── User table ─────────────────────────────────────────────────────── */
.user-table { width: 100%; border-collapse: collapse; }
.user-table th, .user-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.user-table th { background: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.user-table tr:hover td { background: var(--muted); }
.action-buttons { display: flex; gap: 0.375rem; }
.btn-edit { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn-edit:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-delete { background: var(--destructive); color: #fff; border-color: var(--destructive); }
.btn-delete:hover { background: #b91c1c; }
.header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

/* ── Filter bar ─────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; color: var(--muted-foreground); }
.filter-bar a { color: var(--primary-dark); text-decoration: none; }
.filter-bar a:hover { text-decoration: underline; }

/* ── Sales admin table ──────────────────────────────────────────────── */
.si-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.si-table th {
    text-align: left;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    background: var(--muted);
}
.si-table td {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    vertical-align: middle;
}
.si-table tr:last-child td { border-bottom: none; }
.si-table tr:hover td { background: var(--muted); }

/* Auction status badges */
.badge-completed { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-running   { background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border); }
.badge-pending   { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-failed    { background: var(--destructive-light); color: var(--destructive); border: 1px solid var(--destructive-border); }
.badge-auction-completed { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-auction-live      { background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border); }
.badge-auction-no_sold   { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-auction-no_data   { background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border); }

/* Trigger form */
.trigger-form { display: flex; gap: 0.625rem; align-items: center; }
.trigger-form input {
    flex: 1;
    max-width: 200px;
    background: var(--background);
    border: 1px solid var(--input);
    color: var(--foreground);
    padding: 0.45rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-family: var(--sans-serif);
    font-size: 0.85rem;
}
.trigger-form input::placeholder { color: var(--muted-foreground); opacity: 0.6; }
.trigger-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(17,24,39,0.10); }
#triggerStatus { font-size: 0.8rem; margin-top: 0.5rem; min-height: 1.2em; color: var(--muted-foreground); }

/* Empty state */
.empty-state {
    padding: 2.5rem;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}
.empty-state i { font-size: 1.5rem; opacity: 0.3; display: block; margin-bottom: 0.5rem; }

/* ── Sale detail page ───────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    text-align: left;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
    margin-top: 0.35rem;
    line-height: 1.35;
}

.lot-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.lot-table th {
    text-align: left;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    font-weight: 600;
    background: var(--muted);
}
.lot-table td {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    vertical-align: middle;
}
.lot-table tr:last-child td { border-bottom: none; }
.lot-table tr:hover td { background: var(--muted); }
.lot-rank { color: var(--muted-foreground); font-size: 0.75rem; font-family: var(--sans-serif); }
.artist-cell { font-weight: 600; }
.title-cell { color: var(--muted-foreground); font-style: italic; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price-cell { font-family: var(--sans-serif); font-weight: 600; white-space: nowrap; color: var(--primary-dark); }
.estimate-cell { font-family: var(--sans-serif); color: var(--muted-foreground); font-size: 0.78rem; white-space: nowrap; }
.delta-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    border-width: 1px;
    border-style: solid;
}
.delta-above { background: var(--success-light); color: var(--success); border-color: var(--success-border); }
.delta-within { background: var(--secondary); color: var(--muted-foreground); border-color: var(--border); }
.delta-below { background: var(--destructive-light); color: var(--destructive); border-color: var(--destructive-border); }
.lot-link { color: var(--primary); font-size: 0.75rem; text-decoration: none; }
.lot-link:hover { color: var(--primary-dark); }
.sell-bar-wrap { background: var(--border); border-radius: 9999px; height: 5px; width: 70px; overflow: hidden; display: inline-block; vertical-align: middle; }
.sell-bar { height: 100%; border-radius: 9999px; background: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body { padding: 0.75rem; }
    .main-card { padding: 1.25rem; }
    .col-md-4, .col-md-6 { flex: 0 0 100%; max-width: 100%; }
    .lot-grid { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.4rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Micro-animations ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.tech-pulse { }
