:root {
  --bg: #ffffff;
  --text: #0f1419;
  --muted: #536471;
  --line: #eff3f4;
  --outline: #cfd9de;
  --hover: #f7f9f9;
  --field: #eff3f4;
  --bar: rgb(255 255 255 / 0.85);
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: #e8f5fd;
  --danger: #f4212e;
  --danger-soft: #fee8ea;
  --ok: #00ba7c;
  --fill: #0f1419;
  --on-fill: #ffffff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --text: #e7e9ea;
  --muted: #71767b;
  --line: #2f3336;
  --outline: #536471;
  --hover: #16181c;
  --field: #202327;
  --bar: rgb(0 0 0 / 0.65);
  --accent-soft: rgb(29 155 240 / 0.1);
  --danger-soft: rgb(244 33 46 / 0.12);
  --fill: #eff3f4;
  --on-fill: #0f1419;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
button { font: inherit; color: inherit; }

.shell { max-width: 600px; margin: 0 auto; min-height: 100vh; }
@media (min-width: 640px) {
  .shell { border-inline: 1px solid var(--line); }
}

/* ---- top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  min-height: 53px;
  background: var(--bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-text { flex: 1; min-width: 0; }
.bar h1 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn .sun, :root[data-theme="dark"] .icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: block; }
.bar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---- text */
.title { margin: 0 0 8px; font-size: 23px; font-weight: 800; line-height: 1.25; }
.label { margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.sub { margin: 0 0 16px; color: var(--muted); }
.block .sub { margin-top: -6px; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.opt { font-size: 13px; font-weight: 400; }
.hint { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0 10px; }

/* ---- layout */
.pane { padding: 32px 16px; }
.block { padding: 16px; border-bottom: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; padding: 48px 16px; }
.center p { margin: 0 0 16px; }

/* ---- controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}
.btn.sm { min-height: 32px; padding: 0 14px; font-size: 14px; }
.btn.lg { min-height: 44px; width: 100%; font-size: 17px; }
.btn.primary { background: var(--accent); color: #ffffff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.outline { background: transparent; border-color: var(--outline); }
.btn.outline:hover { background: var(--hover); }
.btn.link { background: none; color: var(--accent); padding: 0 4px; min-height: 32px; font-weight: 400; }
.btn.link:hover { text-decoration: underline; }
form .btn.link { display: flex; margin: 12px auto 0; }

.input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: inherit;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 4px;
  padding: 14px 12px;
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input::placeholder { color: var(--muted); }
.input.ltr { letter-spacing: 0.04em; }
.input.pill {
  font-size: 15px;
  border-radius: 9999px;
  padding: 10px 16px;
  background: var(--field);
  border-color: var(--field);
}
.input.pill:focus { background: var(--bg); }
textarea.input { resize: vertical; min-height: 88px; font-size: 15px; }

/* Google's button frame is light; matching its colour scheme keeps the frame transparent in dark mode. */
.gbtn { display: flex; justify-content: center; min-height: 44px; color-scheme: light; }

/* ---- profile */
.profile { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 17px;
}
.name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner {
  margin: 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

/* ---- stage */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid var(--outline);
  border-radius: 9999px;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip[aria-checked="true"] { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }

/* ---- calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; }
.day {
  justify-self: center;
  width: 100%;
  max-width: 48px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s;
}
.day:hover { background: var(--hover); }
.day.weekend { color: var(--muted); }
.day[aria-pressed="true"] { background: var(--danger); color: #ffffff; font-weight: 700; }
.cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
#count.some { color: var(--danger); font-weight: 700; }

/* ---- save bar */
.savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.savebar .btn { min-width: 96px; }

/* ---- admin */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.stats div { padding: 14px 16px; }
.stats div + div { border-inline-start: 1px solid var(--line); }
.stats b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  flex: 1;
  position: relative;
  min-height: 53px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: var(--hover); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 700; }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 56px;
  height: 4px;
  border-radius: 9999px;
  background: var(--accent);
  transform: translateX(-50%);
}
.tab .n { margin-inline-start: 4px; font-weight: 400; font-variant-numeric: tabular-nums; }

.search { padding: 8px 16px; border-bottom: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s;
}
.item:hover { background: var(--hover); }
.line1 { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.line1 .name { max-width: 100%; }
.line1 .muted { font-size: 14px; }
.status { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; }
.status .ok { color: var(--ok); }
.daychip {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.badge {
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.note { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.contact { margin-top: 4px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.contact bdi { unicode-bidi: isolate; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.review, .fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.select {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 32px;
  padding: 4px 10px;
  font: inherit;
  font-size: 14px;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 4px;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.admin-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

/* ---- feedback */
.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 1.5s !important; }
}
