:root {
    --bg-a: #f3f8ff;
    --bg-b: #fff8ef;
    --bg-c: #f4fff6;
    --ink-1: #111827;
    --ink-2: #374151;
    --brand: #1643c9;
    --brand-soft: #e7efff;
    --danger: #dc2626;
    --card: rgba(255, 255, 255, 0.86);
    --border: rgba(17, 24, 39, 0.08);
    --radius: 18px;
    --shadow: 0 16px 48px rgba(17, 24, 39, 0.08);
    --btn-h: 44px;
    --btn-h-mini: 38px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Plus Jakarta Sans", sans-serif;
    color: var(--ink-1);
    background: linear-gradient(120deg, var(--bg-a), var(--bg-b), var(--bg-c));
    position: relative;
}

body.modal-open {
    overflow: hidden;
}

.bg-blur {
    position: fixed;
    border-radius: 999px;
    filter: blur(44px);
    z-index: 0;
    opacity: .52;
}

.bg-blur-1 {
    width: 320px;
    height: 320px;
    background: #c7dbff;
    top: -80px;
    right: -60px;
}

.bg-blur-2 {
    width: 280px;
    height: 280px;
    background: #ffd9e8;
    bottom: 20px;
    left: -60px;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.site-header {
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 26px rgba(15, 23, 42, 0.06);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink-1);
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-toggle {
    display: none;
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
    color: var(--ink-1);
    cursor: pointer;
}

.nav-links a {
    color: var(--ink-2);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
}

.lang-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border);
}

.page-content {
    padding: 28px 0 36px;
    display: grid;
    gap: 14px;
    flex: 1 0 auto;
    position: relative;
    z-index: 3;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    overflow: hidden;
}

.elevated {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 255, 0.92));
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 18px;
    margin-bottom: 18px;
}

.hero-copy h1 {
    margin: 10px 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.8rem, 2.8vw, 3rem);
    line-height: 1.1;
}

.eyebrow {
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .78rem;
    font-weight: 700;
    color: #425386;
    margin: 0;
}

.hero-copy p {
    margin-top: 8px;
    color: var(--ink-2);
    line-height: 1.6;
}

.hero-copy .lead {
    font-size: 1.02rem;
}

.hero-bullets {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--ink-2);
    display: grid;
    gap: 6px;
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
}

.hero-stat-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.stat-chip {
    background: #ffffff;
    border: 1px solid #e6ebf5;
    border-radius: 12px;
    padding: 10px 12px;
}

.stat-chip strong {
    display: block;
    font-size: .82rem;
    font-family: "Space Grotesk", sans-serif;
    margin-bottom: 4px;
}

.stat-chip span {
    font-size: .78rem;
    color: #4b5563;
    line-height: 1.4;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
}

.cta-row > form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, #2456d8, #1d4ed8);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    padding: 11px 16px;
    cursor: pointer;
    min-height: var(--btn-h);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
    transition: transform .08s ease, box-shadow .12s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 84, 202, 0.22);
}

.btn-soft {
    color: #1f3f9b;
    background: var(--brand-soft);
}

.btn-ghost {
    color: #1f3f9b;
    background: rgba(31, 63, 155, 0.08);
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-success {
    background: linear-gradient(120deg, #16a34a, #15803d);
    color: #fff;
}

.btn-mini {
    padding: 8px 12px;
    font-size: .84rem;
    border-radius: 10px;
    min-height: var(--btn-h-mini);
}

.btn-icon-mini {
    min-width: var(--btn-h-mini);
    padding: 8px;
}

.btn-icon-mini svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-loading {
    opacity: .75;
    cursor: not-allowed;
}

.feature-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.feature-card h3 {
    margin: 12px 0 8px;
    font-size: 1rem;
    font-family: "Space Grotesk", sans-serif;
}

.metrics-grid .feature-card p {
    margin: 0;
}

.metrics-grid .feature-card strong {
    display: inline-block;
    font-size: 1.75rem;
    line-height: 1.1;
    color: #1d4ed8;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e3ebfa;
    border-radius: 14px;
    background: #fff;
}

.metric-card h3 {
    margin: 0 0 6px;
    font-size: .92rem;
}

.metric-card p {
    margin: 0;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: .02em;
    color: #1d4ed8;
    background: #e8f0ff;
}

.metric-card-success .metric-icon {
    color: #047857;
    background: #dcfce7;
}

.metric-card-warning .metric-icon {
    color: #b45309;
    background: #fef3c7;
}

.metric-card-danger .metric-icon {
    color: #b91c1c;
    background: #fee2e2;
}

.dashboard-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

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

.dashboard-metric-mini-row {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 360px));
    gap: 14px;
    justify-content: start;
}

.dashboard-user-metrics .dashboard-metric-mini-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
}

.dashboard-metric-tile-mini {
    min-height: 92px;
}

.dashboard-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.dashboard-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.dashboard-full-width {
    width: 100%;
    grid-column: 1 / -1;
}

.dashboard-metric-tile {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 12px;
    align-items: center;
    min-height: 112px;
    padding: 14px;
    border: 1px solid #e3ebfa;
    border-radius: 14px;
    background: #fff;
}

.dashboard-metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9e4f8;
    background: #eef4ff;
}

.dashboard-metric-icon img {
    display: block;
    width: 22px;
    height: 22px;
}

.dashboard-metric-content h3,
.dashboard-status-tile h3,
.dashboard-health-grid h3 {
    margin: 0 0 6px;
    font-size: .92rem;
    line-height: 1.35;
    word-break: break-word;
}

.dashboard-metric-value {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: #1d4ed8;
}

.dashboard-status-tile {
    min-height: 96px;
    padding: 14px;
    border: 1px solid #e3ebfa;
    border-radius: 14px;
    background: #fff;
}

.dashboard-metric-tile-success .dashboard-metric-icon {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.dashboard-metric-tile-warning .dashboard-metric-icon {
    background: #fef3c7;
    border-color: #fde68a;
}

.dashboard-metric-tile-danger .dashboard-metric-icon {
    background: #fee2e2;
    border-color: #fecaca;
}

.feature-card p,
.legal-card p,
.small-note {
    color: var(--ink-2);
    line-height: 1.6;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.portal-card {
    border: 1px solid #e6edfb;
    border-radius: 14px;
    padding: 14px;
    background: #fdfdff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.portal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-weight: 700;
    color: #1d4ed8;
    background: #e5edff;
    margin-bottom: 10px;
}

.portal-badge-de {
    color: #065f46;
    background: #e6fffa;
}

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

.screenshot-card {
    border: 1px solid #e6edfb;
    border-radius: 14px;
    padding: 12px;
    background: #ffffff;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.screenshot-card img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #e5eaf5;
    object-fit: contain;
    max-height: 320px;
    background: #f8f9ff;
}

.screenshot-card figcaption {
    margin: 0;
    font-weight: 600;
    color: #0f172a;
}

.screenshot-button {
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

.screenshot-button:hover img {
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.screenshot-lightbox-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    height: 100%;
    overflow: auto;
}

.screenshot-lightbox-body img {
    width: 100%;
    max-height: calc(90vh - 96px);
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #e5eaf5;
    background: #f8f9ff;
}

.feature-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
    color: #334155;
}

.promo-box {
    margin-top: 12px;
    border: 1px solid #e5edfb;
    background: #f7faff;
    border-radius: 12px;
    padding: 12px 14px;
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.promo-box strong {
    display: block;
    margin-bottom: 6px;
}

.auth-inline-link {
    text-align: center;
    margin-top: 10px;
}

.auth-inline-link a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.auth-inline-link a:hover {
    text-decoration: underline;
}

.link-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

.link-list a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
}

.link-list a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.onboarding-process h2,
.onboarding-cta h2 {
    margin-top: 0;
    font-family: "Space Grotesk", sans-serif;
}

.process-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.process-step {
    background: #ffffff;
    border: 1px solid #e9edf5;
    border-radius: 14px;
    padding: 14px;
}

.step-index {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e6efff;
    color: #1d4ed8;
    font-family: "Space Grotesk", sans-serif;
    font-size: .85rem;
    font-weight: 700;
}

.process-step h3 {
    margin: 10px 0 8px;
    font-size: .98rem;
    font-family: "Space Grotesk", sans-serif;
}

.process-step p {
    margin: 0;
    color: #475569;
    font-size: .9rem;
    line-height: 1.5;
}

.legal-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.boundary-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
    color: #475569;
}

.onboarding-cta {
    margin-top: 18px;
}

.onboarding-cta p {
    margin: 0;
    color: #475569;
}

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

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

.auth-card h1,
.auth-card h2 {
    margin: 10px 0 16px;
    font-family: "Space Grotesk", sans-serif;
}

.wide-card { max-width: 860px; margin: 0 auto; }

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

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

.form-grid .full { grid-column: 1 / -1; }

label span {
    display: block;
    font-size: .88rem;
    color: #334155;
    font-weight: 600;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 11px;
    border: 1px solid #d0d9ea;
    padding: 10px 12px;
    background: #fff;
    font: inherit;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.checkbox-row input {
    width: auto;
    margin-top: 3px;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.link-row {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

.link-row a { color: #1e40af; text-decoration: none; font-weight: 600; }
.link-row .btn { width: auto; }

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.flash {
    padding: 11px 14px;
    border-radius: 11px;
    border: 1px solid var(--border);
}

.flash-success { background: #ecfdf3; color: #166534; }
.flash-error { background: #fef2f2; color: #991b1b; }
.flash-warning { background: #fffbeb; color: #92400e; }

.panel-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-hero {
    grid-column: span 2;
}

.panel-hero h1 {
    margin: 0 0 8px;
    font-family: "Space Grotesk", sans-serif;
}

.panel-card h3 { margin: 10px 0 8px; }
.compact-card { padding: 14px; box-shadow: none; }
.review-item { margin-bottom: 12px; }
.review-item h3 { margin-top: 0; }
.status-pill {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e8eefb;
    color: #1f3f9b;
    font-size: .78rem;
    font-weight: 700;
    text-transform: lowercase;
}
.field-warning {
    display: block;
    color: #b45309;
    font-size: .84rem;
    margin-top: 6px;
}
.signature-canvas {
    width: 100%;
    max-width: 760px;
    border: 1px dashed #9db4e8;
    border-radius: 12px;
    background: #fff;
    touch-action: none;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #edf1f8;
    vertical-align: middle;
}

td .cta-row {
    margin-top: 0;
}

th { font-size: .82rem; color: #475569; text-transform: uppercase; letter-spacing: .05em; }

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

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

.list {
    display: grid;
    gap: 12px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid #edf1f8;
    border-radius: 14px;
    background: #fff;
    align-items: flex-start;
}

.list-info h3 {
    margin: 0 0 6px;
    font-family: "Space Grotesk", sans-serif;
}

.list-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
}

.list-item-vertical {
    flex-direction: column;
    align-items: stretch;
}

.inline-doc-list {
    display: grid;
    gap: 10px;
}

.inline-doc-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid #edf1f8;
    border-radius: 10px;
    background: #fdfdff;
}

.processing-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.spinner-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid #93c5fd;
    border-top-color: #1d4ed8;
    animation: spin 1s linear infinite;
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4200;
    background: rgba(15, 23, 42, 0.44);
    backdrop-filter: blur(2px);
    padding: 20px;
}

.page-loading-overlay.is-visible {
    display: flex;
}

.page-loading-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.72);
    background: #ffffff;
    padding: 14px 18px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.24);
}

.page-loading-spinner {
    width: 18px;
    height: 18px;
}

.page-loading-text {
    margin: 0;
    font-weight: 600;
    color: #1e293b;
}

body.page-loading {
    overflow: hidden;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.preview-image {
    max-width: 100%;
    max-height: calc(80vh - 180px);
    width: auto;
    margin: 0 auto;
    display: block;
    border-radius: 10px;
    border: 1px solid #edf1f8;
}

.preview-frame {
    width: 100%;
    min-height: calc(80vh - 180px);
    height: calc(80vh - 180px);
    border: 1px solid #dbe4f2;
    border-radius: 10px;
    background: #fff;
}

.preview-audio,
.preview-video {
    width: 100%;
    max-width: 100%;
}

.preview-video {
    min-height: calc(80vh - 240px);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-card {
    position: relative;
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    z-index: 1;
}

.modal-card-wide {
    max-width: 980px;
}

.modal-card-preview {
    width: 96vw;
    max-width: 1200px;
    height: 96vh;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
}

.modal-card-editor {
    width: 92vw;
    max-width: 92vw;
    height: 92vh;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-card-editor .modal-body {
    flex: 1 1 auto;
}

.modal-card-editor textarea {
    min-height: 60vh;
}

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

.modal-body {
    display: grid;
    gap: 12px;
    overflow: auto;
}

.modal-card-preview .modal-body {
    flex: 1 1 auto;
}

.consent-row {
    display: grid;
    gap: 10px;
}

.site-footer {
    font-size: .85rem;
    color: #64748b;
    padding-bottom: 28px;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.site-footer-links a {
    color: #1e40af;
    text-decoration: none;
    font-weight: 600;
}

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

.legal-text-box {
    border: 1px solid #e1e8f5;
    border-radius: 12px;
    background: #fdfefe;
    padding: 12px;
    max-height: 460px;
    overflow: auto;
}

.legal-text-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Plus Jakarta Sans", sans-serif;
    color: #1f2937;
    line-height: 1.65;
}

.final-rich-text p {
    margin: 0 0 10px;
}

.final-rich-text ul {
    margin: 4px 0 12px 20px;
    padding: 0;
}

.final-rich-text li {
    margin-bottom: 6px;
}

@media (max-width: 1024px) {
    .hero-grid,
    .feature-grid,
    .panel-grid,
    .auth-grid,
    .test-grid,
    .process-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-stat-grid,
    .legal-grid {
        grid-template-columns: 1fr;
    }

    .panel-hero { grid-column: span 2; }
}

@media (max-width: 760px) {
    .hero-grid,
    .feature-grid,
    .panel-grid,
    .auth-grid,
    .test-grid,
    .form-grid.two-col,
    .process-grid {
        grid-template-columns: 1fr;
    }

    .panel-hero { grid-column: span 1; }

    .nav-wrap {
        align-items: center;
        position: relative;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .nav-toggle {
        display: inline-flex;
        width: auto;
        justify-content: center;
    }

    .nav-links {
        width: auto;
        display: none;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        border: 1px solid #e7edf8;
        border-radius: 14px;
        padding: 10px;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
        max-height: calc(100vh - 110px);
        overflow: auto;
    }

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

    .nav-links a,
    .nav-links .inline-form {
        width: 100%;
    }

    .inline-form { flex-wrap: wrap; }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-card-preview {
        width: 94vw;
        max-width: 94vw;
        height: 86vh;
        max-height: 86vh;
    }

    .modal-card-editor {
        width: 96vw;
        max-width: 96vw;
        height: 92vh;
        max-height: 92vh;
    }

    .btn,
    .btn-mini {
        width: 100%;
    }

    .cta-row > form {
        width: 100%;
    }
}

/* Phase-2C Visual System */
:root {
    --surface-1: rgba(255, 255, 255, 0.88);
    --surface-2: #ffffff;
    --text-strong: #0f172a;
    --text-muted: #475569;
    --focus-ring: rgba(37, 99, 235, 0.22);
    --control-h: 46px;
    --sidebar-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.site-header {
    background: rgba(255, 255, 255, 0.82);
}

.nav-links {
    gap: 12px;
}

.nav-primary,
.nav-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-secondary {
    border-left: 1px solid #e7ecf7;
    padding-left: 12px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: #1f2f57;
    font-weight: 650;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.nav-link:hover {
    background: #f1f5ff;
    border-color: #dce7ff;
}

.nav-link.is-active {
    background: #eaf1ff;
    border-color: #bfd4ff;
    color: #17357e;
}

.nav-group {
    position: relative;
    display: block;
    width: auto;
    border: 0;
    background: transparent;
    padding: 0;
}

.nav-group > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    min-height: 38px;
    border: 1px solid #dce6f8;
    background: #fff;
    border-radius: 10px;
    color: #1f2f57;
    font-size: .9rem;
    font-weight: 700;
}

.nav-group > summary::-webkit-details-marker {
    display: none;
}

.nav-group > summary::after {
    content: "▾";
    font-size: .82rem;
    color: #64748b;
}

.nav-group[open] > summary::after {
    transform: rotate(180deg);
}

.nav-group-items {
    display: grid;
    gap: 6px;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 250px;
    padding: 8px;
    background: #fff;
    border: 1px solid #dce6f8;
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    z-index: 390;
}

.nav-group:not([open]) .nav-group-items {
    display: none;
}

.nav-logout {
    min-height: 38px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.info-box {
    border: 1px solid #dce7f8;
    border-radius: 12px;
    background: #f8fbff;
    padding: 12px;
}

.info-box h3 {
    margin: 0 0 6px;
    font-size: .93rem;
    font-family: "Space Grotesk", sans-serif;
}

.info-box p {
    margin: 0;
    color: #475569;
    line-height: 1.5;
    font-size: .87rem;
}

.howto-hero h1 {
    margin-bottom: 8px;
}

.howto-steps {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 12px;
}

.howto-steps li {
    background: #f8fbff;
    border: 1px solid #dce7f8;
    border-radius: 12px;
    padding: 12px 14px;
}

.howto-steps li p {
    margin: 6px 0 0;
    color: #475569;
}

.howto-checklist {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.howto-checklist li {
    color: #334155;
    line-height: 1.5;
}

.card {
    background: var(--surface-1);
    border-color: rgba(15, 23, 42, 0.09);
    border-radius: 20px;
    padding: 24px;
}

.card h1,
.card h2,
.card h3 {
    color: var(--text-strong);
}

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

.btn {
    min-height: var(--control-h);
    border-radius: 12px;
    padding: 11px 16px;
}

.btn-mini {
    min-height: 38px;
    border-radius: 10px;
    padding: 8px 12px;
}

.btn-soft {
    background: #e8f0ff;
    color: #1843b5;
}

.btn-ghost {
    background: rgba(29, 78, 216, 0.1);
    color: #1d4ed8;
}

.btn-danger {
    background: #fef2f2;
    color: #b91c1c;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.cta-row > form {
    display: inline-flex;
    align-items: center;
}

input,
select,
textarea {
    min-height: var(--control-h);
    border-radius: 12px;
    border: 1px solid #cfd9eb;
    background: var(--surface-2);
    color: #111827;
    transition: border-color .12s ease, box-shadow .12s ease;
}

textarea {
    min-height: 110px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #6f9bff;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

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

.template-grid > p {
    grid-column: 1 / -1;
}

.template-card {
    display: grid;
    gap: 14px;
    min-height: 240px;
    align-content: space-between;
}

.template-card h3 {
    margin: 0;
    font-size: 1.18rem;
    font-family: "Space Grotesk", sans-serif;
}

.table-wrap {
    border: 1px solid #e8eef9;
    border-radius: 14px;
    background: #fff;
}

table {
    min-width: 680px;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fbff;
}

.status-pill {
    background: #ecf2ff;
    color: #1e3a8a;
    text-transform: none;
}

.modal-card {
    border: 1px solid #e6edf9;
}

.modal-card-preview {
    width: min(1200px, 80vw);
    max-width: 80vw;
    height: 80vh;
    max-height: 80vh;
}

.editor-field {
    display: grid;
    gap: 10px;
    align-content: start;
    min-width: 0;
}

.editor-grid {
    align-items: start;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid #d9e4f7;
    border-radius: 12px;
    background: #f8fbff;
}

.editor-live-preview {
    border: 1px solid #dbe7f8;
    border-radius: 12px;
    background: #fff;
    padding: 12px 14px;
    min-height: 120px;
    max-height: 260px;
    overflow: auto;
}

.editor-live-preview p {
    margin: 0 0 8px;
}

.editor-live-preview ul {
    margin: 0 0 10px 20px;
}

.defaults-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.defaults-tab.is-active {
    background: #1d4ed8;
    color: #fff;
}

.tab-pane {
    display: none;
}

.tab-pane.is-active {
    display: block;
}

@media (max-width: 980px) {
    .nav-links {
        align-items: stretch;
    }

    .nav-secondary {
        border-left: 0;
        padding-left: 0;
    }

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

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

    .dashboard-metric-grid,
    .dashboard-status-grid,
    .dashboard-health-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 760px) {
    .nav-links {
        width: 100%;
        right: auto;
    }

    .nav-primary,
    .nav-secondary {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .nav-link,
    .lang-chip,
    .inline-form,
    .nav-logout {
        width: 100%;
    }

    .card {
        padding: 18px;
    }

    .modal-card-preview {
        width: 94vw;
        max-width: 94vw;
        height: 86vh;
        max-height: 86vh;
    }

    .feature-grid.metrics-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-metric-grid,
    .dashboard-status-grid,
    .dashboard-health-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-metric-tile {
        grid-template-columns: 44px 1fr;
    }
}

/* Phase-2D Navigation / Modal / Upload UX */
.site-header {
    z-index: 120;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    border: 1px solid #dbe5f8;
    border-radius: 12px;
    background: #fff;
    color: #1f2f57;
    padding: 6px 10px;
    cursor: pointer;
    font: inherit;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8efff;
    color: #1d4ed8;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.user-meta {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 220px;
    line-height: 1.2;
}

.user-meta strong {
    font-size: .82rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta small {
    font-size: .72rem;
    color: #64748b;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 210px;
    border: 1px solid #dfe7f9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    display: none;
    overflow: hidden;
    z-index: 390;
}

.user-menu.is-open .user-menu-dropdown {
    display: block;
}

.user-menu-link {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    color: #1f2f57;
    text-decoration: none;
    text-align: left;
    font: inherit;
    padding: 10px 12px;
    cursor: pointer;
}

.user-menu-link:hover {
    background: #f1f5ff;
}

.user-menu-link-danger {
    color: #b91c1c;
}

.modal {
    z-index: 700;
}

.modal-card {
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.modal-switch {
    display: inline-flex;
    border: 1px solid #dbe7f8;
    border-radius: 12px;
    overflow: hidden;
}

.modal-switch button {
    border: 0;
    background: #fff;
    color: #1f2f57;
    padding: 9px 12px;
    font: inherit;
    font-size: .87rem;
    font-weight: 650;
    cursor: pointer;
}

.modal-switch button + button {
    border-left: 1px solid #dbe7f8;
}

.modal-switch button.is-active {
    background: #1d4ed8;
    color: #fff;
}

.upload-pane {
    display: none;
}

.upload-pane.is-active {
    display: block;
}

@media (max-width: 1040px) {
    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 76px;
        left: 12px;
        right: 12px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid #dfe7f9;
        border-radius: 16px;
        box-shadow: var(--sidebar-shadow);
        padding: 12px;
        max-height: calc(100vh - 94px);
        overflow: auto;
        z-index: 360;
    }

    .nav-links.is-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .nav-primary,
    .nav-secondary {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .nav-secondary {
        border-left: 0;
        border-top: 1px solid #e7ecf7;
        padding-left: 0;
        padding-top: 10px;
    }

    .nav-link,
    .lang-chip {
        width: 100%;
        justify-content: flex-start;
    }

    .nav-group {
        display: grid;
        gap: 8px;
        width: 100%;
        border: 1px solid #dce6f8;
        border-radius: 12px;
        background: #fff;
        padding: 4px;
    }

    .nav-group > summary {
        border: 0;
        background: transparent;
    }

    .nav-group-items {
        position: static;
        min-width: 0;
        padding: 0 4px 4px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .user-menu,
    .user-menu-trigger,
    .user-menu-dropdown {
        width: 100%;
    }

    .user-menu-dropdown {
        position: static;
        margin-top: 8px;
        box-shadow: none;
    }

    .user-meta {
        max-width: calc(100% - 44px);
    }
}

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

.EasyMDEContainer {
    width: 100%;
    min-width: 0;
    align-self: start;
}

.EasyMDEContainer .CodeMirror {
    border-radius: 12px;
    border-color: #cfd9eb;
    min-height: 340px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: .95rem;
}

.EasyMDEContainer .CodeMirror-focused {
    border-color: #6f9bff;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.EasyMDEContainer .editor-toolbar {
    border-radius: 12px;
    border-color: #d9e4f7;
    margin-top: 0 !important;
}

.EasyMDEContainer .editor-toolbar button {
    color: #1f2f57 !important;
}

.EasyMDEContainer .editor-toolbar button.active,
.EasyMDEContainer .editor-toolbar button:hover {
    background: #eaf1ff !important;
    border-color: #bfd4ff !important;
}

.EasyMDEContainer .CodeMirror-scroll {
    min-height: 300px;
}

.markdown-live-view {
    min-height: 320px;
}

/* Faz-2D overrides */
.checkbox-row {
    align-items: center;
}

.lang-flag {
    min-width: 46px;
    min-height: 38px;
    padding: 6px 10px;
}

.lang-flag img {
    display: block;
    border-radius: 3px;
    border: 1px solid rgba(15, 23, 42, 0.14);
}

.nav-group {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
}

.nav-group-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #dce6f8;
    border-radius: 10px;
    background: #fff;
    color: #1f2f57;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}

.nav-group-trigger::after {
    content: "▾";
    font-size: .82rem;
    color: #64748b;
    transition: transform .12s ease;
}

.nav-group.is-open .nav-group-trigger::after {
    transform: rotate(180deg);
}

.nav-group.is-active-group .nav-group-trigger {
    border-color: #bfd4ff;
    background: #edf3ff;
}

.nav-group .nav-group-items {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 250px;
    padding: 8px;
    background: #fff;
    border: 1px solid #dce6f8;
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    z-index: 280;
}

.nav-group.is-open .nav-group-items {
    display: grid;
    gap: 6px;
}

.user-menu {
    position: relative;
}

.modal {
    z-index: 1200;
}

.modal-card {
    width: min(900px, 94vw);
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.modal-card-preview {
    width: min(80vw, 1200px);
    height: 80vh;
    max-width: 80vw;
    max-height: 80vh;
}

.review-history-table {
    max-height: 340px;
    overflow: auto;
}

@media (max-width: 1040px) {
    .nav-group {
        width: 100%;
    }

    .nav-group .nav-group-items {
        position: static;
        min-width: 0;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .nav-group.is-open .nav-group-items {
        margin-top: 2px;
    }

    .lang-flag {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-card {
        width: min(96vw, 96vw);
    }
}

/* Dashboard full-width layout stabilization */
.page-content {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
}

.page-content > * {
    grid-column: 1 / -1;
}

.page-content > .card {
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

.page-content > .dashboard-full-width,
.page-content > .dashboard-block {
    grid-column: 1 / -1;
}

.dashboard-block .dashboard-metric-grid,
.dashboard-block .dashboard-status-grid,
.dashboard-block .dashboard-health-grid {
    width: 100%;
}

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

.dashboard-block-queue .dashboard-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-block-health .dashboard-health-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1180px) {
    .dashboard-block-metrics .dashboard-metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-block-queue .dashboard-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dashboard-block-metrics .dashboard-metric-grid,
    .dashboard-block-queue .dashboard-status-grid,
    .dashboard-block-health .dashboard-health-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .dashboard-user-metrics .dashboard-metric-mini-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .dashboard-block-metrics .dashboard-metric-grid,
    .dashboard-block-queue .dashboard-status-grid,
    .dashboard-block-health .dashboard-health-grid {
        grid-template-columns: 1fr;
    }

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

    .dashboard-metric-mini-row,
    .dashboard-user-metrics .dashboard-metric-mini-row {
        grid-template-columns: 1fr;
    }
}

.dashboard-list-card .dashboard-scroll-list {
    min-height: 360px;
    max-height: 360px;
    overflow: auto;
    padding-right: 2px;
}

.dashboard-block-failed .dashboard-health-grid-compact {
    margin-bottom: 14px;
}

.dashboard-block-failed .dashboard-scroll-list {
    min-height: 260px;
    max-height: 320px;
    overflow: auto;
    padding-right: 2px;
}

.dashboard-scroll-list .lazy-sentinel {
    width: 100%;
    height: 1px;
}

@media (max-width: 900px) {
    .dashboard-list-card .dashboard-scroll-list {
        min-height: 300px;
        max-height: 300px;
    }
}

@media (max-width: 760px) {
    .link-row .btn,
    .link-row .btn-mini {
        width: auto;
    }
}

/* Faz-2E */
.is-hidden {
    display: none !important;
}

.question-options-wrap {
    margin-top: 8px;
    border: 1px dashed #d7e3f8;
    border-radius: 12px;
    padding: 12px;
    background: rgba(245, 249, 255, 0.72);
}

.question-option-row {
    border: 1px solid #dce6f8;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    margin-top: 10px;
}

.question-option-row:first-child {
    margin-top: 0;
}

.option-key-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px dashed #c9d8f7;
    background: #f3f7ff;
    color: #1e3a8a;
    font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
    font-size: .82rem;
    line-height: 1.2;
    word-break: break-all;
}

.radio-group {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.radio-group .checkbox-row {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #dbe4f5;
    border-radius: 10px;
    background: #fff;
}

.radio-group .checkbox-row input[type="radio"] {
    width: 18px;
    height: 18px;
}

.condition-inline-box {
    margin-top: 8px;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.condition-inline-stop {
    border: 1px solid #f9caca;
    background: #fef2f2;
    color: #991b1b;
}

.condition-inline-warn {
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
}

[data-case-dependent="1"].is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.modal {
    position: fixed !important;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2.4vw, 24px);
    z-index: 1800 !important;
    pointer-events: none;
    overflow-y: auto;
}

.modal.is-open {
    display: flex !important;
    pointer-events: auto;
}

.modal-card {
    width: min(900px, 96vw);
    max-height: min(92dvh, 920px);
    overflow: hidden;
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.modal-card .modal-body {
    overflow: auto;
    max-height: calc(min(92dvh, 920px) - 120px);
}

#case-start-modal .modal-card {
    width: min(720px, 96vw);
    display: flex;
    flex-direction: column;
}

#case-start-modal .modal-body {
    overflow-y: auto;
    max-height: calc(92vh - 120px);
    max-height: calc(92dvh - 120px);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1;
}

.consent-row {
    display: grid;
    gap: 10px;
}

.consent-row .checkbox-row {
    align-items: flex-start;
}

.consent-row .checkbox-row span {
    line-height: 1.45;
}

.ai-live-note {
    margin: 4px 0 0;
}

.ai-suggestion-live-note {
    margin-top: 2px;
    color: #1d4ed8;
}

.row-sort-actions {
    margin-top: 0;
    gap: 6px;
}

.compact-list {
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}

.compact-list .list-item {
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: center;
}

.compact-list .list-info {
    flex: 1 1 auto;
    min-width: 0;
}

.compact-list .list-actions {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
}

.list-item-vertical > form,
.list-item-vertical .form-grid {
    width: 100%;
    min-width: 0;
}

.row-sort-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}

.row-sort-actions .btn,
.row-sort-actions .btn-mini {
    width: auto !important;
    min-width: var(--btn-h-mini);
    flex: 0 0 auto;
}

.defaults-live-list .list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.defaults-live-list .list-actions {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
}

.defaults-live-list .list-actions .btn,
.defaults-live-list .list-actions .btn-mini {
    width: auto !important;
    min-width: var(--btn-h-mini);
    padding: 8px 10px;
}

.defaults-live-list {
    /* keep quick-add defaults compact: ~3 rows visible, rest scrolls */
    max-height: 210px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.site-footer {
    position: relative;
    z-index: 0;
    margin-top: auto;
}

/* Faz-2E2 modal/footer stabilization */
html,
body {
    min-height: 100dvh;
}

.site-footer {
    margin-top: auto;
    position: relative;
    z-index: 1;
}

body.modal-open .site-header,
body.modal-open .site-footer {
    pointer-events: none;
}

body.modal-open .site-header {
    z-index: 0 !important;
}

body.modal-open .nav-links.is-open {
    display: none !important;
}

.modal {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 24px);
    z-index: 6200 !important;
    pointer-events: none;
    overflow: hidden auto;
}

.modal.is-open {
    display: flex !important;
    pointer-events: auto;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    z-index: 1;
}

.modal-card {
    position: relative;
    z-index: 2;
    width: min(920px, 96vw);
    max-height: min(92dvh, 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

.modal-card-preview {
    width: min(80vw, 1200px);
    max-width: 80vw;
    height: 80vh;
    max-height: 80vh;
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
    margin: 0;
    padding-bottom: 10px;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 40%);
    padding-top: 10px;
}

#case-start-modal .modal-card {
    width: min(760px, 96vw);
    background: #fff;
    border-radius: 18px;
}

#case-start-form {
    display: grid;
    gap: 12px;
}

#case-start-modal .modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0 max(6px, env(safe-area-inset-bottom));
    margin-top: 2px;
}

#case-start-form .checkbox-row {
    align-items: flex-start;
}

@media (max-width: 860px) {
    .modal {
        align-items: flex-start;
        padding: max(10px, env(safe-area-inset-top) + 8px) 10px 10px;
    }

    .modal-card {
        width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
    }

    .modal-card-preview {
        width: 100%;
        max-width: 100%;
        height: min(80dvh, 700px);
        max-height: min(80dvh, 700px);
    }
}

@media (max-width: 760px) {
    .site-footer {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 14px;
    }

    .site-footer-links {
        display: inline-flex;
        flex-wrap: nowrap;
        margin-bottom: 0;
        gap: 10px;
    }

    .site-footer p {
        margin: 0;
        white-space: nowrap;
    }

    .defaults-live-list .list-item {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .case-reviews-table table {
        min-width: 0;
    }

    .case-reviews-table thead {
        display: none;
    }

    .case-reviews-table tbody,
    .case-reviews-table tr,
    .case-reviews-table td {
        display: block;
        width: 100%;
    }

    .case-reviews-table tr {
        border: 1px solid #e3ebfa;
        border-radius: 12px;
        padding: 10px;
        margin-bottom: 10px;
        background: #fff;
    }

    .case-reviews-table td {
        border: 0;
        padding: 4px 0;
    }

    .case-reviews-table td::before {
        content: attr(data-label);
        display: block;
        font-size: .74rem;
        color: #64748b;
        margin-bottom: 2px;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .case-reviews-table td.case-id-cell,
    .case-reviews-table td.updated-cell {
        display: none;
    }
}
