:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1f24; --muted: #6b6f78; --line: #e3e1dc;
  --accent: #2f5d50; --accent-ink: #ffffff; --today: #fff4d6; --danger: #b23a2e;
  --c-firma: #2f5d50; --c-kunde: #3a5fa8; --c-gemeinde: #8a5a1e; --c-privat: #8b3f78; --c-sonstiges: #5f6470;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b; --panel: #1d2025; --ink: #e8e6e1; --muted: #9a9ea6; --line: #2d3138;
    --accent: #6fb39e; --accent-ink: #0e1512; --today: #2e2a1c; --danger: #e0786c;
    --c-firma: #6fb39e; --c-kunde: #86a6e6; --c-gemeinde: #d8a660; --c-privat: #d18bc0; --c-sonstiges: #a3a8b2;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: transparent; background: transparent; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
input:focus, select:focus, textarea:focus, button:focus-visible, .cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
label.check input { width: auto; margin: 0; }

.brand { font-weight: 700; letter-spacing: .02em; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 4px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .brand { margin-bottom: 20px; font-size: 18px; }
.login-card button { width: 100%; padding: 10px; }
.msg { color: var(--danger); min-height: 1.2em; margin: 4px 0 10px; font-size: 14px; }

/* Leiste */
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav h1 { font-size: 18px; margin: 0 0 0 8px; font-weight: 600; }
.actions { display: flex; gap: 8px; align-items: center; }
.seg { display: flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.seg button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }

/* Monat */
.month { padding: 12px 16px 24px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays div { font-size: 12px; color: var(--muted); padding: 4px 6px; text-transform: uppercase; letter-spacing: .05em; }
.grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel); border-radius: 10px; overflow: hidden; }
.cell { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.cell:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cell.out { background: var(--bg); }
.cell.out .num { color: var(--muted); opacity: .6; }
.cell.today { background: var(--today); }
.cell.today .num { font-weight: 700; color: var(--accent); }
.num { font-size: 13px; padding: 2px 4px; }
.more { font-size: 12px; color: var(--muted); padding: 0 4px; }

.chip { display: block; width: 100%; text-align: left; font-size: 12px; padding: 2px 6px; border-radius: 5px; border: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.chip.by-claude { box-shadow: inset 3px 0 0 rgba(255,255,255,.55); }
@media (prefers-color-scheme: dark) { .chip { color: #111; } }
.cat-firma { --c: var(--c-firma); } .cat-kunde { --c: var(--c-kunde); } .cat-gemeinde { --c: var(--c-gemeinde); }
.cat-privat { --c: var(--c-privat); } .cat-sonstiges { --c: var(--c-sonstiges); }
.chip { background: var(--c); }

/* Liste */
.list { padding: 8px 16px 32px; max-width: 820px; margin: 0 auto; }
.list h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 20px 0 6px; }
.item { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; width: 100%; text-align: left; align-items: center; margin-bottom: 6px; padding: 10px 12px; border-left: 4px solid var(--c); }
.item .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.item .tag { font-size: 12px; color: var(--c); }
.empty { color: var(--muted); text-align: center; margin-top: 48px; }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); width: min(520px, calc(100vw - 32px)); padding: 24px; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: 0 0 16px; font-size: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meta { font-size: 12px; color: var(--muted); margin: 0; }
.buttons { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.spacer { flex: 1; }

@media (max-width: 720px) {
  .bar { padding: 10px 12px; }
  .nav h1 { font-size: 16px; }
  .month { padding: 8px 4px 16px; }
  .cell { min-height: 64px; padding: 2px; }
  .chip { font-size: 10px; padding: 1px 3px; }
  .row { grid-template-columns: 1fr; gap: 0; }
  .item { grid-template-columns: 1fr; gap: 2px; }
}
