:root {
    /* ----- Typography -------------------------------------------- */
    --accent-text-primary: #351c71;
    --accent-text-secondary: #7c3aed;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #737373;
    --stroke-soft: #e5e5e5;

    /* ----- Surfaces ---------------------------------------------- */
    --bg-base: #f8f9fc;
    --bg-surface: #eef0f7;
    --bg-elevated: #ffffff;

    /* ----- Primary Button ---------------------------------------- */
    --primary-bg: #7c3aed;
    --primary-bg-hover: #6a2fdb;
    --primary-bg-active: #5a26c7;
    --primary-text: #ffffff;
    --primary-focus: #c9b6ff;

    /* ----- Secondary Button -------------------------------------- */
    --secondary-bg: #ffffff;
    --secondary-text: #351c71;
    --secondary-border: #d2d2d7;
    --secondary-hover: #eef0f7;
    --secondary-active: #e4e6ef;

    /* ----- Inputs & Controls ------------------------------------- */
    --field-bg: #f6f0ff;
    --field-border: #d2d2d7;
    --field-text: #1a1a1a;
    --field-placeholder: #737373;
    --field-focus: #c9b6ff;

    /* ----- Destructive Palette ------------------------------------------- */
    --destructive-bg: #dc2626;
    --destructive-text: #ffffff;
    --destructive-hover: #b91c1c;
    --destructive-active: #9f1818;
    --destructive-focus: #fca5a5;

    /* ----- Constructive Palette ------------------------------------------ */
    --constructive-bg: #2ab56f;
    --constructive-text: #ffffff;
    --constructive-hover: #23985d;
    --constructive-active: #1d7f4d;
    --constructive-focus: #a7f3d0;

    /* ----- Disabled Palette ---------------------------------------------- */
    --disabled-text: #c7c7c7;
    --disabled-bg: #f0f0f0;
    --disabled-border: #e0e0e0;

    /* ----- Menus, Popovers & Dropdowns ----------------------------------- */
    --menu-bg: #ffffff;
    --menu-border: #dcdce7;
    --menu-divider: #ecebf7;
    --menu-item-hover: #eef0f7;
    --menu-item-active: #e4e6ef;
    --menu-shadow: 0 22px 48px rgba(53, 28, 113, 0.16);
    --overlay-scrim: rgba(16, 18, 27, 0.32);

    /* ----- Color Series ------------------------------------------ */
    --series-1: #7c3aed;
    --series-2: #351c71;
    --series-3: #c0392b;
    --series-4: #e67e22;
    --series-5: #f1c40f;
    --series-6: #16a085;
    --series-7: #27ae60;
    --series-8: #2980b9;
    --series-9: #8e44ad;
    --series-10: #2c3e50;
    --series-11: #7f8c8d;
    --series-12: #d35400;

    /* Typography scale */
    --vh-text-xxs: 0.5rem;
    /* 8px */
    --vh-text-xs: 0.75rem;
    /* 12px */
    --vh-text-sm: 0.875rem;
    /* 14px */
    --vh-text-md: 1rem;
    /* 16px */
    --vh-text-lg: 1.25rem;
    /* 20px */
    --vh-text-xl: 1.5rem;
    /* 24px */
    --vh-text-2xl: 2rem;
    /* 32px */
    --vh-text-3xl: 2.5rem;
    /* 40px */

    /* Line-height pairings */
    --vh-leading-tight: 1.1;
    --vh-leading-standard: 1.4;
    --vh-leading-relaxed: 1.6;

    /* Button height + horizontal padding pattern */
    --vh-button-height-xs: 2rem;
    /* 32px */
    --vh-button-height-sm: 2.5rem;
    /* 40px */
    --vh-button-height-md: 3rem;
    /* 48px */
    --vh-button-height-lg: 3.5rem;
    /* 56px */

    --vh-button-padding-xs: 0 0.75rem;
    --vh-button-padding-sm: 0 1rem;
    --vh-button-padding-md: 0 1.25rem;
    --vh-button-padding-lg: 0 1.5rem;

    --vh-button-radius-xs: 4px;
    --vh-button-radius-sm: 6px;
    --vh-button-radius-md: 8px;
    --vh-button-radius-lg: 10px;
}

/* ==========================================================================
   Global Resets & Base
   ========================================================================== */

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

html {
    font-size: 16px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 0.8rem 0;
    font-family: "TT Norms Pro", "Avenir Next", -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: var(--vh-leading-tight);
}


a {
    color: var(--accent-text-secondary);
    text-decoration: none;
    transition: color 160ms ease;
}

a:hover,
a:focus-visible {
    color: var(--accent-text-primary);
}

ul,
ol {
    margin: 0;
    padding-left: 1.25rem;
}

button {
    font-family: inherit;
    font-size: inherit;
    background: none;
    border: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-focus) 40%, transparent);
}

::selection {
    background: color-mix(in srgb, var(--accent-text-secondary) 25%, transparent);
}

/* ==========================================================================
   Typography Utilities
   ========================================================================== */

.vh-text-xxs {
    font-size: var(--vh-text-xxs);
    line-height: var(--vh-leading-standard);
}

.vh-text-xs {
    font-size: var(--vh-text-xs);
    line-height: var(--vh-leading-standard);
}

.vh-text-sm {
    font-size: var(--vh-text-sm);
    line-height: var(--vh-leading-standard);
}

.vh-text-md {
    font-size: var(--vh-text-md);
    line-height: var(--vh-leading-standard);
}

.vh-text-lg {
    font-size: var(--vh-text-lg);
    line-height: var(--vh-leading-tight);
}

.vh-text-xl {
    font-size: var(--vh-text-xl);
    line-height: var(--vh-leading-tight);
}

.vh-text-2xl {
    font-size: var(--vh-text-2xl);
    line-height: var(--vh-leading-tight);
}

.vh-text-3xl {
    font-size: var(--vh-text-3xl);
    line-height: var(--vh-leading-tight);
}

.vh-text-muted {
    color: var(--text-muted);
}

.vh-text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.vh-weight-medium {
    font-weight: 500;
}

.vh-weight-semibold {
    font-weight: 500;
}

/* ==========================================================================
   Button System
   ========================================================================== */

.vh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--vh-button-radius-md);
    padding: var(--vh-button-padding-md);
    min-height: var(--vh-button-height-md);
    line-height: 1;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease,
        color 160ms ease, box-shadow 160ms ease;
}

.vh-button:focus-visible {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-focus) 35%, transparent);
}

.vh-button[disabled],
.vh-button.is-disabled {
    cursor: not-allowed;
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    border-color: var(--disabled-border);
    box-shadow: none;
}

.vh-button--primary {
    background-color: var(--primary-bg);
    color: var(--primary-text);
}

.vh-button--primary:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--primary-bg-hover);
}

.vh-button--primary:active:not([disabled]):not(.is-disabled) {
    background-color: var(--primary-bg-active);
}

.vh-button--secondary {
    background-color: var(--secondary-bg);
    color: var(--secondary-text);
    border-color: var(--secondary-border);
}

.vh-button--secondary:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--secondary-hover);
}

.vh-button--secondary:active:not([disabled]):not(.is-disabled) {
    background-color: var(--secondary-active);
}

.vh-button--constructive {
    background-color: var(--constructive-bg);
    color: var(--constructive-text);
}

.vh-button--constructive:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--constructive-hover);
}

.vh-button--constructive:active:not([disabled]):not(.is-disabled) {
    background-color: var(--constructive-active);
}

.vh-button--destructive {
    background-color: var(--destructive-bg);
    color: var(--destructive-text);
}

.vh-button--destructive:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--destructive-hover);
}

.vh-button--destructive:active:not([disabled]):not(.is-disabled) {
    background-color: var(--destructive-active);
}

.vh-button--ghost {
    background-color: transparent;
    color: var(--accent-text-primary);
    border-color: transparent;
}

.vh-button--ghost:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--secondary-hover);
}

.vh-button--ghost:active:not([disabled]):not(.is-disabled) {
    background-color: var(--secondary-active);
}

.vh-button-xs {
    font-size: var(--vh-text-xs);
    min-height: var(--vh-button-height-xs);
    padding: var(--vh-button-padding-xs);
    border-radius: var(--vh-button-radius-xs);
}

.vh-button-sm {
    font-size: var(--vh-text-sm);
    min-height: var(--vh-button-height-sm);
    padding: var(--vh-button-padding-sm);
    border-radius: var(--vh-button-radius-sm);
}

.vh-button-md {
    font-size: var(--vh-text-md);
    min-height: var(--vh-button-height-md);
    padding: var(--vh-button-padding-md);
    border-radius: var(--vh-button-radius-md);
}

.vh-button-lg {
    font-size: var(--vh-text-lg);
    min-height: var(--vh-button-height-lg);
    padding: var(--vh-button-padding-lg);
    border-radius: var(--vh-button-radius-lg);
}

/* Icon-only buttons */
.vh-button--icon {
    padding: 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-width: 2px;
    border-radius: 12px;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.vh-button--icon svg {
    width: 60%;
    height: 60%;
}

.vh-button--icon.vh-button-xs {
    width: var(--vh-button-height-xs);
    height: var(--vh-button-height-xs);
}

.vh-button--icon.vh-button-sm {
    width: var(--vh-button-height-sm);
    height: var(--vh-button-height-sm);
}

.vh-button--icon.vh-button-md {
    width: var(--vh-button-height-md);
    height: var(--vh-button-height-md);
}

.vh-button--icon.vh-button-lg {
    width: var(--vh-button-height-lg);
    height: var(--vh-button-height-lg);
}

.vh-button--icon.vh-button--secondary {
    background: var(--secondary-bg);
    border-color: var(--secondary-border);
    color: var(--secondary-text);
}

.vh-button--icon.vh-button--secondary:hover:not([disabled]):not(.is-disabled) {
    background: var(--secondary-hover);
}

.vh-button--icon.vh-button--secondary:active:not([disabled]):not(.is-disabled) {
    background: var(--secondary-active);
}

.vh-button--icon.vh-button--primary {
    background-color: var(--primary-bg);
    border-color: var(--primary-focus);
    color: var(--primary-text);
}

.vh-button--icon.vh-button--primary:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--primary-bg-hover);
    border-color: var(--primary-focus);
}

.vh-button--icon.vh-button--primary:active:not([disabled]):not(.is-disabled) {
    background-color: var(--primary-bg-active);
    border-color: var(--primary-focus);
}

.vh-button--icon.vh-button--constructive {
    background-color: var(--constructive-bg);
    border-color: var(--constructive-focus);
    color: var(--constructive-text);
}

.vh-button--icon.vh-button--constructive:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--constructive-hover);
    border-color: var(--constructive-focus);
}

.vh-button--icon.vh-button--constructive:active:not([disabled]):not(.is-disabled) {
    background-color: var(--constructive-active);
    border-color: var(--constructive-focus);
}

.vh-button--icon.vh-button--destructive {
    background-color: var(--destructive-bg);
    border-color: var(--destructive-focus);
    color: var(--destructive-text);
}

.vh-button--icon.vh-button--destructive:hover:not([disabled]):not(.is-disabled) {
    background-color: var(--destructive-hover);
    border-color: var(--destructive-focus);
}

.vh-button--icon.vh-button--destructive:active:not([disabled]):not(.is-disabled) {
    background-color: var(--destructive-active);
    border-color: var(--destructive-focus);
}

/* ==========================================================================
   Form & Input System
   ========================================================================== */

.vh-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.vh-field__label {
    font-size: var(--vh-text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.vh-field__hint {
    font-size: var(--vh-text-xs);
    color: var(--text-muted);
}

.vh-input,
.vh-textarea {
    appearance: none;
    font-family: inherit;
    font-size: var(--vh-text-md);
    border-radius: 10px;
    border: 1px solid var(--menu-border);
    background-color: var(--menu-bg);
    color: var(--field-text);
    padding: 0.65rem 0.85rem;
    transition: border-color 140ms ease, box-shadow 140ms ease,
        background-color 140ms ease;
    width: 100%;
}

.vh-input::placeholder,
.vh-textarea::placeholder {
    color: var(--field-placeholder);
}

.vh-input:hover,
.vh-textarea:hover {
    border-color: var(--field-border);
}

.vh-input:focus,
.vh-textarea:focus {
    outline: none;
    border-color: var(--field-focus);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--field-focus) 20%, transparent);
}

.vh-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: var(--vh-leading-relaxed);
}

.vh-input:disabled,
.vh-textarea:disabled {
    cursor: not-allowed;
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    border-color: var(--disabled-border);
}

select.vh-input {
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%234a4a4a' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 16px;
}

/* Search Bar */
.vh-search {
    position: relative;
    display: flex;
    align-items: center;
}

.vh-search__input {
    appearance: none;
    font-family: inherit;
    font-size: var(--vh-text-md);
    border-radius: 10px;
    border: 1px solid var(--menu-border);
    background-color: var(--menu-bg);
    color: var(--field-text);
    padding: 0.65rem 0.85rem 0.65rem 2.5rem;
    width: 100%;
    transition: border-color 140ms ease, box-shadow 140ms ease,
        background-color 140ms ease;
}

.vh-search__input::placeholder {
    color: var(--field-placeholder);
}

.vh-search__input:hover {
    border-color: var(--field-border);
}

.vh-search__input:focus {
    outline: none;
    border-color: var(--field-focus);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--field-focus) 20%, transparent);
}

.vh-search__icon {
    position: absolute;
    left: 0.75rem;
    width: 18px;
    height: 18px;
    pointer-events: none;
    color: var(--text-muted);
}

/* ==========================================================================
   Dropdown / Menu System
   ========================================================================== */

details.vh-dropdown {
    position: relative;
    display: inline-block;
    min-width: 220px;
}

summary.vh-dropdown__trigger {
    list-style: none;
    cursor: pointer;
}

summary.vh-dropdown__trigger::-webkit-details-marker {
    display: none;
}

.vh-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    padding: var(--vh-button-padding-sm);
    min-height: var(--vh-button-height-sm);
    border-radius: var(--vh-button-radius-sm);
    background-color: var(--menu-bg);
    color: var(--secondary-text);
    border: 1px solid var(--secondary-border);
    transition: background-color 160ms ease, border-color 160ms ease,
        color 160ms ease;
}

.vh-dropdown__trigger:hover {
    background-color: var(--secondary-hover);
}

details.vh-dropdown[open]>summary.vh-dropdown__trigger {
    background-color: var(--secondary-hover);
}

.vh-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background-color: var(--menu-bg);
    border: 1px solid var(--menu-border);
    border-radius: 12px;
    box-shadow: var(--menu-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
    z-index: 20;
}

details.vh-dropdown[open] .vh-dropdown__menu {
    opacity: 1;
    pointer-events: auto;
}

.vh-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: var(--vh-text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}

.vh-dropdown__item:hover {
    background-color: var(--menu-item-hover);
    color: var(--accent-text-secondary);
}

.vh-dropdown__item:active {
    background-color: var(--menu-item-active);
}

.vh-dropdown__item.is-destructive {
    color: var(--destructive-bg);
}

.vh-dropdown__item+.vh-dropdown__item-divider {
    margin: 0.25rem 0;
}

.vh-dropdown__item-divider {
    height: 1px;
    background: var(--menu-divider);
}

.vh-dropdown__meta {
    font-size: var(--vh-text-xs);
    color: var(--text-muted);
}

/* ==========================================================================
   Utility Helpers
   ========================================================================== */

.vh-surface {
    background-color: var(--bg-surface);
    border: 1px solid var(--stroke-soft);
    border-radius: 16px;
    padding: 1.5rem;
}

.vh-elevated {
    background-color: var(--bg-elevated);
    box-shadow: 0 18px 44px rgba(23, 25, 38, 0.08);
}

.vh-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.vh-stack-md {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.vh-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.vh-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--vh-text-xs);
    font-weight: 600;
    color: var(--secondary-text);
    background-color: var(--secondary-hover);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.vh-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background-color: var(--destructive-bg);
    color: var(--destructive-text);
    font-size: var(--vh-text-xs);
    font-weight: 600;
}
/* ==========================================================================
   VoteHub Console — app shell & screens
   (everything below is built on the tokens defined above)
   ========================================================================== */

body {
    margin: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: var(--vh-text-md);
    line-height: var(--vh-leading-standard);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app { display: flex; min-height: 100vh; }

/* ----- Sidebar ----- */
.sidebar {
    flex: 0 0 232px;
    width: 232px;
    background: var(--bg-surface);
    border-right: 1px solid var(--stroke-soft);
    padding: 1.1rem 0.85rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem; }
.brand__mark { width: 30px; height: 30px; flex: 0 0 30px; }
.brand__name {
    font-family: "TT Norms Pro", "Avenir Next", -apple-system, sans-serif;
    font-weight: 600; font-size: var(--vh-text-md); letter-spacing: -0.01em;
    color: var(--accent-text-primary); line-height: 1.15;
}
.brand__sub {
    display: block; font-size: var(--vh-text-xs); font-weight: 400;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}

.nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav__link {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.7rem; border-radius: 10px;
    color: var(--text-secondary); font-size: var(--vh-text-sm); font-weight: 500;
    transition: background-color 140ms ease, color 140ms ease;
}
.nav__link:hover { background: var(--menu-item-hover); color: var(--accent-text-secondary); }
.nav__link.is-active { background: var(--menu-item-active); color: var(--accent-text-primary); font-weight: 600; }
.nav__link svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* ----- Main column ----- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.6rem; border-bottom: 1px solid var(--stroke-soft);
    background: var(--bg-base); position: sticky; top: 0; z-index: 10;
}
.topbar__title { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar__title h1 { margin: 0; font-size: var(--vh-text-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 0.6rem; flex: 0 0 auto; }

.live { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--vh-text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.live__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--constructive-bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--constructive-focus) 60%, transparent); }

.content { padding: 1.6rem; width: 100%; max-width: 1280px; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.eyebrow { font-size: var(--vh-text-xs); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--text-muted); margin: 0 0 0.55rem; }
.note { font-size: var(--vh-text-sm); color: var(--text-muted); margin: 0; }

/* ----- Toolbar ----- */
.toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.toolbar .vh-search { flex: 1 1 260px; max-width: 360px; }
.toolbar__spacer { flex: 1 1 auto; }

/* ----- Tables ----- */
.table-card { background: var(--bg-elevated); border: 1px solid var(--stroke-soft); border-radius: 16px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--vh-text-sm); }
.tbl thead th {
    position: sticky; top: 0; background: var(--bg-elevated); text-align: left;
    font-size: var(--vh-text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--stroke-soft); white-space: nowrap;
}
.tbl tbody td { padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--stroke-soft); white-space: nowrap; color: var(--text-primary); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-surface); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .group-head th { text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--vh-text-xxs); color: var(--text-muted); text-align: center; padding: 0.5rem 0.85rem 0.25rem; }
.col-sep { border-left: 1px solid var(--stroke-soft); }
.muted { color: var(--text-muted); }
.race-link { font-weight: 600; }
.incumbent { color: var(--text-muted); font-weight: 600; margin-left: 0.1rem; }
.leader { font-weight: 600; color: var(--accent-text-primary); }

/* ----- Stat strip (race header) ----- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.stat { background: var(--bg-elevated); border: 1px solid var(--stroke-soft); border-radius: 16px; padding: 1.1rem 1.25rem; }
.stat__label { font-size: var(--vh-text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat__value { font-size: var(--vh-text-2xl); font-weight: 500; letter-spacing: -0.01em; color: var(--accent-text-primary); font-variant-numeric: tabular-nums; margin-top: 0.35rem; line-height: 1.1; }
.stat__value small { font-size: var(--vh-text-sm); color: var(--text-muted); font-weight: 400; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-surface); overflow: hidden; margin-top: 0.7rem; }
.progress__bar { height: 100%; border-radius: 999px; background: var(--primary-bg); }

/* ----- Panel ----- */
.panel { background: var(--bg-elevated); border: 1px solid var(--stroke-soft); border-radius: 16px; padding: 1.25rem 1.4rem; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel__title { font-size: var(--vh-text-lg); margin: 0; }
.panel__row { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }

/* ----- Status pills ----- */
.pill { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--vh-text-xs); font-weight: 600; padding: 0.3rem 0.65rem; border-radius: 999px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; opacity: 0.85; }
.pill--neutral { background: var(--bg-surface); color: var(--text-muted); }
.pill--active { background: color-mix(in srgb, var(--primary-bg) 12%, white); color: var(--accent-text-primary); }
.pill--done { background: color-mix(in srgb, var(--constructive-bg) 16%, white); color: var(--constructive-active); }

/* ----- Map placeholder ----- */
.map { background: var(--bg-surface); border: 1px solid var(--stroke-soft); border-radius: 16px; min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; color: var(--text-muted); text-align: center; padding: 1.5rem; }
.map svg { width: 40px; height: 40px; opacity: 0.55; }
.map__label { font-size: var(--vh-text-sm); }

/* ----- Modal ----- */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay-scrim); display: none; align-items: center; justify-content: center; padding: 1.5rem; z-index: 50; }
.modal-overlay.is-open { display: flex; }
.modal { background: var(--bg-elevated); border-radius: 16px; box-shadow: var(--menu-shadow); width: min(480px, 100%); padding: 1.5rem; }
.modal__title { font-size: var(--vh-text-lg); margin: 0 0 0.25rem; }
.modal__sub { font-size: var(--vh-text-sm); color: var(--text-muted); margin: 0 0 1.25rem; }
.modal__grid { display: grid; gap: 1rem; }
.modal__actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.6rem; margin-top: 1.4rem; }

/* ----- Forms / misc ----- */
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.readonly-value { padding: 0.65rem 0.85rem; border-radius: 10px; border: 1px solid var(--stroke-soft); background: var(--bg-surface); color: var(--text-secondary); font-size: var(--vh-text-md); }
.inline-confirm { font-size: var(--vh-text-sm); color: var(--constructive-active); display: none; align-items: center; gap: 0.4rem; margin-right: auto; }
.inline-confirm.is-show { display: inline-flex; }
.table-select { font-size: var(--vh-text-sm); padding: 0.4rem 1.8rem 0.4rem 0.6rem; min-height: 0; }

/* ----- Responsive + motion ----- */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { position: static; height: auto; width: 100%; flex: none; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .content { padding: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ----- Results map (schematic VCU regions) ----- */
.map { background: var(--bg-elevated); border: 1px solid var(--stroke-soft); border-radius: 16px; min-height: 0; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; align-items: stretch; justify-content: flex-start; color: var(--text-primary); text-align: left; }
.map__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.map-region { border: 1px solid var(--stroke-soft); border-radius: 12px; padding: 0.8rem 0.85rem; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; gap: 0.5rem; }
.map-region__name { font-size: var(--vh-text-sm); font-weight: 600; }
.map-region__leader { font-size: var(--vh-text-xs); }
.map-region__meta { font-size: var(--vh-text-xxs); font-variant-numeric: tabular-nums; opacity: 0.85; }
.map-region.is-led { color: #fff; border-color: transparent; }
.map-region.is-empty { background: var(--bg-surface); color: var(--text-muted); }
.map__legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--vh-text-xs); color: var(--text-secondary); }
.legend-swatch { width: 12px; height: 12px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.08); flex: 0 0 12px; }
.map__note { font-size: var(--vh-text-xs); color: var(--text-muted); margin: 0; }

/* ----- Race-call graphic preview ----- */
.modal--graphic .modal { width: min(560px, 100%); }
.graphic-card { border: 1px solid var(--stroke-soft); border-radius: 16px; overflow: hidden; background: var(--bg-elevated); }
.graphic-card__head { display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--stroke-soft); }
.graphic-card__head svg { width: 22px; height: 22px; }
.graphic-card__brand { font-weight: 600; font-size: var(--vh-text-sm); color: var(--accent-text-primary); }
.graphic-card__body { padding: 1.6rem 1.25rem; text-align: center; }
.graphic-card__eyebrow { font-size: var(--vh-text-xs); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.graphic-card__race { font-size: var(--vh-text-lg); margin: 0.35rem 0 1.1rem; }
.graphic-card__winner { display: inline-flex; align-items: center; gap: 0.55rem; font-family: "TT Norms Pro", "Avenir Next", sans-serif; font-size: var(--vh-text-2xl); font-weight: 600; letter-spacing: -0.01em; color: var(--accent-text-primary); }
.graphic-card__check { width: 26px; height: 26px; border-radius: 999px; background: var(--constructive-bg); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.graphic-card__check svg { width: 15px; height: 15px; }
.graphic-card__party { font-size: var(--vh-text-sm); color: var(--text-muted); margin-top: 0.4rem; }
.graphic-card__bar { height: 8px; border-radius: 999px; background: var(--bg-surface); overflow: hidden; margin: 1.1rem auto 0; max-width: 280px; }
.graphic-card__bar > span { display: block; height: 100%; background: var(--primary-bg); border-radius: 999px; }
.graphic-card__foot { display: flex; justify-content: space-between; padding: 0.8rem 1.1rem; border-top: 1px solid var(--stroke-soft); font-size: var(--vh-text-xs); color: var(--text-muted); }
.graphic-note { font-size: var(--vh-text-sm); color: var(--text-muted); margin: 1rem 0 0; }

/* Empty map slot (no map data to render) */
.map--empty { min-height: 240px; align-items: center; justify-content: center; }
.map--empty svg { width: 46px; height: 46px; color: var(--text-muted); opacity: 0.45; }

/* Depot: races + collapsible reporting panel */
.depot-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.depot-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 1024px) { .depot-grid { grid-template-columns: 1fr; } }
.side-panel { background: var(--bg-elevated); border: 1px solid var(--stroke-soft); border-radius: 16px; overflow: hidden; }
.side-panel__head { width: 100%; background: none; border: none; font: inherit; color: inherit; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.9rem 1.1rem; cursor: pointer; }
.side-panel__title { font-size: var(--vh-text-base); font-weight: 600; }
.side-panel__head .chev { width: 18px; height: 18px; color: var(--text-secondary); transition: transform 0.15s ease; flex: 0 0 18px; }
.side-panel.is-collapsed .chev { transform: rotate(-90deg); }
.side-panel__body { padding: 0 1.1rem 1rem; }
.side-panel.is-collapsed .side-panel__body { display: none; }
.rep-row { padding: 0.7rem 0; border-top: 1px solid var(--stroke-soft); display: flex; flex-direction: column; gap: 0.5rem; }
.rep-row:first-child { border-top: none; padding-top: 0.25rem; }
.rep-row__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.rep-row__name { font-weight: 600; font-size: var(--vh-text-sm); }
.rep-row__meta { font-size: var(--vh-text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Race page: content + collapsible reporting panel (collapse reclaims width) */
.race-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.race-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
@media (max-width: 1024px) { .race-grid { grid-template-columns: 1fr; } }
.race-grid.is-collapsed { grid-template-columns: minmax(0, 1fr) auto; }
.race-grid.is-collapsed .side-panel__body { display: none; }
.race-grid.is-collapsed .side-panel__title { display: none; }
.race-grid.is-collapsed .side-panel__head { padding: 0.7rem; }
.race-grid.is-collapsed .chev { transform: rotate(90deg); }

/* Race page: content + collapsible reporting panel (collapse frees space) */
.race-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.race-grid.is-collapsed { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 1024px) { .race-grid, .race-grid.is-collapsed { grid-template-columns: 1fr; } }
.race-grid.is-collapsed .side-panel__body { display: none; }
.race-grid.is-collapsed .side-panel__title { display: none; }
.race-grid.is-collapsed .side-panel__head { justify-content: center; padding: 0.7rem; }
.race-grid.is-collapsed .chev { transform: rotate(90deg); }

/* Section header with an inline control */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.section-head .eyebrow { margin: 0; }

/* Depot side panel (race list) */
.depot-list { display: flex; flex-direction: column; }
.depot-item { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0; border-top: 1px solid var(--stroke-soft); text-decoration: none; color: var(--text-primary); }
.depot-item:first-child { border-top: none; padding-top: 0.2rem; }
.depot-item__title { font-weight: 600; font-size: var(--vh-text-sm); }
.depot-item__meta { font-size: var(--vh-text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.depot-item:hover .depot-item__title, .depot-item.is-active .depot-item__title { color: var(--accent-text-primary); }

/* Collapsible left sidebar */
.sidebar { transition: flex-basis 150ms ease, width 150ms ease; }
.sidebar__top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sidebar__toggle { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 0.3rem; display: inline-flex; border-radius: 8px; flex: 0 0 auto; }
.sidebar__toggle:hover { background: var(--menu-item-hover); color: var(--accent-text-secondary); }
.sidebar__toggle .chev { width: 18px; height: 18px; transition: transform 150ms ease; }
.nav__label { white-space: nowrap; }
.sidebar.is-collapsed { flex-basis: 66px; width: 66px; padding-left: 0.55rem; padding-right: 0.55rem; }
.sidebar.is-collapsed .brand__name, .sidebar.is-collapsed .brand__sub, .sidebar.is-collapsed .nav__label { display: none; }
.sidebar.is-collapsed .sidebar__top { flex-direction: column; gap: 0.7rem; }
.sidebar.is-collapsed .brand { justify-content: center; padding: 0; gap: 0; }
.sidebar.is-collapsed .nav__link { justify-content: center; padding: 0.55rem; }
.sidebar.is-collapsed .sidebar__toggle .chev { transform: rotate(180deg); }

/* Races nested under Depot (shown when sidebar expanded) */
.nav__sub { display: flex; flex-direction: column; gap: 0.05rem; margin: 0.15rem 0 0.35rem; padding-left: 2.35rem; }
.nav__sublink { padding: 0.4rem 0.7rem; border-radius: 8px; color: var(--text-secondary); font-size: var(--vh-text-sm); text-decoration: none; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.nav__sublink:hover { background: var(--menu-item-hover); color: var(--accent-text-secondary); }
.nav__sublink.is-active { color: var(--accent-text-primary); font-weight: 600; }
.sidebar.is-collapsed .nav__sub { display: none; }

.view { display: none; }
.view.is-active { display: block; }
