:root {
  --bg: #f6f5f3;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #9d174d;
  --accent-soft: #fce7f3;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --card: #292524;
    --ink: #f5f5f4;
    --muted: #a8a29e;
    --line: #44403c;
    --accent: #f472b6;
    --accent-soft: #4c1d3d;
    --danger: #f87171;
    --ok: #4ade80;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 5.5rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main { padding: 0.75rem; max-width: 720px; margin: 0 auto; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0.9rem calc(0.9rem + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.top-title { font-size: 1.15rem; font-weight: 650; }

/* Нижняя панель: большой палец достаёт до неё, не перехватывая телефон. */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
}

.tabs a span { font-size: 1.25rem; line-height: 1; }
.tabs a.on { color: var(--accent); font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.6rem;
}

.card.done { opacity: 0.55; }
.card.gone { opacity: 0.55; }
.card.gone .visit-title { text-decoration: line-through; }

.visit { display: flex; gap: 0.75rem; align-items: flex-start; }
.visit-time { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3.4rem; }
.visit-body { flex: 1; min-width: 0; }
.visit-title { font-weight: 600; }
.visit-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }
.stripe { width: 4px; align-self: stretch; border-radius: 2px; background: var(--accent); }

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.right { text-align: right; }

a.btn, button, .chip {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  min-height: 2.6rem;
}

button.primary, a.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 0.4rem 0.5rem; min-height: 2.2rem; }
button.danger { color: var(--danger); }
button.ok { color: var(--ok); }

.chip {
  padding: 0.5rem 0.7rem;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--ink);
}

.slots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }

label { display: block; margin-bottom: 0.75rem; }
label > span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  min-height: 2.8rem;
}

textarea { min-height: 4.5rem; resize: vertical; }
input[type="checkbox"] { width: auto; min-height: 0; }

.error {
  background: var(--accent-soft);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.75rem;
}

.daybar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.5rem; }
.daybar .name { font-weight: 650; }

.weekday { display: flex; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.weekday:last-child { border-bottom: 0; }
.weekday .label { min-width: 2.5rem; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.pill { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent-soft); }
