:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #101828;
  --muted: #475467;
  --line: #e4e7ec;
  --danger: #d92d20;
  --ok: #12b76a;
  --warn: #f79009;
  --primary: #2e6bff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(6px);
}
.topbar__inner { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.brand__title { font-weight: 700; font-size: 16px; }
.brand__subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.nav__user { color: var(--muted); font-size: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(16,24,40,.08);
}

h1 { margin: 0 0 14px 0; font-size: 18px; }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search input { min-width: 260px; }

.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus {
  border-color: rgba(46,107,255,.55);
  box-shadow: 0 0 0 4px rgba(46,107,255,.12);
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .search input { min-width: 180px; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  transition: filter .12s ease, transform .06s ease;
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: translateY(1px); }

.btn--primary { border-color: rgba(46,107,255,.35); background: rgba(46,107,255,.10); }
.btn--danger  { border-color: rgba(217,45,32,.35); background: rgba(217,45,32,.10); }
.btn--ghost   { background: transparent; }

/* KEIN Scrollbalken */
.tableWrap { overflow-x: hidden; margin-top: 14px; }

/* Tabelle so layouten, dass sie in die Card passt */
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

.table th, .table td {
  border-top: 1px solid var(--line);
  padding: 10px 10px;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

/* Zahlen-Spalten kompakter */
.table .num { text-align: right; width: 72px; }

/* Aktionen etwas kompakter */
.table .actions { width: 170px; }
.inline { display: inline; }

/* Pflegestelle & Ort bekommen definierte Breiten */
.table th:nth-child(1), .table td:nth-child(1) { width: 220px; }
.table th:nth-child(2), .table td:nth-child(2) { width: 120px; }

/* "Stand" kompakt (bei dir Spalte 9) */
.table th:nth-child(9), .table td:nth-child(9) { width: 120px; }

.titleCell__name { font-weight: 700; }
.titleCell__note { margin-top: 6px; color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}
.badge--ok   { border-color: rgba(18,183,106,.45); background: rgba(18,183,106,.10); }
.badge--low  { border-color: rgba(247,144,9,.45);  background: rgba(247,144,9,.10); }
.badge--full { border-color: rgba(217,45,32,.45);  background: rgba(217,45,32,.10); }

.alert {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
  font-size: 13px;
}
.alert--ok    { border-color: rgba(18,183,106,.45); background: rgba(18,183,106,.10); }
.alert--error { border-color: rgba(217,45,32,.45);  background: rgba(217,45,32,.10); }

.muted { color: var(--muted); font-size: 12px; }

.actionsRow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* Mobile Cards: nur auf klein anzeigen */
.cards { display: none; margin-top: 14px; gap: 12px; }
.cardItem {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(16,24,40,.06);
}
.cardItem__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cardItem__title { font-weight: 800; }
.cardItem__meta { margin-top: 8px; font-size: 13px; color: var(--muted); }
.cardItem__notes { margin-top: 8px; color: var(--muted); font-size: 12px; }
.cardItem__actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Aktionen-Spalte: Buttons sauber trennen */
.table td.actions {
  display: flex;
  gap: 8px;              /* Abstand zwischen Buttons */
  align-items: center;
  flex-wrap: wrap;       /* bricht sauber um, falls es eng wird */
}

/* Mobile Cards: auch dort Abstand */
.cardItem__actions {
  gap: 8px;
}

@media (max-width: 720px) {
  .tableWrap { display: none; }
  .cards { display: grid; }
}
