* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #263449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; margin-top: 3rem; }
.right { margin-left: auto; }
.error { color: var(--danger); margin-top: 0.5rem; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 1.3rem; }
header div { display: flex; gap: 0.5rem; }

main { padding: 2rem; max-width: 1200px; margin: 0 auto; }

/* Login */
.login-box {
  max-width: 380px;
  margin: 12vh auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}
.login-box h1 { margin-bottom: 0.5rem; }
.login-box form { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }

/* Formulare */
input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea { font-family: ui-monospace, monospace; resize: vertical; }
label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.9rem; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
input[type="file"] { margin: 0.8rem 0; display: block; color: var(--muted); }

/* Buttons */
.btn {
  padding: 0.55rem 1rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { filter: brightness(1.2); }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.success { background: #14532d; border-color: var(--success); }
.btn.warn { background: #57340b; border-color: var(--warn); }
.btn.danger { background: #5c1a1a; border-color: var(--danger); }
.btn.full { width: 100%; }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Karten */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.card:hover { border-color: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.card a { color: var(--primary); text-decoration: none; }
.card-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

/* Badges */
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--muted);
}
.badge.ok { background: #14532d; color: #86efac; }
.badge.warn { background: #57340b; color: #fcd34d; }
.badge.err { background: #5c1a1a; color: #fca5a5; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  z-index: 10;
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem 2rem;
  width: 100%;
  max-width: 480px;
}
.modal-content.wide { max-width: 760px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

.detail-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

.actions-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }

/* Logs */
.log {
  background: #020617;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 0.5rem;
}

/* Deployment: Fortschritt + Terminal */
.progress-outer {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  height: 26px;
  margin: 0.7rem 0 0.35rem;
}
.progress-bar {
  background: var(--primary);
  height: 100%;
  width: 0%;
  min-width: 90px;
  color: #fff;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: width 0.2s;
}
.progress-bar.done { background: var(--success); }
.progress-bar.failed { background: var(--danger); }
.progress-bar.indeterminate {
  width: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--primary) 0 14px,
    #2563eb 14px 28px
  );
  background-size: 200% 100%;
  animation: bar-move 1s linear infinite;
}
@keyframes bar-move {
  from { background-position: 0 0; }
  to { background-position: 40px 0; }
}
.log.terminal {
  background: #000;
  color: #86efac;
}

/* Compose-Stack: Service-Zeilen in der Karte */
.btn.toggle { margin-top: 0.5rem; }
.svc-list {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.svc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.svc-row:last-child { border-bottom: none; }
.svc-meta {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.svc-actions { display: flex; gap: 0.3rem; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.dot.ok { background: var(--success); }
.dot.err { background: var(--danger); }

select {
  padding: 0.45rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.toast.error-bg { background: var(--danger); }
