/* Promptwache – Stylesheet
   Farben angelehnt an Einsatzfahrzeuge und Einsatzkleidung:
   Leuchtrot (abgedunkelt für ausreichenden Kontrast), Weiß, Dunkelblau.
   Die rot-weiße Schraffur zitiert die Heckwarnmarkierung nach DIN 30710.
   Bewusst kein rotes Kreuz und kein Star of Life (geschützte Zeichen). */
:root {
  --brand: #C8141E;
  --brand-dark: #A50F18;
  --brand-soft: #FDEDEE;
  --brand-line: #F2C4C7;
  --signal: #E3000F;
  --navy: #15233B;
  --navy-soft: #B8C2D3;
  --navy-tint: #EAEEF4;
  --navy-line: #CBD3E0;
  --ink: #16202E;
  --ink-soft: #4A5568;
  --ink-muted: #5B6577;
  --paper: #F4F6F8;
  --white: #FFFFFF;
  --line: #DDE2E8;
  --line-strong: #C3CAD4;
  --stripe: repeating-linear-gradient(-45deg, var(--signal) 0 9px, var(--white) 9px 18px);
  --ok: #2E7D32;
  --ok-soft: #E6F3E7;
  --warn: #9A5B00;
  --warn-soft: #FFF3DF;
  --err: #B3261E;
  --err-soft: #FCE9E7;
  --mark: #FFF1B8;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-dark); }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -0.01em; color: var(--navy); }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
pre { margin: 0; }
.wrap { width: min(1140px, 100% - 2rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }
.muted { color: var(--ink-muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 62ch; }
.req { color: var(--err); }
.hp { position: absolute; left: -9999px; }
[hidden] { display: none !important; }

/* Header ------------------------------------------------------------ */
.site-header { background: var(--white); position: relative; }
.site-header::after { content: ""; display: block; height: 6px; background: var(--stripe); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 84px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .85rem; text-decoration: none; color: var(--navy); padding: .75rem 0; }
.brand:hover { color: var(--navy); }
.brand img { width: 46px; height: 46px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: .85rem; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; line-height: 1.2; }
.brand-claim { font-size: .85rem; color: var(--ink-muted); }
.brand-accent { color: var(--brand); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink-soft); padding: .5rem .8rem; border-radius: 6px; font-weight: 600; }
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav a[aria-current="page"] { background: var(--brand); color: #fff; }
.nav .nav-admin { border: 1px dashed var(--line-strong); }
.nav-toggle { display: none; }

/* Footer ------------------------------------------------------------ */
.site-footer { margin-top: 4rem; background: var(--navy); border-top: 4px solid var(--brand); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0; font-size: .875rem; color: var(--navy-soft); flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner { align-items: center; }
.footer-inner a { color: var(--white); }
.footer-inner a:hover { color: var(--navy-soft); }
.footer-brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--navy-soft) !important; font-size: .8rem; flex: none; }
.footer-brand img { width: 96px; height: auto; display: block; }
.footer-text { flex: 1 1 320px; }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Impressum, Datenschutz */
.legal h2 { font-size: 1.1rem; margin-top: 1.75rem; }
.legal ul { padding-left: 1.2rem; }
.legal-logo { width: 225px; height: auto; display: block; margin-bottom: 1.25rem; padding: .5rem .75rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-sizing: content-box; }
.gate-legal { margin: 1rem 0 0 !important; }
.gate-legal a { color: var(--ink-muted); }

/* Main / sections --------------------------------------------------- */
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site > main { flex: 1 0 auto; }
main { padding-block: 2rem 1rem; }
.section { margin-top: 3rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.page-head { margin-bottom: 1.5rem; }
.page-narrow, .form-narrow { max-width: 760px; }

.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }
.hero h1 { font-size: 2.3rem; max-width: 20ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-panel { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 1.5rem; }
.hero-panel h2 { font-size: 1.1rem; }
.steps { margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; margin-bottom: .75rem; padding-left: 2.4rem; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: .05rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand); color: var(--white); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }

.callout { display: flex; align-items: center; justify-content: space-between; gap: 2rem; background: var(--navy); border-radius: var(--radius); padding: 1.5rem 1.75rem 1.5rem 2.25rem; flex-wrap: wrap; position: relative; overflow: hidden; }
.callout::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--stripe); }
.callout h2 { margin-bottom: .25rem; color: var(--white); }
.callout p { margin: 0; max-width: 70ch; color: var(--navy-soft); }

/* FMS-Status: Anzeige wie am Funkmeldesystem (Status 2 = einsatzbereit auf Wache) */
.fms { display: inline-flex; align-items: center; gap: .6rem; margin: 0 0 1rem; padding: .3rem .85rem .3rem .3rem; border-radius: 6px; background: var(--navy); color: var(--white); font-size: .85rem; font-weight: 600; letter-spacing: .02em; }
.fms-key { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 4px; background: var(--ok); font-family: var(--mono); font-weight: 700; font-size: 1rem; animation: fms-pulse 2.4s ease-in-out infinite; }
.fms-off .fms-key { background: var(--ink-muted); animation: none; }
@keyframes fms-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(46,125,50,.0); } 50% { box-shadow: 0 0 0 4px rgba(46,125,50,.45); } }
@media (prefers-reduced-motion: reduce) { .fms-key { animation: none; } }
.error-page { padding-block: 2rem; }

/* Grid & cards ------------------------------------------------------ */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: var(--brand); color: inherit; box-shadow: inset 4px 0 0 var(--brand); }
.card-link h3 { color: var(--navy); }
.card-link:hover h3 { color: var(--brand-dark); }
.card-link p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.prompt-card { display: flex; flex-direction: column; gap: .5rem; }
.prompt-card h3 { margin: 0; }
.prompt-card h3 a { text-decoration: none; color: var(--ink); }
.prompt-card h3 a:hover { color: var(--brand); }
.card-desc { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.card-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .5rem; }
.prompt-excerpt { font-family: var(--font); font-size: .875rem; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; background: var(--paper); border-radius: 6px; padding: .75rem; max-height: 7.5em; overflow: hidden; position: relative; }
.prompt-excerpt::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2em; background: linear-gradient(to bottom, transparent, var(--paper)); }

.cat-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.cat-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1.1rem; text-decoration: none; color: inherit; }
.cat-item:hover { border-color: var(--brand); color: inherit; box-shadow: inset 4px 0 0 var(--brand); }
.cat-name { font-weight: 650; color: var(--navy); grid-column: 1; }
.cat-item:hover .cat-name { color: var(--brand-dark); }
.cat-desc { font-size: .875rem; color: var(--ink-muted); grid-column: 1; }
.cat-count { grid-column: 2; grid-row: 1 / span 2; align-self: center; background: var(--paper); border: 1px solid var(--line); color: var(--navy); font-weight: 650; font-size: .85rem; padding: .2rem .6rem; border-radius: 999px; }

/* Chips, tags ------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.chip { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; font-size: .85rem; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); color: var(--navy); }
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-count { opacity: .7; font-size: .8em; }
.tag { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
mark.ph { background: var(--mark); color: var(--ink); border-radius: 3px; padding: 0 .15em; }

/* Buttons ----------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--white); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn-danger:hover { background: var(--err-soft); color: var(--err); }
.btn-sm { padding: .35rem .75rem; font-size: .875rem; }
.btn-lg { padding: .75rem 1.4rem; font-size: 1.05rem; }
.btn.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* Forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field .hint { margin: 0; font-size: .82rem; color: var(--ink-muted); }
.field .error { margin: 0; font-size: .85rem; color: var(--err); }
.field.has-error input, .field.has-error textarea { border-color: var(--err); }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], textarea, select {
  font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--line-strong); border-radius: 6px; padding: .55rem .7rem; width: 100%;
}
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
textarea { resize: vertical; min-height: 5.5em; }
select[multiple] { padding: .3rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500 !important; }
.checkbox input { width: auto; }
.check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .75rem; }
.check-list label { display: flex; gap: .45rem; align-items: flex-start; font-weight: 400; font-size: .9rem; }
.check-list input { margin-top: .25rem; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.filter-search { flex: 1 1 260px; }
.filter-select { flex: 0 1 240px; }
.result-count { color: var(--ink-muted); font-size: .9rem; margin: .25rem 0 1rem; }
.empty { text-align: center; padding: 3rem 1rem; background: var(--white); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* Flash ------------------------------------------------------------- */
.flash { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #BFE0C2; }
.flash-error { background: var(--err-soft); color: var(--err); border-color: #F0C4C0; }
.flash-info { background: var(--navy-tint); color: var(--navy); border-color: var(--navy-line); }

/* Prompt box -------------------------------------------------------- */
.prompt-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.prompt-box-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--paper); font-weight: 600; font-size: .9rem; }
.prompt-body { font-family: var(--font); font-size: .95rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; padding: 1rem 1.1rem; margin: 0; min-height: 8em; }
.prompt-box-foot { display: flex; flex-direction: column; gap: .5rem; padding: .75rem .9rem; border-top: 1px solid var(--line); background: var(--paper); }
.prompt-detail { max-width: 860px; }
.breadcrumb { font-size: .875rem; color: var(--ink-muted); margin-bottom: .5rem; }
.breadcrumb a { color: var(--ink-muted); }
.prompt-detail .card-meta { margin-bottom: 1rem; }
.detail-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }

/* Studio ------------------------------------------------------------ */
.studio-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-bottom: 1.25rem; }
.type-card { min-width: 0; text-align: left; font: inherit; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; color: var(--ink); }
.type-card:hover { border-color: var(--navy); }
.type-card[aria-selected="true"] { border-color: var(--navy); background: var(--navy-tint); box-shadow: inset 0 0 0 1px var(--navy), inset 0 4px 0 var(--brand); }
.type-name { font-weight: 650; overflow-wrap: anywhere; hyphens: auto; }
.type-desc { font-size: .78rem; color: var(--ink-muted); line-height: 1.35; }
.studio-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.25rem; align-items: start; }
.studio-form-head { margin-bottom: 1rem; }
.studio-form-head h2 { margin-bottom: .2rem; }
.studio-form-head p { margin: 0; font-size: .92rem; }
.sticky { position: sticky; top: 1rem; }
.studio-preview .prompt-body { max-height: 70vh; overflow: auto; }

/* Admin ------------------------------------------------------------- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-side { background: var(--stripe) top left / 100% 6px no-repeat, var(--white); border-right: 1px solid var(--line); padding: calc(1.25rem + 6px) 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.admin-side .brand { padding: 0; }
.admin-side .brand img { width: 36px; height: 36px; }
.admin-side .brand-name { font-size: 1.05rem; }
.admin-nav { display: flex; flex-direction: column; gap: .15rem; }
.admin-nav a { text-decoration: none; color: var(--ink-soft); padding: .5rem .7rem; border-radius: 6px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.admin-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.admin-nav a[aria-current="page"] { background: var(--brand); color: #fff; }
.admin-nav .badge { background: var(--warn-soft); color: var(--warn); font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; }
.admin-nav a[aria-current="page"] .badge { background: rgba(255,255,255,.25); color: #fff; }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; font-size: .875rem; }
.admin-main { padding: 1.5rem 2rem 3rem; min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 1.6rem; }
.admin-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; text-decoration: none; color: inherit; }
.stat:hover { border-color: var(--brand); }
.stat-num { font-size: 1.7rem; font-weight: 700; color: var(--brand); display: block; line-height: 1.1; }
.stat-label { font-size: .85rem; color: var(--ink-muted); }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); background: var(--paper); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
.status { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 4px; font-weight: 600; }
.status-published { background: var(--ok-soft); color: var(--ok); }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-archived { background: var(--paper); color: var(--ink-muted); border: 1px solid var(--line); }
.inline-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 140px; }
.inline-form .field.narrow { flex: 0 1 90px; }
.inline-form .field.wide { flex: 2 1 260px; }
.admin-two { display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem; align-items: start; }
.side-list { display: flex; flex-direction: column; gap: .15rem; }
.side-list a { text-decoration: none; color: var(--ink-soft); padding: .45rem .7rem; border-radius: 6px; display: flex; justify-content: space-between; gap: .5rem; }
.side-list a:hover { background: var(--brand-soft); }
.side-list a.is-active { background: var(--brand); color: #fff; }
.side-list .count { font-size: .8rem; opacity: .7; }
.admin-edit { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }
.code { font-family: var(--mono); font-size: .85rem; background: var(--paper); padding: .1rem .35rem; border-radius: 3px; }
.template-editor { font-family: var(--mono); font-size: .88rem; line-height: 1.5; min-height: 22em; }
.help-box { background: var(--navy-tint); border: 1px solid var(--navy-line); border-radius: var(--radius); padding: 1rem 1.1rem; font-size: .9rem; }
.help-box h3 { font-size: .95rem; margin-bottom: .4rem; }
.help-box ul { margin: 0; padding-left: 1.1rem; }
.help-box li { margin-bottom: .25rem; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(400px, 100%); text-align: center; }
.login-card { border-top: 4px solid var(--brand); }
.login-card img { width: 64px; height: 64px; margin-bottom: 1rem; }
.login-card .field { text-align: left; }
details.row-edit summary { cursor: pointer; color: var(--brand); font-size: .875rem; }
details.row-edit > div { margin-top: .75rem; padding: .75rem; background: var(--paper); border-radius: 6px; }
.field-list { display: flex; flex-direction: column; gap: .5rem; }
.field-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; }
.field-item summary { display: flex; gap: .75rem; align-items: center; cursor: pointer; list-style: none; flex-wrap: wrap; }
.field-item summary::-webkit-details-marker { display: none; }
.field-item summary .grow { flex: 1; }
.field-item[open] { border-color: var(--navy-line); }
.field-item > .field-body { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.danger-zone { border: 1px solid #F0C4C0; background: #FFF8F7; border-radius: var(--radius); padding: 1rem 1.1rem; }

/* Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-body { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .admin-main { padding: 1.25rem 1rem 3rem; }
  .admin-two, .admin-edit { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.8rem; }
  .grid-2, .grid-3, .cat-list, .form-grid, .check-list { grid-template-columns: 1fr; }
  .brand img { width: 40px; height: 40px; }
  .brand-claim { display: none; }
  .nav-toggle { display: inline-block; font: inherit; background: var(--white); border: 1px solid var(--line-strong); border-radius: 6px; padding: .4rem .8rem; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: .75rem; }
  .nav.is-open { display: flex; }
  .header-inner { min-height: 0; }
  .filter-select { flex-basis: 100%; }
}
@media print {
  .site-header, .site-footer, .btn, .filter-bar, .chips { display: none !important; }
  body { background: #fff; }
}

/* Backend: Sortieren, Bausteine, Vorschau ---------------------------- */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 26px; color: var(--ink-muted); cursor: grab; border-radius: 4px; vertical-align: middle; flex: none; }
.drag-handle:hover { background: var(--brand-soft); color: var(--brand-dark); }
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 12px; height: 16px; fill: currentColor; }
.sort-cell { white-space: nowrap; width: 1%; }
.sort-cell .sort-pos { display: inline-block; min-width: 1.4em; text-align: right; font-size: .8rem; color: var(--ink-muted); margin-right: .25rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 1px solid transparent; background: transparent; border-radius: 4px; color: var(--ink-muted); cursor: pointer; font: inherit; vertical-align: middle; }
.btn-icon:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-line); }
.btn-icon svg { width: 12px; height: 12px; fill: currentColor; }
.is-dragging { opacity: .4; }
[data-sortable] [data-sort-id] { transition: background .12s; }
[data-sortable] tr[data-sort-id]:hover { background: #F8F9FB; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 6px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--err); }
.chip-insert { display: inline-flex; align-items: stretch; margin: 0 .35rem .35rem 0; border: 1px solid var(--navy-line); border-radius: 5px; background: var(--white); font-family: var(--mono); font-size: .8rem; overflow: hidden; vertical-align: middle; }
.chip-insert button { font: inherit; background: transparent; border: 0; padding: .25rem .5rem; cursor: pointer; color: var(--navy); }
.chip-insert button:hover { background: var(--navy-tint); }
.chip-insert button[draggable] { cursor: grab; }
.chip-insert .chip-wrap { border-left: 1px solid var(--navy-line); padding: .25rem .4rem; color: var(--ink-muted); }
.chip-insert.is-unused { border-style: dashed; }
.chip-insert.is-unused button:first-child { color: var(--warn); }
.chip-legend { font-size: .8rem; color: var(--ink-muted); margin: .25rem 0 .5rem; }
.template-check { font-size: .85rem; margin-top: .5rem; line-height: 1.7; }
.check-ok { color: var(--ok); }
.check-warn { color: var(--warn); }
.check-bad { color: var(--err); font-weight: 600; }
.preview-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.preview-toggle button { font: inherit; font-size: .8rem; padding: .25rem .6rem; border: 0; background: var(--white); cursor: pointer; color: var(--ink-soft); }
.preview-toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.editor-tools { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; margin-bottom: .4rem; }
.editor-tools .label { font-size: .8rem; color: var(--ink-muted); margin-right: .25rem; }
.kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 3px; padding: 0 .3rem; background: var(--white); }
.side-item { display: flex; align-items: center; gap: .1rem; }
.side-item > a { flex: 1; }
.side-item .drag-handle { height: 22px; width: 18px; }
.field-item summary .sort-cell { display: inline-flex; align-items: center; width: auto; flex: none; margin-right: .25rem; }

/* Skills / Ausgabe-Ergänzungen ------------------------------------- */
.skill-box { border: 1px solid var(--navy-line); background: var(--navy-tint); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: .5rem 0 1rem; }
.skill-box legend { font-weight: 600; font-size: .92rem; padding: 0 .35rem; }
.skill-box .hint { margin: 0 0 .5rem; font-size: .82rem; color: var(--ink-muted); }
.skill-box .check-list { grid-template-columns: 1fr; }
.skill-item { align-items: flex-start; }
.skill-item > span { display: flex; flex-direction: column; }
.skill-name { font-weight: 500; }
.skill-desc { font-size: .8rem; color: var(--ink-muted); }

/* Skill-Dateien --------------------------------------------------- */
.skill-file-card { display: flex; flex-direction: column; gap: .5rem; }
.skill-file-card h3 { margin: 0; }
.skill-file-card h3 a { text-decoration: none; color: var(--ink); }
.skill-file-card h3 a:hover { color: var(--brand); }
.skill-file-meta { display: flex; flex-wrap: wrap; gap: .35rem .75rem; font-size: .82rem; color: var(--ink-muted); }
.skill-file-desc { margin: 0; color: var(--ink-soft); font-size: .95rem; white-space: pre-wrap; }
.howto { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.howto h2 { font-size: 1.1rem; }
.howto p { margin: 0; white-space: pre-wrap; color: var(--ink-soft); }
.download-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--navy-tint); border: 1px solid var(--navy-line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0 1.5rem; }
.download-box .file-name { font-family: var(--mono); font-size: .9rem; word-break: break-all; }
input[type="file"] { font: inherit; width: 100%; padding: .45rem 0; }
.version-list td.small { color: var(--ink-muted); }

/* Vorschlagen: Umschalter Prompt / Skill -------------------------- */
.seg-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; max-width: 760px; margin-bottom: 1rem; }
.seg-tabs a { display: flex; flex-direction: column; gap: .1rem; text-decoration: none; color: var(--ink); background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .75rem 1rem; }
.seg-tabs a:hover { border-color: var(--navy); color: var(--ink); }
.seg-tabs a[aria-current="page"] { border-color: var(--navy); background: var(--navy-tint); box-shadow: inset 0 0 0 1px var(--navy); }
.seg-tabs .seg-title { font-weight: 650; }
.seg-tabs .seg-title::before { content: "○ "; color: var(--ink-muted); }
.seg-tabs a[aria-current="page"] .seg-title::before { content: "● "; color: var(--navy); }
.seg-tabs .seg-desc { font-size: .82rem; color: var(--ink-muted); }

/* Vorläufige Zugangssperre ------------------------------------------ */
.gate-body { min-height: 100vh; margin: 0; background: var(--paper); overflow: hidden; }
/* Hintergrund: geschlossenes Hallentor der Wache mit Warnmarkierung an den Torpfosten */
.gate-bg { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(to bottom, var(--white) 0 calc(100% - 3vh), var(--line-strong) calc(100% - 3vh)); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.gate-sign { font-weight: 800; font-size: clamp(1.4rem, 4.5vw, 3.2rem); letter-spacing: .28em; text-transform: uppercase; color: var(--brand); margin-bottom: 2.5vh; padding-left: .28em; white-space: nowrap; }
.gate-door { display: flex; width: min(960px, 88vw); height: min(72vh, 640px); border-top: 16px solid var(--navy); margin-bottom: 3vh; }
.gate-post { flex: none; width: clamp(16px, 2.4vw, 28px); background: var(--stripe); }
.gate-shutter { flex: 1; position: relative; background: repeating-linear-gradient(to bottom, #E8EBEF 0 30px, #C9CFD8 30px 32px); }
.gate-shutter::before { content: ""; position: absolute; left: 6%; right: 6%; top: 18%; height: 7%; background: repeating-linear-gradient(to right, var(--navy-soft) 0 14%, transparent 14% 15.5%); opacity: .8; }
.gate-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.gate-card { width: min(380px, 100%); background: rgba(255,255,255,.96); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 12px; padding: 2rem 1.75rem 1.75rem; text-align: center; box-shadow: 0 20px 60px rgba(21,35,59,.3); }
.gate-card img { width: 64px; height: 64px; margin-bottom: .75rem; }
.gate-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.gate-card p { margin-bottom: 1rem; }
.gate-field { display: flex; gap: .5rem; }
.gate-field input { flex: 1; font-size: 1.05rem; text-align: center; letter-spacing: .1em; }
.gate-field .btn { padding-inline: 1rem; font-size: 1.2rem; }
.gate-card .error { margin: .75rem 0 0; font-size: .875rem; color: var(--err); }

/* Ampel und Prüfung vor Verwendung -------------------------------- */
:root {
  --green: #1E6B22;
  --green-soft: #E3F2E4;
  --amber: #7A4F00;
  --amber-soft: #FFF1D0;
  --lamp-red: #FF3B30;
  --lamp-yellow: #FFB800;
  --lamp-green: #34C246;
}
/* Ampel als Grafik: waagerecht klein (rot, gelb, grün), senkrecht groß */
.light { display: inline-flex; gap: 3px; padding: 3px 4px; background: var(--navy); border-radius: 999px; vertical-align: middle; flex: none; }
.light i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.16); }
.light-rot i:nth-child(1) { background: var(--lamp-red); box-shadow: 0 0 6px var(--lamp-red); }
.light-gelb i:nth-child(2) { background: var(--lamp-yellow); box-shadow: 0 0 6px var(--lamp-yellow); }
.light-gruen i:nth-child(3) { background: var(--lamp-green); box-shadow: 0 0 6px var(--lamp-green); }
.light-lg { flex-direction: column; gap: 7px; padding: 8px; border-radius: 16px; }
.light-lg i { width: 24px; height: 24px; }
.light-lg.light-rot i:nth-child(1), .light-lg.light-gelb i:nth-child(2), .light-lg.light-gruen i:nth-child(3) { box-shadow: 0 0 14px currentColor; }
.light-lg.light-rot { color: var(--lamp-red); }
.light-lg.light-gelb { color: var(--lamp-yellow); }
.light-lg.light-gruen { color: var(--lamp-green); }

.status-line { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.status-gruen { color: var(--green); }
.status-gelb { color: var(--amber); }
.status-rot { color: var(--brand-dark); }
a.status-line:hover { text-decoration: underline; }
.check-line { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.pips { display: inline-flex; gap: 2px; flex: none; }
.pips i { width: 6px; height: 12px; border-radius: 2px; background: var(--line-strong); }
.pips-1 i:nth-child(1), .pips-2 i:nth-child(-n+2), .pips-3 i { background: var(--navy); }
.code-mark { font-family: var(--mono); font-size: .74rem; color: var(--ink-muted); text-decoration: none; }
a.code-mark:hover { color: var(--brand-dark); text-decoration: underline; }
.prompt-card .card-meta { gap: .35rem 1rem; }

/* Gesperrte Einträge */
.prompt-card-rot { border-left: 4px solid var(--brand); }
.card-alt a { font-weight: 600; }

/* Detailseite: Ampel-Tafel */
.for-line { margin: -.5rem 0 1rem; font-size: .9rem; color: var(--ink-muted); }
.ampel-panel { display: flex; gap: 1.25rem; align-items: flex-start; padding: 1.1rem 1.25rem; margin: 0 0 1rem; background: var(--white); border: 1px solid var(--line); border-left: 6px solid var(--panel); border-radius: var(--radius); }
.ampel-panel-gruen { --panel: var(--lamp-green); }
.ampel-panel-gelb { --panel: var(--lamp-yellow); background: #FFFBF0; }
.ampel-panel-rot { --panel: var(--brand); background: #FFF8F8; }
.ampel-panel-body { min-width: 0; }
.ampel-panel-title { margin: 0 0 .15rem; font-size: 1.15rem; font-weight: 800; }
.ampel-panel-gruen .ampel-panel-title { color: var(--green); }
.ampel-panel-gelb .ampel-panel-title { color: var(--amber); }
.ampel-panel-rot .ampel-panel-title { color: var(--brand-dark); }
.ampel-panel-text { margin: 0 0 .75rem; color: var(--ink-soft); }
.ampel-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .92rem; }
.ampel-facts li { display: flex; gap: .6rem; align-items: baseline; }
.ampel-facts svg { width: 16px; height: 16px; flex: none; position: relative; top: 3px; color: var(--navy); }
.ampel-facts .pips { position: relative; top: 1px; margin: 0 2px; }
.ampel-facts li.is-not svg { color: var(--brand); }
.ampel-facts li.is-ok svg { color: var(--green); }
.prompt-detail .help-box { margin-bottom: 1rem; }
.notfor-box { border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 6px 6px 0; padding: .65rem .9rem; margin: 0 0 1rem; font-size: .92rem; }
.notfor-box strong { color: var(--brand-dark); }
.prompt-box-actions { display: inline-flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }

/* Die drei Ampelfarben als Karten */
.ampel-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.ampel-card { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; padding: 1rem 1.1rem; background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--panel); border-radius: var(--radius); text-decoration: none; color: var(--ink-soft); font-size: .92rem; }
a.ampel-card:hover { border-color: var(--panel); color: var(--ink); }
.ampel-card-gruen { --panel: var(--lamp-green); }
.ampel-card-gelb { --panel: var(--lamp-yellow); }
.ampel-card-rot { --panel: var(--brand); }
.ampel-card-title { font-size: 1.02rem; color: var(--navy); }

/* Seite „Die Ampel“ */
.rule-list { margin: 0; padding: 0; list-style: none; counter-reset: rule; display: grid; gap: .5rem; max-width: 760px; }
.rule-list li { position: relative; padding: .7rem 1rem .7rem 3rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); counter-increment: rule; }
.rule-list li::before { content: counter(rule); position: absolute; left: .9rem; top: .7rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand); color: var(--white); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.check-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.check-levels > div { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); font-size: .92rem; color: var(--ink-soft); }
.check-levels strong { color: var(--navy); font-size: 1rem; }
.check-levels .pips i { width: 8px; height: 16px; }
.red-list { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.red-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); font-size: .92rem; align-items: baseline; }
.red-row:last-child { border-bottom: 0; }
.red-title { display: flex; gap: .55rem; align-items: baseline; color: var(--ink); text-decoration: none; font-weight: 600; }
.red-title .light { position: relative; top: 2px; }
.red-title:hover { color: var(--brand-dark); }
.red-alt { color: var(--ink-soft); }
.red-alt::before { content: "Stattdessen: "; color: var(--green); font-weight: 700; }
.red-alt a { font-weight: 600; }
details.background { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 0; max-width: 900px; }
details.background summary { cursor: pointer; padding: .85rem 1.1rem; font-weight: 700; color: var(--navy); }
.background-body { padding: 0 1.1rem 1rem; font-size: .92rem; }
.background-body h3 { font-size: 1rem; margin-top: .75rem; }
.background-body ul { padding-left: 1.1rem; }
.background-body li { margin-bottom: .4rem; }

/* Generator: Kennung auf der Karte, Prüfung, Hinweis zur Fachprüfung */
.type-code { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .72rem; font-weight: 700; color: var(--ink-muted); }
.type-code .light i { width: 6px; height: 6px; }
.studio-form-head .card-meta { margin-bottom: .5rem; gap: .35rem 1rem; }
.studio-form-head .notfor-box { margin: .75rem 0 0; }
.field .warn { margin: .2rem 0 0; font-size: .85rem; color: var(--amber); }
.field .error a, .field .warn a { font-weight: 600; }
.field.has-warn input, .field.has-warn textarea, .field.has-warn select { border-color: var(--lamp-yellow); }
.field.has-error select { border-color: var(--err); }
.custom-value { margin-top: .35rem; }
.check-panel { padding: .75rem .9rem; border-bottom: 1px solid var(--line); background: var(--amber-soft); font-size: .88rem; }
.check-panel.is-blocked { background: var(--err-soft); }
.check-panel ul { margin: 0; padding-left: 1.1rem; }
.check-panel li { margin-bottom: .35rem; }
.check-panel li.is-block { color: var(--err); }
.check-panel li.is-warn { color: var(--amber); }
.check-panel a { color: inherit; font-weight: 700; }
.check-confirm { margin-top: .5rem; font-size: .85rem; color: var(--ink); align-items: flex-start !important; }
.check-confirm input { margin-top: .2rem; }
.prompt-body.is-blocked { opacity: .45; user-select: none; }
.fach-hint { margin: 0; font-size: .85rem; padding: .45rem .65rem; border-radius: 6px; background: var(--navy-tint); color: var(--navy); }
.btn[disabled] { cursor: not-allowed; }
.inline-pair { display: flex; gap: .4rem; }
td .card-meta { margin-bottom: .2rem; gap: .3rem .8rem; }

@media (max-width: 900px) {
  .ampel-strip, .check-levels { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .studio-types .type-desc { display: none; }
  .type-card { padding: .6rem .7rem; }
  .ampel-panel { gap: .9rem; padding: 1rem; }
  .light-lg i { width: 18px; height: 18px; }
  .red-row { grid-template-columns: 1fr; gap: .25rem; }
}
