/* ── Theme variables ─────────────────────────────────────────── */
:root {
    --bg:         #f4f6fa;
    --surface:    #ffffff;
    --text:       #1a1f2e;
    --text-muted: #6b7280;
    --border:     #e5e7eb;
    --primary:    #4ba8d8;
    --primary-h:  #2e8bbf;
    --danger:     #ef4444;
    --radius:     10px;
    --shadow:     0 4px 24px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --bg:         #0f1117;
    --surface:    #1a1f2e;
    --text:       #f1f5f9;
    --text-muted: #94a3b8;
    --border:     #2d3748;
    --primary:    #5ec4f0;
    --primary-h:  #4ba8d8;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}
a.topbar-logo:hover { opacity: .8; }

.topbar-logo img {
    height: 30px;
    width: auto;
}

.topbar-logo-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
    margin-left: 8px;
}

/* ── Theme-aware logo switching ──────────────────────────────── */
.logo-img-dark  { display: none; }
.logo-img-light { display: block; }

[data-theme="dark"] .logo-img-dark  { display: block; }
[data-theme="dark"] .logo-img-light { display: none; }

/* ── Access Denied page ──────────────────────────────────────── */
.access-denied-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 58px);
    padding: 48px 16px;
}

.access-denied-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 40px;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.access-denied-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
}

.access-denied-logo img {
    height: 48px;
    width: auto;
}

.centered-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.access-denied-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.access-denied-icon-wrap.lock {
    background: rgba(75, 168, 216, 0.12);
    color: var(--primary);
}

.access-denied-icon-wrap.forbidden {
    background: rgba(239, 68, 68, 0.10);
    color: var(--danger);
}

.access-denied-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.access-denied-card p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 360px;
}

.access-denied-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.error-code-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 12px;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* wider card when crash report section is present */
.access-denied-card--wide { max-width: 560px; }

/* ── Crash report section ────────────────────────────────────── */
.error-report-section {
    width: 100%;
    margin-top: 28px;
}

.error-report-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.error-report-divider::before,
.error-report-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.error-report-intro {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px !important;
    text-align: left;
}

.error-ref-code {
    display: inline-block;
    font-family: monospace;
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 4px;
    color: var(--primary);
}

.error-report-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    text-align: left;
}

.error-report-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.15s;
}

.error-report-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.error-report-textarea::placeholder { color: var(--text-muted); }

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    align-self: flex-start;
}

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

.error-report-sent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(75, 168, 216, 0.08);
    border: 1px solid rgba(75, 168, 216, 0.3);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Page wrap ───────────────────────────────────────────────── */
.page-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 58px);
    padding: 48px 16px;
}

/* ── Auth card ───────────────────────────────────────────────── */
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ── Form ────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border 0.15s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ── .form-input — admin/module shared input/select/textarea class ── */
.form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border 0.15s;
}
.form-input:focus   { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.btn-primary:hover { background: var(--primary-h); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 7px 14px;
}

.btn-ghost:hover { background: var(--bg); }

.btn-google {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
    padding: 11px;
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-google:hover { background: var(--bg); }

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Success message ─────────────────────────────────────────── */
.success-msg {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

[data-theme="dark"] .success-msg {
    background: #052e16;
    border-color: #14532d;
}

/* ── Error message ───────────────────────────────────────────── */
.error-msg {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

[data-theme="dark"] .error-msg {
    background: #2d1515;
    border-color: #7f1d1d;
}

/* ── Footer link ─────────────────────────────────────────────── */
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ── Dashboard page ──────────────────────────────────────────── */
.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 40px;
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.dashboard-card .check-icon {
    width: 56px;
    height: 56px;
    background: #ecfdf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #10b981;
}

[data-theme="dark"] .dashboard-card .check-icon {
    background: #064e3b;
}

.dashboard-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.dashboard-card p {
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 14px;
}

/* ── Theme dropdown ──────────────────────────────────────────── */
.theme-dropdown { position: relative; }

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.theme-toggle-btn:hover { background: var(--bg); }

.theme-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 130px;
    z-index: 999;
    overflow: hidden;
}

.theme-menu.open { display: block; }

.theme-option {
    display: block;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}

.theme-option:hover { background: var(--bg); }
.theme-option.active { color: var(--primary); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   BRAND PALETTE (Auditra)
═══════════════════════════════════════════════════════════════ */
:root {
    --brand-blue:   #4ba8d8;
    --brand-green:  #52967a;
    --brand-gold:   #c49020;
    --brand-ink:    #1c2a38;
}

/* ═══════════════════════════════════════════════════════════════
   FORM EXTRAS (selects, row layout, actions)
═══════════════════════════════════════════════════════════════ */
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select:focus { border-color: var(--primary); }

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

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════════
   ONBOARDING
═══════════════════════════════════════════════════════════════ */
.onboarding-card  { max-width: 540px; }
.onboarding-wide  { max-width: 680px; }

.onboarding-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 6px;
}

.step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    flex-shrink: 0;
}

.step.active {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    background: #eff8ff;
}

.step.done {
    border-color: var(--brand-green);
    background: var(--brand-green);
    color: #fff;
}

[data-theme="dark"] .step.active { background: #0d2a38; }

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
}

.step-line.done { background: var(--brand-green); }

.onboarding-step-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Gap assessment ──────────────────────────────────────────── */
.gap-domain {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg);
}

.gap-domain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.gap-domain-name   { font-weight: 700; font-size: 15px; }
.gap-domain-weight { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.gap-question {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.gap-q-text    { font-size: 14px; margin-bottom: 10px; line-height: 1.5; }
.gap-q-options { display: flex; gap: 10px; }

.gap-option {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: border 0.12s, background 0.12s;
}

.gap-option:has(input:checked) { border-color: var(--brand-blue); background: #eff8ff; }
[data-theme="dark"] .gap-option:has(input:checked) { background: #0d2a38; }

/* Hide radio inputs but keep them reachable for browser validation and label activation */
.gap-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.gap-option-yes { color: var(--brand-green); }
.gap-option-no  { color: var(--danger); }

/* Locked question (auto-verified) */
.gap-question-locked {
    background: rgba(82,150,122,0.06);
    border-radius: 8px;
    padding: 12px;
    margin: 0 -12px;
}
[data-theme="dark"] .gap-question-locked { background: rgba(82,150,122,0.09); }

/* Auto-verified badge */
.gap-auto-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--brand-green);
    background: rgba(82,150,122,0.10);
    border: 1px solid rgba(82,150,122,0.28);
    border-radius: 100px;
    padding: 3px 10px;
}

/* Auto-verified notice banner at top of form */
.gap-auto-notice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(82,150,122,0.07);
    border: 1px solid rgba(82,150,122,0.25);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.5;
}
.gap-auto-notice svg { flex-shrink: 0; margin-top: 1px; color: var(--brand-green); }
[data-theme="dark"] .gap-auto-notice { background: rgba(82,150,122,0.10); }

/* Results view: highlight the selected answer */
.gap-option-selected {
    border-color: var(--brand-blue);
    background: #eff8ff;
}
[data-theme="dark"] .gap-option-selected { background: #0d2a38; }

/* Non-compliant "No" answer — red selected option */
.gap-option-selected-no {
    border-color: #dc2626 !important;
    background: #fff1f1 !important;
}
[data-theme="dark"] .gap-option-selected-no { background: #2d0a0a !important; }

/* Non-compliant question row in results view */
.gap-question-noncompliant {
    border-left: 3px solid #dc2626;
    padding-left: 12px;
    margin-left: -15px;
    background: rgba(220,38,38,0.03);
    border-radius: 0 6px 6px 0;
}
[data-theme="dark"] .gap-question-noncompliant { background: rgba(220,38,38,0.06); }

/* Non-compliant badge */
.gap-noncompliant-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #dc2626;
    background: rgba(220,38,38,0.08);
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 100px;
    padding: 3px 10px;
}
[data-theme="dark"] .gap-noncompliant-badge { background: rgba(220,38,38,0.14); }

/* Row wrapping badge + edit toggle */
.gap-manual-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* "Mark as resolved" / "Edit" toggle button */
.gap-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 100px;
    padding: 3px 10px;
    cursor: pointer;
    border: 1px solid;
    background: transparent;
    transition: background 0.15s;
}
.gap-edit-toggle-resolve {
    color: var(--brand-green);
    border-color: rgba(82,150,122,0.35);
}
.gap-edit-toggle-resolve:hover { background: rgba(82,150,122,0.10); }
.gap-edit-toggle-change {
    color: var(--text-muted);
    border-color: var(--border);
}
.gap-edit-toggle-change:hover { background: var(--surface-2); }


/* ═══════════════════════════════════════════════════════════════
   DASHBOARD SHELL
═══════════════════════════════════════════════════════════════ */
.dash-shell {
    display: flex;
    height: calc(100vh - 58px);
}

.dash-sidebar {
    width: 228px;
    min-width: 228px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    overflow-y: auto;
}

.dash-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

/* ── Sidebar links ─────────────────────────────────────────────── */
.sidebar-section { padding: 0 10px; margin-bottom: 4px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13.5px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 7px;
    margin: 1px 8px;
    transition: background 0.12s, color 0.12s;
}

.sidebar-link:hover  { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: #eff8ff; color: var(--brand-blue); font-weight: 600; }
[data-theme="dark"] .sidebar-link.active { background: #0d2a38; }

.sidebar-link-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}
.sidebar-link-disabled:hover { background: transparent !important; color: var(--text-muted) !important; }

/* Fixed-position tooltip for disabled sidebar items */
.sidebar-tip {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    white-space: normal;
    max-width: 240px;
    text-align: center;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.sidebar-tip.visible { opacity: 1; }

.sidebar-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 24px 4px;
}

.sidebar-spacer { flex: 1; }

.sidebar-upgrade {
    color: #fff;
    background: linear-gradient(135deg, #4ba8d8, #2e8bbf);
    border: 1px solid #2e8bbf;
    margin: 8px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 2px 8px rgba(75,168,216,.35);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.sidebar-upgrade:hover {
    background: linear-gradient(135deg, #2e8bbf, #1a6f9f);
    color: #fff;
    box-shadow: 0 4px 14px rgba(75,168,216,.5);
    transform: translateY(-1px);
}

[data-theme="dark"] .sidebar-upgrade {
    color: #fff;
    background: linear-gradient(135deg, #1a6f9f, #0e5580);
    border-color: #4ba8d8;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

[data-theme="dark"] .sidebar-upgrade:hover {
    background: linear-gradient(135deg, #2e8bbf, #1a6f9f);
    color: #fff;
    box-shadow: 0 4px 14px rgba(75,168,216,.3);
}

/* ── Trial banner ─────────────────────────────────────────────── */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, #e8f5fd, #d0ecf9);
    border: 1px solid #4ba8d8;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #1c2a38;
    flex-wrap: wrap;
}

[data-theme="dark"] .trial-banner {
    background: linear-gradient(90deg, #0d2233, #0a1c2d);
    border-color: #4ba8d8;
    color: #e2f4fc;
}

.trial-banner-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #4ba8d8, #2e8bbf);
    color: #fff !important;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(75,168,216,.4);
    transition: background .15s, box-shadow .15s, transform .1s;
}

.trial-banner-btn:hover {
    background: linear-gradient(135deg, #2e8bbf, #1a6f9f);
    box-shadow: 0 4px 12px rgba(75,168,216,.5);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD CONTENT
═══════════════════════════════════════════════════════════════ */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    margin-bottom: 24px;
    color: #92400e;
}

[data-theme="dark"] .trial-banner { background: #1c1600; border-color: #92400e; color: #fde68a; }
.trial-banner a { color: var(--brand-gold); font-weight: 600; }

/* ── Locked / gated button ────────────────────────────────────── */
.btn-locked {
    opacity: 0.55;
    cursor: pointer;
    filter: grayscale(30%);
}
.btn-locked:hover {
    opacity: 0.75;
    filter: none;
}

/* ── Sidebar lock icon ────────────────────────────────────────── */
.sidebar-lock-icon {
    margin-left: auto;
    opacity: 0.5;
    flex-shrink: 0;
}

.sidebar-link-disabled {
    cursor: pointer;
}

/* ── Upsell modal ─────────────────────────────────────────────── */
.upsell-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.upsell-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 28px 28px;
    max-width: 380px;
    width: 100%;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: upsell-in .18s ease;
}

@keyframes upsell-in {
    from { transform: translateY(12px) scale(.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.upsell-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.upsell-close:hover { color: var(--text); }

.upsell-icon {
    margin: 0 auto 14px;
    width: 56px;
    height: 56px;
    background: color-mix(in srgb, var(--primary) 12%, var(--bg));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upsell-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.upsell-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 22px;
}

.upsell-cta-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 11px 24px;
    font-size: 15px;
    font-weight: 700;
}

.dash-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.dash-welcome-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.dash-welcome-sub   { font-size: 14px; color: var(--text-muted); }

.dash-score-pill {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.score-num   { font-size: 28px; font-weight: 800; }
.score-label { font-size: 13px; color: var(--text-muted); }

/* ── Module grid ─────────────────────────────────────────────── */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
    position: relative;
}

.module-card:hover:not(.module-locked):not(.module-disabled) {
    box-shadow: 0 6px 28px rgba(75, 168, 216, 0.14);
    transform: translateY(-2px);
    border-color: #b3d9f0;
}

.module-card.module-locked {
    opacity: 0.55;
    cursor: default;
}

.module-card.module-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
}
.module-card:hover:not(.module-locked):not(.module-disabled) {
    box-shadow: 0 6px 28px rgba(75, 168, 216, 0.14);
    transform: translateY(-2px);
    border-color: #b3d9f0;
}
.module-disabled-badge {
    margin-top: auto;
    padding-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.module-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.gap-icon    { background: #eff8ff; color: var(--brand-blue); }
.vault-icon  { background: #f0fdf4; color: var(--brand-green); }
.staff-icon  { background: #f5f3ff; color: #7c3aed; }
.audit-icon  { background: #fff7ed; color: #ea580c; }
.breach-icon { background: #fef2f2; color: #dc2626; }
.ipc-icon    { background: #fefce8; color: var(--brand-gold); }

[data-theme="dark"] .gap-icon    { background: #0d2a38; }
[data-theme="dark"] .vault-icon  { background: #0a2018; }
[data-theme="dark"] .staff-icon  { background: #1e1030; }
[data-theme="dark"] .audit-icon  { background: #1c1008; }
[data-theme="dark"] .breach-icon  { background: #2d1515; }
[data-theme="dark"] .ipc-icon    { background: #1c1600; }
.vendor-icon  { background: #eff6ff; color: #2563eb; }
.ppcheck-icon { background: #fdf4ff; color: #9333ea; }
[data-theme="dark"] .vendor-icon  { background: #0d1e38; }
[data-theme="dark"] .ppcheck-icon { background: #1e0d38; }

.module-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.module-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }

.module-stat {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
}

.module-limit-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-gold);
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 100px;
    padding: 3px 10px;
    display: inline-block;
}

[data-theme="dark"] .module-limit-badge { background: #1c1600; border-color: #92400e; }

.module-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 3px 10px;
}

/* ── Risk band colours ───────────────────────────────────────── */
.band-strong   .score-num,
.band-strong   .module-stat { color: var(--brand-green); }
.band-strong               { border-color: #bbf7d0 !important; }

.band-moderate .score-num,
.band-moderate .module-stat { color: var(--brand-blue); }

.band-high     .score-num,
.band-high     .module-stat { color: var(--brand-gold); }
.band-high                  { border-color: #fde68a !important; }

.band-critical .score-num,
.band-critical .module-stat { color: #dc2626; }
.band-critical              { border-color: #fecaca !important; }

.band-none .score-label { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   POLICY VAULT
═══════════════════════════════════════════════════════════════ */
.pv-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.plan-limit-note {
    font-size: 13px;
    color: var(--brand-gold);
    margin-left: 8px;
}
.plan-limit-note a { color: var(--brand-gold); font-weight: 600; }

.pv-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Status badges */
.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    display: inline-block;
    white-space: nowrap;
}
.status-current  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-review   { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.status-expired  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status-missing  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.status-archived { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

[data-theme="dark"] .status-current  { background: #052e16; border-color: #14532d; }
[data-theme="dark"] .status-review   { background: #1c1600; border-color: #713f12; }
[data-theme="dark"] .status-expired  { background: #2d1515; border-color: #7f1d1d; }

/* Policy Vault grid */
.pv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.pv-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: box-shadow 0.15s;
}

.pv-card:hover  { box-shadow: 0 4px 20px rgba(75,168,216,0.10); }

.pv-card-locked { opacity: 0.6; }

.pv-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.pv-cat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0fdf4;
    color: var(--brand-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .pv-cat-icon { background: #0a2018; }

.pv-cat-name { font-size: 14px; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.pv-cat-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }

.pv-ipc-note {
    display: flex;
    gap: 7px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    border-left: 3px solid var(--brand-blue);
    border-radius: 0 6px 6px 0;
    padding: 8px 10px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.pv-ipc-note svg { flex-shrink: 0; margin-top: 1px; color: var(--brand-blue); }

.pv-doc-info {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg);
}

.pv-doc-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    word-break: break-all;
}

.pv-doc-meta  { font-size: 12px; color: var(--text-muted); }
.pv-doc-notes { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic; }

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

.pv-btn-sm {
    font-size: 12px;
    padding: 6px 12px;
}

.pv-btn-muted { color: var(--text-muted); }

.pv-upload-btn {
    width: 100%;
    justify-content: center;
    margin-top: auto;
}

.pv-locked-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: auto;
}

.pv-locked-msg a { color: var(--brand-blue); }

/* Upload page */
.pv-upload-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.pv-upload-breadcrumb a { color: var(--brand-blue); text-decoration: none; }

.pv-version-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #eff8ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    color: #075985;
}

[data-theme="dark"] .pv-version-notice { background: #0d2a38; border-color: #0369a1; color: #7dd3fc; }

.form-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border 0.15s;
}
.form-textarea:focus { border-color: var(--primary); }

.pv-dropzone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.pv-dropzone:hover,
.pv-dropzone-hover { border-color: var(--brand-blue); background: #f0f9ff; }
[data-theme="dark"] .pv-dropzone:hover,
[data-theme="dark"] .pv-dropzone-hover { background: #0d2a38; }

.pv-dropzone svg   { color: var(--text-muted); margin-bottom: 10px; }
.pv-dropzone p     { font-size: 14px; color: var(--text-muted); margin: 0; }

.pv-browse-link { color: var(--brand-blue); cursor: pointer; font-weight: 600; }

.pv-dropzone-ready { border-color: var(--brand-green); background: #f0fdf4; }
[data-theme="dark"] .pv-dropzone-ready { background: #0a2018; }

.pv-selected-file {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-green);
    margin-top: 8px !important;
}

/* History page */
.pv-history-list { display: flex; flex-direction: column; gap: 12px; }

.pv-history-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.pv-history-archived { opacity: 0.6; }

.pv-history-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.pv-history-version {
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.pv-history-title   { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.pv-history-details { font-size: 12px; color: var(--text-muted); }

.pv-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 48px;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS PAGE
═══════════════════════════════════════════════════════════════ */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

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

.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}

.settings-row-text { flex: 1; }

.settings-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
}

.settings-hint {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-sub-row {
    padding-left: 36px;
    background: var(--bg);
    transition: opacity 0.15s;
}

/* Toggle switch */
.toggle { position: relative; display: inline-block; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
    display: flex;
    align-items: center;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.toggle input:checked + .toggle-track { background: var(--brand-blue); }

.toggle-thumb {
    position: absolute;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }

/* ── Module progress bars ─────────────────────────────────────── */
.module-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
}

.module-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}

.module-progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.4s ease;
}

.module-progress-pct {
    font-size: 13px;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}

.module-progress-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ── Compliance Health Card ───────────────────────────────────── */
.health-card {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 28px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

/* Ring column */
.health-ring-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 180px;
}

.health-card-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.health-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 14px;
}

.health-ring-svg {
    display: block;
    filter: drop-shadow(0 2px 8px rgba(75,168,216,0.15));
}

.health-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.health-ring-num {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.health-ring-denom {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.2;
}

.health-ring-band {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 100px;
}

.health-ring-none {
    font-size: 32px;
    color: var(--text-muted);
    font-weight: 300;
}

.health-clinic-name {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Divider */
.health-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 0 36px;
    flex-shrink: 0;
}

/* Domains column */
.health-domains-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.health-domains-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.health-domain-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.health-domain-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.health-domain-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    min-width: 140px;
}

.health-domain-track {
    flex: 1;
    height: 7px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}

.health-domain-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.5s ease;
}

.health-domain-pct {
    font-size: 12px;
    font-weight: 700;
    min-width: 34px;
    text-align: right;
}

/* Empty state */
.health-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Band pill colours inside ring */
.health-ring-band.band-strong   { background: rgba(82,150,122,0.12); color: var(--brand-green); }
.health-ring-band.band-moderate { background: rgba(75,168,216,0.12); color: var(--brand-blue);  }
.health-ring-band.band-high     { background: rgba(196,144,32,0.12); color: var(--brand-gold);  }
.health-ring-band.band-critical { background: rgba(220,38,38,0.12);  color: #dc2626;             }
.health-ring-band.band-none     { background: var(--border);          color: var(--text-muted);  }

/* Responsive */
@media (max-width: 768px) {
    .health-card {
        flex-direction: column;
        padding: 24px 20px;
        gap: 24px;
    }

    .health-divider {
        width: 100%;
        height: 1px;
        margin: 0;
    }

    .health-domain-name { min-width: 110px; }
}

/* ── Staff & Access module ────────────────────────────────────── */

/* Stats row */
.staff-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.staff-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.staff-stat-num {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.staff-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Table */
.staff-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.staff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.staff-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.staff-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.staff-table tbody tr:hover { background: var(--bg); }

.staff-row-inactive td { opacity: 0.55; }

/* Avatar + name cell */
.staff-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

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

/* Access badge */
.staff-access-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

/* Status badges */
.staff-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active     { background: rgba(82,150,122,0.12); color: var(--brand-green); }
.badge-inactive   { background: var(--border);          color: var(--text-muted);  }
.badge-terminated { background: rgba(220,38,38,0.10);  color: #dc2626;             }

/* Checklist dots */
.checklist-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.checklist-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
    flex-shrink: 0;
}

.checklist-dot.dot-done { background: var(--brand-green); }

.checklist-score {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Legend */
.checklist-legend {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0 16px;
}

.checklist-legend .checklist-dot { width: 8px; height: 8px; }

/* Table actions */
.staff-actions { white-space: nowrap; }
.btn-danger-ghost { color: #dc2626 !important; }
.btn-danger-ghost:hover { background: rgba(220,38,38,0.08) !important; }

/* ── Manage page ──────────────────────────────────────────────── */
.form-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 28px;
}

.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-section-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Checklist form items */
.checklist-form-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.checklist-form-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.checklist-form-item:last-child { border-bottom: none; }

.checklist-form-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--brand-green);
    flex-shrink: 0;
    cursor: pointer;
}

.checklist-form-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.checklist-form-label {
    font-size: 14px;
    font-weight: 500;
}

.checklist-form-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .staff-stats { grid-template-columns: repeat(2, 1fr); }
    .staff-table { font-size: 13px; }
    .staff-table th, .staff-table td { padding: 10px 12px; }
    .form-section { padding: 20px 18px; }
}

/* ── Province dropdown — Ontario only ────────────────────────── */
option.province-disabled {
    color: var(--text-muted);
    font-style: italic;
}

/* ── Address autocomplete error ──────────────────────────────── */
.addr-error {
    margin-top: 6px;
    font-size: 13px;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 5px;
}

.addr-error::before {
    content: '⚠';
    flex-shrink: 0;
}

/* ── Breach Response module ──────────────────────────────────── */
.breach-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13.5px;
    color: #991b1b;
    line-height: 1.5;
}

.breach-alert-banner svg { flex-shrink: 0; margin-top: 1px; }

.breach-alert-banner div { display: flex; flex-direction: column; gap: 4px; }

[data-theme="dark"] .breach-alert-banner {
    background: #2d1515;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* Breach type dot on the list row */
.breach-type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    margin-right: 6px;
}

.breach-dot-stolen               { background: #dc2626; }
.breach-dot-lost                 { background: #ea580c; }
.breach-dot-unauthorizeduse      { background: #d97706; }
.breach-dot-unauthorizeddisclosure { background: #7c3aed; }

.breach-type-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Notification status dots (patient · IPC · college) */
.notification-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.notif-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: transparent;
    display: inline-block;
}

.notif-done    { background: var(--brand-green); border-color: var(--brand-green); }
.notif-pending { background: #fde68a;            border-color: #d97706; }
.notif-overdue { background: #dc2626;            border-color: #dc2626; }

/* Annual report note at bottom of breach list */
.breach-annual-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.breach-annual-note svg { flex-shrink: 0; color: var(--brand-blue); }
.breach-annual-note a   { color: var(--brand-blue); text-decoration: underline; }

/* ── Audit Log ────────────────────────────────────────────────── */
.audit-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.audit-type-label {
    font-size: 13px;
    color: var(--text-muted);
}

.audit-flag {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.audit-flag-afterhours {
    background: rgba(234, 88, 12, 0.12);
    color: #ea580c;
}

.audit-flag-bulk {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

[data-theme="dark"] .audit-flag-afterhours { background: rgba(234,88,12,0.18); }
[data-theme="dark"] .audit-flag-bulk       { background: rgba(124,58,237,0.18); }

/* ── Audit integrity badges ───────────────────────────────────── */
.audit-integrity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.audit-integrity-ok {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, 0.25);
}
.audit-integrity-tampered {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.25);
}
.audit-integrity-legacy {
    background: var(--surface-2, #f3f4f6);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
[data-theme="dark"] .audit-integrity-ok       { background: rgba(22,163,74,0.18); }
[data-theme="dark"] .audit-integrity-tampered  { background: rgba(220,38,38,0.18); }
[data-theme="dark"] .audit-integrity-legacy    { background: rgba(255,255,255,0.06); }

/* ── Audit log locked-field display (review mode) ────────────── */
.audit-locked-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.audit-locked-notice svg { flex-shrink: 0; margin-top: 1px; color: #3b82f6; }
.audit-locked-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 20px;
    padding: 16px;
    background: var(--surface-2, #f9fafb);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
}
.audit-locked-item  { display: flex; flex-direction: column; gap: 3px; }
.audit-locked-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.audit-locked-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}
[data-theme="dark"] .audit-locked-notice { background: rgba(59,130,246,0.1); }
[data-theme="dark"] .audit-locked-grid   { background: rgba(255,255,255,0.04); }

/* ── Global textarea constraint ──────────────────────────────── */
textarea {
    max-width: 100%;
    resize: vertical;
    font-family: inherit;
}

/* ── .form-control (shared input/select/textarea styling) ─────── */
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border 0.15s;
    font-family: inherit;
}

.form-control:focus { border-color: var(--primary); }

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

textarea.form-control {
    resize: vertical;
    max-width: 100%;
}

/* ── Module page header ───────────────────────────────────────── */
.module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.module-page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.module-page-sub {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Date / time input icons in dark mode ────────────────────── */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
    cursor: pointer;
}

/* ── Small button variant ─────────────────────────────────────── */
.btn-sm {
    padding: 5px 12px !important;
    font-size: 12px !important;
}

/* ── Module btn-primary override (not full-width) ─────────────── */
.module-content .btn-primary,
.form-actions .btn-primary {
    width: auto;
    padding: 10px 24px;
    font-size: 14px;
}

/* ── Shared utility classes ───────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-red   { color: #dc2626; }

/* ── Form label & required marker ────────────────────────────── */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.required { color: #dc2626; margin-left: 2px; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.10);
    border-color: rgba(234, 179, 8, 0.30);
    color: #92400e;
}

.alert-error {
    background: rgba(239, 68, 68, 0.09);
    border-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.alert-info {
    background: rgba(75, 168, 216, 0.10);
    border-color: rgba(75, 168, 216, 0.30);
    color: #1e6fa8;
}

[data-theme="dark"] .alert-warning { background: rgba(234,179,8,0.08);  border-color: rgba(234,179,8,0.20);  color: #fde68a; }
[data-theme="dark"] .alert-error   { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.20);  color: #fca5a5; }
[data-theme="dark"] .alert-info    { background: rgba(94,196,240,0.08); border-color: rgba(94,196,240,0.20); color: #7dd3fc; }

/* ── Generic badge ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green   { background: rgba(82,150,122,0.12);  color: #166534; }
.badge-red     { background: rgba(220,38,38,0.10);   color: #991b1b; }
.badge-gold    { background: rgba(234,179,8,0.12);   color: #92400e; }
.badge-neutral { background: var(--border);           color: var(--text-muted); }

[data-theme="dark"] .badge-green   { background: rgba(82,150,122,0.18); color: #6ee7b7; }
[data-theme="dark"] .badge-red     { background: rgba(220,38,38,0.18);  color: #fca5a5; }
[data-theme="dark"] .badge-gold    { background: rgba(234,179,8,0.15);  color: #fde68a; }
[data-theme="dark"] .badge-neutral { background: rgba(255,255,255,0.07); color: var(--text-muted); }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.empty-state p { margin: 8px 0 0; font-size: 14px; }

.empty-state-sub {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 440px;
    margin: 6px auto 0;
    line-height: 1.6;
}

/* ── Generic data table ───────────────────────────────────────── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tbody tr:hover { background: var(--bg); }

.table-actions {
    white-space: nowrap;
    text-align: right;
}


/* ═══════════════════════════════════════════════════════════════
   VENDOR MANAGEMENT
═══════════════════════════════════════════════════════════════ */

/* Stats bar */
.vendor-stats-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.vendor-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
}

.vendor-stat-green { border-left: 4px solid #52967a; }
.vendor-stat-gold  { border-left: 4px solid #d97706; }
.vendor-stat-red   { border-left: 4px solid #dc2626; }

.vendor-stat-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.vendor-stat-green .vendor-stat-num { color: #166534; }
.vendor-stat-gold  .vendor-stat-num { color: #92400e; }
.vendor-stat-red   .vendor-stat-num { color: #991b1b; }

[data-theme="dark"] .vendor-stat-green .vendor-stat-num { color: #6ee7b7; }
[data-theme="dark"] .vendor-stat-gold  .vendor-stat-num { color: #fde68a; }
[data-theme="dark"] .vendor-stat-red   .vendor-stat-num { color: #fca5a5; }

.vendor-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Vendor table cells */
.vendor-name {
    font-weight: 500;
    font-size: 14px;
}

.vendor-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Existing file row in manage form */
.existing-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
}

.existing-file-row svg { color: var(--text-muted); flex-shrink: 0; }

.existing-file-remove {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #dc2626;
    cursor: pointer;
    white-space: nowrap;
}

.existing-file-remove input[type="checkbox"] {
    accent-color: #dc2626;
    cursor: pointer;
}

@media (max-width: 768px) {
    .vendor-stats-bar { gap: 10px; }
    .vendor-stat { padding: 12px 16px; min-width: 110px; }
    .vendor-stat-num { font-size: 22px; }
}

/* ═══════════════════════════════════════════════════════════════
   PRIVACY POLICY CHECKER
═══════════════════════════════════════════════════════════════ */

/* URL input row */
.ppcheck-url-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.ppcheck-url-input { flex: 1; }

.ppcheck-run-btn {
    width: auto !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Score card */
.ppcheck-score-card {
    display: flex;
    gap: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.ppcheck-score-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 160px;
}

.ppcheck-score-gauge {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.ppcheck-score-num {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
}

.ppcheck-score-denom {
    font-size: 20px;
    font-weight: 600;
    opacity: 0.7;
}

.ppcheck-score-band {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ppcheck-score-url {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    word-break: break-all;
}

.ppcheck-score-url a {
    color: var(--primary);
    text-decoration: none;
}

.ppcheck-score-url a:hover { text-decoration: underline; }

.ppcheck-score-date {
    font-size: 11px;
    color: var(--text-muted);
}

.ppcheck-score-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 220px;
}

.ppcheck-found-summary {
    font-size: 15px;
    color: var(--text);
}

/* Section title */
.ppcheck-section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* Check items grid */
.ppcheck-items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.ppcheck-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    border-left-width: 4px;
}

.ppcheck-item-pass { border-left-color: #52967a; }
.ppcheck-item-fail { border-left-color: var(--border); opacity: 0.75; }

.ppcheck-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.ppcheck-item-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ppcheck-item-pass .ppcheck-item-icon {
    background: rgba(82,150,122,0.12);
    color: #166534;
}

.ppcheck-item-fail .ppcheck-item-icon {
    background: rgba(220,38,38,0.10);
    color: #991b1b;
}

.ppcheck-item-label {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.ppcheck-item-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.ppcheck-excerpt {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    word-break: break-word;
}

/* Gap note */
.ppcheck-gap-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(75,168,216,0.07);
    border: 1px solid rgba(75,168,216,0.25);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 8px;
}

.ppcheck-gap-note svg { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.ppcheck-gap-note a   { color: var(--primary); }

[data-theme="dark"] .ppcheck-gap-note {
    background: rgba(94,196,240,0.06);
    border-color: rgba(94,196,240,0.18);
}

@media (max-width: 768px) {
    .ppcheck-items-grid   { grid-template-columns: 1fr; }
    .ppcheck-score-card   { flex-direction: column; gap: 20px; }
    .ppcheck-score-left   { align-items: flex-start; }
    .ppcheck-url-row      { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════
   IPC REPORTING GUIDE
═══════════════════════════════════════════════════════════════ */

/* Breach summary banner at top of page */
.ipc-breach-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid #dc2626;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 20px;
}

.ipc-breach-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(220,38,38,0.10);
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ipc-breach-banner-body { flex: 1; }

.ipc-breach-banner-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ipc-breach-banner-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Progress bar */
.ipc-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.ipc-progress-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.ipc-progress-bar-fill {
    height: 100%;
    background: var(--brand-blue);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.ipc-progress-bar-label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Step list */
.ipc-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ipc-step {
    display: flex;
    gap: 20px;
    padding: 0 0 28px 0;
    position: relative;
}

/* Vertical connector line between steps */
.ipc-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 38px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.ipc-step-done:not(:last-child)::before  { background: var(--brand-green); }
.ipc-step-action:not(:last-child)::before { background: var(--border); }

/* Step marker (circle with number or checkmark) */
.ipc-step-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--surface);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.ipc-step-done     .ipc-step-marker { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.ipc-step-action   .ipc-step-marker { border-color: var(--primary); color: var(--primary); }
.ipc-step-overdue  .ipc-step-marker { background: #dc2626; border-color: #dc2626; color: #fff; }

/* Step body */
.ipc-step-body { flex: 1; min-width: 0; }

.ipc-step-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px; /* aligns with marker */
}

.ipc-step-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.ipc-step-content p { margin-bottom: 12px; }
.ipc-step-content p:last-child { margin-bottom: 0; }

.ipc-step-done-note {
    background: rgba(82,150,122,0.10);
    border: 1px solid rgba(82,150,122,0.25);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #166534;
    margin-bottom: 14px !important;
}

[data-theme="dark"] .ipc-step-done-note {
    background: rgba(82,150,122,0.12);
    border-color: rgba(82,150,122,0.22);
    color: #6ee7b7;
}

/* PHIPA criteria list */
.ipc-criteria-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ipc-criteria-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

.ipc-criteria-list li svg { color: var(--brand-green); flex-shrink: 0; margin-top: 2px; }

/* Information checklist */
.ipc-checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 14px 0;
}

.ipc-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
    background: var(--surface);
}

.ipc-checklist-item:last-child { border-bottom: none; }
.ipc-checklist-item-warn { background: rgba(234,179,8,0.04); }

.ipc-checklist-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.ipc-icon-done { background: rgba(82,150,122,0.12); color: #166534; }
.ipc-icon-warn { background: rgba(234,179,8,0.14);  color: #92400e; }

[data-theme="dark"] .ipc-icon-done { background: rgba(82,150,122,0.18); color: #6ee7b7; }
[data-theme="dark"] .ipc-icon-warn { background: rgba(234,179,8,0.18);  color: #fde68a; }

/* Action card (IPC portal link) */
.ipc-action-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin: 14px 0;
}

.ipc-action-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(75,168,216,0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ipc-action-card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.ipc-action-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.ipc-action-btn {
    width: auto !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
}

/* Tip box */
.ipc-tip-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.6;
}

.ipc-tip-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 13px;
}

.ipc-tip-list {
    padding-left: 18px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Deadline chip */
.ipc-deadline-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin: 0 0 14px;
}

.ipc-deadline-warn    { background: rgba(234,179,8,0.12);  color: #92400e; border: 1px solid rgba(234,179,8,0.3); }
.ipc-deadline-overdue { background: rgba(220,38,38,0.10);  color: #991b1b; border: 1px solid rgba(220,38,38,0.3); }

[data-theme="dark"] .ipc-deadline-warn    { color: #fde68a; }
[data-theme="dark"] .ipc-deadline-overdue { color: #fca5a5; }

/* Step note */
.ipc-step-note {
    background: rgba(75,168,216,0.07);
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .ipc-breach-banner     { flex-wrap: wrap; }
    .ipc-breach-banner-meta { flex-direction: column; gap: 2px; }
    .ipc-action-card       { flex-direction: column; }
    .ipc-step              { gap: 14px; }
}

/* ── IPC pre-fill panel ───────────────────────────────────────── */
.ipc-prefill-launch {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.ipc-prefill-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.ipc-prefill-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 16px 0;
    background: var(--surface);
}

.ipc-prefill-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.ipc-prefill-row {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.ipc-prefill-row-tall { align-items: flex-start; padding: 14px 16px; }

.ipc-prefill-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
    flex-shrink: 0;
}

.ipc-prefill-value {
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}

.ipc-prefill-missing {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
}

/* Copy button */
.ipc-copy-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    flex-shrink: 0;
    align-self: flex-start;
}

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

.ipc-copy-btn-done {
    background: var(--brand-green) !important;
    color: #fff !important;
    border-color: var(--brand-green) !important;
}

@media (max-width: 768px) {
    .ipc-prefill-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .ipc-prefill-label { font-size: 11px; }
    .ipc-copy-btn { width: fit-content; }
}

/* ── IPC Bookmarklet section ──────────────────────────────────── */
.ipc-bm-section {
    background: linear-gradient(135deg, rgba(75, 168, 216, 0.06) 0%, rgba(94, 196, 240, 0.04) 100%);
    border: 1px solid rgba(75, 168, 216, 0.25);
    border-radius: var(--radius);
    margin: 20px 0;
    overflow: hidden;
}

.ipc-bm-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(75, 168, 216, 0.15);
}

.ipc-bm-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.ipc-bm-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 3px;
}

.ipc-bm-sub {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.ipc-bm-body {
    padding: 16px 18px;
}

.ipc-bm-steps-list {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 18px;
    margin-bottom: 14px;
    line-height: 1.7;
}

.ipc-bm-steps-list li + li { margin-top: 4px; }
.ipc-bm-steps-list kbd {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text);
}

.ipc-bm-drag-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: grab;
    margin: 4px 0 16px;
    border: 2px dashed transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
}

.ipc-bm-drag-link:hover {
    background: var(--primary-h);
    border-color: rgba(255,255,255,0.4);
}

.ipc-bm-drag-link:active {
    transform: scale(0.98);
    cursor: grabbing;
}

.ipc-bm-fallback {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.ipc-bm-fallback summary {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.ipc-bm-fallback summary:hover { color: var(--text); }

.ipc-bm-fallback-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 8px 0 10px;
    line-height: 1.5;
}

.ipc-bm-code-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
}

.ipc-bm-code {
    flex: 1;
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    white-space: pre-wrap;
    max-height: 80px;
    overflow-y: auto;
    line-height: 1.5;
}

/* ── IPC Export Pack ──────────────────────────────────────────── */
.xpk-action-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.xpk-action-btns { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.xpk-report {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 1000px;
}

/* ── Cover theme tokens ──────────────────────────────────────── */
:root {
    --xpk-cover-bg:           linear-gradient(160deg, #eef6fb 0%, #dff0f9 100%);
    --xpk-cover-text:         #1a1f2e;
    --xpk-cover-muted:        #4b5563;
    --xpk-cover-subtle:       #6b7280;
    --xpk-cover-heading:      #0f172a;
    --xpk-cover-logo:         #2e8bbf;
    --xpk-cover-type-bg:      rgba(46, 139, 191, 0.10);
    --xpk-cover-type-color:   #2e8bbf;
    --xpk-cover-type-border:  rgba(46, 139, 191, 0.25);
    --xpk-cover-circle-bg:    rgba(0, 0, 0, 0.04);
    --xpk-cover-ipc-bg:       rgba(0, 0, 0, 0.04);
    --xpk-cover-ipc-border:   rgba(0, 0, 0, 0.10);
    --xpk-cover-divider:      rgba(0, 0, 0, 0.10);
    --xpk-cover-ipc-value:    #374151;
    --xpk-cover-disclaimer:   #9ca3af;
}

[data-theme="dark"] {
    --xpk-cover-bg:           linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
    --xpk-cover-text:         #f1f5f9;
    --xpk-cover-muted:        #94a3b8;
    --xpk-cover-subtle:       #64748b;
    --xpk-cover-heading:      #ffffff;
    --xpk-cover-logo:         #5ec4f0;
    --xpk-cover-type-bg:      rgba(94, 196, 240, 0.15);
    --xpk-cover-type-color:   #5ec4f0;
    --xpk-cover-type-border:  rgba(94, 196, 240, 0.30);
    --xpk-cover-circle-bg:    rgba(255, 255, 255, 0.05);
    --xpk-cover-ipc-bg:       rgba(255, 255, 255, 0.06);
    --xpk-cover-ipc-border:   rgba(255, 255, 255, 0.10);
    --xpk-cover-divider:      rgba(255, 255, 255, 0.08);
    --xpk-cover-ipc-value:    #cbd5e1;
    --xpk-cover-disclaimer:   #475569;
}

/* ── Cover ──────────────────────────────────────────────────── */
.xpk-cover {
    padding: 36px 40px 28px;
    background: var(--xpk-cover-bg);
    color: var(--xpk-cover-text);
    position: relative;
}

.xpk-cover-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.xpk-cover-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--xpk-cover-logo);
}

.xpk-cover-meta {
    text-align: right;
    font-size: 12px;
    color: var(--xpk-cover-muted);
    line-height: 1.7;
}

.xpk-cover-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.xpk-cover-clinic-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--xpk-cover-heading);
    margin-bottom: 6px;
}

.xpk-cover-addr {
    font-size: 13px;
    color: var(--xpk-cover-muted);
    line-height: 1.7;
}

.xpk-cover-type {
    display: inline-block;
    margin-top: 8px;
    background: var(--xpk-cover-type-bg);
    color: var(--xpk-cover-type-color);
    border: 1px solid var(--xpk-cover-type-border);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.xpk-cover-score-block {
    flex-shrink: 0;
    text-align: center;
}

.xpk-cover-score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--xpk-cover-circle-bg);
    margin: 0 auto 10px;
}

.xpk-cover-score-num {
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

.xpk-cover-score-denom {
    font-size: 13px;
    color: var(--xpk-cover-muted);
}

.xpk-cover-score-label {
    font-size: 11px;
    color: var(--xpk-cover-muted);
    margin: 6px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.xpk-cover-score-date {
    font-size: 11px;
    color: var(--xpk-cover-subtle);
    margin-top: 6px;
}

.xpk-cover-ipc-row {
    background: var(--xpk-cover-ipc-bg);
    border: 1px solid var(--xpk-cover-ipc-border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.xpk-cover-ipc-label {
    font-size: 11px;
    color: var(--xpk-cover-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    min-width: 180px;
}

.xpk-cover-ipc-value   { font-size: 13px; color: var(--xpk-cover-ipc-value); }
.xpk-cover-ipc-missing { font-size: 13px; color: #dc2626; }

.xpk-cover-disclaimer {
    font-size: 11px;
    color: var(--xpk-cover-disclaimer);
    line-height: 1.6;
    border-top: 1px solid var(--xpk-cover-divider);
    padding-top: 14px;
}

/* ── Sections ───────────────────────────────────────────────── */
.xpk-section {
    border-bottom: 1px solid var(--border);
}

.xpk-section:last-child { border-bottom: none; }

.xpk-section-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 28px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.xpk-section-num {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.xpk-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.xpk-section-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.xpk-section-body { padding: 20px 28px 24px; }

/* ── Key-value grid ─────────────────────────────────────────── */
.xpk-kv-grid { display: flex; flex-direction: column; gap: 0; }

.xpk-kv-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

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

.xpk-kv-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding-top: 2px;
}

.xpk-kv-value {
    font-size: 13px;
    color: var(--text);
}

/* ── Tables ─────────────────────────────────────────────────── */
.xpk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.xpk-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.xpk-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.xpk-table tbody tr:last-child td { border-bottom: none; }
.xpk-table tbody tr:hover td { background: rgba(0,0,0,0.02); }

.xpk-table-compact td { padding: 6px 10px; }

/* ── Stat row chips ─────────────────────────────────────────── */
.xpk-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.xpk-stat-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 18px;
    min-width: 100px;
    text-align: center;
}

.xpk-stat-chip.xpk-stat-good  { border-color: rgba(22,163,74,0.35); background: rgba(22,163,74,0.06); }
.xpk-stat-chip.xpk-stat-warn  { border-color: rgba(220,38,38,0.35); background: rgba(220,38,38,0.06); }
.xpk-stat-chip.xpk-stat-neutral { border-color: rgba(217,119,6,0.35); background: rgba(217,119,6,0.06); }

.xpk-stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.xpk-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

/* ── Tick marks ─────────────────────────────────────────────── */
.xpk-tick-yes { color: #16a34a; font-weight: 700; }
.xpk-tick-no  { color: var(--text-muted); }

/* ── Gap assessment section ─────────────────────────────────── */
.xpk-gap-summary {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 4px;
}

.xpk-gap-score-cell { text-align: center; flex-shrink: 0; min-width: 80px; }
.xpk-gap-big-score { font-size: 40px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.xpk-gap-date { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.xpk-gap-interpretation { font-size: 13px; color: var(--text); line-height: 1.6; padding-top: 4px; }

.xpk-gap-domain-detail {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.xpk-gap-domain-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

/* ── Privacy policy section ─────────────────────────────────── */
.xpk-pp-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
}

.xpk-pp-score {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Reference notes ────────────────────────────────────────── */
.xpk-ref-note {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(75, 168, 216, 0.06);
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.xpk-note-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 4px; }
.xpk-empty-row { padding: 16px 0; font-size: 13px; color: var(--text-muted); font-style: italic; }

/* ── Declaration ─────────────────────────────────────────────── */
.xpk-declaration .xpk-section-header { background: rgba(22,163,74,0.05); }
.xpk-declaration .xpk-section-num   { background: #16a34a; }
.xpk-decl-text { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 24px; }

.xpk-sig-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 40px;
}

.xpk-sig-block { display: flex; flex-direction: column; gap: 6px; }
.xpk-sig-line { border-bottom: 1px solid var(--text); height: 36px; }
.xpk-sig-pre { color: var(--text-muted); font-size: 13px; display: flex; align-items: flex-end; padding-bottom: 4px; }
.xpk-sig-label { font-size: 11px; color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────────────── */
.xpk-footer {
    padding: 16px 28px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: var(--text-muted);
}

.xpk-footer-legal { font-size: 11px; color: var(--text-muted); opacity: 0.6; margin-top: 4px; }

/* ── Bottom action bar ───────────────────────────────────────── */
.xpk-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 0 4px;
    flex-wrap: wrap;
}

.xpk-bottom-note {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    min-width: 200px;
}

/* ── Print styles ────────────────────────────────────────────── */
.print-only { display: none; }

@media print {
    /* Hide all dashboard chrome and action bars */
    .topbar, .sidebar, .xpk-action-bar, .xpk-bottom-bar, .no-print { display: none !important; }
    .print-only { display: inline !important; }

    /* Force white page — overrides dark mode CSS variables */
    *, *::before, *::after {
        background: transparent !important;
        box-shadow: none !important;
    }

    body, html {
        background: #fff !important;
        color: #111 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .main-content, .page-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .xpk-report {
        border: 1px solid #d1d5db !important;
        border-radius: 0;
        max-width: 100%;
    }

    /* Cover — always white/light in print, never dark */
    .xpk-cover {
        background: linear-gradient(160deg, #eef6fb 0%, #dff0f9 100%) !important;
        color: #111 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .xpk-cover-clinic-name  { color: #0f172a !important; }
    .xpk-cover-logo         { color: #2e8bbf !important; }
    .xpk-cover-meta,
    .xpk-cover-addr,
    .xpk-cover-muted,
    .xpk-cover-score-label,
    .xpk-cover-score-date,
    .xpk-cover-ipc-label,
    .xpk-cover-disclaimer   { color: #4b5563 !important; }
    .xpk-cover-ipc-value    { color: #374151 !important; }
    .xpk-cover-ipc-row      { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.10) !important; }
    .xpk-cover-type         { background: rgba(46,139,191,0.10) !important; color: #2e8bbf !important; border-color: rgba(46,139,191,0.25) !important; }
    .xpk-cover-score-circle { background: rgba(0,0,0,0.04) !important; }
    /* Score numbers keep their inline colour (semantic — green/amber/red) */
    .xpk-cover-score-denom  { color: #6b7280 !important; }
    .xpk-cover-score-num    { /* preserve inline style colour */ }

    /* Section headers */
    .xpk-section-header     { background: #f8fafc !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .xpk-section-title      { color: #111 !important; }
    .xpk-section-sub        { color: #6b7280 !important; }
    .xpk-section-num        { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Tables */
    .xpk-table th       { background: #f8fafc !important; color: #6b7280 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .xpk-table td       { color: #111 !important; border-color: #e5e7eb !important; }
    .xpk-table tr       { page-break-inside: avoid; }
    .xpk-table thead    { display: table-header-group; }

    /* Stat chips */
    .xpk-stat-chip      { background: #f9fafb !important; border-color: #e5e7eb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .xpk-stat-chip.xpk-stat-good    { background: #f0fdf4 !important; border-color: #bbf7d0 !important; }
    .xpk-stat-chip.xpk-stat-warn    { background: #fff1f2 !important; border-color: #fecaca !important; }
    .xpk-stat-chip.xpk-stat-neutral { background: #fffbeb !important; border-color: #fde68a !important; }
    .xpk-stat-num   { color: #111 !important; }
    .xpk-stat-label { color: #6b7280 !important; }

    /* Gap + PP summaries */
    .xpk-gap-summary, .xpk-pp-summary { background: #f9fafb !important; border-color: #e5e7eb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .xpk-gap-domain-detail  { page-break-inside: avoid; border-color: #e5e7eb !important; }
    .xpk-gap-domain-name    { background: #f8fafc !important; color: #6b7280 !important; border-color: #e5e7eb !important; }

    /* Key-value grid */
    .xpk-kv-row   { border-color: #e5e7eb !important; }
    .xpk-kv-label { color: #6b7280 !important; }
    .xpk-kv-value { color: #111 !important; }

    /* Ref notes */
    .xpk-ref-note  { background: #eff8ff !important; border-color: #93c5fd !important; color: #374151 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Badges keep their colours */
    .staff-status-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Declaration */
    .xpk-declaration .xpk-section-header { background: #f0fdf4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .xpk-decl-text  { color: #111 !important; }
    .xpk-sig-line   { border-color: #111 !important; }
    .xpk-sig-label, .xpk-sig-pre { color: #6b7280 !important; }

    /* Footer */
    .xpk-footer       { background: #f8fafc !important; color: #6b7280 !important; border-color: #e5e7eb !important; }
    .xpk-footer-legal { color: #9ca3af !important; }

    /* Misc */
    .xpk-section    { page-break-inside: avoid; border-color: #e5e7eb !important; }
    .alert          { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a               { color: inherit !important; text-decoration: none !important; }
    .text-muted     { color: #6b7280 !important; }
}

/* ── Policy Vault — generate banner & button ─────────────────────────────── */
.pv-success-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: color-mix(in srgb, var(--brand-green) 12%, transparent);
    border: 1px solid var(--brand-green);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: .9em;
    color: var(--text-primary);
    margin-bottom: 20px;
}
.pv-success-banner svg { color: var(--brand-green); flex-shrink: 0; }

.pv-gen-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ── Announcement banner ──────────────────────────────────────────────────── */
.ann-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: color-mix(in srgb, var(--brand-blue) 12%, transparent);
    border: 1px solid var(--brand-blue);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .88em;
    color: var(--text-primary);
}
.ann-banner svg { color: var(--brand-blue); flex-shrink: 0; }
.ann-banner span { flex: 1; }
.ann-dismiss {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text-secondary); line-height: 1;
    padding: 0 4px;
}
.ann-dismiss:hover { color: var(--text-primary); }

/* ── Admin panel shared ───────────────────────────────────────────────────── */
.adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.adm-kpi {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
}
.adm-kpi-value { font-size: 2em; font-weight: 700; line-height: 1.1; }
.adm-kpi-label { font-size: .8em; color: var(--text-secondary); margin-top: 4px; }

.adm-quick-links {
    display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px;
}
.adm-quick-card {
    display: flex; align-items: center; gap: 10px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px 18px;
    color: var(--text-primary); text-decoration: none; font-size: .9em;
    font-weight: 500; transition: border-color .15s;
}
.adm-quick-card:hover { border-color: var(--brand-blue); }

/* ── Admin search ──────────────────────────────────────────────────────────── */
.adm-search-form { display: flex; gap: 8px; align-items: center; }
.adm-search-input { min-width: 220px; }

/* ── Clinic detail layout ──────────────────────────────────────────────────── */
.adm-detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) { .adm-detail-grid { grid-template-columns: 1fr; } }

.adm-info-table { width: 100%; border-collapse: collapse; font-size: .9em; }
.adm-info-table td { padding: 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.adm-info-table td:first-child { width: 38%; color: var(--text-secondary); padding-right: 12px; }
.adm-info-table tr:last-child td { border-bottom: none; }

.adm-action-row { display: flex; gap: 8px; align-items: center; }
.adm-notes-display { background: color-mix(in srgb, var(--brand-gold) 8%, transparent); }

/* ── Engagement table ─────────────────────────────────────────────────────── */
.adm-engage-table { font-size: .85em; }
.adm-engage-th { text-align: center; white-space: nowrap; max-width: 72px; overflow: hidden; }
.adm-engage-cell { text-align: center; }
.adm-used  { color: var(--brand-green); }
.adm-unused { color: var(--border); }
.adm-churn-risk td { background: color-mix(in srgb, #dc2626 5%, transparent); }
.adm-clinic-link { color: var(--text-primary); font-weight: 500; }
.adm-clinic-link:hover { color: var(--brand-blue); }

/* ── Announcements ────────────────────────────────────────────────────────── */
.adm-ann-layout { display: grid; grid-template-columns: 380px 1fr; gap: 28px; align-items: start; }
@media (max-width: 800px) { .adm-ann-layout { grid-template-columns: 1fr; } }

.adm-ann-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px 16px; margin-bottom: 12px;
    position: relative;
}
.adm-ann-expired { opacity: .55; }
.adm-ann-msg { font-size: .93em; margin-bottom: 8px; }
.adm-ann-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .8em; }
.adm-ann-del { color: #dc2626; font-size: 12px; padding: 3px 8px; margin-top: 8px; }

.adm-plan-checks { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.adm-check-label { display: flex; align-items: center; gap: 8px; font-size: .9em; cursor: pointer; line-height: 1; }
.adm-check-label input[type="checkbox"] { margin: 0; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

/* ── Plans edit ──────────────────────────────────────────────────────────── */
.adm-plan-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .adm-plan-edit-grid { grid-template-columns: 1fr; } }
.adm-price-row { display: flex; gap: 20px; flex-wrap: wrap; }
.adm-feature-group-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.adm-feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.adm-feature-item { font-size: 14px; }

/* ── Subscribe plan cards ────────────────────────────────────────────────── */
.sub-plan-grid { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.sub-plan-card { flex: 1; min-width: 200px; max-width: 280px; border: 1px solid var(--border); border-radius: 12px; padding: 28px 24px; text-align: left; position: relative; background: var(--bg); }
.sub-plan-popular { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
.sub-plan-dimmed  { opacity: .5; pointer-events: none; }
.sub-popular-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.sub-badge-current  { background: var(--border);  color: var(--text-muted); }
.sub-badge-included { background: var(--border);  color: var(--text-muted); }
.sub-plan-name { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.sub-plan-price { font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1; }
.sub-plan-period { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.sub-plan-annual { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.sub-plan-desc { font-size: 13px; color: var(--text-muted); margin: 14px 0 0; line-height: 1.5; }
.sub-plan-btn { display: block; width: 100%; margin-top: 20px; text-align: center; }

/* ── Loading / in-progress overlay ──────────────────────────────────────── */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.38);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.spinner-overlay.active { display: flex; }
.spinner-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 40px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.22);
    min-width: 140px;
}
.spinner-ring {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner-turn 0.72s linear infinite;
    margin: 0 auto 12px;
}
.spinner-label { font-size: 13px; color: var(--text-muted); }
@keyframes spinner-turn { to { transform: rotate(360deg); } }

/* ── Audit log pagination ─────────────────────────────────────────────────── */
.adm-pagination {
    display: flex; align-items: center; gap: 16px;
    margin-top: 20px; justify-content: center;
}

/* ── btn-danger ───────────────────────────────────────────────────────────── */
.btn-danger {
    background: #dc2626; color: #fff; border: none;
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: .875em;
}
.btn-danger:hover { background: #b91c1c; }

/* ── Clinic Switcher ──────────────────────────────────────────────────────── */
.clinic-switcher {
    position: relative;
    margin: 0 0 4px;
}
.clinic-switcher-btn {
    display: flex; align-items: center; gap: 7px;
    width: 100%; padding: 8px 12px;
    background: var(--surface-2, rgba(0,0,0,.05));
    border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500;
    color: var(--text-primary);
    text-align: left; transition: background .15s;
}
.clinic-switcher-btn:hover { background: var(--surface-3, rgba(0,0,0,.08)); }
.clinic-switcher-btn span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clinic-switcher-menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    background: var(--surface-1, #fff);
    border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
    z-index: 200; overflow: hidden;
}
.clinic-option {
    display: flex; align-items: center;
    padding: 9px 14px; font-size: 13px;
    color: var(--text-primary); text-decoration: none;
    transition: background .12s;
    gap: 6px;
}
.clinic-option:hover { background: var(--surface-2, rgba(0,0,0,.05)); }
.clinic-option.active { font-weight: 600; color: var(--primary); }
[data-theme="dark"] .clinic-switcher-btn { background: rgba(255,255,255,.06); }
[data-theme="dark"] .clinic-switcher-btn:hover { background: rgba(255,255,255,.1); }
[data-theme="dark"] .clinic-switcher-menu { background: var(--sidebar-bg, #1e2028); }

/* ── Admin Clinic Branch Tree ─────────────────────────────────────────────── */
.branch-toggle {
    width: 20px; height: 20px;
    border-radius: 4px; border: 1px solid var(--border);
    background: var(--surface-2, rgba(0,0,0,.05));
    color: var(--text-primary); font-size: 14px; font-weight: 700;
    line-height: 1; cursor: pointer; padding: 0;
    transition: background .15s, color .15s;
    display: inline-flex; align-items: center; justify-content: center;
}
.branch-toggle:hover  { background: var(--primary); color: #fff; border-color: var(--primary); }
.branch-toggle.open   { background: var(--primary); color: #fff; border-color: var(--primary); }
.clinic-primary-row   { background: var(--surface-1, transparent); }
.branch-count-pill {
    display: inline-block; margin-left: 7px;
    padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 500;
    background: var(--primary-light, rgba(var(--primary-rgb, 59,130,246),.12));
    color: var(--primary); vertical-align: middle;
}
.branch-row td { background: var(--surface-2, rgba(0,0,0,.025)); border-left: 3px solid var(--primary-light, #bfdbfe); }
.branch-row td:first-child { border-left: none; }
.branch-indent { display: inline-flex; align-items: center; gap: 6px; padding-left: 18px; }
.branch-icon { color: var(--text-muted); font-size: 15px; line-height: 1; }
