/* Konfigurator, Farben aus Docs/prepaid-hoster-design.md */
:root {
  --paper: #ffffff; --mist: #f6f8fb; --panel: #eef2f7; --line: #e3e8ef; --line-strong: #c9d3e1;
  --ink: #0f1a2e; --muted: #556175; --brand: #022873; --brand-hover: #1a389c; --brand-tint: #eef4fd;
  --focus: #2f81f5; --ok: #047857; --ok-tint: #ecfdf5; --bad: #b42318; --bad-tint: #fef3f2;
  --warn: #8a5a00; --warn-tint: #fff8e6; --add: #e6f6ec; --del: #fdecec;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111827; --mist: #0b1220; --panel: #1a2333; --line: #263248; --line-strong: #34425e;
    --ink: #e7ecf4; --muted: #9aa6ba; --brand: #6d95ff; --brand-hover: #8eadff; --brand-tint: #17244a;
    --ok: #34d399; --ok-tint: #0f2a22; --bad: #f87171; --bad-tint: #3a1515; --warn: #fbbf24; --warn-tint: #2f2610;
    --add: #0f2e1d; --del: #3a1717;
  }
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--mist); }
code, pre, .mono, textarea { font-family: var(--mono); font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); margin: 8px 0; }

/* Knöpfe und Felder */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.icon { padding: 6px 9px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; font-size: 12px; text-decoration: underline; }
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input:disabled, textarea:disabled { background: var(--panel); color: var(--muted); }
label { font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin-right: 12px; white-space: nowrap; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-size: 11px; font-weight: 600; }
.badge.bad { background: var(--bad-tint); color: var(--bad); }
.note { padding: 10px 12px; border-radius: var(--radius); background: var(--brand-tint); border: 1px solid var(--line); margin: 10px 0; }
.note.warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.logo { width: 34px; height: 34px; border-radius: 7px; background: var(--brand); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 9px; border: 3px solid #fff; border-radius: 3px; }
.logo.small { width: 22px; height: 22px; border-radius: 5px; }
.logo.small::after { inset: 6px; border-width: 2px; }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 28px;
  display: grid; gap: 10px; box-shadow: 0 10px 30px rgba(15, 26, 46, .08); }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0; }

/* Rahmen */
.app { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: auto 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.release { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; }
.side { overflow: auto; padding: 12px; border-right: 1px solid var(--line); background: var(--paper); }
.side .search { margin-bottom: 8px; }
.file-group { margin: 10px 0 14px; }
.file-group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px 6px; }
.file { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.file:hover { background: var(--panel); }
.file.active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.file.readonly .name { color: var(--muted); }
.file .name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.drift { background: #d97706; }
.lock { font-size: 11px; opacity: .7; }
.side-foot { font-size: 12px; margin-top: 18px; }
.main { overflow: auto; padding: 20px 24px 96px; }
.empty { max-width: 760px; }
.empty h2 { margin-bottom: 10px; }
.bullets { padding-left: 18px; }

/* Datei */
.doc { max-width: 1100px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.doc-head h2 { font-size: 18px; font-family: var(--mono); word-break: break-all; }
.doc-actions { display: flex; gap: 6px; }
.ctx { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 12px; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .search { flex: 1 1 260px; width: auto; }

/* Formularzeilen */
.rows { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.row { padding: 6px 12px 6px calc(12px + var(--d) * 18px); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.changed { background: var(--warn-tint); box-shadow: inset 3px 0 0 #d97706; }
.comment { white-space: pre-wrap; font-size: 12px; color: var(--muted); margin: 2px 0 4px; padding-left: 8px; border-left: 2px solid var(--line-strong); }
.group { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 2px 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.group .key { font-weight: 700; font-family: var(--mono); }
.group .meta { color: var(--muted); font-size: 12px; }
.caret { width: 12px; color: var(--muted); }
.anchor { font-family: var(--mono); font-size: 11px; color: #7c3aed; }
.field { display: grid; grid-template-columns: minmax(140px, 240px) 1fr; gap: 12px; align-items: start; }
.field .key { font-family: var(--mono); font-weight: 600; padding-top: 7px; overflow-wrap: anywhere; }
.row.ro .field .key { color: var(--muted); }
.value { min-width: 0; }
.value .num { max-width: 180px; }
.text-wrap { display: flex; gap: 6px; }
.text-wrap select.type { width: 100px; flex: none; }
.hints { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin-top: 3px; }
.hints:empty { display: none; }
.also { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.also.over { color: var(--warn); font-weight: 600; }
.alias { padding-top: 6px; }
.alias code { color: #7c3aed; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding-top: 4px; font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }
.switch em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); min-height: 36px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 999px; background: var(--panel); font-family: var(--mono); font-size: 12px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--bad); }
.chip-input { border: 0 !important; flex: 1 1 140px; width: auto !important; padding: 4px !important; }
.chip-input:focus { outline: none; }

/* YAML-Editor */
.status { font-size: 12px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.editor { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); height: calc(100vh - 290px); min-height: 320px; overflow: hidden; }
.gutter { margin: 0; padding: 10px 8px; text-align: right; color: var(--muted); background: var(--panel); user-select: none; overflow: hidden; line-height: 1.5; min-width: 46px; }
.editor textarea { flex: 1; border: 0; border-radius: 0; padding: 10px 12px; line-height: 1.5; white-space: pre; overflow: auto; resize: none; height: 100%; tab-size: 2; }
.editor textarea:focus { outline: none; }

/* Tabellen */
.table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }

/* Speicherleiste, Dialoge, Toast */
.savebar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 26, 46, .18); z-index: 20; }
.modal { position: fixed; inset: 0; background: rgba(15, 26, 46, .45); display: grid; place-items: center; padding: 16px; z-index: 40; }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border-radius: 12px; padding: 20px; display: grid; gap: 10px; }
.dialog.wide { width: min(1000px, 100%); }
.dialog h2 { font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.cache-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 4px 0; }
.cache-box legend { font-weight: 600; padding: 0 4px; }
.diff { border: 1px solid var(--line); border-radius: var(--radius); max-height: 50vh; overflow: auto; font-family: var(--mono); font-size: 12px; background: var(--paper); }
.dl { display: grid; grid-template-columns: 40px 40px 16px 1fr; white-space: pre; }
.dl .ln { color: var(--muted); text-align: right; padding-right: 6px; user-select: none; }
.dl .sg { color: var(--muted); user-select: none; }
.dl.add { background: var(--add); }
.dl.del { background: var(--del); }
.dl.gap { display: block; text-align: center; color: var(--muted); background: var(--panel); }
.flush { border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.flush.ok { background: var(--ok-tint); }
.flush.bad { background: var(--bad-tint); }
.flush details { margin-top: 6px; }
.flush pre { white-space: pre-wrap; max-height: 220px; overflow: auto; background: var(--paper); padding: 8px; border-radius: 6px; margin: 6px 0 0; }
.spin::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--paper); z-index: 60; }
.toast.bad { background: var(--bad); color: #fff; }

/* Schmal */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .release { display: none; }
  .side { position: fixed; top: 53px; bottom: 0; left: 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
  .side.open { transform: none; }
  .main { padding: 16px 16px 96px; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .field .key { padding-top: 0; }
  .top-actions .btn { padding: 6px 8px; font-size: 12px; }
  .savebar { left: 16px; right: 16px; transform: none; flex-wrap: wrap; }
}
