:root {
  --cream: oklch(97% 0.012 75);
  --cream-2: oklch(93.5% 0.018 72);
  --sand: oklch(89% 0.028 70);
  --ink: oklch(23% 0.02 45);
  --ink-2: oklch(46% 0.018 45);
  --ink-3: oklch(60% 0.014 45);
  --line: oklch(23% 0.02 45 / 0.12);
  --line-2: oklch(23% 0.02 45 / 0.2);
  --accent: oklch(40% 0.06 182.5);
  --accent-strong: oklch(33% 0.062 182.5);
  --accent-light: oklch(71.4% 0.052 185.5);
  --accent-ink: oklch(98% 0.008 75);
  --dark: oklch(19% 0.03 190);
  --dark-2: oklch(26% 0.032 188);
  --dark-ink: oklch(95% 0.012 75);
  --dark-ink-2: oklch(95% 0.012 75 / 0.62);
  --dark-line: oklch(100% 0 0 / 0.12);
  --danger: oklch(48% 0.14 25);
  --danger-bg: oklch(94% 0.03 25);
  --ok: oklch(50% 0.1 145);
  --ok-bg: oklch(94% 0.035 145);
  --warn: oklch(52% 0.13 70);
  --warn-bg: oklch(94% 0.05 80);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 10px 30px oklch(23% 0.02 45 / 0.08);
  --shadow-2: 0 18px 44px oklch(23% 0.02 45 / 0.14);
  --accent-gradient: linear-gradient(90deg, var(--accent-light), var(--accent), var(--accent-light));
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Vazirmatn', Tahoma, sans-serif; color: var(--ink);
  font-size: 14px;
  background: var(--cream-2);
  background-image: repeating-linear-gradient(135deg, oklch(23% 0.02 45 / 0.05) 0 1px, transparent 1px 30px);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .tap { transition: transform .15s ease; } .tap:active { transform: scale(.96); } }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: relative; width: 220px; flex-shrink: 0; background: var(--dark); color: var(--dark-ink); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent-gradient); }
.sidebar .brand { font-size: 15.5px; font-weight: 800; margin-bottom: 24px; padding: 0 4px; display: flex; align-items: center; gap: 10px; }
.sidebar .brand .mark {
  width: 32px; height: 32px; border-radius: 999px; background: var(--dark-ink); padding: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1);
}
.sidebar .brand .mark img { width: 100%; height: 100%; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; color: var(--dark-ink-2);
  display: flex; align-items: center; gap: 10px; transition: background .15s ease, color .15s ease;
}
.sidebar nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; transition: opacity .15s ease; }
.sidebar nav a:hover { background: var(--dark-line); color: var(--dark-ink); }
.sidebar nav a:hover svg { opacity: 1; }
.sidebar nav a.active { background: var(--accent); color: var(--accent-ink); }
.sidebar nav a.active svg { opacity: 1; }
.sidebar .spacer { flex: 1; }
.sidebar .user-box { padding: 10px 12px; border-top: 1px solid var(--dark-line); margin-top: 8px; }
.sidebar .user-box .who { font-size: 12px; color: var(--dark-ink-2); margin-bottom: 6px; }
.sidebar .user-box .role-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.sidebar .logout-btn {
  margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--dark-ink-2); background: none; border: none; padding: 7px 12px;
  width: 100%; display: flex; align-items: center; gap: 8px; border-radius: var(--radius-sm); text-align: right;
}
.sidebar .logout-btn svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.sidebar .logout-btn:hover { background: var(--dark-line); color: var(--dark-ink); }
.sidebar .logout-btn:hover svg { opacity: 1; }

.main { flex: 1; min-width: 0; padding: 26px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.eyebrow-label { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--accent); margin-bottom: 4px; }
.page-head h1 { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.page-head .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.7; }

.btn {
  font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 999px; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.96); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--cream); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sand); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: oklch(90% 0.05 25); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.card { background: var(--cream); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); border: 1px solid var(--line); padding: 18px; }
.card + .card { margin-top: 14px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-size: 11.5px; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--cream-2); }

.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pill.active { background: var(--ok-bg); color: var(--ok); }
.pill.inactive { background: var(--cream-2); color: var(--ink-3); }
.pill.owner { background: var(--sand); color: oklch(40% 0.06 70); }
.pill.staff { background: var(--cream-2); color: var(--ink-2); }
.pill.st-pending { background: var(--warn-bg); color: var(--warn); }
.pill.st-confirmed { background: var(--ok-bg); color: var(--ok); }
.pill.st-done { background: var(--cream-2); color: var(--ink-2); }
.pill.st-cancelled { background: var(--danger-bg); color: var(--danger); }
.pill.pc-yes { background: var(--ok-bg); color: var(--ok); }
.pill.pc-no { background: var(--danger-bg); color: var(--danger); }
.pill.pc-unknown { background: var(--cream-2); color: var(--ink-3); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--ink-3); }
input[type=text], input[type=number], input[type=password], input[type=time], input[type=date], input[type=tel], textarea, select {
  font-family: inherit; font-size: 13.5px; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--cream); color: var(--ink); width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-light); outline-offset: 1px; border-color: var(--accent-light); }
textarea { resize: vertical; min-height: 70px; font-family: inherit; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-row input { width: auto; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 13px; }
.empty-state .empty-icon {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: oklch(71.4% 0.052 185.5 / 0.16); color: var(--accent);
}
.empty-state .empty-icon svg { width: 26px; height: 26px; }

.modal-backdrop {
  position: fixed; inset: 0; background: oklch(23% 0.02 45 / 0.45); display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 16px; overflow-y: auto; z-index: 50;
}
.modal { background: var(--cream); border-radius: var(--radius-lg); width: 100%; max-width: 640px; padding: 22px; box-shadow: var(--shadow-2); border: 1px solid var(--line); }
.modal h2 { margin: 0 0 4px; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.modal .modal-sub { font-size: 12px; color: var(--ink-2); margin: 0 0 18px; line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: var(--dark-ink);
  padding: 10px 20px; border-radius: 999px; font-size: 12.5px; font-weight: 600; z-index: 100; box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.error { background: var(--danger); color: var(--accent-ink); }

.section-title { font-size: 13.5px; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; }

.variant-row, .staff-check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.variant-row input[type=text] { flex: 1; }
.variant-row input[type=number] { width: 100px; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.img-tile { position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 1; background: var(--cream-2); border: 1px solid var(--line); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile .tag { position: absolute; top: 5px; right: 5px; font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: oklch(23% 0.02 45 / 0.65); color: var(--accent-ink); }
.img-tile .del-btn { position: absolute; bottom: 5px; left: 5px; width: 22px; height: 22px; border-radius: 50%; background: oklch(23% 0.02 45 / 0.7); color: var(--accent-ink); border: none; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.img-upload-tile {
  border: 2px dashed var(--line-2); border-radius: var(--radius-md); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; color: var(--ink-3); font-size: 11px; cursor: pointer; text-align: center; padding: 6px; transition: background .15s ease, border-color .15s ease;
}
.img-upload-tile svg { width: 20px; height: 20px; opacity: .7; }
.img-upload-tile:hover { background: var(--cream-2); border-color: var(--accent-light); }
.img-upload-tile:hover svg { opacity: 1; color: var(--accent); }
.img-upload-tile input { display: none; }
.img-upload-tile select { font-size: 10.5px; padding: 3px 4px; width: auto; margin-top: 4px; }

.hours-grid-head { display: grid; grid-template-columns: 90px auto 1fr 1fr; gap: 10px; padding: 0 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hours-grid-head span { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.hours-grid { display: flex; flex-direction: column; gap: 6px; }
.hours-row { display: grid; grid-template-columns: 90px auto 1fr 1fr; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hours-row:last-child { border-bottom: none; }
.hours-row .day-name { font-size: 13px; font-weight: 700; }
.hours-row.is-off input { opacity: .4; pointer-events: none; }

.login-wrap {
  position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--cream-2); background-image: repeating-linear-gradient(135deg, oklch(23% 0.02 45 / 0.05) 0 1px, transparent 1px 30px); padding: 20px;
}
.login-wrap::before {
  content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%; top: -180px; inset-inline-end: -160px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%); opacity: .22; pointer-events: none;
}
.login-card {
  position: relative; z-index: 1; border-radius: var(--radius-lg); padding: 36px 30px; width: 100%; max-width: 360px;
  background: linear-gradient(155deg, oklch(100% 0 0 / 0.7), oklch(100% 0 0 / 0.25) 55%, oklch(97% 0.012 75 / 0.5));
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid oklch(100% 0 0 / 0.6); box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.7), var(--shadow-2);
}
.login-card .mark {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 999px; background: var(--cream); padding: 12px;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1); border: 1px solid var(--line);
}
.login-card .mark img { width: 100%; height: 100%; object-fit: contain; }
.login-card .brand { text-align: center; font-size: 17px; font-weight: 800; margin-bottom: 4px; color: var(--accent-strong); }
.login-card .sub { text-align: center; font-size: 12.5px; color: var(--ink-2); margin-bottom: 22px; }
.login-error { background: var(--danger-bg); color: var(--danger); font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; display: none; }
.login-error.show { display: block; }

/* ============ صفحه‌ی نوبت‌ها ============ */
.bookings-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bookings-toolbar .date-jump { display: flex; align-items: center; gap: 8px; background: var(--cream); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 14px; }
.bookings-toolbar .date-jump input[type=date] { width: 150px; border: none; background: transparent; padding: 4px 2px; }
.bookings-toolbar .date-jump input[type=date]:focus { outline: none; }
.bookings-toolbar .date-jump .jpicker-input { width: 130px; border: none; background: transparent; padding: 4px 2px; }
.bookings-toolbar .date-jump .jpicker-input:focus { outline: none; }
.bookings-toolbar .jalali-echo { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bookings-toolbar .spacer { flex: 1; }
.bookings-toolbar .btn.active-filter { background: var(--accent); color: var(--accent-ink); }
.customer-cell strong { display: block; }
.customer-cell span { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; direction: ltr; text-align: right; }
.dt-cell .d { font-weight: 700; }
.dt-cell .t { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.status-select { font-size: 11px; font-weight: 700; padding: 5px 8px; border-radius: 999px; width: auto; border: 1px solid var(--line); }
.customer-link { color: var(--accent-strong); cursor: pointer; }
.customer-link:hover { text-decoration: underline; }

/* ============ پیکرِ تقویمِ شمسیِ اختصاصی ============ */
.jpicker { position: relative; }
.jpicker-input { cursor: pointer; background-image: none; }
.jpicker-input::placeholder { color: var(--ink-3); }
.jpicker-popup {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 280px;
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-2);
  padding: 12px; animation: jpickerIn .12s ease;
}
@keyframes jpickerIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.jpicker-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.jpicker-nav {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--cream);
  display: flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.jpicker-nav:hover { background: var(--sand); }
.jpicker-nav svg { width: 13px; height: 13px; }
.jpicker-head select {
  font-size: 12.5px; font-weight: 700; padding: 5px 6px; width: auto; flex: 1; border-radius: var(--radius-sm);
}
.jpicker-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.jpicker-weekdays span { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--ink-3); padding: 4px 0; }
.jpicker-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jpicker-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-variant-numeric: tabular-nums;
  border-radius: var(--radius-sm); border: none; background: transparent; color: var(--ink); cursor: pointer;
}
.jpicker-day:hover { background: var(--cream-2); }
.jpicker-day.is-empty { visibility: hidden; pointer-events: none; }
.jpicker-day.is-today { color: var(--accent-strong); font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--accent-light); }
.jpicker-day.is-selected { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.jpicker-day.is-selected:hover { background: var(--accent-strong); }
.jpicker-footer { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.jpicker-footer button { font-size: 11.5px; font-weight: 700; color: var(--accent-strong); background: none; border: none; padding: 4px 6px; }
.jpicker-footer button:hover { text-decoration: underline; }
