@import url('https://fonts.bunny.net/css?family=dm-sans:400,500,700|general-sans:500,600,700,800|jetbrains-mono:400,500');

:root {
    --primary: #16a34a;
    --primary-hover: #15803d;
    --secondary: #20970b;
    --neutral: #9c9c9c;
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #0a0a0a;
    --text-secondary: #6b6b6b;
    --border: #e8e8ec;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --ring: 0 0 0 3px rgba(22, 163, 74, 0.12);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
    --font-display: 'General Sans', ui-sans-serif, system-ui, sans-serif;
    --font-body: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
    --font-code: 'JetBrains Mono', ui-monospace, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.app-shell {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
}

.app-shell-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

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

button,
input,
textarea {
    font: inherit;
}

button {
    appearance: none;
}

button:not(:disabled),
a,input,textarea {
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

button:not(:disabled),
a[href] {
    cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button:not(:disabled):hover,
a[href]:hover {
    transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    padding: 22px 16px;
    border-right: 1px solid var(--border);
    background: rgba(250, 250, 250, 0.92);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-sidebar > .brand {
    flex: 0 0 auto;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--primary);
    font-family: var(--font-code);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.brand-name,
.page-hero h1,
.form-intro h1,
.panel-head h2,
.modal-head h2,
.empty-state h3 {
    font-family: var(--font-display);
    letter-spacing: -0.04em;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-code);
    font-size: 10px;
    font-weight: 700;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    border-color: var(--border);
    background: #f2f2f5;
    color: var(--text);
}

.sidebar-link.is-active {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.08);
    color: var(--primary-hover);
}

.sidebar-link.is-active .sidebar-icon {
    border-color: rgba(22, 163, 74, 0.22);
    background: var(--primary);
    color: #fff;
}

.sidebar-actions {
    display: grid;
    gap: 10px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.sidebar-logout {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f9fafb;
}

.sidebar-user-avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-family: var(--font-code);
    font-size: 10px;
    font-weight: 700;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout .secondary-button {
    width: 100%;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.app-main {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.app-shell-auth .app-main {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
}

.auth-stack {
    display: grid;
    gap: 20px;
    width: min(100%, 860px);
}

.app-shell-auth .flash {
    width: fit-content;
    min-width: min(320px, 100%);
    justify-self: center;
    margin: 0;
    text-align: center;
}

body:not(.app-shell-auth) .app-main {
    width: 100%;
}

.flash {
    margin-bottom: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
    padding: 12px 16px;
    font-weight: 500;
    animation: flash-in 0.3s ease-out;
}

@keyframes flash-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-hero,
.panel-head,
.form-actions,
.action-group,
.modal-head,
.hero-actions {
    display: flex;
    align-items: center;
}

.page-hero {
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.overline {
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-hero h1,
.form-intro h1 {
    margin: 0;
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 800;
    line-height: 0.95;
}

.lede {
    max-width: 620px;
    margin: 16px 0 0;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
}

.hero-actions,
.form-actions,
.action-group {
    gap: 12px;
    flex-wrap: wrap;
}

.hero-actions {
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.primary-button,
.secondary-button,
.action-edit,
.action-delete,
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 500;
}

.primary-button,
.secondary-button {
    min-height: 38px;
    padding: 10px 16px;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.primary-button:not(:disabled):hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.secondary-button {
    border-color: var(--border);
    background: transparent;
    color: var(--text);
}

.secondary-button:not(:disabled):hover {
    border-color: #d6d6dc;
    background: #f7f7f8;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card,
.panel,
.form-card,
.modal-dialog {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.metric-card {
    padding: 16px;
}

.metric-card span,
.metric-card small,
.panel-subtitle,
.field span,
.search-field span {
    color: var(--text-secondary);
}

.metric-card span,
.field span,
.search-field span {
    font-size: 13px;
    font-weight: 500;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-family: var(--font-display);
    font-size: 32px;
    letter-spacing: -0.04em;
}

.metric-card small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.panel {
    overflow: hidden;
}

.panel-head {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.panel-head h2,
.modal-head h2,
.empty-state h3 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.panel-subtitle {
    margin: 8px 0 0;
    line-height: 1.5;
}

.search-field {
    display: grid;
    gap: 6px;
    width: min(100%, 320px);
}

.search-form {
    margin: 0;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    outline: none;
    font-size: 14px;
}

.env-textarea {
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    tab-size: 4;
    white-space: pre;
    overflow-x: auto;
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    outline: none;
    font-size: 14px;
}

select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

input::placeholder,
textarea::placeholder {
    color: var(--neutral);
}

.table-wrap {
    overflow: auto;
}

.table-wrap.is-loading {
    opacity: 0.72;
    pointer-events: none;
}

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

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

.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: #f7f7f8;
}

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

.cell-no,
.code-chip {
    font-family: var(--font-code);
    font-size: 13px;
}

.cell-type {
    font-weight: 700;
}

.code-chip,
.location-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.code-chip {
    border: 1px solid rgba(22, 163, 74, 0.18);
    background: rgba(22, 163, 74, 0.08);
    color: var(--primary-hover);
}

.location-badge {
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.owner-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    font-size: 12px;
    white-space: nowrap;
}

.owner-badge--planned {
    border-color: rgba(20, 184, 166, 0.2);
    background: rgba(20, 184, 166, 0.12);
    color: #0d9488;
}

.owner-badge--unplanned {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    max-width: 220px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 9999px;
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.09);
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
}

.input-user-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 10px;
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
    font-family: var(--font-code);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cell-note {
    max-width: 280px;
    color: var(--text-secondary);
}

.cell-analysis {
    width: 280px;
    max-width: 280px;
}

.analysis-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-preview > span {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.analysis-view-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-secondary);
}

.analysis-view-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.analysis-view-button:hover,
.analysis-view-button:focus-visible {
    border-color: var(--primary);
    background: rgba(22, 163, 74, 0.08);
    color: var(--primary);
}

.analysis-modal-body {
    padding: 20px 24px;
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.analysis-modal-actions {
    justify-content: flex-end;
    padding: 0 24px 20px;
}

.evidence-preview-button {
    display: grid;
    gap: 8px;
    justify-items: start;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.evidence-thumbnail {
    display: block;
    max-width: 280px;
    max-height: 200px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.evidence-preview-button:hover .evidence-thumbnail,
.evidence-preview-button:focus-visible .evidence-thumbnail {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.evidence-modal-dialog {
    width: min(1000px, calc(100% - 32px));
}

.evidence-modal-time {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.evidence-modal-content {
    display: grid;
    min-height: 240px;
    max-height: calc(100vh - 210px);
    margin: 0 24px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f7f8;
    place-items: center;
}

.evidence-modal-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 230px);
    object-fit: contain;
}

.evidence-modal-document {
    width: 100%;
    height: calc(100vh - 230px);
    min-height: 420px;
    border: 0;
    background: #fff;
}

.evidence-modal-actions {
    justify-content: flex-end;
    padding: 16px 24px 20px;
}

.action-edit,
.action-delete,
.action-view {
    min-height: 32px;
    padding: 8px 12px;
    background: transparent;
    font-size: 13px;
}

.action-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    background: #f7f7f8;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.status-pill.is-active {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.status-pill.is-inactive {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
}

.action-edit {
    border-color: rgba(22, 163, 74, 0.2);
    color: var(--primary);
}

.action-edit:not(:disabled):hover {
    background: rgba(22, 163, 74, 0.08);
}

.action-view {
    border-color: var(--border);
    color: var(--text-secondary);
}

.action-view:not(:disabled):hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
}

.action-delete {
    border-color: rgba(239, 68, 68, 0.22);
    color: var(--error);
}

.action-delete:not(:disabled):hover {
    background: rgba(239, 68, 68, 0.08);
}

.empty-state {
    display: grid;
    gap: 12px;
    justify-items: start;
    padding: 48px 24px;
}

.empty-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    font-family: var(--font-code);
}

.empty-state p {
    margin: 0;
    color: var(--text-secondary);
}

.form-page {
    display: grid;
    gap: 24px;
    max-width: 960px;
}

.form-page-compact {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
    max-width: 1200px;
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 0.9fr);
    gap: 24px;
    align-items: start;
    width: min(100%, 860px);
    margin: 0 auto;
}

.auth-page-single {
    display: block;
    width: min(100%, 480px);
}

.auth-hero,
.auth-card {
    min-height: 100%;
}

.auth-hero {
    padding: 28px;
}

.auth-card {
    display: grid;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 28px;
}

.auth-page .auth-card,
.auth-page .auth-hero {
    width: 100%;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.remember-row input {
    width: 16px;
    height: 16px;
    padding: 0;
}

.form-intro-card,
.form-card-raised {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.form-intro-card {
    padding: 28px;
    position: sticky;
    top: 88px;
    align-self: start;
}

.form-hint-card {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f9fafb;
}

.form-hint-card span,
.required-note,
.field small {
    color: var(--text-secondary);
    font-size: 12px;
}

.form-hint-card span,
.required-note {
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-hint-card p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.form-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
}

.form-section-head h2 {
    margin: 6px 0 0;
    font-family: var(--font-display);
    letter-spacing: -0.04em;
    font-size: 24px;
}

.panel-head-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.export-dropdown {
    position: relative;
}

.export-dropdown .dropdown-caret {
    font-size: 11px;
    margin-left: 4px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 50;
    overflow: hidden;
}

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

.dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.dropdown-item:hover {
    background: #f7f7f8;
    transform: none;
}

.dropdown-hint {
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}

.dropdown-item-hint {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 1px;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1.5rem 1rem;
}

.category-filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.category-filter-form label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.category-filter-form select {
    min-height: 34px;
    max-width: 240px;
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

@media (max-width: 640px) {
    .category-filter-form {
        width: 100%;
        margin-left: 0;
    }

    .category-filter-form select {
        flex: 1;
        max-width: none;
    }
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.filter-tab:hover {
    border-color: #d7d7dd;
    background: #f7f7f8;
    color: var(--text);
}

.filter-tab.is-active {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.08);
    color: var(--primary-hover);
}

.public-evidence-card {
    width: min(860px, 100%);
    margin: 2rem auto;
    overflow: hidden;
    border-color: rgba(15, 118, 110, 0.18);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
}

.public-evidence-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 28px 32px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(125deg, #087f5b 0%, #0f766e 54%, #155e75 100%);
}

.public-evidence-hero::after {
    position: absolute;
    top: -90px;
    right: -45px;
    width: 240px;
    height: 240px;
    border: 38px solid rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    content: '';
}

.public-evidence-logo {
    position: relative;
    z-index: 1;
    width: 88px;
    height: 88px;
    padding: 7px;
    border-radius: 18px;
    background: #fff;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.public-evidence-heading {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.public-evidence-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.public-evidence-verified {
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    letter-spacing: 0;
    text-transform: none;
}

.public-evidence-heading h1 {
    margin: 0 0 6px;
    color: #fff;
    font-size: clamp(25px, 4vw, 38px);
    line-height: 1.15;
}

.public-evidence-heading p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

.public-evidence-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 24px 32px;
    background: linear-gradient(180deg, rgba(240, 253, 250, 0.8), transparent);
}

.public-evidence-detail {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 2px 10px;
    align-items: center;
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(15, 118, 110, 0.13);
    border-radius: 12px;
    background: var(--surface);
}

.public-evidence-icon {
    display: grid;
    grid-row: 1 / span 2;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(15, 118, 110, 0.10);
    color: #0f766e;
    font-weight: 800;
}

.public-evidence-detail > span:nth-child(2) {
    color: var(--text-secondary);
    font-size: 11px;
}

.public-evidence-detail strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.public-evidence-status {
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
}

.public-evidence-status.is-planned {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.public-evidence-status.is-unplanned {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
}

.evidence-public-preview {
    padding: 4px 32px 32px;
}

.evidence-public-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.evidence-public-head h2 {
    margin-top: 3px;
    font-size: 20px;
}

.evidence-public-frame {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-color: #f8fafc;
    background-image: linear-gradient(45deg, #eef2f7 25%, transparent 25%), linear-gradient(-45deg, #eef2f7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eef2f7 75%), linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.evidence-public-preview img,
.evidence-public-preview iframe {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 70vh;
    margin: 0;
    border: 0;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.evidence-public-preview iframe {
    width: 100%;
    min-height: 65vh;
}

.evidence-public-empty {
    display: grid;
    justify-items: center;
    gap: 5px;
    padding: 50px 20px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    text-align: center;
}

.evidence-public-empty > span {
    font-size: 30px;
}

.evidence-public-empty strong {
    color: var(--text);
}

.public-evidence-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 32px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
}

@media (max-width: 760px) {
    .public-evidence-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .app-shell-auth .app-main {
        padding: 12px;
    }

    .public-evidence-card {
        margin: 0;
        border-radius: 16px;
    }

    .public-evidence-hero {
        align-items: flex-start;
        gap: 14px;
        padding: 22px 18px;
    }

    .public-evidence-logo {
        width: 60px;
        height: 60px;
        border-radius: 12px;
    }

    .public-evidence-eyebrow {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .public-evidence-details {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .evidence-public-preview {
        padding: 2px 18px 22px;
    }

    .evidence-public-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-evidence-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 18px;
    }
}

.chart-panel {
    margin-bottom: 24px;
}

.chart-panel .panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.chart-range-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chart-wrap {
    position: relative;
    height: 300px;
    padding: 0 1.5rem 1.5rem;
}

.form-card-raised {
    padding: 28px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.form-card {
    padding: 24px;
}

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

.field {
    display: grid;
    gap: 6px;
}

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

.field strong {
    color: var(--error);
    font-weight: 700;
}

.field small {
    line-height: 1.45;
}

.field .field-error {
    color: var(--error);
    font-weight: 700;
}

.form-errors {
    grid-column: 1 / -1;
    border: 1px solid rgba(239, 68, 68, 0.24);
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    padding: 12px 16px;
}

.form-errors ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.form-actions {
    justify-content: flex-end;
}

.search-form {
    display: flex;
    align-items: center;
}

.search-form input {
    min-width: 0;
}

.user-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.55fr) auto;
    gap: 8px;
    width: min(100%, 520px);
}

.user-search-form input,
.user-search-form select {
    min-width: 0;
    width: 100%;
}

.form-actions-sticky {
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 60;
}

.modal.is-open {
    display: block;
    animation: modal-fade-in 0.2s ease-out;
}

.modal.is-open .modal-dialog {
    animation: modal-slide-in 0.25s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.42);
    backdrop-filter: blur(8px);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    margin: 16px auto;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-dialog-small {
    width: min(520px, calc(100% - 32px));
}

.modal-head {
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    width: 38px;
    height: 38px;
    border-color: var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 24px;
}

.modal-close:hover {
    color: var(--text);
    background: #f7f7f8;
}

.modal-form {
    padding: 24px;
}

.downtime-modal-form {
    gap: 12px 14px;
    padding: 16px 20px 18px;
}

.downtime-modal-form .field {
    gap: 4px;
}

.downtime-modal-form textarea {
    min-height: 64px;
    resize: vertical;
}

.downtime-form-intro { display: none; }
.downtime-field-name { order: 1; }
.downtime-field-category { order: 2; }
.downtime-field-duration { order: 3; }
.downtime-field-time { order: 4; }
.downtime-field-status { order: 5; }
.downtime-field-analysis { order: 6; }
.downtime-field-resolution { order: 7; }
.downtime-field-evidence { order: 8; }
.downtime-field-actions { order: 9; }

.downtime-field-name small,
.downtime-field-category small,
.downtime-field-status small {
    display: none;
}

.downtime-modal-form .form-actions-sticky {
    margin-top: 0;
    padding-top: 10px;
}

.modal-copy {
    margin: 0 0 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-section-head {
    padding-top: 0;
    margin-bottom: 4px;
}

.modal-form .field small {
    color: var(--text-secondary);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
}

.table-footer--top {
    padding: 16px 24px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
}

.table-meta {
    color: var(--text-secondary);
    font-size: 13px;
}

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

.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-group form {
    margin: 0;
}

.table-footer .pager {
    margin-left: auto;
    gap: 10px;
}

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

button.pager-link {
    font: inherit;
    cursor: pointer;
}

.table-footer .pager-link,
.table-footer .pager-count {
    min-height: 36px;
}

.pager-link,
.pager-count {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.pager-link:hover {
    border-color: #d7d7dd;
    background: #f7f7f8;
}

.pager-link.is-disabled {
    color: var(--neutral);
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    .app-shell-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 18px 16px;
        gap: 18px;
    }

    .app-sidebar > .brand {
        grid-column: 1;
        grid-row: 1;
    }

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

    .sidebar-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        gap: 18px;
        width: 100%;
    }

    .sidebar-actions {
        margin-top: 0;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-footer {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .form-page-compact {
        grid-template-columns: 1fr;
    }

    .auth-page {
        grid-template-columns: 1fr;
        margin-top: 0;
    }

    .form-intro-card {
        position: static;
    }
}

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

    .hero-actions {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .app-main {
        padding: 32px 16px 56px;
    }

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

    .app-sidebar {
        gap: 14px;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-menu {
        display: none;
    }

    .app-sidebar.is-open .sidebar-menu {
        display: grid;
    }

    .brand-subtitle {
        white-space: normal;
    }

    .page-hero h1,
    .form-intro h1 {
        font-size: 44px;
    }

    .hero-actions,
    .form-actions,
    .action-group {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .user-search-form {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .nav-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .primary-button,
    .secondary-button,
    .action-edit,
    .action-delete,
    .action-disabled {
        width: 100%;
    }

    .user-search-form .secondary-button {
        width: 100%;
    }

    .cell-action .action-group {
        align-items: stretch;
        flex-direction: column;
    }

    .cell-action .action-group form {
        width: 100%;
    }

    .table-footer .pager {
        width: 100%;
        margin-left: 0;
    }

    .table-footer .pager-link,
    .table-footer .pager-count {
        justify-content: center;
        flex: 1 1 120px;
    }

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

    .auth-card {
        padding: 20px;
    }

    .data-table {
        min-width: 860px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .data-table th {
        font-size: 10px;
    }

    .cell-note {
        max-width: 220px;
    }

    .modal-dialog {
        width: min(100% - 16px, 760px);
        margin: 8px auto;
    }

    .modal-dialog-small {
        width: min(100% - 16px, 520px);
    }

    .modal-head,
    .modal-form {
        padding: 20px;
    }
}

.form-page-compact .form-intro h1 {
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1;
}

.form-card.form-card-raised {
    padding: 28px;
}

@media (prefers-color-scheme: dark) {
    body.app-shell.theme-system {
        color-scheme: dark;
    }

    .theme-system {
        --primary: #22c55e;
        --primary-hover: #15803d;
        --secondary: #34d399;
        --neutral: #6b7280;
        --bg: #0f0f0f;
        --surface: #1a1a1a;
        --text: #f5f5f5;
        --text-secondary: #a1a1aa;
        --border: #2e2e2e;
        --success: #34d399;
        --warning: #fbbf24;
        --error: #f87171;
        --ring: 0 0 0 3px rgba(34, 197, 94, 0.2);
        --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.3);
    }
}

/* Forced dark mode via class */
body.app-shell.theme-dark {
    color-scheme: dark;
    --primary: #22c55e;
    --primary-hover: #15803d;
    --secondary: #34d399;
    --neutral: #6b7280;
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --text: #f5f5f5;
    --text-secondary: #a1a1aa;
    --border: #2e2e2e;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --ring: 0 0 0 3px rgba(34, 197, 94, 0.2);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Shared dark-mode rules: apply to both .theme-dark and .theme-system (when OS is dark) */
:is(.theme-dark, .theme-system) .app-sidebar {
    background: rgba(15, 15, 15, 0.92);
}

:is(.theme-dark, .theme-system) .sidebar-link:hover,
:is(.theme-dark, .theme-system) .sidebar-link.is-active {
    background: #262626;
}

:is(.theme-dark, .theme-system) .sidebar-link.is-active {
    border-color: rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.1);
}

:is(.theme-dark, .theme-system) .sidebar-user {
    background: #222;
    border-color: var(--border);
}

:is(.theme-dark, .theme-system) .data-table th {
    background: var(--surface);
}

:is(.theme-dark, .theme-system) .data-table tbody tr:hover {
    background: #222;
}

:is(.theme-dark, .theme-system) .code-chip {
    border-color: rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.12);
    color: var(--primary);
}

:is(.theme-dark, .theme-system) .location-badge {
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
}

:is(.theme-dark, .theme-system) .owner-badge {
    border-color: rgba(251, 191, 36, 0.25);
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
}

:is(.theme-dark, .theme-system) .owner-badge--planned {
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
}

:is(.theme-dark, .theme-system) .owner-badge--unplanned {
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
}

:is(.theme-dark, .theme-system) .flash {
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
}

:is(.theme-dark, .theme-system) .form-errors {
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
}

:is(.theme-dark, .theme-system) .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
}

:is(.theme-dark, .theme-system) .dropdown-menu {
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

:is(.theme-dark, .theme-system) .dropdown-item:hover {
    background: #262626;
}

:is(.theme-dark, .theme-system) .dropdown-hint {
    color: #888;
    border-bottom-color: #333;
}

:is(.theme-dark, .theme-system) .dropdown-item-hint {
    color: #888;
}

:is(.theme-dark, .theme-system) .secondary-button:not(:disabled):hover {
    border-color: #444;
    background: #262626;
}

:is(.theme-dark, .theme-system) .filter-tab:hover {
    border-color: #444;
    background: #262626;
}

:is(.theme-dark, .theme-system) .pager-link:hover {
    border-color: #444;
    background: #262626;
}

:is(.theme-dark, .theme-system) .action-edit:not(:disabled):hover {
    background: rgba(34, 197, 94, 0.12);
}

:is(.theme-dark, .theme-system) .action-view:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.06);
}

:is(.theme-dark, .theme-system) .action-delete:not(:disabled):hover {
    background: rgba(248, 113, 113, 0.12);
}

:is(.theme-dark, .theme-system) .form-hint-card {
    background: #222;
}

:is(.theme-dark, .theme-system) input,
:is(.theme-dark, .theme-system) textarea,
:is(.theme-dark, .theme-system) select {
    background: #222;
    border-color: var(--border);
    color: var(--text);
}

:is(.theme-dark, .theme-system) .brand-mark {
    background: #222;
}

:is(.theme-dark, .theme-system) .empty-mark {
    background: #222;
}

/* Settings page */
.settings-grid {
    display: grid;
    gap: 24px;
}

.settings-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 28px;
}

.settings-card-head h2 {
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.settings-card-desc {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.settings-category-errors {
    margin-top: 20px;
}

.settings-category-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-top: 24px;
}

.settings-category-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.settings-category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--background);
}

.settings-category-edit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.settings-category-edit input {
    min-width: 0;
}

.settings-category-usage {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.settings-category-empty {
    margin: 0;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .settings-category-add,
    .settings-category-edit {
        grid-template-columns: 1fr;
    }

    .settings-category-item {
        align-items: stretch;
        flex-direction: column;
    }
}

.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.theme-option {
    cursor: pointer;
}

.theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-option-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-option.is-active .theme-option-card,
.theme-option input:checked + .theme-option-card {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.theme-option-card:hover {
    border-color: #ccc;
}

.theme-option.is-active .theme-option-card:hover {
    border-color: var(--primary);
}

.theme-option-label {
    font-size: 14px;
    font-weight: 600;
}

.theme-option-desc {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.theme-preview {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 6px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.theme-preview-light {
    background: #fafafa;
}

.theme-preview-light .theme-preview-sidebar {
    background: #f2f2f5;
    border-right: 1px solid #e8e8ec;
}

.theme-preview-light .theme-preview-content {
    padding: 10px 8px;
}

.theme-preview-light .theme-preview-line {
    height: 6px;
    border-radius: 3px;
    background: #e8e8ec;
    margin-bottom: 6px;
}

.theme-preview-light .theme-preview-line.short {
    width: 60%;
}

.theme-preview-dark {
    background: #1a1a1a;
    border-color: #2e2e2e;
}

.theme-preview-dark .theme-preview-sidebar {
    background: #0f0f0f;
    border-right: 1px solid #2e2e2e;
}

.theme-preview-dark .theme-preview-content {
    padding: 10px 8px;
}

.theme-preview-dark .theme-preview-line {
    height: 6px;
    border-radius: 3px;
    background: #2e2e2e;
    margin-bottom: 6px;
}

.theme-preview-dark .theme-preview-line.short {
    width: 60%;
}

.theme-preview-system {
    background: linear-gradient(135deg, #fafafa 50%, #1a1a1a 50%);
    border-color: #ccc;
}

.theme-preview-system .theme-preview-sidebar {
    background: linear-gradient(180deg, #f2f2f5 50%, #0f0f0f 50%);
    border-right: 1px solid #ccc;
}

.theme-preview-system .theme-preview-content {
    padding: 10px 8px;
}

.theme-preview-system .theme-preview-line {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(135deg, #e8e8ec 50%, #2e2e2e 50%);
    margin-bottom: 6px;
}

.theme-preview-system .theme-preview-line.short {
    width: 60%;
}

/* ==============================
   Welcome Modal (3D)
   ============================== */

.welcome-modal {
    display: none;
    align-items: center;
    justify-content: center;
}

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

.welcome-modal .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

.welcome-modal-dialog {
    max-width: 580px;
    width: 90%;
    margin: 0;
    padding: 2.5rem;
    text-align: center;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    animation: welcome-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes welcome-pop {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.welcome-model-container {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    margin-bottom: 1.5rem;
}

.welcome-model-container model-viewer {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
}

.welcome-text {
    margin-bottom: 1.5rem;
}

.welcome-text h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.welcome-text p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.welcome-text p strong {
    color: var(--primary);
}

/* Settings: Welcome 3D toggle */

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: 1.5rem;
}

.settings-toggle-info {
    flex: 1;
}

.settings-toggle-info h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text);
}

.settings-toggle-info p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 1rem;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-switch-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-switch-track {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-switch-track::after {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-switch-track {
    box-shadow: var(--ring);
}

/* === Auth hero: brand lockup, acronym treatment & staggered entrance === */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0 0;
}

.auth-hero .brand-mark {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}

.brand-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(40px, 6.5vw, 56px);
    line-height: 0.9;
    letter-spacing: -0.03em;
    color: var(--text);
}

.acronym-expand {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 20px 0 0;
}

.acronym-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
}

.acronym-line b {
    flex: 0 0 1.5em;
    color: var(--primary);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
    line-height: 1;
}

.acronym-of {
    margin-left: calc(1.5em + 12px);
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
    font-weight: 400;
}

.auth-helper {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

@keyframes auth-hero-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-hero > * {
    animation: auth-hero-in 0.5s ease-out both;
}

.auth-hero > :nth-child(1) { animation-delay: 0.05s; }
.auth-hero > :nth-child(2) { animation-delay: 0.12s; }
.auth-hero > :nth-child(3) { animation-delay: 0.20s; }
.auth-hero > :nth-child(4) { animation-delay: 0.30s; }

.auth-card {
    animation: auth-hero-in 0.5s ease-out 0.18s both;
}

@media (prefers-reduced-motion: reduce) {
    .auth-hero > *,
    .auth-card,
    .auth-brand {
        animation: none;
    }
}

/* === Auth: top brand band fills the previously-empty hero area === */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 auto 28px;
    padding: 0 4px;
    width: min(100%, 860px);
    animation: auth-hero-in 0.5s ease-out both;
}

.auth-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 15px;
    border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--border));
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.auth-brand-text {
    display: grid;
    gap: 2px;
}

.auth-brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.auth-brand-sub {
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

/* Brand band placed inside the login card */
.auth-brand-inset {
    margin: 0;
    padding: 0 0 24px;
    width: 100%;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.auth-brand-inset .auth-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    font-size: 16px;
}

.auth-brand-inset .auth-brand-name {
    font-size: 21px;
}

.auth-brand-inset .auth-brand-sub {
    font-size: 12.5px;
}

@media (max-width: 640px) {
    .auth-brand {
        margin-bottom: 28px;
    }
}
