/* ============================================================
   Zeiterfassung – Designsystem (aus Claude Design v1.0)
   Ein System, zwei Mandanten · Systemschrift · helles Theme · WCAG AA
   ============================================================ */
:root {
  /* Neutralskala – kühles, ruhiges Grau */
  --bg:#f4f5f7; --surface:#ffffff; --surface-2:#f7f8fa; --surface-3:#eef0f3;
  --border:#e3e6ea; --border-strong:#cdd2d8;
  --text:#1c2127; --text-muted:#5b636e; --text-faint:#8b919b;
  /* Mandanten-Akzente (gleiche L/C, andere Hue) */
  --acc-c2k:oklch(0.60 0.15 52);     /* connected2000 – Konfektionierung */
  --acc-c2k-ink:oklch(0.46 0.14 50);
  --acc-dd:oklch(0.55 0.13 252);     /* Dynamik Druck – Druck */
  --acc-dd-ink:oklch(0.44 0.13 254);
  /* Status */
  --st-open:#b06a00; --st-open-bg:#fdf3e2;
  --st-active:#1f7a4d; --st-active-bg:#e6f4ec;
  --st-run:#1d6fb8; --st-run-bg:#e7f0fa;
  --st-done:#3a6b3f; --st-done-bg:#eaf2ea;
  --st-reject:#b3261e; --st-reject-bg:#fbeceb;
  --st-neutral:#5b636e; --st-neutral-bg:#eef0f3;
  /* Maße */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;
  --r-sm:8px; --r-md:12px; --r-lg:18px; --r-pill:999px; --radius:12px;
  --sh-1:0 1px 2px rgba(20,25,35,.06),0 1px 3px rgba(20,25,35,.05);
  --sh-2:0 4px 14px rgba(20,25,35,.10);
  /* Aktiver Mandanten-Akzent (per JS gesetzt) – Default Dynamik Druck */
  --a:var(--acc-dd);
  --muted:var(--text-muted); --line:var(--border); --card:var(--surface); --ink:var(--text);
}
/* Mandanten-Akzent je Firma (body[data-firma=...]) */
body[data-firma="connected2000"] { --a:var(--acc-c2k); }
body[data-firma="dynamik-druck"] { --a:var(--acc-dd); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dot { width: 22px; height: 22px; border-radius: 7px; background: var(--a); display: inline-block; }
#clock { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
main { max-width: 460px; margin: 0 auto; padding: 16px; }
.loading { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--sh-1); margin-bottom: 14px; }
.pad { padding: 18px; }

h1 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 20px; font-weight: 700; margin: 18px 0 10px; }
.sub { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }

/* Einheitlicher Kachel-Kopf: Titel (h1-Größe) in der Kachel, optionale Steuerung rechts */
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cardhead > h1 { font-size: 20px; font-weight: 700; margin: 0; }
.cardhead .ch-right { display: flex; align-items: center; gap: 8px; flex: none; }
.card > .cardhead { padding: 16px 16px 0; margin-bottom: 12px; }   /* Titel in randlosen Listen-Karten */

/* ---------- Formularelemente ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; }
input, select {
  width: 100%; height: 48px; font-size: 15px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--a); border-color: var(--a); }

/* Mehrspaltiges Formular (Mitarbeiter bearbeiten) – reihenweise */
.mform { display: flex; flex-direction: column; }
.mform .mrow { display: flex; flex-wrap: wrap; gap: 0 18px; }
.mform .fld { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; }
.mform .fld > input, .mform .fld > select, .mform .fld > .ro, .mform .fld > button { margin-top: auto; }
.mform .ro { height: 48px; display: flex; align-items: center; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-muted); }
@media (max-width: 560px) { .mform .fld { flex-basis: 100%; } }

/* Button-Farb-Variablen (per JS aus den Firmen-Design-Einstellungen gesetzt) */
:root {
  --btn-primary-bg: var(--a);          --btn-primary-ink: #fff;
  --btn-danger-bg: var(--st-reject);   --btn-danger-ink: #fff;
  --btn-sek-bg: var(--surface);        --btn-sek-ink: var(--text);   --btn-sek-bd: var(--border-strong);
}
button {
  font-size: 15px; font-weight: 600; border-radius: var(--r-md); border: 1px solid var(--btn-sek-bd);
  background: var(--btn-sek-bg); color: var(--btn-sek-ink); cursor: pointer; padding: 12px 16px; width: 100%;
  transition: filter .12s ease, background-color .12s ease, box-shadow .12s ease;
}
button:active { transform: scale(0.99); }
button:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
/* Hover: Sekundär-Buttons heller hinterlegen, farbige Buttons leicht abdunkeln */
button:not(.btn-primary):not(.btn-danger):not(.navitem):not(.ma-navitem):not(.ma-tab):not(.key):not(.icon-btn):not(.lo-top):not(.firma-card):not(:disabled):hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-primary:not(:disabled):hover, .btn-danger:not(:disabled):hover { filter: brightness(0.93); box-shadow: var(--sh-2); }
button:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-ink); font-weight: 700; height: 52px; box-shadow: var(--sh-1); }
.btn-danger { background: var(--btn-danger-bg); border-color: var(--btn-danger-bg); color: var(--btn-danger-ink); font-weight: 700; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row button { flex: 1; }

/* ---------- Kopfzeile in Karten ---------- */
.head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.head .name { font-weight: 700; font-size: 15px; }
.head .role { font-size: 12px; color: var(--text-muted); }
.icon-btn { width: auto; margin-left: 0; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.head .icon-btn:first-of-type { margin-left: auto; }

/* ---------- Auftrags-/Listenkarten ---------- */
.order { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; padding: 16px; border-radius: 0; }
.order:last-child { border-bottom: 0; }
.order.active { background: color-mix(in oklch, var(--a) 6%, #fff); }
.order .row1 { display: flex; align-items: center; gap: 8px; }
.order .nr { font-weight: 700; font-size: 15px; }
.order .desc { font-size: 13px; color: var(--text-muted); margin: 4px 0 10px; }

/* ---------- Status-Badges ---------- */
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill);
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.run    { color: var(--st-run);    background: var(--st-run-bg); }
.pill.active { color: var(--st-active); background: var(--st-active-bg); }
.pill.done   { color: var(--st-done);   background: var(--st-done-bg); }
.pill.open   { color: var(--st-open);   background: var(--st-open-bg); }
.pill.reject { color: var(--st-reject); background: var(--st-reject-bg); }
.pill.neutral{ color: var(--st-neutral);background: var(--st-neutral-bg); }

/* ---------- Fortschrittsbalken ---------- */
.bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--a); }
.progress { display: flex; align-items: center; gap: 8px; }
.qtytxt { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Timer / Stoppuhr ---------- */
.timerwrap { text-align: center; padding: 26px 16px 10px;
  background: linear-gradient(180deg, color-mix(in oklch, var(--a) 7%, #fff), #fff); }
.timer { font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.timer-label { font-size: 13px; color: var(--text-muted); }

/* ---------- Mengen-Stepper ---------- */
.menge { margin: 6px 16px 18px; background: var(--surface-2); border-radius: var(--r-md); padding: 16px; }
.menge .lbl { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.stepper { display: flex; align-items: center; gap: 12px; justify-content: center; }
.stepper button { width: 52px; height: 52px; font-size: 26px; font-weight: 700; padding: 0; flex: none; }
.stepper input { text-align: center; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; max-width: 110px; }
.hint { color: var(--text-muted); font-size: 12px; padding: 12px 16px; }
.err { color: var(--st-reject); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Mandantenwahl-Karten ---------- */
.firma-card { display: flex; align-items: center; gap: 16px; text-align: left; padding: 20px;
  border: 2px solid var(--accent, var(--a)); border-radius: var(--r-lg); background: #fff; width: 100%;
  box-shadow: var(--sh-1); margin-bottom: 14px; }
.firma-card .swatch { width: 52px; height: 52px; border-radius: 14px; background: var(--accent, var(--a)); flex: none; }
.firma-card .fn { font-size: 18px; font-weight: 700; display: block; }
.firma-card .fs { font-size: 13px; color: var(--text-muted); }

/* Akzentstreifen oben (Login etc.) */
.accentbar { height: 6px; background: var(--a); }

/* ---------- PIN-Eingabe / Tastenfeld ---------- */
.pin-dots { display: flex; gap: 10px; margin: 6px 0 4px; }
.pin-dots .d { flex: 1; height: 52px; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--text); }
.pin-dots .d.on { border-color: var(--a); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.keypad .key { height: 58px; font-size: 24px; font-weight: 600; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); padding: 0; }
.keypad .key.action { background: none; border: none; color: var(--text-faint); font-size: 14px; font-weight: 600; }
.keypad .key.go { background: var(--btn-primary-bg); border: none; color: var(--btn-primary-ink); font-size: 22px; font-weight: 700; }

/* ---------- Tabellen (Admin) ---------- */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
/* Zebra-Streifen für Tabellen mit Klasse .ztab (Datenzeilen, Kopf bleibt) */
.ztab tr:nth-child(even) td { background: #f6f7f9; }
/* Hover: ganze Zeile bei .ztab-Tabellen, einzelne Zelle im Kalender */
.ztab tr:hover td { background: #eaeef3; }
.ztab .ma-link:hover { text-decoration: underline; }
/* Hover für Listen-/Zeilen-Karten (Anwesend, Abwesend, Aufträge, Mitarbeiter …) */
.emp, .a-order, .order, .step { transition: background .12s ease; }
.emp:hover, .a-order:hover { background: var(--surface-2); }
.kal-cell:hover { background: #e3e9f1 !important; }
/* Kalender: beim Zell-Hover zusätzlich den Namen (Zeilenkopf) hervorheben */
.kaltab tr:hover .kal-name { background: #e3e9f1 !important; }

/* Druck: nur den Stundenzettel zeigen, Navigation/Steuerleiste ausblenden */
@media print {
  .sidebar, .ma-side, .ma-tabbar, .no-print, #topbar { display: none !important; }
  .ma-shell { display: block !important; }
  .ma-content { padding: 0 !important; }
  .adminwrap, .content, .contentpad { display: block !important; overflow: visible !important; background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .zettel { box-shadow: none !important; border: 0 !important; }
  .zettel .pad { padding: 0 !important; }
}
thead th { text-align: left; color: var(--text-muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }
.tablecard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }

/* ---------- Admin-Layout mit Seitenleiste (Desktop) ---------- */
.adminwrap { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: none; background: #1c2127; color: #cfd3da;
  padding: 20px 0; display: flex; flex-direction: column; }
.sidebar .brandrow { padding: 0 20px 18px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #2c333d; margin-bottom: 12px; }
.sidebar .brandrow .swatch { width: 30px; height: 30px; border-radius: 8px; background: var(--a); }
.sidebar .brandrow .nm { color: #fff; font-weight: 700; }
.navitem { padding: 11px 20px; display: block; width: 100%; text-align: left; border: 0; background: none;
  font-size: 14px; font-weight: 600; color: #cfd3da; border-left: 3px solid transparent; border-radius: 0; }
.navitem:hover { background: #262d36; color: #fff; }
.navitem.on { color: #fff; background: #2c333d; border-left-color: var(--a); }
.sidebar .who { margin-top: auto; padding: 14px 20px; border-top: 1px solid #2c333d; font-size: 13px; color: #9aa0aa; }
.content { flex: 1; background: var(--bg); min-width: 0; }
.tophead { background: var(--surface); border-bottom: 1px solid var(--border); padding: 18px 28px;
  display: flex; justify-content: space-between; align-items: center; }
.tophead .htitle { font-size: 20px; font-weight: 700; }
.tophead .hsub { font-size: 13px; color: var(--text-muted); }
.contentpad { padding: 24px 28px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; }
.kpi .k { font-size: 13px; color: var(--text-muted); }
.kpi .v { font-size: 30px; font-weight: 700; margin-top: 4px; }

@media (max-width: 720px) {
  .adminwrap { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 10px; gap: 4px; }
  .sidebar .brandrow { width: 100%; border-bottom: 0; margin: 0 0 6px; padding: 4px 10px; }
  .sidebar .who { display: none; }
  .navitem { width: auto; padding: 8px 12px; border-left: 0; border-radius: 8px; }
  .navitem.on { border-left: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .contentpad { padding: 16px; }
}

/* ============================================================
   Mitarbeiter-Oberfläche – responsive Shell
   Desktop: dunkle Seitenleiste · Mobil: feste Tableiste unten
   ============================================================ */
/* Vollbreite, sobald angemeldet (Login/Mandantenwahl bleiben zentriert) */
body.ma-app main { max-width: none; margin: 0; padding: 0; }

.ma-shell { display: flex; align-items: stretch; min-height: calc(100vh - 49px); }

/* Seitenleiste (Desktop) */
.ma-side { width: 210px; flex: none; background: #1c2127; color: #cfd3da;
  padding: 18px 0; display: flex; flex-direction: column; }
.ma-brand { padding: 0 18px 16px; margin-bottom: 10px; border-bottom: 1px solid #2c333d;
  display: flex; align-items: center; gap: 10px; min-height: 30px; }
.ma-brand .ma-swatch { width: 26px; height: 26px; border-radius: 7px; background: var(--a); flex: none; }
.ma-brand .ma-nm { color: #fff; font-weight: 700; font-size: 15px; }
.ma-navitem { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 18px; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #cfd3da; border-left: 3px solid transparent; border-radius: 0; }
.ma-navitem svg { flex: none; opacity: .9; }
.ma-navitem:hover { background: #262d36; color: #fff; }
.ma-navitem.on { color: #fff; background: #2c333d; border-left-color: var(--a); }
.ma-who { margin-top: auto; padding: 14px 18px 4px; border-top: 1px solid #2c333d;
  font-size: 13px; color: #9aa0aa; }

/* Inhalt */
.ma-content { flex: 1; min-width: 0; background: var(--bg); padding: 22px; max-width: 760px; }
.ma-content .cardhead { margin-bottom: 14px; }

/* Tableiste (mobil) – standardmäßig aus */
.ma-tabbar { display: none; }

/* Abmelden-Button in der Topbar */
.lo-top { width: auto; height: auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); border-radius: var(--r-pill); }
.lo-top svg { width: 16px; height: 16px; }
.lo-top:hover { background: var(--surface-2); }

/* Kennzahlen-Kacheln */
.ma-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ma-kpi { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; }
.ma-kpi .k { font-size: 12px; color: var(--text-muted); }
.ma-kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* Tabellen (Stunden / Zettel) */
.ma-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ma-table th { text-align: left; color: var(--text-muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ma-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.ma-table tbody tr:nth-child(even) { background: var(--surface-2); }

@media (max-width: 720px) {
  .ma-side { display: none; }
  .ma-content { padding: 16px 14px 84px; max-width: none; }   /* Platz für Tableiste */
  .ma-kpis { grid-template-columns: repeat(2, 1fr); }
  .ma-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #1c2127; border-top: 1px solid #2c333d; padding: 4px 2px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .ma-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px; border: 0; background: none; cursor: pointer;
    color: #9aa0aa; font-size: 11px; font-weight: 600; }
  .ma-tab svg { width: 22px; height: 22px; }
  .ma-tab.on { color: #fff; }
  .ma-tab.on svg { color: var(--a); }
}
