/* ============================================================
   BALY Online Status System — Design-System
   Modern & zeitlos: ruhige Flächen, klare Typografie,
   zurückhaltende Farben, keine Effekte um der Effekte willen.
   ============================================================ */

:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --line: #e1e7ef;
  --line-strong: #cfd8e3;
  --ink: #1f2d40;
  --ink-soft: #43566e;
  --muted: #6b7c92;

  --brand: #1e4a86;
  --brand-deep: #163a6b;
  --brand-soft: #eaf0f8;

  --green: #1d9155;
  --green-ink: #146b3e;
  --green-bg: #e7f4ec;
  --green-line: #c4e3d0;

  --yellow: #b07a10;
  --yellow-bg: #faf1de;
  --yellow-line: #ecdcae;

  --red: #c0392b;
  --red-ink: #a02d21;
  --red-bg: #fbe9e7;
  --red-line: #f0cac5;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 43, 77, .05), 0 6px 20px -8px rgba(23, 43, 77, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -100px, #f7f9fc 0%, rgba(247, 249, 252, 0) 70%),
    var(--bg);
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; color: var(--ink); }
p { margin: 0; }
a { color: var(--brand); }

.page { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------ Karten ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* =========================== STATUSSEITE =========================== */

.status-page .page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: 40px;
  padding-bottom: 48px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 28px 32px;
}
.hero .logo { width: min(320px, 70vw); height: auto; display: block; }
.hero-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; }
.eyebrow {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.stand { color: var(--muted); font-size: 14px; }

/* Gesamtnachricht */
.overall {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 28px;
  border-radius: var(--radius);
  border: 1px solid;
  background: var(--green-bg);
  border-color: var(--green-line);
}
.overall.yellow { background: var(--yellow-bg); border-color: var(--yellow-line); }
.overall.red    { background: var(--red-bg);    border-color: var(--red-line); }
.overall h1 { font-size: 22px; }
.overall p { color: var(--ink-soft); margin-top: 2px; }
.overall.green { color: var(--green-ink); }
.overall.green h1 { color: var(--green-ink); }
.overall.yellow h1 { color: var(--yellow); }
.overall.red h1 { color: var(--red-ink); }

/* Status-Punkt & Pulse */
.dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
  display: inline-block;
}
.dot.green  { background: var(--green);  box-shadow: 0 0 0 4px var(--green-bg); }
.dot.yellow { background: #d9a515; box-shadow: 0 0 0 4px var(--yellow-bg); }
.dot.red    { background: var(--red);    box-shadow: 0 0 0 4px var(--red-bg); }

.pulse { width: 15px; height: 15px; border-radius: 50%; flex: none; }
.pulse.green  { background: var(--green); }
.pulse.yellow { background: #d9a515; animation: pulse 2.4s ease-out infinite; }
.pulse.red    { background: var(--red);   animation: pulseRed 2.4s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(217, 165, 21, .45); }
  70%  { box-shadow: 0 0 0 13px rgba(217, 165, 21, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 165, 21, 0); }
}
@keyframes pulseRed {
  0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, .40); }
  70%  { box-shadow: 0 0 0 13px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

/* Systemkarten */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.service { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.service-head { display: flex; align-items: center; gap: 12px; }
.service-head h2 { font-size: 17px; }
.service .desc { color: var(--ink-soft); font-size: 14.5px; }
.service-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.updated { color: var(--muted); font-size: 13px; }
.empty { padding: 24px; color: var(--muted); text-align: center; }

/* Status-Pill */
.pill {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.pill.green  { color: var(--green-ink); background: var(--green-bg);  border-color: var(--green-line); }
.pill.yellow { color: var(--yellow);    background: var(--yellow-bg); border-color: var(--yellow-line); }
.pill.red    { color: var(--red-ink);   background: var(--red-bg);    border-color: var(--red-line); }
.pill.off    { color: var(--muted);     background: #f0f2f5;          border-color: var(--line); }

.foot { color: var(--muted); font-size: 13.5px; text-align: center; padding: 8px 0 4px; }

/* =========================== ADMIN =========================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 68px;
}
.topbar .brand img { height: 40px; width: auto; display: block; }
.mainnav { display: flex; gap: 4px; margin-right: auto; }
.mainnav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 550;
  font-size: 14.5px;
  padding: 8px 14px;
  border-radius: 8px;
}
.mainnav a:hover { background: var(--brand-soft); color: var(--brand); }
.mainnav a.on { background: var(--brand-soft); color: var(--brand); }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .who { display: flex; flex-direction: column; line-height: 1.25; font-size: 14px; font-weight: 550; }
.userbox .who small { color: var(--muted); font-weight: 400; font-size: 12px; }

main.page { padding-top: 28px; padding-bottom: 48px; }

/* Flash-Meldungen */
.flash {
  margin: 18px 0 0;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14.5px;
}
.flash.ok  { background: var(--green-bg);  border-color: var(--green-line);  color: var(--green-ink); }
.flash.err { background: var(--red-bg);    border-color: var(--red-line);    color: var(--red-ink); }

/* Kartenkopf + Tabellen */
main.page > .card { margin-bottom: 24px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  flex-wrap: wrap;
}
.card-head h1 { font-size: 20px; }
.hint { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 62ch; }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
.rowname { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.rowsub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: center; width: 110px; }
.actions-col { width: 210px; }
td.actions { white-space: nowrap; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.you {
  font-size: 11.5px; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: 2px 9px; margin-left: 6px;
}
.action-tag {
  font-size: 12.5px; font-weight: 600; color: var(--brand-deep);
  background: var(--brand-soft); border-radius: 999px; padding: 3px 11px; white-space: nowrap;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
  transition: background .15s, border-color .15s;
}
.btn.small { font-size: 13px; padding: 5px 11px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: #fff; border-color: var(--red-line); color: var(--red-ink); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn.block { display: block; width: 100%; }

/* Formulare */
.form-card { max-width: 640px; }
form { padding: 4px 24px 26px; }
/* Inline-Formulare (Topbar-Logout, Status, Löschen) erhalten kein Formular-Padding */
.topbar form, form.inline { padding: 0; }

/* Statuszelle: Auswahl + Reihenfolge untereinander */
.status-col { width: 250px; }
.statusstack { display: flex; flex-direction: column; }
.statusstack .inline { justify-content: center; }
.statusstack select { width: auto; min-width: 195px; margin-top: 0; }
.order-sub { margin-top: 7px; font-size: 12.5px; color: var(--muted); text-align: center; }
label { display: block; font-weight: 550; font-size: 14px; color: var(--ink-soft); margin-top: 14px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}
select { width: auto; }
td select { margin: 0; font-size: 13.5px; padding: 6px 8px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 74, 134, .15);
}
textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row label { flex: 1; }
.form-actions { margin-top: 22px; display: flex; gap: 12px; }
.check { display: flex; align-items: center; gap: 9px; margin-top: 18px; }
.check input { width: auto; margin: 0; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 430px; padding: 34px 34px 30px; }
.login-card .logo { width: 230px; height: auto; margin-bottom: 18px; }
.login-card h1 { font-size: 21px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 8px; }
.login-card form { padding: 10px 0 0; }
.login-card .btn { margin-top: 22px; }
.login-card .flash { margin: 10px 0 0; }

/* ============================================================
   Responsiv — Smartphone (Tabellen werden zu Karten gestapelt)
   ============================================================ */
@media (max-width: 760px) {
  .page { padding: 0 14px; }

  /* Statusseite */
  .status-page .page { gap: 16px; padding-top: 20px; padding-bottom: 32px; }
  .hero { padding: 20px; gap: 16px; }
  .hero .logo { width: min(280px, 78vw); }
  .hero-meta { text-align: left; }
  .overall { padding: 16px 18px; gap: 14px; }
  .overall h1 { font-size: 19px; }
  .overall p { font-size: 14.5px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .service { padding: 16px; }

  /* Kopfzeile */
  .topbar-inner {
    height: auto;
    flex-wrap: wrap;
    row-gap: 6px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .topbar .brand img { height: 32px; }
  .mainnav { margin-right: auto; width: 100%; order: 3; }
  .mainnav a { padding: 8px 12px; }
  .userbox { margin-left: auto; gap: 8px; }
  .userbox .who { display: none; }

  /* Tabellen → Kartenstapel */
  .dtable thead { display: none; }
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; width: auto; }
  .dtable tr { border-bottom: 1px solid var(--line); padding: 10px 0 12px; }
  .dtable tr:last-child { border-bottom: none; }
  .dtable tbody td {
    border: none;
    padding: 5px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  .dtable td[data-label]::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    flex: none;
  }
  .dtable td.namecell { flex-direction: column; align-items: flex-start; gap: 2px; }
  .dtable td.num { text-align: left; }
  .dtable td.actions { justify-content: flex-end; flex-wrap: wrap; }
  .dtable .statusstack { flex: 1; min-width: 0; }
  .dtable .statusstack .inline { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .dtable .statusstack select { min-width: 0; flex: 1; }
  .dtable .order-sub { text-align: left; margin-top: 6px; }
  .dtable select { font-size: 14px; padding: 8px; }
  .dtable .btn.small { padding: 7px 12px; }
  .dtable td.muted, .dtable td.mono { white-space: normal; word-break: break-word; }

  /* Karten & Formulare */
  .card-head { flex-direction: column; gap: 12px; padding: 18px 16px 12px; }
  form { padding: 2px 16px 20px; }
  .form-row { flex-direction: column; gap: 0; }
  .btn { min-height: 38px; }

  /* Login */
  .login-wrap { padding: 16px; }
  .login-card { padding: 26px 22px 24px; }
  .login-card .logo { width: 200px; }

  .hint { font-size: 13px; }
  td.actions { white-space: normal; }
}
