:root {
    color-scheme: dark;
    --bg: #070a09;
    --rail: #090d0c;
    --surface: #0d1211;
    --surface-raised: #111715;
    --surface-hover: #151d1a;
    --line: #24302c;
    --line-strong: #34443e;
    --text: #e7efeb;
    --text-strong: #f7fbf9;
    --muted: #91a099;
    --faint: #65736d;
    --accent: #39df88;
    --accent-strong: #20bd70;
    --accent-soft: rgba(57, 223, 136, 0.1);
    --info: #63c2d0;
    --info-soft: rgba(99, 194, 208, 0.1);
    --warning: #d8aa52;
    --warning-soft: rgba(216, 170, 82, 0.1);
    --danger: #ed6573;
    --danger-strong: #d94e5d;
    --danger-soft: rgba(237, 101, 115, 0.1);
    --focus: rgba(99, 194, 208, 0.42);
    --radius: 6px;
    --font-ui: "Segoe UI Variable", "Segoe UI", Inter, Arial, sans-serif;
    --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f5f3;
    --rail: #f8faf9;
    --surface: #ffffff;
    --surface-raised: #f7faf8;
    --surface-hover: #eef4f1;
    --line: #d4ddd8;
    --line-strong: #b9c7c0;
    --text: #23302a;
    --text-strong: #101a15;
    --muted: #5c6d65;
    --faint: #7e8b85;
    --accent: #087a48;
    --accent-strong: #066b3e;
    --accent-soft: rgba(8, 122, 72, 0.08);
    --info: #176f7d;
    --info-soft: rgba(23, 111, 125, 0.08);
    --warning: #926513;
    --warning-soft: rgba(146, 101, 19, 0.09);
    --danger: #b83244;
    --danger-strong: #a72839;
    --danger-soft: rgba(184, 50, 68, 0.08);
    --focus: rgba(23, 111, 125, 0.3);
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a {
    color: var(--info);
    text-decoration: none;
}

a:hover { color: var(--accent); }

code,
pre { font-family: var(--font-mono); }

code {
    color: var(--info);
    overflow-wrap: anywhere;
}

button,
input,
select,
textarea { font: inherit; }

button { appearance: none; }

h1,
h2,
h3,
p { margin-top: 0; }

h1,
h2,
h3 {
    color: var(--text-strong);
    font-weight: 650;
    letter-spacing: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
    line-height: 1.18;
}

h2 {
    margin-bottom: 14px;
    font-size: 18px;
    line-height: 1.3;
}

h3 {
    margin-bottom: 8px;
    font-size: 15px;
}

.ui-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

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

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 100vh;
    min-width: 0;
    flex-direction: column;
    padding: 18px 14px;
    border-right: 1px solid var(--line);
    background: var(--rail);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 8px;
    color: var(--text-strong);
}

.brand:hover { color: var(--text-strong); }

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    background: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
}

.brand strong,
.brand small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand strong {
    font-family: var(--font-mono);
    font-size: 14px;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 3px;
    margin-top: 24px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 10px;
    border-left: 2px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-weight: 520;
}

.nav a:hover {
    color: var(--text);
    background: var(--surface-raised);
}

.nav a.is-active {
    border-left-color: var(--accent);
    color: var(--text-strong);
    background: var(--accent-soft);
}

.nav-icon {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--faint);
}

.nav a:hover .nav-icon,
.nav a.is-active .nav-icon { color: var(--accent); }

.sidebar-footer,
.auth-status {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent);
}

.main {
    width: 100%;
    min-width: 0;
    max-width: 1600px;
    padding: 24px 28px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.page-context {
    margin: 0 0 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.project-switcher {
    display: grid;
    gap: 4px;
    min-width: 190px;
}

.project-switcher label,
.form-stack label,
.scan-control label,
.filter-bar label,
.user-form-grid label,
.compact-form-grid label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 520;
}

.form-stack label,
.scan-control label,
.filter-bar label,
.user-form-grid label,
.compact-form-grid label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    background: var(--surface-raised);
}

textarea {
    min-height: 92px;
    resize: vertical;
}

select { cursor: pointer; }

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

input:hover,
select:hover,
textarea:hover { border-color: var(--faint); }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--info);
    box-shadow: 0 0 0 3px var(--focus);
}

input[type="file"] {
    min-height: 46px;
    padding: 6px;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

a:focus-visible,
button:focus-visible,
.click-row:focus-visible {
    outline: 2px solid var(--info);
    outline-offset: 3px;
}

.icon-button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--accent-strong);
    border-radius: 4px;
    color: #06120c;
    background: var(--accent);
    cursor: pointer;
    font-weight: 650;
    line-height: 1.2;
}

.button {
    gap: 7px;
    padding: 8px 13px;
}

.button:hover,
.icon-button:hover {
    color: #06120c;
    background: #52e997;
    border-color: #52e997;
}

[data-theme="light"] .button,
[data-theme="light"] .icon-button,
[data-theme="light"] .button:hover,
[data-theme="light"] .icon-button:hover { color: #ffffff; }

[data-theme="light"] .button:hover,
[data-theme="light"] .icon-button:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.button.ghost {
    color: var(--text);
    background: transparent;
    border-color: var(--line-strong);
}

.button.ghost:hover {
    color: var(--text-strong);
    background: var(--surface-hover);
    border-color: var(--faint);
}

.button.danger {
    color: #ffffff;
    background: var(--danger-strong);
    border-color: var(--danger-strong);
}

.button.danger:hover {
    color: #ffffff;
    background: var(--danger);
    border-color: var(--danger);
}

.button.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.button:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

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

.theme-icon,
.theme-icon-moon,
.theme-icon-sun {
    display: grid;
    place-items: center;
}

.theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: grid; }

.flash {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--text);
    background: var(--surface);
}

.flash.success { border-color: rgba(57, 223, 136, 0.42); }
.flash.error { border-color: rgba(237, 101, 115, 0.52); }

.project-overview,
.panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.project-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 20px;
    border-color: var(--line-strong);
}

.project-overview h2 {
    margin-bottom: 7px;
    font-family: var(--font-mono);
    font-size: 24px;
}

.project-overview p:last-child {
    max-width: 860px;
    margin-bottom: 0;
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 14px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.metric {
    min-width: 0;
    padding: 16px 18px;
    border-right: 1px solid var(--line);
}

.metric:last-child { border-right: 0; }

.metric span,
.muted { color: var(--muted); }

.metric strong {
    display: block;
    margin-top: 7px;
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 650;
    line-height: 1.15;
}

.metric small {
    display: block;
    margin-top: 4px;
}

.panel {
    margin-bottom: 14px;
    padding: 18px;
}

.panel.danger,
.danger-zone { border-color: rgba(237, 101, 115, 0.5); }

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading p { margin-bottom: 0; }

.panel-heading p { margin-top: 4px; }

.two-column,
.admin-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
    gap: 14px;
    align-items: start;
}

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

.two-column > *,
.admin-grid > * { min-width: 0; }

.form-stack {
    display: grid;
    gap: 13px;
}

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

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, 0.8fr)) auto;
    gap: 9px;
    align-items: end;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.filter-bar.compact { grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.4fr) auto; }

.inline-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.inline-filter input,
.inline-filter select {
    width: auto;
    min-width: 150px;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text);
}

.sort-link:hover { color: var(--accent); }

.sort-link .ui-icon {
    width: 13px;
    height: 13px;
}

.admin-grid { grid-template-columns: minmax(320px, 0.78fr) minmax(560px, 1.22fr); }

.compact-form-grid {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 1fr) 90px 104px minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.user-form-grid {
    display: grid;
    grid-template-columns: 140px minmax(160px, 1fr) minmax(130px, 0.8fr);
    gap: 9px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.user-form-grid:first-child { padding-top: 0; }
.user-form-grid:last-child { padding-bottom: 0; border-bottom: 0; }

.user-form-grid small {
    display: block;
    margin-top: 3px;
}

.user-form-grid .action-row { justify-content: flex-end; }

.check-line,
.form-stack label.check-line,
.user-form-grid label.check-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    color: var(--muted);
}

.validation-form {
    flex: 1 1 520px;
    flex-wrap: wrap;
}

.validation-form select { width: min(210px, 100%); }
.validation-form input { width: min(210px, 100%); }

.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-raised);
}

.mail-template-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.mail-template-panel h2,
.mail-template-panel p { margin-bottom: 0; }

.clipboard-template {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.clipboard-html { display: none; }

.clipboard-template.manual-copy {
    position: static;
    width: 100%;
    height: 260px;
    margin-top: 12px;
    opacity: 1;
}

.copy-status {
    min-height: 18px;
    font-size: 12px;
}

.match-select {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.schema-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 16px;
}

.schema-preview span,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface-raised);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.2;
}

.schema-preview span { color: var(--info); }

.badge.danger,
.badge.failed,
.badge.security,
.badge.validation-invalid,
.badge.error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(237, 101, 115, 0.34);
}

.badge.completed,
.badge.validation-valid {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(57, 223, 136, 0.32);
}

.badge.running,
.badge.queued,
.badge.validation-pending,
.badge.audit {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: rgba(216, 170, 82, 0.32);
}

.badge.risk-alto {
    color: #ffffff;
    background: var(--danger-strong);
    border-color: var(--danger-strong);
}

.badge.risk-medio {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: rgba(216, 170, 82, 0.32);
}

.badge.risk-basso {
    color: var(--info);
    background: var(--info-soft);
    border-color: rgba(99, 194, 208, 0.32);
}

.badge.risk-nullo {
    color: var(--muted);
    background: transparent;
}

.list { display: grid; }

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.list-row:first-child { border-top: 1px solid var(--line); }

.list-row:hover {
    color: var(--text-strong);
    background: var(--surface-raised);
}

.list-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.chevron { color: var(--faint); }

.chevron .ui-icon {
    width: 17px;
    height: 17px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

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

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    background: var(--surface-raised);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

td { color: var(--text); }
tr:last-child td { border-bottom: 0; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--surface-hover); }

.scan-control {
    display: flex;
    align-items: end;
    gap: 10px;
    max-width: 680px;
}

.scan-control label { flex: 1; }

.progress-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-raised);
}

.progress-top,
.meta-line,
.match-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.progress-bar {
    height: 8px;
    margin: 11px 0;
    overflow: hidden;
    border-radius: 2px;
    background: var(--line);
}

.progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
}

.empty-state {
    padding-block: 48px;
    text-align: center;
}

.empty-state.small { padding: 26px; }

.detail-heading {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.detail-heading h2 {
    flex: 1 1 100%;
    margin: 4px 0 0;
    font-family: var(--font-mono);
    font-size: 25px;
}

.detail-heading p {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
}

.back-link .ui-icon {
    width: 16px;
    height: 16px;
}

.match-list {
    display: grid;
    gap: 8px;
}

.match-card {
    display: grid;
    gap: 11px;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-raised);
}

.match-card.high-risk { border-color: rgba(237, 101, 115, 0.48); }

.match-card,
.match-card p,
.match-card dd,
.match-card a,
.match-card strong,
.meta-line span {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.match-card p {
    margin-bottom: 0;
    color: var(--text);
}

.match-card-head {
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.match-card-head strong {
    flex: 1 1 220px;
    min-width: 0;
    color: var(--text-strong);
}

.confidence {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
}

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

dt {
    color: var(--muted);
    font-size: 11px;
}

dd {
    min-width: 0;
    margin: 2px 0 0;
    color: var(--text);
}

.meta-line {
    justify-content: flex-start;
    flex-wrap: wrap;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.meta-line span + span::before {
    content: "/";
    margin-right: 10px;
    color: var(--faint);
}

.setup-error {
    display: grid;
    min-height: 100vh;
    max-width: 620px;
    margin: 0 auto;
    padding: 24px;
    align-content: center;
}

.setup-error > .panel {
    width: 100%;
    margin: 0;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr);
    min-height: 100vh;
}

.auth-context {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 32px;
    border-right: 1px solid var(--line);
    background: var(--rail);
}

.auth-context .brand {
    align-self: flex-start;
    padding: 0;
}

.auth-context-copy {
    width: min(520px, 100%);
    margin: auto 0;
}

.auth-context-copy h1 {
    max-width: 500px;
    margin-bottom: 16px;
    font-size: 40px;
    line-height: 1.12;
}

.auth-context-copy > p:last-child {
    max-width: 480px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
}

.auth-panel-area {
    display: grid;
    width: min(460px, calc(100% - 48px));
    margin: auto;
    align-content: center;
}

.login-panel {
    margin: 0;
    padding: 26px;
}

.login-panel h2 {
    margin-bottom: 20px;
    font-size: 22px;
}

.docs-intro {
    display: flex;
    gap: 28px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.docs-intro h2 { margin-bottom: 7px; font-size: 26px; }
.docs-intro p:last-child { max-width: 780px; margin: 0; color: var(--muted); }

.docs-meta { display: flex; flex: 0 0 auto; gap: 22px; }
.docs-meta div { min-width: 100px; }
.docs-meta dt { font-family: var(--font-mono); text-transform: uppercase; }
.docs-meta dd { font-size: 12px; white-space: nowrap; }

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

.help-nav {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px;
}

.help-nav strong {
    padding: 7px 9px 10px;
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
}

.help-nav a {
    padding: 7px 9px;
    border-left: 2px solid transparent;
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.help-nav a:hover,
.help-nav a:focus-visible {
    border-left-color: var(--accent);
    color: var(--text-strong);
    background: var(--surface-raised);
}

.help-content {
    min-width: 0;
    padding: 0 28px;
    scroll-behavior: smooth;
}

.docs-section {
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 20px;
}

.docs-section:last-child { border-bottom: 0; }
.docs-section h2 { margin-bottom: 14px; font-size: 22px; }
.docs-section h3 { margin: 22px 0 8px; font-size: 15px; }
.docs-section > p { max-width: 920px; line-height: 1.7; }
.docs-section a { overflow-wrap: anywhere; }

.docs-kicker,
.release-date {
    margin-bottom: 7px !important;
    color: var(--accent) !important;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
}

.docs-list,
.docs-steps {
    display: grid;
    gap: 9px;
    max-width: 940px;
    margin: 12px 0 0;
    padding-left: 22px;
    color: var(--text);
    line-height: 1.6;
}

.docs-steps { gap: 13px; }
.docs-list li::marker,
.docs-steps li::marker { color: var(--accent); font-family: var(--font-mono); }

.docs-callout {
    max-width: 940px;
    margin-top: 18px;
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    background: var(--surface-raised);
}

.docs-callout.warning { border-left-color: var(--warning); }
.docs-callout strong { display: block; margin-bottom: 5px; color: var(--text-strong); }
.docs-callout p { margin: 0; color: var(--muted); line-height: 1.6; }

.docs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 980px;
    margin-top: 8px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.docs-grid > div {
    padding: 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.docs-grid h3 { margin-top: 0; }
.docs-grid p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.docs-table { margin-top: 12px; }

.release-heading { display: flex; gap: 12px; align-items: center; }
.release-heading h2 { margin: 0; }

.version-badge {
    padding: 3px 7px;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 11px;
}

.release-date { margin-top: 8px; color: var(--muted) !important; }

@media (max-width: 1240px) {
    .admin-grid { grid-template-columns: 1fr; }
    .compact-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .docs-intro { align-items: flex-start; flex-direction: column; }
}

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

    .sidebar {
        position: static;
        height: auto;
        padding: 12px 16px 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand { padding-inline: 0; }

    .nav {
        display: flex;
        gap: 2px;
        margin-top: 10px;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .nav a {
        flex: 0 0 auto;
        border-bottom: 2px solid transparent;
        border-left: 0;
        border-radius: 4px 4px 0 0;
        white-space: nowrap;
    }

    .nav a.is-active {
        border-bottom-color: var(--accent);
        border-left-color: transparent;
    }

    .sidebar-footer { display: none; }
    .main { padding: 20px; }

    .two-column,
    .two-column.wide-left,
    .filter-bar,
    .filter-bar.compact { grid-template-columns: 1fr; }

    .filter-bar .action-row { justify-content: flex-start; }

    .help-layout { grid-template-columns: 1fr; }
    .help-nav {
        position: static;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .help-nav strong { grid-column: 1 / -1; }
    .help-content { padding-inline: 22px; }
}

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

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .project-switcher { flex: 1 1 220px; }
    .metric-grid { grid-template-columns: 1fr; }

    .metric {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .metric:last-child { border-bottom: 0; }

    .panel-heading,
    .mail-template-panel,
    .scan-control {
        align-items: stretch;
        flex-direction: column;
    }

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

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

    .auth-context {
        min-height: 280px;
        padding: 24px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .auth-context-copy { margin: 44px 0 30px; }
    .auth-context-copy h1 { font-size: 32px; }

    .auth-panel-area {
        width: min(100% - 32px, 460px);
        margin: 32px auto;
    }

    .docs-meta { width: 100%; flex-wrap: wrap; }
    .docs-grid { grid-template-columns: 1fr; }
    .help-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .main { padding: 16px 12px 28px; }
    .sidebar { padding-inline: 12px; }
    h1 { font-size: 24px; }

    .project-overview,
    .panel { padding: 15px; }

    .project-overview h2,
    .detail-heading h2 { font-size: 21px; }

    .compact-form-grid,
    .user-form-grid,
    dl { grid-template-columns: 1fr; }

    .inline-filter,
    .inline-filter input,
    .inline-filter select,
    .inline-form.validation-form,
    .validation-form select,
    .validation-form input { width: 100%; }

    .validation-form .button { width: 100%; }
    .match-card-head .confidence { margin-left: 0; }

    .auth-context {
        min-height: 250px;
        padding: 20px;
    }

    .auth-context-copy h1 { font-size: 28px; }
    .login-panel { padding: 20px; }

    .docs-intro { padding: 16px; }
    .docs-meta { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .docs-meta dd { white-space: normal; }
    .help-nav { grid-template-columns: 1fr; }
    .help-content { padding-inline: 16px; }
    .docs-section { padding-block: 24px; }
}

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