/* CYRACTA – design system. Plain CSS, no build step. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #dfe3e9;
  --border-strong: #c8ced8;
  --text: #18202c;
  --text-2: #3d4757;
  --muted: #667085;
  --brand: #12355b;
  --brand-2: #1c4f86;
  --primary: #1f5fae;
  --primary-hover: #194f92;
  --primary-soft: #e6eef9;
  --focus: #2f7de1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #157f3c;
  --success-soft: #e5f4ea;
  --warning: #a15c07;
  --warning-soft: #fdf1df;
  --info-soft: #e8f1fb;
  --violet: #5b3cc4;
  --violet-soft: #eeeafb;
  --sidebar: #0f2240;
  --sidebar-text: #c9d4e5;
  --sidebar-active: #1d3a63;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b;
    --surface: #151c27;
    --surface-2: #1b2431;
    --surface-3: #222d3c;
    --border: #283446;
    --border-strong: #354459;
    --text: #e6ebf2;
    --text-2: #c3cbd8;
    --muted: #8d99ab;
    --primary: #5b9cf0;
    --primary-hover: #7bb0f4;
    --primary-soft: #19304f;
    --danger: #f2877d;
    --danger-soft: #3a1b1a;
    --success: #5ccf86;
    --success-soft: #16301f;
    --warning: #f0b45c;
    --warning-soft: #372815;
    --info-soft: #172a42;
    --violet: #a993f5;
    --violet-soft: #2a2347;
    --sidebar: #0a1422;
    --sidebar-active: #18304f;
    --shadow-sm: none;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.15rem 1.25rem 1rem; color: #fff; font-weight: 700; letter-spacing: .12em; font-size: 1.02rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3a86e0, #1b4d8c); display: grid; place-items: center; font-size: .8rem; letter-spacing: 0; }
.brand small { display: block; font-weight: 400; letter-spacing: 0; font-size: .72rem; color: var(--sidebar-text); }
.nav { padding: .5rem .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f8ea6; padding: 1rem .6rem .35rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a[aria-current="page"] { background: var(--sidebar-active); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-footer { margin-top: auto; padding: 1rem 1.25rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.sidebar-footer .user { color: #fff; font-weight: 600; }
.role-pill { display: inline-block; margin-top: .25rem; padding: .05rem .5rem; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: .72rem; letter-spacing: .03em; }
.sidebar-footer form { margin-top: .75rem; }
.sidebar-footer button { background: none; border: 1px solid rgba(255, 255, 255, .18); color: var(--sidebar-text); border-radius: 6px; padding: .35rem .7rem; cursor: pointer; font: inherit; font-size: .82rem; }
.sidebar-footer button:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.75rem 2rem 3rem; width: 100%; max-width: 1280px; }
.content.wide { max-width: none; }
.menu-toggle { display: none; }

/* ---------- Page header ---------- */
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.breadcrumbs a { color: var(--muted); }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--muted); margin-top: .25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 550; font-size: .93rem; cursor: pointer; line-height: 1.2; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .35rem .65rem; font-size: .84rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

/* ---------- Cards, panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 1.25rem 1.35rem; }
.card-header { padding: 1rem 1.35rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-header h2, .card-header h3 { margin: 0; }
.card-footer { padding: .85rem 1.35rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }

.stat { padding: 1.1rem 1.25rem; }
.stat .label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: .15rem; letter-spacing: -.02em; }
.stat .value small { font-size: .9rem; color: var(--muted); font-weight: 500; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.status-erfassung { background: var(--info-soft); color: var(--primary); }
.status-pruefung { background: var(--warning-soft); color: var(--warning); }
.status-abgeschlossen { background: var(--success-soft); color: var(--success); }
.status-abgenommen { background: var(--violet-soft); color: var(--violet); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .title { font-weight: 600; color: var(--text); }
.table .sub { font-size: .84rem; color: var(--muted); }
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }

/* ---------- Forms ---------- */
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input[type=search], .search input[type=text] { padding-left: 2.2rem; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: .93rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .5rem .7rem; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 2.6rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
input[readonly], textarea[readonly], select[disabled], textarea[disabled], input[disabled] { background: var(--surface-2); color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section h3 { margin-bottom: 1rem; }
.field label, .field .label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: .3rem; color: var(--text-2); }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.field .errors { color: var(--danger); font-size: .82rem; margin-top: .3rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.required-mark { color: var(--danger); margin-left: .15rem; }
.checkbox-list { display: grid; gap: .5rem; }
.checkbox-list label, .check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.checkbox-list label:hover { background: var(--surface-2); }
.checkbox-list input { margin-top: .25rem; }
.checkbox-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }

/* ---------- Alerts / toasts ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); color: var(--text-2); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.messages { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* ---------- Progress, stepper ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: 999px; transition: width .3s; }
.progress.lg { height: 10px; }
.progress-label { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); margin-bottom: .35rem; }
.stepper { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; }
.stepper li { flex: 1; position: relative; padding-top: 1.6rem; font-size: .84rem; color: var(--muted); text-align: center; }
.stepper li::before { content: ""; position: absolute; top: .45rem; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.stepper li:last-child::before { display: none; }
.stepper li::after { content: ""; position: absolute; top: 0; left: calc(50% - .5rem); width: 1rem; height: 1rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); z-index: 1; }
.stepper li.done { color: var(--text-2); }
.stepper li.done::after { background: var(--success); border-color: var(--success); }
.stepper li.done::before { background: var(--success); }
.stepper li.current { color: var(--text); font-weight: 650; }
.stepper li.current::after { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: fit-content(55%) minmax(0, 1fr); gap: .5rem 1.25rem; margin: 0; font-size: .93rem; }
.kv dt, .kv dd { min-width: 0; overflow-wrap: break-word; hyphens: auto; }  /* labels wrap beyond 55 %, values only when unavoidable */
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tab { padding: .35rem .75rem; border-radius: 999px; font-size: .85rem; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.tab:hover { background: var(--surface-2); text-decoration: none; }
.tab[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .count { opacity: .75; margin-left: .25rem; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h3 { color: var(--text); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand-2) 22%, transparent), transparent),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--primary) 16%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .card-body { padding: 2rem; }
.auth-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 1rem; color: #fff; }
.auth-brand strong { font-size: 1.25rem; letter-spacing: .14em; }
.auth-brand div span { display: block; font-size: .82rem; color: var(--muted); }

/* ---------- Workspace (Fragenbearbeitung) ---------- */
.ws-header { padding: 1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.ws-header .title { flex: 1; min-width: 260px; }
.ws-header h1 { font-size: 1.2rem; margin: 0; }
.ws-progress { width: 260px; }
.ws { display: grid; grid-template-columns: 360px minmax(0, 1fr); flex: 1; min-height: 0; }
.ws-tree { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; height: calc(100vh - 74px); position: sticky; top: 0; }
.ws-tree .filters { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: grid; gap: .6rem; }
.ws-tree nav { overflow-y: auto; padding: .5rem 0 2rem; flex: 1; }
.tree-catalog { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .9rem 1rem .3rem; font-weight: 600; }
.tree details { border: none; }
.tree summary { list-style: none; cursor: pointer; padding: .45rem 1rem; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "›"; display: inline-block; width: .8rem; transition: transform .15s; color: var(--muted); }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary .meta { margin-left: auto; font-weight: 500; font-size: .78rem; color: var(--muted); }
.tree-group { font-size: .78rem; color: var(--muted); padding: .35rem 1rem .15rem 2.1rem; font-weight: 600; }
.tree-control { font-size: .82rem; color: var(--text-2); padding: .3rem 1rem .1rem 2.1rem; }
.tree-control .code { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin-right: .3rem; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree-item a { display: flex; gap: .55rem; align-items: flex-start; padding: .38rem 1rem .38rem 2.35rem; color: var(--text); font-size: .87rem; border-left: 3px solid transparent; line-height: 1.35; }
.tree-item a:hover { background: var(--surface-2); text-decoration: none; }
.tree-item.active a { background: var(--primary-soft); border-left-color: var(--primary); }
.tree-item .q { flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tree-item .nr { font-family: var(--mono); font-size: .75rem; color: var(--muted); flex: none; min-width: 3.2rem; padding-top: .1rem; }
.tree-item.hidden { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: .3rem; border: 2px solid var(--border-strong); background: var(--surface); }
.dot.done { background: var(--success); border-color: var(--success); }
.dot.partial { background: linear-gradient(90deg, var(--warning) 50%, var(--surface) 50%); border-color: var(--warning); }
.dot.dropped { border-style: dashed; }
.tree-item.dropped .q { text-decoration: line-through; color: var(--muted); }
.ws-panel { padding: 1.5rem 2rem 4rem; min-width: 0; }
.ws-panel-inner { max-width: 920px; }
.question-card h2 { font-size: 1.22rem; line-height: 1.4; margin: .35rem 0 .75rem; }
.question-card h2[tabindex="-1"]:focus { outline: none; }
.question-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .84rem; color: var(--muted); }
.context-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .9rem; }
.context-box summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.context-box p { margin: .5rem 0 0; }
.hint { display: flex; gap: .5rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--info-soft); font-size: .9rem; color: var(--text-2); }
.panel-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1.5rem; }
.save-state { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.save-state.saved { color: var(--success); }
.save-state.error { color: var(--danger); }
.htmx-request .save-state, .save-state.htmx-request { color: var(--muted); }

/* Segmented rating scale */
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: .4rem; }
.scale ul, .scale > div { display: contents; }
.scale label { position: relative; display: block; cursor: pointer; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale .opt { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); height: 100%; transition: border-color .12s, background .12s; }
.scale .opt .v { font-weight: 700; font-size: 1.05rem; }
.scale .opt .t { font-size: .76rem; color: var(--muted); line-height: 1.25; }
.scale label:hover .opt { border-color: var(--primary); }
.scale input:checked + .opt { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.scale input:checked + .opt .t { color: var(--text-2); }
.scale input:focus-visible + .opt { outline: 3px solid var(--focus); outline-offset: 2px; }
.scale input:disabled + .opt { cursor: default; opacity: .75; }
.scale-clear { font-size: .8rem; }
.rating-block + .rating-block { margin-top: 1.25rem; }
.rating-block .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .5rem; }

/* Measures */
.measure { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem; background: var(--surface); }
.measure + .measure { margin-top: .6rem; }
.measure .head { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; }
.measure .name { font-weight: 600; }
.measure .facts { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .84rem; color: var(--muted); margin-top: .35rem; }
.measure .facts strong { color: var(--text-2); font-weight: 600; }
.measure.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--success-soft); } to { background: var(--surface); } }
.add-measure { display: flex; gap: .5rem; align-items: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.add-measure .field { flex: 1; }
.scm-list { font-size: .85rem; color: var(--muted); }
.scm-list li { margin: .2rem 0; }

kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; background: var(--surface); color: var(--text-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout-main-side { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .brand { padding: .85rem 1rem; }
  .menu-toggle { display: inline-flex; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 6px; padding: .3rem .6rem; font: inherit; cursor: pointer; }
  .nav, .sidebar-footer { display: none; }
  .sidebar.open .nav, .sidebar.open .sidebar-footer { display: flex; }
  .sidebar.open .sidebar-footer { display: block; }
  .content { padding: 1.25rem 1rem 2.5rem; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .ws-header { padding: 1rem; }
  .ws { grid-template-columns: 1fr; }
  .ws-tree { position: static; height: auto; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--border); }
  .ws-panel { padding: 1.25rem 1rem 3rem; }
  .ws-progress { width: 100%; }
}
@media print {
  .sidebar, .actions, .ws-tree, .panel-nav { display: none !important; }
  .app { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Admin catalog tree ---------- */
.md-tree { font-size: .92rem; }
.md-node { margin-left: 1.1rem; border-left: 1px solid var(--border); padding-left: .75rem; }
.md-node.chapter { margin-left: 0; border-left: none; padding-left: 0; margin-bottom: 1rem; }
.md-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .3rem 0; }
.md-row > a { color: var(--text); }
.md-node.question .md-row > a { color: var(--text-2); }
.md-add { margin-left: auto; font-size: .8rem; opacity: 0; transition: opacity .12s; }
.md-row:hover .md-add, .md-row:focus-within .md-add { opacity: 1; }
@media (hover: none) { .md-add { opacity: 1; } }

/* ---------- Charts (validated: series #2a78d6 light / #3987e5 dark, see docs) ---------- */
:root { --viz-series: #2a78d6; --viz-neutral: #b9c0cb; --viz-track: transparent;
  --heat-1: #cde2fb; --heat-2: #9ec5f4; --heat-3: #6da7ec; --heat-4: #3987e5; --heat-5: #256abf; --heat-6: #184f95;
  --heat-ink-low: #18202c; --heat-ink-high: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root { --viz-series: #3987e5; --viz-neutral: #4a5568;
    --heat-1: #104281; --heat-2: #184f95; --heat-3: #256abf; --heat-4: #3987e5; --heat-5: #6da7ec; --heat-6: #9ec5f4;
    --heat-ink-low: #ffffff; --heat-ink-high: #0e131b; }
}
.chart figcaption { font-weight: 650; margin-bottom: .75rem; }
.chart figcaption small { font-weight: 400; color: var(--muted); }
.chart { margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 210px) 1fr 92px; gap: .75rem; align-items: center; padding: .28rem .35rem; border-radius: 6px; font-size: .88rem; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 18px; border-left: 1px solid var(--border-strong); }
.bar { display: block; height: 18px; background: var(--viz-series); border-radius: 0 4px 4px 0; min-width: 0; }
.bar.neutral { background: var(--viz-neutral); }
.bar-value { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.bar-value small { color: var(--muted); font-weight: 400; }
.chart details { margin-top: .75rem; font-size: .85rem; }
.chart details summary { cursor: pointer; color: var(--primary); }
.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: .88rem; }
.heat th { font-size: .76rem; color: var(--muted); font-weight: 600; text-align: center; padding: .35rem .25rem; }
.heat th.row-head, .heat td.row-head { text-align: left; color: var(--text); font-weight: 500; padding-right: .75rem; white-space: nowrap; }
.heat td.cell { text-align: center; border-radius: 4px; padding: .45rem .25rem; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.heat td.cell.step-0 { color: var(--muted); }
.heat td.step-1 { background: var(--heat-1); color: var(--heat-ink-low); }
.heat td.step-2 { background: var(--heat-2); color: var(--heat-ink-low); }
.heat td.step-3 { background: var(--heat-3); color: var(--heat-ink-low); }
.heat td.step-4 { background: var(--heat-4); color: var(--heat-ink-high); }
.heat td.step-5 { background: var(--heat-5); color: var(--heat-ink-high); }
.heat td.step-6 { background: var(--heat-6); color: var(--heat-ink-high); }
.heat td.total { text-align: right; font-weight: 600; padding-left: .75rem; }
.heat-legend { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); margin-top: .6rem; }
.heat-legend span.sw { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }
.report-note { font-size: .84rem; color: var(--muted); }
@media print {
  .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
.rule-tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; padding: .08rem .5rem; border-radius: 999px; border: 1px dashed var(--border-strong); color: var(--text-2); background: var(--surface); }
.rule-tag::before { content: "⚑"; font-size: .7rem; color: var(--muted); }

/* ---------- Control-centred workspace (EXT-03) ---------- */
.tree-sub { display: block; font-size: .74rem; color: var(--muted); margin-top: .1rem; }
.tree-item .nr { min-width: 4.6rem; }
.control-rating { border-left: 3px solid var(--primary); }
.card.question { border-left: 3px solid var(--border-strong); }
.card.question.dropped { opacity: .65; }
.card.question .card-header { align-items: flex-start; }
.question-details { margin-top: .9rem; }
.question-details summary { cursor: pointer; color: var(--primary); }
.answered-by { padding: .5rem 1.35rem; border-top: 1px solid var(--border); }
.measures-block { padding: .9rem 1.35rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.measures-block h5 { margin: 0 0 .6rem; font-size: .9rem; }
.table tr.control-row td { background: var(--surface-2); border-top: 2px solid var(--border-strong); }

/* EXT-05/07: evidence per question, assessor guide, score line */
.hint-block { display: block; }
.hint-block summary { color: var(--text-2); }
.evidence-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.evidence-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); gap: .5rem; }
.evidence-list .sub { display: block; }
.evidence-add { margin-top: .6rem; }
.score-line { display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; margin-top: .4rem; }
.score-line .label { color: var(--muted); }
.score-track { display: flex; }
.bar-range { display: block; height: 18px; background: var(--viz-series); opacity: .28; border-radius: 0 4px 4px 0; }
.score-track .bar + .bar-range { border-radius: 0 4px 4px 0; }
.score-track .bar:has(+ .bar-range[style*="width: 0%"]) { border-radius: 0 4px 4px 0; }
.ui-switch { display: block; margin-top: .6rem; font-size: .76rem; color: #7f8ea6; }
.ui-switch a { color: var(--sidebar-text); text-decoration: underline; }
.auth { align-content: center; gap: 0; }
.score-track { position: relative; }
.target-mark { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--text); opacity: .7; }

/* Layout fixes (design audit 31.10.2026, all variants) */
@media (max-width: 820px) { .app { grid-template-rows: auto 1fr; } }          /* no stretched gap under the logo bar */
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); } /* zebra rows stay inside rounded cards */
.table th.right, .table th.num { text-align: right; }
.heat td.cell.open { background: var(--surface-3); color: var(--text-2); }       /* «noch offen» is neutral, not a heat step */
.empty svg { color: var(--muted); margin-bottom: .5rem; }

/* EXT-10: control description in the workspace header */
.control-description { margin-top: .6rem; font-size: .9rem; color: var(--text-2); }
.control-description summary { cursor: pointer; font-weight: 600; }
.control-description ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.control-description li { margin: .15rem 0; max-width: 80ch; }
.control-description p { margin: .4rem 0 0; max-width: 80ch; }
/* Assessment full-text search */
.assessment-search-results { list-style:none; padding:0; margin:0; }
.assessment-search-results li { border-bottom:1px solid var(--border, #ccc); }
.assessment-search-results a { display:flex; flex-direction:column; gap:.3rem; padding:.75rem .25rem; color:inherit; text-decoration:none; }
.assessment-search-results a:hover, .assessment-search-results a:focus-visible { background:var(--surface-hover, #e5e9ed); color:#182330; }
.search-snippet { overflow-wrap:anywhere; }
.search-snippet mark { background:#ffe38a; color:#182330; }
#assessment-search-results { max-height:55vh; overflow:auto; }
.question, .measure, #control-heading, #control-context { scroll-margin-top:1rem; }
.evidence-records > li { display:block; padding:.8rem 0; }
.evidence-records textarea { width:100%; min-height:4rem; }
/* Interview guidance stays with its implementation question. */
.interview-prompt { margin:0 0 .75rem; padding:.7rem .9rem; border-left:3px solid var(--primary); background:var(--info-soft); border-radius:var(--radius-sm); color:var(--text-2); }
.interview-prompt p { margin:.25rem 0 0; font-size:.95rem; line-height:1.5; }
.question-guide { margin-bottom:.75rem; }
.question-guide > summary { cursor:pointer; }
.guide-section + .guide-section { margin-top:1rem; padding-top:.75rem; border-top:1px solid var(--border); }
.guide-section h5 { margin:.75rem 0 .35rem; font-size:.9rem; }
.guide-section h5 .muted { font-weight:400; }
.guide-section p, .guide-section ul { margin:.35rem 0 0; }
.guide-section ul { padding-left:1.25rem; }
.guide-section li + li { margin-top:.25rem; }
