@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Neutral palette (soft zinc, less blue than slate) */
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e7e7ea;
  --border-strong: #d6d6da;
  --text: #18181b;
  --text-muted: #71717a;
  --primary: #18181b;
  --primary-fg: #ffffff;

  /* Brand accent */
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #f5f3ff;
  --accent-border: #e4dcff;

  /* Semantic (Ampel) */
  --rot: #dc2626;
  --gelb: #d97706;
  --gruen: #16a34a;
  --grau: #a1a1aa;

  /* Radius scale */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Layered shadows */
  --shadow-sm: 0 1px 2px rgba(24,24,27,.05);
  --shadow: 0 1px 2px rgba(24,24,27,.04), 0 2px 6px rgba(24,24,27,.06);
  --shadow-md: 0 4px 14px rgba(24,24,27,.09);
  --shadow-lg: 0 16px 40px rgba(24,24,27,.16);

  --gap: 1.15rem;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Tabular figures for all the numbers (KW, hours, capacity, dates) */
.auftrag-nummer, .cap-bar, .month-day-num, .stepper-val,
.week-day-header, .dp-entry, .badge { font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); color: var(--accent-hover); }

/* ── Layout ── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--primary);
  color: var(--primary-fg);
  padding: .7rem 1.15rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, var(--shadow-md);
}

.topbar-brand {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: .01em;
  color: inherit;
  text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }

.topbar nav { display: flex; gap: .15rem; margin-left: .5rem; }
.topbar nav a {
  color: rgba(255,255,255,.62);
  text-decoration: none;
  padding: .38rem .7rem;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.15); color: #fff; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .55rem;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: none;
  background: var(--accent);
}

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 1px 2px rgba(24,24,27,.12);
  letter-spacing: .02em;
}

main { flex: 1; padding: var(--gap); max-width: 1120px; margin: 0 auto; width: 100%; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.15rem; }
.card-header {
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .05s;
  min-height: 36px;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--grau); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #3f3f46; border-color: #3f3f46; }
.btn-accent  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger  { background: #fef2f2; color: var(--rot); border-color: #fecaca; box-shadow: none; }
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }
.btn-sm { padding: .3rem .65rem; font-size: 12px; min-height: 30px; }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; }

/* ── Form ── */
.form-group { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
input[type=text], input[type=date], input[type=time], input[type=email],
input[type=number], input[type=password], select, textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .45rem .65rem;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,58,237,.12);
}
textarea { resize: vertical; min-height: 70px; }

.input-row { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .input-row { grid-template-columns: 1fr; } }

/* ── Aufwand chips ── */
.aufwand-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.aufwand-chip {
  padding: .35rem .7rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: var(--surface);
  transition: all .12s;
}
.aufwand-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Ampel ── */
.ampel-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}
.ampel-rot  { background: var(--rot); }
.ampel-gelb { background: var(--gelb); }
.ampel-gruen { background: var(--gruen); }
.ampel-grau { background: var(--grau); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-offen         { background: #f4f4f5; color: #52525b; border-color: #e4e4e7; }
.badge-in_arbeit     { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.badge-wartet_termin { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.badge-fertig        { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.badge-abgeholt      { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-border); }

/* ── Auftragsliste ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; align-items: center; }
.filter-chip {
  padding: .32rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background .14s, border-color .14s;
}
.filter-chip:hover { background: var(--surface-2); text-decoration: none; }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.auftrag-list { display: flex; flex-direction: column; gap: .5rem; }
.auftrag-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1.1rem;
  display: grid;
  grid-template-columns: 16px 80px 1fr auto;
  gap: .5rem .85rem;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .16s, border-color .16s, transform .06s;
}
.auftrag-row:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  text-decoration: none;
}

.auftrag-nummer { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: .01em; }
.auftrag-info   { min-width: 0; }
.auftrag-titel  { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auftrag-sub    { font-size: 12px; color: var(--text-muted); margin-top: .1rem; }
.auftrag-meta   { text-align: right; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 580px) {
  .auftrag-row {
    grid-template-columns: 16px 1fr auto;
    grid-template-rows: auto auto;
  }
  .auftrag-nummer { grid-column: 2; grid-row: 2; }
  .auftrag-info   { grid-column: 2; grid-row: 1; }
  .auftrag-meta   { grid-column: 3; grid-row: 1/3; }
}

/* ── Auftrag detail ── */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 0 1.15rem; align-items: start; }
@media (min-width: 920px) {
  .detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}
.detail-main, .detail-side { min-width: 0; }

.auftrag-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.auftrag-header h1 { font-size: 1.2rem; font-weight: 700; margin-bottom: .35rem; }
.auftrag-header-meta { display: flex; flex-wrap: wrap; gap: .5rem .9rem; font-size: 13px; color: var(--text-muted); }

.runde-card {
  border: 1.5px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.runde-card-header {
  padding: .75rem 1.1rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.runde-card-body   { padding: 1.1rem; }
.action-buttons    { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }

.verlauf { display: flex; flex-direction: column; gap: .5rem; }
.verlauf-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.verlauf-item:last-child { border-bottom: none; }
.verlauf-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.verlauf-body { flex: 1; min-width: 0; }
.verlauf-title { font-weight: 500; }
.verlauf-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 1rem;
}
.modal-body    { padding: 1.25rem; }
.modal-footer  { padding: .75rem 1.25rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ── Week board ── */
.week-board {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.week-day-header {
  background: var(--surface);
  padding: .5rem .75rem;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
}
.week-person-label {
  background: var(--bg);
  padding: .5rem .65rem;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.week-cell {
  background: var(--surface);
  min-height: 80px;
  padding: .4rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.week-cell.over-cap { background: #fef2f2; }

/* Spalten dürfen schmaler werden als ihr Inhalt → Karten kürzen statt Grid sprengen */
.week-board > div { min-width: 0; }
.week-cell { min-width: 0; }
.plan-card { min-width: 0; max-width: 100%; }
.plan-card-title { min-width: 0; }

.plan-card {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: .35rem .55rem;
  font-size: 12px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .14s;
}
.plan-card:hover { box-shadow: var(--shadow-md); }
.plan-card.entwurf { opacity: .6; border-style: dashed; }
.plan-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.termin-block {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 5px;
  padding: .3rem .5rem;
  font-size: 11px;
  color: #92400e;
}

.cap-bar { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: .15rem; }
.cap-bar.over { color: var(--rot); font-weight: 600; }

/* ── Monat grid ── */
.month-grid {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
  gap: 1px;
}
.month-day {
  background: var(--surface);
  padding: .5rem;
  min-height: 70px;
  position: relative;
}
.month-day.weekend { background: var(--bg); }
.month-day-num { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }
.dp-entry {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: 11px;
  border-radius: 4px;
  padding: .1rem .35rem;
  margin: .1rem .1rem 0 0;
  cursor: pointer;
  border: 1px solid transparent;
}
.dp-da     { background: #f0fdf4; border-color: #bbf7d0; }
.dp-urlaub { background: #fefce8; border-color: #fef08a; }
.dp-krank  { background: #fef2f2; border-color: #fecaca; }

/* ── Heute ── */
.heute-cards { display: flex; flex-direction: column; gap: .75rem; }
.heute-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.heute-card-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.heute-card-sub   { font-size: 13px; color: var(--text-muted); margin-top: .1rem; }
.heute-actions    { display: flex; gap: .5rem; margin-top: .85rem; }
.btn-heute { padding: .7rem 1.2rem; font-size: 15px; border-radius: var(--radius-sm); }

/* ── Search ── */
.search-input {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .35rem .8rem;
  font-size: 13px;
  width: 200px;
  background: var(--surface);
}

/* ── Flash ── */
.flash {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 13px;
  font-weight: 500;
}
.flash-info  { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.flash-error { background: #fef2f2; color: var(--rot); border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Login ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
  background:
    radial-gradient(1100px 600px at 50% -20%, #2a2a30 0%, rgba(42,42,48,0) 60%),
    var(--primary);
}
.login-card { width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); border: none; }
.login-card .card-header { justify-content: center; padding-top: 1.1rem; padding-bottom: .9rem; }

/* ── Misc ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: .5rem;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }

.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }
.text-rot   { color: var(--rot); }
.text-gelb  { color: var(--gelb); }
.text-gruen { color: var(--gruen); }

.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.gap-4 { gap: 1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.suggestion-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: .75rem 1rem;
  margin-bottom: .4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  transition: background .12s;
}
.suggestion-btn:hover { background: var(--bg); }
.suggestion-btn.primary {
  border-color: var(--accent);
  background: #f5f3ff;
  font-weight: 600;
}
.suggestion-btn .sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }

[x-cloak] { display: none !important; }

.tag-chip {
  display: inline-block;
  padding: .1rem .45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Position stepper */
.stepper { display: flex; align-items: center; gap: .4rem; }
.stepper-val { font-size: 14px; font-weight: 600; min-width: 60px; text-align: center; }

/* Drag ghost */
.sortable-ghost { opacity: .35; }
.sortable-chosen { cursor: grabbing; }

/* ── Auftrag-Liste: Zeilen-Löschen ── */
.auftrag-row-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.auftrag-row-wrap .auftrag-row {
  flex: 1;
  border-radius: var(--radius) 0 0 var(--radius);
}
.auftrag-del-form {
  display: flex;
  align-items: center;
}
.auftrag-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.auftrag-row-wrap:hover .auftrag-del-btn { opacity: 1; }
.auftrag-del-btn:hover { background: #fef2f2; color: var(--rot); }

/* ── Weekend cell ── */
.weekend-cell { background: color-mix(in srgb, var(--border) 30%, var(--surface)); }

/* ── Todos sidebar ── */
.todos-fab-wrap {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  right: calc(1.5rem + env(safe-area-inset-right, 0px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
}

.todos-fab {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: background .15s;
}
.todos-fab:hover, .todos-fab.active { background: #6d28d9; }

.todos-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--rot);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: .05rem .3rem;
  min-width: 18px;
  text-align: center;
}

.todos-panel {
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  width: 300px;
  max-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .15s, transform .15s;
  z-index: 199;
}
.todos-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.todos-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.todos-list {
  flex: 1;
  overflow-y: auto;
  padding: .35rem 0;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  transition: background .1s;
}
.todo-item:hover { background: var(--bg); }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-muted); }

.todo-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gruen);
}
.todo-check.checked { background: var(--gruen); border-color: var(--gruen); color: #fff; }

.todo-text { flex: 1; font-size: 13px; }

.todo-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 .1rem;
  opacity: 0;
  transition: opacity .1s;
}
.todo-item:hover .todo-del { opacity: 1; }

.todos-add {
  display: flex;
  gap: .35rem;
  padding: .5rem .75rem;
  border-top: 1px solid var(--border);
}

.todos-input {
  flex: 1;
  padding: .3rem .5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
.todos-input:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ── To-Do Kategorien ── */
.kat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.todo-group { margin-bottom: .35rem; }
.todos-group-head {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .75rem .2rem;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted);
}
.todos-group-count { font-weight: 700; }
.todo-drop { min-height: 4px; padding: 1px 0; }
.todo-drop:empty { min-height: 16px; }
.todos-list .todo-item { cursor: grab; }
.todos-list .todo-item:active { cursor: grabbing; }
.todos-list .todo-check, .todos-list .todo-del { cursor: pointer; }
.sortable-ghost { opacity: .4; }
.todos-katmanage { padding: .35rem .5rem .5rem; overflow-y: auto; }
.todos-kat-row { display: flex; align-items: center; gap: .45rem; padding: .35rem .25rem; font-size: 13px; border-bottom: 1px solid var(--border); }
.todos-kat-add { display: flex; gap: .35rem; align-items: center; margin-top: .5rem; }
.todos-kat-add input[type=color] { width: 30px; height: 30px; border: none; padding: 0; background: none; cursor: pointer; flex-shrink: 0; }
.todos-kat-select {
  border: 1px solid var(--border); border-radius: 4px; font-size: 12px;
  background: var(--bg); color: var(--text); max-width: 82px; padding: .3rem;
}

/* ═══════════════════════════════════════════
   Mobile (Handy)
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Topbar: Marke + Profil in Zeile 1, Navigation scrollt in Zeile 2 */
  .topbar { flex-wrap: wrap; padding: .55rem .8rem; gap: .4rem .5rem; }
  .topbar-brand { order: 1; font-size: .98rem; }
  .topbar-right { order: 2; margin-left: auto; }
  .topbar nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: .1rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex: 0 0 auto; white-space: nowrap; padding: .35rem .6rem; }

  main { padding: .85rem; }
  .page-header h2 { font-size: 1.1rem; }

  /* Beide FABs auf gleicher Höhe, sicher über der Handy-Leiste */
  .todos-fab-wrap {
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    right: calc(.85rem + env(safe-area-inset-right, 0px));
  }

  /* Panel füllt kleine Screens, bleibt über der FAB-Reihe */
  .todos-panel {
    width: calc(100vw - 1.7rem);
    max-width: 340px;
    right: calc(.85rem + env(safe-area-inset-right, 0px));
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Sehr schmale Geräte: FABs etwas kleiner, näher an die Ecke */
@media (max-width: 380px) {
  .todos-fab { width: 46px; height: 46px; }
}
