:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eff6ff;
    --accent-ring: rgba(37, 99, 235, .18);
    --header-from: #0f172a;
    --header-to: #1e3a8a;
    --critical: #dc2626;
    --critical-soft: #fef2f2;
    --important: #ea580c;
    --important-soft: #fff7ed;
    --moderate: #ca8a04;
    --moderate-soft: #fefce8;
    --low: #64748b;
    --low-soft: #f1f5f9;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lg: 0 24px 64px rgba(15, 23, 42, .28);
    --radius: 12px;
    --mono: "Cascadia Code", "JetBrains Mono", Consolas, ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #111827;
        --surface-2: #0f172a;
        --surface-3: #1e293b;
        --text: #e2e8f0;
        --text-2: #94a3b8;
        --muted: #64748b;
        --border: #1f2a3d;
        --border-strong: #334155;
        --accent: #3b82f6;
        --accent-hover: #60a5fa;
        --accent-soft: rgba(59, 130, 246, .12);
        --accent-ring: rgba(59, 130, 246, .3);
        --header-from: #020617;
        --header-to: #172554;
        --critical: #f87171;
        --critical-soft: rgba(248, 113, 113, .12);
        --important: #fb923c;
        --important-soft: rgba(251, 146, 60, .12);
        --moderate: #facc15;
        --moderate-soft: rgba(250, 204, 21, .1);
        --low: #94a3b8;
        --low-soft: rgba(148, 163, 184, .12);
        --success: #4ade80;
        --success-soft: rgba(74, 222, 128, .12);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
        --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

svg {
    flex-shrink: 0;
}

.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

/* App bar */
.appbar {
    background: linear-gradient(120deg, var(--header-from), var(--header-to));
    color: #fff;
}

.appbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    display: grid;
    place-items: center;
}

.brand-mark .icon {
    width: 22px;
    height: 22px;
}

.brand h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.brand p {
    margin: 1px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
}

.sources {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
    font-size: 12px;
    color: rgba(255, 255, 255, .85);
    font-family: var(--mono);
}

.source-chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, .2);
}

.source-chip .dot.missing {
    background: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, .25);
}

/* Page body */
.page {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 24px 28px 40px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    flex-wrap: wrap;
    color: var(--text-2);
    font-size: 12.5px;
}

.footer-brand,
.footer-meta,
.footer-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-brand .icon {
    color: var(--accent);
}

.footer-meta {
    gap: 20px;
    flex-wrap: wrap;
}

.footer-meta .icon {
    color: var(--muted);
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.stat-icon.blue {
    background: var(--accent-soft);
    color: var(--accent);
}

.stat-icon.violet {
    background: rgba(124, 58, 237, .1);
    color: #7c3aed;
}

.stat-icon.green {
    background: var(--success-soft);
    color: var(--success);
}

.stat-icon.red {
    background: var(--critical-soft);
    color: var(--critical);
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    color: var(--text-2);
    font-size: 12.5px;
    margin-top: 2px;
}

/* Tabs */
.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 11px;
    margin-bottom: 16px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    padding: 8px 16px;
    font: inherit;
    font-weight: 550;
    color: var(--text-2);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.tab .count {
    background: var(--border);
    color: var(--text-2);
    border-radius: 999px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
}

.tab.active .count {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Panel card */
.panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel.active {
    display: block;
    animation: fade .2s ease;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.panel-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
}

.panel-title p {
    margin: 2px 0 0;
    color: var(--text-2);
    font-size: 13px;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search {
    position: relative;
}

.search .icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search input {
    width: 290px;
    max-width: 100%;
    padding: 8px 12px 8px 36px;
}

input[type=search],
select {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    height: 38px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

select {
    padding: 0 32px 0 12px;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}

input[type=search]:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.result-count {
    color: var(--muted);
    font-size: 12.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Tables */
.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 330px);
    min-height: 240px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr {
    transition: background .12s;
}

tbody tr.clickable {
    cursor: pointer;
}

tbody tr.clickable:hover {
    background: var(--accent-soft);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   DataTables (sorting, paging) — matched to the app's tables
--------------------------------------------------------------------------- */
table.dataTable {
    width: 100% !important;
    margin: 0 !important;
}

table.dataTable > thead > tr > th,
table.dataTable > tbody > tr > td {
    padding: 12px 14px;
}

table.dataTable > thead > tr > th {
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

table.dataTable > thead > tr > th.dt-orderable-asc,
table.dataTable > thead > tr > th.dt-orderable-desc {
    cursor: pointer;
    user-select: none;
}

table.dataTable > thead > tr > th.dt-orderable-asc:hover,
table.dataTable > thead > tr > th.dt-orderable-desc:hover,
table.dataTable > thead > tr > th.dt-ordering-asc,
table.dataTable > thead > tr > th.dt-ordering-desc {
    color: var(--accent);
}

table.dataTable > thead > tr > th:active {
    outline: none;
}

table.dataTable.no-footer {
    border-bottom: 0;
}

/* DataTables right-aligns columns it detects as numeric; keep only our ".num" columns right-aligned */
table.dataTable th.dt-type-numeric:not(.num),
table.dataTable td.dt-type-numeric:not(.num) {
    text-align: left;
}

table.dataTable thead th.dt-type-numeric:not(.num) div.dt-column-header {
    flex-direction: row;
}

table.dataTable td.dt-empty {
    padding: 36px 14px;
    color: var(--muted);
    text-align: center;
}

.dt-container {
    position: relative;
}

.dt-container .dt-layout-row:has(.dt-paging, .dt-info, .dt-length) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.dt-container .dt-layout-cell {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0;
}

.dt-container .dt-info,
.dt-container .dt-length {
    color: var(--text-2);
    font-size: 13px;
    padding: 0;
}

.dt-container .dt-length select {
    height: 30px;
    margin: 0 6px;
    padding: 0 8px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.dt-container .dt-paging .dt-paging-button {
    min-width: 32px;
    height: 32px;
    margin-left: 4px;
    padding: 0 10px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 7px;
    background: var(--surface) !important;
    color: var(--text-2) !important;
    font-size: 13px;
    font-weight: 600;
}

.dt-container .dt-paging .dt-paging-button:hover:not(.disabled) {
    background: var(--surface-3) !important;
    color: var(--text) !important;
}

.dt-container .dt-paging .dt-paging-button.current,
.dt-container .dt-paging .dt-paging-button.current:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}

.dt-container .dt-paging .dt-paging-button.disabled {
    opacity: .45;
}

.dt-container .dt-processing {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 3;
}

.dt-container .dt-processing > div:last-child > div {
    background: var(--accent);
}

th.num {
    text-align: right;
}

.idx {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    width: 48px;
}

.app-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    letter-spacing: -.02em;
}

.app-name {
    font-weight: 600;
    color: var(--text);
}

.app-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 1px;
    max-width: 340px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mono {
    font-family: var(--mono);
    font-size: 12.5px;
    white-space: nowrap;
}

code.cmd {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--surface-3);
    color: var(--text-2);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
}

.panel td:last-child,
.panel th:last-child {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -8px 0 12px -10px rgba(15, 23, 42, .25);
}

.panel th:last-child {
    background: var(--surface-2);
    z-index: 2;
}

.panel tbody tr.clickable:hover td:last-child {
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.panel tr.no-results td:last-child,
.panel tr.empty-row td:last-child {
    position: static;
    box-shadow: none;
}

.desc {
    color: var(--text-2);
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 20px;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.sev-critical {
    color: var(--critical);
    background: var(--critical-soft);
}

.sev-important {
    color: var(--important);
    background: var(--important-soft);
}

.sev-moderate {
    color: var(--moderate);
    background: var(--moderate-soft);
}

.sev-low,
.sev-unrated,
.sev-none {
    color: var(--low);
    background: var(--low-soft);
}

.arch {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-family: var(--mono);
}

.arch.x64 {
    border-color: transparent;
    background: var(--accent-soft);
    color: var(--accent);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    border-radius: 6px;
    padding: 1px 8px;
    margin: 2px 4px 2px 0;
    font-size: 12px;
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

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

.btn-ghost {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-3);
}

.btn-row {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    background: var(--surface);
    color: var(--accent);
    border-color: var(--border-strong);
}

tbody tr.clickable:hover .btn-row {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.empty {
    padding: 56px 20px;
    text-align: center;
    color: var(--text-2);
}

.empty .icon {
    width: 36px;
    height: 36px;
    color: var(--muted);
    margin-bottom: 8px;
}

.empty strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 2px;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    max-width: 440px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--critical);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    animation: slide .25s ease;
}

.toast .icon {
    color: var(--critical);
    margin-top: 1px;
}

.toast strong {
    display: block;
    font-size: 14px;
}

.toast span {
    color: var(--text-2);
    font-size: 13px;
    word-break: break-word;
}

.toast button {
    margin-left: auto;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}

@keyframes slide {
    from {
        opacity: 0;
        transform: translateX(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, .55);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s, visibility .18s;
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 1080px;
    max-width: 100%;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(10px) scale(.985);
    transition: transform .2s ease;
}

.modal-backdrop.open .modal {
    transform: none;
}

/* Static backdrop: brief "bounce" when clicking outside or pressing Escape */
.modal-backdrop.modal-static .modal {
    animation: modal-static .3s ease;
}

@keyframes modal-static {
    50% {
        transform: scale(1.02);
    }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px 16px;
}

.modal-header .avatar {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    font-size: 15px;
}

.modal-heading {
    flex: 1;
    min-width: 0;
}

.modal-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.modal-heading p {
    margin: 2px 0 0;
    color: var(--text-2);
    font-size: 13px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

.modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 22px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 550;
}

.pill b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.modal-body {
    overflow: auto;
    flex: 1;
    min-height: 200px;
}

.modal-body th:first-child,
.modal-body td:first-child {
    width: 44px;
    padding-right: 0;
}

.modal-body tbody tr:hover {
    background: var(--surface-2);
}

.modal-body tr.unchecked td:not(:first-child) {
    opacity: .5;
}

.folder {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    font-size: 12.5px;
    white-space: nowrap;
}

.folder .icon {
    color: #f59e0b;
}

.url {
    display: block;
    max-width: 300px;
    color: var(--muted);
    font-size: 12px;
    font-family: var(--mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.url:hover {
    color: var(--accent);
    text-decoration: underline;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    flex-wrap: wrap;
}

.status {
    color: var(--text-2);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}

.skeleton td div {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--border) 50%, var(--surface-3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress {
    height: 3px;
    background: var(--accent-soft);
    overflow: hidden;
    display: none;
}

.progress.active {
    display: block;
}

/* While a ZIP is being built the selection is locked */
.modal-backdrop.is-busy .modal-toolbar,
.modal-backdrop.is-busy .modal-body {
    pointer-events: none;
    opacity: .6;
}

.progress::after {
    content: "";
    display: block;
    width: 35%;
    height: 100%;
    background: var(--accent);
    animation: indeterminate 1.3s ease-in-out infinite;
}

@keyframes indeterminate {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(300%);
    }
}

@media (max-width: 1000px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {

    .appbar-inner,
    .page,
    .footer-inner {
        padding-left: 16px;
        padding-right: 16px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .search input {
        width: 100%;
    }

    .controls,
    .search {
        width: 100%;
    }

    .table-wrap {
        max-height: none;
    }
}
/* ---------------------------------------------------------------------------
   Header user menu
--------------------------------------------------------------------------- */
.appbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px 5px 5px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-info strong {
    font-size: 13px;
    font-weight: 600;
}

.user-info span {
    font-size: 11.5px;
    color: rgba(255, 255, 255, .65);
}

.logout-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, .14);
}

/* ---------------------------------------------------------------------------
   Login page
--------------------------------------------------------------------------- */
.auth-body {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, .14), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, .12), transparent 60%),
        var(--bg);
}

.auth-page {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 40px 16px;
}

.auth-card {
    width: 920px;
    max-width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-hero {
    padding: 44px 40px;
    color: #fff;
    background: linear-gradient(150deg, var(--header-from), var(--header-to));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-hero .brand-mark {
    margin-bottom: 20px;
}

.auth-hero h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.auth-hero p {
    margin: 8px 0 28px;
    color: rgba(255, 255, 255, .72);
    font-size: 14.5px;
}

.auth-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: rgba(255, 255, 255, .88);
}

.auth-features .icon {
    color: #93c5fd;
}

.auth-form {
    padding: 44px 40px;
}

.auth-form h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.auth-subtitle {
    margin: 4px 0 24px;
    color: var(--text-2);
}

.auth-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 13px;
    margin-bottom: 18px;
}

.auth-alert.error {
    background: var(--critical-soft);
    color: var(--critical);
}

.auth-alert.success {
    background: var(--success-soft);
    color: var(--success);
}

.field {
    display: block;
    margin-bottom: 16px;
}

.field > span:first-child {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.field input.invalid {
    border-color: var(--critical);
}

.password-wrap {
    position: relative;
    display: block;
}

.password-wrap input {
    padding-right: 64px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: var(--surface-3);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 22px;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
}

.btn-block {
    width: 100%;
    height: 44px;
    font-size: 15px;
}

@media (max-width: 760px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        padding: 32px 28px;
    }

    .auth-features {
        display: none;
    }

    .auth-form {
        padding: 32px 28px;
    }

    .user-info {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   Header navigation (admins)
--------------------------------------------------------------------------- */
.appbar-nav {
    display: flex;
    gap: 4px;
    margin-right: auto;
    margin-left: 12px;
}

.appbar-nav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    transition: background .15s, color .15s;
}

.appbar-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.appbar-nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .16);
}

a.tab,
a.btn {
    text-decoration: none;
}

/* ---------------------------------------------------------------------------
   History & users tables
--------------------------------------------------------------------------- */
.history-table {
    max-height: none;
    min-height: 0;
}

.history-table td:last-child,
.history-table th:last-child {
    position: static;
    box-shadow: none;
}

.nowrap {
    white-space: nowrap;
}

.status-success {
    color: var(--success);
    background: var(--success-soft);
}

.status-partial {
    color: var(--important);
    background: var(--important-soft);
}

.status-failed {
    color: var(--critical);
    background: var(--critical-soft);
}

.status-in_progress {
    color: var(--accent);
    background: var(--accent-soft);
}

.row-inactive td:not(.actions-col) {
    opacity: .55;
}

.actions-col {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: inline-flex;
    gap: 6px;
    justify-content: flex-end;
}

.row-actions form {
    margin: 0;
}

.btn-small {
    height: 30px;
    padding: 0 10px;
    font-size: 12.5px;
}

/* Square icon-only button; its text shows as a tooltip on hover / keyboard focus */
.btn-icon-only {
    position: relative;
    width: 30px;
    padding: 0;
}

.btn-icon-only[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translate(4px, -50%);
    z-index: 5;
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--text);
    color: var(--surface);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s, transform .12s, visibility .12s;
}

.btn-icon-only[data-tooltip]:hover::after,
.btn-icon-only[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
}

.btn-danger {
    color: var(--critical);
}

.btn-danger:hover {
    color: #fff;
    background: var(--critical);
    border-color: var(--critical);
}

.btn-warning {
    color: var(--important);
}

.btn-warning:hover {
    color: #fff;
    background: var(--important);
    border-color: var(--important);
}

.btn-success {
    color: var(--success);
}

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

/* ---------------------------------------------------------------------------
   Pagination
--------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.pagination-summary,
.pagination-page {
    color: var(--text-2);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn.disabled {
    opacity: .45;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   User form, notices, success toast
--------------------------------------------------------------------------- */
.form-panel {
    max-width: 640px;
}

.form-body {
    padding: 20px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.back-link {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--text-2);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.back-link:hover {
    color: var(--accent);
}

.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.notice.success {
    border-left: 4px solid var(--success);
}

.notice.success > .icon {
    color: var(--success);
    margin-top: 2px;
}

.notice strong {
    display: block;
    margin-bottom: 2px;
}

.notice span {
    display: block;
    color: var(--text-2);
    font-size: 13px;
}

.copy-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.copy-row code {
    font-size: 14px;
    color: var(--text);
}

/* Table value with a copy icon placed right after the text */
.copy-field {
    display: flex;
    align-items: center;
    justify-content: normal;
    gap: 10px;
}

.copy-icon-btn {
    flex: none;
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.copy-icon-btn:hover {
    color: var(--accent);
    background: var(--surface-3);
    border-color: var(--border);
}

.copy-icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.copy-icon-btn .when-copied,
.copy-icon-btn.is-copied .when-idle {
    display: none;
}

.copy-icon-btn.is-copied .when-copied {
    display: block;
}

.copy-icon-btn.is-copied {
    color: var(--success);
    background: var(--success-soft);
}

.toast-success {
    border-left-color: var(--success);
}

.toast-success .icon {
    color: var(--success);
}

@media (max-width: 760px) {
    .appbar-nav {
        order: 3;
        width: 100%;
        margin: 0;
    }
}