/* ═══════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════ */
:root {
    /* Brand */
    --navy: #0a1f44;
    --navy-mid: #173877;
    --gold: #c59d5f;
    --gold-soft: rgba(197, 157, 95, 0.14);

    /* Layout */
    --sidebar-w: 248px;

    /* Surface */
    --bg: #eef2f9;
    --surface: #ffffff;
    --border: rgba(10, 31, 68, 0.1);
    --border-solid: #d8e1f0;

    /* Text */
    --text: #0d1f3c;
    --muted: #5a6a8a;
    --label: #8898b8;

    /* Status */
    --warning-bg: #fff6db;
    --warning-border: #f1cf6b;
    --warning-text: #8a6300;
    --success-bg: #eaf8ee;
    --success-border: #9fd6ac;
    --success-text: #18794e;
    --danger-bg: #ffe1e1;
    --danger-border: #f3a9a9;
    --danger-text: #b42318;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(10, 31, 68, 0.07), 0 1px 2px rgba(10, 31, 68, 0.04);
    --shadow-md: 0 4px 12px rgba(10, 31, 68, 0.08), 0 2px 4px rgba(10, 31, 68, 0.04);

    /* Legacy aliases kept for any inline usage */
    --white: #ffffff;
    --black: #0d1f3c;
    --ink-soft: #5a6a8a;
    --mist: #eef3fb;
    --warm: #fbf7f0;
    --card-shadow: var(--shadow-md);
    --card-bg: var(--surface);
    --line: var(--border);
    --primary: var(--navy);
    --primary-strong: #173877;
    --accent: var(--gold);
    --accent-soft: var(--gold-soft);
    --shadow: var(--shadow-md);
}


/* ═══════════════════════════════════════
   RESET & BASE
════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    height: 100%;
}

body {
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    height: 100%;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    font-family: "Familjen Grotesk", sans-serif;
    color: var(--navy);
    line-height: 1.15;
}

p {
    margin: 0 0 0.75em;
    line-height: 1.65;
}

p:last-child {
    margin-bottom: 0;
}


/* ═══════════════════════════════════════
   APP SHELL LAYOUT
════════════════════════════════════════ */

/* Collapsed width of the sidebar rail */
:root { --sb-rail: 52px; --sb-full: 248px; }

.app-shell {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar host ── (the flex item that occupies layout space) */
.sidebar-host {
    position: relative;
    flex-shrink: 0;
    width: var(--sb-rail);        /* collapsed: only rail visible */
    height: 100%;
    z-index: 200;
    transition: width 0.22s ease;
}

/* Pinned: host takes full width in layout */
html[data-sb="pinned"] .sidebar-host {
    width: var(--sb-full);
}

/* ── Sidebar ── (the actual panel, always full width, clips or overlays) */
.sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: var(--sb-rail);        /* visually narrow when collapsed */
    display: flex;
    flex-direction: column;
    background: var(--navy);
    overflow: hidden;
    transition: width 0.22s ease, box-shadow 0.22s ease;
}

/* Expanded states: hover or pinned */
.sidebar-host.sb-hover .sidebar,
html[data-sb="pinned"] .sidebar {
    width: var(--sb-full);
}

/* Drop-shadow only when overlaying (hover, not pinned) */
.sidebar-host.sb-hover:not(html[data-sb="pinned"] .sidebar-host) .sidebar {
    box-shadow: 4px 0 24px rgba(10, 31, 68, 0.28);
}

/* ── Sidebar brand ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

/* Full logo — shown when expanded */
.sidebar-brand-logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    object-position: left center;
    opacity: 1;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
}

/* Favicon icon — shown when collapsed */
.sidebar-brand-icon {
    display: block;
    width: 26px;
    height: 26px;
    object-fit: contain;
    position: absolute;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

/* Swap logo ↔ icon based on expand state */
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-brand-logo {
    opacity: 0;
}
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-brand-icon {
    opacity: 1;
}

/* Pin button — always rendered, visible only when sidebar expanded */
.sidebar-pin-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    pointer-events: none;
}

/* Show pin button only when expanded */
.sidebar-host.sb-hover .sidebar-pin-btn,
html[data-sb="pinned"] .sidebar-pin-btn {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-pin-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* Which icon to show */
.sb-icon-unpin { display: none; }
.sb-icon-pin   { display: block; }
html[data-sb="pinned"] .sb-icon-pin   { display: none; }
html[data-sb="pinned"] .sb-icon-unpin { display: block; }

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section-label {
    display: block;
    padding: 12px 10px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    overflow: hidden;
    /* Collapsed: render as a thin divider line */
    transition: color 0.15s, padding 0.15s;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.92);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    border-left-color: var(--gold);
    padding-left: 7px;
}

/* Center icons in rail when collapsed */
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    border-left-color: transparent !important;
    padding-left: 0 !important;
}

.sidebar-link-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active .sidebar-link-icon { opacity: 1; }

.sidebar-link-text {
    white-space: nowrap;
    overflow: hidden;
}

/* ── Footer ── */
.sidebar-footer {
    padding: 10px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-footer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-footer-link {
    display: block;
    padding: 2px 4px;
    font-size: 0.76rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.15s, opacity 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-link:hover,
.sidebar-footer-link.active {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-footer-icon {
    flex-shrink: 0;
    opacity: 0.5;
    width: 15px;
    height: 15px;
}

/* Collapsed: center the user icon, hide text */
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-footer {
    justify-content: center;
}
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-user,
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-logout-btn,
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-footer-link {
    opacity: 0;
    pointer-events: none;
}

.sidebar-user {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.sidebar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

/* ── Sidebar profile button ── */
.sidebar-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 4px 4px 4px 2px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}

.sidebar-profile-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-profile-btn:hover .sidebar-footer-icon {
    opacity: 0.8;
}

/* Collapsed state: keep button centered, hide username text */
.sidebar-host:not(.sb-hover):not(html[data-sb="pinned"] .sidebar-host) .sidebar-profile-btn {
    justify-content: center;
    flex: none;
}

/* ── Profile modal ── */
.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 68, 0.5);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.profile-overlay[hidden] {
    display: none;
}

.profile-modal {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 8px 48px rgba(10, 31, 68, 0.24);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: profile-pop-in 0.18s ease;
}

@keyframes profile-pop-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.profile-modal-header {
    background: var(--navy);
    padding: 20px 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.profile-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--navy-mid);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.18);
}

.profile-modal-title-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.profile-modal-title-block h3 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    width: fit-content;
}

.profile-role-badge.role-admin {
    background: rgba(255, 214, 0, 0.2);
    color: #ffd600;
}

.profile-role-badge.role-member {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
}

.profile-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.profile-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.profile-modal-body {
    padding: 20px;
}

.profile-detail-list {
    margin: 0;
}

.profile-detail-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-solid);
}

.profile-detail-row:last-child {
    border-bottom: none;
}

.profile-detail-row dt {
    min-width: 78px;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    flex-shrink: 0;
}

.profile-detail-row dd {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text, #1a2b4a);
    word-break: break-all;
}

.profile-info-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profile-info-submit {
    width: 100%;
    justify-content: center;
}

.profile-info-message {
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.profile-info-message.is-success {
    background: #dcfce7;
    color: #166534;
}

.profile-info-message.is-error {
    background: #fee2e2;
    color: #991b1b;
}

.profile-password-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border-solid);
}

.profile-password-section h4 {
    margin: 0 0 14px;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.profile-pw-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-pw-submit {
    width: 100%;
    justify-content: center;
}

.profile-pw-message {
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.profile-pw-message.is-success {
    background: #dcfce7;
    color: #166534;
}

.profile-pw-message.is-error {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Main area ── */
.main-area {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
    /* Smooth resize when pin state changes */
    transition: flex 0.22s ease;
}

.page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 50px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-solid);
    flex-shrink: 0;
}

.page-topbar-title {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
}

.page-content-wrap {
    flex: 1;
    padding: 22px 26px 48px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Auth shell (login page) ── */
.auth-shell {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.auth-brand {
    margin-bottom: 28px;
}

.auth-brand-logo {
    display: block;
    height: 52px;
    width: auto;
    object-fit: contain;
}

/* Legacy shell — kept as no-op so any stray references don't break layout */
.shell {
    width: 100%;
}

/* ── Messages ── */
.messages {
    display: grid;
    gap: 8px;
}

.message {
    border-radius: 7px;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-weight: 500;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.message.error,
.message.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}


/* ═══════════════════════════════════════
   TYPOGRAPHY & UTILITIES
════════════════════════════════════════ */
.eyebrow {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

.small-note {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.full-width {
    width: 100%;
}


/* ═══════════════════════════════════════
   CARDS
════════════════════════════════════════ */
.hero-card,
.form-card,
.table-card,
.login-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

/* ── Bookkeeping FY collapsible groups ─────────────────────────────── */
.bk-fy-group {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 10px;
}

.bk-fy-group[open] .bk-fy-caret {
    transform: rotate(180deg);
}

.bk-fy-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.bk-fy-summary::-webkit-details-marker { display: none; }
.bk-fy-summary:hover { background: var(--bg); }

.bk-fy-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--navy);
    flex: 1;
}

.bk-fy-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border-solid);
    border-radius: 20px;
    padding: 2px 10px;
}

.bk-fy-caret {
    color: var(--text-secondary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.bk-fy-body {
    border-top: 1px solid var(--border-solid);
    overflow-x: auto;
}

.bk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.857rem;
}

.bk-table thead tr {
    background: var(--bg);
}

.bk-table th {
    padding: 9px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 1px solid var(--border-solid);
}

.bk-table td {
    padding: 10px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-faint);
    vertical-align: middle;
}

.bk-table tbody tr:last-child td { border-bottom: none; }
.bk-table tbody tr:hover { background: var(--bg); }

.bk-id {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bk-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.bk-badge--warn { background: #fff3cd; color: #92400e; }
.bk-badge--ok   { background: #d1fae5; color: #065f46; }

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
}

.form-card {
    padding: 20px 24px;
}

.table-card {
    overflow-x: auto;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
}

.dashboard-hero-copy {
    display: grid;
    gap: 6px;
}

.dashboard-hero-copy h2 {
    margin: 0;
    font-size: 1.4rem;
}

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

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    font-size: 1.35rem;
    margin-bottom: 5px;
}

.section-heading p {
    color: var(--muted);
}


/* ═══════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.primary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    min-height: 38px;
    padding: 0 16px;
    font-size: 0.875rem;
    line-height: 1;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: "Familjen Grotesk", sans-serif;
    white-space: nowrap;
    text-align: center;
    appearance: none;
    -webkit-appearance: none;
    transition: filter 0.15s, background 0.15s;
}

.primary-button,
.primary-button:visited,
.primary-button:link,
.primary-button:hover,
.primary-button:active {
    background: var(--navy);
    color: #ffffff;
}

.primary-button:hover {
    filter: brightness(1.12);
}

.ghost-button {
    background: var(--surface);
    color: var(--navy);
    border-color: var(--border-solid);
}

.ghost-button:hover {
    background: #f0f4fb;
}

.hero-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.danger-button:hover {
    filter: brightness(0.97);
}

.icon-button {
    padding: 0 10px;
    min-width: 38px;
}

.button-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

/* ── Table icon buttons ── */
.table-icon-button {
    min-height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-solid);
    background: var(--surface);
    color: var(--navy);
    cursor: pointer;
    transition: background 0.15s;
}

.table-icon-button:hover {
    background: #f0f4fb;
}

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

.danger-icon-button:hover {
    filter: brightness(0.95);
}

/* ── Form / hero action rows ── */
.form-actions,
.topbar-actions,
.entry-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-actions form,
.entry-actions form {
    margin: 0;
}

.topbar-actions form button,
.entry-actions form button {
    width: 100%;
}


/* ═══════════════════════════════════════
   NAVIGATION & BACK LINK
════════════════════════════════════════ */
.page-back-row {
    margin-bottom: 4px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border-solid);
    background: var(--surface);
    color: var(--navy);
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 0.15s;
}

.back-link:hover {
    background: #f0f4fb;
}

.back-link .button-icon {
    width: 14px;
    height: 14px;
}

/* ── Pills / badges ── */
.user-chip,
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(10, 31, 68, 0.07);
    color: var(--navy);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: "Familjen Grotesk", sans-serif;
}

.status-pill {
    background: rgba(24, 121, 78, 0.1);
    color: var(--success-text);
}

.inactive-pill {
    background: rgba(10, 31, 68, 0.06);
    color: var(--muted);
}


/* ═══════════════════════════════════════
   TABLES
════════════════════════════════════════ */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-solid);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: "Familjen Grotesk", sans-serif;
    background: #f7faff;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #f7faff;
}

.empty-state {
    color: var(--muted);
    background: transparent;
    border: none;
    font-size: 0.875rem;
    text-align: center;
    padding: 28px 16px;
}

.dashboard-action-cell {
    width: 56px;
}

.dashboard-action-cell form {
    margin: 0;
}


/* ═══════════════════════════════════════
   FORMS
════════════════════════════════════════ */
.stack-form {
    display: grid;
    gap: 16px;
}

.form-row {
    display: grid;
    gap: 5px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.checkbox-row input {
    width: auto;
}

.access-check-panel {
    display: grid;
    gap: 14px;
    padding-top: 4px;
}

.access-check-heading {
    margin-bottom: 0;
}

.access-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.access-check-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--border-solid);
    border-radius: 8px;
    background: var(--surface);
}

.access-check-item input {
    margin-top: 3px;
}

.access-check-item strong,
.access-check-item small {
    display: block;
}

.access-check-item small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
}

.user-access-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-access-actions form {
    margin: 0;
}

.read-only-fieldset {
    display: contents;
    border: 0;
    padding: 0;
    margin: 0;
}

.read-only-fieldset input,
.read-only-fieldset select,
.read-only-fieldset textarea {
    color: var(--text);
    opacity: 1;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
}

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

    .access-check-grid {
        grid-template-columns: 1fr;
    }
}

.form-row input,
.form-row select,
.form-row textarea,
td input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-solid);
    border-radius: 6px;
    background: var(--surface);
    font-size: 0.875rem;
    font-family: "Inter", sans-serif;
    color: var(--text);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus,
td input:focus {
    outline: none;
    border-color: var(--navy-mid);
    box-shadow: 0 0 0 3px rgba(23, 56, 119, 0.1);
}

.form-row ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-row li label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    font-size: 0.875rem;
}

.section-heading p,
.hero-card p,
td,
label,
small {
    line-height: 1.6;
}

.form-errors,
.field-error {
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.875rem;
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border: 1px solid var(--warning-border);
    border-radius: 7px;
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 0.875rem;
}

/* ── Filter card ── */
.filter-card {
    padding: 14px 20px;
}

.filter-details {
    display: grid;
    gap: 14px;
}

.filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--navy);
    list-style: none;
}

.filter-summary::-webkit-details-marker {
    display: none;
}

.filter-summary-note {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.filter-details[open] .filter-summary {
    margin-bottom: 2px;
}

.dashboard-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

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

/* ── Settings ── */
.settings-form {
    max-width: 540px;
}

.settings-row {
    max-width: 320px;
}


/* ═══════════════════════════════════════
   MODE CARDS (course type choice)
════════════════════════════════════════ */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.mode-card {
    display: grid;
    gap: 10px;
    padding: 20px;
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.18s, box-shadow 0.18s;
    cursor: pointer;
}

.mode-card:hover {
    border-color: rgba(23, 56, 119, 0.3);
    box-shadow: var(--shadow-md);
}

.mode-card h3 {
    font-size: 1.2rem;
}

.mode-card p {
    color: var(--muted);
    line-height: 1.6;
}


/* ═══════════════════════════════════════
   PACKAGE FORM
════════════════════════════════════════ */
.package-course-list,
.discount-choice-list {
    display: grid;
    gap: 8px;
}

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

.package-course-option,
.discount-choice-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border-solid);
    border-radius: 7px;
    background: var(--surface);
    font-weight: 600;
}

.package-course-option {
    justify-content: space-between;
}

.package-course-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 700;
    color: var(--navy);
    font-size: 0.875rem;
}

.package-course-check span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.package-plan-control {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.package-plan-control select {
    min-height: 32px;
    min-width: 130px;
    padding: 5px 10px;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
}

.package-course-option input,
.discount-choice-option input {
    width: auto;
    margin: 0;
}

.discount-choice-list {
    grid-template-columns: repeat(4, minmax(0, max-content));
    align-items: stretch;
    gap: 10px;
}

.discount-choice-option {
    min-height: 68px;
    min-width: 68px;
    padding: 0 18px;
    border-radius: 8px;
    background: rgba(10, 31, 68, 0.06);
    border-color: transparent;
    justify-content: center;
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--navy);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.discount-choice-option:last-child {
    min-width: 130px;
}

.discount-choice-option:hover {
    background: rgba(10, 31, 68, 0.1);
}

.discount-choice-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.discount-choice-option.selected {
    background: var(--navy);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.2);
}

.custom-discount-wrap {
    max-width: 260px;
}

.custom-active {
    border-color: var(--navy-mid) !important;
    box-shadow: 0 0 0 3px rgba(23, 56, 119, 0.1) !important;
}


/* ═══════════════════════════════════════
   ENTRY CARDS (course detail)
════════════════════════════════════════ */
.entry-stack {
    display: grid;
    gap: 16px;
}

.entry-card {
    display: grid;
    gap: 14px;
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 0 4px;
}

.entry-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.entry-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.entry-status-row {
    margin-top: 8px;
}

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

.entry-stack .entry-actions a {
    color: inherit;
}


/* ═══════════════════════════════════════
   PRICE MATRIX TABLE
════════════════════════════════════════ */
.matrix-table th[scope="row"] {
    color: var(--navy);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    background: #f7faff;
}

.matrix-table thead th:first-child {
    min-width: 140px;
}

.cell-note {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.price-primary {
    color: var(--navy);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.discount-note {
    color: var(--success-text);
    font-weight: 700;
}

.included-courses-note {
    display: grid;
    gap: 6px;
    padding: 0 4px;
}

.breakdown-heading {
    font-weight: 700;
    color: var(--navy);
}

.included-course-card {
    padding: 11px 14px;
    border: 1px solid var(--border-solid);
    border-radius: 7px;
    background: var(--surface);
}

.package-breakdown-block {
    display: grid;
    gap: 5px;
}

.package-breakdown-table th:first-child,
.package-breakdown-table td:first-child {
    min-width: 200px;
}

.package-breakdown-table th,
.package-breakdown-table td {
    padding: 8px 12px;
}

.package-plan-header-row th,
.package-plan-header-row td {
    background: rgba(10, 31, 68, 0.04);
    border-bottom: 1px solid var(--border-solid);
}

.package-plan-header-row th {
    color: var(--navy);
    font-size: 0.875rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: 0;
}

.package-plan-header-row td {
    padding: 0;
}

.package-row-component th,
.package-row-component td {
    background: var(--surface);
}

.package-row-total th,
.package-row-total td,
.package-row-discount th,
.package-row-discount td {
    font-weight: 800;
}

.package-row-total th,
.package-row-total td {
    background: rgba(10, 31, 68, 0.05);
    color: var(--navy);
}

.package-row-discount th,
.package-row-discount td {
    background: rgba(24, 121, 78, 0.08);
    color: var(--success-text);
}

.package-row-total th,
.package-row-discount th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.875rem;
}

.package-row-component th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.875rem;
    color: var(--navy);
}


/* ═══════════════════════════════════════
   HUB — APP GRID
════════════════════════════════════════ */
.app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.app-card {
    display: grid;
    gap: 12px;
    padding: 22px;
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.app-card:hover {
    border-color: rgba(23, 56, 119, 0.2);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.app-card-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(10, 31, 68, 0.07);
    color: var(--navy);
}

.app-card-icon svg {
    width: 24px;
    height: 24px;
}

.app-card h3 {
    font-size: 1.15rem;
    margin: 0;
}

.app-card p {
    color: var(--muted);
    line-height: 1.6;
}

.app-card-link {
    justify-self: start;
}


/* ═══════════════════════════════════════
   QBF FINANCE
════════════════════════════════════════ */

/* Flatten old 2-col layout — nav is now in global sidebar */
.qbf-layout {
    display: block;
}

.qbf-sidebar {
    display: none;
}

.qbf-main {
    display: grid;
    gap: 16px;
}

.qbf-dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.qbf-dashboard-filter-bar {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

.qbf-dashboard-filter-bar .form-row {
    min-width: 160px;
}

.qbf-financial-filter-bar .form-row {
    min-width: 140px;
}

.qbf-small-button {
    min-height: 34px;
    padding: 0 14px;
    font-size: 0.84rem;
}

.qbf-tab-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.qbf-settings-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
}

.qbf-tab-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid var(--border-solid);
    background: var(--surface);
    color: var(--navy);
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    transition: background 0.15s;
}

.qbf-tab-link.active {
    background: var(--navy);
    color: #ffffff;
    border-color: transparent;
}

.qbf-tab-link:hover:not(.active) {
    background: #f0f4fb;
}

.qbf-upload-grid,
.qbf-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.qbf-email-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
}

.qbf-email-chip {
    font-size: 0.78rem;
    padding: 6px 10px;
}

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

/* ── LMS / Platform settings panel ────────────────────────────────────────── */
.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--muted, #6b7a99);
    line-height: 1.4;
}

.qbf-lms-summary {
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--surface-tint, #f7faff);
    border: 1px solid var(--border-solid, #d8e1f0);
    border-radius: 8px;
}

.qbf-lms-summary .eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted, #6b7a99);
    margin-bottom: 4px;
}

.qbf-lms-summary strong {
    font-size: 1rem;
    color: var(--navy, #0a1f44);
}

.qbf-lms-charges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.qbf-lms-charge-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--border-solid, #d8e1f0);
    border-radius: 8px;
    min-width: 120px;
}

.qbf-charge-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted, #6b7a99);
}

.qbf-charge-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy, #0a1f44);
}

.qbf-period-grid {
    grid-template-columns: minmax(140px, 0.7fr) minmax(120px, 0.55fr);
    align-items: end;
    margin-bottom: 12px;
}

.period-mode-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 6px 0 2px;
}

.period-mode-option {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 400;
}

.period-mode-option input[type="radio"] {
    width: 15px;
    height: 15px;
    accent-color: var(--navy);
    cursor: pointer;
    flex-shrink: 0;
}

.qbf-upload-action-cell {
    align-self: end;
}

.qbf-upload-action-cell .primary-button {
    min-height: 38px;
}

.qbf-action-label {
    visibility: hidden;
}

.qbf-upload-actions {
    justify-content: flex-end;
    margin-top: -4px;
}

.qbf-manual-wide {
    grid-column: 1 / -1;
}

.qbf-category-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.qbf-inline-table {
    margin: 0;
}

.qbf-review-row {
    background: rgba(197, 157, 95, 0.06);
}

.qbf-transaction-form {
    display: contents;
}

.qbf-compact-card {
    padding: 16px 18px;
    min-height: 0;
}

.qbf-compact-card h3 {
    margin: 0 0 3px;
    font-size: 1.8rem;
    line-height: 1;
}

.qbf-compact-card p {
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--muted);
}

.qbf-review-panel {
    padding: 14px 14px 8px;
}

.qbf-review-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.qbf-review-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qbf-review-filter-form {
    flex: 1 1 680px;
    display: grid;
    gap: 10px;
}

.qbf-review-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.qbf-review-filter-grid .field-group {
    margin: 0;
}

.qbf-review-filter-grid .field-group span {
    display: block;
    margin-bottom: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.qbf-review-filter-grid input,
.qbf-review-filter-grid select {
    min-height: 36px;
}

.qbf-review-table th,
.qbf-review-table td {
    padding: 9px 10px;
    vertical-align: top;
}

.qbf-review-table th {
    font-size: 0.7rem;
}

.qbf-review-table td {
    white-space: normal;
}

.qbf-review-table th:nth-child(1),
.qbf-review-table td:nth-child(1) {
    width: 120px;
    min-width: 120px;
}

.qbf-review-table th:nth-child(2),
.qbf-review-table td:nth-child(2) {
    min-width: 320px;
    max-width: 500px;
}

.qbf-review-table th:nth-child(3),
.qbf-review-table td:nth-child(3) {
    width: 110px;
    min-width: 110px;
}

.qbf-review-table th:nth-child(4),
.qbf-review-table td:nth-child(4) {
    width: 140px;
    min-width: 140px;
}

.qbf-review-table th:nth-child(5),
.qbf-review-table td:nth-child(5) {
    width: 150px;
    min-width: 150px;
}

.qbf-review-table th:nth-child(6),
.qbf-review-table td:nth-child(6) {
    width: 200px;
    min-width: 200px;
}

.qbf-review-table th:nth-child(7),
.qbf-review-table td:nth-child(7) {
    width: 100px;
    min-width: 100px;
}

.qbf-review-table th:nth-child(8),
.qbf-review-table td:nth-child(8) {
    width: 70px;
    min-width: 70px;
}

.qbf-review-table strong {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.qbf-review-panel.is-fullscreen {
    position: fixed;
    inset: 12px;
    width: auto;
    height: auto;
    margin: 0;
    z-index: 1200;
    border-radius: 10px;
    padding: 16px 16px 10px;
    background: rgba(255, 255, 255, 0.99);
    overflow: auto;
    box-shadow: 0 20px 64px rgba(10, 31, 68, 0.2);
}

.qbf-review-panel.is-fullscreen .qbf-review-table th:nth-child(2),
.qbf-review-panel.is-fullscreen .qbf-review-table td:nth-child(2) {
    max-width: none;
}

.qbf-review-panel.is-fullscreen .qbf-review-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: inset 0 -1px 0 var(--border-solid);
}

.qbf-combined-panel {
    padding: 12px;
}

/* ── Combined toolbar ─────────────────────── */
.qbf-combined-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.qbf-combined-toolbar-title {
    min-width: 160px;
}

.qbf-combined-toolbar-title h2 {
    margin: 0 0 2px;
}

.qbf-combined-toolbar-title p {
    margin: 0;
}

.qbf-combined-filter-bar {
    flex: 1 1 520px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.qbf-combined-filter-grid {
    display: grid;
    grid-template-columns: 160px 130px 1fr;
    gap: 10px;
    flex: 1 1 380px;
}

.qbf-combined-filter-grid .field-group {
    margin: 0;
}

.qbf-combined-filter-grid .field-group span {
    display: block;
    margin-bottom: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.qbf-combined-filter-grid input,
.qbf-combined-filter-grid select {
    min-height: 36px;
}

.qbf-combined-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: 1px;
}

.qbf-row-count {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ── Combined table wrapper ───────────────── */
.qbf-combined-table-wrap {
    width: 100%;
    max-height: 72vh;
    overflow: auto;
    border: 1px solid var(--border-solid);
    border-radius: 8px;
}

.qbf-combined-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    font-size: 0.78rem;
}

.qbf-combined-table th,
.qbf-combined-table td {
    padding: 7px 9px;
    min-width: 90px;
    max-width: 180px;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.qbf-combined-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg);
    box-shadow: inset 0 -1px 0 var(--border-solid);
}

.qbf-combined-table th:first-child,
.qbf-combined-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 116px;
    max-width: 116px;
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--border-solid);
}

.qbf-combined-table thead th:first-child {
    z-index: 5;
    background: var(--bg);
}

.qbf-combined-table td.is-wide {
    min-width: 200px;
    max-width: 320px;
}

.qbf-combined-table td.is-compact {
    min-width: 118px;
    max-width: 148px;
}

.qbf-combined-table td.is-number {
    min-width: 80px;
    max-width: 120px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.qbf-combined-table td.is-editable {
    min-width: 100px;
    background: rgba(255, 255, 255, 0.72);
}

.qbf-combined-table td.is-number.is-editable {
    min-width: 96px;
}

.qbf-combined-table tbody tr.qbf-combined-review-row td {
    background: #fff7ed;
}

.qbf-combined-table tbody tr.qbf-combined-review-row td:first-child {
    background: #ffedd5;
}

.qbf-combined-table tbody tr.qbf-combined-review-row td.is-editable {
    background: #fffbeb;
}

.qbf-combined-table td.is-locked {
    background: rgba(241, 245, 249, 0.78);
}

.qbf-combined-table input,
.qbf-combined-table select {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
}

.qbf-combined-table input:disabled,
.qbf-combined-table select:disabled {
    color: var(--text-muted);
    background: #f1f5f9;
    border-color: var(--border-solid);
    cursor: not-allowed;
}

.qbf-combined-table select {
    min-width: 0;
}

.qbf-combined-table td:first-child select {
    font-size: 0.72rem;
    padding: 5px 6px;
}

.qbf-match-reason {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qbf-combined-panel.is-fullscreen .qbf-combined-table-wrap {
    max-height: calc(100vh - 140px);
}

body.qbf-fullscreen-open {
    overflow: hidden;
}

/* Column group divider — applied via JS to the first "calculated" column */
.qbf-combined-table th.is-group-start,
.qbf-combined-table td.is-group-start {
    border-left: 2px solid var(--border-solid);
}

/* Filter: hidden rows */
.qbf-combined-table tbody tr[data-review-row].is-filtered-out {
    display: none;
}

/* Status badge chips in match column */
.qbf-match-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-bottom: 4px;
}

.qbf-match-badge.badge-matched     { background: #dcfce7; color: #166534; }
.qbf-match-badge.badge-inr-only    { background: #e0f2fe; color: #0369a1; }
.qbf-match-badge.badge-needs-review { background: #fef3c7; color: #92400e; }
.qbf-match-badge.badge-unmatched   { background: #fee2e2; color: #991b1b; }


/* ═══════════════════════════════════════
   FINANCIAL CHARTS
════════════════════════════════════════ */
.financial-report-card {
    display: grid;
    gap: 16px;
}

.financial-report-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.financial-report-header h2,
.financial-chart-card h3 {
    margin: 0;
}

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

.financial-chart-card {
    padding: 20px;
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.financial-doughnut-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

/* ── GST Summary Report ──────────────────────── */
.gst-report {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gst-section {
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    overflow: hidden;
}

/* Section label / heading strip */
.gst-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 16px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border-solid);
}

.gst-section-revenue .gst-section-label { color: var(--navy);   background: #f0f4ff; border-color: #dce6ff; }
.gst-section-output  .gst-section-label { color: #0369a1;       background: #f0f9ff; border-color: #bae6fd; }
.gst-section-net     .gst-section-label { color: #92400e;       background: #fffbeb; border-color: #fde68a; }

/* Individual row */
.gst-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-solid);
    gap: 12px;
}

.gst-row:last-child { border-bottom: none; }

.gst-row-name   { font-size: 0.875rem; }
.gst-row-amount { font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Detail rows */
.gst-row-detail .gst-row-name   { color: var(--text); }
.gst-row-detail .gst-row-amount { color: var(--text); }

/* Sub-rows (Courses / Client Invoices inside Total Taxable Revenue) */
.gst-row-sub {
    padding-left: 2rem;
    background: #fafbff;
}
.gst-row-sub .gst-row-name   { color: var(--muted, #6b7280); font-style: italic; }
.gst-row-sub .gst-row-amount { color: var(--muted, #6b7280); }

/* Hero (taxable revenue) row */
.gst-row-hero {
    background: #f8faff;
}

.gst-row-hero .gst-row-name   { font-weight: 500; }
.gst-row-hero .gst-row-amount { font-size: 1.05rem; font-weight: 700; color: var(--navy); }

/* Sub-total rows (e.g. Total GST collected) */
.gst-row-total {
    background: var(--bg);
    border-top: 2px solid var(--border-solid);
}

.gst-row-total .gst-row-name,
.gst-row-total .gst-row-amount {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--navy);
}

/* Net GST liability — most important row */
.gst-row-net {
    background: var(--navy);
    border-top: none;
}

.gst-row-net .gst-row-name,
.gst-row-net .gst-row-amount {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.financial-doughnut-header p {
    margin: 5px 0 0;
}

.financial-doughnut-total {
    font-size: 1rem;
    color: var(--navy);
    white-space: nowrap;
}

.financial-doughnut-card {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.financial-doughnut-wrap {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto;
}

.financial-doughnut-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.financial-doughnut-track,
.financial-doughnut-segment {
    fill: none;
    stroke-width: 13;
    transform-origin: 60px 60px;
    transform: rotate(-90deg);
}

.financial-doughnut-track {
    stroke: rgba(10, 31, 68, 0.07);
}

.financial-doughnut-segment {
    stroke-linecap: butt;
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
}

.financial-doughnut-segment:hover {
    stroke-width: 16;
    opacity: 0.96;
}

.financial-doughnut-empty {
    min-height: 200px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(10, 31, 68, 0.03);
    color: var(--muted);
    text-align: center;
    padding: 20px;
    font-size: 0.875rem;
}

.financial-doughnut-hole {
    position: absolute;
    inset: 50px;
    display: grid;
    place-content: center;
    gap: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.97);
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(10, 31, 68, 0.05);
}

.financial-doughnut-hole span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.financial-doughnut-hole strong {
    font-size: 1.05rem;
    color: var(--navy);
    font-family: "Familjen Grotesk", sans-serif;
}

.financial-doughnut-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
}

.financial-doughnut-legend-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    gap: 7px;
    align-items: center;
    padding: 6px 9px;
    border-radius: 6px;
    background: rgba(10, 31, 68, 0.025);
}

.financial-doughnut-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.financial-doughnut-label,
.financial-doughnut-value,
.financial-doughnut-meta {
    color: var(--navy);
    font-size: 0.8rem;
    font-weight: 700;
}

.financial-doughnut-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.financial-doughnut-meta {
    color: var(--muted);
    font-weight: 600;
}

.financial-chart-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.financial-chart-row {
    display: grid;
    grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.financial-chart-label,
.financial-chart-value {
    font-size: 0.875rem;
    color: var(--navy);
    font-weight: 700;
}

.financial-chart-track {
    height: 9px;
    border-radius: 999px;
    background: rgba(10, 31, 68, 0.07);
    overflow: hidden;
}

.financial-chart-bar {
    height: 100%;
    border-radius: 999px;
}

.financial-chart-bar.positive {
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
}

.financial-chart-bar.negative {
    background: linear-gradient(135deg, #d04b4b, #b42318);
}


/* ═══════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sidebar {
        display: none;
    }

    .main-area {
        height: auto;
        overflow: visible;
    }

    .page-content-wrap {
        overflow-y: visible;
        padding: 16px 18px 36px;
    }
}

@media (max-width: 768px) {
    .hero-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .entry-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .mode-grid,
    .app-grid,
    .qbf-upload-grid,
    .qbf-settings-grid,
    .qbf-metric-grid,
    .qbf-category-layout,
    .qbf-dashboard-metrics,
    .financial-chart-grid {
        grid-template-columns: 1fr;
    }

    .qbf-tab-strip {
        flex-wrap: wrap;
    }

    .qbf-review-toolbar {
        align-items: stretch;
    }

    .qbf-review-filter-grid,
    .qbf-review-toolbar-group {
        width: 100%;
    }

    .qbf-review-filter-grid {
        grid-template-columns: 1fr;
    }

    .financial-report-header,
    .financial-doughnut-header {
        flex-direction: column;
    }

    .financial-doughnut-legend {
        grid-template-columns: 1fr;
    }

    .financial-doughnut-wrap {
        width: 180px;
        height: 180px;
    }

    .financial-doughnut-hole {
        inset: 40px;
    }
}


/* ═══════════════════════════════════════
   HUB HOME PAGE
════════════════════════════════════════ */

.hub-welcome {
    margin-bottom: 22px;
}

.hub-welcome-title {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin: 2px 0 4px;
    line-height: 1.2;
}

.hub-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 18px;
    align-items: start;
}

.hub-section-title {
    font-size: 0.857rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

/* App grid */
.hub-app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.hub-app-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.18s, transform 0.18s;
}

.hub-app-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* App icon */
.hub-app-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.hub-app-icon--navy {
    background: linear-gradient(135deg, var(--navy-mid), var(--navy));
}

.hub-app-icon--gold {
    background: linear-gradient(135deg, #d4b07a, var(--gold));
}

.hub-app-name {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 5px;
}

.hub-app-desc {
    font-size: 0.857rem;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 14px;
}

/* Feature list */
.hub-app-features {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.hub-app-feature {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.843rem;
    color: var(--muted);
}

.hub-app-feature svg {
    color: var(--gold);
    flex-shrink: 0;
}

/* CTA button */
.hub-app-cta {
    align-self: flex-start;
    margin-top: auto;
}

.hub-app-cta--gold {
    background: linear-gradient(135deg, #d4b07a, var(--gold));
    color: var(--navy);
    border-color: transparent;
}

.hub-app-cta--gold:hover {
    background: linear-gradient(135deg, var(--gold), #b8893e);
    color: var(--navy);
}

/* Quick links panel */
.hub-panel {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.hub-panel-header {
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border-solid);
}

.hub-panel-title {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.857rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hub-panel-body {
    padding: 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hub-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 7px;
    font-size: 0.857rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.14s;
}

.hub-quick-link:hover {
    background: #eef2fb;
    color: var(--navy);
}

.hub-quick-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(10, 31, 68, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--navy);
}

/* Hub responsive */
@media (max-width: 900px) {
    .hub-layout {
        grid-template-columns: 1fr;
    }

    .hub-app-grid {
        grid-template-columns: 1fr;
    }
}


/* ═══════════════════════════════════════
   KPI CARDS (QBF DASHBOARD)
════════════════════════════════════════ */

.kpi-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.16s, transform 0.16s;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.kpi-card.k-gold::before  { background: var(--gold); }
.kpi-card.k-navy::before  { background: var(--navy); }
.kpi-card.k-green::before { background: #16a34a; }
.kpi-card.k-red::before   { background: #dc2626; }
.kpi-card.k-blue::before  { background: #0369a1; }

.kpi-eyebrow {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.kpi-value {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 7px;
}

.kpi-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
}

.t-up   { color: #16a34a; background: #f0fdf4; }
.t-down { color: #dc2626; background: #fef2f2; }
.t-flat { color: var(--muted); background: var(--bg); }


/* ═══════════════════════════════════════
   QBF DASHBOARD LAYOUT
════════════════════════════════════════ */

.db-sec-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.db-sec-title {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy);
    margin: 2px 0 0;
}

.db-reset-btn {
    font-size: 0.857rem;
    padding: 6px 12px;
    align-self: center;
}

/* ── Period matrix picker ──────────────────────────────────────────── */
.pm-wrap {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
}

.pm-all-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-solid);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    align-self: flex-start;
    margin-top: 2px;
}
.pm-all-btn:hover { background: var(--bg); color: var(--navy); }
.pm-all-btn.pm--active { background: var(--navy); color: #fff; border-color: var(--navy); }

.pm-fy-block {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.pm-fy-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-solid);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.pm-fy-tab:hover,
.pm-fy-tab--has-active { background: var(--bg); color: var(--navy); }
.pm-fy-block--open .pm-fy-tab { background: var(--navy); color: #fff; border-color: var(--navy); }

.pm-caret {
    transition: transform 0.2s;
    opacity: 0.7;
}
.pm-fy-block--open .pm-caret { transform: rotate(180deg); }

.pm-grid {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border-solid);
    border-radius: 8px;
    min-width: 340px;
}
.pm-fy-block--open .pm-grid { display: flex; }

.pm-fy-all-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    align-self: flex-start;
}
.pm-fy-all-link:hover { background: var(--surface); color: var(--navy); }
.pm-fy-all-link.pm--active { color: var(--navy); font-weight: 700; }

.pm-quarters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.pm-quarter-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-q-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 4px 3px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--navy);
    background: var(--surface);
    border: 1px solid var(--border-solid);
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    line-height: 1.2;
}
.pm-q-btn:hover { background: #dde5f0; }
.pm-q-btn.pm--active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pm-q-btn.pm--no-data { opacity: 0.35; pointer-events: none; }

.pm-q-range {
    font-size: 0.62rem;
    font-weight: 400;
    opacity: 0.75;
    margin-top: 1px;
}

.pm-month-row {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.pm-month-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 26px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border-solid);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}
.pm-month-btn:hover { background: #dde5f0; color: var(--navy); }
.pm-month-btn.pm--active { background: var(--gold); color: #fff; border-color: var(--gold); font-weight: 700; }
.pm-month-btn.pm--no-data { opacity: 0.3; pointer-events: none; }

/* ── Trend SVG charts ──────────────────────────────────────────────── */
.db-trend-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.db-trend-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.db-trend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Expense sparklines grid ───────────────────────────────────────── */
.db-sparklines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.db-spark-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border-solid);
    border-radius: 8px;
}

.db-spark-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.db-spark-cat {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-spark-total {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sp-trend-up { font-size: 0.7rem; color: #2f855a; }
.sp-trend-dn { font-size: 0.7rem; color: #c53030; }
.sp-trend-flat { font-size: 0.7rem; color: var(--text-secondary); }

.db-sparkline-svg { flex-shrink: 0; }

.db-period-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 10px;
    border-radius: 20px;
    background: var(--gold-soft);
    color: var(--gold);
    font-family: "Inter", sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.01em;
}

/* Charts two-column row */
.db-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* Generic dashboard card */
.db-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 14px;
}

.db-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px 11px;
    border-bottom: 1px solid var(--border-solid);
}

.db-card-title {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.93rem;
    font-weight: 700;
    color: var(--navy);
}

.db-card-meta {
    font-size: 0.857rem;
    color: var(--muted);
    font-weight: 600;
}

.db-card-body {
    padding: 16px 18px;
}

.db-card-body--table {
    padding: 0;
    overflow-x: auto;
}

.db-sm-btn {
    font-size: 0.857rem;
    padding: 5px 12px;
}

.db-empty {
    color: var(--muted);
    font-size: 0.857rem;
    text-align: center;
    padding: 24px 0;
    margin: 0;
}

/* ── Bank Income Split donut — side-by-side layout ──────────────────── */
.db-donut2-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 28px;
}

.db-donut2-ring {
    position: relative;
    width: 190px;
    height: 190px;
    flex-shrink: 0;
}

.db-donut2-svg {
    width: 190px;
    height: 190px;
    display: block;
}

.db-donut2-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.db-donut2-val {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}

.db-donut2-lbl {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Legend — vertical stack filling the remaining width */
.db-donut2-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-width: 0;
}

.db-donut2-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.db-donut2-item-hdr {
    display: flex;
    align-items: center;
    gap: 7px;
}

.db-donut2-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.db-donut2-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-donut2-nums {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 16px;
}

.db-donut2-amount {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--navy);
}

.db-donut2-pct {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 36px;
    text-align: right;
}

/* Proportion bar inside each legend row */
.db-donut2-bar-track {
    height: 5px;
    background: var(--border-solid);
    border-radius: 3px;
    margin-left: 16px;
    overflow: hidden;
}

.db-donut2-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Bar chart */
.db-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.db-bar-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.db-bar-hdr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.db-bar-lbl {
    font-size: 0.857rem;
    font-weight: 500;
    color: var(--text);
}

.db-bar-val {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.857rem;
    font-weight: 700;
    color: var(--navy);
}

.db-bar-track {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.db-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Currency revenue */
.db-currency-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.db-currency-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.db-currency-badge {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.db-currency-info {
    flex: 1;
    min-width: 0;
}

.db-currency-amount {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.93rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}

.db-currency-bar-wrap {
    height: 5px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}

.db-currency-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.db-currency-pct {
    font-size: 0.786rem;
    color: var(--muted);
}

/* Inner tables (inside db-card) */
.db-inner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.857rem;
}

.db-inner-table thead tr {
    border-bottom: 1px solid var(--border-solid);
}

.db-inner-table th {
    padding: 10px 16px;
    font-size: 0.786rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: transparent;
    white-space: nowrap;
}

.db-inner-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(10, 31, 68, 0.05);
    vertical-align: middle;
}

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

.db-inner-table tbody tr:hover td {
    background: #f8fafd;
}

.ta-r { text-align: right; }

.db-num {
    font-family: "Familjen Grotesk", sans-serif;
    font-weight: 700;
    color: var(--navy);
}

.db-muted { color: var(--muted) !important; font-weight: 500 !important; }
.db-income { color: #16a34a !important; }
.db-expense { color: #dc2626 !important; }

.db-month-name, .db-course-name {
    font-weight: 600;
    color: var(--navy);
}

/* Share bar in course table */
.db-share-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.db-share-bar-wrap {
    width: 60px;
    height: 5px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.db-share-bar {
    height: 100%;
    background: var(--navy);
    border-radius: 3px;
}

.db-share-pct {
    font-size: 0.786rem;
    color: var(--muted);
    min-width: 36px;
    text-align: right;
}

/* Badges for margin/review */
.db-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.786rem;
    font-weight: 700;
}

.db-badge--green { color: #15803d; background: #f0fdf4; }
.db-badge--gold  { color: #92400e; background: #fffbeb; }
.db-badge--grey  { color: var(--muted); background: var(--bg); }
.db-badge--red   { color: #b91c1c; background: #fef2f2; }

/* Top countries card */
.db-country-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.db-country-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.db-country-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.db-country-info {
    flex: 1;
    min-width: 0;
}

.db-country-name-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.db-country-name {
    font-size: 0.857rem;
    font-weight: 600;
    color: var(--text);
}

.db-country-amount {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 0.857rem;
    font-weight: 700;
    color: var(--navy);
}

.db-country-pct {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 3px;
}

/* Enrolment breakdown card */
.db-enrol-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.db-enrol-stats {
    display: flex;
    align-items: center;
    gap: 0;
}

.db-enrol-stat {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
}

.db-enrol-divider {
    width: 1px;
    height: 48px;
    background: var(--border-solid);
    flex-shrink: 0;
}

.db-enrol-number {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 4px;
}

.db-enrol-number--new { color: #16a34a; }
.db-enrol-number--ret { color: #0369a1; }

.db-enrol-label {
    font-size: 0.786rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 2px;
}

.db-enrol-pct {
    font-size: 0.857rem;
    font-weight: 700;
    color: var(--muted);
}

.db-enrol-bar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.db-enrol-bar-track {
    height: 28px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

.db-enrol-bar-new {
    height: 100%;
    background: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.786rem;
    font-weight: 700;
    color: #ffffff;
    transition: width 0.4s ease;
    min-width: 0;
}

.db-enrol-bar-ret {
    height: 100%;
    background: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.786rem;
    font-weight: 700;
    color: #ffffff;
    transition: width 0.4s ease;
    min-width: 0;
}

.db-enrol-legend {
    display: flex;
    align-items: center;
    font-size: 0.786rem;
    color: var(--muted);
}

.db-enrol-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.db-enrol-dot--new { background: #16a34a; }
.db-enrol-dot--ret { background: #0369a1; }

/* Responsive */
@media (max-width: 900px) {
    .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .db-charts-row { grid-template-columns: 1fr; }
    .db-enrol-stats { flex-direction: column; gap: 12px; }
    .db-enrol-divider { width: 100%; height: 1px; }
}

/* ── Revenue Share ─────────────────────────────────────────────────────────── */

.rs-instructor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.rs-instructor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.rs-instructor-card:hover {
    box-shadow: 0 4px 16px rgba(23,56,119,.10);
    border-color: var(--brand-mid);
}

.rs-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rs-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-dark);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rs-card-info {
    flex: 1;
    min-width: 0;
}
.rs-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rs-card-email {
    font-size: 12px;
    margin-top: 2px;
}

.rs-card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.rs-card-meta-row {
    display: flex;
    gap: 14px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    flex-wrap: wrap;
}
.rs-meta-item {
    font-size: 12px;
    color: var(--text-muted);
}
.rs-meta-item strong {
    color: var(--text-primary);
}

/* Period link in tables */
.rs-period-link {
    font-weight: 500;
    color: var(--brand-mid);
    text-decoration: none;
}
.rs-period-link:hover { text-decoration: underline; }

/* Verified / paid status icons */
.rs-status-tick {
    display: inline-flex;
    align-items: center;
    color: var(--green);
    font-weight: 700;
}
.rs-status-pending {
    color: var(--text-muted);
}

/* Verified button (green outline when active) */
.rs-verified-btn {
    color: var(--green);
    border-color: var(--green);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.rs-verified-btn:hover {
    background: rgba(47,133,90,.08);
}

/* Status row under hero */
.rs-status-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 2px;
}
.rs-pill-verified {
    background: rgba(47,133,90,.12);
    color: var(--green);
    border: 1px solid rgba(47,133,90,.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rs-pill-paid {
    background: rgba(23,56,119,.10);
    color: var(--brand-mid);
    border: 1px solid rgba(23,56,119,.2);
}

/* Total row in period detail table */
.rs-total-row td {
    background: var(--brand-dark);
    color: #fff;
    border-top: 2px solid var(--brand-mid);
}
.rs-total-row td strong { color: #fff; }
.rs-total-final strong {
    color: #f5c842 !important;
    font-size: 15px;
}
/* Bundle proration sub-rows */
.rs-bundle-row td {
    background: var(--surface-2, #f8fafc);
    border-top: none;
    border-bottom: 1px dashed var(--border-solid);
}
.rs-bundle-row:last-of-type td { border-bottom: none; }

/* Final earnings summary card */
.rs-final-card {
    background: linear-gradient(135deg, var(--brand-dark) 0%, #1e3f7a 100%);
    border-color: var(--brand-mid);
}
.rs-final-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.rs-final-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rs-final-item--total {
    margin-left: auto;
    text-align: right;
}
.rs-final-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.6);
}
.rs-final-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.rs-final-value--big {
    font-size: 28px;
    color: var(--gold);
}
.rs-final-sep {
    color: rgba(255,255,255,.5);
    font-size: 13px;
}
.rs-final-adj {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 13px;
    color: #fff;
}
.rs-final-adj--deduct {
    background: rgba(220,60,60,.18);
    border-color: rgba(220,60,60,.35);
    color: #ffaaaa;
}

/* Formset rows in instructor form */
.rs-formset-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.rs-formset-row:last-child { border-bottom: none; }
.rs-formset-fields {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 12px;
    flex: 1;
}
.rs-formset-delete {
    padding-top: 24px;
}
.rs-delete-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--danger);
    cursor: pointer;
}
.rs-delete-label input[type="checkbox"] {
    accent-color: var(--danger);
}

/* ta-r helper (right-align) — may already exist */
.ta-r { text-align: right; }
.db-muted { color: var(--text-muted); font-size: 12px; }


/* ═══════════════════════════════════════
   PRICE TRACKER DASHBOARD
════════════════════════════════════════ */

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.pt-hero {
    align-items: flex-start;
    padding: 20px 24px 18px;
    gap: 16px;
}

.pt-hero-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pt-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.pt-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}
.pt-breadcrumb a:hover { color: var(--navy); }
.pt-breadcrumb-sep { opacity: .5; }

.pt-hero-title {
    font-size: 1.5rem;
    margin: 0;
}

.pt-hero-meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0;
}

/* ── KPI stat cards ───────────────────────────────────────────────────────── */
.pt-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.pt-stat-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.pt-stat-card {
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    padding: 12px 16px 14px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.pt-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 10px 10px 0 0;
}
.pt-stat-navy::before  { background: var(--navy); }
.pt-stat-gold::before  { background: var(--gold); }
.pt-stat-teal::before  { background: #0891b2; }
.pt-stat-green::before { background: #16a34a; }

.pt-stat-eyebrow {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 5px;
}

.pt-stat-value {
    font-family: "Familjen Grotesk", sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 4px;
}

.pt-stat-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Inline filter bar ────────────────────────────────────────────────────── */
.pt-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}

.pt-filter-search {
    position: relative;
    flex: 1 1 200px;
    min-width: 180px;
}

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

.pt-filter-search-input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--border-solid);
    border-radius: 7px;
    font-size: 0.875rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.pt-filter-search-input:focus {
    border-color: var(--navy);
    background: var(--surface);
}
.pt-filter-search-input::placeholder { color: var(--muted); }

.pt-filter-select {
    padding: 7px 28px 7px 10px;
    border: 1px solid var(--border-solid);
    border-radius: 7px;
    font-size: 0.875rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6a8a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    transition: border-color 0.15s;
}
.pt-filter-select:focus { border-color: var(--navy); }

.pt-filter-clear {
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.pt-filter-clear:hover { color: var(--navy); background: var(--bg); }

/* ── Course table ─────────────────────────────────────────────────────────── */
.pt-table th { background: var(--bg); }

.pt-th-sub {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--muted);
    margin-top: 1px;
}

.pt-course-name {
    font-weight: 600;
    color: var(--navy);
}

/* Type badges */
.pt-type-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.pt-type-flagship    { background: rgba(197,157,95,.15); color: #7a5a1a; }
.pt-type-professional { background: rgba(10,31,68,.09);  color: var(--navy); }
.pt-type-foundation  { background: rgba(3,105,161,.1);   color: #0369a1; }

/* Mode badges */
.pt-mode-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.pt-mode-individual { background: rgba(10,31,68,.06); color: var(--muted); }
.pt-mode-package    { background: rgba(22,163,74,.12); color: #15803d; }

/* Price cells */
.pt-price-cell { white-space: nowrap; }

.pt-price {
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    color: var(--navy);
    font-weight: 500;
}

.pt-discount-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(220,38,38,.1);
    color: #b91c1c;
    vertical-align: middle;
}

.pt-price-na { color: var(--muted); font-size: 0.85rem; }

.pt-date-cell {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

.pt-action-col {
    width: 44px;
    text-align: center;
}

/* Table footer / pagination */
.pt-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border-solid);
    background: var(--bg);
    border-radius: 0 0 10px 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.pt-table-count {
    font-size: 0.8rem;
    color: var(--muted);
}

.pt-pagination {
    display: flex;
    gap: 6px;
}

.pt-page-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-solid);
    background: var(--surface);
    color: var(--navy);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}
.pt-page-btn:hover { background: var(--navy); color: white; border-color: var(--navy); }
.pt-page-btn--disabled {
    color: var(--muted);
    background: transparent;
    border-color: var(--border-solid);
    cursor: not-allowed;
    pointer-events: none;
    opacity: .5;
}

/* ── Notice banners ──────────────────────────────────────────────────────────
   Usage: <div class="notice-banner notice-warning">…</div>
   Variants: notice-warning | notice-info | notice-success | notice-danger
   ───────────────────────────────────────────────────────────────────────── */
.notice-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 0.875rem;
    line-height: 1.55;
    border: 1px solid var(--border-solid);
    background: var(--surface);
    color: var(--text);
}
.notice-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}
.notice-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}
.notice-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}
.notice-info {
    background: #e8f0fe;
    border-color: #93b4f5;
    color: #1e3a7c;
}

/* ── Toggle switch ───────────────────────────────────────────────────────────
   Usage:
   <label class="toggle-switch" for="id">
     <input type="checkbox" id="id">
     <span class="toggle-slider"></span>
   </label>
   ───────────────────────────────────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-solid);
    border-radius: 999px;
    transition: background 0.2s;
}
.toggle-slider::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: left 0.2s;
}
.toggle-switch input:checked ~ .toggle-slider {
    background: var(--navy);
}
.toggle-switch input:checked ~ .toggle-slider::after {
    left: calc(100% - 21px);
}
.toggle-switch input:focus-visible ~ .toggle-slider {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* ── Toggle row (label + toggle side-by-side) ───────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.toggle-row-text {
    flex: 1;
    min-width: 0;
}
.toggle-row-text .muted {
    font-size: 0.825rem;
}


/* ── Version / Release Notes ─────────────────────────────────────────────── */
.version-current-header {
    margin-bottom: 4px;
}

.version-change-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
}

.version-history-list {
    display: flex;
    flex-direction: column;
}

.version-history-item {
    border-bottom: 1px solid var(--border);
}

.version-history-item:last-child {
    border-bottom: none;
}

.version-history-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.version-history-summary::-webkit-details-marker { display: none; }

.version-history-summary:hover {
    background: var(--bg);
    border-radius: 6px;
}

.version-history-name {
    flex-shrink: 0;
    min-width: 72px;
}

.version-history-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.875rem;
}

.version-history-date {
    flex-shrink: 0;
    font-size: 0.8rem;
    min-width: 80px;
    text-align: right;
}

.version-history-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.2s;
}

details[open] .version-history-chevron {
    transform: rotate(180deg);
}

.version-history-body {
    padding: 4px 4px 16px 4px;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text);
}

/* ── Markdown toolbar ────────────────────────────────────────────────────── */
.md-toolbar {
    display: flex;
    gap: 3px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.md-btn {
    padding: 2px 8px;
    border: 1px solid var(--border-solid);
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.76rem;
    cursor: pointer;
    color: var(--text);
    line-height: 1.6;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
}

.md-btn:hover {
    background: var(--bg);
    border-color: var(--navy);
}

.md-btn b { font-weight: 800; }
.md-btn i { font-style: italic; }

/* Rendered markdown in views */
.md-body { font-size: 0.9rem; line-height: 1.7; }
.md-body p { margin: 0 0 6px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body strong { font-weight: 700; }
.md-body em { font-style: italic; }
.md-body ul, .md-body ol { margin: 4px 0 6px 20px; padding: 0; }
.md-body li { margin-bottom: 2px; }
