:root {
  --bg: #f6f5f2; --surface: #fff; --text: #1d1c1a; --muted: #6b6862; --line: #e4e1db;
  --primary: #2f5d50; --primary-text: #fff; --accent: #c96f3b;
  --danger: #b3261e; --ok-bg: #e6f2ec; --ok: #1f6b45; --err-bg: #fbe9e7; --warn-bg: #fff4dc; --warn: #8a5a00;
  --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --surface: #1f1f1d; --text: #ecebe7; --muted: #9c998f; --line: #34332f;
    --primary: #6fb39d; --primary-text: #0e1a16; --accent: #e08c5a;
    --danger: #f2756b; --ok-bg: #173226; --ok: #8fd4ae; --err-bg: #3a1c1a; --warn-bg: #3a2e12; --warn: #f0c870;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--primary); }
code { font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

.topbar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: .75rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: .35rem .7rem; border-radius: 6px; }
.topbar nav a:hover { color: var(--text); background: var(--bg); }
.topbar nav a.active { color: var(--text); background: var(--bg); font-weight: 600; }
.logout { display: flex; align-items: center; gap: .6rem; margin: 0; }
.who { color: var(--muted); font-size: .9rem; }

.container { max-width: 980px; margin: 0 auto; padding: 1.75rem 1rem 3rem; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.full { padding: 0; height: calc(100vh - 58px); display: flex; flex-direction: column; }
.full .flash { margin: .75rem 1rem 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card.login { width: 100%; max-width: 360px; }
.card.login h1 { margin-bottom: .25rem; }
.card.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.danger-zone h2 { color: var(--danger); }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; margin-bottom: .85rem; }
label.check { flex-direction: row; align-items: center; margin: 0; font-weight: 400; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; padding: .55rem .7rem; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.stack { max-width: 460px; }
.row { display: flex; gap: .6rem; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.wrap input:not([type]) { width: auto; flex: 1 1 200px; }
.row span { flex: 1; }

.btn { display: inline-block; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 7px;
  padding: .55rem 1rem; cursor: pointer; text-decoration: none; text-align: center; white-space: nowrap; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; font-weight: 500; }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--danger); color: #fff; }
.btn:hover { filter: brightness(1.06); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--danger); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.secret { background: var(--warn-bg); color: var(--warn); font-family: ui-monospace, monospace; word-break: break-all; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; text-decoration: none; color: var(--text); transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.tile p { color: var(--muted); margin: 0; font-size: .9rem; }
.tile-icon { font-size: 1.6rem; color: var(--primary); display: block; margin-bottom: .5rem; }
.tile.accent .tile-icon { color: var(--accent); }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head-row h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.project { display: flex; flex-direction: column; margin: 0; }
.project p { margin: 0 0 .75rem; color: var(--muted); }
.project-top { display: flex; justify-content: space-between; gap: .5rem; align-items: start; }
.project-top h2 { margin-bottom: .5rem; }
.project-actions { margin-top: auto; display: flex; gap: .5rem; }

.badge { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.s-live { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.s-prototyp, .s-in-arbeit { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); border-color: transparent; }
.s-idee { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.s-pausiert { background: var(--err-bg); color: var(--danger); border-color: transparent; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.inactive td { opacity: .55; }
.menu { position: relative; }
.menu summary { list-style: none; } .menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem; display: flex; flex-direction: column; gap: .35rem;
  min-width: 230px; box-shadow: 0 8px 24px rgb(0 0 0 / .12); }
.menu-body form { margin: 0; } .menu-body .btn { width: 100%; text-align: left; }
.menu-body form.del { display: flex; gap: .35rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.menu-body form.del input { padding: .3rem .5rem; font-size: .85rem; }
.menu-body form.del .btn { width: auto; }

.terminal-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .5rem 1rem; color: var(--muted); font-size: .9rem; }
.terminal { flex: 1; width: 100%; border: 0; border-top: 1px solid var(--line); background: #000; }

/* Reiter (Kontoverwaltung) */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: inherit; opacity: .7; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { opacity: 1; font-weight: 600; border-bottom-color: currentColor; }
.count { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; font-size: .75rem; font-weight: 700;
  text-align: center; background: var(--danger); color: #fff; }
