/* AATR Events -- Supabase-inspired dark theme
   Dark mode native, emerald green accent, border-defined depth.
   Font stack: system sans (CSP-compatible, no external fetches). */

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

:root {
    --accent: #3ecf8e;
    --accent-link: #00c573;
    --accent-border: rgba(62, 207, 142, 0.3);
    --danger: #ff6b7d;
    --warning: #f0bd5a;
    --success: #3ecf8e;

    --bg-page: #171717;
    --bg-sidebar: #0f0f0f;
    --bg-elev: #1a1a1a;
    --bg-input: #222222;
    --bg-hover: rgba(255,255,255,0.04);

    --border: #2e2e2e;
    --border-light: #363636;
    --border-subtle: #242424;

    --text: #e8edf5;
    --text-muted: #898989;
    --text-secondary: #b4b4b4;
    --text-heading: #fafafa;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-pill: 9999px;

    --shadow-sm: none;
    --shadow: none;
    --shadow-md: none;

    --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
}

html, body { min-height: 100%; }
html { color-scheme: dark; }

body {
    font-family: var(--font);
    font-size: 0.92rem;
    color: var(--text);
    background: var(--bg-page);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    color: var(--text-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
a { color: var(--accent-link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

/* ============ SIDEBAR LAYOUT ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: rgba(62, 207, 142, 0.15);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-brand {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-heading);
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    font-weight: 400;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.nav-section {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 20px 16px 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 1px 8px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    width: calc(100% - 16px);
    transition: all 0.12s ease;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-heading);
}

.nav-item.active {
    background: rgba(62, 207, 142, 0.1);
    color: var(--accent);
    font-weight: 500;
    border: 1px solid var(--accent-border);
}

.nav-item.logout-item {
    color: var(--danger);
    margin-top: auto;
}

.nav-item.logout-item:hover {
    background: rgba(255, 107, 125, 0.1);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-heading);
}

.nav-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 32px;
    max-width: 1200px;
    width: calc(100% - 240px);
}

/* Mobile header bar */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: 56px;
    align-items: center;
    justify-content: space-between;
}

/* ============ PAGE HEADER ============ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.12s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover {
    border-color: var(--border-light);
    color: var(--text-heading);
    background: var(--bg-hover);
}

.btn-primary {
    background: var(--bg-sidebar);
    color: var(--text-heading);
    border-color: var(--text-heading);
}

.btn-primary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-secondary {
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-warning {
    border-color: rgba(240, 189, 90, 0.3);
    color: var(--warning);
}

.btn-warning:hover {
    border-color: rgba(240, 189, 90, 0.6);
    background: rgba(240, 189, 90, 0.08);
}

.btn-danger {
    border-color: rgba(255, 107, 125, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    border-color: rgba(255, 107, 125, 0.6);
    background: rgba(255, 107, 125, 0.08);
}

.btn-full { width: 100%; justify-content: center; }

.btn-small {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
}

/* ============ CARDS ============ */
.card, .stat-card, .detail-card, .form-card, .shift-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    transition: border-color 0.15s ease;
}

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

.glass-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

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

.stat-card { text-align: center; }

.stat-number {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--accent);
}

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

.stat-warning .stat-number { color: var(--warning); }
.stat-danger .stat-number { color: var(--danger); }

/* ============ LIST HEADER ============ */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.list-header h1 { margin: 0; }

/* ============ EVENT LIST ============ */
.event-list { display: grid; gap: 0.75rem; }

.event-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-color: var(--border);
}

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

.event-card h3 { margin: 0.5rem 0 0.25rem; font-size: 1.1rem; }

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============ STATUS BADGES ============ */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-open {
    background: rgba(62, 207, 142, 0.12);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.status-locked {
    background: rgba(240, 189, 90, 0.12);
    color: var(--warning);
    border: 1px solid rgba(240, 189, 90, 0.3);
}

.status-completed {
    background: rgba(137, 137, 137, 0.12);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-cancelled, .status-deleted {
    background: rgba(255, 107, 125, 0.12);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 125, 0.3);
}

.event-type-badge {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

/* ============ LIST FILTERS ============ */
.list-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
}
.list-filters input, .list-filters select {
    padding: 7px 12px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.12s ease;
}
.list-filters input:focus, .list-filters select:focus {
    outline: none;
    border-color: var(--accent-border);
}
.list-filters .filter-search { flex: 1; min-width: 200px; }
.list-filters .filter-toggle {
    display: flex;
    align-items: center; gap: 0.35rem;
    font-size: 13px; color: var(--text-secondary);
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; margin-bottom: 0.35rem;
    font-size: 0.85rem; color: var(--text-muted); font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 0.7rem 0.95rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.12s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent-border);
}
.form-group textarea { resize: vertical; min-height: 4.5rem; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; color: var(--text); }
.form-error, .form-hint { font-size: 0.85rem; margin-top: 0.35rem; }
.form-error { color: var(--danger); }
.form-hint { color: var(--text-muted); }
.form-group select option, select option { background: var(--bg-input); color: var(--text); }

/* ============ TABLES ============ */
.table-responsive { overflow-x: auto; margin-bottom: 1rem; }
.data-table, .catalog-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; font-size: 0.92rem;
}
.data-table th, .catalog-table th {
    background: var(--bg-sidebar);
    padding: 0.75rem 1rem; text-align: left;
    font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted); white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table td, .catalog-table td {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-subtle);
    vertical-align: top;
}
.data-table a, .catalog-table a { color: var(--accent-link); }
.data-table a:hover, .catalog-table a:hover { color: var(--accent); }
.total-row td { font-weight: 700; background: rgba(0,0,0,0.2); }
.row-flagged { background: rgba(240,189,90,0.06); }
.catalog-inactive { opacity: 0.55; }

/* ============ EVENTS TABLE ============ */
.events-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.events-table th, .events-table td {
    padding: 0.1rem 0.6rem; text-align: left;
    vertical-align: middle; white-space: nowrap; line-height: 1.2;
}
.events-table th {
    font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.events-table tbody tr + tr td { border-top: 1px solid var(--border-subtle); padding-top: 0.05rem; padding-bottom: 0.05rem; }
.events-table td:nth-child(3) { white-space: normal; min-width: 10rem; }
.events-table td:nth-child(4) { white-space: normal; min-width: 14rem; }
.event-deleted { opacity: 0.45; }

/* ============ ALERTS ============ */
.alert {
    padding: 0.75rem 1rem; border-radius: var(--radius);
    margin-bottom: 1rem; font-size: 0.92rem;
    border: 1px solid var(--border);
}
.alert-error { background: rgba(255,107,125,0.08); color: var(--danger); border-color: rgba(255,107,125,0.25); }
.alert-warning { background: rgba(240,189,90,0.08); color: var(--warning); border-color: rgba(240,189,90,0.25); }
.alert-info { background: rgba(62,207,142,0.08); color: var(--accent); border-color: var(--accent-border); }

/* ============ EVENT DETAIL ============ */
.detail-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.5rem 1rem;
    margin-bottom: 1.25rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.detail-header-right { display: flex; align-items: center; gap: 0.75rem; }
.detail-header h1 { font-size: 1.75rem; margin: 0; }
.detail-section {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem; page-break-inside: avoid; break-inside: avoid;
}
.detail-section h2 {
    font-size: 0.8rem; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.85rem; padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border-subtle);
}
.detail-section dl { display: grid; grid-template-columns: 1fr; gap: 0.4rem 1rem; margin: 0; }
.detail-section dt { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; padding-top: 0.1rem; }
.detail-section dd { margin: 0 0 0.35rem; color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; }
.detail-actions {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin: 1rem 0 1.5rem; padding: 0.85rem 1rem;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.detail-actions .btn { margin: 0; }

@media (min-width: 700px) {
    .detail-section dl { grid-template-columns: minmax(11rem, auto) 1fr; gap: 0.5rem 1.25rem; }
    .detail-section dt, .detail-section dd { padding: 0; }
}

/* ============ ACTION TOOLBARS ============ */
.action-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.action-row .row-action-form, .action-row form { margin: 0; }
.action-row .btn { margin: 0; }
.inline-form, .row-action-form { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }
.cancel-details { margin: 0; }
.action-row .cancel-details[open] { flex-basis: 100%; }
.cancel-details > summary { list-style: none; display: inline-flex; cursor: pointer; }
.cancel-details > summary::-webkit-details-marker { display: none; }
.cancel-form {
    margin-top: 0.75rem; padding: 0.85rem 1rem;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
    display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
}
.cancel-form p { width: 100%; margin: 0 0 0.25rem; color: var(--text-muted); }
.cancel-form label { display: inline-flex; align-items: center; gap: 0.35rem; }
.cancel-form input[type="text"] { padding: 0.3rem 0.55rem; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.92rem; }

/* ============ ROSTER ADD FORM ============ */
.roster-add-form {
    display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
    margin: 0.6rem 0 0; padding: 0.65rem 0.85rem;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.roster-add-form label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-muted); font-size: 0.88rem; }
.roster-add-form input[type="text"], .roster-add-form input[type="number"], .roster-add-form select {
    padding: 0.3rem 0.55rem; background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.92rem; line-height: 1.1; color-scheme: dark;
}
.roster-add-form input[type="number"] { width: 5rem; }
.roster-add-form input[type="text"] { min-width: 9rem; }
.roster-add-form .btn { margin-left: auto; }

/* ============ NOTES FORM ============ */
.notes-form { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; }
.notes-form textarea {
    width: 100%; padding: 0.55rem 0.75rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: inherit; font-size: 0.92rem; line-height: 1.45;
    resize: vertical; min-height: 5rem;
}
.notes-form textarea:focus { outline: none; border-color: var(--accent-border); }

/* ============ DROPDOWN ============ */
.btn-dropdown { position: relative; display: inline-block; }
.btn-dropdown > summary { cursor: pointer; list-style: none; user-select: none; }
.btn-dropdown > summary::-webkit-details-marker { display: none; }
.btn-dropdown[open] > summary { background: var(--bg-hover); }
.btn-dropdown-menu {
    position: absolute; top: calc(100% + 0.25rem); left: 0; z-index: 30;
    min-width: 11rem; padding: 0.35rem;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; gap: 0.2rem;
}
.btn-dropdown-menu form { margin: 0; }
.btn-dropdown-item {
    width: 100%; text-align: left; padding: 0.5rem 0.75rem;
    background: transparent; border: 0; color: inherit;
    border-radius: var(--radius-sm); cursor: pointer; font: inherit;
}
.btn-dropdown-item:hover { background: var(--bg-hover); }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center; }
.row-action-form { display: inline; margin: 0; }

/* ============ CATALOG ============ */
.catalog-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 720px; }
.catalog-form > label { display: flex; flex-direction: column; gap: 0.4rem; font-weight: 600; }
.catalog-form > label > input, .catalog-form > label > select, .catalog-form > label > textarea {
    width: 100%; padding: 0.55rem 0.75rem;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); color: inherit; font: inherit; font-weight: 400;
}
.catalog-form > label > textarea { min-height: 5rem; resize: vertical; }
.catalog-form .field-hint { display: block; font-weight: 400; font-size: 0.85rem; line-height: 1.35; color: var(--text-muted); }
.catalog-form .field-hint code { background: rgba(255,255,255,0.08); padding: 0 0.3rem; border-radius: 0.25rem; font-size: 0.85em; }
.catalog-form .checkbox-label { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 600; }
.catalog-form .hint-list { margin: 0.4rem 0 0.4rem 1.1rem; padding: 0; list-style: disc; font-weight: 400; }
.catalog-form .hint-list li { margin: 0.15rem 0; }
.catalog-form .hint-details { margin-top: 0.4rem; font-weight: 400; }
.catalog-form .hint-details > summary { cursor: pointer; user-select: none; color: var(--text-muted); font-size: 0.85rem; padding: 0.15rem 0; }
.catalog-form .hint-details[open] > summary { color: var(--text-secondary); }
.catalog-form .hint-details > input[type="text"] { width: 100%; margin-top: 0.4rem; padding: 0.55rem 0.75rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; font: inherit; font-weight: 400; }
.catalog-form .applies-when-preset { width: 100%; padding: 0.45rem 0.65rem; margin-bottom: 0.4rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; font: inherit; font-weight: 400; }

.variable-chips { margin: 1rem 0; }
.variable-chips h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.chip {
    display: inline-block; padding: 0.2rem 0.6rem; margin: 0.2rem;
    border: 1px solid var(--border); background: var(--bg-input);
    color: var(--accent); border-radius: var(--radius);
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 0.85rem; cursor: pointer; transition: background 0.15s;
}
.chip:hover { background: rgba(62,207,142,0.1); }
.preview-panel { margin: 1rem 0; padding: 1rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.preview-panel h3 { font-size: 0.9rem; margin: 0 0 0.75rem; color: var(--text-heading); }
#preview-results { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.preview-cell { flex: 1 1 120px; padding: 0.75rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); }
.preview-label { font-size: 0.75rem; color: var(--text-muted); }
.preview-value { font-size: 1.3rem; font-weight: 700; color: var(--accent); word-break: break-word; }
.preview-error { color: var(--danger); font-size: 0.85rem; font-weight: normal; }
.preview-skipped { color: var(--text-muted); font-size: 0.95rem; font-weight: normal; font-style: italic; }

/* ============ PACK LIST ============ */
.packlist-page .packlist-header { margin-bottom: 1.5rem; }
.packlist-page .packlist-header h1 { margin: 0 0 0.5rem; font-size: 1.75rem; }
.packlist-page .meta { color: var(--text-muted); margin: 0 0 0.75rem; font-size: 0.95rem; }
.packlist-page .packlist-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.packlist-page .packlist-actions button {
    padding: 0.5rem 1rem; border: 1px solid var(--border);
    background: var(--bg-input); color: var(--text);
    border-radius: var(--radius); font-size: 0.9rem;
    cursor: pointer; font-weight: 500;
}
.packlist-page .packlist-actions button:hover { border-color: var(--accent); color: var(--accent); }
.packlist-page .contact { background: rgba(240,189,90,0.08); padding: 0.5rem 0.75rem; border-left: 3px solid var(--warning); margin: 0 0 1rem; border-radius: 4px; color: var(--text); }
.packlist-page .day-before, .packlist-page .day-of { margin-bottom: 2rem; }
.packlist-page .day-before > h2, .packlist-page .day-of > h2 { color: var(--accent); font-size: 1.25rem; margin-bottom: 0.75rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); }
.packlist-page .team-block { margin: 1rem 0 1.5rem; padding: 1rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); page-break-inside: avoid; break-inside: avoid; }
.packlist-page .team-block > h3 { color: var(--text-heading); margin-bottom: 0.75rem; }
.packlist-page .section-block { margin: 0.75rem 0 1.25rem; page-break-inside: avoid; break-inside: avoid; }
.packlist-page .section-block h3, .packlist-page .section-block h4 { margin: 0.5rem 0 0.35rem; font-size: 0.95rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.packlist-page .pl-list { list-style: none; padding: 0; margin: 0; }
.packlist-page .pl-item { padding: 0.2rem 0; }
.packlist-page .pl-item label { display: flex; align-items: baseline; gap: 0.5rem; cursor: pointer; }
.packlist-page .pl-item input[type="checkbox"] { flex-shrink: 0; }
.packlist-page .pl-name { white-space: nowrap; color: var(--text); }
.packlist-page .pl-dots { flex: 1; border-bottom: 1px dotted var(--border); margin: 0 6px; min-width: 2rem; }
.packlist-page .pl-qty { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.packlist-page .empty-state { color: var(--text-muted); padding: 2rem; text-align: center; font-style: italic; }
.packlist-page #rule-errors { margin-bottom: 1.5rem; }
.packlist-page #rule-errors ul { margin-left: 1.25rem; margin-top: 0.5rem; }
.packlist-page #rule-errors code { background: rgba(255,107,125,0.12); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.85rem; }

/* ============ RULES REVIEW ============ */
.sweep-review h1 { margin-bottom: 0.5rem; }
.service-tabs {
    display: flex; gap: 0.4rem; margin-bottom: 1.25rem;
    padding: 0.35rem; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    width: fit-content;
}
.service-tabs .tab {
    padding: 0.5rem 1.1rem; color: var(--text-muted);
    text-decoration: none; border: 1px solid transparent;
    border-radius: var(--radius-pill); font-weight: 600; font-size: 0.88rem;
    transition: color 0.18s ease, background 0.18s ease;
}
.service-tabs .tab:hover { color: var(--text); }
.service-tabs .tab-active { background: var(--bg-sidebar); color: var(--accent); border-color: var(--accent-border); }

.scenario-panel {
    display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.25rem; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
}
.scenario-panel label { display: flex; flex-direction: column; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; gap: 0.35rem; font-weight: 600; }
.scenario-panel label.checkbox-label { flex-direction: row; align-items: center; text-transform: none; letter-spacing: normal; font-size: 0.92rem; color: var(--text); font-weight: 500; align-self: flex-end; padding-bottom: 0.6rem; }
.scenario-panel select, .scenario-panel input[type="text"] { padding: 0.55rem 0.85rem; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; min-width: 11rem; font-family: inherit; transition: border-color 0.12s ease; }
.scenario-panel select:focus, .scenario-panel input[type="text"]:focus { outline: none; border-color: var(--accent-border); }
.scenario-panel select[name="tables"] { min-width: 13rem; }
.scenario-panel .field, .scenario-panel .field-check { display: flex; flex-direction: column; gap: 0.25rem; }
.scenario-panel .field span { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.scenario-panel .field-check { flex-direction: row; align-items: center; gap: 0.4rem; align-self: flex-end; padding-bottom: 0.4rem; }
.scenario-panel .field-check span { font-size: 0.9rem; color: var(--text); text-transform: none; letter-spacing: normal; }

.sweep-grid-wrap { overflow-x: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.sweep-grid { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.sweep-grid thead th { background: var(--bg-sidebar); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-size: 0.72rem; padding: 0.55rem 0.65rem; text-align: right; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.sweep-grid thead th.sticky:first-child, .sweep-grid thead th.sticky:nth-child(2) { text-align: left; position: sticky; z-index: 3; background: var(--bg-sidebar); }
.sweep-grid thead th.sticky:first-child { left: 0; }
.sweep-grid thead th.sticky:nth-child(2) { left: 14rem; }
.sweep-grid tbody td { padding: 0.45rem 0.65rem; border-top: 1px solid var(--border-subtle); text-align: right; white-space: nowrap; }
.sweep-grid tbody td.sticky { text-align: left; position: sticky; background: var(--bg-elev); z-index: 1; }
.sweep-grid tbody td.sticky:first-child { left: 0; min-width: 14rem; font-weight: 500; color: var(--text); border-right: 1px solid var(--border); }
.sweep-grid tbody td.sticky:nth-child(2) { left: 14rem; color: var(--text-muted); font-size: 0.8rem; border-right: 1px solid var(--border); }
.sweep-grid tbody tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.sweep-grid tbody tr:nth-child(even) td.sticky { background: #1a1a1a; }
.sweep-grid tbody tr:hover td { background: rgba(62,207,142,0.04); }
.sweep-grid tbody tr:hover td.sticky { background: #1e1e1e; }
.sweep-cell { font-weight: 500; }
.sweep-blank { color: #3a4a5a; font-weight: 300; }

.review-head h1 { margin-bottom: 0.25rem; }
.review-head .meta { color: var(--text-muted); margin-bottom: 1rem; }
.review-summary { color: var(--text-muted); font-size: 0.9rem; margin: 0.75rem 0 1rem; }
.review-summary strong { color: var(--accent); font-weight: 700; }
.review-summary .muted { color: var(--text-muted); margin-left: 0.5rem; }
.review-list-wrap { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.5rem 1.6rem 1.5rem; }
.review-section { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; padding: 1.25rem 0 0.5rem; border-bottom: 1px solid var(--border-subtle); margin-bottom: 0.4rem; }
.review-section:first-child { padding-top: 0.5rem; }
.review-list { list-style: none; padding: 0; margin: 0 0 0.4rem; }
.review-row { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.5rem 0.5rem; border-radius: var(--radius-sm); transition: background 0.15s ease; }
.review-row:hover { background: rgba(62,207,142,0.04); }
.review-name { color: var(--text); font-size: 0.98rem; font-weight: 500; }
.review-dots { flex: 1; border-bottom: 1px dotted var(--border-light); margin: 0 0.65rem; min-width: 1.5rem; transform: translateY(-4px); }
.review-qty { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; color: var(--accent); min-width: 3rem; text-align: right; letter-spacing: -0.01em; }

/* ============ LOGIN PAGE ============ */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg-page);
}
.login-card {
    background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    width: 100%; max-width: 400px; margin: 1rem;
}
.login-card h1 { text-align: center; color: var(--accent); margin-bottom: 0.35rem; font-size: 1.6rem; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.75rem; font-size: 0.95rem; }

/* ============ WIZARD ============ */
.wizard-steps {
    display: flex; gap: 0.35rem; margin-bottom: 1.5rem;
    padding: 0.3rem; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    width: fit-content; flex-wrap: wrap;
}
.wizard-step-btn {
    padding: 0.45rem 1rem; color: var(--text-muted);
    border: 1px solid transparent; border-radius: var(--radius-pill);
    font-weight: 500; font-size: 0.85rem; cursor: pointer;
    background: transparent; font-family: inherit;
    transition: all 0.15s ease;
}
.wizard-step-btn:hover { color: var(--text); }
.wizard-step-btn.active { background: var(--bg-sidebar); color: var(--accent); border-color: var(--accent-border); }
.wizard-step { margin-bottom: 1.5rem; }
.wizard-step h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text-heading); }
.wizard-step .step-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }
.wizard-nav {
    display: flex; gap: 0.5rem; margin-top: 1rem;
    padding: 0.85rem 1rem; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    align-items: center; flex-wrap: wrap;
}

/* ============ MISC HELPERS ============ */
.hidden { display: none !important; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; }
.empty-note { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }
.muted { color: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (min-width: 768px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
    .sidebar { display: none; }
    .sidebar.open { display: flex; }
    .sidebar-overlay.open { display: block; }
    .mobile-header { display: flex; }
    .main-content { margin-left: 0; width: 100%; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .event-list { grid-template-columns: repeat(2, 1fr); }
}

/* ============ PRINT ============ */
@media print {
    .sidebar, .mobile-header, .sidebar-overlay,
    .no-print, form, button { display: none !important; }
    body { background: white; color: black; font-family: Georgia, "Times New Roman", serif; font-size: 12pt; }
    .main-content { margin-left: 0; width: 100%; }
    .packlist-page .section-block, .packlist-page .team-block { page-break-inside: avoid; break-inside: avoid; background: white; border: none; padding: 0; }
    .packlist-page .team-block > h3, .packlist-page .day-before > h2, .packlist-page .day-of > h2 { color: black; }
    .packlist-page .pl-dots { border-bottom-color: black; }
    .packlist-page .pl-name, .packlist-page .pl-qty { color: black; }
    .packlist-page .section-block h3, .packlist-page .section-block h4 { color: black; }
    .alert, .alert-error { border: 1px solid black; background: white; color: black; }
    .detail-header, .detail-section h2 { border-bottom-color: black; }
    .detail-header h1, .detail-section h2 { color: black; }
    .detail-section { background: white; border: 1px solid #666; page-break-inside: avoid; break-inside: avoid; }
    .detail-section h2 { border-bottom-color: #666; }
    .detail-section dt { color: #444; }
    .detail-section dd { color: black; }
    .detail-actions { display: none !important; }
    .status-badge { border: 1px solid #666; color: black !important; background: white !important; }
    @page { margin: 0.75in; }
