/*
 * PTC PaySync portal stylesheet.
 *
 * Colours come from theme.css (Eco and Pearl modes); this file only uses the
 * tokens. Sections:
 *   1. Base and typography      6. Status badges and notices
 *   2. Buttons                  7. Application shell (sidebar, topbar, header)
 *   3. Forms                    8. Dashboard
 *   4. Cards and sections       9. Feature pages (loading, imports, audit, OTP, account)
 *   5. Tables and paging       10. Sign-in pages, responsive rules, print
 */

/* 1. Base and typography ------------------------------------------------- */

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

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

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font: 14px/1.55 var(--font-sans);
}

[hidden] {
    display: none !important;
}

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

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h2 {
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 1.35;
    font-weight: 650;
    letter-spacing: -0.2px;
}

h3 {
    margin: 12px 0;
    font-size: 15px;
    font-weight: 650;
}

p {
    overflow-wrap: anywhere;
}

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

.muted {
    font-size: 13px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--brand-ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.error {
    color: var(--danger-text);
}

.numeric {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.skip-link {
    position: absolute;
    top: 8px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-raised);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* 2. Buttons ------------------------------------------------------------- */

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--button-bg);
    color: var(--button-text);
    font: 600 13px/1.4 var(--font-sans);
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--button-bg-hover);
    text-decoration: none;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.secondary,
button.secondary,
.button.secondary {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

.secondary:hover,
button.secondary:hover,
.button.secondary:hover {
    border-color: var(--brand-soft-border);
    background: var(--surface-hover);
    color: var(--brand-ink);
}

.danger,
button.danger,
.button.danger {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.danger:hover,
button.danger:hover {
    background: var(--danger-hover-bg);
    color: var(--danger-text);
}

.small,
button.small {
    padding: 6px 11px;
    font-size: 12px;
}

.inline {
    display: inline-block;
    margin: 3px 4px 3px 0;
}

.inline button {
    white-space: nowrap;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
}

.toolbar > p {
    margin: 0;
}

/* 3. Forms --------------------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    margin: 18px 0 0;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--neutral-700);
    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: 14px/1.4 var(--font-sans);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-active);
    outline: 3px solid var(--brand-soft);
    outline-offset: 0;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--brand-soft-border);
}

textarea {
    resize: vertical;
}

/* Password field with a show/hide control at the end of the input. The
   button is a sibling of the label (not inside it), so the field keeps the
   plain label text as its name. login.js reveals the button. */
.password-field {
    position: relative;
    min-width: 0;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 1px;
    bottom: 1px;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: calc(14px * 1.4 + 20px);
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
}

.password-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.password-toggle span {
    display: inline-grid;
}

.password-toggle .password-toggle-hide,
.password-toggle[aria-pressed="true"] .password-toggle-show {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-hide {
    display: inline-grid;
}

.password-toggle[aria-pressed="true"] {
    color: var(--brand-ink);
}

select[multiple] {
    min-height: 145px;
}

input[type="file"] {
    padding: 8px;
    font-size: 13px;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font: 600 12px var(--font-sans);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-strong);
}

.span-all,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}

label.checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
}

label.checkbox input {
    flex: none;
    margin-top: 1px;
}

.compact-form {
    display: grid;
    gap: 8px;
    min-width: 170px;
}

.compact-form input,
.compact-form select {
    padding: 7px 9px;
}

.compact-form .form-actions {
    padding: 0;
}

.filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.filter-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter > input {
    max-width: 320px;
}

.filter label {
    min-width: 180px;
}

.check-label,
.preference-ack {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.preference-ack {
    grid-column: 1 / -1;
    max-width: 580px;
    margin: 10px 0;
}

.check-label input,
.preference-ack input,
input[data-loading-select] {
    flex: 0 0 auto;
    margin: 2px 0;
}

/* 4. Cards and sections -------------------------------------------------- */

.card {
    margin-bottom: 20px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-accent);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.section-title {
    margin-bottom: 16px;
}

.section-title p {
    max-width: 860px;
    margin: 0;
    font-size: 13px;
}

.section-title h2:last-child {
    margin-bottom: 0;
}

.subcard {
    padding: 18px 0;
    border-top: 1px solid var(--border);
}

.subcard:first-of-type {
    border-top: 0;
}

.steps {
    padding-left: 22px;
    font-size: 13px;
}

.steps li {
    margin: 10px 0;
    padding-left: 3px;
}

.steps li::marker {
    color: var(--brand-ink);
    font-weight: 700;
}

details {
    padding: 12px 0;
}

summary {
    color: var(--brand-ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin: 0 0 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stats article {
    padding: 18px 20px;
    border-right: 1px solid var(--border);
}

.stats article:last-child {
    border-right: 0;
}

.stats span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.stats strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 22px;
}

.quick-links a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
}

.empty {
    padding: 32px;
    color: var(--text-muted);
    text-align: center;
}

/* People */

.person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.person > div {
    min-width: 0;
}

.person-avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

/* The initials (or a generic icon) are always there; a photo is laid over
   them. If the photo fails to load the initials remain (see app.js). */
.person-avatar {
    position: relative;
}

.person-avatar .avatar-fallback {
    display: inline-grid;
    place-items: center;
    line-height: 1;
}

.person-avatar .avatar-fallback .ui-icon {
    width: 55%;
    height: 55%;
}

.person-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

.profile-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin: 12px 0 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.profile-heading .person-avatar {
    width: 68px;
    height: 68px;
    font-size: 22px;
}

.profile-heading h3 {
    margin: 0 0 4px;
}

.profile-heading p {
    margin: 0 0 7px;
    font-size: 13px;
}

.profile-photo {
    width: 110px;
    height: 110px;
    border: 1px solid var(--border);
    border-radius: 12px;
    object-fit: cover;
}

/* 5. Tables and paging --------------------------------------------------- */

.table-wrap {
    margin: 14px 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
}

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

td small {
    display: block;
    max-width: 300px;
    margin-top: 3px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

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

tbody tr:hover td {
    background: var(--surface-hover);
}

.total td {
    background: var(--brand-soft);
    font-weight: 700;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    margin-top: 14px;
    font-size: 13px;
}

/* 6. Status badges and notices ------------------------------------------ */

.badge {
    display: inline-block;
    vertical-align: middle;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--neutral-bg);
    color: var(--neutral-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.badge.approved,
.badge.finalized,
.badge.eligible,
.badge.ready {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.badge.pending,
.badge.submitted {
    border-color: var(--warning-border);
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge.draft {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.badge.rejected,
.badge.disapproved {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge.protected {
    border-color: var(--brand-soft-border);
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.badge.archived {
    border-color: var(--border-strong);
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.badge.protected + small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
}

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

.department-badge.dept-iict {
    background: var(--dept-iict-bg);
    color: var(--dept-iict-text);
}

.department-badge.dept-iboa {
    background: var(--dept-iboa-bg);
    color: var(--dept-iboa-text);
}

.department-badge.dept-executive {
    background: var(--dept-executive-bg);
    color: var(--dept-executive-text);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.notice .ui-icon {
    margin-top: 1px;
}

.notice > span {
    min-width: 0;
}

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

.context-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0;
    padding: 12px 14px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 13px;
}

.context-note .ui-icon {
    margin-top: 2px;
}

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

/* 7. Application shell -------------------------------------------------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 22px 16px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
}

/* Brand row: logo and name, plus the drawer close button on narrow screens. */
.sidebar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--sidebar-divider);
}

.sidebar-head .brand {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 6px;
    border-bottom: 0;
}

.sidebar-icon-button {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--sidebar-button-border);
    border-radius: 8px;
    background: var(--sidebar-button-bg);
    color: var(--sidebar-button-text);
}

.sidebar-icon-button:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-button-text);
}

.sidebar-icon-button:focus-visible {
    outline: 2px solid var(--sidebar-text);
    outline-offset: 2px;
}

/* Collapse control in the sidebar's top-right corner, clear of the brand text. */
/* Align the collapse control with the sidebar branding. */
.sidebar-collapse {
    position: absolute;
    top: 20px;
    right: 16px;
    width: 28px;
    height: 28px;
}

/* The close button belongs to the narrow-screen drawer only. */
.sidebar-close {
    display: none;
}

.sidebar-logout button {
    gap: 8px;
}

/* Rail tooltip, created by app.js and positioned next to the item. */
.nav-tooltip {
    position: fixed;
    z-index: 60;
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--text);
    color: var(--surface);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-raised);
    transform: translateY(-50%);
}

.nav-tooltip[hidden] {
    display: none;
}

/* Collapsed icon rail (desktop only; the class has no effect on narrow screens). */
@media (min-width: 1025px) {
    html.sidebar-collapsed {
        --sidebar-width: 76px;
    }

    html.sidebar-collapsed .sidebar {
        padding-right: 12px;
        padding-left: 12px;
    }

    html.sidebar-collapsed .sidebar-head {
        flex-direction: column;
        gap: 12px;
    }

    html.sidebar-collapsed .sidebar-head .brand {
        flex: 0 0 auto;
        padding: 0;
    }

    html.sidebar-collapsed .sidebar-collapse {
        position: static;
        width: 34px;
        height: 34px;
    }

    html.sidebar-collapsed .sidebar-collapse .ui-icon {
        transform: scaleX(-1);
    }

    /* Hidden visually but still read by screen readers, so every link keeps its name. */
    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .sidebar nav a span,
    html.sidebar-collapsed .sidebar-account > div,
    html.sidebar-collapsed .sidebar-scope,
    html.sidebar-collapsed .sidebar-logout span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        opacity: 0;
    }

    html.sidebar-collapsed .nav-group-label {
        height: 1px;
        margin: 10px 6px;
        overflow: hidden;
        background: var(--sidebar-divider);
        color: transparent;
        font-size: 0;
    }

    html.sidebar-collapsed .sidebar nav a {
        justify-content: center;
        gap: 0;
        padding-right: 0;
        padding-left: 0;
    }

    html.sidebar-collapsed .sidebar-account {
        justify-content: center;
    }

    /* The hidden name and scope take no space here, so the gap between the
       avatar and the sign-out button is set on the button's form. */
    html.sidebar-collapsed .sidebar-bottom .inline {
        margin-top: 14px;
    }

    html.sidebar-collapsed .sidebar-bottom {
        padding-right: 0;
        padding-left: 0;
    }

    html.sidebar-collapsed .sidebar-bottom button {
        padding-right: 0;
        padding-left: 0;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 6px 20px;
    border-bottom: 1px solid var(--sidebar-divider);
    color: inherit;
}

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

.brand-text {
    min-width: 0;
}

.brand-name {
    display: block;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.brand-tagline {
    display: block;
    margin-top: 3px;
    color: var(--sidebar-muted);
    font-size: 12px;
}

.brand-mark {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--brand-mark-bg);
    color: var(--brand-mark-text);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.sidebar nav {
    display: grid;
    gap: 3px;
    margin-top: 10px;
}

.nav-group-label {
    margin: 16px 12px 6px;
    color: var(--sidebar-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.sidebar nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
}

.sidebar nav a:hover {
    background: var(--sidebar-hover-bg);
    text-decoration: none;
}

.sidebar nav a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar nav a.active::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--sidebar-active-indicator);
}

.sidebar nav a:focus-visible {
    outline-color: var(--sidebar-text);
}

.sidebar-bottom {
    margin-top: auto;
    padding: 18px 4px 0;
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--sidebar-divider);
}

.sidebar-account > div {
    min-width: 0;
}

.sidebar-account strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sidebar-account small,
.sidebar-scope {
    display: block;
    color: var(--sidebar-muted);
    font-size: 12px;
}

.sidebar-account .person-avatar {
    width: 40px;
    height: 40px;
    background: var(--sidebar-avatar-bg);
    color: var(--sidebar-avatar-text);
}

.sidebar-scope {
    margin: 12px 0 0;
}

/* The sign-out control keeps a clear gap from the account block above it,
   in the expanded sidebar, the icon rail and the narrow-screen drawer. */
.sidebar-bottom .inline {
    display: block;
    margin: 16px 0 0;
}

.sidebar-bottom button {
    width: 100%;
    border-color: var(--sidebar-button-border);
    background: var(--sidebar-button-bg);
    color: var(--sidebar-button-text);
}

.sidebar-bottom button:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-button-text);
}

.sidebar-backdrop {
    display: none;
}

.workspace {
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--topbar-height);
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--topbar-bg);
    box-shadow: inset 0 -2px 0 var(--topbar-accent);
}

.topbar-start,
.topbar-end {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.nav-toggle {
    display: none;
    padding: 8px;
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

.nav-toggle:hover {
    background: var(--surface-hover);
    color: var(--brand-ink);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: 13px;
}

.breadcrumb li + li::before {
    content: "/";
    margin: 0 8px;
    color: var(--neutral-500);
}

.breadcrumb [aria-current="page"] {
    color: var(--text);
    font-weight: 700;
}

.scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.scope-chip .ui-icon {
    width: 15px;
    height: 15px;
    color: var(--brand-ink);
}

.topbar-clock {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    white-space: nowrap;
}

.topbar-clock > .ui-icon {
    width: 17px;
    height: 17px;
    color: var(--brand-ink);
}

.topbar-clock-copy {
    display: grid;
    gap: 2px;
    line-height: 1.2;
}

.topbar-clock-copy strong {
    color: var(--text);
    font-size: 12px;
}

.topbar-clock-copy small {
    color: var(--text-muted);
    font-size: 10px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
    color: var(--text);
}

.topbar-user:hover {
    text-decoration: none;
}

.topbar-user strong {
    display: block;
    font-size: 14px;
    line-height: 1.25;
}

.topbar-user small {
    display: block;
    font-size: 12px;
}

main {
    min-width: 0;
    max-width: 1560px;
    margin: auto;
    padding: 28px 32px 40px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 22px;
}

.page-header > div:first-child {
    flex: 1 1 420px;
    min-width: 0;
}

.page-header p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 15px;
}

.page-header-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}

.date-chip .ui-icon {
    width: 16px;
    height: 16px;
}

.page-dashboard .page-header,
.page-account .page-header,
.page-profile .page-header,
.page-archives .page-header,
.page-backups .page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: start;
    column-gap: 24px;
}

.page-dashboard .page-header-tools,
.page-account .page-header-tools,
.page-profile .page-header-tools,
.page-archives .page-header-tools,
.page-backups .page-header-tools {
    flex-wrap: nowrap;
    justify-self: end;
    align-self: start;
}

/* 8. Dashboard ----------------------------------------------------------- */

.semester-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.semester-picker label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.semester-picker select {
    width: auto;
    max-width: 300px;
    padding: 8px 10px;
    font-size: 13px;
}

.dashboard-notices .notice,
.dashboard-notices .context-note {
    margin: 0 0 14px;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-metric {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: start;
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-accent);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    color: var(--text);
}

.dashboard-metric:hover {
    border-color: var(--brand-soft-border);
    text-decoration: none;
}

.dashboard-metric-label {
    grid-column: 1;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.dashboard-metric-icon {
    display: inline-grid;
    grid-row: 1 / 3;
    grid-column: 2;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.dashboard-metric strong {
    grid-column: 1;
    margin-top: 8px;
    font-size: 30px;
    font-weight: 750;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.dashboard-metric small {
    grid-column: 1 / -1;
    font-size: 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
}

.dashboard-main,
.dashboard-rail {
    min-width: 0;
}

.panel {
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
}

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

.panel-heading h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
}

.panel-heading h2 .ui-icon {
    color: var(--brand-ink);
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.panel-body {
    padding: 16px 20px 20px;
}

.panel-body > p:first-child {
    margin-top: 0;
}

.panel-note {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.feed {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.feed-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.feed-item > div {
    flex: 1;
    min-width: 0;
}

.feed-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.feed-item small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.feed-item .badge {
    flex: 0 0 auto;
}

a.feed-item {
    color: var(--text);
}

a.feed-item:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.status-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--neutral-500);
}

.status-dot.approved,
.status-dot.finalized {
    background: var(--brand-active);
}

.status-dot.pending,
.status-dot.submitted,
.status-dot.warning {
    background: var(--attention);
}

.status-dot.rejected,
.status-dot.disapproved,
.status-dot.danger {
    background: var(--danger-text);
}

.status-dot.draft {
    background: var(--neutral-500);
}

.feed-time {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.dashboard-callout,
.dashboard-highlight {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 14px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--text);
    font-size: 13px;
}

.dashboard-highlight-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--brand-ink);
    font-weight: 800;
}

.dashboard-callout strong,
.dashboard-highlight strong {
    display: block;
    font-size: 13px;
}

.dashboard-callout p,
.dashboard-highlight p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.dashboard-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--warning-border);
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning-text);
}

.dashboard-alert:first-child {
    margin-top: 0;
}

.dashboard-alert:hover {
    color: var(--warning-text);
    text-decoration: none;
    filter: brightness(0.98);
}

.dashboard-alert > span {
    flex: 1;
    min-width: 0;
}

.dashboard-alert > span strong {
    display: block;
    font-size: 13px;
}

.dashboard-alert small {
    display: block;
    margin-top: 2px;
    color: inherit;
    font-size: 12px;
}

.dashboard-alert-count {
    flex: 0 0 auto;
    min-width: 34px;
    padding: 2px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dashboard-alert-danger {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.dashboard-alert-danger:hover {
    color: var(--danger-text);
}

.dashboard-alert-details {
    margin: 4px 0 4px;
    padding: 4px 14px;
    font-size: 12px;
}

.dashboard-alert-details ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.dashboard-alert-details li {
    padding: 4px 0;
    overflow-wrap: anywhere;
}

.dashboard-alert-details li small {
    display: block;
    white-space: pre-wrap;
}

.dashboard-empty {
    padding: 22px 12px;
    color: var(--text-muted);
    text-align: center;
}

.dashboard-empty > .ui-icon {
    display: block;
    width: 30px;
    height: 30px;
    margin: 0 auto 10px;
    color: var(--neutral-500);
}

.dashboard-empty strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.dashboard-empty p {
    max-width: 360px;
    margin: 6px auto 0;
    font-size: 12px;
}

.dashboard-class-time {
    flex: 0 0 82px;
    padding-left: 10px;
    border-left: 3px solid var(--brand-active);
}

.dashboard-class-time strong {
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
}

.dashboard-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
}

.dashboard-task:first-child {
    border-top: 0;
    padding-top: 0;
}

.dashboard-task:hover {
    color: var(--brand-ink);
    text-decoration: none;
}

.dashboard-task > .ui-icon {
    color: var(--brand-ink);
}

.dashboard-task > span:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.dashboard-task strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.dashboard-task small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}

.dashboard-task-count {
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dashboard-intentions {
    display: grid;
    margin: 0 0 14px;
}

.dashboard-intentions > div,
.dashboard-breakdown > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.dashboard-intentions > div:first-child {
    border-top: 0;
}

.dashboard-intentions dt {
    color: var(--text-muted);
    font-size: 13px;
}

.dashboard-intentions dd {
    margin: 0;
    color: var(--brand-ink);
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.dashboard-draft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 8px;
    background: var(--brand-soft);
}

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

.dashboard-draft small {
    display: block;
    font-size: 12px;
}

.dashboard-net {
    margin: 14px 0;
    padding: 18px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 9px;
    background: var(--brand-soft);
}

.dashboard-net small {
    display: block;
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 600;
}

.dashboard-net strong {
    display: block;
    margin-top: 3px;
    color: var(--brand-ink);
    font-size: 28px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.dashboard-breakdown {
    margin: 8px 0 16px;
    font-size: 13px;
}

.dashboard-breakdown dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.dashboard-workload-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 13px;
}

.dashboard-workload-summary strong {
    margin-right: 4px;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.dashboard-overload-row td {
    background: var(--danger-bg);
}

.dashboard-tracking {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.dashboard-tracking:first-child {
    border-top: 0;
    padding-top: 0;
}

.dashboard-tracking-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-tracking-head strong {
    display: block;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.dashboard-tracking-head small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}

.dashboard-tracking-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0;
}

.dashboard-tracking-meta dt {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.dashboard-tracking-meta dd {
    margin: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.dashboard-tracking-meta dd small {
    display: block;
    margin-top: 2px;
}

.dashboard-review-note {
    padding: 10px 12px;
    border-left: 3px solid var(--brand-active);
    border-radius: 0 6px 6px 0;
    background: var(--surface-muted);
    font-size: 13px;
    white-space: pre-wrap;
}

.dashboard-history {
    margin: 10px 0;
    padding: 2px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.dashboard-history ol {
    margin: 8px 0 12px;
    padding: 0 0 0 10px;
    border-left: 2px solid var(--brand-soft-border);
    list-style: none;
}

.dashboard-history li {
    padding: 6px 8px 10px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.dashboard-history li strong {
    color: var(--brand-ink);
}

.dashboard-history li small {
    display: block;
    margin-top: 2px;
}

.dashboard-history li p {
    margin: 4px 0 0;
    white-space: pre-wrap;
}

/* 9. Feature pages ------------------------------------------------------ */

.loading-department-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.loading-outside-preference td,
.loading-outside-preference:hover td {
    background: var(--preference-bg);
    color: var(--preference-text);
}

.loading-bulk-form {
    margin: 16px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.loading-bulk-form .toolbar {
    gap: 12px;
    margin: 0;
}

.loading-bulk-form p {
    margin: 10px 0;
    font-size: 12px;
}

.loading-bulk-form [data-loading-selection-count] {
    margin-left: auto;
    color: var(--brand-ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.loading-bulk-list {
    margin-bottom: 18px;
}

.loading-warning-details {
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.6;
}

.loading-workflow {
    width: 320px;
    max-width: 100%;
}

.loading-workflow-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.loading-workflow-form .preference-ack {
    max-width: 100%;
    margin: 0 0 8px;
    font-size: 12px;
}

.loading-workflow > small:empty {
    display: none;
}

.loading-workflow > small:not(:empty) {
    margin-top: 10px;
}

.loading-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.loading-actions > button,
.loading-actions > .button,
.loading-actions > .inline {
    flex: 0 0 auto;
    margin: 0;
}

.loading-actions button,
.loading-actions .button {
    min-height: 36px;
    white-space: nowrap;
}

.loading-review-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: 85vh;
    padding: 26px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-raised);
}

.loading-review-dialog::backdrop {
    background: var(--overlay);
}

.loading-review-dialog h2 {
    margin: 0 0 16px;
    color: var(--brand-ink);
    font-size: 20px;
}

.loading-review-dialog h3 {
    margin-top: 16px;
    font-size: 14px;
}

.loading-review-dialog ul {
    padding: 12px 12px 12px 30px;
    border-radius: 8px;
    background: var(--surface-muted);
}

.loading-review-dialog li {
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.loading-review-dialog p {
    font-size: 13px;
}

.loading-review-dialog .toolbar {
    justify-content: flex-end;
    margin-bottom: 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.import-types {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.import-type {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
}

.import-type .ui-icon {
    width: 22px;
    height: 22px;
    color: var(--brand-ink);
}

.import-type small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}

.import-type:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.import-type.active {
    border-color: var(--brand-active);
    background: var(--brand-soft);
    box-shadow: inset 0 -3px 0 var(--brand-active);
}

.import-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.import-progress strong {
    color: var(--brand-ink);
}

.page-imports .card > .form-grid {
    align-items: end;
    padding: 18px;
    border: 1px dashed var(--neutral-400);
    border-radius: 8px;
    background: var(--surface-muted);
}

.page-imports .form-grid label:first-of-type {
    grid-column: 1 / -1;
}

.import-row-error td,
.import-row-error:hover td {
    background: var(--danger-bg);
}

.import-row-error td:last-child {
    min-width: 220px;
}

.audit-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-muted);
}

.audit-filter-actions {
    grid-column: 1 / -1;
}

.audit-filter-hint {
    grid-column: 1 / -1;
    margin: -4px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.profile-photo-form {
    display: block;
    margin: 18px 0 0;
}

.profile-photo-form label {
    max-width: 440px;
}

.profile-photo-form .muted {
    margin: 12px 0 0;
}

.profile-photo-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 14px 0 22px;
}

.profile-photo-remove-form {
    display: inline-flex;
    margin: 0;
}

.audit-result-count {
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.audit-history-table .audit-when {
    white-space: nowrap;
}

.audit-history-table .audit-action {
    min-width: 220px;
    max-width: 350px;
    overflow-wrap: anywhere;
}

.audit-history-table .audit-details {
    min-width: 180px;
    max-width: 330px;
    overflow-wrap: anywhere;
}

.audit-details ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.audit-details li {
    white-space: pre-wrap;
}

.audit-details li + li {
    margin-top: 5px;
}

.payslip-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    margin: 24px 0;
}

.payslip-info p {
    margin: 5px 0;
    font-size: 13px;
}

.page-payslip .total td {
    padding: 16px 14px;
    font-size: 16px;
}

.otp-status {
    margin: 18px 0;
    padding: 12px 14px;
    border: 1px solid var(--brand-soft-border);
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.otp-status p {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
}

.otp-status small {
    display: block;
    color: var(--brand-ink);
    font-size: 12px;
}

.otp-code-input {
    font-size: 26px;
    letter-spacing: 8px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.otp-resend-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.otp-resend-form small {
    flex: 1;
    min-width: 180px;
    font-size: 12px;
}

.otp-resend-form button {
    white-space: nowrap;
}

/* My account: details list, vertical card layout and appearance chooser */

.page-account .account-page-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.page-account .account-page-stack > .card {
    margin-bottom: 0;
}

/* Three theme choices share the available horizontal space. */
.page-account .theme-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-account .theme-options legend {
    grid-column: 1 / -1;
}

.account-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
    margin: 0;
}

.account-details > div {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.account-details dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.account-details dd {
    margin: 3px 0 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin: 6px 0 18px;
    padding: 0;
    border: 0;
}

.theme-options legend {
    margin-bottom: 10px;
    padding: 0;
    color: var(--neutral-700);
    font-size: 13px;
    font-weight: 600;
}

.theme-option {
    position: relative;
    display: block;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

.theme-option:has(input:checked) {
    border-color: var(--brand-active);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.theme-option:has(input:focus-visible) {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.theme-option input {
    position: absolute;
    top: 14px;
    right: 14px;
}

.theme-option-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.theme-option-text {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.theme-preview {
    display: grid;
    grid-template-columns: 30% 1fr;
    height: 86px;
    overflow: hidden;
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
    background: #f4f6f4;
}

.theme-preview-sidebar {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 10px 8px;
}

.theme-preview-sidebar i {
    display: block;
    height: 6px;
    border-radius: 3px;
}

.theme-preview-main {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    align-content: start;
    padding: 10px;
}

.theme-preview-main i {
    display: block;
    height: 26px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #ffffff;
}

.theme-preview-eco .theme-preview-sidebar {
    background: #099226;
}

.theme-preview-eco .theme-preview-sidebar i {
    background: rgb(255 255 255 / 70%);
}

.theme-preview-eco .theme-preview-sidebar i:nth-child(2) {
    background: #0eab2f;
}

.theme-preview-pearl .theme-preview-sidebar {
    border-right: 1px solid #e5e7eb;
    background: #ffffff;
}

.theme-preview-pearl .theme-preview-sidebar i {
    background: #d9d9d9;
}

.theme-preview-pearl .theme-preview-sidebar i:nth-child(2) {
    background: #0eab2f;
}

.theme-preview-pearl .theme-preview-main i {
    border-top: 2px solid #0eab2f;
}

/* Dark preview: literal colours keep it accurate regardless of the active theme. */
.theme-preview-dark {
    border-color: #34483a;
    background: #0e1310;
}

.theme-preview-dark .theme-preview-sidebar {
    border-right: 1px solid #222b25;
    background: #111713;
}

.theme-preview-dark .theme-preview-sidebar i {
    background: #a7b1aa;
}

/* Active navigation: dark green background with a brighter indicator. */
.theme-preview-dark .theme-preview-sidebar i:nth-child(2) {
    border-left: 2px solid #3ddc63;
    background: #8ff0a6;
    box-shadow: 0 0 0 3px #173a22;
}

/* Topbar surface and its green accent line. */
.theme-preview-dark .theme-preview-main {
    box-shadow:
        inset 0 7px 0 #121814,
        inset 0 9px 0 #0eab2f;
}

/* Dark cards with their green top accent. */
.theme-preview-dark .theme-preview-main i {
    border-color: #34483a;
    border-top: 2px solid #0eab2f;
    background-color: #151b17;
    background-repeat: no-repeat;
    background-position: 8px 9px;
    background-size: 38% 4px;
}

/* Representative status colors inside the workspace. */
.theme-preview-dark .theme-preview-main i:nth-child(1) {
    background-image: linear-gradient(#6fdc8a, #6fdc8a);
}

.theme-preview-dark .theme-preview-main i:nth-child(2) {
    background-image: linear-gradient(#8fb4ff, #8fb4ff);
}

.theme-preview-dark .theme-preview-main i:nth-child(3) {
    background-image: linear-gradient(#f2c26b, #f2c26b);
}

.theme-preview-dark .theme-preview-main i:nth-child(4) {
    background-image: linear-gradient(#ff9a8f, #ff9a8f);
}

/* 10. Sign-in pages ------------------------------------------------------ */

.auth-page {
    min-height: 100vh;
    background: var(--page-bg);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
    min-height: 100vh;
}

.auth-story {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 56px 60px 40px;
    overflow: hidden;
    background: var(--auth-panel-bg);
    color: var(--auth-panel-text);
}

.auth-story::before,
.auth-story::after {
    content: "";
    position: absolute;
    border: 34px solid var(--auth-panel-decoration);
    border-radius: 50%;
    pointer-events: none;
}

.auth-story::before {
    top: -120px;
    right: -150px;
    width: 420px;
    height: 420px;
}

.auth-story::after {
    bottom: -140px;
    left: -110px;
    width: 300px;
    height: 300px;
}

.auth-brand {
    position: relative;
    z-index: 1;
    padding: 0;
    border: 0;
}

.auth-brand .brand-tagline {
    color: var(--auth-panel-muted);
}

[data-theme="eco"] .auth-brand .brand-mark,
:root:not([data-theme]) .auth-brand .brand-mark {
    background: #ffffff;
    color: var(--brand);
}

.auth-story-copy {
    position: relative;
    z-index: 1;
    margin: auto 0;
    padding: 48px 0;
}

.auth-story .eyebrow {
    color: inherit;
}

[data-theme="pearl"] .auth-story .eyebrow,
[data-theme="dark"] .auth-story .eyebrow {
    color: var(--brand-ink);
}

.auth-story h1 {
    max-width: 480px;
    font-size: 46px;
    line-height: 1.08;
    letter-spacing: -1.5px;
}

.auth-story-copy > p:not(.eyebrow) {
    max-width: 440px;
    margin: 20px 0 0;
    color: var(--auth-panel-muted);
    font-size: 17px;
    line-height: 1.6;
}

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

.auth-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.auth-footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    color: var(--auth-panel-muted);
    font-size: 13px;
}

.auth-main {
    display: grid;
    place-items: center;
    padding: 48px 24px;
}

.auth-content {
    width: min(500px, 100%);
}

.auth-card {
    padding: 40px 44px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-raised);
}

.auth-card h2 {
    margin-bottom: 6px;
    font-size: 28px;
    letter-spacing: -0.6px;
}

.auth-card .lead {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
}

.auth-card .form-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 26px;
}

.auth-card .form-actions button {
    width: 100%;
    padding: 13px 18px;
    font-size: 15px;
}

.input-with-icon {
    position: relative;
    display: block;
}

.input-with-icon .ui-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.input-with-icon input {
    padding: 13px 14px 13px 44px;
}

.auth-help {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-secure {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

.auth-secure .ui-icon {
    width: 15px;
    height: 15px;
}

.auth-content > .notice {
    margin-bottom: 18px;
}

.auth-links {
    margin: 16px 0 0;
    font-size: 13px;
}

/* Responsive rules ------------------------------------------------------- */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 272px;
    }

    .sidebar {
        transform: translateX(-100%);
        visibility: hidden;
        box-shadow: var(--shadow-raised);
    }

    .nav-open .sidebar {
        transform: none;
        visibility: visible;
    }

    .nav-open .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 25;
        display: block;
        background: var(--overlay-nav);
    }

    /* The page behind an open drawer does not scroll. */
    body.nav-open {
        overflow: hidden;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-close {
        display: inline-grid;
    }

    .workspace {
        margin-left: 0;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 10px 20px;
    }

    main {
        padding: 22px 20px 32px;
    }

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

    .auth-shell {
        grid-template-columns: 1fr;
    }

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

    .auth-story-copy {
        padding: 28px 0 8px;
    }

    .auth-story h1 {
        font-size: 34px;
    }

    .auth-features,
    .auth-footer {
        display: none;
    }
}

@media (max-width: 760px) {
    .topbar .scope-chip,
    .topbar-clock-copy small,
    .topbar-user > div {
        display: none;
    }

    .page-dashboard .page-header,
    .page-account .page-header,
    .page-profile .page-header,
    .page-archives .page-header,
    .page-backups .page-header {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-dashboard .page-header-tools,
    .page-account .page-header-tools,
    .page-profile .page-header-tools,
    .page-archives .page-header-tools,
    .page-backups .page-header-tools {
        justify-self: start;
        flex-wrap: wrap;
    }

    h1 {
        font-size: 24px;
    }

    .card {
        padding: 18px 16px;
    }

    .panel {
        padding: 0;
    }

    .panel-heading,
    .panel-body {
        padding-right: 16px;
        padding-left: 16px;
    }

    .form-grid,
    .account-details {
        grid-template-columns: 1fr;
    }

    .theme-options {
        grid-template-columns: 1fr;
    }

    .page-account .theme-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter > input {
        max-width: none;
    }

    .filter label {
        flex: 1 1 150px;
        min-width: 0;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats article:nth-child(2n) {
        border-right: 0;
    }

    .stats article {
        border-bottom: 1px solid var(--border);
    }

    .import-types,
    .audit-filters {
        grid-template-columns: 1fr;
    }

    .dashboard-tracking-meta {
        grid-template-columns: 1fr;
    }

    .payslip-info {
        flex-direction: column;
        gap: 12px;
    }

    .semester-picker,
    .semester-picker label,
    .semester-picker select {
        width: 100%;
        max-width: none;
    }

    td,
    th {
        padding: 10px 11px;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .auth-story h1 {
        font-size: 28px;
    }
}

@media (max-width: 520px) {
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    main {
        padding: 18px 14px 28px;
    }

    .topbar {
        gap: 10px;
        padding: 10px 14px;
    }

    /* Three theme buttons fit beside the breadcrumb and avatar on 360-390 px phones. */
    .topbar-start,
    .topbar-end {
        gap: 8px;
    }

    .topbar-user {
        padding-left: 8px;
    }

    .page-account .theme-options {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 420px) {
    /* The page title is repeated in the heading below; keep only the current crumb. */
    .breadcrumb li:not(:last-child) {
        display: none;
    }

    .breadcrumb li + li::before {
        content: none;
    }
}

@media (pointer: coarse) {
    button,
    .button,
    .sidebar nav a {
        min-height: 44px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .password-toggle {
        width: 46px;
        height: calc(16px * 1.4 + 20px);
        min-height: 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    button,
    .button,
    .sidebar nav a,
    .dashboard-metric,
    .import-type {
        transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    .sidebar {
        transition:
            transform 0.2s ease,
            visibility 0.2s ease,
            width 0.2s ease,
            padding 0.2s ease;
    }

    .workspace {
        transition: margin-left 0.2s ease;
    }

    /* Labels fade back in once the rail has mostly widened. */
    .brand-text,
    .sidebar nav a span,
    .sidebar-account > div,
    .sidebar-scope,
    .sidebar-logout span {
        transition: opacity 0.15s ease 0.1s;
    }
}

/* Attendance reports use application-controlled page margins. */
@page attendance-report {
    margin: 12mm;
}

/* Print: content only, with status colours preserved. -------------------- */

@media print {
    body.page-attendance {
        page: attendance-report;
    }
    body {
        background: #ffffff;
        font-size: 11px;
    }

    .sidebar,
    .sidebar-backdrop,
    .topbar,
    .page-header,
    .notice,
    .context-note,
    form,
    .toolbar,
    .pager,
    .no-print,
    button,
    details,
    .quick-links,
    .skip-link,
    .import-types,
    .dashboard-metrics,
    .panel-link,
    .theme-status,
    .loading-review-dialog {
        display: none !important;
    }

    .workspace {
        margin-left: 0;
    }

    main {
        max-width: none;
        padding: 0;
    }

    .card {
        margin: 0 0 18px;
        padding: 8px 0;
        border: 0;
        box-shadow: none;
        break-inside: avoid;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
    }

    table {
        font-size: 10px;
    }

    th,
    td {
        padding: 6px;
    }

    a {
        color: inherit;
    }

    .badge,
    .loading-outside-preference td,
    .dashboard-overload-row td,
    .total td {
        print-color-adjust: exact;
    }

    .dashboard-grid {
        display: block;
    }

    /* Attendance report: readable, print-focused table layout. */
    body.page-attendance .card {
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        break-inside: auto;
    }

    body.page-attendance .section-title h2 {
        margin-bottom: 5pt;
        color: #111827;
        font-size: 16pt;
        font-weight: 700;
    }

    body.page-attendance .section-title p {
        margin-bottom: 12pt;
        color: #475569;
        font-size: 9pt;
    }

    body.page-attendance .table-wrap {
        overflow: visible !important;
    }

    body.page-attendance table {
        width: 100%;
        border-collapse: collapse;
        table-layout: auto;
        font-size: 9pt;
    }

    body.page-attendance th,
    body.page-attendance td {
        padding: 6pt 7pt;
        border: 0.6pt solid #cbd5e1;
        color: #111827;
        vertical-align: top;
    }

    body.page-attendance th {
        background: #eef2f7 !important;
        font-weight: 700;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.page-attendance td small {
        display: block;
        margin-top: 2pt;
        color: #475569;
        font-size: 8pt;
    }
}

/* Shared theme selector: Eco (leaf), Pearl (sun), Dark (moon) ----------- */

.theme-switcher-form {
    flex: 0 0 auto;
    margin: 0;
}

.theme-switcher-options {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
}

.theme-switcher-option {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
}

.theme-switcher-option:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.theme-switcher-option[aria-pressed="true"] {
    border-color: var(--brand-active);
    background: var(--brand-soft);
    color: var(--brand-ink);
    box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

.theme-switcher-option:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Visible name on hover and keyboard focus; screen readers use the hidden text. */
.theme-switcher-option::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 40;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--text);
    color: var(--surface);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
}

.theme-switcher-option:hover::after,
.theme-switcher-option:focus-visible::after {
    opacity: 1;
}

/* Result of an in-place theme change (theme-switcher.js). Quick header
   switches are announced to screen readers only; an explicit save or a
   failure is shown here. */
.theme-status {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 70;
    max-width: min(420px, calc(100vw - 40px));
    margin: 0;
    padding: 12px 16px;
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 13px;
    box-shadow: var(--shadow-raised);
    overflow-wrap: anywhere;
}

.theme-status-error {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.auth-main-inner {
    width: min(500px, 100%);
}

.auth-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

@media (max-width: 760px) {
    .theme-switcher-option {
        width: 30px;
        height: 30px;
    }
}

/* ==========================================================================
   PTC PaySync v3.2: confirmation dialog, action feedback and Database & Recovery.
   Theme tokens only, so Eco, Pearl and Dark apply without separate rules.
   ========================================================================== */

.confirm-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: 85vh;
    padding: 24px;
    overflow: auto;
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-raised);
}

.confirm-dialog[data-variant="warning"] {
    border-top-color: var(--warning-text);
}

.confirm-dialog[data-variant="destructive"] {
    border-top-color: var(--danger-text);
}

.confirm-dialog::backdrop {
    background: var(--overlay);
}

.confirm-dialog h2 {
    margin: 0 0 12px;
    color: var(--brand-ink);
    font-size: 19px;
    overflow-wrap: anywhere;
}

.confirm-dialog[data-variant="destructive"] h2 {
    color: var(--danger-text);
}

.confirm-dialog p {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.confirm-dialog-consequence,
.confirm-dialog-unsaved {
    padding: 10px 12px;
    border: 1px solid var(--warning-border);
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning-text);
}

.confirm-dialog[data-variant="destructive"] .confirm-dialog-consequence {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.confirm-dialog-field {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
}

.confirm-dialog .toolbar {
    justify-content: flex-end;
    margin-bottom: 0;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.confirm-dialog[data-variant="destructive"] [data-confirm-accept] {
    border-color: var(--danger-text);
    background: var(--danger-text);
    /* The surface colour is white in Eco and Pearl and near-black in Dark: readable on either red. */
    color: var(--surface);
}

@media (prefers-reduced-motion: no-preference) {
    .confirm-dialog[open] {
        animation: confirm-dialog-in 140ms ease-out;
    }
}

@keyframes confirm-dialog-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

form[aria-busy="true"] button,
form[aria-busy="true"] input[type="submit"] {
    cursor: progress;
}

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

.notice.info,
.notice.pending {
    border-color: var(--border-strong);
    background: var(--info-bg);
    color: var(--info-text);
}

.recovery-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.recovery-tabs a {
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.recovery-tabs a:hover {
    background: var(--surface-hover);
    color: var(--brand-ink);
}

.recovery-tabs a.active {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.verification-stages {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.verification-stages li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 4px 9px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;
}

.verification-stages li.done {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.verification-stages li small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.3;
}

.backup-status {
    margin: 0 0 14px;
}

.backup-status-line {
    margin: 6px 0;
    font-size: 14px;
}

.backup-status-line small,
.restore-stages small {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.backup-status [data-backup-status-text] button {
    margin-left: 6px;
}

.restore-step {
    margin: 20px 0 10px;
    font-size: 16px;
}

.restore-stages {
    margin: 12px 0;
    padding-left: 20px;
    font-size: 14px;
}

.restore-stages li.failed {
    color: var(--danger-text);
}

.restore-stages li.completed {
    color: var(--success-text);
}

.backup-record-list {
    display: grid;
    gap: 14px;
}

.backup-record {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.backup-record-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.backup-record-identity {
    min-width: 0;
}

.backup-record-id {
    display: block;
    overflow-wrap: anywhere;
    font-size: 15px;
    font-weight: 700;
}

.backup-record-identity > small {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.45;
}

.backup-record-note {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.backup-record-purpose {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.backup-record-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
}

.backup-record-level,
.backup-record-error,
.backup-record-archive {
    flex-basis: 100%;
    text-align: right;
    font-size: 13px;
    line-height: 1.45;
}

.backup-record-level,
.backup-record-archive {
    color: var(--text-muted);
}

.backup-record-error,
.backup-record-problem {
    color: var(--danger-text);
}

.backup-record-details {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.backup-record-detail {
    min-width: 0;
}

.backup-record-label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.backup-record-facts {
    display: grid;
    gap: 9px;
    margin: 0;
}

.backup-record-facts > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
}

.backup-record-facts dt {
    color: var(--text-muted);
}

.backup-record-facts dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.backup-record-source strong,
.backup-record-source small {
    display: block;
    overflow-wrap: anywhere;
}

.backup-record-source strong {
    font-size: 14px;
}

.backup-record-source small {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

.backup-record-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
}

.backup-record-actions,
.backup-record-downloads {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.backup-record-actions .inline {
    margin: 0;
}

.backup-record-actions .inline button {
    margin: 0;
}

.backup-record-empty {
    padding: 28px 18px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
}

.restore-points-table {
    min-width: 640px;
    table-layout: fixed;
}

.restore-points-table th:nth-child(1) {
    width: 34%;
}

.restore-points-table th:nth-child(2) {
    width: 27%;
}

.restore-points-table th:nth-child(3) {
    width: 25%;
}

.restore-points-table th:nth-child(4) {
    width: 14%;
    text-align: right;
}

.restore-points-table td {
    vertical-align: middle;
}

.restore-point-id {
    display: block;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.restore-point-meta {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.restore-point-verification {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.restore-point-verification.tested {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.restore-point-eligibility {
    display: grid;
    justify-items: start;
    gap: 5px;
}

.restore-point-readiness,
.restore-point-problem {
    max-width: 240px;
    font-size: 12px;
}

.restore-point-readiness {
    color: var(--warning-text);
}

.restore-point-action {
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .backup-record-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .backup-record-header {
        align-items: flex-start;
    }
}

@media (max-width: 520px) {
    .backup-record {
        padding: 14px;
    }

    .backup-record-header {
        flex-direction: column;
    }

    .backup-record-status {
        justify-content: flex-start;
    }

    .backup-record-level,
    .backup-record-error,
    .backup-record-archive {
        text-align: left;
    }

    .backup-record-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .backup-record-footer {
        align-items: stretch;
        flex-direction: column;
    }

}

.page-backups table {
    font-size: 14px;
}

.page-backups th {
    font-size: 12px;
}

.page-backups td small {
    font-size: 13px;
    line-height: 1.45;
}

.page-backups .restore-summary dt {
    font-size: 13px;
}

.page-backups .restore-summary dd {
    font-size: 15px;
    line-height: 1.45;
}

.page-backups button.small,
.page-backups .button.small {
    padding: 9px 16px;
    font-size: 13px;
}

.maintenance-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--font-sans);
}

.maintenance-card {
    max-width: 520px;
    padding: 28px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.maintenance-card h1 {
    margin: 0 0 12px;
    color: var(--brand-ink);
    font-size: 22px;
}
