:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #dfe3e8;
    --text: #1f2933;
    --muted: #536475;
    --primary: #2754c5;
    --primary-dark: #1d3f96;
    --success: #1e7b4f;
    --warning: #9a6200;
    --danger: #b42318;
    --radius: 8px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
h3 { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }
code { font-size: 0.8rem; color: var(--muted); }

/* minmax(0, …) keeps wide tables and tabs scrolling inside the column instead of widening the page. */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #111827; color: #fff; padding: 1.5rem 1rem; }
.brand { display: block; text-decoration: none; color: #fff; margin-bottom: 2rem; }
.brand-name { display: block; font-weight: 700; font-size: 1.3rem; }
.brand-tagline { display: block; font-size: 0.8rem; color: #9ca3af; }
.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav a { color: #d1d5db; text-decoration: none; padding: 0.55rem 0.75rem; border-radius: 6px; }
.nav a:hover, .nav a.active { background: #1f2937; color: #fff; }

.content { padding: 2rem; max-width: 1200px; width: 100%; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.eyebrow { margin: 0 0 0.25rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 640px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.grid > .card { margin-bottom: 0; }
.grid + * { margin-top: 1.25rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { margin: 0; display: flex; flex-direction: column; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.button { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 6px; padding: 0.6rem 1rem; font: inherit; cursor: pointer; text-decoration: none; }
.button:hover { background: var(--primary-dark); }
.button-secondary { background: #e5e9f0; color: var(--text); }
.button-secondary:hover { background: #d5dbe5; }

label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }
input[type="text"], input:not([type]), select, textarea { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; box-sizing: border-box; }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
label.checkbox { font-weight: 400; display: flex; gap: 0.4rem; align-items: center; }
label.checkbox input { width: auto; }
pre.path { white-space: pre-wrap; background: #f6f8fb; padding: 0.75rem; border-radius: 6px; }
input.invalid { border-color: var(--danger); }
.field-error { color: var(--danger); margin: 0.35rem 0 0; font-size: 0.875rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.35rem 0 0; }
.actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: end; }
.inline-form label { grid-column: 1 / -1; margin-top: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.path { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }
.muted { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
th.size, td.size { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: #e5e9f0; color: var(--text); }
.badge-success { background: #dcf3e6; color: var(--success); }
.badge-warning { background: #fdf0d5; color: var(--warning); }
.badge-danger { background: #fde2e0; color: var(--danger); }
.badge-neutral { background: #e5e9f0; color: var(--muted); }

.flash { background: #e6efff; border: 1px solid #c3d4fb; color: var(--primary-dark); padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.notices { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.notice { padding: 0.6rem 0.8rem; border-radius: 6px; }
.notice-warning { background: #fdf6e7; border-left: 3px solid var(--warning); }
.notice-danger { background: #fdecea; border-left: 3px solid var(--danger); }
details { border-top: 1px solid var(--border); padding: 0.5rem 0; }
details ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
summary { cursor: pointer; }

/* Accessibility */
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: #fff; color: var(--primary-dark); padding: 0.5rem 1rem; border-radius: 6px; z-index: 10; }
.skip-link:focus { left: 0.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, .content:focus-visible {
    outline: 3px solid #f0b429; outline-offset: 2px;
}
.content:focus { outline: none; }
input[disabled], select[disabled], textarea[disabled] { background: #f6f8fb; color: var(--muted); }

/* Language switcher */
.locale-form { margin-top: 2rem; display: grid; grid-template-columns: 1fr auto; gap: 0.4rem; align-items: center; }
.locale-form label { grid-column: 1 / -1; margin: 0; font-size: 0.8rem; font-weight: 600; color: #9ca3af; }
.locale-form select { background: #1f2937; color: #fff; border-color: #374151; padding: 0.4rem; }
.product-version { margin: 1.5rem 0 0; font-size: 0.8rem; color: #9ca3af; }

/* Buttons */
.button-small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.button-danger { background: #fde2e0; color: var(--danger); }
.button-danger:hover { background: #fbcdc9; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }
.actions.wrap { flex-wrap: wrap; }
.row-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }

/* Workspace tabs */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; padding-bottom: 0; scrollbar-width: thin; }
.tab { white-space: nowrap; text-decoration: none; color: var(--muted); padding: 0.55rem 0.8rem; border-bottom: 3px solid transparent; font-size: 0.9rem; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.intro { color: var(--muted); margin: -0.5rem 0 1.25rem; max-width: 70ch; }

/* Forms */
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 1rem 1rem; margin: 1rem 0 0; }
legend { font-weight: 600; padding: 0 0.35rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0 1rem; }
.grid.group-row { grid-template-columns: 2fr 1fr 1fr 2fr; gap: 0 1rem; }
.grid.group-row + .group-row { margin-top: 0.5rem; border-top: 1px dashed var(--border); }
h2.spaced { margin-top: 1.75rem; }
textarea.code { min-height: 24rem; }
.field-static { margin: 1rem 0 0; }
.color-row { display: flex; gap: 0.5rem; align-items: center; }
.swatch { width: 2.4rem; height: 2.4rem; border-radius: 6px; border: 1px solid var(--border); flex: none; }
.radio-card { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.75rem; margin: 0.5rem 0 0; cursor: pointer; }
.radio-card input { margin-top: 0.2rem; }
.filter-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.filter-form label { margin: 0 0 0.25rem; font-size: 0.85rem; }
.filter-form select { width: auto; min-width: 8rem; }
.notice-info { background: #eef4ff; border-left: 3px solid var(--primary); margin-bottom: 1.25rem; }
.notices-card h2 { color: var(--danger); }
.workflow { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.4rem; }
.rule-list { margin: 0.25rem 0 0; padding-left: 1.25rem; font-size: 0.85rem; }
.facts.compact { gap: 0.25rem 0.75rem; font-size: 0.85rem; }

/* Checklists */
.checklist { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.35rem; }
.checklist.inline { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; }
.release-checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.release-checklist-item { display: grid; grid-template-columns: 5.5rem 8rem 1fr; gap: 0.75rem; align-items: center; padding: 0.55rem 0.75rem; border-radius: 6px; background: #f6f8fb; }
.release-checklist-passed { background: #effaf3; }
.release-checklist-failed { background: #fdf1f0; }
.release-checklist-item .badge { text-align: center; }

/* Previews */
.installer-preview { --preview-primary: var(--primary); --preview-text: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #f7f8fa; }
.installer-preview-header { background: var(--preview-primary); color: var(--preview-text); padding: 0.9rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.installer-preview-logo { max-height: 32px; max-width: 120px; background: #fff; border-radius: 4px; padding: 2px; }
.installer-preview-body { padding: 1rem; }
.installer-preview-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0 0 1rem; font-size: 0.8rem; }
.installer-preview-steps li { padding: 0.2rem 0.6rem; border-radius: 999px; background: #e5e9f0; color: var(--muted); }
.installer-preview-steps li.current { background: var(--preview-primary); color: var(--preview-text); }
.installer-preview-button { display: inline-block; background: var(--preview-primary); color: var(--preview-text); padding: 0.5rem 1rem; border-radius: 6px; }
.installer-preview-support { margin: 0; padding: 0.6rem 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.field-preview fieldset { background: #f7f8fa; }
.preview-field label { font-weight: 600; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Tablet */
@media (max-width: 1100px) {
    .shell { grid-template-columns: 190px minmax(0, 1fr); }
    .content { padding: 1.5rem; }
    .release-checklist-item { grid-template-columns: 5.5rem 1fr; }
    .release-checklist-item .muted { grid-column: 1 / -1; }
    .grid.group-row { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 800px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { padding: 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
    .brand { margin-bottom: 0; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .locale-form { margin-top: 0; grid-template-columns: auto auto; }
    .locale-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .content { padding: 1rem; }
    .facts { grid-template-columns: 1fr; }
    .facts dt { margin-top: 0.5rem; }
    .page-header .actions { flex-wrap: wrap; margin-top: 0.5rem; }
    .actions { flex-wrap: wrap; }
    .inline-form { grid-template-columns: 1fr; }
    .grid.group-row { grid-template-columns: 1fr; }
    .product-version { margin: 0; }
    table { font-size: 0.85rem; }
}
