:root {
  --bg: #1C1B1B;
  --bg-deep: #161515;
  --surface: #282727;
  --line: #3A3838;
  --border: #4D4A4A;
  --text: #F2F2F2;
  --text-2: #D4D1D1;
  --muted: #A8A5A5;
  --accent: #FF8C2F;
  --accent-soft: #33241A;
  --ok: #6CC24A;
  --danger: #FF6A5C;
  --danger-line: #7A2E28;
  --warn: #F5C542;
  --series-2: #9CC4FF;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grundgerüst ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.shell { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.view.narrow { max-width: 560px; }

.topbar { display: flex; align-items: center; gap: 4px; padding: 16px 20px 12px 10px; width: 100%; max-width: 1200px; margin: 0 auto; }
.topbar .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.topbar h1 { font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.topbar.plain { padding-left: 20px; }
.iconbtn { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text); border-radius: 12px; text-decoration: none; }
.iconbtn.boxed { border: 1px solid var(--line); background: var(--surface); }

.tabs { position: sticky; bottom: 0; display: flex; border-top: 1px solid var(--line); background: var(--bg-deep); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent); }
.side-servers { display: none; }

@media (min-width: 900px) {
  .shell.with-nav { flex-direction: row; }
  .sidebar { order: -1; width: 248px; flex: none; position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: var(--bg-deep); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
  .side-servers { display: flex; flex-direction: column; gap: 8px; }
  .side-label { padding: 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .side-servers a { min-height: 48px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent; display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; }
  .side-servers a[aria-current="true"] { background: var(--surface); border-color: var(--line); color: var(--text); }
  .tabs { position: static; flex-direction: column; border: none; background: transparent; padding: 0; gap: 4px; }
  .tabs a { flex: none; min-height: 44px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 14px; color: var(--text-2); }
  .view { padding: 4px 32px 32px; }
  .topbar { padding: 24px 32px 16px 22px; }
  .topbar.plain { padding-left: 32px; }
  .topbar h1 { font-size: 26px; }
}
@media (max-width: 899px) {
  .sidebar { display: contents; }
}

/* ---------- Bausteine ---------- */
.card { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
a.card { color: var(--text); text-decoration: none; }
.card.flush { padding: 0; gap: 0; }
.row { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.row + .row, .card.flush > * + * { border-top: 1px solid var(--line); }
.row.link { min-height: 56px; color: var(--text); text-decoration: none; font-weight: 600; border: none; background: transparent; width: 100%; text-align: left; }
.card.flush > .row.link + .row.link { border-top: 1px solid var(--line); }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.label { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.section { margin: 8px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .danger { color: var(--danger); } .accent { color: var(--accent); }

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; }
.dot.on { background: var(--ok); border-color: var(--ok); }
.dot.bad { border-color: var(--danger); }
.dot.paused { border-color: var(--warn); background: var(--warn); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.status.on { color: var(--ok); } .status.bad { color: var(--danger); } .status.paused { color: var(--warn); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.btn.danger { border-color: var(--danger-line); color: var(--danger); }
.btn.text { border: none; padding: 0 8px; color: var(--accent); }
.btn.big { min-height: 52px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns.equal > * { flex: 1 1 auto; }
.btn { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input { height: 48px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
textarea.input { height: auto; padding: 12px 14px; min-height: 80px; font-family: var(--mono); font-size: 13px; }

.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; min-width: 6px; border-radius: 3px; background: var(--accent); }
.bar.high > i { background: var(--danger); }

.chart { display: block; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 12px; height: 3px; border-radius: 2px; background: var(--accent); }
.swatch.s2 { background: var(--series-2); }

.notice { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.notice.error { border-color: var(--danger-line); }
.notice.success { border-color: #3C5A2A; background: #1E2A18; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 14px; }
.badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--danger); color: var(--bg); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tag { font-size: 12px; font-weight: 600; color: var(--warn); }

.log { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2); overflow: auto; max-height: 62dvh; white-space: pre-wrap; overflow-wrap: anywhere; }
.log .w { color: var(--warn); } .log .e { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 40px); padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; z-index: 20; }
.toast.error { background: var(--danger); }

/* ---------- Serverauswahl ---------- */
.server-card { gap: 16px; padding: 18px; border-radius: 16px; }
.server-card h2 { font-size: 20px; font-weight: 600; }
.mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini > div { padding: 12px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.mini .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.add-tile { min-height: 64px; border-radius: 16px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.servers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* ---------- Dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; grid-auto-flow: dense; }
.dash > .full { grid-column: span 2; }
@media (min-width: 900px) {
  .dash { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick button { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: transparent; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; }
.quick button span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.temps { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.temps > div { padding: 8px 4px; border-radius: 8px; background: var(--bg); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.temps .label { font-size: 11px; font-weight: 400; }
.edit-tools { display: flex; gap: 6px; }
.edit-tools button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: transparent; }
.card.hidden-card { opacity: .55; }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.cols > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
