[hidden] { display: none !important; }
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --ok: #17803d;
  --ok-bg: #e5f5ea;
  --warn: #b25e09;
  --warn-bg: #fdf1e2;
  --crit: #c22b2b;
  --crit-bg: #fde8e8;
  --code-bg: #0f131a;
  --code-text: #d7dde8;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1a1f27;
    --text: #e6e9ef;
    --muted: #8d97a8;
    --border: #2a313c;
    --accent: #5b8ff9;
    --ok: #4cc27a;
    --ok-bg: #173323;
    --warn: #f0a24b;
    --warn-bg: #3a2a14;
    --crit: #f06b6b;
    --crit-bg: #3b1a1a;
    --code-bg: #0b0e13;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
code, .mono, pre, textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.tiny { font-size: .75rem; }
.warn { color: var(--warn); }
.crit { color: var(--crit); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.25rem; padding-top: max(.7rem, env(safe-area-inset-top));
          background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: .5rem; }
.brand img { border-radius: 7px; }
.topnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topnav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); }
.topnav a.active, .topnav a:hover { background: var(--bg); color: var(--text); }
.logout { margin: 0; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.footer { text-align: center; color: var(--muted); font-size: .75rem; padding-bottom: 1.5rem; }
section { margin-bottom: 1.5rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.metrics { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: .9rem; }

.metric { margin: 0; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; }
.metric-head strong { font-size: 1.4rem; }
.bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: .4rem 0; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar span.warn { background: var(--warn); }
.bar span.crit { background: var(--crit); }
.spark { width: 100%; height: 48px; margin-top: .4rem; display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.group-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.group-head h3 { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }

.actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.nowrap-actions { flex-wrap: nowrap; justify-content: flex-end; }
.btn { display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .85rem; border-radius: 7px;
       border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
       font: inherit; font-size: .9rem; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.small { padding: .25rem .55rem; font-size: .82rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger-ghost { color: var(--crit); }
.btn.danger-ghost:hover { border-color: var(--crit); }

.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
        background: var(--bg); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; }
.pill.running, .pill.h-healthy, .pill.success { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.exited, .pill.dead, .pill.failed, .pill.h-unhealthy { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.pill.restarting, .pill.paused, .pill.deploying, .pill.h-starting, .pill.expired, .pill.abgebrochen { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--crit-bg); color: var(--crit); }
.flash.pre { white-space: pre-line; }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 7px;
                          background: var(--bg); color: var(--text); width: 100%; }
input[type=checkbox] { width: auto; }
select.small { width: auto; padding: .25rem .5rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-weight: 400; font-size: .78rem; color: var(--muted); }
.hint-box { background: var(--bg); border-radius: 8px; padding: .7rem .9rem; line-height: 1.8; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix span { padding: .5rem .65rem; border: 1px solid var(--border); border-left: 0; border-radius: 0 7px 7px 0;
                     color: var(--muted); background: var(--surface); white-space: nowrap; font-weight: 400; }
.slot-form h3 { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.slot-form h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.secret { cursor: pointer; text-decoration: underline dotted; word-break: break-all; }

.slot-card { display: flex; justify-content: space-between; gap: 1rem; color: var(--text); flex-wrap: wrap; }
.slot-card:hover { border-color: var(--accent); }
.empty { text-align: center; padding: 2rem; }
.danger-zone { border-color: var(--crit-bg); }
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; }
form.inline input { max-width: 320px; }

.logbox { background: var(--code-bg); color: var(--code-text); padding: .9rem; border-radius: 8px; font-size: .8rem;
          line-height: 1.45; max-height: 65vh; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: .5rem 0 0; }
pre.code { background: var(--code-bg); color: var(--code-text); padding: .7rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; }

.login-card { max-width: 380px; margin: 10vh auto 0; }
.login-card h1 { font-size: 1.4rem; margin: 0; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-bottom: 1.25rem; }
.login-brand img { border-radius: 14px; }

.spinner { display: inline-block; width: .8rem; height: .8rem; border: 2px solid var(--border); border-top-color: var(--accent);
           border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .topbar { gap: .5rem; padding: .55rem 16px; padding-top: max(.55rem, env(safe-area-inset-top)); justify-content: space-between; }
  .topnav { display: none; }
  .tabbar { display: flex; }
  body.has-tabbar .container { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  body.has-tabbar .footer { display: none; }
  /* iOS zoomt bei Schrift < 16px in Eingabefelder hinein */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 38px; }
  .btn.small { min-height: 36px; min-width: 36px; justify-content: center; }
  .section-head .actions { width: 100%; }
  .logbox { max-height: 60vh; font-size: .75rem; }
  /* Container-Tabelle als Karten */
  .group table thead { display: none; }
  .group table, .group tbody, .group tr, .group td { display: block; width: 100%; }
  .group tr { border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .group tr:last-child { border-bottom: none; }
  .group td { border: none; padding: .1rem 0; }
  .group td:nth-child(3), .group td:nth-child(4) { display: inline-block; width: auto; margin-right: 1rem; }
  .group td:nth-child(3)::before { content: "CPU "; color: var(--muted); font-size: .8rem; }
  .group td:nth-child(4)::before { content: "RAM "; color: var(--muted); font-size: .8rem; }
  .group td:nth-child(5) { display: none; }
  .nowrap-actions { justify-content: flex-start; margin-top: .3rem; }
}

/* --- App-Navigation unten (nur mobil) --- */
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
          background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
          -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border);
          padding: .35rem max(.5rem, env(safe-area-inset-left)) calc(.35rem + env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-right)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .3rem 0;
            color: var(--muted); font-size: .72rem; font-weight: 600; border-radius: 10px;
            -webkit-tap-highlight-color: transparent; }
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active svg { stroke-width: 2.2; }

/* Als installierte App: kein Überscroll-Wackeln, keine Textauswahl an Bedienelementen */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
  .btn, .tabbar a, .topnav a { -webkit-user-select: none; user-select: none; }
  .install-btn { display: none !important; }
}

@media (max-width: 640px) {
  .tabbar { display: flex; }
  /* Kennzahlen kompakt im 2er-Raster */
  .grid.metrics { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .metric { padding: .75rem .8rem; }
  .metric-head { font-size: .85rem; }
  .metric-head strong { font-size: 1.15rem; }
  .metric .small { font-size: .74rem; line-height: 1.35; }
  .spark { height: 30px; margin-top: .25rem; }
  .metric .tiny { display: none; }
  h2 { font-size: 1.2rem; }
}
.update { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.update .pill { margin-left: .35rem; }
