@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100..800&display=swap');

/* ==========================================================================
   STRUCTURAL VARIABLES (theme-independent)
   Spacing, typography, border-radius, transitions, layout — never change.
   ========================================================================== */

:root {
    /* Typography */
    --font-sans: 'Montserrat', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    --font-primary: var(--font-sans);
    --font-size-xs: 0.8125rem;
    --font-size-sm: 0.9375rem;
    --font-size-base: 1rem;
    --font-size-md: 16px;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 40px;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --border-radius-sm: 0.25rem;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 0.75rem;
    --border-radius-full: 9999px;
    --radius-sm: 3px;
    --radius-base: 5px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 14px;

    /* Layout */
    --container-max: 1200px;
    --sidebar-width: 250px;
    --header-height: 60px;

    /* Inputs */
    --input-height: 36px;

    /* Buttons */
    --button-height: 35px;
    --button-min-width: 70px;
    --button-padding-x: 20px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ==========================================================================
   DARK THEME
   ========================================================================== */

.theme-dark {
    color: var(--text-primary);

    /* Page & Surface Backgrounds */
    --bg-page: #2a2a2a;
    --bg-surface: #333333;
    --bg-surface-raised: #555555;
    --bg-surface-hover: #3a3a3a;
    --bg-input: #ffffff;
    --bg-panel: #434343;

    /* Text Colors */
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-heading: #ffffff;
    --text-muted: #a0a0a0;
    --text-on-input: #1e293b;
    --text-link: #3a85ff;
    --text-on-primary: #ffffff;
    --text-inverse: #111111;
    --text-disabled: #666666;

    /* Border Colors */
    --border-default: #444444;
    --border-subtle: #333333;
    --border-input: #555555;
    --border-strong: #000000;

    /* Brand / Action Colors */
    --color-primary: #3a85ff;
    --color-primary-dark: #2a75ef;
    --color-primary-light: #5a9fff;
    --color-secondary: #64748b;
    --color-success: #4CAF50;
    --color-warning: #ffaa00;
    --color-error: #ff3a3a;
    --color-info: #3a92f5;

    /* Static Colors */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gold: #d4af37;

    /* Accent Colors */
    --color-green-bright: #8efa00;
    --color-blue-accent: #3a85ff;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-inner: inset 0 0 10px rgba(0, 0, 0, 0.5);

    /* List Table */
    --bg-table-header: linear-gradient(to bottom, #444444, #333333);
    --bg-table-header-active: linear-gradient(to bottom, #555555, #444444);
    --bg-table-header-sort-asc: linear-gradient(to bottom, #555555, #444444);
    --bg-table-header-sort-desc: linear-gradient(to top, #555555, #444444);
    --table-header-text: #e0e0e0;
    --table-border: #555555;
    --table-cell-border: #444444;
    --bg-table-row-odd: rgba(255, 255, 255, 0.05);
    --bg-table-row-even: rgba(255, 255, 255, 0.02);
    --bg-table-row-hover: rgba(255, 255, 255, 0.1);
    --table-no-results: #888888;

    /* Pagination (Janesville) */
    --pagi-bg: linear-gradient(to bottom, #555555, #333333);
    --pagi-border: #555555;
    --pagi-text: #e0e0e0;
    --pagi-text-disabled: #666666;
    --pagi-bar-bg: #555555;
    --pagi-active-bg: #3a85ff;
    --pagi-active-text: #ffffff;
    --pagi-details-text: #a0a0a0;
    --pagi-filler-bg: #444444;

    /* Fieldset */
    --fieldset-bg: #333333;
    --fieldset-nested-bg: #444444;
    --legend-bg: #555555;
    --legend-text: #ffffff;

    /* Sort Arrow */
    --sort-arrow: #e0e0e0;

    /* Flash / Badge Colors */
    --flash-success-bg: rgba(76, 175, 80, 0.15);
    --flash-success-text: #a7f3d0;
    --flash-success-border: rgba(76, 175, 80, 0.3);
    --flash-error-bg: rgba(255, 58, 58, 0.15);
    --flash-error-text: #fca5a5;
    --flash-error-border: rgba(255, 58, 58, 0.3);
    --flash-warning-bg: rgba(255, 170, 0, 0.15);
    --flash-warning-text: #fde68a;
    --flash-warning-border: rgba(255, 170, 0, 0.3);
    --flash-info-bg: rgba(58, 146, 245, 0.15);
    --flash-info-text: #93c5fd;
    --flash-info-border: rgba(58, 146, 245, 0.3);
    --badge-gray-bg: rgba(255, 255, 255, 0.1);
    --badge-gray-text: #a0a0a0;

    /* Search Box */
    --search-box-bg: #eeeeee;
    --search-box-border: #cccccc;
}

/* ==========================================================================
   LIGHT THEME
   ========================================================================== */

.theme-light {
    color: var(--text-primary);

    /* Page & Surface Backgrounds */
    --bg-page: #ffffff;
    --bg-surface: #f8fafc;
    --bg-surface-raised: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-input: #ffffff;
    --bg-panel: #f8fafc;

    /* Text Colors */
    --text-primary: #111111;
    --text-secondary: #1e293b;
    --text-heading: #000000;
    --text-muted: #475569;
    --text-on-input: #111111;
    --text-link: #2563eb;
    --text-on-primary: #ffffff;
    --text-inverse: #ffffff;
    --text-disabled: #94a3b8;

    /* Border Colors */
    --border-default: #cbd5e1;
    --border-subtle: #e2e8f0;
    --border-input: #cbd5e1;
    --border-strong: #cbd5e1;

    /* Brand / Action Colors */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #3b82f6;
    --color-secondary: #64748b;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-error: #dc2626;
    --color-info: #0891b2;

    /* Static Colors */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gold: #b8860b;

    /* Accent Colors */
    --color-green-bright: #16a34a;
    --color-blue-accent: #2563eb;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-inner: inset 0 0 5px rgba(0, 0, 0, 0.1);

    /* List Table */
    --bg-table-header: linear-gradient(to bottom, #ffffff, #dddddd);
    --bg-table-header-active: linear-gradient(to bottom, #eeeeee, #cccccc);
    --bg-table-header-sort-asc: linear-gradient(to bottom, #ffffff, #cccccc);
    --bg-table-header-sort-desc: linear-gradient(to top, #ffffff, #cccccc);
    --table-header-text: #333333;
    --table-border: #999999;
    --table-cell-border: #bbbbbb;
    --bg-table-row-odd: rgba(255, 255, 255, 0.3);
    --bg-table-row-even: rgba(150, 150, 150, 0.3);
    --bg-table-row-hover: #ffffcc;
    --table-no-results: #888888;

    /* Pagination (Janesville) */
    --pagi-bg: linear-gradient(to bottom, #f5f5f5, #d0d0d0);
    --pagi-border: #cccccc;
    --pagi-text: #000000;
    --pagi-text-disabled: #999999;
    --pagi-bar-bg: #999999;
    --pagi-active-bg: #245F9F;
    --pagi-active-text: #ffffff;
    --pagi-details-text: #24386C;
    --pagi-filler-bg: #D5DEFF;

    /* Fieldset */
    --fieldset-bg: #f8fafc;
    --fieldset-nested-bg: #f8f8f8;
    --legend-bg: #999999;
    --legend-text: #ffffff;

    /* Sort Arrow */
    --sort-arrow: #333333;

    /* Flash / Badge Colors */
    --flash-success-bg: rgba(22, 163, 74, 0.1);
    --flash-success-text: #166534;
    --flash-success-border: rgba(22, 163, 74, 0.3);
    --flash-error-bg: rgba(220, 38, 38, 0.1);
    --flash-error-text: #991b1b;
    --flash-error-border: rgba(220, 38, 38, 0.3);
    --flash-warning-bg: rgba(217, 119, 6, 0.1);
    --flash-warning-text: #92400e;
    --flash-warning-border: rgba(217, 119, 6, 0.3);
    --flash-info-bg: rgba(8, 145, 178, 0.1);
    --flash-info-text: #155e75;
    --flash-info-border: rgba(8, 145, 178, 0.3);
    --badge-gray-bg: #f1f5f9;
    --badge-gray-text: #475569;

    /* Search Box */
    --search-box-bg: #eeeeee;
    --search-box-border: #cccccc;
}


/* ==========================================================================
   RESET
   ========================================================================== */

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

/* ==========================================================================
   BASE
   ========================================================================== */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-heading);
}

h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--font-size-2xl); margin-bottom: var(--space-4); }
h3 { font-size: var(--font-size-xl); margin-bottom: var(--space-3); }
h4 { font-size: var(--font-size-lg); margin-bottom: var(--space-2); }

p { margin-bottom: var(--space-4); }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}


/* ==========================================================================
   LAYOUT
   ========================================================================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.page-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin: 0 5px;
}

.main-content-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
    padding: 5px;
}

.main-content {
    flex: 1;
    padding: 0;
}


/* ==========================================================================
   PAGE HEADER
   ========================================================================== */

.page-header {
    padding: 10px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    position: relative;
}

.page-header .header-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px;
}

.header-text h1 {
    font-size: 48px;
    font-weight: 300;
    margin: 0;
    background: linear-gradient(135deg, #3a85ff 0%, #8efa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.header-text .tagline {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.login-panel {
    position: absolute;
    right: 10px;
    top: 0;
    height: 38px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.login-panel .message {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 38px;
}

.login-panel .message a {
    color: var(--text-secondary);
    text-decoration: none;
}

.login-panel .message a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}


/* ==========================================================================
   TAB BAR
   ========================================================================== */

.tab-bar-wrapper {
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom,
        rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 50%), var(--bg-surface);
    padding: 5px;
}

.ui-tabs-nav li a {
    font-size: 15px !important;
}


/* ==========================================================================
   DIGITAL CLOCK (JetBrains Mono)
   ========================================================================== */

.digital-clock {
    margin: 0px 0px 3px auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #000;
    border-radius: 4px;
    height: 34px;
    padding: 1px 10px;
}

.clock-time {
    display: inline-flex;
    align-items: baseline;
}

.clock-digit {
    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 28px;
    color: var(--color-green-bright);
    display: inline-block;
    width: 22px;
    text-align: center;
}

.clock-sep {
    font-family: "JetBrains Mono", monospace;
    font-size: 28px;
    color: var(--color-green-bright);
    display: inline-block;
    width: 12px;
    text-align: center;
}

.clock-ampm {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--color-green-bright);
    font-weight: 400;
}

.clock-timezone {
    font-size: 10px;
    color: #ffcc00;
    white-space: nowrap;
    font-weight: normal;
    line-height: 12px;
    text-align: right;
}


/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    padding: 8px 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}


/* ==========================================================================
   FLASH MESSAGES
   ========================================================================== */

.flash {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border: 1px solid transparent;
}

.flash-success {
    background-color: var(--flash-success-bg);
    color: var(--flash-success-text);
    border-color: var(--flash-success-border);
}

.flash-error {
    background-color: var(--flash-error-bg);
    color: var(--flash-error-text);
    border-color: var(--flash-error-border);
}

.flash-warning {
    background-color: var(--flash-warning-bg);
    color: var(--flash-warning-text);
    border-color: var(--flash-warning-border);
}

.flash-info {
    background-color: var(--flash-info-bg);
    color: var(--flash-info-text);
    border-color: var(--flash-info-border);
}


/* ==========================================================================
   BUTTONS — Modern (.btn)
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: var(--line-height-normal);
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    color: var(--color-white);
}

.btn-secondary {
    background-color: var(--bg-surface-raised);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
}

.btn-danger {
    background-color: var(--color-error);
    color: var(--color-white);
}

.btn-danger:hover {
    background-color: #b91c1c;
    color: var(--color-white);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-base);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-sm);
    cursor: pointer;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}


/* ==========================================================================
   BUTTONS — Spidey-style (.button1)
   ========================================================================== */

.button1 {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--button-height);
    min-width: var(--button-min-width);
    padding: 0 var(--button-padding-x);
    margin: 0 var(--space-1) 0 var(--space-1);
    font-family: var(--font-primary);
    font-size: var(--font-size-md) !important;
    font-weight: var(--font-weight-normal);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    background: #dddddd;
    color: #444444;
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
    text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.15);
    box-shadow:
        0 0 0 1px #999999 inset,
        0 0 0 2px #ffffff inset,
        0 30px 20px -18px rgba(255, 255, 255, 0.65) inset,
        1px 1px 3px rgba(0, 0, 0, 0.2);
}

.button1:hover {
    transform: translateY(-1px);
    box-shadow:
        0 0 0 1px #999999 inset,
        0 0 0 2px #ffffff inset,
        0 30px 20px -18px rgba(255, 255, 255, 0.75) inset,
        1px 2px 4px rgba(0, 0, 0, 0.3);
}

.button1:active {
    transform: translateY(0);
    box-shadow:
        0 0 0 1px #999999 inset,
        0 0 0 2px #ffffff inset,
        0 20px 15px -18px rgba(255, 255, 255, 0.55) inset,
        1px 1px 2px rgba(0, 0, 0, 0.2);
}

.button1.green {
    background: #669933;
    color: var(--color-white);
    box-shadow:
        0 0 0 1px #669966 inset,
        0 0 0 2px #669966 inset,
        0 30px 20px -18px rgba(255, 255, 255, 0.55) inset,
        1px 1px 3px rgba(0, 0, 0, 0.2);
}

.button1.blue {
    background: #0040a0;
    color: var(--color-white);
    box-shadow:
        0 0 0 2px #0017a5 inset,
        0 0 0 1px #0017a5 inset,
        0 30px 20px -18px rgba(255, 255, 255, 0.55) inset,
        1px 1px 3px rgba(0, 0, 0, 0.2);
}

.button1.red {
    background: #dd0000;
    color: var(--color-white);
    box-shadow:
        0 0 0 1px #ff0000 inset,
        0 0 0 2px #ff6666 inset,
        0 30px 20px -18px rgba(255, 255, 255, 0.55) inset,
        1px 1px 3px rgba(0, 0, 0, 0.2);
}

.button1.disabled {
    background: #999;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}


/* ==========================================================================
   FORMS
   ========================================================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.form-group label .required {
    color: var(--color-error);
}

.address-row {
    display: flex;
    gap: var(--space-4);
}

.address-row .form-group {
    flex: none;
}

.form-control {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    line-height: var(--line-height-normal);
    height: var(--input-height);
    color: #000000;
    font-weight: 500;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(58, 133, 255, 0.25);
}

.form-control.is-invalid {
    border-color: var(--color-error);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(255, 58, 58, 0.25);
}

textarea.form-control {
    display: block;
    width: 100%;
    height: auto;
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--color-error);
    margin-top: var(--space-1);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary);
}

.form-group label:has(input[type="checkbox"]) {
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-default);
}

fieldset {
    margin: 3px 0 0 0;
    padding: 5px;
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--fieldset-bg);
}

fieldset.form-slave {
    margin-bottom: 15px;
    padding: 20px;
}

fieldset fieldset {
    background-color: var(--fieldset-nested-bg);
}

fieldset legend {
    padding: 3px 5px;
    margin: 0;
    background-color: var(--legend-bg);
    color: var(--legend-text);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-medium);
}

/* Small form control (for filter selects) */
.form-control-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    padding-right: 2rem;
    background-size: 12px 9px;
}

/* Form Validation */
.has-error .form-control {
    border-color: var(--color-error);
}

.has-error .form-control:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-error);
    margin-top: var(--space-1);
}


/* ==========================================================================
   TABLES — Modern (generic)
   ========================================================================== */

.table-wrapper {
    background: var(--bg-surface-raised);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-inner);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-default);
    gap: var(--space-4);
}

.table-search {
    display: flex;
    gap: var(--space-3);
    flex: 1;
    max-width: 400px;
}

.table-search input {
    flex: 1;
}

.table-filters {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.table-actions {
    display: flex;
    gap: var(--space-3);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--bg-surface);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

thead th a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

thead th a:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

thead th .sort-icon {
    font-size: var(--font-size-xs);
    opacity: 0.4;
}

thead th .sort-icon.active {
    opacity: 1;
    color: var(--color-primary);
}

tbody td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tbody tr:hover:not(.pagi-bar tr) {
    background-color: var(--bg-surface-hover);
}

.pagi-bar tr:hover {
    background-color: transparent;
}

tbody td a {
    font-weight: var(--font-weight-medium);
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-8) var(--space-4);
    font-style: italic;
}


/* ==========================================================================
   TABLES — Janesville ListView (.list)
   ========================================================================== */

.list {
    width: 100%;
    border: 1px solid var(--table-border);
    background: var(--bg-surface-raised);
    padding: 0;
    margin: 0;
    border-collapse: collapse;
}

.list th {
    font-size: 14px;
    background: var(--bg-table-header);
    height: 20px;
    border-bottom: 1px solid var(--table-border);
    padding: 3px 5px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    color: var(--table-header-text);
    cursor: pointer;
}

.list th.current {
    background: var(--bg-table-header-active);
}

.list th.sort-asc {
    background: var(--bg-table-header-sort-asc);
}

.list th.sort-desc {
    background: var(--bg-table-header-sort-desc);
}

.list th a {
    color: var(--table-header-text);
    text-decoration: none;
}

.list th a:hover {
    text-decoration: none;
}

/* Sort direction indicators */
.list th.sort-asc a::after {
    content: "";
    display: inline-block;
    margin-left: 5px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid var(--sort-arrow);
    vertical-align: middle;
}

.list th.sort-desc a::after {
    content: "";
    display: inline-block;
    margin-left: 5px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--sort-arrow);
    vertical-align: middle;
}

.list td {
    padding: 3px 3px 1px 3px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--table-cell-border);
    color: var(--text-primary);
}

.list td a {
    color: var(--text-link);
    text-decoration: none;
}

.list .sortlist_odd {
    font-size: 10px;
    color: var(--text-primary) !important;
    font-weight: 500;
    background-color: var(--bg-table-row-odd);
    line-height: 20px;
    height: 20px;
    padding-left: 5px;
}

.list .sortlist_even {
    font-size: 10px;
    color: var(--text-primary) !important;
    font-weight: 500;
    background-color: var(--bg-table-row-even);
    line-height: 20px;
    height: 20px;
    padding-left: 5px;
}

.list tr.sortlist_odd:hover,
.list tr.sortlist_even:hover {
    background-color: var(--bg-table-row-hover) !important;
}

.list .no_results {
    text-align: center;
    font-size: 24px;
    color: var(--table-no-results);
    height: 20px;
    vertical-align: middle;
    line-height: 20px;
}


/* ==========================================================================
   PAGINATION — Janesville (.pagi_*)
   ========================================================================== */

.pagi-bar {
    width: 100%;
    padding: 0;
    margin: 0;
    background: #666666;
    border: none;
    border-radius: 0;
}

.pagi-bar-top {
    border-radius: 6px 6px 0 0;
}

.pagi-bar-bottom {
    border-radius: 0 0 6px 6px;
}

.pagi-bar td {
    padding: 5px;
    border-bottom: none;
}

.pagi_direction {
    height: 34px;
    line-height: 34px;
    font-size: 18px;
    font-weight: 600;
    color: var(--pagi-text);
    text-align: center;
    padding: 0 10px;
    border: 1px solid var(--pagi-border);
    border-radius: 3px;
    float: left;
    margin-right: 2px;
    background: var(--pagi-bg);
}

.pagi_direction > a {
    color: var(--pagi-text) !important;
    text-decoration: none;
}

.pagi_direction_disabled {
    height: 34px;
    line-height: 34px;
    font-size: 18px;
    font-weight: 600;
    color: var(--pagi-text-disabled);
    text-align: center;
    padding: 0 10px;
    border: 1px solid var(--pagi-border);
    border-radius: 3px;
    float: left;
    margin-right: 2px;
    background: #ffffff;
}

.pagi_bold_two {
    height: 34px;
    line-height: 34px;
    font-size: 18px;
    padding: 0 5px;
    border: 1px solid var(--border-strong);
    float: left;
    text-align: center;
    background: var(--pagi-active-bg);
    color: var(--pagi-active-text);
    margin-right: 2px;
    font-weight: bold;
}

.pagi_page {
    height: 34px;
    line-height: 34px;
    padding: 0 5px;
    margin-right: 2px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    float: left;
    background: var(--pagi-bg);
    border: 1px solid var(--pagi-border);
}

.pagi_page > a {
    color: var(--pagi-text) !important;
    text-decoration: none;
}


.pagi_filler {
    height: 34px;
    line-height: 34px;
    padding: 0 5px;
    border: 1px solid var(--pagi-border);
    border-radius: 3px;
    float: left;
    text-align: center;
    background: var(--pagi-filler-bg);
    margin-right: 2px;
}

.pagi_details {
    height: 34px;
    line-height: 34px;
    padding: 0 10px;
    font-size: 18px;
    text-align: center;
    float: right;
    border: 1px solid var(--pagi-border);
    border-radius: 3px;
    background: #ffffff;
    color: #005493;
}

.pagi_nums {
    font-weight: bold;
}

.pagi_clear {
    clear: both;
}


/* ==========================================================================
   PAGINATION — Modern (.pagination, .page-link)
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-6);
    border-top: 1px solid var(--border-default);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.pagination-links {
    display: flex;
    gap: var(--space-1);
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 var(--space-2);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.pagination-links a {
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.pagination-links a:hover {
    background: var(--bg-surface-hover);
    text-decoration: none;
}

.pagination-links .active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.pagination-links .disabled {
    color: var(--text-disabled);
    pointer-events: none;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 var(--space-2);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-surface-hover);
    text-decoration: none;
}

.page-link.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}


/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */

.card {
    background: var(--bg-surface-raised);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-inner);
    overflow: hidden;
}

.card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gold);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.15);
}

/* Panel inner recessed (Janesville pattern) */
.panel-inner-recessed {
    margin: 5px;
    padding: 10px;
    flex: 1;
    border-radius: var(--radius-base);
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-inner);
}

/* Specialization rows — fill grid cells properly */
.spec-row .custom-select {
    width: 100%;
}

.spec-row .custom-select select {
    width: 100%;
}

.spec-row .form-control.w-xs {
    width: 100%;
}


/* ==========================================================================
   BADGES
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-full);
}

.badge-success { background: var(--flash-success-bg); color: var(--flash-success-text); }
.badge-warning { background: var(--flash-warning-bg); color: var(--flash-warning-text); }
.badge-error { background: var(--flash-error-bg); color: var(--flash-error-text); }
.badge-info { background: var(--flash-info-bg); color: var(--flash-info-text); }
.badge-gray { background: var(--badge-gray-bg); color: var(--badge-gray-text); }


/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.breadcrumb {
    margin: 5px 20px 5px 0;
    font-size: 18px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
    margin: 5px;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}


/* ==========================================================================
   TABS — Admin
   ========================================================================== */

.admin-tabs {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-default);
    padding-top: 15px;
}

.admin-tab {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.admin-tab:hover {
    background: var(--bg-surface-raised);
    color: var(--color-white);
}

.admin-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   CUSTOM SELECT
   Theme-driven — no separate .dark variant needed.
   ========================================================================== */

.custom-select {
    position: relative;
    display: inline-block;
    width: fit-content;
    vertical-align: top;
}

.custom-select select {
    padding-right: 30px;
    color: #000000;
    background:
        linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0) 38%),
        linear-gradient(to bottom, #f5f5f5, #d0d0d0);
    border: 1px solid #cccccc;
}

.custom-select::before,
.custom-select::after {
    --arrow-size: 0.3rem;
    position: absolute;
    content: "";
    right: 1em;
    pointer-events: none;
}

.custom-select::before {
    border-left: var(--arrow-size) solid transparent;
    border-right: var(--arrow-size) solid transparent;
    border-bottom: var(--arrow-size) solid #000000;
    top: 25%;
}

.custom-select::after {
    border-left: var(--arrow-size) solid transparent;
    border-right: var(--arrow-size) solid transparent;
    border-top: var(--arrow-size) solid #000000;
    top: 58%;
}


/* ==========================================================================
   LISTVIEW COMPONENTS (Searchbar, Search box, etc.)
   ========================================================================== */

.searchbar-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
    box-sizing: border-box;
    margin: 2px 2px 10px 2px;
    padding: 0;
}

.left-group,
.center-group,
.right-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.left-group {
    justify-content: flex-start;
    white-space: nowrap;
}

.center-group {
    justify-content: center;
    flex: 1 1 auto;
}

.right-group {
    justify-content: flex-end;
    white-space: nowrap;
}

.left-group.label,
.right-group.label {
    padding: 0 20px 0 10px;
}

.searchbar-container .label {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Search box */
.search_box {
    padding: 0;
    height: 32px;
    font-size: 23px !important;
    width: 250px;
    border-width: 2px 1px 1px 2px;
    border-color: var(--search-box-border);
    border-style: solid;
    border-radius: 3px;
    background-color: var(--search-box-bg) !important;
}

.search_box:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* List view layout */
.list-view {
    margin-bottom: var(--space-4);
}

.list-actions {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.list-search {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    max-width: 500px;
    align-items: center;
}

.list-search .form-control {
    flex: 1;
}

.list-filters {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    align-items: center;
}

.list-filters label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    white-space: nowrap;
}

.list-info {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}


/* ==========================================================================
   UTILITIES
   ========================================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-semibold { font-weight: var(--font-weight-semibold); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Width utilities */
.w-xs   { width: 80px; }
.w-sm   { width: 150px; }
.w-md   { width: 250px; }
.w-lg   { width: 400px; }
.w-full { display: block; width: 100%; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state p {
    margin-bottom: var(--space-6);
}


/* ==========================================================================
   LOGGED-OUT CONTENT (no recessed panel, no tabs)
   ========================================================================== */

.logged-out-content {
    flex: 1;
    padding: 0;
}


/* ==========================================================================
   LOGIN PAGE — Background-check dialog style
   ========================================================================== */

.login-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 250px var(--space-4) var(--space-12);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 28px;
    font-weight: var(--font-weight-bold);
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
}

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

.login-form .form-label {
    display: block;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    font-size: var(--font-size-base);
    font-family: var(--font-sans);
    color: var(--text-on-input);
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius);
    height: auto;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(58, 133, 255, 0.25);
}

.login-error {
    background: var(--flash-error-bg);
    border: 1px solid var(--flash-error-border);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--flash-error-text);
    font-size: var(--font-size-sm);
    display: none;
}

.login-error.visible {
    display: block;
}

.login-submit {
    width: 100%;
    margin: 8px 0 0 0;
    padding: 12px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}
