/* =====================================================================
   LU-Verwaltung – Oberfläche
   Bildsprache aus dem Lohnunternehmen: rot-weiße Warntafel als einziges
   lautes Element, Zahlen und Codes wie auf einem Kennzeichen, sonst ruhig.
   ===================================================================== */

:root {
  --paper: #f2f3ee;
  --sheet: #ffffff;
  --ink: #1f2621;
  --muted: #5b6660;
  --line: #cfd4cb;
  --line-strong: #9aa39a;
  --warn: #c8362b;
  --beacon: #f0a20b;
  --field: #4f5d2f;
  --field-soft: #e4e9d8;
  --warn-soft: #f7e1de;
  --beacon-soft: #fcefd2;

  --font-display: "Bahnschrift", "DIN Alternate", "D-DIN", "Barlow", "Arial Narrow", system-ui, sans-serif;
  --font-body: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;

  --radius: 4px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151a17;
    --sheet: #1d2420;
    --ink: #e8ebe5;
    --muted: #a3ada6;
    --line: #34403a;
    --line-strong: #56635b;
    --warn: #e2574a;
    --beacon: #f5b434;
    --field: #a9bd74;
    --field-soft: #26301d;
    --warn-soft: #3a211e;
    --beacon-soft: #3a2f16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151a17;
  --sheet: #1d2420;
  --ink: #e8ebe5;
  --muted: #a3ada6;
  --line: #34403a;
  --line-strong: #56635b;
  --warn: #e2574a;
  --beacon: #f5b434;
  --field: #a9bd74;
  --field-soft: #26301d;
  --warn-soft: #3a211e;
  --beacon-soft: #3a2f16;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0)/1.5 var(--font-body);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-stretch: semi-condensed;
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 3px solid var(--beacon);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus { left: var(--gutter); top: 8px; z-index: 10; background: var(--sheet); padding: 8px 12px; }

/* ------------------------------------------------------------------ Warntafel */

.stripes {
  background: repeating-linear-gradient(-45deg, var(--warn) 0 10px, #ffffff 10px 20px);
}

/* ------------------------------------------------------------------ Kopfzeile */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--sheet);
  border-bottom: 1px solid var(--line);
}
.bar::before {
  content: "";
  display: block;
  height: 6px;
  background: repeating-linear-gradient(-45deg, var(--warn) 0 10px, #ffffff 10px 20px);
}
.bar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  text-decoration: none;
  white-space: nowrap;
}
.bar-company {
  font-family: var(--font-display);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bar-spacer { flex: 1; }
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.me-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
  object-fit: cover;
}
.avatar.small { width: 26px; height: 26px; }

/* ------------------------------------------------------------------ Seitenlayout */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
  outline: none;
}
main:focus, main:focus-visible { outline: none; }
.loading { color: var(--muted); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 24px;
  overflow-x: auto;
}
.tabs a {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.section { margin-top: 36px; }

/* ------------------------------------------------------------------ Bedienelemente */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 var(--step-0)/1 var(--font-body);
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--ink); filter: none; }
.btn.danger { background: transparent; color: var(--warn); border-color: currentColor; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: var(--step--1); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }

.form { display: grid; gap: 18px; max-width: 560px; }
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 600; }
.hint { color: var(--muted); font-size: var(--step--1); margin: 0; }
input[type="text"], input[type="number"], select {
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
input:focus-visible, select:focus-visible { outline-offset: 0; }
input.mono { font-family: var(--font-display); font-size: var(--step-1); letter-spacing: 0.04em; }

fieldset { border: 0; padding: 0; margin: 0; }
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 16px;
  margin-top: 6px;
}
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.checks input { width: 18px; height: 18px; accent-color: var(--ink); }

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

/* ------------------------------------------------------------------ Meldungen */

.notice {
  border-left: 4px solid var(--line-strong);
  background: var(--sheet);
  padding: 12px 16px;
  margin: 0 0 20px;
  max-width: 68ch;
}
.notice.error { border-color: var(--warn); background: var(--warn-soft); }
.notice.ok { border-color: var(--field); background: var(--field-soft); }
.notice.warn { border-color: var(--beacon); background: var(--beacon-soft); }
.notice p:last-child { margin-bottom: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: var(--radius);
  z-index: 20;
  max-width: calc(100vw - 32px);
}

/* ------------------------------------------------------------------ Tabellen */

.table { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-weight: 600; color: var(--muted); font-size: var(--step--1); background: var(--paper); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 10px; }
.who small { display: block; color: var(--muted); }

@media (max-width: 640px) {
  .bar-company { display: none; }
  .bar-inner { gap: 10px; }
}
@media (max-width: 420px) {
  .me-name { display: none; }
}

@media (max-width: 640px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 4px 12px; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .table td.num[data-label] { text-align: left; }
  .table td.num:not([data-label]) { text-align: right; }
}

/* ------------------------------------------------------------------ Status und Rollen */

.tag {
  display: inline-block;
  font-size: var(--step--1);
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  margin: 2px 4px 2px 0;
}
.tag.active { border-color: var(--field); color: var(--field); }
.tag.probation, .tag.applicant { border-color: var(--beacon); background: var(--beacon-soft); color: var(--ink); }
.tag.suspended, .tag.revoked, .tag.expired { border-color: var(--warn); color: var(--warn); }
.tag.used_up, .tag.left { color: var(--muted); }

/* ------------------------------------------------------------------ Firmenliste */

.companies { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.companies li { border-bottom: 1px solid var(--line); }
.companies a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 16px 4px;
  text-decoration: none;
}
.companies a:hover .company-name { text-decoration: underline; text-underline-offset: 4px; }
.company-name { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; }
.company-meta { color: var(--muted); grid-column: 1; }
.companies .tags { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }

/* ------------------------------------------------------------------ Startseite */

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  padding: 24px 0 8px;
}
.welcome h1 { font-size: clamp(2rem, 4.4vw, 3rem); max-width: 18ch; }
.welcome .lead { font-size: var(--step-1); color: var(--muted); max-width: 46ch; }
.board {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.board-row {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.board-row:last-child { border-bottom: 0; }
.board-nr { font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--muted); }
.board-title { font-weight: 600; }
.board-title small { display: block; font-weight: 400; color: var(--muted); }
@media (max-width: 760px) {
  .welcome { grid-template-columns: 1fr; gap: 24px; }
}

/* ------------------------------------------------------------------ Einladungscode wie ein Kennzeichen */

.plate-wrap { display: grid; gap: 14px; justify-items: start; }
.plate {
  display: inline-flex;
  align-items: stretch;
  border: 3px solid #1f2621;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2621;
  overflow: hidden;
  max-width: 100%;
}
.plate-band {
  width: 22px;
  flex: none;
  background: repeating-linear-gradient(-45deg, #c8362b 0 7px, #ffffff 7px 14px);
  border-right: 2px solid #1f2621;
}
.plate-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 4.6vw, 2rem);
  letter-spacing: 0.06em;
  padding: 8px 16px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  user-select: all;
}
.copy-line {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 640px;
}
.copy-line input { font-size: var(--step--1); }

/* ------------------------------------------------------------------ Mitglied bearbeiten */

.table tr.edit-row td { background: var(--paper); padding: 16px 12px 20px; }
.edit-form {
  max-width: none;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}
.edit-form > div:first-child,
.edit-form fieldset,
.edit-form > p,
.edit-form .actions { grid-column: 1 / -1; }
.edit-form > div:first-child:empty { display: none; }

.empty {
  border: 1px dashed var(--line-strong);
  padding: 24px;
  border-radius: var(--radius);
  color: var(--muted);
  max-width: 68ch;
}
.empty p { margin-bottom: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 0.18s ease-out; }
  @keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
}

.table tr[hidden] { display: none; }

/* ------------------------------------------------------------------ Kennzahlen */

.facts {
  display: flex;
  flex-wrap: wrap;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-width: 1px 0 0 1px;
  margin: 0 0 8px;
}
.fact {
  flex: 1 1 150px;
  min-width: 0;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-width: 0 1px 1px 0;
  padding: 14px 16px;
  text-decoration: none;
  display: block;
}
a.fact:hover dd { text-decoration: underline; text-underline-offset: 4px; }
.fact dt { color: var(--muted); font-size: var(--step--1); }
.fact dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.9vw, var(--step-2));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a {
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: var(--step--1);
}
.filters a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ------------------------------------------------------------------ Tabellen-Ergänzungen */

.table td.nr, .order-nr {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.block { display: block; }
.urgent { color: var(--warn); font-weight: 600; }
.neg { color: var(--warn); }
.table.accounts tr.current td { background: var(--beacon-soft); }
.table.accounts a[aria-current] { font-weight: 600; }

/* ------------------------------------------------------------------ Formulare */

.form.wide { max-width: 760px; }
.grid-2, .grid-3 { display: grid; gap: 18px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2.top { align-items: start; gap: 32px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
}
input[type="date"], input[type="file"] {
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  min-height: 44px;
  width: 100%;
}
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

details.panel {
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: var(--radius);
  margin-top: 16px;
  max-width: 760px;
}
details.panel > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  list-style: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+ "; color: var(--muted); }
details.panel[open] > summary::before { content: "– "; }
.panel-body { padding: 4px 16px 16px; }

.plain-list { list-style: none; padding: 0; margin: 0 0 12px; border-top: 1px solid var(--line); }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.inline-form { margin-top: 8px; max-width: 420px; }

.sell-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}
.sell-line .field { width: 200px; }

/* ------------------------------------------------------------------ Auftrag */

.order-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 16px;
}
.order-head h2 { margin: 0; }
.order-nr { font-size: var(--step-2); }
.order-actions { margin: 0 0 24px; }
.order-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 760px) { .order-body { grid-template-columns: 1fr; } }
.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
  background: var(--sheet);
  border: 1px solid var(--line);
}
.details dt, .details dd { padding: 9px 12px; border-bottom: 1px solid var(--line); margin: 0; }
.details dt { color: var(--muted); }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }
.order-panels { display: grid; gap: 20px; }
.panel-plain {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  padding: 14px 16px 16px;
}
.panel-plain h3 { margin-bottom: 12px; }
.panel-plain .form { max-width: none; }

/* ------------------------------------------------------------------ Auswahl, Früchte, Lizenzen */

.table th.pick, .table td.pick { width: 36px; padding-right: 0; }
.pick input { width: 18px; height: 18px; accent-color: var(--ink); }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }

.chips { list-style: none; padding: 0; margin: 8px 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 999px;
  padding: 3px 4px 3px 12px;
  font-size: var(--step--1);
}
.chips li:not(:has(.chip-x)) { padding-right: 12px; }
.chip-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
}
.chip-x:hover { background: var(--warn-soft); color: var(--warn); }

.license-line { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.license .tag { margin-left: 8px; }
.license-settings { margin-top: 6px; }
.license-settings summary { cursor: pointer; color: var(--muted); font-size: var(--step--1); }
.license-settings .form { margin-top: 10px; }
@media (max-width: 640px) { .table td.pick { padding-top: 10px; } }

/* ------------------------------------------------------------------ Zeitvorschläge */

.time-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.time-chip {
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  min-height: 34px;
}
.time-chip:hover { border-color: var(--ink); }
.time-chip.strong { border-color: var(--beacon); background: var(--beacon-soft); font-weight: 600; }

/* ------------------------------------------------------------------ Mein Konto */

.me-link { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; border-radius: 999px; padding: 2px 8px 2px 2px; }
.me-link:hover { background: var(--paper); }
.avatar.large { width: 72px; height: 72px; }
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.profile-head h1 { margin: 0; }
