:root {
    --bg: #0c0e14;
    --bg-elevated: #12151e;
    --surface: #181c27;
    --surface-hover: #1e2330;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #eef0f4;
    --muted: #8b95a8;
    --brand: #c41e3a;
    --brand-hover: #d42a46;
    --brand-soft: rgba(196, 30, 58, 0.14);
    --accent: #5b8def;
    --accent-soft: rgba(91, 141, 239, 0.12);
    --success-bg: rgba(46, 160, 96, 0.14);
    --success-text: #7ddea8;
    --warning-bg: rgba(212, 168, 56, 0.12);
    --warning-text: #e8c66a;
    --error-bg: rgba(196, 60, 76, 0.14);
    --error-text: #f0a0ab;
    --dev-bg: rgba(91, 141, 239, 0.1);
    --dev-text: #9ec8ff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
    --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(91, 141, 239, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(196, 30, 58, 0.06), transparent);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1;
}

.container {
    width: min(1120px, 92vw);
    margin: 0 auto;
}

/* ── Header ── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    background: rgba(18, 21, 30, 0.85);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
}

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.workspace-context {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-left: 0.35rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
    min-width: 0;
}

.workspace-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}

.workspace-scope-form {
    margin: 0;
}

.workspace-scope-select {
    max-width: 16rem;
    padding: 0.25rem 0.45rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font: inherit;
    font-size: 0.78rem;
}

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

.brand-footnote {
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--dev-bg);
    color: var(--dev-text);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    width: 1.15rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--surface-hover);
}

@media (max-width: 900px) {
    .header-inner {
        flex-wrap: nowrap;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 0.5rem 0 0.75rem;
        border-top: 1px solid var(--border);
        order: 3;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links a,
    .nav-links .nav-user {
        padding: 0.65rem 0.75rem;
    }

    .header-inner {
        flex-wrap: wrap;
    }
}

.nav-user {
    color: var(--muted);
    font-size: 0.82rem;
    padding: 0 0.35rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-signout {
    color: var(--muted) !important;
    border: 1px solid var(--border);
}

/* ── Layout ── */

main.container {
    padding: 2rem 0 3.5rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0 0 0.2rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-header .muted,
.page-header .subtitle {
    margin: 0;
}

.subtitle {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
}

.muted, .status-list {
    color: var(--muted);
}

/* ── Cards ── */

.hero-card, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.hero-card {
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--surface) 0%, var(--bg-elevated) 100%);
}

.hero-card h1 {
    font-size: 2rem;
    letter-spacing: -0.03em;
    margin: 0 0 0.5rem;
}

.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header-row h2 {
    margin: 0;
}

.card-header-row a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.card-header-row a:hover {
    text-decoration: underline;
}

.stat-card {
    transition: border-color 0.15s, transform 0.15s;
}

.stat-card:hover {
    border-color: var(--border-strong);
}

.stat-card strong, .stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0.2rem 0;
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-alert {
    border-color: rgba(212, 168, 56, 0.35);
    box-shadow: 0 0 0 1px rgba(212, 168, 56, 0.12);
}

.stat-card-alert .stat-value {
    color: var(--warning-text);
}

.firm-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.firm-clients-table .actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.firm-clients-table tr.row-active {
    background: var(--accent-soft);
}

.firm-clients-table td.num,
.firm-clients-table th.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.firm-clients-table-wide {
    min-width: 1100px;
}

.stat-card-muted .stat-value-sm {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0.2rem 0;
}

.firm-analytics-deductions .stat-label {
    letter-spacing: 0.03em;
}

.inline-form {
    display: inline;
    margin: 0;
}

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

.quick-links-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.quick-links-stack a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.quick-links-stack a:hover {
    text-decoration: underline;
}

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

/* Client edit — full-width overview strip + form */
.client-overview-bar {
    margin-bottom: 1rem;
}

.client-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.client-overview-header h2 {
    margin: 0;
}

.client-overview-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: flex-start;
}

.client-overview-stat {
    min-width: 6.5rem;
}

.client-overview-stat .stat-value {
    font-size: 1.25rem;
}

.client-overview-stat .stat-value-sm {
    font-size: 1.05rem;
    font-weight: 600;
}

.client-overview-note {
    margin: 0.85rem 0 0;
}

.client-edit-form.form-card {
    max-width: none;
}

.client-edit-form .form-wide {
    max-width: none;
    width: 100%;
}

.grid-2, .grid-3 {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ── Feature pills (landing) ── */

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0;
    padding: 0;
    list-style: none;
}

.feature-pill {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(91, 141, 239, 0.2);
}

/* ── Alerts ── */

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid rgba(212, 168, 56, 0.25);
}

.alert-info {
    background: rgba(91, 141, 239, 0.12);
    color: var(--text);
    border: 1px solid rgba(91, 141, 239, 0.28);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid rgba(196, 60, 76, 0.25);
}

.alert-error .error-list {
    margin: 0.4rem 0 0 1.15rem;
    padding: 0;
}

.alert-error .error-list li {
    margin: 0.15rem 0;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid rgba(46, 160, 96, 0.25);
}

.alert-dev {
    background: var(--dev-bg);
    color: var(--dev-text);
    border: 1px solid rgba(91, 141, 239, 0.2);
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.35);
}

.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

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

.btn-secondary:hover {
    background: #252b3a;
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

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

/* ── Forms ── */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 420px;
}

.form-wide {
    max-width: 560px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-stack label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-stack input,
.form-stack select,
.form-inline select {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-stack input:focus,
.form-stack select:focus,
.form-inline select:focus,
.input-sm:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--muted);
}

.required-mark {
    color: var(--error-text);
    font-weight: 700;
}

.form-stack input.is-invalid,
.form-stack select.is-invalid,
.form-stack textarea.is-invalid {
    border-color: var(--error-text);
    box-shadow: 0 0 0 3px var(--error-bg);
}

.form-stack input.is-invalid:focus,
.form-stack select.is-invalid:focus,
.form-stack textarea.is-invalid:focus {
    border-color: var(--error-text);
    box-shadow: 0 0 0 3px rgba(196, 60, 76, 0.28);
}

.field-error {
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--error-text);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.25rem;
}

.form-footer {
    margin-top: 1rem;
}

.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 1rem 0;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.auth-card .form-stack {
    max-width: none;
    margin-top: 1.25rem;
}

.hero-actions {
    margin-top: 1.5rem;
}

/* ── Tables ── */

.table-scroll {
    overflow-x: auto;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-elevated);
}

.data-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table tbody tr {
    transition: background 0.12s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover {
    text-decoration: underline;
}

.data-table tr.row-active td {
    background: var(--accent-soft);
}

code, .code-tag {
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 0.88em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--accent);
}

/* ── Badges ── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    background: var(--border);
    letter-spacing: 0.02em;
}

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

.badge-active,
.badge-calculated,
.badge-approved,
.badge-processed {
    background: var(--success-bg);
    color: var(--success-text);
}

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

.badge-inactive,
.badge-terminated,
.badge-on_leave {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

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

.badge-processed {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ── Year-end checklist ── */

.progress-bar-wrap {
    width: 100%;
}

.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transition: width 0.35s ease;
}

.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}

.checklist-icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.checklist-complete .checklist-icon {
    background: var(--success-bg);
    color: var(--success-text);
}

.checklist-pending .checklist-icon {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

.checklist-warning .checklist-icon {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.checklist-info .checklist-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.checklist-body {
    flex: 1;
    min-width: 0;
}

.checklist-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.checklist-desc {
    margin: 0.2rem 0 0;
    font-size: 0.88rem;
}

.checklist-detail {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

.checklist-action {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.checklist-action:hover {
    text-decoration: underline;
}

.badge-checklist-complete {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-checklist-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

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

.badge-checklist-info {
    background: var(--accent-soft);
    color: var(--accent);
}

.simple-list {
    margin: 0;
    padding-left: 1.25rem;
}

.simple-list li {
    margin-bottom: 0.35rem;
}

.simple-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.simple-list a:hover {
    text-decoration: underline;
}

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

/* ── Quick links & misc ── */

.quick-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-top: 1rem;
}

.quick-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
}

.quick-links a:hover {
    text-decoration: underline;
}

.quick-links .muted {
    font-size: 0.75rem;
}

.finalized-note {
    font-size: 0.88rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.paystub-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.totals-list dd {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.warn-list {
    margin-top: 0.75rem;
    color: var(--warning-text);
    font-size: 0.9rem;
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(120px, 38%) 1fr;
    gap: 0.45rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.88rem;
}

.detail-list dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Pay run / hours forms ── */

.form-inline,
.inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.add-employee-row {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.inline-gross-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.input-sm {
    width: 6rem;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font: inherit;
}

.input-hours {
    width: 4rem;
}

.hours-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.hours-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: flex-end;
}

.hours-inputs label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.72rem;
    color: var(--muted);
}

.hours-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

fieldset.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem 1.15rem;
    margin: 0.5rem 0 0;
}

fieldset.form-section legend {
    padding: 0 0.35rem;
}

.form-section-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Collapsible optional form blocks (native <details>) */
details.form-collapsible {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 0;
    margin: 0.35rem 0 0;
}

details.form-collapsible > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    user-select: none;
}

details.form-collapsible > summary::-webkit-details-marker {
    display: none;
}

details.form-collapsible > summary::after {
    content: "▸";
    color: var(--muted);
    font-size: 0.85rem;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

details.form-collapsible[open] > summary {
    border-bottom: 1px solid var(--border);
}

details.form-collapsible[open] > summary::after {
    transform: rotate(90deg);
}

details.form-collapsible > summary:hover {
    background: var(--surface-hover);
}

details.form-collapsible > summary .summary-meta {
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--muted);
}

details.form-collapsible .form-collapsible-body {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1rem 1.1rem 1.15rem;
}

details.form-collapsible .form-collapsible-body > .form-section-title {
    margin: 0;
    padding-top: 0;
    border-top: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.import-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ── WSIB card ── */

.wsib-filing-card .wsib-totals {
    margin: 1rem 0 1.25rem;
}

.wsib-filing-card .wsib-highlight {
    border-color: rgba(91, 141, 239, 0.35);
    background: linear-gradient(135deg, var(--surface) 0%, rgba(91, 141, 239, 0.06) 100%);
}

.wsib-filing-card .wsib-highlight .stat-value {
    color: var(--accent);
}

.ytd-summary-card {
    border-color: rgba(91, 141, 239, 0.25);
    background: linear-gradient(135deg, var(--surface) 0%, rgba(91, 141, 239, 0.05) 100%);
}

/* ── Calculation log (firm audit) ── */

.calculation-log-card .calc-log-panel {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.calculation-log-card .calc-log-panel summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    list-style-position: inside;
}

.calculation-log-card .calc-log-panel[open] summary {
    border-bottom: 1px solid var(--border);
}

.calculation-log-card .calc-log-body {
    padding: 0.75rem 1rem 1rem;
}

.calculation-log-card .calc-log-subtitle {
    margin: 1rem 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.calculation-log-card .calc-log-steps dt {
    font-family: var(--mono, ui-monospace, monospace);
    font-size: 0.82rem;
}

/* ── Footer ── */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0 2rem;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .brand-footnote {
        display: none;
    }

    .nav-user {
        display: none;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }

    .hero-card {
        padding: 1.75rem 1.25rem;
    }

    .hero-card h1 {
        font-size: 1.6rem;
    }
}