/* Site-wide theme variables - Dark theme is default */
:root {
    /* Background colors - blue-tinted dark theme */
    --site-bg: #1a2332;
    --site-bg-secondary: #212a3a;
    --site-bg-tertiary: #2a3444;

    /* Background gradient */
    --site-gradient: linear-gradient(135deg, #1a2332 0%, #1e2940 50%, #1a2332 100%);

    /* Sidebar gradient - deeper blue tones */
    --sidebar-gradient-start: #162030;
    --sidebar-gradient-end: #0f1620;

    /* Top bar / header */
    --topbar-bg: rgba(0, 0, 0, 0.4);
    --topbar-border: rgba(255, 255, 255, 0.1);

    /* Text colors */
    --text-primary: #e0e4e8;
    --text-secondary: #a0a8b0;
    --text-muted: #8793a3; /* 4.6:1 on --site-bg-secondary */
    --text-inverse: #1a2332;

    /* Link and accent colors */
    --accent-primary: #4A90D9;
    --accent-primary-hover: #5BA0E9;
    --accent-success: #59DE8A;
    --accent-error: #FA6B5C;
    --accent-warning: #FCBF4D;

    /* Navigation colors */
    --nav-link: #d7d7d7;
    --nav-link-hover-bg: rgba(255, 255, 255, 0.1);
    --nav-link-active-bg: rgba(255, 255, 255, 0.37);
    --nav-link-active: #ffffff;
    --nav-icon-fill: white;

    /* Form elements */
    --input-bg: #2a3444;
    --input-border: #3a4558;
    --input-text: #e0e4e8;
    --input-placeholder: #6a7585;
    --input-focus-border: #4A90D9;

    /* Buttons */
    --btn-primary-bg: #4A90D9;
    --btn-primary-border: #3d7fc2;
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: #5BA0E9;
    --btn-primary-hover-border: #4A90D9;

    --btn-secondary-bg: #2e3a4c;
    --btn-secondary-border: #3e4a5c;
    --btn-secondary-text: #e0e4e8;
    --btn-secondary-hover-bg: #3e4a5c;
    --btn-secondary-hover-border: #4e5a6c;

    --btn-outline-primary-text: #5BA0E9;
    --btn-outline-primary-border: #4A90D9;
    --btn-outline-primary-hover-bg: rgba(74, 144, 217, 0.15);
    --btn-outline-primary-hover-text: #6BB0F9;

    /* Borders and dividers */
    --border-primary: rgba(255, 255, 255, 0.15);
    --border-secondary: rgba(255, 255, 255, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);

    /* Notification/Warning backgrounds */
    --warning-bg: #3a3828;
    --warning-text: #f5e6a3;
    --warning-border: #5a5238;

    /* Code/monospace */
    --code-text: #C28CF5;
    --code-bg: rgba(194, 140, 245, 0.1);

    /* Tables */
    --table-header-bg: #2a3444;
    --table-row-hover: rgba(100, 140, 200, 0.08);
    --table-border: rgba(100, 140, 200, 0.15);

    /* Scrollbar */
    --scrollbar-track: #1a2332;
    --scrollbar-thumb: #3a4558;
    --scrollbar-thumb-hover: #4a5568;

    /* Status indicators (for data loading states) */
    --status-pending-bg: #203a4a;
    --status-requested-bg: #4a2020;
    --status-loaded-bg: #2a5a2a;
}

/* Light theme */
:root[data-theme="light"] {
    /* Background colors */
    --site-bg: #f0f4f8;
    --site-bg-secondary: #ffffff;
    --site-bg-tertiary: #e4e8f0;

    /* Background gradient - subtle warm to cool */
    --site-gradient: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 50%, #f0f4f8 100%);

    /* Sidebar gradient - darker blue-gray for white text visibility */
    --sidebar-gradient-start: #6a7a8a;
    --sidebar-gradient-end: #5a6a7a;

    /* Top bar / header - darker blue-gray for visibility */
    --topbar-bg: #7a8fa0;
    --topbar-border: rgba(0, 0, 0, 0.2);

    /* Text colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #6b6b6b; /* 5.3:1 on white */
    --text-inverse: #ffffff;

    /* Link and accent colors */
    --accent-primary: #2980B9;
    --accent-primary-hover: #3498db;
    --accent-success: #27AE60;
    --accent-error: #E74C3C;
    --accent-warning: #E67E22;

    /* Navigation colors - light text for darker sidebar */
    --nav-link: #ffffff;
    --nav-link-hover-bg: rgba(255, 255, 255, 0.15);
    --nav-link-active-bg: rgba(255, 255, 255, 0.25);
    --nav-link-active: #ffffff;
    --nav-icon-fill: #ffffff;

    /* Form elements */
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-text: #333333;
    --input-placeholder: #999999;
    --input-focus-border: #2980B9;

    /* Buttons */
    --btn-primary-bg: #2980B9;
    --btn-primary-border: #1a5276;
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: #3498db;
    --btn-primary-hover-border: #2980B9;

    --btn-secondary-bg: #e8e8ec;
    --btn-secondary-border: #d0d0d8;
    --btn-secondary-text: #333333;
    --btn-secondary-hover-bg: #d8d8e0;
    --btn-secondary-hover-border: #c0c0c8;

    --btn-outline-primary-text: #2980B9;
    --btn-outline-primary-border: #2980B9;
    --btn-outline-primary-hover-bg: rgba(41, 128, 185, 0.1);
    --btn-outline-primary-hover-text: #1a5276;

    /* Borders and dividers */
    --border-primary: rgba(0, 0, 0, 0.15);
    --border-secondary: rgba(0, 0, 0, 0.08);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);

    /* Notification/Warning backgrounds */
    --warning-bg: #fff8dc;
    --warning-text: #5c4a00;
    --warning-border: #e6d9a0;

    /* Code/monospace */
    --code-text: #8E44AD;
    --code-bg: rgba(142, 68, 173, 0.1);

    /* Tables */
    --table-header-bg: #f0f0f5;
    --table-row-hover: rgba(0, 0, 0, 0.03);
    --table-border: rgba(0, 0, 0, 0.1);

    /* Scrollbar */
    --scrollbar-track: #f5f5f8;
    --scrollbar-thumb: #c0c0c8;
    --scrollbar-thumb-hover: #a0a0a8;

    /* Status indicators (for data loading states) */
    --status-pending-bg: #e3f2fd;
    --status-requested-bg: #ffe4e1;
    --status-loaded-bg: #c8e6c9;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--site-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--accent-primary);
    transition: color 0.15s ease;
}

a:hover, .btn-link:hover {
    color: var(--accent-primary-hover);
}

/* Navbar brand and nav links use theme colors */
.navbar-dark .navbar-brand,
.navbar-dark .nav-link {
    color: var(--nav-link);
}

.navbar-dark .navbar-brand:hover {
    color: var(--nav-link-active);
}

.btn-primary {
    color: var(--btn-primary-text);
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.btn-primary:hover {
    color: var(--btn-primary-text);
    background-color: var(--btn-primary-hover-bg);
    border-color: var(--btn-primary-hover-border);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-primary.active {
    color: var(--btn-primary-text);
    background-color: var(--btn-primary-hover-bg);
    border-color: var(--btn-primary-hover-border);
}

.btn-primary:disabled,
.btn-primary.disabled {
    color: var(--btn-primary-text);
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-border);
    opacity: 0.6;
    box-shadow: none;
}

.btn-secondary {
    color: var(--btn-secondary-text);
    background-color: var(--btn-secondary-bg);
    border-color: var(--btn-secondary-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    color: var(--btn-secondary-text);
    background-color: var(--btn-secondary-hover-bg);
    border-color: var(--btn-secondary-hover-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-secondary:active,
.btn-secondary.active {
    color: var(--btn-secondary-text);
    background-color: var(--btn-secondary-hover-bg);
    border-color: var(--btn-secondary-hover-border);
}

/* Icon-only buttons - transparent background with theme-aware colors */
.btn-icon {
    background-color: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.btn-icon:hover {
    background-color: var(--table-row-hover);
}

.btn-icon svg {
    fill: currentColor;
}

/* Light theme: darker hover background for better visibility */
:root[data-theme="light"] .btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.btn-outline-primary {
    color: var(--btn-outline-primary-text);
    background-color: transparent;
    border-color: var(--btn-outline-primary-border);
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    color: var(--btn-outline-primary-hover-text);
    background-color: var(--btn-outline-primary-hover-bg);
    border-color: var(--btn-outline-primary-border);
    transform: translateY(-1px);
}

.btn-outline-primary:active,
.btn-outline-primary.active {
    color: var(--btn-primary-text);
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-border);
}

.btn-outline-primary:disabled,
.btn-outline-primary.disabled {
    color: var(--btn-outline-primary-text);
    background-color: transparent;
    border-color: var(--btn-outline-primary-border);
    opacity: 0.5;
}

/* Focus rings: shown for keyboard focus on buttons and links (not after a
   mouse click), always on form fields. One ring, from the theme accent. */
:root {
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 55%, transparent);
}

.btn:focus { box-shadow: none; }

.btn:focus-visible, .btn-link.nav-link:focus-visible, .form-check-input:focus-visible {
    box-shadow: 0 0 0 0.1rem var(--site-bg), 0 0 0 0.25rem var(--accent-primary);
    outline: none;
}

/* Anything else focusable that has no ring of its own. */
:where(a, button, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.btn:focus-visible { outline: none; }

/* Full-width container for chart pages - cancels parent article padding */
.chart-full-width {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

@media (min-width: 641px) {
    .chart-full-width {
        margin-left: -2rem;
        margin-right: -1.5rem;
    }
}

code {
    color: var(--code-text);
    background-color: var(--code-bg);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}



input[type=search] {
    width: 20rem;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    color: var(--input-text);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

    input[type=search]:focus {
        border-color: var(--input-focus-border);
        box-shadow: var(--focus-ring);
    }

    input[type=search]::placeholder {
        color: var(--input-placeholder);
    }

/* Custom scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Form controls with theme */
.form-control {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--input-text);
    border-radius: 8px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus-border);
    color: var(--input-text);
    box-shadow: var(--focus-ring);
    outline: none;
}

.form-control::placeholder {
    color: var(--input-placeholder);
}

/* Select/dropdown styling */
.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.875rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--input-text);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e0e0e0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus-border);
    color: var(--input-text);
    box-shadow: var(--focus-ring);
    outline: 0;
}

.form-select:hover:not(:focus) {
    border-color: var(--input-focus-border);
}

:root[data-theme="light"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Select options - these inherit from body for most browsers */
.form-select option {
    background-color: var(--input-bg);
    color: var(--input-text);
}

/* ---------------------------------------------------------------------------
   Time input (createTimeInput)
   Visually mimics <input type="time">: a single bordered shell containing
   two compact selects (HH and MM) joined by a ':' separator.
   --------------------------------------------------------------------------- */
.time-input {
    display: inline-flex;
    align-items: center;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.125rem 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.5;
}
.time-input:hover {
    border-color: var(--input-focus-border);
}
.time-input:focus-within {
    border-color: var(--input-focus-border);
    box-shadow: var(--focus-ring);
}

/* The two selects inside the shell. No individual border or chevron —
   the shell provides those. Width is sized for "00"-"23" and "00"-"59"
   with a small chevron drawn via background-image. */
.time-input-field {
    appearance: none;
    background-color: transparent;
    border: none;
    color: var(--input-text);
    font: inherit;
    padding: 0.25rem 1rem 0.25rem 0.25rem;
    margin: 0;
    cursor: pointer;
    text-align: center;
    /* Subtle per-select chevron so users see it's clickable. */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23999' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.1rem center;
    background-size: 10px 8px;
    min-width: 3rem;
}
.time-input-field:focus {
    outline: none;
}
.time-input-field:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.time-input-field option {
    background-color: var(--input-bg);
    color: var(--input-text);
}
.time-input-sep {
    color: var(--input-text);
    padding: 0 0.125rem;
    user-select: none;
}

/* Number-input variants of time-input-field (used by date-input).
   No dropdown chevron needed; tighter width; hide the spin buttons
   that browsers attach to <input type="number"> by default. */
input.time-input-field {
    background-image: none;
    padding: 0.25rem 0.25rem;
    min-width: 0;
    width: 2.5rem;
    -moz-appearance: textfield;
}
input.time-input-field.date-input-year {
    width: 3.5rem;
}
input.time-input-field::-webkit-outer-spin-button,
input.time-input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Table styling - Override Bootstrap 5 CSS variables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--table-border);
    --bs-table-striped-bg: var(--table-row-hover);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--table-row-hover);
    --bs-table-hover-color: var(--text-primary);
    color: var(--text-primary);
    border-color: var(--table-border);
}

.table > thead {
    background-color: var(--table-header-bg);
}

.table > thead > tr > th {
    background-color: var(--table-header-bg);
    color: var(--text-primary);
    border-bottom-color: var(--table-border);
    text-align: left;
    white-space: normal;
    max-width: 150px;
    word-wrap: break-word;
}

.table > thead > tr:hover > th,
.table-hover > thead > tr:hover > th {
    --bs-table-bg-state: var(--table-header-bg) !important;
    --bs-table-color-state: var(--text-primary) !important;
    background-color: var(--table-header-bg) !important;
    color: var(--text-primary) !important;
}

.table > tbody > tr {
    background-color: var(--site-bg-secondary);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.table > tbody > tr > td {
    color: var(--text-primary);
    border-bottom-color: var(--table-border);
    padding: 0.75rem 0.5rem;
}

.table > tbody > tr:hover {
    background-color: var(--table-row-hover);
}

.table > tbody > tr > td:first-child {
    border-radius: 6px 0 0 6px;
}

.table > tbody > tr > td:last-child {
    border-radius: 0 6px 6px 0;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--table-row-hover);
    background-color: var(--table-row-hover);
}

/* Row selection (SortableTable `selection`). The whole cell toggles. */
.table th.row-select,
.table td.row-select {
    width: 2rem;
    cursor: pointer;
    user-select: none;
}

.row-select .form-check-input,
.bulk-field-toggle .form-check-input {
    float: none;
    margin: 0;
    vertical-align: middle;
}

.table > tbody > tr.row-selected > td {
    background-color: color-mix(in srgb, var(--accent-primary) 14%, var(--site-bg-secondary));
}

/* Per-column filters (SortableTable `filter`): a funnel next to the
   column title opens a popover. Faint until hovered; accent when set. */
.th-content {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.column-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

th:hover .column-filter-btn,
.column-filter-btn:focus-visible,
.column-filter-btn.open {
    opacity: 1;
}

.column-filter-btn:hover,
.column-filter-btn.open {
    background-color: rgba(100, 140, 200, 0.2);
}

.column-filter-btn.active {
    color: var(--accent-primary);
    opacity: 1;
}

.column-filter-popover {
    position: fixed;
    z-index: 1030; /* over the page, under side panels and modals */
    min-width: 200px;
    max-width: 280px;
    padding: 0.5rem;
    background-color: var(--site-bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-weight: 400;
}

/* Min/max and from/to: label column + input column. */
.column-filter-range {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.5rem;
    align-items: center;
    font-size: 0.875rem;
}

.column-filter-range label {
    margin: 0;
}

.column-filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.column-filter-actions .btn-link {
    padding: 0;
}

.column-filter-options {
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
}

.column-filter-option {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.column-filter-option:hover,
.column-filter-option:focus-visible {
    background-color: var(--table-row-hover);
    outline: none;
}

.column-filter-option.selected {
    color: var(--accent-primary);
    font-weight: 600;
}

.column-filter-option.empty {
    color: var(--text-muted);
}

.column-filter-count {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.result-count .clear-column-filters {
    padding: 0;
    vertical-align: baseline;
}

/* Bulk-action bar over a selectable table; stays in view while scrolling. */
.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background-color: var(--site-bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
}

.bulk-bar[hidden] {
    display: none;
}

.bulk-field-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.bulk-mixed {
    font-size: 0.8rem;
    font-weight: 400;
}

.bulk-failures {
    max-height: 50vh;
    overflow-y: auto;
    padding-left: 1.25rem;
    font-size: 0.85rem;
}

/* Search box styling */
.search-box {
    max-width: 400px;
}

.search-box .search-input {
    background-color: var(--input-bg);
    border-color: var(--border-primary);
    color: var(--input-text);
}

.search-box .search-input:focus {
    background-color: var(--input-bg);
    border-color: var(--accent-primary);
    color: var(--input-text);
    box-shadow: 0 0 0 0.2rem rgba(100, 140, 200, 0.25);
}

/* Sortable table headers */
.sort-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
    padding-right: 1.5rem !important;
}

/* The sort control inside a header cell: a real button, looking like the title. */
.sort-btn {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
}

.sort-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Opaque: the header stays in view over the rows scrolling under it. */
.table > thead > tr > th.sort-header:hover {
    background-color: color-mix(in srgb, var(--accent-primary) 12%, var(--table-header-bg)) !important;
}

.table > thead > tr > th.sort-header.active {
    background-color: color-mix(in srgb, var(--accent-primary) 8%, var(--table-header-bg));
}

.sort-icon {
    margin-left: 0.25rem;
    font-size: 0.7em;
    color: var(--accent-primary);
    vertical-align: middle;
}

.sort-header:not(.active) .sort-icon {
    opacity: 0;
}

.sort-header:not(.active):hover .sort-icon {
    opacity: 0.3;
}

/* Table row status colors */
tr.status-pending {
    background-color: var(--status-pending-bg);
}

tr.status-requested {
    background-color: var(--status-requested-bg);
}

tr.status-loaded {
    background-color: var(--status-loaded-bg);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

/* Page titles - clean, modern style */
.content {
    padding-top:0.5rem;
}

.content h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.content h3 {
    font-size: 1.0rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Muted text */
.text-muted {
    color: var(--text-muted) !important;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--nav-link-hover-bg);
    border-color: var(--accent-primary);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

/* Custom Modal styling */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: fadeIn 0.15s ease-out;
}

:root[data-theme="light"] .custom-modal-overlay {
    background-color: rgba(0, 0, 0, 0.35);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.custom-modal {
    background-color: var(--site-bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    background-color: var(--site-bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

.custom-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.custom-modal-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.custom-modal-close:hover {
    background-color: var(--nav-link-hover-bg);
    color: var(--text-primary);
}

.custom-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    color: var(--text-primary);
}

.custom-modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ============================================
   Side Panel (slide-in from right)
   ============================================ */

.side-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1040;
    animation: fadeIn 0.15s ease-out;
}

.side-panel.side-panel-wide {
    width: 520px;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background-color: var(--site-bg-secondary);
    border-left: 1px solid var(--border-primary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background-color: var(--site-bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.side-panel-header h5 {
    margin: 0;
    font-size: 1rem;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.side-panel-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ---------- Modal dialog (centered, for pickers/confirmations) ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1060;
    animation: fadeIn 0.15s ease-out;
}

.modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    background-color: var(--site-bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1070;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.15s ease-out;
}

/* confirmDialog stacks above an open modal. */
.modal-overlay.confirm-layer { z-index: 1080; }
.modal-panel.confirm-layer { z-index: 1090; }
.confirm-message { white-space: pre-line; margin: 0; }

.modal-panel.modal-small  { width: 320px; }
.modal-panel.modal-medium { width: 480px; }
.modal-panel.modal-large  { width: 720px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background-color: var(--site-bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.modal-header h5 {
    margin: 0;
    font-size: 1rem;
}

/* Close button used by modal-header, side-panel-header, and custom-modal-header.
   Empty <button class="btn-close"> renders the × glyph via CSS so consumers
   don't have to put markup inside. */
.btn-close {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    width: 1.75rem;
    height: 1.75rem;
    line-height: 1;
    color: var(--text-secondary, #888);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-close::before {
    content: "\00D7";
}
.btn-close:hover {
    color: var(--text-primary, #000);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.side-panel-body .form-group {
    margin-bottom: 0.75rem;
}

.side-panel-body .form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.side-panel-body .form-control:disabled,
.side-panel-body .form-control[disabled],
.side-panel-body textarea:disabled {
    background-color: transparent;
    border-color: transparent;
    opacity: 0.8;
    padding-left: 0;
    cursor: default;
}

.side-panel-body .form-group .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   Bootstrap Utility Replacements
   ============================================ */

/* Box sizing for all elements */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Reset html and body margins */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

/* Flexbox utilities */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-start { justify-content: flex-start; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.align-items-center { align-items: center; }
.align-items-stretch { align-items: stretch; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Grid system */
.container-fluid {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.col { flex: 1 0 0%; }
.col-4 { flex: 0 0 auto; width: 33.3333%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-8 { flex: 0 0 auto; width: 66.6667%; }

/* A description list laid out as a grid (`dl.row`): the cells' widths
   include the gutter, so no browser indent on top of it. */
.row > dd { margin-left: 0; }

@media (min-width: 576px) {
    .col-sm-2 { flex: 0 0 auto; width: 16.6667%; }
    .col-sm-10 { flex: 0 0 auto; width: 83.3333%; }
}

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 auto; width: 16.6667%; }
    .col-md-4 { flex: 0 0 auto; width: 33.3333%; }
}

/* Horizontal gutter comes from `.row > *` padding. */
.row.g-3 { row-gap: 1rem; }

.flex-grow-1 { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Spacing utilities - only the ones actually used */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem; }
.p-3 { padding: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.ps-3 { padding-left: 1rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.px-4 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* Text utilities - only the ones actually used */
.text-center { text-align: center; }
.text-primary { color: var(--accent-primary) !important; }
.text-dark { color: #000 !important; }
.text-danger { color: var(--accent-error) !important; }
.text-nowrap { white-space: nowrap; }
.small { font-size: 0.875em; }
.border-0 { border: 0 !important; }

/* Button base styles */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn:disabled, .btn.disabled {
    pointer-events: none;
    opacity: 0.65;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

.btn-group {
    display: inline-flex;
}

.btn-group > .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group > .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* Outline button variants */
.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-primary);
    background-color: transparent;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    color: var(--text-primary);
    background-color: var(--site-bg-tertiary);
    border-color: var(--border-primary);
    transform: translateY(-1px);
}

.btn-outline-danger {
    color: var(--accent-error);
    border-color: var(--accent-error);
    background-color: transparent;
    transition: all 0.2s ease;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: var(--accent-error);
    border-color: var(--accent-error);
    transform: translateY(-1px);
}

.btn-danger {
    color: #fff;
    background-color: var(--accent-error);
    border-color: var(--accent-error);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.btn-danger:hover {
    color: #fff;
    background-color: color-mix(in srgb, var(--accent-error) 85%, #000);
    border-color: color-mix(in srgb, var(--accent-error) 85%, #000);
    transform: translateY(-1px);
}

.btn-warning {
    color: #1a1a1a;
    background-color: var(--accent-warning);
    border-color: var(--accent-warning);
}

.btn-warning:hover {
    color: #1a1a1a;
    background-color: color-mix(in srgb, var(--accent-warning) 85%, #000);
    border-color: color-mix(in srgb, var(--accent-warning) 85%, #000);
    transform: translateY(-1px);
}

.btn-info {
    color: #fff;
    background-color: #2a8fa8;
    border-color: #2a8fa8;
}

.btn-info:hover {
    color: #fff;
    background-color: #237a90;
    border-color: #237a90;
    transform: translateY(-1px);
}

.btn-outline-warning {
    color: var(--accent-warning);
    border-color: var(--accent-warning);
    background-color: transparent;
    transition: all 0.2s ease;
}

.btn-outline-warning:hover {
    color: #1a1a1a;
    background-color: var(--accent-warning);
    border-color: var(--accent-warning);
    transform: translateY(-1px);
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.btn-link {
    font-weight: 400;
    color: var(--accent-primary);
    text-decoration: underline;
    background-color: transparent;
    border-color: transparent;
}

.btn-link:hover {
    color: var(--accent-primary-hover);
}

/* Table utilities */
.table {
    width: 100%;
    margin-bottom: 1rem;
    vertical-align: top;
    border-collapse: collapse;
}

.table > :not(caption) > * > * {
    padding: 0.5rem;
    border-bottom-width: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A table of text (names, DOIs) wraps its cells rather than widen. */
.table.table-wrap > :not(caption) > * > * {
    white-space: normal;
    overflow-wrap: anywhere;
}

.table > thead {
    vertical-align: bottom;
}

.table.table-sm > * > tr > * {
    padding: 0.3rem 0.5rem;
}

.table-bordered > * > tr > * {
    border: 1px solid var(--table-border);
}

.table > thead.table-light > tr > th {
    background-color: var(--table-header-bg);
}

.table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* A table scrolls in its own box, both ways: a wide one never widens the
   page (the menu stays put), and a long one is at most the window's height,
   so its header (sticky to the box) stays in view while the rows scroll. */
.table-responsive {
    overflow: auto;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    -webkit-overflow-scrolling: touch;
}

/* The column that names the row (SortableTable `sticky`) stays at the left
   while the table scrolls sideways. Its cells need their own opaque
   background, or the cells passing under them show through. */
.table > thead > tr > th.sticky-col {
    left: 0;
    z-index: 11;
}

.table > tbody > tr > td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: inherit;
}

.table > tbody > tr:hover > td.sticky-col {
    background-color: var(--site-bg);
    background-image: linear-gradient(var(--table-row-hover), var(--table-row-hover));
}

.table > tbody > tr.row-selected > td.sticky-col {
    background-color: color-mix(in srgb, var(--accent-primary) 14%, var(--site-bg-secondary));
    background-image: none;
}

/* Only rows that open something look clickable (SortableTable
   `onRowClick` / `clickableRows`); they're focusable too. */
.table > tbody > tr.row-clickable {
    cursor: pointer;
}

.table > tbody > tr.row-clickable:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.4em 0.8em;
    font-size: 0.7em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 50rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* A badge holding a value with a unit keeps its case: "mg", not "MG". */
.badge.badge-value { text-transform: none; letter-spacing: 0; }

.bg-primary { background-color: var(--accent-primary) !important; color: #fff; }
.bg-secondary { background-color: var(--site-bg-tertiary) !important; }
.btn.active .badge.bg-secondary,
.btn[aria-pressed="true"] .badge.bg-secondary {
    background-color: rgba(0, 0, 0, 0.3) !important;
    color: #fff;
}
.bg-success { background-color: var(--accent-success) !important; color: #000; }
.bg-danger { background-color: var(--accent-error) !important; color: #fff; }
.bg-warning { background-color: var(--accent-warning) !important; color: #000; }
.bg-info { background-color: var(--accent-primary) !important; color: #fff; }

/* Alert - only the variants actually used */
.alert {
    position: relative;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 500;
}

.alert-warning {
    color: var(--accent-warning);
    background-color: var(--warning-bg);
    border-color: var(--warning-border);
}

:root[data-theme="light"] .alert-warning {
    color: var(--warning-text);
}

/* Inline notice inside a form or modal. */
.alert-compact {
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    font-weight: 400;
}

.alert-danger {
    color: var(--accent-error);
    background-color: rgba(250, 107, 92, 0.15);
    border-color: rgba(250, 107, 92, 0.3);
}

/* A field the form refused (utils/field-errors.ts), and why, under it. */
.form-control.is-invalid,
.form-select.is-invalid,
.fc-input.is-invalid,
.time-input.is-invalid,
.time-input:has(.is-invalid) {
    border-color: var(--accent-error) !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.fc-input.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(250, 107, 92, 0.25);
}

.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--accent-error);
}

.alert-info {
    color: var(--accent-primary);
    background-color: rgba(74, 144, 217, 0.15);
    border-color: rgba(74, 144, 217, 0.3);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    list-style: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    float: left;
    padding-right: 0.5rem;
    color: var(--text-muted);
    content: "/";
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accordion-item {
    background-color: var(--site-bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.accordion-header {
    margin: 0;
    display: flex;
    align-items: center;
    background-color: var(--site-bg-tertiary);
    transition: background-color 0.15s ease-in-out;
}

.accordion-header:hover {
    background-color: var(--site-bg-secondary);
}

.accordion-header.expanded {
    background-color: var(--site-bg-secondary);
    border-bottom: 1px solid var(--border-secondary);
}

.accordion-button {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    background-color: transparent;
    border: 0;
    border-radius: 0;
    overflow-anchor: none;
    cursor: pointer;
}

.accordion-chevron {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.75rem;
    margin-right: 1rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: 1.25rem;
    transition: transform 0.2s ease-in-out;
    cursor: pointer;
}

:root[data-theme="light"] .accordion-chevron {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.accordion-chevron:not(.collapsed) {
    transform: rotate(-180deg);
}

.accordion-collapse {
    display: none;
}

.accordion-collapse.show {
    display: block;
}

.accordion-body {
    padding: 1rem 1.25rem;
    background-color: var(--site-bg-secondary);
}

/* Spinner */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentcolor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Small inline spinner; also the BaseComponent loading state's. */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 0.2em solid currentcolor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.loading-container,
/* Not found / access denied (components/page-states.ts). */
.page-state {
    padding: 3rem 1rem;
    text-align: center;
}

.page-state p {
    color: var(--text-secondary);
}

.error-container {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.loading-container .spinner {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.75rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Form utilities */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    appearance: none;
    border-radius: 0.375rem;
}

.form-label {
    margin-bottom: 0.5rem;
    display: inline-block;
}

.form-control.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.form-select.form-select-sm {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--text-secondary);
}

.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}

.form-check-input {
    float: left;
    margin-left: -1.5em;
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    vertical-align: top;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    appearance: none;
    border-radius: 0.25em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.form-check-input[type="checkbox"] {
    border-radius: 0.25em;
}

/* "Some selected" state of a select-all box. */
.form-check-input:indeterminate {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.form-check-label {
    cursor: pointer;
}

/* Visibility */
.visually-hidden,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Width/Height utilities */
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.mw-100 { max-width: 100%; }

/* Position utilities */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }

/* Navbar (minimal for sidebar) */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar-brand {
    padding-top: 0.3125rem;
    padding-bottom: 0.3125rem;
    margin-right: 1rem;
    font-size: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-dark {
    color: rgba(255, 255, 255, 0.55);
}

/* ============================================
   Sidebar Layout
   ============================================ */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    /* A flex item is at least as wide as its content by default: a wide
       table would widen the page instead of scrolling in its box. */
    min-width: 0;
}

.sidebar {
    background-image: linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 70%);
    position: relative;
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 230px;
        min-width: 230px;
        flex-shrink: 0;
        height: 100vh;
        position: sticky;
        top: 0;
    }
}

/* Top row / header */
.top-row {
    min-height: 3.5rem;
    background-color: var(--topbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-row .navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Build-version badge appended to the GaiaPulse brand by main.ts.
   Quiet typography (low weight, dim color, small caps) keeps it from
   competing with the brand title but stays readable for support. */
.build-version-tag {
    margin-left: 0.5rem;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.55);
    vertical-align: middle;
    text-transform: lowercase;
    font-variant-numeric: tabular-nums;
}

/* Page header - responsive title + controls row */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    padding: 0 1rem;
}

.page-header h1 {
    margin-bottom: 0;
}

/* A long address (a dataset link) wraps rather than push the page sideways. */
.link-wrap {
    overflow-wrap: anywhere;
}

/* Navbar toggler (mobile hamburger menu) */
.navbar-toggler {
    appearance: none;
    cursor: pointer;
    width: 3.5rem;
    height: 2.5rem;
    color: var(--nav-link);
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
}

.navbar-toggler:checked {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Nav scrollable area */
.nav-scrollable {
    display: none;
}

.navbar-toggler:checked ~ .nav-scrollable {
    display: block;
}

@media (min-width: 641px) {
    .navbar-toggler {
        display: none;
    }

    .nav-scrollable {
        display: block;
        height: calc(100vh - 3.5rem - 3.5rem);
        overflow-y: auto;
    }
}

/* Navigation items */
.nav-item {
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
}

.nav-item:first-of-type {
    padding-top: 1rem;
}

.nav-item:last-of-type {
    padding-bottom: 1rem;
}

.nav-item .nav-link {
    color: var(--nav-link);
    background: none;
    border: none;
    border-radius: 6px;
    height: 2.75rem;
    display: flex;
    align-items: center;
    line-height: 2.75rem;
    width: 100%;
    padding: 0 1rem;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-item a.active {
    background-color: var(--nav-link-active-bg);
    color: var(--nav-link-active);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

.nav-item .nav-link:hover {
    background-color: var(--nav-link-hover-bg);
    color: var(--nav-link-active);
    transform: translateX(3px);
}

/* Navigation icons */
.bi {
    display: inline-block;
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    top: -1px;
    background-size: cover;
}

.bi-house-door-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
}

.bi-plus-square-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
}

.bi-list-nested-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
}

.bi-lock-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
}

.bi-person-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'/%3E%3C/svg%3E");
}

.bi-person-badge-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3zM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z'/%3E%3Cpath d='M4.5 0A2.5 2.5 0 0 0 2 2.5V14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2.5A2.5 2.5 0 0 0 11.5 0h-7zM3 2.5A1.5 1.5 0 0 1 4.5 1h7A1.5 1.5 0 0 1 13 2.5v10.795a4.2 4.2 0 0 0-.776-.492C11.392 12.387 10.063 12 8 12s-3.392.387-4.224.803a4.2 4.2 0 0 0-.776.492V2.5z'/%3E%3C/svg%3E");
}

.bi-person-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z'/%3E%3C/svg%3E");
}

.bi-arrow-bar-left-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5ZM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5Z'/%3E%3C/svg%3E");
}

.bi-geo-alt-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M12.166 8.94c-.524 1.062-1.234 2.12-1.96 3.07A31.493 31.493 0 0 1 8 14.58a31.481 31.481 0 0 1-2.206-2.57c-.726-.95-1.436-2.008-1.96-3.07C3.304 7.867 3 6.862 3 6a5 5 0 0 1 10 0c0 .862-.305 1.867-.834 2.94zM8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10z'/%3E%3Cpath d='M8 8a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 1a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'/%3E%3C/svg%3E");
}

.bi-broadcast-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707zm2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708zm5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708zm2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0z'/%3E%3C/svg%3E");
}

.bi-activity-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M6 2a.5.5 0 0 1 .47.33L10 12.036l1.53-4.208A.5.5 0 0 1 12 7.5h3.5a.5.5 0 0 1 0 1h-3.15l-1.88 5.17a.5.5 0 0 1-.94 0L6 3.964 4.47 8.171A.5.5 0 0 1 4 8.5H.5a.5.5 0 0 1 0-1h3.15l1.88-5.17A.5.5 0 0 1 6 2Z'/%3E%3C/svg%3E");
}

.bi-soundwave-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-1 0v-11a.5.5 0 0 1 .5-.5zm-2 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zm4 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zm-6 1.5A.5.5 0 0 1 5 6v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm8 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm-10 1A.5.5 0 0 1 3 7v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5zm12 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5z'/%3E%3C/svg%3E");
}

.bi-rulers-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1 0a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h5v-1H2v-1h4v-1H4v-1h2v-1H2v-1h4V9H4V8h2V7H2V6h4V2h1v4h1V4h1v2h1V2h1v4h1V4h1v2h1V2h1v4h1V1a1 1 0 0 0-1-1H1z'/%3E%3C/svg%3E");
}

.bi-calendar-event-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z'/%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
}

.bi-building-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M4 2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1Zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1Zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1ZM4 5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1ZM7.5 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1Zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1ZM4.5 8a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1Zm2.5.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1Zm3.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1Z'/%3E%3Cpath d='M2 1a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V1Zm11 0H3v14h3v-2.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5V15h3V1Z'/%3E%3C/svg%3E");
}

.bi-file-earmark-text-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 7a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1h-5zM5 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z'/%3E%3Cpath d='M9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0zm0 1v2A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z'/%3E%3C/svg%3E");
}

.bi-people-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M15 14s1 0 1-1-1-4-5-4-5 3-5 4 1 1 1 1h8Zm-7.978-1A.261.261 0 0 1 7 12.996c.001-.264.167-1.03.76-1.72C8.312 10.629 9.282 10 11 10c1.717 0 2.687.63 3.24 1.276.593.69.758 1.457.76 1.72l-.008.002a.274.274 0 0 1-.014.002H7.022ZM11 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM6.936 9.28a5.88 5.88 0 0 0-1.23-.247A7.35 7.35 0 0 0 5 9c-4 0-5 3-5 4 0 .667.333 1 1 1h4.216A2.238 2.238 0 0 1 5 13c0-.01 0-.02.002-.032L5 12.998c-.001-.246.154-.986.832-1.664.502-.502 1.2-.923 2.104-1.054ZM4.5 7a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z'/%3E%3C/svg%3E");
}

/* Sidebar footer with theme toggle */
.sidebar-footer {
    height: 3.5rem;
    display: none;
    align-items: center;
    padding: 0 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-toggler:checked ~ .sidebar-footer {
    display: flex;
}

@media (min-width: 641px) {
    .sidebar-footer {
        display: flex;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

.sidebar-footer .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.sidebar-footer .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-footer .theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Inline editable fields */
.editable-field {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.editable-field:hover {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

/* ============================================================================
   Toast notifications
   ============================================================================ */
/* Bottom right: at the top it sat over side panels' close buttons. */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--site-bg-secondary);
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    max-width: 380px;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-item.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-success { border-left: 3px solid var(--accent-success); }
.toast-error   { border-left: 3px solid var(--accent-error); }
.toast-warning { border-left: 3px solid var(--accent-warning); }
.toast-info    { border-left: 3px solid var(--accent-primary); }

/* ============================================================================
   Quick Config — mobile-friendly device configuration (NFC landing page)
   ============================================================================ */
.qc-page {
    max-width: 540px;
    margin: 0 auto;
    padding: 16px;
}

.qc-header {
    text-align: center;
    margin-bottom: 20px;
}

.qc-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.qc-subtitle {
    font-size: 0.9rem;
    color: var(--accent-primary);
    margin: 0;
    font-weight: 500;
}

.qc-iccid {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 4px 0 0 0;
    font-family: monospace;
}

.qc-status-line {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 6px 0 0 0;
}

/* Active/Inactive banner */
.qc-active-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.qc-active-on {
    background: rgba(89, 222, 138, 0.12);
    border: 2px solid var(--accent-success);
    color: var(--accent-success);
}

.qc-active-off {
    background: rgba(250, 107, 92, 0.12);
    border: 2px solid var(--accent-error);
    color: var(--accent-error);
}

.qc-active-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.qc-active-on .qc-active-dot {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
}

.qc-active-off .qc-active-dot {
    background: var(--accent-error);
}

/* Config sync status */
.qc-sync-banner {
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.qc-sync-ok {
    background: rgba(89, 222, 138, 0.08);
    color: var(--accent-success);
}

.qc-sync-pending {
    background: rgba(252, 191, 77, 0.12);
    border: 1px solid var(--accent-warning);
    color: var(--accent-warning);
}

.side-panel-body h6,
.custom-modal-body h6 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.side-panel-body hr,
.custom-modal-body hr {
    border: 0;
    border-top: 1px solid var(--border-primary);
    opacity: 1;
    margin: 1rem 0;
}

/* Sections */
.fc-section {
    margin-bottom: 20px;
}

.fc-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-primary);
}

/* Fields — larger touch targets */
.fc-field {
    margin-bottom: 12px;
}

.fc-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.fc-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    box-sizing: border-box;
    -webkit-appearance: none;
    min-height: 48px;
}

.fc-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.fc-textarea {
    resize: vertical;
    min-height: 48px;
    line-height: 1.4;
}

.fc-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Grid layouts */
.fc-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.fc-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Toggle switches — large touch area */
.fc-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    cursor: pointer;
    border-radius: 8px;
    min-height: 52px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.fc-toggle:active {
    background: var(--site-bg-secondary);
}

.fc-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fc-toggle-label {
    font-size: 0.95rem;
}

.fc-toggle-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.fc-toggle input[type="checkbox"] {
    display: none;
}

.fc-toggle-switch {
    position: relative;
    width: 52px;
    height: 30px;
    background: var(--text-muted);
    border-radius: 15px;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.fc-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.fc-toggle input:checked + .fc-toggle-switch {
    background: var(--accent-success);
}

.fc-toggle input:checked + .fc-toggle-switch::after {
    transform: translateX(22px);
}

.fc-toggle input:disabled + .fc-toggle-switch {
    opacity: 0.4;
}

/* Save button — full width, large */
.fc-actions {
    margin-top: 24px;
    padding-bottom: 24px;
}

.fc-btn {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
}

.fc-btn-save {
    background: var(--accent-primary);
    color: white;
}

.fc-btn-save:active {
    background: var(--accent-primary-hover);
}

/* Error screen */
.qc-error {
    text-align: center;
    padding: 48px 16px;
}

.qc-error-icon {
    width: 64px;
    height: 64px;
    line-height: 64px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-error);
    border: 3px solid var(--accent-error);
    border-radius: 50%;
    margin: 0 auto 20px;
}

.qc-error-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 12px 0;
    line-height: 1.5;
}

.qc-error-text a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

/* NFC re-tap prompt */
.qc-nfc-prompt {
    text-align: center;
    padding: 24px 16px;
    margin: 0 auto 20px;
    max-width: 540px;
    background: rgba(89, 222, 138, 0.08);
    border: 2px solid var(--accent-success);
    border-radius: 12px;
}

.qc-nfc-icon {
    font-size: 3rem;
    color: var(--accent-success);
    margin-bottom: 8px;
}

.qc-nfc-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-success);
    margin: 0 0 8px;
}

.qc-nfc-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

/* Danger zone */
.qc-danger-zone {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 2px solid var(--accent-error);
}

.qc-danger-zone .fc-section-title {
    color: var(--accent-error);
}

.qc-danger-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.fc-btn-danger {
    background: var(--accent-error);
    color: white;
}

.fc-btn-danger:active {
    opacity: 0.85;
}

.qc-nfc-applied {
    background: rgba(89, 222, 138, 0.08);
    border-color: var(--accent-success);
}

.qc-nfc-applied .qc-nfc-icon {
    color: var(--accent-success);
    font-size: 2.5rem;
}

.qc-nfc-applied .qc-nfc-title {
    color: var(--accent-success);
}

.qc-nfc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 8px;
    animation: qc-spin 0.8s linear infinite;
}

@keyframes qc-spin {
    to { transform: rotate(360deg); }
}

.fc-btn-dismiss {
    background: var(--accent-success);
    color: white;
    min-width: 120px;
}

.fc-btn-dismiss:active {
    opacity: 0.85;
}

/* Mobile: full width on small screens */
@media (max-width: 600px) {
    .qc-page {
        padding: 12px;
    }

    .fc-grid-3 {
        grid-template-columns: 1fr;
    }

    .qc-status-bar {
        flex-direction: column;
    }
}

/* Shown in a chart's place when WebGPU is unavailable (lib/gpu.ts). */
.gpu-unavailable {
    padding: 1.25rem 1.5rem;
    margin: 0.5rem;
    border: 1px dashed var(--border-primary);
    border-radius: 6px;
    background: var(--site-bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.gpu-unavailable strong {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}
.gpu-unavailable p {
    margin: 0;
}

/* Map (lib/webgpuMap.ts). touch-action: none hands every touch on the map
   to the map's own pan/pinch handling instead of scrolling the page. */
.gmap {
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.gmap:focus { outline: none; }
.gmap:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.gmap-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.gmap-attrib {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 1px 6px;
    font: 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    background: rgba(255, 255, 255, 0.75);
    border-top-left-radius: 4px;
}
.gmap-attrib a { color: inherit; }

/* ==== user-account-component-ui v0.3.0: styles.css (copied; see ts/accounts/README.md) ==== */
/* The accounts UI. A service themes it by setting these variables (on :root
   or on .uac), e.g. to its own font and colours. */

:root {
  --uac-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --uac-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --uac-bg: #f4f5f7;
  --uac-surface: #ffffff;
  /* table heads, hovered rows and menu items, read-only fields */
  --uac-surface-2: #f7f8fa;
  --uac-input: var(--uac-surface);
  --uac-fg: #1d2330;
  --uac-muted: #687083;
  --uac-border: #d6d9e0;
  --uac-accent: #2f6fde;
  --uac-accent-fg: #ffffff;
  --uac-danger: #c43d3d;
  --uac-danger-fg: #ffffff;
  --uac-warn: #b7791f;
  --uac-ok: #1f8a4c;
  --uac-radius: 8px;
  --uac-shadow: 0 12px 40px rgba(20, 24, 33, 0.18);
  --uac-dim: rgba(20, 24, 33, 0.45);
}

.uac {
  font-family: var(--uac-font);
  color: var(--uac-fg);
  line-height: 1.4;
}

.uac *,
.uac *::before,
.uac *::after {
  box-sizing: border-box;
}

.uac [hidden] {
  display: none !important;
}

.uac-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Layers, cards and dialogs ---- */

.uac-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}

.uac-page {
  background: var(--uac-bg);
}

.uac-dim {
  background: var(--uac-dim);
}

.uac-card,
.uac-dialog {
  background: var(--uac-surface);
  border: 1px solid var(--uac-border);
  border-radius: var(--uac-radius);
  box-shadow: var(--uac-shadow);
  padding: 28px 32px;
  width: min(400px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.uac-dialog {
  width: min(480px, 100%);
  padding: 24px 28px;
}

.uac-card-head,
.uac-dialog-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uac-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.uac-dialog-body p {
  margin: 0;
}

.uac-service {
  margin: 0;
  color: var(--uac-accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.uac h1 {
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0;
}

.uac h2 {
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0;
}

.uac-subtitle {
  overflow-wrap: anywhere;
}

/* ---- Fields ---- */

.uac label,
.uac-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  font-weight: 500;
}

.uac input:not([type="checkbox"]):not([type="radio"]),
.uac select {
  font: inherit;
  font-weight: 400;
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--uac-border);
  border-radius: calc(var(--uac-radius) * 0.6);
  background: var(--uac-input);
  color: var(--uac-fg);
  outline: none;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.uac input:not([type="checkbox"]):not([type="radio"]):focus,
.uac select:focus {
  border-color: var(--uac-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--uac-accent) 25%, transparent);
}

.uac input.uac-mono {
  font-family: var(--uac-mono);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.uac-hint {
  color: var(--uac-muted);
  font-size: 0.8rem;
  font-weight: 400;
  margin: 0;
}

/* The one-time password and its Copy and Another buttons */
.uac-secret {
  display: flex;
  gap: 6px;
}

.uac-secret input {
  flex: 1;
  min-width: 0;
}

/* ---- Buttons ---- */

.uac button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--uac-border);
  border-radius: calc(var(--uac-radius) * 0.6);
  background: var(--uac-surface);
  color: var(--uac-fg);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.uac button:hover:not(:disabled) {
  background: var(--uac-surface-2);
  border-color: color-mix(in srgb, var(--uac-fg) 25%, var(--uac-border));
}

.uac button:focus-visible {
  outline: 2px solid var(--uac-accent);
  outline-offset: 2px;
}

.uac button:disabled {
  opacity: 0.6;
  cursor: default;
}

.uac button.uac-primary {
  background: var(--uac-accent);
  border-color: var(--uac-accent);
  color: var(--uac-accent-fg);
}

.uac button.uac-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uac-accent) 85%, #ffffff);
  border-color: color-mix(in srgb, var(--uac-accent) 85%, #ffffff);
}

.uac button.uac-danger {
  color: var(--uac-danger);
}

.uac .uac-dialog button.uac-danger[type="submit"] {
  background: var(--uac-danger);
  border-color: var(--uac-danger);
  color: var(--uac-danger-fg);
}

.uac .uac-dialog button.uac-danger[type="submit"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uac-danger) 85%, #000000);
}

.uac button.uac-icon {
  min-width: 36px;
  padding: 8px;
  font-size: 1rem;
  line-height: 1;
}

.uac button.uac-small {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.uac button.uac-wide {
  width: 100%;
  min-height: 40px;
}

.uac-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ---- Messages ---- */

.uac-muted {
  color: var(--uac-muted);
  font-size: 0.85rem;
  font-weight: 400;
  margin: 0;
}

.uac-message {
  margin: 0;
  font-size: 0.9rem;
}

.uac-message:empty {
  display: none;
}

.uac-message.uac-error,
.uac-message.uac-info {
  padding: 9px 12px;
  border-radius: calc(var(--uac-radius) * 0.6);
  border: 1px solid;
}

.uac-message.uac-error {
  color: var(--uac-danger);
  border-color: color-mix(in srgb, var(--uac-danger) 40%, transparent);
  background: color-mix(in srgb, var(--uac-danger) 10%, transparent);
}

.uac-message.uac-info {
  color: var(--uac-ok);
  border-color: color-mix(in srgb, var(--uac-ok) 40%, transparent);
  background: color-mix(in srgb, var(--uac-ok) 10%, transparent);
}

/* ---- Badges ---- */

.uac-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.uac-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid var(--uac-border);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--uac-muted);
}

/* the states, each with a dot of its colour */
.uac-badge-ok,
.uac-badge-info,
.uac-badge-warn,
.uac-badge-off {
  --uac-badge: var(--uac-muted);
  color: var(--uac-badge);
  border-color: color-mix(in srgb, var(--uac-badge) 35%, transparent);
  background: color-mix(in srgb, var(--uac-badge) 12%, transparent);
}

.uac-badge-ok::before,
.uac-badge-info::before,
.uac-badge-warn::before,
.uac-badge-off::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.uac-badge-ok {
  --uac-badge: var(--uac-ok);
}

.uac-badge-info {
  --uac-badge: var(--uac-accent);
}

.uac-badge-warn {
  --uac-badge: var(--uac-warn);
}

.uac-badge-you {
  padding: 0 7px;
  font-size: 0.7rem;
  font-weight: 500;
}

.uac-role {
  color: var(--uac-fg);
  font-weight: 500;
  background: var(--uac-surface-2);
}

.uac-role-platform {
  color: var(--uac-accent);
  border-color: color-mix(in srgb, var(--uac-accent) 45%, transparent);
}

/* ---- The accounts ---- */

.uac-users {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.uac-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.uac-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.uac-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uac-tools input[type="search"] {
  width: 220px;
}

.uac-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.9rem;
  border: 1px solid var(--uac-border);
  border-radius: var(--uac-radius);
}

.uac-table th,
.uac-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--uac-border);
  vertical-align: middle;
}

.uac-table tbody tr:last-child td {
  border-bottom: none;
}

.uac-table th {
  color: var(--uac-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--uac-surface-2);
  white-space: nowrap;
}

.uac-table thead th:first-child {
  border-top-left-radius: var(--uac-radius);
}

.uac-table thead th:last-child {
  border-top-right-radius: var(--uac-radius);
}

.uac-table tbody tr:hover td {
  background: color-mix(in srgb, var(--uac-surface-2) 60%, transparent);
}

.uac-table tr.uac-off .uac-name,
.uac-table tr.uac-off .uac-email,
.uac-table tr.uac-off .uac-role {
  opacity: 0.55;
}

.uac-nowrap {
  white-space: nowrap;
}

.uac-empty {
  text-align: center;
  color: var(--uac-muted);
  padding: 28px 14px;
}

.uac-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.uac-email {
  color: var(--uac-muted);
  overflow-wrap: anywhere;
}

.uac-cell-actions {
  width: 1%;
  white-space: nowrap;
}

.uac-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.uac-row-actions button {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 0.85rem;
}

.uac-row-actions button.uac-icon {
  min-width: 32px;
  padding: 5px;
}

/* ---- A row's menu ---- */

.uac-menu {
  position: relative;
}

.uac-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--uac-surface);
  border: 1px solid var(--uac-border);
  border-radius: var(--uac-radius);
  box-shadow: var(--uac-shadow);
}

.uac-menu-up .uac-menu-list {
  top: auto;
  bottom: calc(100% + 4px);
}

.uac .uac-menu-list button {
  border: none;
  background: none;
  text-align: left;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: calc(var(--uac-radius) * 0.5);
}

.uac .uac-menu-list button:hover,
.uac .uac-menu-list button:focus-visible {
  background: var(--uac-surface-2);
  outline: none;
}

.uac .uac-menu-list button.uac-danger:hover,
.uac .uac-menu-list button.uac-danger:focus-visible {
  background: color-mix(in srgb, var(--uac-danger) 12%, transparent);
}

.uac-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--uac-border);
}

/* ---- Sessions ---- */

.uac-sessions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.uac-sessions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--uac-border);
  border-radius: var(--uac-radius);
  max-height: 50vh;
  overflow: auto;
}

.uac-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--uac-border);
}

.uac-session:last-child {
  border-bottom: none;
}

.uac-session-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.uac-session.uac-ended .uac-session-main {
  opacity: 0.6;
}

/* ---- Narrow screens: the name, email, state and actions ---- */

@media (max-width: 720px) {
  .uac-tools {
    width: 100%;
  }

  .uac-tools input[type="search"] {
    flex: 1;
    width: auto;
  }

  .uac-table th:nth-child(3),
  .uac-table td:nth-child(3),
  .uac-table th:nth-last-child(2),
  .uac-table td:nth-last-child(2) {
    display: none;
  }
}
/* ==== end of user-account-component-ui ==== */

/* The accounts screens follow the dashboard's theme (dark and light). */
:root {
    --uac-font: inherit;
    --uac-bg: var(--site-bg);
    --uac-surface: var(--site-bg-secondary);
    --uac-surface-2: var(--site-bg-tertiary);
    --uac-input: var(--input-bg);
    --uac-fg: var(--text-primary);
    --uac-muted: var(--text-muted);
    --uac-border: var(--border-primary);
    --uac-accent: var(--accent-primary);
    --uac-accent-fg: #ffffff;
    --uac-danger: var(--accent-error);
    --uac-danger-fg: #1a2332;
    --uac-warn: var(--accent-warning);
    --uac-ok: var(--accent-success);
    --uac-dim: rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
    --uac-danger-fg: #ffffff;
    --uac-dim: rgba(0, 0, 0, 0.35);
}

/* The accounts list keeps a readable width and scrolls sideways on a narrow screen,
   rather than crush the email column to a letter a line. */
#accounts-users {
    overflow-x: auto;
}
#accounts-users table {
    min-width: 720px;
}
