:root {
  --linen: #fcf8f2;
  --card: #ffffff;
  --pink: #f4bebb;
  --pink-soft: #fbe4e2;
  --petrol: #1a5d74;
  --ink: #123f50;
  --muted: #5a6f77;
  --line: #e8ded3;
  --sage: #cfe6d5;
  --amber: #fbe9c8;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font: 16px/1.5 "Rubik", system-ui, -apple-system, sans-serif;
}
h1 { font-size: 22px; margin: 0; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 600; }
a { color: var(--petrol); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 12px; z-index: 30; }
.skip:focus { left: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bar { display: flex; align-items: center; justify-content: space-between; max-width: 860px; margin: 0 auto; padding: 20px 16px 8px; }
main { max-width: 860px; margin: 0 auto; padding: 8px 16px 120px; outline: none; }
[hidden] { display: none !important; }

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

.btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 999px; min-height: 44px; padding: 10px 20px;
  cursor: pointer; color: var(--ink); background: var(--card); border: 1.5px solid var(--line);
  transition: transform 90ms ease-in, background-color 180ms ease, opacity 180ms ease;
}
.btn:active { transform: scale(0.97); transition-duration: 90ms; }
.btn:not(:active) { transition-timing-function: ease-out; transition-duration: 180ms; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: var(--ink); }
.btn.primary:hover { background: #f0aaa6; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.wide { width: 100%; min-height: 56px; margin-top: 16px; }
.btn.ghost { background: transparent; border-color: var(--petrol); color: var(--petrol); }
.btn.undo { background: var(--pink); border-color: var(--pink); min-height: 40px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card.narrow { max-width: 420px; margin: 32px auto; }
label { display: block; font-weight: 500; margin: 12px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="time"], input[type="datetime-local"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 48px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--petrol); }
textarea { resize: vertical; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.notice { background: var(--amber); border-radius: 14px; padding: 12px 14px; margin: 8px 0; font-weight: 500; }
.notice.ok { background: var(--sage); }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.tabs [role="tab"] {
  font: inherit; font-weight: 500; white-space: nowrap; border: 0; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 10px 16px; min-height: 44px; cursor: pointer; transition: background-color 250ms ease, color 250ms ease;
}
.tabs [aria-selected="true"] { background: var(--pink); color: var(--ink); font-weight: 600; }

.filters { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-weight: 500; border-radius: 999px; min-height: 40px; padding: 6px 16px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line); transition: background-color 250ms ease, transform 90ms ease-in;
}
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); font-weight: 600; }
.chip .count { color: var(--petrol); font-weight: 600; margin-inline-start: 4px; }
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stepper strong { min-width: 150px; text-align: center; }

.bulk { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--linen); padding: 8px 0; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--petrol); margin: 0; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; animation: rise 220ms ease-out both; animation-delay: calc(var(--i, 0) * 40ms); }
.item.selected { border-color: var(--petrol); box-shadow: 0 0 0 2px var(--petrol) inset; }
.item.fade-out { opacity: 0; transform: translateY(-4px); transition: opacity 220ms ease, transform 220ms ease; }
.item-head { display: flex; align-items: flex-start; gap: 12px; }
.item-head .who { flex: 1; min-width: 0; }
.item-head .name { font-weight: 600; font-size: 18px; overflow-wrap: anywhere; }
.item-head .meta { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; font-size: 13px; font-weight: 500; border-radius: 999px; padding: 2px 10px; background: var(--pink-soft); margin-inline-end: 6px; }
.badge.sage { background: var(--sage); }
.badge.known { background: var(--amber); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn.big.primary { flex: 1 1 180px; }
.actions .btn { flex: 0 1 auto; }
.actions a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.resched { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.resched input { flex: 1 1 200px; }
.phone { direction: ltr; unicode-bidi: plaintext; }

.switch { display: flex; align-items: center; gap: 12px; margin: 16px 0; min-height: 44px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 32px; margin: 0; cursor: pointer; }
.switch .track { flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line); position: relative; transition: background-color 250ms ease; }
.switch .track::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(18, 63, 80, 0.25); transition: transform 250ms ease; }
.switch input:checked + .track { background: var(--petrol); }
.switch input:checked + .track::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--petrol); outline-offset: 2px; }

.days { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-height: 96px; }
.day.today { border-color: var(--petrol); }
.day h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.slot { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.slot time { font-weight: 600; color: var(--petrol); min-width: 48px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 12px; }
.inline { display: inline-flex; flex-direction: column; margin: 0; }
.avail-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: center; margin: 8px 0; }

.empty { text-align: center; color: var(--muted); padding: 32px 0; }

.toast {
  position: fixed; inset-inline: 16px; bottom: 16px; max-width: 460px; margin-inline: auto; z-index: 20; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
  background: var(--ink); color: #fff; border-radius: 20px; box-shadow: 0 8px 24px rgba(18, 63, 80, 0.3);
  animation: rise 300ms ease-out both;
}
.toast .bar-time { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: var(--pink); transform-origin: left center; transform: scaleX(var(--left, 1)); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .avail-row { grid-template-columns: 1fr 1fr; }
  .avail-row select { grid-column: 1 / -1; }
  .bulk { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn:active, .chip:active { transform: none; }
}
.via { color: var(--muted); }
