/* ==========================================================================
   Stressfrei – Design-Grundlagen
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --surface-3: #eef0ec;
  --text: #19221e;
  --muted: #5c6862;
  --faint: #89938e;
  --border: #e1e5e0;
  --border-strong: #cdd3cc;

  --accent: #2f6f62;
  --accent-hover: #275e53;
  --accent-soft: #e2efeb;
  --accent-text: #ffffff;
  --accent-ink: #1f5348;

  --info: #2b5c9c;     --info-soft: #e6eefa;
  --violet: #6a4aa8;   --violet-soft: #efeafa;
  --warn: #9a6210;     --warn-soft: #fbf0db;
  --ok: #2c7445;       --ok-soft: #e3f2e7;
  --danger: #b4412d;   --danger-soft: #fae8e4;
  --neutral: #5c6862;  --neutral-soft: #eceeea;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(18, 28, 23, 0.05), 0 6px 20px rgba(18, 28, 23, 0.04);
  --shadow-lg: 0 10px 40px rgba(18, 28, 23, 0.18);
  --sidebar-w: 244px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111513;
    --surface: #181d1b;
    --surface-2: #1d2320;
    --surface-3: #242b28;
    --text: #e6ebe8;
    --muted: #a1aba6;
    --faint: #76817b;
    --border: #2a322e;
    --border-strong: #38423d;

    --accent: #5cb5a1;
    --accent-hover: #6fc4b0;
    --accent-soft: #1f3631;
    --accent-text: #0d1a17;
    --accent-ink: #8fd3c3;

    --info: #8db4ec;     --info-soft: #1d2a3d;
    --violet: #b9a0ee;   --violet-soft: #2a2340;
    --warn: #e6b45f;     --warn-soft: #362a15;
    --ok: #7fcf98;       --ok-soft: #1b3324;
    --danger: #f08f7c;   --danger-soft: #3b201b;
    --neutral: #a1aba6;  --neutral-soft: #262d2a;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }

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

.icon { display: inline-flex; flex: none; line-height: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   Layout
   ========================================================================== */

.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.mobilebar { display: none; }

.view {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  outline: none;
}

.scrim { position: fixed; inset: 0; background: rgba(10, 15, 12, 0.45); z-index: 35; }

.loading-page { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Seitenkopf */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 550;
  font-size: 14px;
  margin-bottom: 10px;
}

/* ==========================================================================
   Bausteine
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-pad { padding: 20px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}
.card-head h2 { font-size: 16px; }
.card-head .count { color: var(--faint); font-weight: 500; margin-left: 6px; }
.card-body { padding: 14px 20px 20px; }
.card-foot { padding: 12px 20px 16px; border-top: 1px solid var(--border); }

.section-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0 8px;
}
.section-title:first-child { margin-top: 0; }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 580;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 580;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: var(--neutral);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 560;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: var(--radius-xs);
  padding: 1px 7px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag.overdue { background: var(--danger-soft); color: var(--danger); }
.tag.soon { background: var(--warn-soft); color: var(--warn); }

/* Avatar */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  object-fit: cover;
  background: var(--accent);
  overflow: hidden;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* Formulare */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--faint); }

.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2389938e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }

.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 550; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 38px; }

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 550;
  margin-top: 14px;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--info-soft);
  color: var(--info);
}
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--ok-soft); color: var(--ok); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* Leere Zustände */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 36px 20px;
  color: var(--muted);
}
.empty .empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 4px;
}
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 420px; }
.empty .btn { margin-top: 8px; }
.empty.compact { padding: 18px 10px; }

/* ==========================================================================
   Übersicht
   ========================================================================== */

.greeting h1 { font-size: 28px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  color: inherit;
}
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-label .icon { color: var(--accent); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--faint); }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.next-up {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 14px;
}
.next-up .when { font-size: 13px; font-weight: 650; }
.next-up .what { font-weight: 650; color: var(--text); }

.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.agenda li { border-top: 1px solid var(--border); }
.agenda li:first-child { border-top: 0; }

.agenda-item {
  display: grid;
  grid-template-columns: 88px 4px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-xs);
}
.agenda-item:hover { background: var(--surface-2); }
.agenda-item.past { opacity: 0.55; }
.agenda-time { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda-bar { width: 4px; border-radius: 4px; align-self: stretch; min-height: 22px; }
.agenda-title { font-weight: 600; overflow-wrap: anywhere; }
.agenda-meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.agenda-now { font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; margin-left: 6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  color: inherit;
  min-width: 0;
}
.list li:first-child .list-item, .list > .list-item:first-child { border-top: 0; }
a.list-item:hover { text-decoration: none; background: var(--surface-2); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--radius-xs); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.todo { background: var(--faint); }
.dot.doing { background: var(--warn); }
.dot.done { background: var(--ok); }

/* ==========================================================================
   Kalender
   ========================================================================== */

.cal-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }

.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 14px;
}
.cal-list label:hover { background: var(--surface-2); }
.cal-list input { position: absolute; opacity: 0; pointer-events: none; }
.cal-swatch {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid var(--swatch);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.cal-list input:checked + .cal-swatch { background: var(--swatch); }
.cal-list input:focus-visible + .cal-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-list li { display: flex; align-items: center; gap: 4px; }
.cal-list li > label { flex: 1; min-width: 0; }
.share-toggle { width: 28px; height: 28px; flex: none; border: 0; border-radius: 7px; background: transparent; color: var(--faint); opacity: 0.45; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.share-toggle:hover { background: var(--surface-3); opacity: 1; }
.share-toggle.on { color: var(--accent-ink); background: var(--accent-soft); opacity: 1; }
.default-toggle { width: 28px; height: 28px; flex: none; border: 0; border-radius: 7px; background: transparent; color: var(--faint); opacity: 0.35; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.default-toggle:hover { background: var(--surface-3); opacity: 1; }
.default-toggle.on { color: var(--warn); opacity: 1; cursor: default; }
.default-toggle.on svg { fill: currentColor; }
.cal-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); margin-top: 10px; }

.cal-card { padding: 16px; position: relative; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar h2 { font-size: 18px; margin-right: auto; min-width: 0; }
.cal-nav { display: inline-flex; gap: 4px; align-items: center; }
.cal-box { height: calc(100vh - 210px); min-height: 520px; }
.cal-card.is-loading::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.connect-card { max-width: 560px; margin: 20px auto; }

/* FullCalendar an das Design anpassen */
.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-neutral-text-color: var(--muted);
  --fc-today-bg-color: color-mix(in srgb, var(--accent) 7%, transparent);
  --fc-now-indicator-color: var(--danger);
  --fc-event-border-color: transparent;
  --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-highlight-color: color-mix(in srgb, var(--accent) 16%, transparent);
  font-size: 13px;
}
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-list-day-text, .fc .fc-list-day-side-text {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.fc .fc-col-header-cell { padding: 6px 0; background: var(--surface); }
.fc .fc-timegrid-slot-label-cushion { color: var(--faint); font-size: 12px; }
.fc .fc-timegrid-slot { height: 2.4em; }
.fc .fc-event { border-radius: 6px; padding: 1px 3px; cursor: pointer; }
.fc .fc-daygrid-event { font-size: 12px; }
.fc .fc-list-event-title a, .fc .fc-list-event { color: var(--text); }
.fc .fc-scrollgrid { border-radius: var(--radius-sm); overflow: hidden; }
.fc-theme-standard .fc-list { border-radius: var(--radius-sm); }
.fc .fc-list-empty { background: var(--surface); }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  min-width: 26px;
  text-align: center;
  margin: 4px;
  padding: 2px 6px;
}
.fc a { text-decoration: none; }

/* ==========================================================================
   Aufträge
   ========================================================================== */

.orders { display: flex; flex-direction: column; }

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  color: inherit;
}
.order-row:first-child { border-top: 0; }
.order-row:hover { background: var(--surface-2); text-decoration: none; }
.order-num { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.order-title { font-weight: 650; font-size: 15px; }
.order-meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 2px; }
.order-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.order-counts { display: flex; gap: 10px; color: var(--faint); font-size: 13px; }
.order-counts span { display: inline-flex; align-items: center; gap: 4px; }
.order-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { font-size: 24px; }

.status-select { width: auto; min-height: 36px; font-weight: 600; font-size: 14px; }

.info-list { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.info-list dt { font-size: 12px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.info-list dd { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.info-list dd a { display: inline-flex; align-items: center; gap: 5px; }

.remarks-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.remarks-actions .muted { font-size: 13px; }

.file-group + .file-group { margin-top: 18px; }
.file-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.file-group-head h3 { font-size: 14px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.file-row:first-child { border-top: 0; }
.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--muted);
  flex: none;
}
.file-icon.pdf { background: var(--danger-soft); color: var(--danger); }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-meta { font-size: 12px; color: var(--faint); }
.file-empty { font-size: 14px; color: var(--faint); padding: 6px 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-3);
  border: 0;
  padding: 0;
  cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.thumb:hover img { transform: scale(1.04); }
.thumb .thumb-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; padding: 8px; text-align: center; }

.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(6, 9, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 64px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox-bar { position: absolute; top: 10px; left: 14px; right: 10px; display: flex; align-items: center; gap: 6px; color: #fff; }
.lightbox-bar .lb-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.lightbox .lb-prev, .lightbox .lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.lightbox .lb-prev { left: 10px; }
.lightbox .lb-next { right: 10px; }
.lightbox a.icon-btn { text-decoration: none; }

/* ==========================================================================
   Stunden
   ========================================================================== */

.month-switch { display: inline-flex; align-items: center; gap: 4px; }
.month-switch strong { min-width: 140px; text-align: center; font-size: 15px; }

.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.team-totals { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-totals th, .team-totals td { text-align: left; padding: 9px 0; border-top: 1px solid var(--border); }
.team-totals th { font-size: 12px; color: var(--faint); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; border-top: 0; }
.team-totals td.num, .team-totals th.num { text-align: right; font-variant-numeric: tabular-nums; }
.team-totals button { border: 0; background: none; color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

.day-group + .day-group { margin-top: 6px; }
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 20px 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}
.day-head .num { font-variant-numeric: tabular-nums; }

.entry {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
}
.entry-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.entry-time small { display: block; font-weight: 500; color: var(--faint); font-size: 12px; }
.entry-main { min-width: 0; }
.entry-who { font-weight: 600; font-size: 14px; }
.entry-note { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.entry-dur { font-weight: 700; font-variant-numeric: tabular-nums; }
.entry-actions { display: flex; gap: 2px; }

.access-text { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 0; user-select: all; }

.duration-preview { font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; }

/* Stempeluhr */

.clock-card { padding: 18px 20px; margin-bottom: 18px; }
.clock-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.clock-state { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 300px; }
.clock-title { font-weight: 700; font-size: 17px; }
.clock-sub { font-size: 13px; color: var(--muted); }
.clock-time { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin-left: auto; padding-right: 8px; }
.clock-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--border-strong); flex: none; }
.clock-dot.on { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); animation: pulse 2s ease-in-out infinite; }
.clock-dot.pause { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px var(--ok-soft); } }
.clock-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; }
.clock-btn { min-height: 46px; padding: 0 20px; font-size: 15px; }
.clock-order { width: auto; max-width: 280px; min-height: 46px; }
.clock-note { width: 260px; min-height: 46px; }
.clock-team { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.clock-person { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; flex-wrap: wrap; }
.clock-person .clock-dot { width: 10px; height: 10px; box-shadow: none; animation: none; }
.clock-person-name { font-weight: 600; }
.clock-person .btn { margin-left: auto; }

/* ==========================================================================
   Aufgaben (Kanban)
   ========================================================================== */

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.column {
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  transition: background 0.15s, box-shadow 0.15s;
}
.column.drag-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.column-head h2 { font-size: 14px; }
.column-head .count { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 0 8px; }
.column-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }

.task {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}
.task:hover { border-color: var(--border-strong); }
.task.dragging { opacity: 0.4; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.task-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-foot .avatar { margin-left: auto; }
.column[data-status="done"] .task-title { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--muted); }

.add-task {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 580;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.add-task:hover { color: var(--text); border-color: var(--muted); background: var(--surface); }

/* ==========================================================================
   Team
   ========================================================================== */

.people { display: flex; flex-direction: column; }
.person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.person:first-child { border-top: 0; }
.person.inactive { opacity: 0.55; }
.person-name { font-weight: 650; }
a.person-name { color: var(--text); display: inline-block; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.import-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 52vh; overflow-y: auto; }
.import-row { display: grid; grid-template-columns: auto 4px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.import-row:first-child { border-top: 0; }
.import-row:hover { background: var(--surface-2); }
.import-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.import-bar { align-self: stretch; border-radius: 4px; min-height: 28px; }
.import-main { display: flex; flex-direction: column; min-width: 0; }
.import-title { font-weight: 600; overflow-wrap: anywhere; }
.import-meta { font-size: 13px; color: var(--muted); }
a.person-name:hover { color: var(--accent-ink); }
.person-mail { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.person-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================================================
   Dialoge & Meldungen
   ========================================================================== */

.dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog.dialog-wide { width: min(720px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(10, 15, 12, 0.5); }
.dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 22px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { font-size: 18px; }
.dialog-body { padding: 18px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.dialog-text { color: var(--muted); }

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 550;
  animation: toast-in 0.18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--accent); color: var(--accent-text); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ==========================================================================
   Anmeldeseite
   ========================================================================== */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.login-logo { border-radius: 15px; }
.login-card h1 { font-size: 28px; letter-spacing: -0.03em; }
.login-sub { color: var(--muted); margin-top: -6px; margin-bottom: 8px; }
.login-card .notice { width: 100%; text-align: left; }
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #fff;
  color: #1f1f1f;
  font-weight: 600;
  font-size: 15px;
  margin-top: 6px;
}
.google-btn:hover { background: #f7f8f8; text-decoration: none; }
.google-btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.login-foot { font-size: 13px; color: var(--faint); margin-top: 6px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-submit { min-height: 44px; font-size: 15px; margin-top: 4px; }
.me-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.me-button:hover { background: var(--surface-2); }

/* Datenschutzseite */

.legal-page { background: var(--bg); }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.65; }
.legal-brand { padding-left: 0; }
.legal h1 { font-size: 30px; margin: 8px 0 4px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal ul { margin: 0 0 12px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal-foot { margin-top: 32px; }
.login-links { font-size: 13px; color: var(--faint); }

/* ==========================================================================
   Kleinere Bildschirme
   ========================================================================== */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
    width: min(280px, 86vw);
  }
  .app.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .mobilebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobilebar-title { font-weight: 650; }
  .mobilebar-spacer { flex: 1; }
  .view { padding: 20px 16px 40px; }
  .dash-grid, .detail-grid, .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-side { order: -1; }
  .board { grid-template-columns: repeat(3, minmax(270px, 86vw)); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; padding-bottom: 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .column { scroll-snap-align: start; }
  .cal-box { height: calc(100dvh - 230px); min-height: 460px; }
  .cal-side-card .card-body { padding-top: 8px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .page-head h1, .greeting h1 { font-size: 23px; }
  .stats, .stats.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 23px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .order-row { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; gap: 10px; }
  .order-counts { display: none; }
  .entry { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; gap: 6px 12px; }
  .entry-time { grid-column: 1; }
  .entry-dur { grid-column: 2; grid-row: 1; text-align: right; }
  .entry-main { grid-column: 1 / -1; }
  .entry-actions { grid-column: 1 / -1; justify-content: flex-end; margin-top: -4px; }
  .day-head { padding: 14px 16px 6px; }
  .person { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px 16px; }
  .person-badges { grid-column: 2 / -1; justify-content: flex-start; }
  .lightbox { padding: 56px 8px; }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 12px; transform: none; }
  .dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .dialog-body { padding: 16px; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
  .agenda-item { grid-template-columns: 70px 4px minmax(0, 1fr); gap: 10px; }
  .search { max-width: none; }
  .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .cal-toolbar h2 { order: -1; width: 100%; }
  .clock-card { padding: 16px; }
  .clock-actions { width: 100%; }
  .clock-actions .clock-btn { flex: 1; }
  .clock-order, .clock-note { width: 100%; max-width: none; }
  .clock-time { font-size: 26px; }
  .month-switch strong { min-width: 120px; }
}

/* ---------- Sprachumschalter (DE | MN) ---------- */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-lang { align-self: flex-start; margin-left: 6px; }
.login-lang { align-self: flex-end; margin: -8px -8px 4px 0; }

/* ---------- Automatische Übersetzung ---------- */
.auto-translated { cursor: help; }
.auto-mark { display: inline-flex; vertical-align: -1px; margin-left: 5px; color: var(--accent); opacity: 0.75; }
.auto-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
}
.auto-box.full, .form-grid > .auto-box { grid-column: 1 / -1; margin-top: 0; }
.auto-box-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.auto-box-head .icon { color: var(--accent); }
.auto-box-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.auto-box-title { font-weight: 600; margin-bottom: 2px; }
.translate-card .field { margin-bottom: 10px; }
.translate-card .status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; }
.translate-card ol { margin: 0 0 14px 18px; padding: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------- Stunden: Reiter, Abrechnung, Standort der Stempeluhr ---------- */
.page-tabs { margin-bottom: 18px; }
.page-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 14px; }

.stat-strong .stat-value { color: var(--accent-ink); }
.payroll-table .act { width: 36px; text-align: right; padding-left: 8px; }
.payroll-table th.num, .payroll-table td.num { padding-left: 12px; white-space: nowrap; }
.payroll-table tfoot td { font-weight: 650; border-top: 2px solid var(--border-strong); }
.payroll-table tr.inactive .payroll-name button { color: var(--muted); }
.payroll-name { min-width: 0; }
.payroll-note { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.payroll-note.warn { color: var(--warn); }
.payroll-total strong { font-weight: 700; }
.payroll-hint { margin: 12px 0 0; font-size: 13px; color: var(--faint); }
.rate-history ul { list-style: none; margin: 6px 0 0; padding: 0; }
.rate-history li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--border); font-size: 14px; }

a.geo-tag { color: var(--accent-ink); background: var(--accent-soft); text-decoration: none; }
a.geo-tag:hover { text-decoration: underline; }
a.geo-tag.geo-rough { color: var(--warn); background: var(--warn-soft); }
.geo-acc { font-weight: 500; opacity: 0.8; }
.clock-sub a.geo-tag { vertical-align: 1px; }
.clock-geo-error { margin-top: 14px; }
.clock-btn .spinner { width: 16px; height: 16px; border-color: color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; }

@media (max-width: 640px) {
  .page-tabs { display: flex; }
  .page-tabs button { flex: 1; justify-content: center; }
  /* Abrechnung am Handy: jede Person als Block statt breiter Tabelle */
  .payroll-table thead { display: none; }
  .payroll-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
  .payroll-table td { border-top: 0; padding: 0; }
  .payroll-table td.payroll-name, .payroll-table tfoot td:first-child { grid-column: 1; grid-row: 1; font-size: 15px; }
  .payroll-table td.act { grid-column: 2; grid-row: 1; }
  .payroll-table td.num { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-left: 0; font-size: 14px; }
  .payroll-table td.num::before { content: attr(data-label); color: var(--muted); }
  .payroll-table td.payroll-total { font-size: 15px; }
  .payroll-table td.hide-sm { display: none; }
  .payroll-table tfoot tr { border-top: 2px solid var(--border-strong); }
  .payroll-table tfoot td { border-top: 0; }
}

/* ---------- Stempeluhr: Foto beim Einstempeln (Geoshot) ---------- */
.geoshot { display: flex; flex-direction: column; gap: 12px; }
.geoshot-intro { margin: 0; color: var(--muted); font-size: 14px; }
.geoshot-frame { position: relative; background: #000; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.geoshot-video, .geoshot-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.geoshot-video.mirror { transform: scaleX(-1); }
.geoshot-video[hidden], .geoshot-canvas[hidden] { display: none; }
.geoshot-message { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.geoshot-locrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.geoshot-loc { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.geoshot-loc .spinner { width: 14px; height: 14px; }
.geoshot-loc-error { color: var(--warn); }
.geoshot-view { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.geoshot-img { max-width: 100%; max-height: 70vh; border-radius: var(--radius-sm); display: block; }
button.photo-tag { border: 0; font: inherit; font-size: 12px; font-weight: 560; cursor: pointer; }
button.photo-tag:hover { text-decoration: underline; }
.dialog-foot .btn .spinner, .clock-btn .spinner { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .geoshot-frame { aspect-ratio: 3 / 4; }
  .dialog-foot:has(.geoshot-shoot) { flex-wrap: wrap; }
}
.phone-only-url { font-weight: 700; font-size: 17px; margin: 4px 0 14px; word-break: break-all; }

/* ---------- Kamera/Standort: Hilfe, wenn etwas blockiert ist ---------- */
.geoshot-help { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.geoshot-help-text { margin: 0; font-weight: 600; }
.geoshot-steps { margin: 8px 0 0 18px; padding: 0; color: var(--text); line-height: 1.5; }
.geoshot-steps li + li { margin-top: 3px; }
.geoshot-help-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.geoshot-help-slot:empty { display: none; }

/* ---------- Mitarbeiterprofil ---------- */
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.profile-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.profile-status { margin-bottom: 18px; }
.profile-days .card-body { padding-left: 0; padding-right: 0; }
.doc-day .day-head { padding-top: 6px; }
.doc-entry { display: flex; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--border); }
.profile-status .doc-entry { border-top: 0; padding: 0; }
.doc-photo { flex: none; width: 92px; height: 92px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); padding: 0; cursor: zoom-in; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.doc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-photo.empty { cursor: default; }
.doc-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.doc-time { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.doc-time .clock-dot { width: 10px; height: 10px; box-shadow: none; animation: none; }
.doc-dur { margin-left: auto; font-weight: 700; }
.doc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
a.tag { text-decoration: none; }
.doc-note { font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.thumb .thumb-label { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 650; color: #fff; background: rgba(0, 0, 0, 0.55); border-radius: 4px; padding: 0 5px; }
.doc-files { list-style: none; margin: 12px 0 0; padding: 0; }
.doc-files li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.doc-files li a:not(.tag) { overflow-wrap: anywhere; }
.doc-tasks { list-style: none; margin: 0; padding: 0; }
.doc-tasks li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.doc-tasks li:first-child { border-top: 0; }
.doc-tasks li.done .doc-task-title { text-decoration: line-through; color: var(--muted); }
.doc-task-title { flex: 1; min-width: 120px; overflow-wrap: anywhere; }
.doc-pay-line { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; font-variant-numeric: tabular-nums; }
.doc-pay-line:first-child { border-top: 0; }
.doc-pay-line.strong { font-weight: 700; font-size: 15px; border-top: 2px solid var(--border-strong); }
@media (max-width: 960px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .doc-entry { padding: 12px 16px; gap: 12px; }
  .doc-photo { width: 72px; height: 72px; }
}

/* ---------- Mitarbeiterprofil: Kopf und Protokoll ---------- */
.person-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.log { list-style: none; margin: 0; padding: 0; }
.log-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.log-item:first-child { border-top: 0; }
.log-when { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.log-title { font-size: 14px; line-height: 1.5; }
.log-detail { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.profile-card .gallery { grid-template-columns: repeat(auto-fill, minmax(84px, 96px)); }

/* ---------- Übersetzung korrigieren ---------- */
.auto-box-head > span:not(.icon) { flex: 1; }
.auto-box-fix {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 650;
  padding: 2px 4px; border-radius: 6px; cursor: pointer;
}
.auto-box-fix:hover { background: var(--accent-soft); }
.auto-original { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 14px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--surface-2); }
.glossary-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.glossary-head { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.glossary-head span:last-child { width: 34px; }

/* ==========================================================================
   Aufträge: Art, eingeteilte Mitarbeiter, Kalender | Liste
   ========================================================================== */

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  color: var(--type);
  background: color-mix(in srgb, var(--type) 13%, transparent);
}
.type-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--type); }
@media (prefers-color-scheme: dark) {
  .type-badge { color: color-mix(in srgb, var(--type) 55%, #fff); background: color-mix(in srgb, var(--type) 28%, transparent); }
}
.order-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }

.order-row { position: relative; box-shadow: inset 3px 0 0 var(--type, transparent); }
.order-link { display: block; color: inherit; }
.order-link:hover { text-decoration: none; }
.order-link::after { content: ""; position: absolute; inset: 0; }
.order-link:focus-visible { outline: none; }
.order-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }

.order-team { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 100%; }
.assign-btn {
  position: relative;
  z-index: 1;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 10px 3px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  min-height: 30px;
}
.assign-btn:not(.is-empty) { border-style: solid; border-color: var(--border); }
.assign-btn:hover { color: var(--text); border-color: var(--accent); }
.assignees { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.assignee { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 560; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }

.filter-select { width: auto; max-width: 100%; }

.assign-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 52vh; overflow-y: auto; }
.assign-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); cursor: pointer; min-height: 44px; }
.assign-row:first-child { border-top: 0; }
.assign-row:hover { background: var(--surface-2); }
.assign-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.assign-name { font-weight: 560; }

.type-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.type-legend li { display: flex; align-items: center; gap: 6px; }
.type-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.fc .no-order { opacity: 0.85; }

/* Stundenzettel: Auftrag mit Farbe der Art, Einsätze ohne Stunden */
.order-tag { color: var(--text); box-shadow: inset 3px 0 0 var(--type); padding-left: 8px; }
.assign-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.assign-entry:first-of-type { border-top: 0; }
.assign-entry-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.assign-entry-order { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.assign-entry-order a { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .assign-entry { flex-direction: column; align-items: stretch; }
  .filter-select { flex: 1 1 140px; }
}
