/* Policy PDF Generator - Styles */

:root {
    /* HRXconnect brand palette (from hrxconnect.com) */
    --primary-color: #315eff;
    --primary-hover: #2950e0;
    --primary-soft: #eaf0ff;
    --accent-color: #00c9ff;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #3d4250;       /* HRX secondary slate */
    --text-secondary: #64748b;
    --text-body: #525252;          /* HRX body text */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 20px 40px -16px rgba(16, 24, 40, 0.18);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-head: 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Focus ring token (visible, accessible) */
    --focus-ring: 0 0 0 3px rgba(49, 94, 255, 0.35);
    --focus-ring-offset: 2px;
    --radius: 16px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Accessible focus ring for keyboard users */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 8px;
}

/* Respect reduced-motion globally */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

header .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Panels Layout */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .panels {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

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

.panel-content {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

/* Section Tree */
.section-tree {
    font-size: 0.95rem;
}

.section-item {
    margin-bottom: 4px;
}

.section-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.section-label:hover {
    background-color: #f1f5f9;
}

.section-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.section-label .section-title {
    flex: 1;
    font-weight: 500;
}

.section-label.main-section .section-title {
    font-weight: 700;
    color: var(--primary-color);
}

.section-label.sub-section .section-title {
    font-weight: 600;
    color: var(--text-primary);
}

.expand-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.expand-btn.expanded {
    transform: rotate(90deg);
}

.section-children {
    margin-left: 28px;
    border-left: 2px solid var(--border-color);
    padding-left: 8px;
}

.section-children.collapsed {
    display: none;
}

/* Main sections styling */
.section-item.main > .section-label {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

/* Extended policy indicator */
.extended-badge {
    font-size: 0.75rem;
    background-color: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

/* Form Styles */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: #94a3b8;
}

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

/* Read-only policy summary */
.review-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-style: italic;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 600;
}

.summary-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
}

.acknowledge-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 8px;
}

.acknowledge-section h3 {
    margin-bottom: 12px;
}

.ack-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.ack-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Buttons */
.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-small:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.generate-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    flex-wrap: wrap;
}

.btn-generate {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-md);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-generate:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-secondary:hover {
    background-color: #f0f7ff;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Status Message */
.status-message {
    margin-top: 16px;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status-message.loading {
    display: block;
    background-color: #dbeafe;
    color: #1e40af;
}

.status-message.success {
    display: block;
    background-color: #dcfce7;
    color: #166534;
}

.status-message.error {
    display: block;
    background-color: #fee2e2;
    color: #991b1b;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* Scrollbar styling */
.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for loading */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #1e40af;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

/* ─── Auth Pages ─── */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.btn-auth {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-auth:hover {
    transform: translateY(-1px);
}

.auth-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.auth-info {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.auth-success {
    background-color: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.btn-auth-secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* ─── Dashboard ─── */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    text-align: left;
}

.dashboard-header h1 {
    font-size: 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.btn-logout:hover {
    background: #f1f5f9;
}

.btn-back {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.dashboard-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

.tab-header h2 {
    font-size: 1.1rem;
}

.btn-primary {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.9rem;
}

.share-link {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    word-break: break-all;
}

.btn-copy {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 6px;
    transition: background-color 0.15s ease;
}

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

.btn-delete {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete:hover {
    background: #fee2e2;
}

.btn-action {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.btn-export {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    margin-left: 4px;
}

.btn-export:hover {
    background: #f0f7ff;
}

.badge-pending {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* ─── Create Link Page ─── */

.form-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 32px;
    max-width: 700px;
    margin: 0 auto;
}

.form-card h2 {
    margin-bottom: 8px;
}

.form-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.success-card {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    margin-top: 20px;
}

.success-card h3 {
    color: #166534;
    margin-bottom: 8px;
}

.link-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.link-display code {
    flex: 1;
    word-break: break-all;
    font-size: 0.9rem;
}

/* ─── Handbook Editor ─── */

.editor-container {
    max-width: 1000px;
}

#editor-wrapper {
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

#quill-editor {
    min-height: 600px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 0.95rem;
}

.ql-container {
    font-size: 0.95rem;
}

.ql-editor {
    min-height: 600px;
}

.editor-container .dashboard-header .header-right {
    display: flex;
    gap: 8px;
}

.editor-container .btn-secondary {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.editor-container .btn-primary {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ─── Handbook detail view: two-column layout + details panel ─── */

.handbook-layout {
    max-width: 1280px;
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    grid-template-areas:
        "header header"
        "meta   editor";
    column-gap: 28px;
    align-items: start;
}

.handbook-header-full { grid-area: header; }
.handbook-meta {
    grid-area: meta;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}
.handbook-editor { grid-area: editor; min-width: 0; }

/* Header title block */
.hb-title-block { display: flex; flex-direction: column; line-height: 1.2; }
.hb-title-eyebrow {
    font-family: var(--font-head);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ck-brand, #315eff);
    margin-bottom: 2px;
}

/* Header action buttons */
.hb-header-actions { gap: 8px; }
.hb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    font-size: .85rem;
    font-weight: 600;
    border-radius: var(--ck-r-sm, 10px);
    transition: background var(--ck-dur-fast, .15s) var(--ck-ease),
                color var(--ck-dur-fast, .15s) var(--ck-ease),
                border-color var(--ck-dur-fast, .15s) var(--ck-ease),
                transform var(--ck-dur-fast, .15s) var(--ck-ease),
                box-shadow var(--ck-dur-fast, .15s) var(--ck-ease);
}
.hb-action-btn .hb-btn-icon { flex-shrink: 0; }
.hb-action-btn:active { transform: translateY(1px); }
.hb-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ck-brand-tint, #eef2ff), var(--ck-focus);
}

@media (max-width: 960px) {
    .handbook-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "meta"
            "editor";
    }
    .handbook-meta { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 560px) {
    .hb-action-btn .hb-btn-label { display: none; }
    .hb-action-btn { padding: 9px 11px; }
}

/* Cards */
.hb-card {
    background: var(--ck-canvas, #fff);
    border: 1px solid var(--ck-border, #dbdde3);
    border-radius: var(--ck-r-md, 14px);
    box-shadow: var(--ck-shadow-1);
    overflow: hidden;
    transition: box-shadow var(--ck-dur-med, .22s) var(--ck-ease),
                border-color var(--ck-dur-med, .22s) var(--ck-ease);
}
.hb-card:hover { box-shadow: var(--ck-shadow-2); border-color: #c9ccd4; }
.hb-card--submitter {
    background: linear-gradient(160deg, var(--ck-brand-tint, #eef2ff) 0%, var(--ck-canvas, #fff) 55%);
    border-color: #d8e0ff;
}
.hb-card-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 18px 20px 12px;
}
.hb-card-head-row { justify-content: space-between; }
.hb-card-head-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hb-card-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 8px;
    color: var(--ck-brand, #315eff);
    background: var(--ck-brand-tint, #eef2ff);
}
.hb-card-head h2 {
    margin: 0;
    font-family: var(--font-head);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ck-faint, #8a90a2);
}
.hb-count {
    font-size: .72rem;
    font-weight: 700;
    color: var(--ck-brand, #315eff);
    background: var(--ck-brand-tint, #eef2ff);
    border-radius: var(--ck-pill, 999px);
    padding: 3px 11px;
    line-height: 1;
}
.hb-card-body { padding: 8px 20px 20px; }

/* Submitter */
.hb-submitter {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.hb-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(140deg, #4d7bff, var(--ck-brand, #315eff));
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(49, 94, 255, .28);
}
.hb-submitter-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 120px; }
.hb-name {
    font-weight: 700;
    color: var(--ck-ink, #1a1d24);
    font-size: .98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hb-email {
    color: var(--ck-muted, #6b7280);
    font-size: .82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
.hb-email:hover { color: var(--ck-brand, #315eff); text-decoration: underline; }
.hb-ack-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--ck-ok, #16a34a);
    background: var(--ck-ok-tint, #ecfdf5);
    border: 1px solid var(--ck-ok-border, #bbf7d0);
    border-radius: var(--ck-pill, 999px);
    padding: 3px 9px 3px 7px;
}
.hb-submitter-foot {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--ck-hair, #eceef2);
}
.hb-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: .82rem;
}
.hb-meta-label { color: var(--ck-faint, #8a90a2); }
.hb-meta-value { color: var(--ck-text, #525252); font-weight: 600; }

/* Company details — definition list */
.hb-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin: 0;
}
.hb-detail { min-width: 0; }
.hb-detail dt {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ck-faint, #8a90a2);
    margin-bottom: 2px;
}
.hb-detail dd {
    margin: 0;
    font-size: .88rem;
    font-weight: 500;
    color: var(--ck-ink, #1a1d24);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hb-detail:nth-child(odd):last-child { grid-column: 1 / -1; }

/* Checklist (grouped) */
.hb-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 380px;
    overflow-y: auto;
    margin: -4px -6px -8px;
    padding: 4px 6px 8px;
    scrollbar-width: thin;
}
.hb-checklist::-webkit-scrollbar { width: 8px; }
.hb-checklist::-webkit-scrollbar-thumb { background: #d7dae2; border-radius: 8px; }
.hb-check-group {
    border-radius: 10px;
    padding: 2px;
}
.hb-check-group + .hb-check-group { margin-top: 6px; }
.hb-check-group-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 8px 6px;
}
.hb-group-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .82rem;
    color: var(--ck-ink, #1a1d24);
    line-height: 1.3;
}
.hb-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: var(--ck-brand, #315eff);
    color: #fff;
    display: grid;
    place-items: center;
}
.hb-check--section { background: var(--ck-ok, #16a34a); }
.hb-check-children {
    list-style: none;
    margin: 0;
    padding: 0 0 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-left: 2px solid var(--ck-brand-tint, #eef2ff);
    margin-left: 17px;
}
.hb-check-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: .84rem;
    line-height: 1.4;
    color: var(--ck-text, #525252);
    transition: background var(--ck-dur-fast, .15s) var(--ck-ease);
}
.hb-check-item:hover { background: var(--ck-mist, #f4f6fa); }
.hb-check-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--ck-brand, #315eff);
    opacity: .65;
}
.hb-check-title { color: var(--ck-text, #525252); }

/* Empty state */
.hb-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 18px 8px;
}
.hb-empty-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ck-mist, #f4f6fa);
    color: var(--ck-faint, #8a90a2);
}
.hb-empty {
    margin: 0;
    font-size: .84rem;
    color: var(--ck-faint, #8a90a2);
    max-width: 26ch;
}

/* Regenerate button */
.hb-regenerate-wrap { display: flex; flex-direction: column; gap: 6px; }
.hb-regenerate-btn {
    position: relative;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    min-height: 46px;
    font-family: var(--font-head);
    font-size: .88rem;
    font-weight: 700;
    color: var(--ck-brand, #315eff);
    background: var(--ck-canvas, #fff);
    border: 1.5px solid #c2ccff;
    border-radius: var(--ck-r-md, 14px);
    cursor: pointer;
    box-shadow: var(--ck-shadow-1);
    transition: background var(--ck-dur-fast, .15s) var(--ck-ease),
                border-color var(--ck-dur-fast, .15s) var(--ck-ease),
                color var(--ck-dur-fast, .15s) var(--ck-ease),
                transform var(--ck-dur-fast, .15s) var(--ck-ease),
                box-shadow var(--ck-dur-fast, .15s) var(--ck-ease);
}
.hb-regenerate-btn:hover {
    background: var(--ck-brand-tint, #eef2ff);
    border-color: var(--ck-brand, #315eff);
    box-shadow: var(--ck-shadow-2);
}
.hb-regenerate-btn:active { transform: translateY(1px); }
.hb-regenerate-btn:focus-visible {
    outline: none;
    box-shadow: var(--ck-focus);
}
.hb-regenerate-btn:disabled { cursor: not-allowed; opacity: .75; }
.hb-regenerate-btn .hb-regen-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity var(--ck-dur-fast, .15s) var(--ck-ease);
}
.hb-regenerate-btn.is-loading .hb-regen-label { opacity: 0; }
.hb-regenerate-hint {
    margin: 0;
    text-align: center;
    font-size: .72rem;
    color: var(--ck-faint, #8a90a2);
    line-height: 1.4;
}

/* Spinner */
.hb-spinner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--ck-brand-tint-2, #d8e0ff);
    border-top-color: var(--ck-brand, #315eff);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}
.hb-regenerate-btn.is-loading .hb-spinner {
    opacity: 1;
    animation: hb-spin .7s linear infinite;
}
@keyframes hb-spin { to { transform: rotate(360deg); } }

/* Loading affordance for header buttons */
.hb-action-btn.is-loading { cursor: progress; opacity: .85; }
.hb-action-btn.is-loading .hb-btn-icon { animation: hb-pulse 1s ease-in-out infinite; }
@keyframes hb-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hb-card, .hb-action-btn, .hb-regenerate-btn, .hb-check-item { transition: none; }
    .hb-regenerate-btn.is-loading .hb-spinner,
    .hb-action-btn.is-loading .hb-btn-icon { animation: none; }
}

/* ─── Client Review Page (HRXconnect brand: modern document flow) ─── */

/* Scoped token set — nothing leaks to other pages. */
.client-body {
    --ck-brand: #315eff;
    --ck-brand-press: #2950e0;
    --ck-brand-tint: #eef2ff;
    --ck-brand-tint-2: #f4f7ff;
    --ck-accent: #00c9ff;
    --ck-ink: #1a1d24;
    --ck-text: #525252;
    --ck-muted: #6b7280;
    --ck-faint: #8a90a2;
    --ck-hair: #eceef2;
    --ck-border: #dbdde3;
    --ck-canvas: #ffffff;
    --ck-surface-alt: #fafbfc;
    --ck-mist: #f4f6fa;
    --ck-row-head: #f8f9fb;
    --ck-body-bg: #f1f2f5;
    --ck-ok: #16a34a;
    --ck-ok-tint: #ecfdf5;
    --ck-ok-border: #bbf7d0;
    --ck-warn: #b45309;
    --ck-warn-tint: #fef2f2;
    --ck-tertiary: #ffda2b;
    --ck-tertiary-ink: #6b5400;

    --ck-r-xs: 6px;
    --ck-r-sm: 10px;
    --ck-r-md: 14px;
    --ck-r-lg: 20px;
    --ck-pill: 999px;

    --ck-shadow-1: 0 1px 2px rgba(26, 29, 36, .04), 0 1px 1px rgba(26, 29, 36, .03);
    --ck-shadow-2: 0 4px 12px rgba(26, 29, 36, .06), 0 2px 4px rgba(26, 29, 36, .04);
    --ck-shadow-cta: 0 6px 16px rgba(49, 94, 255, .28);
    --ck-shadow-cta-hover: 0 8px 20px rgba(49, 94, 255, .32);

    --ck-focus: 0 0 0 3px rgba(49, 94, 255, .35);
    --ck-ease: cubic-bezier(.22, 1, .36, 1);
    --ck-dur-fast: .15s;
    --ck-dur-med: .22s;

    background-color: var(--ck-body-bg);
    background-image: radial-gradient(900px 420px at 50% -6%, rgba(0, 201, 255, .05) 0%, transparent 55%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--ck-text);
    font-family: var(--font-sans);
    padding-bottom: 96px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Visible keyboard focus everywhere */
.client-body :is(input, button, label, .ack-checkbox, [tabindex]):focus-visible {
    outline: 2px solid var(--ck-brand);
    outline-offset: 2px;
    border-radius: inherit;
}
.client-body .section-label input[type="checkbox"]:focus-visible,
.ck-ack .ack-checkbox input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: var(--ck-focus);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .client-body *, .client-body *::before, .client-body *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}

/* Topbar */
.ck-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--ck-hair);
    font-size: .72rem;
    letter-spacing: .04em;
}
.ck-topbar-brand {
    color: var(--ck-ink);
    font-family: var(--font-head);
    font-weight: 700;
}
.ck-topbar-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--ck-border);
}
.ck-topbar-eyebrow {
    color: var(--ck-faint);
    text-transform: uppercase;
    font-weight: 700;
}

/* Shell + single document column */
.client-shell {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 20px 120px;
}
.ck-doc {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Spacing between the cards inside <main> */
.ck-doc main {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Hero — white signing surface (no gradient) */
.client-hero {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    border-radius: var(--ck-r-lg);
    border: 1px solid var(--ck-hair);
    background: var(--ck-canvas);
    box-shadow: var(--ck-shadow-1);
    color: var(--ck-ink);
}
.client-hero::after { content: none; }

.hero-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.25rem;
    border-radius: var(--ck-r-sm);
    background: var(--ck-brand);
    color: #fff;
}

.hero-text {
    flex: 1;
    min-width: 0;
}
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ck-faint);
}
.hero-eyebrow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ck-accent);
}
.client-hero h1 {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: var(--ck-ink);
}
.hero-sub {
    max-width: 52ch;
    margin-top: 6px;
    font-size: .9rem;
    color: var(--ck-text);
}
.hero-pill {
    flex-shrink: 0;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: .72rem;
    font-weight: 600;
    border-radius: var(--ck-pill);
    background: var(--ck-brand-tint);
    color: var(--ck-brand-press);
}
.hero-pill svg { width: 15px; height: 15px; }

@media (max-width: 480px) {
    .client-hero { flex-direction: column; padding: 20px; }
}

/* Steps — slim breadcrumb */
.ck-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
}
.ck-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 0;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ck-faint);
}
.ck-step + .ck-step::before {
    content: "";
    width: 16px;
    height: 1px;
    background: var(--ck-border);
    margin-right: 8px;
}
.ck-step.is-active { color: var(--ck-ink); }
.ck-step.is-active .ck-step-num {
    background: var(--ck-brand);
}
.ck-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    background: var(--ck-faint);
    border-radius: 50%;
}
@media (max-width: 480px) {
    .ck-step span:last-child { display: none; }
    .ck-step + .ck-step::before { width: 10px; }
}

/* Cards — surface contrast, never elevate on hover */
.ck-grid {
    display: block;
    margin: 0;
}
.ck-grid > .ck-card + .ck-card { margin-top: 16px; }

.ck-card {
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hair);
    border-radius: var(--ck-r-lg);
    box-shadow: var(--ck-shadow-1);
    overflow: hidden;
    transition: none;
}
.ck-card:hover {
    box-shadow: var(--ck-shadow-1);
    transform: none;
}

.ck-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ck-hair);
}
.ck-card-head-row { justify-content: space-between; }
.ck-card-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ck-card-head h2 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ck-ink);
}

/* Monochrome icon (collapsed trio) */
.ck-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--ck-r-sm);
    background: var(--ck-row-head);
    color: var(--ck-ink);
}
.ck-icon-blue,
.ck-icon-green,
.ck-icon-purple {
    background: var(--ck-row-head);
    color: var(--ck-ink);
}
.ck-icon svg { width: 16px; height: 16px; }

.ck-card-head .btn-small {
    padding: 7px 12px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ck-muted);
    background: transparent;
    border: 1px solid var(--ck-hair);
    border-radius: var(--ck-r-sm);
    cursor: pointer;
    transition: background var(--ck-dur-fast) var(--ck-ease), color var(--ck-dur-fast) var(--ck-ease);
}
.ck-card-head .btn-small:hover {
    background: var(--ck-brand-tint);
    color: var(--ck-brand-press);
    border-color: transparent;
}
.bulk-actions { display: flex; gap: 6px; }

.ck-card-body { padding: 8px 20px 20px; }

/* Detail fields — definition list with hairline dividers */
.review-note {
    margin: 8px 0 0;
    padding: 0;
    font-size: .78rem;
    font-style: italic;
    color: var(--ck-faint);
}
.ck-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
}
.ck-summary .summary-item {
    padding: 12px 0;
    background: none;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--ck-hair);
    transition: none;
}
.ck-summary .summary-item:hover {
    transform: none;
    border-color: var(--ck-hair);
    background: none;
}
.ck-summary .summary-item:nth-child(-n+2) {
    border-top: 0;
    padding-top: 4px;
}
.ck-summary .summary-label {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ck-faint);
}
.ck-summary .summary-value {
    display: block;
    margin-top: 3px;
    font-size: .92rem;
    font-weight: 600;
    color: var(--ck-ink);
    word-break: break-word;
}
@media (max-width: 480px) {
    .ck-summary { grid-template-columns: 1fr; }
}

/* Tree wrapper */
.ck-tree-wrap {
    max-height: 540px;
    padding: 8px 12px 16px;
    overflow-y: auto;
}
.ck-tree-wrap::-webkit-scrollbar { width: 8px; }
.ck-tree-wrap::-webkit-scrollbar-track { background: transparent; }
.ck-tree-wrap::-webkit-scrollbar-thumb { background: var(--ck-border); border-radius: 8px; }
.ck-tree-wrap::-webkit-scrollbar-thumb:hover { background: var(--ck-faint); }

/* Empty / loading state */
.client-body #sectionTree:empty::before {
    content: "Loading policy sections…";
    display: block;
    padding: 32px 16px;
    text-align: center;
    color: var(--ck-faint);
    font-size: .85rem;
    font-style: italic;
}

/* Section tree — custom checkbox + real hierarchy */
.client-body .section-item.main > .section-label {
    background: var(--ck-surface-alt);
    border-bottom: 0;
    border-radius: var(--ck-r-sm);
    padding-right: 12px;
}
.client-body .section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: var(--ck-r-sm);
    cursor: pointer;
    transition: background-color var(--ck-dur-fast) var(--ck-ease);
}
.client-body .section-item.sub > .section-label {
    min-height: 44px;
    padding-left: 12px;
}
.client-body .section-label:hover {
    background: var(--ck-brand-tint);
}
.client-body .section-children {
    padding-left: 16px;
    margin-left: 14px;
    border-left: 1px solid var(--ck-hair);
}
.client-body .section-children.collapsed { display: none; }

/* Custom drawn checkbox (check + indeterminate dash) */
.client-body .section-label input[type="checkbox"],
.ck-ack .ack-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin: 0;
    border-radius: var(--ck-r-xs);
    border: 2px solid var(--ck-border);
    background-color: var(--ck-canvas);
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    transition: background-color var(--ck-dur-fast) var(--ck-ease), border-color var(--ck-dur-fast) var(--ck-ease);
}
.client-body .section-label input[type="checkbox"]:checked,
.ck-ack .ack-checkbox input[type="checkbox"]:checked {
    background-color: var(--ck-brand);
    border-color: var(--ck-brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.client-body .section-label input[type="checkbox"]:indeterminate {
    background-color: var(--ck-brand);
    border-color: var(--ck-brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='4' viewBox='0 0 14 4'%3E%3Crect width='14' height='4' rx='2' fill='white'/%3E%3C/svg%3E");
}

/* Group accent: 3px brand left-inset on selected/indeterminate rows */
.client-body .section-item:has(.section-label > input[type="checkbox"]:checked) > .section-label,
.client-body .section-item:has(.section-label > input[type="checkbox"]:indeterminate) > .section-label {
    box-shadow: inset 3px 0 0 var(--ck-brand);
}

.client-body .section-label.main-section .section-title {
    color: var(--ck-ink);
    font-weight: 600;
    font-size: .92rem;
}
.client-body .section-label.sub-section .section-title {
    color: var(--ck-text);
    font-weight: 500;
    font-size: .88rem;
}
.client-body .section-title {
    flex: 1;
    min-width: 0;
}

/* Extended badge — refined tertiary yellow */
.client-body .extended-badge {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: var(--ck-r-xs);
    background: rgba(255, 218, 43, .35);
    color: var(--ck-tertiary-ink);
}

/* Drawn chevron (hides the JS ▶ via font-size:0) */
.client-body .expand-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    color: transparent;
    background-color: transparent;
    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='%238A90A2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    border: 0;
    padding: 0;
    border-radius: var(--ck-r-sm);
    cursor: pointer;
    transition: transform var(--ck-dur-med) var(--ck-ease), background-color var(--ck-dur-fast) var(--ck-ease);
}
.client-body .expand-btn:hover {
    background-color: var(--ck-brand-tint);
}
.client-body .expand-btn.expanded {
    transform: rotate(90deg);
}

/* Acknowledge */
.ck-ack-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 480px) {
    .ck-ack-fields { grid-template-columns: 1fr; }
}
.ck-ack .form-group { margin-bottom: 0; }
.ck-ack .form-group label {
    display: block;
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ck-faint);
    margin-bottom: 6px;
}
.ck-ack .form-group input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-size: .92rem;
    color: var(--ck-ink);
    background: var(--ck-canvas);
    border: 1px solid var(--ck-border);
    border-radius: var(--ck-r-sm);
    transition: border-color var(--ck-dur-fast) var(--ck-ease), box-shadow var(--ck-dur-fast) var(--ck-ease);
}
.ck-ack .form-group input::placeholder { color: var(--ck-faint); }
.ck-ack .form-group input:focus {
    outline: none;
    border-color: var(--ck-brand);
    box-shadow: var(--ck-focus);
}

.ck-ack .ack-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 0;
    padding: 14px 16px;
    background: var(--ck-mist);
    border: 1px solid var(--ck-hair);
    border-radius: var(--ck-r-md);
    cursor: pointer;
    transition: background var(--ck-dur-fast) var(--ck-ease), border-color var(--ck-dur-fast) var(--ck-ease);
}
.ck-ack .ack-checkbox:has(input:checked) {
    background: var(--ck-ok-tint);
    border-color: var(--ck-ok-border);
}
.ck-ack .ack-checkbox:has(input:focus-visible) {
    box-shadow: var(--ck-focus);
}
.ck-ack .ack-text {
    font-size: .85rem;
    color: var(--ck-ink);
    font-weight: 500;
}

/* Submit dock — sticky, frosted, one saturated CTA */
.ck-submit-dock {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-top: 8px;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--ck-hair);
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.ck-submit-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.ck-count {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ck-muted);
}
.ck-submit-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.ck-submit-bar .btn-generate {
    min-height: 48px;
    padding: 0 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
    background: var(--ck-brand);
    border: 0;
    border-radius: var(--ck-r-sm);
    box-shadow: var(--ck-shadow-cta);
    cursor: pointer;
    transition: background var(--ck-dur-fast) var(--ck-ease), box-shadow var(--ck-dur-fast) var(--ck-ease), transform var(--ck-dur-fast) var(--ck-ease);
}
.ck-submit-bar .btn-generate:hover {
    background: var(--ck-brand-press);
    box-shadow: var(--ck-shadow-cta-hover);
}
.ck-submit-bar .btn-generate:active {
    transform: translateY(1px);
    box-shadow: var(--ck-shadow-cta);
}
.ck-submit-bar .btn-generate:disabled {
    background: var(--ck-border);
    color: rgba(255, 255, 255, .9);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.ck-submit-bar .btn-generate svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
    .ck-submit-inner { flex-direction: column; align-items: stretch; gap: 8px; }
    .ck-submit-bar { align-items: stretch; }
    .ck-submit-bar .btn-generate { justify-content: center; }
    .ck-count { text-align: center; }
}

/* Status message — desaturated inline pill */
.client-body .status-message {
    font-size: .8rem;
    padding: 6px 10px;
    border-radius: var(--ck-pill);
    text-align: center;
    font-weight: 500;
}
.client-body .status-message:empty { display: none; }
.client-body .status-message.loading { background: var(--ck-brand-tint-2); color: var(--ck-brand-press); display: block; }
.client-body .status-message.success { background: var(--ck-ok-tint); color: var(--ck-ok); display: block; }
.client-body .status-message.error { background: var(--ck-warn-tint); color: var(--ck-warn); display: block; }

/* Success — signed receipt */
.client-success {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.success-tile {
    max-width: 460px;
    padding: 40px 32px;
    text-align: center;
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hair);
    border-radius: var(--ck-r-lg);
    box-shadow: var(--ck-shadow-2);
}
.success-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--ck-brand);
    color: #fff;
    box-shadow: var(--ck-shadow-cta);
}
.success-check svg { width: 32px; height: 32px; }
.success-tile h2 {
    margin-bottom: 8px;
    font-family: var(--font-head);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ck-ink);
}
.success-tile p {
    color: var(--ck-text);
    font-size: .9rem;
}
.success-ref {
    margin-top: 16px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--ck-faint);
}

/* ---- Handbook: table of contents & page breaks (editor + preview) ---- */
.ql-editor .toc {
    margin: 16px 0 24px;
}
.ql-editor .toc-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 4px;
}
.ql-editor .toc-rule {
    border-bottom: 2px solid #1a365d;
    margin-bottom: 12px;
}
.ql-editor .toc-entry {
    display: flex;
    align-items: baseline;
    margin: 4px 0;
}
.ql-editor .toc-entry.toc-l1 {
    font-weight: 700;
    color: #1a365d;
    margin-top: 10px;
}
.ql-editor .toc-entry.toc-l2 {
    color: #2c5282;
    padding-left: 24px;
}
.ql-editor .toc-dots {
    flex: 1 1 auto;
    border-bottom: 1px dotted #999;
    margin: 0 6px 3px;
    min-width: 24px;
    align-self: flex-end;
}
.ql-editor .page-break {
    page-break-before: always;
    break-before: page;
    height: 0;
    border-top: 1px dashed #cbd5e0;
    margin: 16px 0;
    position: relative;
}
.ql-editor .page-break::after {
    content: "page break";
    position: relative;
    top: 4px;
    left: 8px;
    font-size: .65rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #a0aec0;
}

/* ════════════════════════════════════════════════════════════════════════
   ADMIN APP SHELL — brings dashboard/index/create-link/editor/auth up to the
   same polished, document-flow quality bar as the .client-body review page.
   Scoped under .admin-body / .auth-body so nothing leaks onto the client page.
   ════════════════════════════════════════════════════════════════════════ */

.admin-body {
    --brand: #315eff;
    --brand-press: #2950e0;
    --brand-tint: #eef2ff;
    --brand-tint-2: #f4f7ff;
    --accent: #00c9ff;
    --ink: #1a1d24;
    --text: #525252;
    --muted: #6b7280;
    --faint: #8a90a2;
    --hair: #eceef2;
    --border: #dbdde3;
    --canvas: #ffffff;
    --surface-alt: #fafbfc;
    --mist: #f4f6fa;
    --row-head: #f8f9fb;
    --body-bg: #f1f2f5;
    --ok: #16a34a;
    --ok-tint: #ecfdf5;
    --ok-border: #bbf7d0;
    --warn: #b45309;
    --warn-tint: #fff7ed;
    --warn-border: #fed7aa;
    --err: #dc2626;
    --err-tint: #fef2f2;
    --err-border: #fecaca;

    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-pill: 999px;

    --shadow-1: 0 1px 2px rgba(26, 29, 36, .04), 0 1px 1px rgba(26, 29, 36, .03);
    --shadow-2: 0 4px 12px rgba(26, 29, 36, .06), 0 2px 4px rgba(26, 29, 36, .04);
    --shadow-cta: 0 6px 16px rgba(49, 94, 255, .28);
    --shadow-cta-hover: 0 8px 20px rgba(49, 94, 255, .32);

    --focus: 0 0 0 3px rgba(49, 94, 255, .35);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --dur-fast: .15s;
    --dur-med: .22s;

    background-color: var(--body-bg);
    background-image: radial-gradient(900px 420px at 50% -6%, rgba(0, 201, 255, .05) 0%, transparent 55%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Visible keyboard focus across the admin shell */
.admin-body :is(input, select, textarea, button, a, label, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: inherit;
}

/* Shared sticky topbar (frosted) */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--hair);
    font-size: .72rem;
    letter-spacing: .04em;
}
.admin-topbar .ck-topbar-brand {
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .92rem;
    letter-spacing: -.01em;
}
.admin-topbar .ck-topbar-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border);
}
.admin-topbar .ck-topbar-eyebrow {
    color: var(--faint);
    text-transform: uppercase;
    font-weight: 700;
}
.admin-topbar .topbar-spacer { flex: 1; }
.admin-topbar .topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: 0;
    text-transform: none;
}
.admin-topbar .topbar-user .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .72rem;
}

/* Content shell */
.admin-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}
.admin-shell.is-wide { max-width: 1320px; }

/* Page heading row */
.page-head {
    margin-bottom: 24px;
}
.page-head .page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
}
.page-head .page-eyebrow .dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.page-head h1 {
    font-family: var(--font-head);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--ink);
}
.page-head .page-sub {
    max-width: 60ch;
    margin-top: 6px;
    font-size: .92rem;
    color: var(--text);
}

/* Back link shared across sub-pages */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    font-size: .85rem;
    padding: 6px 0;
}
.btn-back:hover { color: var(--brand-press); }

/* Monochrome icon tile (same language as .ck-icon) */
.icon-tile {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--row-head);
    color: var(--ink);
}
.icon-tile svg { width: 18px; height: 18px; }
.icon-tile.is-brand { background: var(--brand); color: #fff; }
.icon-tile.is-brand svg { width: 16px; height: 16px; }

/* Generic card */
.adm-card {
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.adm-card .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--hair);
}
.adm-card .card-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.adm-card .card-head h2 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink);
}
.adm-card .card-body { padding: 20px; }

/* ── Buttons (flat brand language) ── */
.admin-body .btn-primary,
.admin-body .btn-generate,
.admin-body .btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 44px;
    font-family: var(--font-sans);
    font-size: .9rem;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-cta);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
}
.admin-body .btn-primary:hover,
.admin-body .btn-generate:hover,
.admin-body .btn-auth:hover {
    background: var(--brand-press);
    box-shadow: var(--shadow-cta-hover);
    color: #fff;
}
.admin-body .btn-primary:active,
.admin-body .btn-generate:active { transform: translateY(1px); }
.admin-body .btn-generate:disabled,
.admin-body .btn-primary:disabled,
.admin-body .btn-auth:disabled {
    background: var(--border);
    color: rgba(255, 255, 255, .9);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.admin-body .btn-generate svg,
.admin-body .btn-primary svg,
.admin-body .btn-auth svg { width: 16px; height: 16px; }

.admin-body .btn-secondary,
.admin-body .btn-auth-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    min-height: 44px;
    font-family: var(--font-sans);
    font-size: .88rem;
    font-weight: 600;
    color: var(--brand);
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
}
.admin-body .btn-secondary:hover,
.admin-body .btn-auth-secondary:hover {
    background: var(--brand-tint);
    border-color: transparent;
    color: var(--brand-press);
}
.admin-body .btn-secondary svg { width: 15px; height: 15px; }

.admin-body .btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    min-height: 38px;
    font-family: var(--font-sans);
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.admin-body .btn-logout:hover { background: var(--surface-alt); border-color: var(--faint); }
.admin-body .btn-logout svg { width: 14px; height: 14px; }

/* Small ghost / pill action buttons inside tables */
.admin-body .btn-small {
    padding: 7px 12px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--hair);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.admin-body .btn-small:hover {
    background: var(--brand-tint);
    color: var(--brand-press);
    border-color: transparent;
}

/* ── Stats cards ── */
.admin-body .stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.admin-body .stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    text-align: left;
}
.admin-body .stat-card .stat-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--brand-tint);
    color: var(--brand);
}
.admin-body .stat-card .stat-icon svg { width: 20px; height: 20px; }
.admin-body .stat-card .stat-meta { min-width: 0; }
.admin-body .stat-number {
    font-family: var(--font-head);
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.admin-body .stat-label {
    margin-top: 6px;
    color: var(--faint);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
@media (max-width: 768px) {
    .admin-body .stats-cards { grid-template-columns: 1fr; }
}

/* ── Segmented tabs ── */
.admin-body .dashboard-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-1);
    border-bottom: 0;
    flex-wrap: wrap;
}
.admin-body .tab-btn {
    padding: 9px 18px;
    min-height: 38px;
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    margin-bottom: 0;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: .85rem;
    color: var(--muted);
    border-bottom: 0;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.admin-body .tab-btn:hover { color: var(--ink); }
.admin-body .tab-btn.active {
    color: #fff;
    background: var(--brand);
    border-bottom-color: transparent;
}

/* ── Tables ── */
.admin-body .data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.admin-body .data-table th,
.admin-body .data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--hair);
}
.admin-body .data-table thead th {
    background: var(--row-head);
    font-weight: 700;
    color: var(--faint);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--hair);
}
.admin-body .data-table tbody tr {
    transition: background var(--dur-fast) var(--ease);
}
.admin-body .data-table tbody tr:hover {
    background: var(--brand-tint-2);
}
.admin-body .data-table tbody tr:last-child td { border-bottom: 0; }
.admin-body .data-table td {
    font-size: .88rem;
    color: var(--text);
    vertical-align: middle;
}
.admin-body .data-table td strong {
    color: var(--ink);
    font-weight: 600;
}
.admin-body .data-table td .num { font-variant-numeric: tabular-nums; }
.admin-body .share-link {
    display: inline-block;
    background: var(--surface-alt);
    color: var(--muted);
    padding: 5px 10px;
    border-radius: var(--r-xs);
    font-size: .78rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    word-break: break-all;
    border: 1px solid var(--hair);
}
.admin-body .btn-copy {
    padding: 6px 12px;
    min-height: 32px;
    font-size: .76rem;
    font-weight: 600;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: var(--r-xs);
    cursor: pointer;
    margin-left: 8px;
    transition: background var(--dur-fast) var(--ease);
}
.admin-body .btn-copy:hover { background: var(--brand-press); }
.admin-body .btn-copy.copied { background: var(--ok); }
.admin-body .btn-delete {
    padding: 6px 12px;
    min-height: 32px;
    font-size: .76rem;
    font-weight: 600;
    background: transparent;
    color: var(--err);
    border: 1px solid var(--err-border);
    border-radius: var(--r-xs);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
}
.admin-body .btn-delete:hover { background: var(--err-tint); }
.admin-body .btn-action {
    display: inline-block;
    padding: 6px 12px;
    min-height: 32px;
    line-height: 20px;
    font-size: .76rem;
    font-weight: 600;
    background: var(--brand-tint);
    color: var(--brand-press);
    border: 0;
    border-radius: var(--r-xs);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease);
}
.admin-body .btn-action:hover { background: #e0e7ff; }
.admin-body .btn-export {
    padding: 6px 12px;
    min-height: 32px;
    font-size: .76rem;
    font-weight: 600;
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    cursor: pointer;
    margin-left: 6px;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.admin-body .btn-export:first-of-type { margin-left: 0; }
.admin-body .btn-export:hover { background: var(--brand-tint); border-color: transparent; }
.admin-body .badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-alt);
    border: 1px solid var(--hair);
    border-radius: var(--r-pill);
    font-style: normal;
}
.admin-body .badge-pending::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    animation: adminPulse 1.4s ease-in-out infinite;
}
@keyframes adminPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* Table action cell — keep buttons on one line */
.admin-body .data-table td:last-child { white-space: nowrap; }

/* Empty state */
.admin-body .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 56px 24px;
    color: var(--faint);
    background: var(--canvas);
    border: 1px solid var(--hair);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}
.admin-body .empty-state .empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--faint);
    margin-bottom: 4px;
}
.admin-body .empty-state .empty-icon svg { width: 22px; height: 22px; }
.admin-body .empty-state p { font-size: .9rem; margin: 0; }

/* Status messages */
.admin-body .status-message {
    margin-top: 14px;
    padding: 10px 16px;
    border-radius: var(--r-pill);
    text-align: center;
    font-weight: 600;
    font-size: .82rem;
    display: none;
}
.admin-body .status-message:empty { display: none; }
.admin-body .status-message.loading { display: block; background: var(--brand-tint-2); color: var(--brand-press); }
.admin-body .status-message.success { display: block; background: var(--ok-tint); color: var(--ok); }
.admin-body .status-message.error { display: block; background: var(--err-tint); color: var(--err); }

/* ── Forms (index + create_link) ── */
.admin-body .panel {
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.admin-body .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--canvas);
    color: var(--ink);
    border-bottom: 1px solid var(--hair);
}
.admin-body .panel-header .panel-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-body .panel-header h2 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink);
}
.admin-body .panel-content {
    padding: 16px 20px 20px;
    max-height: 620px;
    overflow-y: auto;
}
.admin-body .panel-content::-webkit-scrollbar { width: 8px; }
.admin-body .panel-content::-webkit-scrollbar-track { background: transparent; }
.admin-body .panel-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* Section tree (admin generator) — reuse client tree look */
.admin-body .section-item { margin-bottom: 2px; }
.admin-body .section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
}
.admin-body .section-label:hover { background: var(--brand-tint); }
.admin-body .section-item.main > .section-label { background: var(--surface-alt); }
.admin-body .section-label input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; height: 20px;
    flex-shrink: 0;
    margin: 0;
    border-radius: var(--r-xs);
    border: 2px solid var(--border);
    background-color: var(--canvas);
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.admin-body .section-label input[type="checkbox"]:checked {
    background-color: var(--brand);
    border-color: var(--brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.admin-body .section-label.main-section .section-title { color: var(--ink); font-weight: 600; font-size: .92rem; }
.admin-body .section-label.sub-section .section-title { color: var(--text); font-weight: 500; font-size: .88rem; }
.admin-body .section-title { flex: 1; min-width: 0; }
.admin-body .section-children {
    margin-left: 14px;
    padding-left: 16px;
    border-left: 1px solid var(--hair);
}
.admin-body .section-children.collapsed { display: none; }
.admin-body .expand-btn {
    width: 28px; height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    color: transparent;
    background-color: transparent;
    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='%238A90A2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    border: 0; padding: 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: transform var(--dur-med) var(--ease), background-color var(--dur-fast) var(--ease);
}
.admin-body .expand-btn:hover { background-color: var(--brand-tint); }
.admin-body .expand-btn.expanded { transform: rotate(90deg); }
.admin-body .extended-badge {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: var(--r-xs);
    background: rgba(255, 218, 43, .35);
    color: #6b5400;
}

/* Form fields (shared by index + create_link) */
.admin-body .form-section {
    margin-bottom: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--hair);
}
.admin-body .form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.admin-body .form-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 14px;
}
.admin-body .form-section h3::before {
    content: "";
    width: 14px; height: 2px; border-radius: 2px;
    background: var(--brand);
}
.admin-body .form-group { margin-bottom: 14px; }
.admin-body .form-group label {
    display: block;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--muted);
    margin-bottom: 6px;
}
.admin-body .form-group input,
.admin-body .form-group select,
.admin-body .form-group textarea {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: var(--font-sans);
    font-size: .92rem;
    color: var(--ink);
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.admin-body .form-group input::placeholder { color: var(--faint); }
.admin-body .form-group input:focus,
.admin-body .form-group select:focus,
.admin-body .form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus);
}
.admin-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 560px) {
    .admin-body .form-row { grid-template-columns: 1fr; }
}

/* Generate dock (index.html) */
.admin-body .generate-section {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-top: 8px;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--hair);
    border-radius: var(--r-lg);
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.admin-body .generate-section .btn-generate { padding: 0 26px; }
.admin-body .generate-section .status-message { margin: 6px 0 0; flex-basis: 100%; }

/* Panels grid for index */
.admin-body .panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 8px;
}
@media (max-width: 1024px) { .admin-body .panels { grid-template-columns: 1fr; } }

.admin-body header {
    text-align: left;
    margin-bottom: 0;
    padding: 0;
}
.admin-body header h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--ink);
}
.admin-body header .subtitle { color: var(--text); font-size: .92rem; }

/* Create link card */
.admin-body .form-card {
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    padding: 28px;
    max-width: 720px;
    margin: 0 auto;
}
.admin-body .form-card h2 {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
}
.admin-body .form-description {
    color: var(--text);
    margin-bottom: 24px;
    font-size: .9rem;
    max-width: 64ch;
}
.admin-body .link-display {
    background: var(--surface-alt);
    border: 1px solid var(--hair);
    border-radius: var(--r-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.admin-body .link-display code {
    flex: 1;
    word-break: break-all;
    font-size: .85rem;
    color: var(--ink);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.admin-body .success-card {
    background: var(--ok-tint);
    border: 1px solid var(--ok-border);
    border-radius: var(--r-lg);
    padding: 28px;
    text-align: center;
    margin-top: 8px;
}
.admin-body .success-card h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ok);
    margin-bottom: 8px;
}
.admin-body .success-card .success-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
}
.admin-body .success-card .success-check svg { width: 22px; height: 22px; }

/* Handbook editor */
/* On the handbook page the .handbook-layout grid drives the layout; give it
   room and alias --ck-* tokens so the existing .hb-* styles read live brand. */
.admin-body .handbook-shell {
    max-width: 1280px;
    padding: 24px 20px 80px;
}
.admin-body .handbook-layout {
    --ck-brand: var(--brand);
    --ck-brand-press: var(--brand-press);
    --ck-brand-tint: var(--brand-tint);
    --ck-canvas: var(--canvas);
    --ck-border: var(--border);
    --ck-faint: var(--faint);
    --ck-muted: var(--muted);
    --ck-ink: var(--ink);
    --ck-r-sm: var(--r-sm);
    --ck-r-md: var(--r-md);
    --ck-pill: var(--r-pill);
    --ck-ease: var(--ease);
    --ck-dur-fast: var(--dur-fast);
    --ck-dur-med: var(--dur-med);
    --ck-focus: var(--focus);
    --ck-shadow-1: var(--shadow-1);
    --ck-shadow-2: var(--shadow-2);
    max-width: none;
    margin: 0;
    padding: 0;
}
/* header / actions inherit admin tokens */
.admin-body .handbook-layout .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    background: var(--canvas);
    box-shadow: var(--shadow-1);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.admin-body .handbook-layout .header-left { gap: 16px; min-width: 0; }
.admin-body .handbook-layout h1 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}
/* Action buttons use the flat admin button language */
.admin-body .handbook-layout .hb-action-btn.btn-primary {
    background: var(--brand);
    color: #fff;
    border: 0;
    box-shadow: var(--shadow-cta);
}
.admin-body .handbook-layout .hb-action-btn.btn-primary:hover { background: var(--brand-press); }
.admin-body .handbook-layout .hb-action-btn.btn-secondary {
    background: var(--canvas);
    color: var(--brand);
    border: 1px solid var(--border);
    box-shadow: none;
}
.admin-body .handbook-layout .hb-action-btn.btn-secondary:hover { background: var(--brand-tint); border-color: transparent; }
.admin-body .handbook-layout .hb-action-btn.is-loading { opacity: .7; cursor: progress; }

/* Editor surface + Quill toolbar integration */
/* Allow cards to grow with their content — no clipping. */
.admin-body .handbook-layout .hb-card { overflow: visible; }
.admin-body .handbook-layout .hb-name,
.admin-body .handbook-layout .hb-email,
.admin-body .handbook-layout .hb-detail dd {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}
/* Sidebar: let it expand to fit all content instead of cutting it off. */
.admin-body .handbook-layout .handbook-meta {
    position: static;
    max-height: none;
    overflow: visible;
}
.admin-body .handbook-layout #editor-wrapper {
    margin-top: 0;
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.admin-body .handbook-layout .ql-toolbar.ql-snow {
    border: 0;
    border-bottom: 1px solid var(--hair);
    background: var(--surface-alt);
    padding: 10px 14px;
}
.admin-body .handbook-layout .ql-container.ql-snow { border: 0; }
.admin-body .handbook-layout .ql-editor {
    padding: 24px 28px;
}
.admin-body .handbook-layout #quill-editor {
    min-height: 620px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    font-size: .96rem;
}
.admin-body .editor-container { max-width: 1040px; padding: 0; }
.admin-body .editor-container .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--hair);
    margin-bottom: 16px;
    text-align: left;
    flex-wrap: wrap;
}
.admin-body .editor-container .header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.admin-body .editor-container h1 {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-body .editor-container .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-body .editor-container .btn-primary,
.admin-body .editor-container .btn-secondary {
    padding: 9px 16px;
    font-size: .82rem;
    min-height: 40px;
}
.admin-body #editor-wrapper {
    margin-top: 8px;
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.admin-body .ql-toolbar.ql-snow {
    border: 0;
    border-bottom: 1px solid var(--hair);
    background: var(--surface-alt);
    padding: 10px 14px;
}
.admin-body .ql-container.ql-snow { border: 0; }
.admin-body #quill-editor {
    min-height: 600px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: .95rem;
}

/* Footer */
.admin-body footer {
    text-align: center;
    padding: 28px 20px 0;
    color: var(--faint);
    font-size: .8rem;
    margin-top: 24px;
}

/* ════════════════ AUTH SHELL ════════════════ */
.auth-body {
    --brand: #315eff;
    --brand-press: #2950e0;
    --brand-tint: #eef2ff;
    --accent: #00c9ff;
    --ink: #1a1d24;
    --text: #525252;
    --muted: #6b7280;
    --faint: #8a90a2;
    --hair: #eceef2;
    --border: #dbdde3;
    --canvas: #ffffff;
    --row-head: #f8f9fb;
    --ok: #16a34a;
    --ok-tint: #ecfdf5;
    --ok-border: #bbf7d0;
    --warn: #b45309;
    --warn-tint: #fff7ed;
    --warn-border: #fed7aa;
    --err: #dc2626;
    --err-tint: #fef2f2;
    --err-border: #fecaca;
    --shadow-1: 0 1px 2px rgba(26,29,36,.04), 0 1px 1px rgba(26,29,36,.03);
    --shadow-2: 0 4px 12px rgba(26,29,36,.06), 0 2px 4px rgba(26,29,36,.04);
    --shadow-cta: 0 6px 16px rgba(49,94,255,.28);
    --focus: 0 0 0 3px rgba(49,94,255,.35);
    --ease: cubic-bezier(.22,1,.36,1);
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-pill: 999px;

    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: #f1f2f5;
    background-image: radial-gradient(900px 420px at 50% -6%, rgba(0, 201, 255, .06) 0%, transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.auth-body :is(input, button, a, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: inherit;
}
.auth-body .auth-card {
    background: var(--canvas);
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-body .auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    color: var(--ink);
}
.auth-body .auth-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--r-sm);
    background: var(--brand);
    color: #fff;
}
.auth-body .auth-brand .brand-mark svg { width: 18px; height: 18px; }
.auth-body .auth-header {
    text-align: center;
    margin-bottom: 28px;
}
.auth-body .auth-header h1 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--ink);
    margin-bottom: 6px;
}
.auth-body .auth-header p { color: var(--muted); font-size: .92rem; }
.auth-body .auth-form .form-group { margin-bottom: 18px; }
.auth-body .auth-form label {
    display: block;
    font-size: .76rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}
.auth-body .auth-form input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-family: var(--font-sans);
    font-size: .94rem;
    color: var(--ink);
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color var(--dur-fast, .15s) var(--ease), box-shadow var(--dur-fast, .15s) var(--ease);
}
.auth-body .auth-form input::placeholder { color: var(--faint); }
.auth-body .auth-form input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus);
}
.auth-body .btn-auth {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    min-height: 46px;
    font-size: .95rem;
    font-weight: 600;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-cta);
    cursor: pointer;
    transition: background var(--ease), box-shadow var(--ease);
}
.auth-body .btn-auth:hover { background: var(--brand-press); box-shadow: 0 8px 20px rgba(49,94,255,.32); }
.auth-body .btn-auth-secondary {
    width: 100%;
    background: var(--canvas);
    color: var(--brand);
    border: 1px solid var(--border);
    box-shadow: none;
}
.auth-body .btn-auth-secondary:hover { background: var(--brand-tint); box-shadow: none; }

.auth-body .auth-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--err-tint);
    color: var(--err);
    border: 1px solid var(--err-border);
    padding: 12px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 18px;
    font-size: .85rem;
}
.auth-body .auth-info {
    background: var(--brand-tint);
    color: var(--brand-press);
    border: 1px solid #dbe3ff;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 18px;
    font-size: .85rem;
}
.auth-body .auth-success {
    background: var(--ok-tint);
    color: var(--ok);
    border: 1px solid var(--ok-border);
    padding: 12px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 18px;
    font-size: .85rem;
}
.auth-body .auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--muted);
    font-size: .85rem;
}
.auth-body .auth-footer a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}
.auth-body .auth-footer a:hover { color: var(--brand-press); }

@media (max-width: 560px) {
    .auth-body .auth-card { padding: 28px 22px; }
    .admin-body .admin-shell { padding: 22px 16px 80px; }
    .admin-body .admin-topbar { padding: 0 16px; }
}

/* ─── Logo dropzone ─── */
.logo-hint {
    font-size: .8rem;
    color: var(--muted);
    margin: 2px 0 8px;
    line-height: 1.4;
}
.logo-hint kbd {
    background: #eef1f6;
    border: 1px solid #d4dae5;
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 6px;
    font-size: .72rem;
    font-family: inherit;
    color: #4a5160;
}
.logo-dropzone {
    position: relative;
    border: 1.5px dashed #c2cad9;
    border-radius: var(--r-sm, 10px);
    background: #fafbfe;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    padding: 16px;
}
.logo-dropzone:hover,
.logo-dropzone.dragover {
    border-color: var(--brand);
    background: #f3f6ff;
}
.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
    font-size: .85rem;
}
.logo-placeholder svg {
    width: 28px;
    height: 28px;
    color: #9aa3b5;
}
.logo-preview {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.logo-preview img {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.logo-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #1f2937;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.logo-remove:hover { background: #111827; }
