:root {
  /* Brand colors — official DIDGAH OPTIC identity (owner mark 2026-10-24).
     Navy + cyan from the «د»/eye mark and orbital emblem on didgahoptic.ir. */
  --color-primary: #1B3A75;
  --color-primary-dark: #102A43;
  --color-secondary: #22A6DD;
  --color-accent: #22A6DD;
  --color-iris: #3EC3EC;
  --color-success: #1E9E62;
  --color-warning: #B26A00;
  --color-danger: #D32F2F;
  --color-background: #F3F7FC;
  --color-surface: #FFFFFF;
  --color-text: #122232;
  --color-muted: #5D7186;
  --color-border: #D6E2F0;
  --color-primary-soft: #E8F1FB;
  --dg-grad: linear-gradient(135deg, #1B3A75 0%, #22A6DD 100%);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Radius */
  --radius: 0.75rem;
  --radius-lg: 1rem;

  /* Shadows */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font, "Vazirmatn", "Tahoma", system-ui, sans-serif);
  direction: rtl;
  background: var(--color-background);
  color: var(--color-text);
  min-height: 100vh;
}

/* RTL helpers */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-md);
}

.card {
  background: var(--color-surface);
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 16px;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  position: relative;
  overflow: hidden;
}
/* subtle brand accent strip on top of each wizard card */
.card::before {
  content: '';
  position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--color-primary), rgba(34, 166, 221, .18));
  opacity: .55;
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--color-primary-dark);
}

.form-group {
  margin-bottom: var(--space-md);
}

label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 600;
  color: var(--color-text);
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 1rem;
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--color-primary);
  width: 1.05rem !important; height: 1.05rem;
  padding: 0; border: none; background: transparent;
  cursor: pointer; flex-shrink: 0;
}

input, select, textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

/* Modern select: chevron chip replaces the native arrow. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left .7rem center;
  background-size: 18px;
  cursor: pointer;
}
[dir="ltr"] select, select[dir="ltr"] { background-position: right .7rem center; padding-inline-end: var(--space-md); padding-left: 2.4rem; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

button {
  cursor: pointer;
  padding: .68rem 1.35rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #1258a8 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(25, 118, 210, .28), 0 1px 2px rgba(15, 23, 42, .08);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(25, 118, 210, .34), 0 1px 3px rgba(15, 23, 42, .1);
}

button:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(25, 118, 210, .25);
}

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

button:disabled {
  background: var(--color-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.secondary {
  background: var(--color-secondary);
}

button.success {
  background: linear-gradient(135deg, var(--color-success) 0%, #1b5e20 100%);
}

button.danger {
  background: linear-gradient(135deg, var(--color-danger) 0%, #b71c1c 100%);
  box-shadow: 0 2px 8px rgba(211, 47, 47, .28);
}

button.ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  box-shadow: none;
  font-weight: 600;
}

button.ghost:hover {
  background: rgba(25, 118, 210, .07);
  filter: none;
}

.actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.alert {
  padding: .8rem 1rem;
  border-radius: 14px;
  margin-bottom: var(--space-md);
  display: none;
  position: relative;
  padding-inline-start: 2.9rem;
  font-weight: 500;
  line-height: 1.6;
}

.alert.show {
  display: block;
  animation: alert-in .28s ease;
}

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert::before {
  position: absolute; inset-inline-start: .9rem; top: .8rem;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; color: #fff;
}

.alert.success {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}
.alert.success::before { content: '✓'; background: #2e7d32; }

.alert.error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}
.alert.error::before { content: '!'; background: #c62828; }

.alert.info {
  background: #dbe9f7;
  color: #1B3A75;
  border: 1px solid #a8c8ec;
}
.alert.info::before { content: 'i'; background: #1B3A75; font-family: Georgia, serif; font-style: italic; }

.alert.warning {
  background: #fff8e1;
  color: #7a5200;
  border: 1px solid #ffe082;
}
.alert.warning::before { content: '!'; background: #f9a825; }

.conn-badge {
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* Practitioner grouping: when "all doctors" is selected each practitioner
   gets a labeled section so same-time slots stay distinct choices. */
.slot-group {
  grid-column: 1 / -1;
  margin-bottom: var(--space-sm);
}

.slot-group-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
  display: flex; align-items: center; gap: .6rem;
}
.slot-group-title::before, .slot-group-title::after {
  content: ''; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, .12), transparent);
}

/* "first available" quick-pick — a glowing suggestion, not a plain ghost btn */
#firstFreeBtn.ghost {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: .5rem; font-weight: 700; color: var(--color-primary);
  border: 1.5px dashed rgba(25, 118, 210, .5) !important; border-radius: 12px !important;
  background: linear-gradient(90deg, rgba(25, 118, 210, .05), rgba(25, 118, 210, .13), rgba(25, 118, 210, .05));
  padding: .6rem 1rem !important;
}
#firstFreeBtn.ghost::before { content: '✦'; font-size: .9rem; opacity: .8; }
#firstFreeBtn.ghost:hover { background: rgba(25, 118, 210, .15); transform: none; }

.slot-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-sm);
}

.slot {
  padding: var(--space-sm) var(--space-xs);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 6px rgba(15, 23, 42, .04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease,
              background .2s ease, color .16s ease;
  position: relative;
  animation: slotIn .32s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes slotIn {
  from { opacity: 0; transform: translateY(7px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .slot { animation: none; transition: none; }
}

/* Small clock glyph inside every free slot — reads "time" at a glance. */
button.slot::before {
  content: '';
  display: inline-block;
  width: 11px; height: 11px;
  margin-inline-end: .3rem;
  vertical-align: -1px;
  background: currentColor;
  opacity: .45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7z'/%3E%3C/svg%3E") center/contain no-repeat;
}

button.slot.taken::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: .5;
}

/* Slot elements are real <button>s — override the global button palette. */
button.slot {
  color: var(--color-text);
  font-weight: 600;
  font-size: .95rem;
  font-family: inherit;
  width: 100%;
}

button.slot:hover {
  background: linear-gradient(180deg, #ffffff 0%, #eef3fb 100%);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(25, 118, 210, .18), 0 1px 3px rgba(15, 23, 42, .08);
}

button.slot:hover::before { opacity: .9; }

.slot:hover {
  border-color: var(--color-primary);
}

button.slot:active:not(.taken) { transform: translateY(0) scale(.97); }

.slot.selected,
button.slot.selected,
button.slot.selected:hover {
  background: linear-gradient(135deg, var(--color-primary) 0%, #1258a8 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(25, 118, 210, .38), 0 0 0 3px rgba(25, 118, 210, .18);
  transform: translateY(-1px);
}

.slot.selected::before,
button.slot.selected::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 1;
}

.slot.taken,
button.slot.taken {
  opacity: .55;
  cursor: not-allowed;
  background: repeating-linear-gradient(-45deg, #f1f3f6 0 6px, #e8ebf0 6px 12px);
  border-style: dashed;
  color: var(--color-muted);
  text-decoration: line-through;
  box-shadow: none;
  animation: none;
}

button.slot.taken:hover { transform: none; box-shadow: none; border-color: var(--color-border); }

button:focus-visible,
.slot:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skeleton slot cells shown while availability is loading. */
.slot.skeleton,
.slot-skeleton {
  cursor: default;
  border: 1px solid var(--color-border);
  background: linear-gradient(90deg, #e3eaf6 25%, #f2f7fc 50%, #e3eaf6 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
  min-height: 38px;
}

@keyframes skeletonShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .slot-skeleton { animation: none; }
}

/* Booking confirmation card. */
.done-card {
  border: 1px solid #c8e6c9;
  background: #f4faf4;
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-md);
  text-align: center;
}

.done-check {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-sm);
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.done-card .meta { color: var(--color-text); margin-top: var(--space-xs); }

/* Skeleton list rows for staff pages. */
.list-skeleton {
  height: 84px;
  border: 1px solid var(--color-border);
  background: linear-gradient(90deg, #e3eaf6 25%, #f2f7fc 50%, #e3eaf6 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .list-skeleton { animation: none; }
}

.list-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--color-surface);
}

.list-item .meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.confirmed { background: #dbe9f7; color: var(--color-primary-dark); }
.badge.checked_in { background: #fff3e0; color: #ef6c00; }
.badge.in_progress { background: #fff9c4; color: #f57f17; }
.badge.completed { background: #e8f5e9; color: #2e7d32; }
.badge.cancelled { background: #ffebee; color: #c62828; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
}

.topbar h1 {
  margin: 0;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.topbar h1::before {
  content: '';
  width: 11px; height: 11px; border-radius: 3.5px;
  background: linear-gradient(135deg, var(--color-primary), #7ab3f5);
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(25, 118, 210, .45);
  flex-shrink: 0;
}

.topbar button.ghost, .topbar a.ghost {
  font-size: .85rem; padding: .45rem .95rem !important; border-radius: 999px !important;
  display: inline-flex; align-items: center;
}
.topbar a.ghost {
  color: var(--color-primary); border: 1.5px solid var(--color-primary);
  font-weight: 600; transition: background .15s ease;
}
.topbar a.ghost:hover { background: rgba(25, 118, 210, .07); }

.loading {
  text-align: center;
  color: var(--color-muted);
  padding: var(--space-lg);
  display: flex; align-items: center; justify-content: center; gap: .6rem;
}
.loading::before {
  content: ''; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(25, 118, 210, .2); border-top-color: var(--color-primary);
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* spinning refresh icon while a pageHeader onRefresh is in flight */
.os-page-actions .os-spin svg { animation: spin .9s linear infinite; }
.os-page-actions .os-spin { opacity: .65; }

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .app-container {
    padding: var(--space-sm);
  }

  .card {
    padding: var(--space-md);
    border-radius: var(--radius);
  }
}

/* ========================================================================
   Didgah modern UX additions (OSH-PWA-MODERN-UX-001) — append-only.
   ======================================================================== */

/* ---- dark theme token overrides (activated by data-theme on <html>) ---- */
[data-theme="dark"] {
  --color-primary: #5FA8E8;
  --color-primary-dark: #C9DEFA;
  --color-secondary: #3FC4E8;
  --color-accent: #3FC4E8;
  --color-iris: #3EC3EC;
  --color-success: #4CC38A;
  --color-warning: #E8A33D;
  --color-danger: #F06A6A;
  --color-background: #0A1626;
  --color-surface: #14243C;
  --color-text: #E7EEF7;
  --color-muted: #93A4BC;
  --color-border: #27415F;
  --color-primary-soft: #1B2E4A;
  --dg-grad: linear-gradient(135deg, #16305F 0%, #1B7FB4 100%);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Dark-theme fixes for hard-coded light badge surfaces — status colors stay
   readable on dark cards; the badge tone itself still carries the meaning,
   never color alone (each badge already shows a text label). */
[data-theme="dark"] .badge.confirmed  { background: #17385E; color: #A8CCF6; }
[data-theme="dark"] .badge.checked_in { background: #4A2F10; color: #F0B96E; }
[data-theme="dark"] .badge.in_progress{ background: #453C12; color: #E8D77B; }
[data-theme="dark"] .badge.completed  { background: #143B28; color: #7BD8A8; }
[data-theme="dark"] .badge.cancelled  { background: #471C1C; color: #F09A9A; }

[data-theme="dark"] .loading { color: var(--color-muted); }

/* ---- font scale (set by prefs; only sizes rem-based type, layout intact) -*/
html[data-fontscale="90"]  { font-size: 90%; }
html[data-fontscale="110"] { font-size: 110%; }
html[data-fontscale="125"] { font-size: 125%; }

/* ---- user-driven reduced motion (data-motion="reduced") ---------------- */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ---- settings page ------------------------------------------------------ */
.os-seg {
  display: inline-flex;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}

.os-seg-btn {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.os-seg-btn.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

[data-theme="dark"] .os-seg-btn.active { color: #0E1726; }

.os-seg-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.os-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.os-setting-row:first-of-type { border-top: 0; }
.os-setting-label { font-weight: 700; color: var(--color-text); }
.os-setting-hint { font-size: 0.85rem; color: var(--color-muted); margin-top: 2px; }

/* ---- help panel --------------------------------------------------------- */
.os-help-modal {
  max-width: 560px;
  width: min(560px, 94vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.os-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.os-help-intro { color: var(--color-muted); margin: 0 0 var(--space-sm); }

.os-help-search {
  width: 100%;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-background);
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.os-help-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.os-help-sec { border-top: 1px solid var(--color-border); padding: 4px 0; }
.os-help-sec-h {
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  padding: 8px 4px;
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.os-help-sec-h::before { content: '▾'; margin-left: 6px; color: var(--color-muted); }
.os-help-sec:not([open]) .os-help-sec-h::before { content: '◂'; }

.os-help-sec-list { margin: 0; padding: 0 var(--space-md) var(--space-sm) 0; }
.os-help-item { color: var(--color-text); line-height: 1.8; font-size: 0.92rem; }

/* ---- PWA update banner --------------------------------------------------- */
.os-update-banner {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--os-tabbar-h, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.os-update-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-primary-dark);
  color: #fff;
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  margin: 0 var(--space-sm) var(--space-sm);
}

[data-theme="dark"] .os-update-inner { background: var(--color-primary); color: #0E1726; }

.os-update-inner button {
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 36px;
  cursor: pointer;
}

@media (min-width: 880px) {
  .os-update-banner { bottom: 0; }
}

/* ---- toast (non-blocking transient message) ---------------------------- */
.os-toast {
  position: fixed;
  bottom: calc(var(--os-tabbar-h, 0px) + 14px + env(safe-area-inset-bottom, 0px));
  inset-inline: 0;
  margin: 0 auto;
  width: max-content;
  max-width: 88vw;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  z-index: 70;
}

.os-toast.show { opacity: 1; transform: translateY(0); }
[data-theme="dark"] .os-toast { background: var(--color-primary); color: #0E1726; }

/* BOOK-PUB-001 — OTP-first public booking wizard */
.steps {
  display: flex; gap: 0; padding: .25rem 0; margin: 0 0 1.1rem; list-style: none;
  flex-wrap: wrap; counter-reset: step;
}
.steps li {
  counter-increment: step;
  font-size: .78rem; color: var(--color-muted);
  display: inline-flex; align-items: center; gap: .35rem;
  position: relative; padding-inline-end: .95rem;
}
.steps li:last-child { padding-inline-end: 0; }
.steps li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--color-border); background: #fff;
  font-size: .72rem; font-weight: 700; color: var(--color-muted);
  transition: all .2s ease; flex-shrink: 0;
}
/* connector line between steps */
.steps li:not(:last-child)::after {
  content: ''; position: absolute; inset-inline-start: calc(100% - .8rem);
  top: 50%; width: .8rem; height: 1.5px;
  background: var(--color-border); transform: translateY(-50%);
}
.steps li.on { color: var(--color-primary); font-weight: 700; }
.steps li.on::before {
  background: linear-gradient(135deg, var(--color-primary) 0%, #1258a8 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(25, 118, 210, .35);
}
.steps li.done { color: var(--color-success, #2e7d32); }
.steps li.done::before {
  content: '✓'; background: var(--color-success, #2e7d32);
  border-color: transparent; color: #fff;
}
.steps li.done:not(:last-child)::after { background: var(--color-success, #2e7d32); }
.step-pane {
  display: block;
  animation: step-in .3s ease;
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.step-pane h2 {
  font-size: 1.15rem; margin-bottom: .4rem;
  display: flex; align-items: center; gap: .55rem;
}
.step-pane h2::before {
  content: ''; width: 4px; height: 1.05rem; border-radius: 2px;
  background: linear-gradient(180deg, var(--color-primary), #7ab3f5);
  flex-shrink: 0;
}
.step-pane > p { color: var(--color-muted); margin-top: 0; }

/* segmented radio control (attendee self/other) */
.seg {
  display: flex; gap: .5rem; flex-wrap: wrap;
  background: #eef2f8; border-radius: 14px; padding: .3rem;
}
.seg-opt {
  flex: 1 1 10rem; text-align: center; cursor: pointer;
  padding: .55rem .9rem; border-radius: 11px;
  font-size: .92rem; font-weight: 600; color: var(--color-muted);
  transition: all .18s ease; user-select: none;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  margin-bottom: 0;
}
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt:hover { color: var(--color-primary); }
.seg-opt:has(input:checked) {
  background: #fff; color: var(--color-primary); font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* OTP code entry — large tracked digits */
#otpInput {
  font-size: 1.7rem; font-weight: 700; text-align: center;
  letter-spacing: .55em; padding: .7rem .5rem .7rem 1.05rem;
  border-radius: 14px; border-width: 2px;
  background: linear-gradient(180deg, #fbfdff 0%, #fff 100%);
}
#otpInput:focus { border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(25, 118, 210, .16); }
.review-list {
  display: grid; grid-template-columns: auto 1fr; gap: .55rem 1.1rem;
  margin: 0 0 .9rem; padding: .9rem 1.1rem;
  background: linear-gradient(180deg, #f8fafd 0%, #fff 100%);
  border: 1px solid rgba(15, 23, 42, .07); border-radius: 14px;
}
.review-list dt { color: var(--color-muted); font-size: .88rem; }
.review-list dd { margin: 0; font-weight: 700; color: var(--color-text); }
.mine-card {
  border: 1px solid rgba(15, 23, 42, .08); border-radius: 14px; padding: .85rem 1rem;
  margin-bottom: .65rem; background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
  border-inline-start: 3px solid var(--color-primary);
  transition: box-shadow .15s ease, transform .15s ease;
}
.mine-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.mine-card .st { margin-top: .4rem; }
/* status pill — colour-coded per appointment/waitlist state */
.mine-card .st {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 700;
  padding: .2rem .65rem; border-radius: 999px;
  background: #eceff4; color: #475569;
}
.mine-card .st::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.st-requested, .st-wl-waiting { background: #fff8e1 !important; color: #8d6e00 !important; }
.st-confirmed, .st-wl-offered { background: #dbe9f7 !important; color: #1B3A75 !important; }
.st-arrived, .st-checked_in, .st-in_progress { background: #e0f7f4 !important; color: #00695c !important; }
.st-completed, .st-wl-booked { background: #e8f5e9 !important; color: #2e7d32 !important; }
.st-cancelled, .st-wl-cancelled, .st-no_show { background: #ffebee !important; color: #c62828 !important; }
.st-wl-expired { background: #eceff4 !important; color: #64748b !important; }
.mine-card .actions { margin-top: .5rem; }
.receipt { text-align: center; padding: 1rem 0; }
.receipt-badge {
  width: 64px; height: 64px; margin: .2rem auto .9rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
  box-shadow: 0 6px 20px rgba(46, 125, 50, .35), 0 0 0 8px rgba(46, 125, 50, .1);
  animation: badge-pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes badge-pop {
  from { transform: scale(.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.receipt h3 { color: var(--color-primary, #1b3a6b); }
.receipt .track b {
  letter-spacing: .05em; display: inline-block;
  background: rgba(25, 118, 210, .08); border: 1.5px dashed rgba(25, 118, 210, .4);
  border-radius: 10px; padding: .35rem 1rem; margin-top: .35rem;
  font-size: 1.15rem; color: var(--color-primary);
}
.empty {
  color: var(--color-muted); text-align: center; padding: 1.4rem 1rem;
  border: 1.5px dashed rgba(15, 23, 42, .14); border-radius: 14px;
  background: rgba(248, 250, 252, .6); font-size: .92rem;
}
.empty::before {
  content: '◌'; display: block; font-size: 1.6rem; line-height: 1;
  margin-bottom: .5rem; opacity: .5;
}

/* ========================================================================
   Staff login — branded hero + segmented OTP + busy buttons (devin2 UI pass)
   Append-only; never redeclares the rules above.
   ======================================================================== */

.login-shell {
  max-width: 400px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-sm);
}

/* Brand band — deep navy gradient carrying the shop identity. The card
   overlaps its bottom edge (negative margin) so the two read as one unit. */
.login-hero {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--dg-grad);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-lg) var(--space-md) calc(var(--space-lg) + 14px);
  min-height: 96px;
}

.login-hero-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.login-hero-text { flex: 1; min-width: 0; }
.login-hero-name { font-weight: 700; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.login-hero-tag { font-size: 0.8rem; opacity: 0.82; margin-top: 2px; }

/* Connection badge sits on the dark band — light text, readable on navy. */
.login-hero .conn-badge { color: #cfe2ff; }
.login-hero .conn-badge.down { color: #ffb4b4; }

.login-card {
  margin-top: -22px;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative; /* lift the card above the band's bottom edge */
}

.login-sub { color: var(--color-muted); margin-top: calc(var(--space-xs) * -1); }

.login-links { text-align: center; margin-top: var(--space-md); font-size: 0.85rem; }
.login-links a { color: var(--color-primary); }
.login-links-sep { color: var(--color-muted); padding: 0 2px; }

.login-footer { text-align: center; color: var(--color-muted); font-size: 0.75rem; margin: var(--space-sm) 0 0; }

/* Password field with inline reveal toggle — replaces the old inline styles. */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-left: 2.6rem; }
.pwd-toggle {
  position: absolute;
  left: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
  width: auto;
  min-height: 0;
  color: var(--color-muted);
}
.pwd-toggle:hover { color: var(--color-primary); }
.pwd-toggle svg { width: 1.15em; height: 1.15em; display: block; }
.pwd-toggle .eye-closed { display: none; }
.pwd-toggle.showing .eye-open { display: none; }
.pwd-toggle.showing .eye-closed { display: block; }

/* Full-width primary action. */
.btn-block { width: 100%; position: relative; }

/* Busy state — label fades, a bordered spinner takes over. No layout shift:
   the spinner is absolutely centered inside the same button box. */
.btn-block.is-busy .btn-label { visibility: hidden; }
.btn-block .btn-spinner { display: none; }
.btn-block.is-busy .btn-spinner {
  display: inline-block;
  position: absolute;
  inset-inline: 0;
  margin: 0 auto;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

/* Segmented OTP strip — six boxes, digits LTR inside the RTL form. */
.otp-strip {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}
.otp-box {
  width: 46px;
  height: 54px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0;
  caret-color: var(--color-primary);
}
.otp-box:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(36, 117, 216, 0.18);
}
.otp-box.filled { border-color: var(--color-primary); background: var(--color-primary-soft); }

/* Gentle entrance — the hero+card settle in once. Disabled for reduced
   motion (both OS-level and the app's own data-motion="reduced" pref). */
@media (prefers-reduced-motion: no-preference) {
  .login-hero, .login-card { animation: login-in 0.28s ease-out both; }
  .login-card { animation-delay: 0.06s; }
}
html[data-motion="reduced"] .login-hero,
html[data-motion="reduced"] .login-card,
html[data-motion="reduced"] .btn-block.is-busy .btn-spinner { animation: none; }

@keyframes login-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Dark theme — the hero gradient stays branded but deepens so the white
   card boundary still reads crisply. */
[data-theme="dark"] .login-hero {
  background: linear-gradient(135deg, #0B1526 0%, #1B3A66 160%);
}
[data-theme="dark"] .otp-box:focus { box-shadow: 0 0 0 3px rgba(94, 155, 235, 0.25); }

@media (max-width: 480px) {
  .login-shell { padding: var(--space-sm) var(--space-xs); }
  .otp-box { width: 42px; height: 50px; font-size: 1.35rem; }
  .otp-strip { gap: var(--space-xs); }
}

/* Failed-login shake — one quick horizontal jolt. Reduced-motion prefs
   (OS-level + app pref) disable it entirely below. */
@media (prefers-reduced-motion: no-preference) {
  .login-card.shake { animation: login-shake 0.3s ease-in-out; }
}
html[data-motion="reduced"] .login-card.shake { animation: none; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

/* Shared-device security note — quiet, under the recovery links. */
.login-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.75rem;
  margin: var(--space-sm) 0 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-background);
  border-radius: var(--radius);
}
.login-secure::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: var(--color-success);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Login field glyphs — subtle leading icon inside username/password. */
.icon-field { position: relative; }
.icon-field .field-glyph {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); width: 18px; height: 18px;
  color: var(--color-muted, #7a869a); pointer-events: none; opacity: 0.9;
}
.icon-field input { padding-inline-start: 40px; }
.icon-field input:focus + .field-glyph,
.icon-field:focus-within .field-glyph { color: var(--color-primary, #1e5aa8); opacity: 1; }

/* ---- contextual help: graphical sections (icons, flow steps, status chips) */
.os-help-sec-h { align-items: center; gap: 6px; }
.os-help-sec-ic { display: inline-flex; color: var(--color-primary); margin-inline-start: 6px; }
.os-help-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; padding-inline-start: var(--space-md); }
.os-help-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.82rem; background: var(--color-primary-soft); color: var(--color-text); }
.os-help-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--color-muted); flex: none; }
.os-help-chip[data-tone='ok'] i { background: var(--color-success); }
.os-help-chip[data-tone='warn'] i { background: var(--color-warning); }
.os-help-chip[data-tone='bad'] i { background: var(--color-danger); }
.os-help-chip[data-tone='info'] i { background: var(--color-primary); }
.os-help-flow { counter-reset: oshelpstep; }
.os-help-flow .os-help-item { display: flex; align-items: flex-start; gap: 8px; position: relative; }
.os-help-step-n { counter-increment: oshelpstep; flex: none; min-width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.os-help-flow .os-help-item:not(:last-child) { padding-bottom: 2px; }
.os-help-flow .os-help-item:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 9px; top: 26px; bottom: 0; width: 2px; border-radius: 1px; background: var(--color-border); }
.os-help-head { align-items: center; gap: 10px; }
.os-help-head .os-modal-title { flex: 1; }
