/* ===========================================================================
   Design tokens — one source of truth for both portals.
   Palette: deep petrol + cool mint paper. Accents are functional, never
   decorative: plum marks longer services, gold marks "needs attention",
   moss marks done, clay marks destructive.
   =========================================================================== */
:root {
  --ink:        #12232b;
  --ink-soft:   #4a5d63;
  --ink-faint:  #7d8f94;
  --paper:      #eef2f1;
  --surface:    #ffffff;
  --surface-2:  #f7faf9;
  --line:       #d6dedd;
  --line-soft:  #e6ecea;

  --primary:      #0e5a63;
  --primary-ink:  #0a4249;
  --primary-wash: #e3eeee;
  --plum:       #7b4b94;
  --gold:       #a8681f;
  --gold-wash:  #f6ecdd;
  --moss:       #2f6f4f;
  --moss-wash:  #e2efe8;
  --clay:       #a8322b;
  --clay-wash:  #f6e6e4;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(18, 35, 43, .06);
  --shadow-2: 0 8px 28px -12px rgba(18, 35, 43, .28);

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --font: "Assistant", "Heebo", "Rubik", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --step--1: .8125rem;
  --step-0:  .9375rem;
  --step-1:  1.0625rem;
  --step-2:  1.375rem;
  --step-3:  1.75rem;
  --step-4:  2.25rem;
}

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

/* The UA rule for [hidden] loses to any author rule that sets `display`
   (same specificity, author sheet wins), so screens toggled with .hidden = true
   would still render. This restores the attribute's meaning everywhere. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p  { margin: 0 0 var(--sp-3); }
a  { color: var(--primary-ink); }

time, .num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--primary); color: #fff; font-weight: 600;
  cursor: pointer; transition: background .12s ease, border-color .12s ease;
}
.btn:hover:not(:disabled) { background: var(--primary-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--primary-ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-wash); }
.btn-quiet { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--clay); }
.btn-danger:hover:not(:disabled) { background: #8d2a24; }
.btn-sm { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--step--1); }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: var(--sp-4); }
.field > span { display: block; margin-bottom: var(--sp-1); font-size: var(--step--1); color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: var(--sp-2) var(--sp-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field .hint { font-size: var(--step--1); color: var(--ink-faint); margin-top: var(--sp-1); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--clay); }
.field .err { display: none; font-size: var(--step--1); color: var(--clay); margin-top: var(--sp-1); }
.field.invalid .err { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}

.tag {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-2); border-radius: 999px;
  font-size: var(--step--1); font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line-soft);
}
.tag-scheduled  { background: var(--primary-wash); color: var(--primary-ink); border-color: #cfe0e0; }
.tag-confirmed  { background: var(--moss-wash);    color: var(--moss);        border-color: #cfe3d8; }
.tag-completed  { background: var(--surface-2);    color: var(--ink-soft); }
.tag-cancelled  { background: var(--clay-wash);    color: var(--clay);        border-color: #eed3d0; }
.tag-no_show    { background: var(--gold-wash);    color: var(--gold);        border-color: #ead9c0; }
.tag-rescheduled{ background: #efe7f4;             color: var(--plum);        border-color: #e0d2ea; }

.notice {
  display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--line-soft);
  background: var(--surface-2); color: var(--ink-soft); font-size: var(--step-0);
}
.notice-error { background: var(--clay-wash); border-color: #eed3d0; color: #7d2620; }
.notice-ok    { background: var(--moss-wash); border-color: #cfe3d8; color: #23553c; }
.notice-warn  { background: var(--gold-wash); border-color: #ead9c0; color: #7d4d16; }

.empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--ink); margin-bottom: var(--sp-1); }

.skeleton {
  background: linear-gradient(90deg, var(--line-soft), var(--surface-2), var(--line-soft));
  background-size: 200% 100%; border-radius: var(--r-sm); animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

#toast-host {
  position: fixed; inset-block-end: var(--sp-4); inset-inline-start: 50%;
  transform: translateX(50%); z-index: 90;
  display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none;
}
.toast {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-2);
  font-size: var(--step-0); max-width: min(92vw, 420px);
}
.toast-error { background: var(--clay); }
.toast-warn  { background: var(--gold); }
