/* =========================================================
   Stundentracker – Stylesheet
   Farben kommen als CSS-Variablen aus lib/theme.php.
   ========================================================= */

@font-face {
  font-family: 'Delight';
  src: url('fonts/Delight-Regular.woff2') format('woff2'),
       url('fonts/Delight-Regular.woff') format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Delight';
  src: url('fonts/Delight-Bold.woff2') format('woff2'),
       url('fonts/Delight-Bold.woff') format('woff');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Delight';
  src: url('fonts/Delight-Black.woff2') format('woff2'),
       url('fonts/Delight-Black.woff') format('woff');
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --accent: #1a1a1a;
  --accent-text: #ffffff;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #141414;
  --muted: #767676;
  --border: #e6e6e6;
  --positive: #16794f;
  --placeholder: #a8a8a8;
  --danger: #c2412d;
  --radius: 10px;
  /* Fallback, falls lib/theme.php nicht eingebunden ist (z. B. setup.php) */
  --caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23767676' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767676' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='3.5' y='5' width='17' height='16' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --font: 'Delight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --gap: 20px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }

/* Fokusrahmen nur bei Tastaturbedienung zeigen, nicht beim Mausklick. */
:focus:not(:focus-visible) { outline: none; }
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.info-btn:focus-visible,
.brand-home:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html, body {
  margin: 0; padding: 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%;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 15px; }
h3 { font-size: 17px; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
       background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.brand-home {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: none; color: inherit; font: inherit;
  padding: 4px 6px; margin-left: -6px; border-radius: var(--radius); cursor: pointer;
  transition: background .15s;
}
.brand-home:hover { background: var(--bg); }
.brand-logo { display: flex; width: 26px; height: 26px; color: var(--accent); }
.brand-logo svg, .brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-weight: 900; letter-spacing: -0.02em; font-size: 16px; white-space: nowrap; }

.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0; padding: 0;
  border: 0; background: none; color: var(--muted); cursor: pointer;
  border-radius: 50%; transition: color .15s, background .15s;
}
.info-btn:hover { color: var(--accent); background: var(--bg); }
.info-btn svg { width: 16px; height: 16px; }

.tabs { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 700;
  padding: 7px 12px; border-radius: var(--radius); cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); background: var(--bg); }
.tab.is-active { color: var(--accent-text); background: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); cursor: pointer;
  text-decoration: none; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1080px; margin: 0 auto;
  padding: var(--gap) max(16px, env(safe-area-inset-left))
           calc(var(--gap) + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
  display: grid; gap: var(--gap);
}
.view { display: none; }
.view.is-active { display: grid; gap: var(--gap); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { text-transform: uppercase; font-size: 11px; letter-spacing: .09em; color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* ---------- Formulare ---------- */
.input {
  width: 100%; font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
/* Der Pfeil kommt als --caret aus lib/theme.php und traegt dort die
   gedimmte Textfarbe des aktuellen Schemas. background-size ist
   zwingend: ohne die Angabe skaliert das SVG auf die volle Feldhoehe.
   Gilt nur noch fuer nicht aufgewertete Felder (setup.php, kein JS). */
select.input {
  background-image: var(--caret);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 9px 9px;
  padding-right: 26px;
}

.input::placeholder { color: var(--placeholder); opacity: 1; }
.input::-webkit-input-placeholder { color: var(--placeholder); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; }
textarea.input { line-height: 1.45; }

/* ---------- Eigene Auswahlfelder und Datepicker ---------- */
/* Das native <select> bzw. <input type=date> bleibt im DOM erhalten und
   ist weiterhin die Datenquelle – es wird nur unsichtbar gemacht. */
.cs { position: relative; display: block; width: 100%; }
.cs-native {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; border: 0; padding: 0; margin: 0;
}
.cs-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 14px; text-align: left;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 28px 9px 11px; cursor: pointer; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.cs-btn:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
.cs-btn:focus-visible,
.cs.is-open .cs-btn {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.cs-btn::after {
  content: ''; position: absolute; right: 10px; top: 50%; margin-top: -4px;
  width: 9px; height: 9px; background: var(--caret) no-repeat center / 9px 9px;
  transition: transform .18s;
}
.cs.is-open .cs-btn::after { transform: rotate(180deg); }
.cs-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-btn.is-empty .cs-label { color: var(--placeholder); }
.cs-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cs-logo {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.cs-logo img { width: 100%; height: 100%; object-fit: contain; padding: 1px; }

.pop {
  position: fixed; z-index: 300;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px); box-shadow: var(--shadow);
  padding: 5px; overflow: auto; overscroll-behavior: contain;
}
.pop[hidden] { display: none; }

.cs-search { padding: 4px 4px 7px; position: sticky; top: -5px; background: var(--surface); }
.cs-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 14px; text-align: left; color: var(--text);
  background: none; border: 0; border-radius: calc(var(--radius) - 2px);
  padding: 8px 10px; cursor: pointer;
}
.cs-opt:hover, .cs-opt.is-cursor { background: var(--bg); }
.cs-opt.is-selected { font-weight: 700; }
.cs-opt.is-selected::after {
  content: '✓'; margin-left: auto; color: var(--accent); font-size: 12px; padding-left: 8px;
}
.cs-group {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 9px 10px 4px;
}
.cs-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* Aktionszeile am Fuß der Liste, z. B. „Neues Projekt anlegen“ */
.cs-action-wrap {
  position: sticky; bottom: -5px; background: var(--surface);
  border-top: 1px solid var(--border); margin-top: 5px; padding-top: 5px;
}
.cs-action {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 13px; font-weight: 700; text-align: left;
  color: var(--accent); background: none; border: 0;
  border-radius: calc(var(--radius) - 2px); padding: 9px 10px; cursor: pointer;
}
.cs-action:hover { background: var(--bg); }
.cs-action-icon { display: flex; flex-shrink: 0; }
.cs-action-icon svg { width: 14px; height: 14px; }

/* Datepicker */
.dp-btn { padding-right: 34px; }
.dp-btn::after {
  content: ''; position: absolute; right: 10px; top: 50%; margin-top: -7px;
  width: 14px; height: 14px; background: var(--cal) no-repeat center / 14px 14px;
  transform: none;
}
.dp-pop { padding: 12px; width: 268px; }
.dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.dp-title {
  flex: 1; text-align: center; font-weight: 700; font-size: 14px;
  background: none; border: 0; color: var(--text); font-family: inherit;
  cursor: pointer; border-radius: calc(var(--radius) - 2px); padding: 5px 8px;
}
.dp-title:hover { background: var(--bg); }
.dp-nav {
  width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--muted); cursor: pointer;
  border-radius: calc(var(--radius) - 2px); font-size: 15px; line-height: 1;
}
.dp-nav:hover { background: var(--bg); color: var(--text); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd {
  font-size: 10px; font-weight: 700; color: var(--muted); text-align: center;
  padding-bottom: 5px; text-transform: uppercase; letter-spacing: .04em;
}
.dp-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums;
  border: 1px solid transparent; background: none; color: var(--text);
  border-radius: calc(var(--radius) - 2px); cursor: pointer; padding: 0;
}
.dp-day:hover { background: var(--bg); }
.dp-day.is-out { color: var(--placeholder); }
.dp-day.is-today { border-color: var(--border); font-weight: 700; }
.dp-day.is-selected {
  background: var(--accent); color: var(--accent-text);
  border-color: var(--accent); font-weight: 700;
}
.dp-month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dp-month {
  font: inherit; font-size: 13px; padding: 10px 4px; border: 1px solid transparent;
  background: none; color: var(--text); border-radius: calc(var(--radius) - 2px); cursor: pointer;
}
.dp-month:hover { background: var(--bg); }
.dp-month.is-selected { background: var(--accent); color: var(--accent-text); }
.dp-foot {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.dp-foot .btn { flex: 1; font-size: 13px; padding: 6px 10px; }

.field, .field-sm { display: grid; gap: 5px; }
.field > span, .field-sm > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.field-sm > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.stack { display: grid; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 14px; font-weight: 700;
  padding: 9px 15px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { opacity: .88; border-color: var(--accent); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); }
.btn-sm { font-size: 13px; padding: 6px 11px; }
.btn-lg { font-size: 15px; padding: 12px 26px; }

/* ---------- Timer ---------- */
.timer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); padding: 26px 18px;
  display: grid; gap: 20px; justify-items: center;
}
.timer-card.is-running { border-color: var(--accent); }
.timer-display {
  font-size: clamp(40px, 12vw, 60px); font-weight: 900;
  letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
  line-height: 1; color: var(--text);
}
.timer-card.is-running .timer-display { color: var(--accent); }
.timer-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: center; width: 100%; max-width: 760px;
}
/* Das Projektfeld wird von JS in einen .cs-Wrapper gepackt – die
   Flex-Regel muss deshalb am Wrapper hängen, nicht am <select>. */
.timer-form .cs[data-for="timerProject"] { flex: 0 1 190px; }
.timer-form #timerDesc { flex: 1 1 240px; }

/* ---------- Statistik ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); padding: 14px 16px;
}

/* Auf dem Erfassen-Bildschirm stehen die vier Kennzahlen mittig:
   Inhalt zentriert und die Gruppe als Block in der Seitenmitte. */
.view[data-view="track"] .stat-row {
  display: flex; flex-wrap: wrap; justify-content: center;
}
.view[data-view="track"] .stat {
  flex: 1 1 160px; max-width: 250px; text-align: center;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 24px; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 3px; }
/* Bei mehreren Währungen wird der Wert länger – dann kleiner setzen. */
.stat-value--money { font-size: clamp(16px, 4.4cqi, 24px); overflow-wrap: anywhere; }
.stat { container-type: inline-size; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ---------- Chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 5px; }
.chart-fill { background: var(--accent); border-radius: 3px; min-height: 2px; opacity: .85; transition: height .3s; }
.chart-bar.is-empty .chart-fill { background: var(--border); }
.chart-label { font-size: 9px; color: var(--muted); text-align: center; letter-spacing: -.02em; }

/* ---------- Einträge ---------- */
.entry-list { display: grid; }
.entry {
  display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 12px;
  align-items: center; padding: 11px 0; border-top: 1px solid var(--border);
}
.entry:first-child { border-top: 0; }
.entry-check { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.entry-list:not(.entry-list--full) .entry-check { display: none; }
.entry-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.entry-logo {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.entry-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.entry-main { min-width: 0; }
.entry-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-right { text-align: right; }
.entry-dur { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; white-space: nowrap; }
.entry-amount { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.entry-acts { display: flex; gap: 4px; }
.entry-acts button {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 5px; border-radius: 6px; display: flex;
}
.entry-acts button:hover { color: var(--text); background: var(--bg); }
.entry-acts svg { width: 15px; height: 15px; }

.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  vertical-align: 1px; margin-left: 9px;
}
.badge + .badge { margin-left: 5px; }
.badge--invoiced { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 35%, var(--border)); }
.badge--nonbill { color: var(--muted); background: var(--bg); }

/* Die Kennzahlen stehen auch auf der Einträge-Seite mittig. */
.summary-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.summary-bar .stat { flex: 1 1 150px; max-width: 250px; text-align: center; }
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: calc(var(--radius) + 4px); padding: 10px 14px; font-size: 13px; font-weight: 700;
}

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.filters .grow { grid-column: span 2; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.is-active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.preset-group { margin-bottom: 4px; }
.preset-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
                color: var(--muted); font-weight: 700; margin-top: 12px; }
.chip-del {
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  padding: 0 0 0 2px; margin-left: 2px; opacity: .45; line-height: 1; font-size: 14px;
}
.chip-del:hover { opacity: 1; color: var(--danger); }

/* ---------- Kacheln (Projekte / Kunden) ---------- */
.tile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile {
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px);
  padding: 14px; display: grid; gap: 8px; position: relative; background: var(--surface);
  transition: border-color .15s;
}
.tile:hover { border-color: var(--text); }
.tile.is-archived { opacity: .5; }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-logo {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg);
}
.tile-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.tile-swatch { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.tile-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.tile-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tile-acts { display: flex; gap: 6px; margin-top: 2px; }

.empty { color: var(--muted); font-size: 13px; padding: 22px 0; text-align: center; }

/* ---------- Farbwähler ---------- */
.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.color-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
.color-item input[type=color] {
  width: 30px; height: 30px; padding: 0; border: 1px solid var(--border);
  border-radius: 7px; background: none; cursor: pointer; flex-shrink: 0;
}
.color-item input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-item input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-item-label { font-size: 12px; font-weight: 700; }
.color-item-hex { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }

.theme-preset { display: flex; align-items: center; gap: 7px; }
.theme-preset .dots { display: flex; gap: 3px; }
.theme-preset .dots i { width: 9px; height: 9px; border-radius: 50%; display: block; border: 1px solid rgba(0,0,0,.12); }

input[type=range] { width: 100%; accent-color: var(--accent); }

.logo-preview {
  display: flex; align-items: center; justify-content: center;
  height: 74px; border: 1px dashed var(--border); border-radius: var(--radius);
  margin-bottom: 12px; color: var(--accent); background: var(--bg);
}
.logo-preview svg, .logo-preview img { max-height: 46px; max-width: 190px; }
.logo-preview:empty::after { content: 'Keine Vorschau'; color: var(--muted); font-size: 12px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.42); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px); width: 100%; max-width: 540px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; }
.modal-body { padding: 0 18px 4px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 18px; flex-wrap: wrap; }
.modal-foot .spacer { margin-right: auto; }

/* ---------- Info ---------- */
.info-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.info-overlay[hidden] { display: none; }
.info-backdrop {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  animation: info-fade .28s ease-out;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .info-backdrop { background: color-mix(in srgb, var(--bg) 88%, transparent); }
}

.info-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 340px;
  border-radius: calc(var(--radius) + 14px);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .06);
  overflow: hidden;
  animation: info-rise .38s cubic-bezier(.2, .9, .3, 1.1);
}

/* Vier weiche Farbwolken, die langsam umeinander treiben. */
.info-clouds { position: absolute; inset: -35%; filter: blur(42px); opacity: .55; pointer-events: none; }
.info-clouds i { position: absolute; display: block; border-radius: 50%; }
.info-clouds i:nth-child(1) {
  width: 62%; height: 62%; left: 2%; top: 4%;
  background: color-mix(in srgb, var(--accent) 70%, transparent);
  animation: drift-a 19s ease-in-out infinite alternate;
}
.info-clouds i:nth-child(2) {
  width: 55%; height: 55%; right: 0; top: 16%;
  background: color-mix(in srgb, var(--positive) 60%, transparent);
  animation: drift-b 23s ease-in-out infinite alternate;
}
.info-clouds i:nth-child(3) {
  width: 58%; height: 58%; left: 16%; bottom: 2%;
  background: color-mix(in srgb, var(--accent) 42%, var(--surface));
  animation: drift-c 27s ease-in-out infinite alternate;
}
.info-clouds i:nth-child(4) {
  width: 42%; height: 42%; right: 14%; bottom: 12%;
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  animation: drift-d 31s ease-in-out infinite alternate;
}

.info-close {
  position: absolute; z-index: 2; top: 12px; right: 12px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text); backdrop-filter: blur(6px);
}
.info-close:hover { background: var(--surface); }
.info-close svg { width: 15px; height: 15px; }

.info-body {
  position: relative; z-index: 1;
  padding: 46px 28px 34px;
  display: grid; gap: 6px; justify-items: center; text-align: center;
}
.info-logo {
  display: flex; align-items: center; justify-content: center;
  width: 88px; height: 88px; margin-bottom: 14px;
  color: var(--accent);
  animation: info-pulse 3.6s ease-in-out infinite;
}
.info-logo svg, .info-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

.info-name { font-size: 21px; font-weight: 900; letter-spacing: -.03em; }
.info-version { font-weight: 400; color: var(--muted); font-size: 14px; letter-spacing: 0; }
.info-credits { font-size: 13px; color: var(--muted); }
.info-credits a {
  color: var(--text); font-weight: 700; text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 35%, transparent);
}
.info-credits a:hover { border-bottom-color: var(--text); }
.info-heart {
  color: var(--accent); display: inline-block;
  animation: info-beat 1.9s ease-in-out infinite;
}

@keyframes info-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes info-rise {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes info-pulse {
  0%, 100% { transform: scale(1);    opacity: .92; }
  50%      { transform: scale(1.07); opacity: 1; }
}
@keyframes info-beat {
  0%, 72%, 100% { transform: scale(1); }
  78%           { transform: scale(1.28); }
  86%           { transform: scale(1.05); }
}
@keyframes drift-a {
  from { transform: translate(0, 0)        scale(1); }
  to   { transform: translate(26%, 16%)    scale(1.18); }
}
@keyframes drift-b {
  from { transform: translate(0, 0)        scale(1.1); }
  to   { transform: translate(-22%, 22%)   scale(.9); }
}
@keyframes drift-c {
  from { transform: translate(0, 0)        scale(.95); }
  to   { transform: translate(20%, -20%)   scale(1.22); }
}
@keyframes drift-d {
  from { transform: translate(0, 0)        scale(1.15); }
  to   { transform: translate(-26%, -14%)  scale(.92); }
}

/* Wer Bewegung reduziert haben möchte, bekommt ein ruhiges Bild. */
@media (prefers-reduced-motion: reduce) {
  .info-clouds i, .info-logo, .info-heart, .info-card, .info-backdrop { animation: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 200;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast[hidden] { display: none; }
.toast.is-error { background: var(--danger); color: #fff; }

/* ---------- Login / Setup ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px); padding: 32px; width: 100%; max-width: 380px;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 16px; color: var(--accent); }
.auth-logo svg { max-height: 44px; max-width: 160px; }
.auth-title { font-size: 21px; font-weight: 900; letter-spacing: -.025em; text-align: center; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 22px; }
.alert {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius); padding: 9px 12px; font-size: 13px; margin: 0 0 14px;
}
.checklist { list-style: none; padding: 0; margin: 0 0 20px; font-size: 13px; display: grid; gap: 5px; }
.checklist .ok { color: var(--positive); }
.checklist .fail { color: var(--danger); font-weight: 700; }

/* ---------- Quick-Form ---------- */
.quick-grid {
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: 140px minmax(120px, 1fr) 120px minmax(140px, 2fr) auto auto;
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .quick-grid > :nth-child(4) { grid-column: span 2; }
  .quick-grid > :nth-child(6) { grid-column: span 2; }
  .filters .grow { grid-column: span 2; }
}

@media (max-width: 640px) {
  :root { --gap: 14px; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .brand-name { font-size: 15px; }
  .tabs { order: 3; width: 100%; margin-left: 0; padding-bottom: 2px; }
  .tab { padding: 6px 10px; font-size: 13px; }
  .icon-btn { margin-left: auto; }
  .card { padding: 14px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
  .timer-card { padding: 22px 14px; }
  /* In der Spaltenrichtung wird flex-basis zur HÖHE – deshalb hier
     zurücksetzen, sonst wird das Beschreibungsfeld 240 px hoch. */
  .timer-form { flex-direction: column; align-items: stretch; }
  .timer-form > *,
  .timer-form #timerDesc,
  .timer-form .cs[data-for="timerProject"] { flex: 0 0 auto; width: 100%; }
  .timer-form .btn { width: 100%; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-grid > * { grid-column: 1 !important; }
  .filters { grid-template-columns: 1fr 1fr; }
  .entry { grid-template-columns: auto auto 1fr auto; gap: 6px 9px; padding: 12px 0; }
  .entry-main { grid-column: 3; grid-row: 1; }
  .entry-acts { grid-column: 4; grid-row: 1; }
  .entry-right { grid-column: 3 / span 2; grid-row: 2; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .tile-list { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { max-width: 100%; max-height: 92vh; border-radius: calc(var(--radius) + 6px) calc(var(--radius) + 6px) 0 0; }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media print {
  .topbar, .timer-card, .bulk-bar, .preset-row, .filters, .row-actions, .entry-acts { display: none !important; }
  .card { border: 0; padding: 0; }
  body { background: #fff; }
}
