/* Drescherboard – dunkles, ruhiges Arbeits-Interface. */

:root {
  --bg: #0e1216;
  --surface: #161c23;
  --surface-2: #1d2530;
  --surface-3: #242e3b;
  --border: #2b3542;
  --border-soft: #222b36;
  --text: #e9e7e1;
  --muted: #9aa4b2;
  --faint: #6b7482;
  --accent: #d99a3d;
  --accent-hover: #e7ab52;
  --accent-ink: #1a1206;
  --ok: #3fb97f;
  --danger: #e05d5d;
  --danger-hover: #ec7474;
  --radius: 10px;
  --radius-s: 7px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

::selection { background: rgba(217, 154, 61, 0.35); }

/* ── Login ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-image: radial-gradient(circle at 50% 30%, rgba(217, 154, 61, 0.07), transparent 55%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 28px 26px;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.login-brand h1 {
  font-size: 21px;
  margin: 0;
  letter-spacing: 0.2px;
}

.login-brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* ── Formulare & Buttons ───────────────────────────── */
.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text);
  font-size: 15px;
  padding: 9px 12px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 154, 61, 0.18);
}

.form-error {
  background: rgba(224, 93, 93, 0.1);
  border: 1px solid rgba(224, 93, 93, 0.4);
  color: #f0a3a3;
  border-radius: var(--radius-s);
  padding: 8px 12px;
  font-size: 13.5px;
  margin: 0 0 14px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-3);
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); filter: none; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { background: var(--danger); color: #220b0b; }
.btn.danger:hover { background: var(--danger-hover); filter: none; }
.btn.icon { padding: 6px 12px; font-size: 18px; line-height: 1; background: transparent; border-color: var(--border); }
.btn.block { width: 100%; padding: 10px 14px; }
.btn.small { padding: 4px 10px; font-size: 13px; font-weight: 500; }

/* ── Kopfzeile ─────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 16px; letter-spacing: 0.2px; }
.brand-text span { font-size: 12.5px; color: var(--muted); }

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.year-pager { display: flex; align-items: center; gap: 4px; }

.year-label {
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  color: var(--text);
  padding: 5px 12px;
  cursor: pointer;
  min-width: 84px;
  text-align: center;
}

.year-label:hover { background: var(--surface-2); border-color: var(--border); }

.search { max-width: 220px; }

.menu-wrap { position: relative; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 210px;
  padding: 6px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  z-index: 30;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text);
  padding: 9px 11px;
  cursor: pointer;
}

.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: #f0a3a3; }

/* ── Board-Tabelle ─────────────────────────────────── */
.board-wrap { padding: 18px 20px 8px; }

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 210px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table.board {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1060px;
  font-variant-numeric: tabular-nums;
}

.board thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 10px 6px;
  text-align: center;
  z-index: 5;
}

.board thead th:first-child {
  left: 0;
  z-index: 6;
  text-align: left;
  padding-left: 14px;
  min-width: 230px;
}

.board thead th.col-today { color: var(--accent); }

.board td, .board tfoot th, .board tfoot td {
  border-bottom: 1px solid var(--border-soft);
  padding: 4px 6px;
  text-align: center;
}

.board tbody tr:hover td { background: rgba(217, 154, 61, 0.045); }

.board tbody tr:hover td.sticky { background: #1b222c; }

.board td.sticky {
  position: sticky;
  left: 0;
  background: var(--surface);
  text-align: left;
  padding-left: 14px;
  z-index: 4;
}

.person-cell { display: flex; align-items: center; gap: 8px; }

.person-name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.person-total {
  color: var(--faint);
  font-size: 12.5px;
  margin-left: auto;
  padding-right: 2px;
}

.row-actions { display: flex; gap: 4px; margin-left: 6px; opacity: 0; }
tbody tr:hover .row-actions, tbody tr:focus-within .row-actions { opacity: 1; }

.row-actions button {
  font: inherit;
  font-size: 12.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 2px 8px;
  cursor: pointer;
}

.row-actions button:hover { color: var(--text); border-color: var(--faint); }
.row-actions button.del:hover { color: #f0a3a3; border-color: var(--danger); }

.cell-toggle {
  width: 38px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: transparent;
  padding: 0;
}

.cell-toggle:hover { border-color: var(--faint); background: var(--surface-2); }

.cell-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.cell-toggle:focus-visible, .btn:focus-visible, .year-label:focus-visible,
.row-actions button:focus-visible, .menu button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.board tfoot td, .board tfoot th {
  border-bottom: none;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 6px;
  position: sticky;
  bottom: 0;
}

.board tfoot th {
  text-align: left;
  padding-left: 14px;
  font-weight: 600;
  left: 0;
  z-index: 4;
}

/* ── Leere Zustände / Fuß ──────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty h2 { color: var(--text); font-size: 19px; margin: 0 0 8px; }
.empty p { margin: 0 0 18px; }
.empty.small { padding: 40px 20px; }

.foot {
  padding: 10px 20px 22px;
  color: var(--faint);
  font-size: 12.5px;
}

/* ── Dialoge ───────────────────────────────────────── */
.dlg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 24px;
  width: min(420px, calc(100vw - 40px));
}

.dlg.narrow { width: min(360px, calc(100vw - 40px)); }

.dlg::backdrop { background: rgba(5, 8, 11, 0.65); }

.dlg h2 { margin: 0 0 16px; font-size: 18px; }
.dlg p { color: var(--muted); margin: 0 0 8px; }

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ── Hinweise ──────────────────────────────────────── */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  max-width: 340px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }

@media (max-width: 720px) {
  .topbar { padding: 10px 12px; }
  .board-wrap { padding: 12px 12px 4px; }
  .search { max-width: none; flex: 1 1 160px; }
  .brand-text span { display: none; }
  .row-actions { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
