/* A17/A41 (Feinschliff 23.11.2026): datensparsam - dunkles Theme via tokens.css, keine externen Ressourcen. */
@import url("tokens.css");

/* Basis */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-ui); line-height: 1.6; color: var(--ink);
  background:
    radial-gradient(60rem 40rem at 85% -10%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 60%),
    radial-gradient(50rem 35rem at 0% 110%, color-mix(in srgb, #5b8def 8%, transparent), transparent 65%),
    var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; margin: var(--space-4) 0 var(--space-2); }
h2 { font-size: 1.15rem; margin: var(--space-4) 0 var(--space-2); }
main { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: var(--space-3) var(--space-4) var(--space-5); }
code, pre { font-family: var(--font-mono); }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: .3rem; font-size: .9em; }
pre { background: var(--surface-2); padding: .8rem 1rem; border-radius: var(--radius); overflow-x: auto; border: 1px solid var(--line); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint { color: var(--muted); font-size: .85em; }

/* Topbar mit Signet-Logo (Hexagon + Doppelhaken, wie favicon.svg) */
.topnav {
  position: sticky; top: 0; z-index: 30; display: flex; gap: 1rem; align-items: center;
  padding: .65rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topnav .brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-weight: 700; font-family: var(--font-mono); }
.topnav .brand:hover { text-decoration: none; }
.signet { width: 26px; height: 26px; flex: none; }
.signet .hex { fill: var(--surface-2); stroke: var(--primary); stroke-width: 1.8; stroke-linejoin: round; }
.signet .check { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.signet .check2 { fill: none; stroke: var(--verify); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { letter-spacing: -.02em; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.topnav nav { display: flex; gap: .35rem; flex-wrap: wrap; margin-inline-start: auto; }
.navlink { color: var(--muted); padding: .35rem .7rem; border-radius: 999px; font-size: .9rem; transition: color var(--transition), background var(--transition); }
.navlink:hover { color: var(--ink); background: var(--surface-2); }
.kbd-hint { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .78rem; margin-inline-start: .5rem; }
kbd { font-family: var(--font-mono); font-size: .72rem; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: .35rem; padding: .05rem .4rem; color: var(--ink); }

/* App-Footer (Rechtliches) */
.app-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; padding: 1rem 1.25rem 2rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.app-footer nav { display: flex; gap: .9rem; flex-wrap: wrap; }
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--ink); }

/* Formulare & Buttons */
.login, .landing { max-width: 28rem; margin: 3rem auto; padding: 0 1rem; width: 100%; }
label { display: block; margin: .6rem 0; color: var(--ink); font-size: .93rem; }
input, textarea, select { width: 100%; padding: .55rem .7rem; font: inherit; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; transition: border-color var(--transition), box-shadow var(--transition); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); outline: none; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
button { padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #fff 8%), var(--primary)); color: var(--primary-ink); border: none; border-radius: 8px; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), filter var(--transition); }
button:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active { transform: translateY(0); filter: brightness(.95); }
button.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { border-color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); margin: .6rem 0; padding: .8rem 1rem; }
fieldset legend { color: var(--muted); font-size: .85em; padding: 0 .4rem; }

/* Panels & Rueckmeldungen */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; }
.error { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); border: 1px solid var(--danger); color: var(--ink); padding: .6rem .9rem; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.notice { background: color-mix(in srgb, var(--verify) 14%, var(--surface)); border: 1px solid var(--verify); padding: .6rem .9rem; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.field-error { color: var(--danger); font-size: .85em; display: block; }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); padding: 1.4rem; margin: 1rem 0; color: var(--muted); text-align: center; }
.empty-state h2 { color: var(--ink); margin: 0 0 .3rem; }
table { width: 100%; border-collapse: collapse; margin: .6rem 0 1rem; font-size: .92rem; }
table :where(th, td) { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
table thead th { color: var(--muted); font-size: .72em; text-transform: uppercase; letter-spacing: .06em; }
table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
table caption { caption-side: top; text-align: left; color: var(--muted); font-size: .82rem; padding-bottom: .4rem; }

/* Projekt-Raster (Dashboard) */
.project-grid { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.project-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .9rem 1rem; box-shadow: var(--shadow-sm); transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); }
.project-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow-md); }
.project-tile a { color: var(--ink); font-weight: 600; font-size: 1.02rem; }

/* Zustandschips: Farbe + Icon + Kurzlabel, Farbe nicht alleiniges Signal */
.chip { display: inline-block; border-radius: 999px; padding: .12rem .6rem; font-size: .74em; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); letter-spacing: .02em; }
.chip::before { margin-right: .35em; }
.chip-QUEUED::before { content: "\u23F3"; }
.chip-RUNNING::before { content: "\u25B6"; }
.chip-VERIFYING::before { content: "\u{1F50D}"; color: var(--verify); }
.chip-WAIT_MERGE, .chip-WAIT_DEPLOY, .chip-MERGING, .chip-DEPLOYING { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); }
.chip-WAIT_MERGE::before, .chip-WAIT_DEPLOY::before, .chip-MERGING::before, .chip-DEPLOYING::before { content: "\u23F8"; }
.chip-BLOCKED, .chip-PAUSED { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
.chip-BLOCKED::before, .chip-PAUSED::before { content: "\u26D4"; }
.chip-CANCELLED { background: color-mix(in srgb, var(--cancel) 25%, var(--surface)); color: var(--muted); }
.chip-CANCELLED::before { content: "\u2B58"; }
.chip-DONE { background: color-mix(in srgb, var(--verify) 22%, var(--surface)); }
.chip-DONE::before { content: "\u2714\u2713"; color: var(--verify); }
.chip-DRAFT::before { content: "\u{1F4DD}"; }
.chip-WAITING::before { content: "\u23F3"; }

/* Board */
.board { display: flex; gap: .75rem; overflow-x: auto; align-items: flex-start; padding-bottom: .5rem; margin: 1rem 0; }
.board .col { min-width: 13.5rem; flex: 1; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .7rem; box-shadow: var(--shadow-sm); }
.board .col h2 { font-size: .74rem; margin: .1rem 0 .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: .45rem; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; margin-bottom: .5rem; transition: border-color var(--transition), transform var(--transition); box-shadow: var(--shadow-sm); }
.card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); transform: translateY(-1px); }
.card .rev { color: var(--muted); font-size: .78em; }
.card .role { font-size: .72em; background: var(--surface); border-radius: .3rem; padding: .05rem .35rem; color: var(--muted); }
.card .reason { display: block; font-size: .75em; color: var(--danger); margin-top: .15rem; }

/* Planungschat als abgesetzter Verlauf */
.chat-window { background: color-mix(in srgb, var(--surface) 65%, transparent); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3); margin: 1rem 0; box-shadow: var(--shadow-md); max-height: 60vh; overflow-y: auto; }
.msg { border-left: 3px solid var(--line); padding: .25rem .7rem; margin: .45rem 0; border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.msg:nth-child(even) { border-left-color: color-mix(in srgb, var(--primary) 55%, var(--line)); }
.msg strong { color: var(--primary); font-size: .8rem; font-family: var(--font-mono); display: block; margin-bottom: .1rem; }
.proposal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .7rem .9rem; margin: .55rem .35rem; box-shadow: var(--shadow-sm); transition: border-color var(--transition); }
.proposal-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.proposal-card strong { font-family: var(--font-mono); color: var(--primary); }
.proposal-card form { display: inline; }
.proposal-card form button { padding: .35rem .8rem; font-size: .85rem; margin-right: .4rem; }
.planning-footer { margin-top: 1.5rem; color: var(--muted); font-size: .85em; border-top: 1px solid var(--line); padding-top: .7rem; }

/* Command Palette (vanilla JS overlay) */
.palette-overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); display: flex; justify-content: center; padding-top: 12vh; z-index: 60; }
.palette { background: var(--surface); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(34rem, 92vw); height: fit-content; overflow: hidden; }
.palette input { border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.palette ul { list-style: none; margin: 0; padding: .35rem; }
.palette li { padding: .5rem .7rem; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; }
.palette li[aria-selected="true"] { background: var(--surface-2); }
.palette .verb { font-family: var(--font-mono); color: var(--primary); }

/* Cookie-Hinweis (nur Information, kein Consent noetig) */
.cookie-note { position: fixed; inset-inline: 0; bottom: 0; z-index: 70; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: space-between; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: .8rem 1.25rem; }
.cookie-note p { margin: 0; font-size: .85rem; color: var(--muted); }
.cookie-note a { color: var(--ink); text-decoration: underline; }

@media (max-width: 768px) {
  .topnav { gap: .6rem; padding: .55rem .8rem; }
  .navlink { padding: .3rem .5rem; }
  main { padding: .8rem .8rem 2rem; }
  h1 { font-size: 1.35rem; }
}

/* Schwebendes Chatfenster (A43); [hidden]-Fix, da display:flex das hidden-Attribut ueberschreibt */
[hidden] { display: none !important; }
.chat-fab { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 65; border-radius: 999px; padding: .7rem 1.2rem; box-shadow: var(--shadow-lg); }
.chat-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(26rem, 92vw); z-index: 66; background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(14px); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; padding: 1rem; }
.chat-drawer header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.chat-drawer #chat-drawer-body { flex: 1; overflow-y: auto; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}