@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e7e7e7;
  --soft: #f5f5f5;
  --danger: #c62828;
  --r: 16px;
  --r-sm: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  background: var(--ink); color: #fff; font-weight: 700;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1c7c7; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
.icon-btn svg { width: 20px; height: 20px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff;
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--ink); }
textarea.input { resize: vertical; min-height: 84px; }
.ltr { direction: ltr; text-align: left; }

/* ---------- login ---------- */
.login {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { font-size: 30px; margin-bottom: 4px; }
.login-card p { margin: 0 0 28px; }
.brand { font-weight: 900; letter-spacing: -.5px; direction: ltr; }
.brand span { font-weight: 400; }
.input.big { font-size: 18px; letter-spacing: 1px; }
.input.otp { font-size: 24px; font-weight: 800; letter-spacing: 10px; text-align: center; }
.link { border: 0; background: none; padding: 6px 2px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
a.btn { text-decoration: none; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 22px; margin: 0 0 8px; }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .brand { font-size: 20px; }
.top .who { font-size: 13px; color: var(--muted); }
main { max-width: 920px; margin: 0 auto; padding: 16px 16px 110px; }
.tabs {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 150px; min-height: 52px; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--muted);
  font-size: 11.5px; font-weight: 600;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { background: var(--ink); color: #fff; }

.card { border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; background: #fff; }
.card > h3 { margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  background: var(--soft); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.dark { background: var(--ink); color: #fff; }
.empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.loading { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- schedule ---------- */
.date-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.date-nav .title { flex: 1; text-align: center; font-weight: 800; font-size: 17px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.wday {
  display: flex; flex-direction: column; align-items: center; padding: 8px 0;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
.wday small { font-size: 11px; color: var(--muted); }
.wday b { font-size: 16px; }
.wday.today { border-color: var(--ink); }
.wday.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.wday.on small { color: #cfcfcf; }
.rooms { display: grid; gap: 14px; }
@media (min-width: 760px) { .rooms { grid-template-columns: 1fr 1fr; align-items: start; } }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.room-head h3 { font-size: 16px; font-weight: 800; }

/* time bar */
.bar { position: relative; height: 14px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; background: #b9b9b9; }
.bar i.mine { background: var(--ink); }
.bar i.sel { background: var(--ink); }
.bar i.now { width: 2px; background: var(--danger); }
.bar-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.bar.big { height: 22px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.legend span::before {
  content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-inline-end: 5px; background: var(--soft); border: 1px solid var(--line); vertical-align: -1px;
}
.legend .l-busy::before { background: #b9b9b9; border-color: #b9b9b9; }
.legend .l-sel::before { background: var(--ink); border-color: var(--ink); }

.resv {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: start;
  padding: 12px; margin-top: 8px; border: 0; border-radius: var(--r-sm); background: var(--soft);
}
.resv .time { font-weight: 800; white-space: nowrap; font-size: 14px; }
.resv .what { flex: 1; min-width: 0; font-size: 13.5px; }
.resv .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resv.mine { background: var(--ink); color: #fff; }
.resv.mine .muted { color: #cfcfcf; }
.resv.locked { color: var(--muted); cursor: default; }
.resv svg { width: 16px; height: 16px; flex: none; opacity: .6; }

/* ---------- booking ---------- */
.step-n {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  margin-inline-end: 8px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px;
}
.room-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room-opt {
  text-align: start; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
.room-opt b { display: block; font-size: 14.5px; }
.room-opt.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.room-opt.on .muted { color: #cfcfcf; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-size: 16px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.day {
  position: relative; aspect-ratio: 1; max-height: 52px; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid transparent; border-radius: var(--r-sm); background: var(--soft);
  font-weight: 700; font-size: 15px;
}
.day:disabled { background: none; color: #c4c4c4; cursor: default; font-weight: 500; }
.day.full:disabled { text-decoration: line-through; }
.day.today { border-color: var(--ink); }
.day.on { background: var(--ink); color: #fff; }
.day.has::after {
  content: ''; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55;
}

.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 380px) { .slots { grid-template-columns: repeat(4, 1fr); } }
.slot, .dur {
  min-height: 44px; padding: 0 4px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font-weight: 700; font-size: 14px;
}
.slot:disabled { background: var(--soft); border-color: var(--soft); color: #bdbdbd; text-decoration: line-through; cursor: default; }
.slot.in { background: #e3e3e3; border-color: #e3e3e3; }
.slot.on, .dur.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.durs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.dur { flex: none; padding: 0 14px; white-space: nowrap; }
.sub { font-size: 13px; font-weight: 700; margin: 16px 0 8px; }
.summary {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--soft); font-weight: 700; text-align: center;
}

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper output { min-width: 44px; text-align: center; font-size: 22px; font-weight: 800; }
.warn { color: #9a5b00; font-size: 13px; margin-top: 6px; }
.guest-row { margin-bottom: 10px; padding: 10px; border-radius: var(--r-sm); background: var(--soft); }
.guest-top { display: flex; gap: 8px; margin-bottom: 8px; }
.guest-top .g-title { flex: 1; min-width: 0; }
.input.ltr::placeholder { direction: rtl; text-align: right; }
.input.small { min-height: 38px; font-size: 13px; }

/* ---------- public guest page ---------- */
.guest-page { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
.guest-page .brand { font-size: 24px; margin-bottom: 16px; }
.when { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.when div { padding: 12px; border-radius: var(--r-sm); background: var(--soft); }
.when small { display: block; color: var(--muted); font-size: 12px; }
.when b { font-size: 17px; }
#map { height: 260px; border-radius: var(--r-sm); border: 1.5px solid var(--line); z-index: 0; margin-bottom: 12px; }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; background: var(--ink); transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.nav-apps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.note-box { padding: 12px 14px; border-radius: var(--r-sm); background: var(--soft); font-size: 14px; margin-bottom: 10px; }
.cancelled { padding: 12px 14px; border-radius: var(--r-sm); background: #fdecec; color: var(--danger); font-weight: 700; margin-top: 12px; }

/* ---------- sheet ---------- */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 22px 22px 0 0; animation: up .2s ease-out;
}
@media (min-width: 600px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 22px; }
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h3 { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.guest-list { margin: 0 0 14px; padding: 0; list-style: none; }
.guest-list li { padding: 9px 12px; margin-bottom: 6px; border-radius: 10px; background: var(--soft); font-size: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }

#toast {
  position: fixed; bottom: 96px; left: 50%; z-index: 100; transform: translateX(-50%) translateY(20px);
  max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transition: all .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }

/* ---------- late hours & approval ---------- */
.bar i.late { background: repeating-linear-gradient(135deg, transparent 0 4px, #dcdcdc 4px 6px); }
.bar i.pend { background: repeating-linear-gradient(135deg, #b9b9b9 0 4px, #8a8a8a 4px 8px); }
.badge.warn-b { background: #fff3d6; color: #8a5a00; }
.resv.mine .badge.warn-b { background: #fff3d6; color: #8a5a00; }
.pending-card { border-color: #f0d79a; }
.pend-row { padding: 10px 0; border-top: 1px solid var(--line); }
.pend-row:first-of-type { border-top: 0; }
