/* ============================================================
   ۱. توکن‌های دیزاین سیستم (Design Tokens)
   ============================================================ */
:root {
  /* پالت سایدبار تیره */
  --ink-900: #15171C;
  --ink-800: #1B1E24;
  --ink-700: #23272F;
  --ink-600: #2C313B;
  --ink-line: rgba(148, 163, 184, 0.14);
  --ink-text: #94A3B8;
  --ink-text-strong: #E2E8F0;

  /* هویت برند گرم */
  --brand-50: #FFF5EC;
  --brand-100: #FFE8D3;
  --brand-500: #F97316;
  --brand-600: #EA580C;
  --brand-700: #C2410C;
  --brand-800: #9A3412;
  --grad-primary: linear-gradient(135deg, #F97316 0%, #EA580C 55%, #C2410C 100%);
  --grad-glow: 0 8px 20px -6px rgba(234, 88, 12, 0.45);
  --primary-tint: rgba(234, 88, 12, 0.12);

  /* رنگ‌های کاربردی */
  --blue-600: #2563EB;
  --blue-soft: #EFF6FF;
  --amber-600: #D97706;
  --amber-soft: #FFF7E6;
  --red-600: #DC2626;
  --red-soft: #FEF2F2;
  --green-600: #16A34A;
  --green-soft: #F0FDF4;

  /* سطوح روشن (گرم و اداری) */
  --bg: #F6F4F1;
  --surface: #FFFFFF;
  --surface-2: #FAF8F5;
  --text: #1A1A1A;
  --text-2: #52525B;
  --muted: #71717A;
  --border: #E7E2DB;
  --border-soft: #EFECE6;

  /* شعاع و سایه */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 4px 14px -3px rgba(16, 24, 40, 0.08), 0 2px 5px -2px rgba(16, 24, 40, 0.05);
  --shadow-3: 0 16px 40px -12px rgba(16, 24, 40, 0.18);
  --shadow-dock: 0 -8px 28px rgba(16, 24, 40, 0.09);

  --sidebar-w: 236px;
  --topbar-h: 66px;
}

/* ============================================================
   ۲. پایه
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

body {
  background:
    radial-gradient(1100px 340px at 78% -120px, rgba(234, 88, 12, 0.08), transparent 70%),
    var(--bg);
}

.num {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* Persian date/time text — isolated RTL so mixed digits never scramble. */
.fa-date {
  direction: rtl;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.32);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); background-clip: padding-box; }

:focus-visible {
  outline: 2px solid rgba(234, 88, 12, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

button { font-family: inherit; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes growBar {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.35); }
  100% { box-shadow: 0 0 0 12px rgba(234, 88, 12, 0); }
}

/* ============================================================
   ۳. چیدمان کلی و سایدبار تیره
   ============================================================ */
.app {
  display: flex;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--ink-900) 0%, #101216 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 65;
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1023px) {
  /* در موبایل سایدبار اصلا وجود ندارد — فقط نوار پایین */
  .sidebar { display: none !important; }
}

.sidebar-brand {
  height: 60px;
  padding: 0 14px;
  border-bottom: 1px solid var(--ink-line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--grad-glow);
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  color: #F1F5F9;
  line-height: 1.3;
}
.brand-sub {
  font-size: 10px;
  color: #64748B;
  font-weight: 500;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #5B6B84;
  letter-spacing: 0.04em;
  padding: 0 10px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink-line);
}

.nav-group { display: flex; flex-direction: column; gap: 4px; }

.side-link {
  width: 100%;
  height: 37px;
  padding: 0 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink-text);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: right;
  position: relative;
}
.side-link svg { flex-shrink: 0; opacity: 0.85; }
.side-link:hover {
  background: rgba(148, 163, 184, 0.09);
  color: var(--ink-text-strong);
}
.side-link.active {
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--grad-glow);
}
.side-link.active svg { opacity: 1; }

.badge-dot {
  margin-inline-start: auto;
  background: rgba(245, 158, 11, 0.16);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}
.side-link.active .badge-dot {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.side-foot {
  padding: 10px;
  border-top: 1px solid var(--ink-line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--ink-line);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 700; color: var(--ink-text-strong); line-height: 1.3; }
.user-role { font-size: 11px; color: #64748B; }

.reset-demo-btn {
  width: 100%;
  height: 36px;
  border-radius: 11px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: transparent;
  color: #64748B;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.16s ease;
}
.reset-demo-btn:hover {
  color: var(--ink-text-strong);
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(148, 163, 184, 0.07);
}

/* ============================================================
   ۴. ستون اصلی و تاپ‌بار
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  z-index: 20;
}
@media (min-width: 1024px) {
  .topbar { padding: 0 26px; }
}

.topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; }

.title-wrap { min-width: 0; }
.topbar-title {
  font-size: 18.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .topbar-title { font-size: 16.5px; }
  .topbar-sub { display: none; }
}

.topbar-end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  background: var(--brand-50);
  border: 1px solid rgba(234, 88, 12, 0.22);
  color: var(--brand-700);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
@media (max-width: 860px) { .date-chip { display: none; } }

.cashier-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 12px 0 14px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--shadow-1);
}
.cashier-chip .user-avatar { width: 28px; height: 28px; font-size: 12px; }
.cashier-chip .role { color: var(--muted); font-weight: 500; }
@media (max-width: 560px) { .cashier-chip { display: none; } }

/* ============================================================
   ۵. صفحات و ظروف محتوا
   ============================================================ */
.page {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.page.active { display: flex; }
.page.active .page-scroll { animation: fadeUp 0.24s ease both; }

.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 26px;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
  .page-scroll { padding: 24px 26px 32px; }
}

.container-max {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ============================================================
   ۶. کارت‌ها و اجزای مشترک
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-2);
}
@media (max-width: 640px) { .card { padding: 15px; border-radius: 15px; } }

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sec-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.sec-title .t-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sec-hint { font-size: 12.5px; color: var(--muted); }

/* دکمه‌ها */
.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--grad-glow);
}
.btn-primary:hover { filter: brightness(1.06); background: var(--grad-primary); }

.btn-soft {
  background: var(--brand-50);
  border-color: rgba(234, 88, 12, 0.3);
  color: var(--brand-700);
}
.btn-soft:hover { background: var(--brand-100); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--red-600);
}
.btn-danger:hover { background: #FEE2E2; }

.btn-sm { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; }

/* برچسب‌های وضعیت */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green-600); }
.badge-amber { background: var(--amber-soft); color: var(--amber-600); }
.badge-red   { background: var(--red-soft); color: var(--red-600); }
.badge-gray  { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-soft); }
.badge-brand  { background: var(--brand-50); color: var(--brand-700); }

/* فرم‌ها */
.input, .select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input::placeholder { color: #98A2B3; font-weight: 400; }
.input:focus, .select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3.5px var(--primary-tint);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 38px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 210px;
}
.search-wrap > svg {
  position: absolute;
  right: 13px;
  color: var(--muted);
  pointer-events: none;
}
.search-wrap .input { padding-right: 40px; }

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* کلید فعال/غیرفعال */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 25px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 19px;
  width: 19px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.25);
}
.switch input:checked + .slider { background: var(--grad-primary); }
.switch input:checked + .slider::before { transform: translateX(19px); }

/* ============================================================
   ۷. کارت‌های شاخص (KPI)
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brand-50);
  color: var(--brand-600);
}
.kpi-ico.blue  { background: var(--blue-soft); color: var(--blue-600); }
.kpi-ico.red   { background: var(--red-soft); color: var(--red-600); }
.kpi-ico.amber { background: var(--amber-soft); color: var(--amber-600); }
.kpi-ico.green { background: var(--green-soft); color: var(--green-600); }
.kpi-val {
  font-size: 23px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}
.kpi-val.brand { color: var(--brand-700); }
.kpi-val.red  { color: var(--red-600); }
.kpi-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ============================================================
   ۸. صفحه فروش POS
   ============================================================ */
.pos-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.pos-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  -webkit-overflow-scrolling: touch;
}

.pos-main > .card { min-width: 0; }
.pos-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pos-side { display: flex; flex-direction: column; gap: 16px; }

@media (min-width: 1024px) {
  .pos-scroll {
    padding: 24px 26px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 384px;
    gap: 22px;
    align-items: start;
  }
  .mobile-dock { display: none !important; }
}
@media (max-width: 1023px) {
  .desktop-checkout-card { display: none !important; }
  .pos-scroll { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* کارت‌های خدمات (عکس‌دار — استایل رستوران) */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .services-grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 13px; }
}

.srv-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: all 0.18s ease;
}
.srv-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #D3CCC2; }
.srv-card:active { transform: scale(0.97); }
.srv-card.selected {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3.5px var(--primary-tint), var(--shadow-2);
}

.srv-check {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.srv-card.selected .srv-check { opacity: 1; transform: scale(1); }

.srv-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: var(--surface-2);
}

.srv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 5px 3px;
}
.srv-name { font-size: 14.5px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-price { font-size: 13px; font-weight: 800; color: var(--brand-700); white-space: nowrap; }
.srv-card.selected .srv-price { color: var(--brand-600); }

/* عکس‌کوچک‌های جدول و لیست */
.tbl-thumb {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  flex-shrink: 0;
  display: block;
}
.cart-thumb {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  flex-shrink: 0;
}

/* انتخاب عکس در فورم */
.photo-pick {
  position: relative;
  width: 100%;
  height: 112px;
  border-radius: 12px;
  border: 1.5px dashed var(--border);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s ease;
}
.photo-pick:hover { border-color: var(--brand-500); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick .ph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.photo-pick .ph-change {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  background: rgba(23, 23, 23, 0.62);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  padding: 4px 6px;
  backdrop-filter: blur(2px);
}

/* دسته‌بندی‌ها و محصولات */
.cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 12px;
  padding-bottom: 2px;
}
.cat-row::-webkit-scrollbar { display: none; }

.cat-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.cat-btn:hover { border-color: #CBD5E1; }
.cat-btn.active {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--grad-glow);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
@media (min-width: 640px)  { .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .products-grid { grid-template-columns: repeat(4, 1fr); } }

.prod-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 7px 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow-1);
  transition: all 0.18s ease;
}
.prod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.prod-card.in-cart { border-color: rgba(234, 88, 12, 0.55); }

.prod-photo-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}
.prod-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  transition: transform 0.25s ease;
}
.prod-card:hover .prod-photo { transform: scale(1.05); }
.prod-photo-wrap.out .prod-photo { filter: grayscale(1); opacity: 0.5; }

.out-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(23, 23, 23, 0.78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 13px;
  border-radius: 999px;
  white-space: nowrap;
  backdrop-filter: blur(2px);
}

.prod-qty-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  animation: popIn 0.18s ease both;
}

.prod-stock-tag {
  position: absolute;
  bottom: 6px;
  right: 7px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(23, 23, 23, 0.55);
  backdrop-filter: blur(3px);
  padding: 2px 8px;
  border-radius: 999px;
}

.prod-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.prod-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-price { font-size: 13px; font-weight: 800; color: var(--brand-700); flex-shrink: 0; }

.add-btn {
  width: 100%;
  height: 37px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.add-btn:hover { background: var(--brand-50); border-color: rgba(234, 88, 12, 0.4); color: var(--brand-700); }
.add-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card-stepper {
  width: 100%;
  height: 37px;
  border-radius: 10px;
  background: var(--brand-50);
  border: 1px solid rgba(234, 88, 12, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}
.step-btn {
  width: 30px;
  height: 29px;
  border-radius: 8px;
  border: none;
  background: var(--surface);
  color: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  font-size: 16px;
  font-weight: 700;
  transition: all 0.14s ease;
}
.step-btn:active { transform: scale(0.92); }

/* سبد اجناس */
.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  animation: fadeUp 0.2s ease both;
}
.cart-row:last-child { border-bottom: none; padding-bottom: 0; }

.mini-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2.5px;
}
.mini-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: var(--surface);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  font-size: 15px;
  font-weight: 700;
  transition: all 0.14s ease;
}
.mini-btn:active { transform: scale(0.9); color: var(--brand-700); }

/* خلاصه پرداخت */
.checkout-card { padding: 20px; }

.pay-breakdown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 0;
}
.pay-breakdown strong { color: var(--text); font-weight: 800; margin-inline-start: 5px; }

.pay-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1.5px dashed var(--border);
  margin-bottom: 14px;
}
.pay-total-label { font-size: 14.5px; font-weight: 700; color: var(--text); }
.pay-total-val {
  font-size: 27px;
  font-weight: 800;
  color: var(--brand-700);
  line-height: 1.1;
}

.pay-cta {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  border: none;
  background: var(--grad-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: var(--grad-glow);
  transition: all 0.18s ease;
}
.pay-cta:hover { filter: brightness(1.07); transform: translateY(-1px); }
.pay-cta:active { transform: scale(0.98); }

/* خلاصه پرداخت موبایل — داخل اسکرول صفحه است، ثابت و چسپیده نیست */
.mobile-dock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px 16px;
  box-shadow: var(--shadow-2);
}

/* انتخاب تعداد افراد برای خدمات چندنفره (حمام و حوض) */
.persons-ctl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.persons-ctl .p-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}
.persons-ctl .p-step {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
}
.persons-ctl .p-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-700);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.persons-ctl .p-btn:hover { background: var(--surface-2); }
.persons-ctl .p-num {
  min-width: 34px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
}

/* صفحات مدیریتی در موبایل (جایگزین سایدبار) */
.sheet-link {
  width: 100%;
  height: 56px;
  padding: 0 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: right;
}
.sheet-link:hover { background: var(--surface-2); border-color: var(--brand-700); }
.sheet-link svg { color: var(--brand-700); flex-shrink: 0; }
.sheet-link .s-sub {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}
.mobile-dock .pay-breakdown { padding: 0; margin-bottom: 4px; }
.mobile-dock .pay-total-row { margin: 6px 0 10px; padding-top: 8px; }
.mobile-dock .pay-total-val { font-size: 22px; }

/* ============================================================
   ۹. نوار پایین موبایل
   ============================================================ */
.bottom-nav {
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  flex-shrink: 0;
  z-index: 30;
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }

.bnav-btn {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.16s ease;
}
.bnav-btn.active { color: var(--brand-700); font-weight: 800; }
.bnav-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 26px;
  height: 3.5px;
  border-radius: 0 0 5px 5px;
  background: var(--grad-primary);
}

/* ============================================================
   ۱۰. جداول داده (با کارت‌شدن در موبایل)
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table th {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background 0.14s ease; }
table.data-table tbody tr:hover { background: #FAFBFC; }

.td-strong { font-weight: 700; }
.td-money { font-weight: 800; color: var(--brand-700); }
.td-money-red { font-weight: 800; color: var(--red-600); }
.td-muted { color: var(--muted); }

/* نوار خلاصه بالای جداول */
.stat-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow-1);
}
.stat-pill strong { color: var(--text); font-weight: 800; }
.stat-pill.warn strong { color: var(--amber-600); }

/* ============================================================
   ۱۱. نمودارها (SVG)
   ============================================================ */
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-wrap .bar { transform-box: fill-box; transform-origin: bottom; animation: growBar 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; }
.chart-wrap .bar:hover { filter: brightness(1.12); }
.chart-wrap text {
  font-family: 'Vazirmatn', sans-serif;
  fill: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.chart-wrap text.tick-val { font-size: 10px; fill: #98A2B3; }

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.lg-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.lg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.dash-grid-a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1024px) { .dash-grid-a { grid-template-columns: 1.6fr 1fr; } }

.dash-grid-b {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1024px) { .dash-grid-b { grid-template-columns: 1fr 1fr; } }

.donut-center-label { font-size: 11px; fill: var(--muted); }
.donut-center-val { font-size: 17px; font-weight: 800; fill: var(--text); }

/* ============================================================
   ۱۲. لیست‌ها، ردیف‌ها و حالت خالی
   ============================================================ */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.list-row:last-child { border-bottom: none; padding-bottom: 0; }

.row-main { min-width: 0; }
.row-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.row-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.row-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.row-ico.brand { background: var(--brand-50); color: var(--brand-600); }
.row-ico.red  { background: var(--red-soft); color: var(--red-600); }
.row-ico.blue { background: var(--blue-soft); color: var(--blue-600); }
.row-ico.amber { background: var(--amber-soft); color: var(--amber-600); }

.amount-pos { font-weight: 800; color: var(--brand-700); }
.amount-neg { font-weight: 800; color: var(--red-600); }

.rank-chip {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-chip.r2 { background: var(--blue-soft); color: var(--blue-600); }
.rank-chip.r3 { background: var(--amber-soft); color: var(--amber-600); }

.mini-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.mini-track > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: width 0.4s ease;
}
.mini-track.warn > i { background: linear-gradient(90deg, #F59E0B, #D97706); }

.split-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
  margin: 14px 0 12px;
}
.split-srv { background: var(--grad-primary); height: 100%; transition: width 0.4s ease; }
.split-cnt { background: linear-gradient(135deg, #3B82F6, #2563EB); height: 100%; transition: width 0.4s ease; }

.empty {
  text-align: center;
  padding: 30px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-ico {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: #98A2B3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.empty-title { font-size: 14px; font-weight: 700; color: var(--text-2); }
.empty-hint { font-size: 12.5px; color: var(--muted); max-width: 260px; }
.empty.compact { padding: 16px 10px; }
.empty.compact .empty-ico { width: 46px; height: 46px; border-radius: 14px; }

/* ============================================================
   ۱۳. کارت‌های اشتراک
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.sub-card { position: relative; overflow: hidden; }
.sub-card::after {
  content: '';
  position: absolute;
  top: -34px;
  left: -34px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.10), transparent 70%);
  pointer-events: none;
}
.sub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sub-owner { font-size: 15.5px; font-weight: 800; color: var(--text); }
.sub-id { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sub-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}
.sub-meta { font-size: 12.5px; color: var(--text-2); }
.sub-meta strong { font-weight: 800; color: var(--text); }
.sub-track-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.sub-track-row .mini-track { flex: 1; }
.sub-visit-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line, #E7E2DA);
}
.sub-track-num { font-size: 11.5px; font-weight: 800; color: var(--brand-700); white-space: nowrap; }
.sub-track-num.warn { color: var(--amber-600); }
.sub-track-num.done { color: var(--red-600); }

/* ============================================================
   ۱۴. مودال‌ها و توست
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 22, 0.52);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }

.modal-box {
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow-3), 0 0 0 1px rgba(16, 24, 40, 0.04);
}
.modal-backdrop.show .modal-box { animation: popIn 0.24s cubic-bezier(0.34, 1.3, 0.64, 1) both; }

/* ---------- mobile record action sheet ---------- */
.sheet-items { display: grid; gap: 8px; margin-bottom: 14px; }
.sheet-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 13px 15px; border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface); font-size: 14.5px; font-weight: 700; color: var(--text);
  cursor: pointer; text-align: start;
}
.sheet-item:active { background: var(--primary-tint, #f1f5f9); }
.sheet-item-danger { color: var(--red-600, #dc2626); border-color: rgba(220, 38, 38, .25); background: rgba(254, 226, 226, .45); }
.sheet-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-500, #f97316); flex-shrink: 0; }
.sheet-dot.red { background: #dc2626; }

@media (max-width: 640px) {
  .modal-backdrop:has(.modal-box.modal-sheet) { align-items: flex-end; padding: 0; }
  .modal-box.modal-sheet {
    max-width: none; width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .modal-backdrop.show .modal-box.modal-sheet { animation: sheetUp 0.26s cubic-bezier(0.22, 0.9, 0.36, 1) both; }

  /* Row actions move into the tap-to-open sheet; laptops keep inline buttons. */
  .list-row .record-action-buttons, .sub-card .record-action-buttons,
  .service-card .record-action-buttons, tbody tr .record-action-buttons,
  .list-row .btn-sm:not(.row-sheet-trigger), .sub-card .btn-sm:not(.row-sheet-trigger),
  .service-card .btn-sm:not(.row-sheet-trigger), tbody tr .btn-sm:not(.row-sheet-trigger) {
    display: none !important;
  }
  .row-sheet-trigger {
    width: 38px; height: 34px; padding: 0; border-radius: 10px;
    font-size: 20px; line-height: 1; font-weight: 400; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.modal-title-group { display: flex; align-items: center; gap: 11px; }
.modal-ico {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-ico.red { background: var(--red-soft); color: var(--red-600); }
.modal-title { font-size: 15.5px; font-weight: 800; color: var(--text); }

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.modal-close:hover { background: var(--red-soft); color: var(--red-600); border-color: rgba(220, 38, 38, 0.25); }

.success-ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  margin: 4px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ringPulse 0.7s ease-out both;
}

.receipt-note {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.receipt-note strong { font-weight: 800; color: var(--text); }

.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink-900);
  color: #F1F5F9;
  padding: 11px 18px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 100;
  white-space: nowrap;
  box-shadow: var(--shadow-3);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 32px);
}
.toast .t-ico { color: var(--brand-500); flex-shrink: 0; display: flex; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   ۱۵. فیش چاپی
   ============================================================ */
#printArea { display: none; }

@media print {
  body.print-mode .app,
  body.print-mode .modal-backdrop,
  body.print-mode .toast,
  body.print-mode .scrim { display: none !important; }
  body.print-mode #printArea { display: block !important; }
  body { background: #fff !important; }
}

.receipt {
  width: 300px;
  margin: 0 auto;
  font-family: 'Vazirmatn', sans-serif;
  color: #111;
  direction: rtl;
}
.receipt-head { text-align: center; border-bottom: 1.5px dashed #999; padding-bottom: 10px; margin-bottom: 10px; }
.receipt-head h1 { font-size: 17px; font-weight: 800; }
.receipt-head p { font-size: 11px; color: #555; margin-top: 3px; }
.receipt-meta { font-size: 12px; display: flex; justify-content: space-between; padding: 3px 0; }
.receipt-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.receipt-table td { font-size: 12.5px; padding: 5px 0; border-bottom: 1px dotted #ddd; }
.receipt-totals { border-top: 1.5px dashed #999; margin-top: 8px; padding-top: 8px; }
.receipt-totals .receipt-meta.grand { font-size: 15px; font-weight: 800; }
.receipt-foot { text-align: center; font-size: 11px; color: #666; border-top: 1.5px dashed #999; margin-top: 12px; padding-top: 10px; }

/* ============================================================
   ۱۶. حالت موبایل عمومی
   ============================================================ */
@media (max-width: 640px) {
  .modal-box { padding: 18px; }
  .form-row-2 { gap: 10px; }
}

/* Shared frame and interaction states */
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
.app {
  padding-inline-start: env(safe-area-inset-right, 0px);
  padding-inline-end: env(safe-area-inset-left, 0px);
}
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
.brand-name, .brand-sub, .user-name, .user-role { display: block; }
.side-link svg, .bnav-btn svg, .sheet-link svg, .workspace-mark svg { width: 20px; height: 20px; flex: none; }
.side-link svg { width: 18px; height: 18px; }
.sidebar-brand, .user-card { flex: none; }
.user-card:hover { background: var(--ink-700); }
.bnav-btn { min-width: 0; font-size: 11px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #aa582f;
  outline-offset: 3px;
}
.modal-backdrop:not(.show) { visibility: hidden; }
.modal-box { overscroll-behavior: contain; }
.modal-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.modal-title-group { min-width: 0; overflow-wrap: anywhere; }
.modal-close { width: 44px; height: 44px; flex: none; font-size: 22px; }
.modal-box :is(.input, .select, .btn, .check-row) { min-height: 44px; }
.modal-box .form-row-2 > * { min-width: 0; }
.photo-pick { font: inherit; padding: 0; }
.admin-links { display: grid; gap: 7px; }
.admin-links .sheet-link { margin: 0; min-height: 60px; border-radius: 12px; }
.admin-links .sheet-link[aria-current="page"] { background: var(--brand-50); border-color: #e6c6b0; }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand-700); }
.check-row small { display: block; color: var(--muted); }
@media (max-width: 1023px) {
  .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) {
  .modal-backdrop { align-items: end; padding: max(12px, env(safe-area-inset-top, 0px)) 0 0; }
  .modal-box {
    max-width: none;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)));
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .modal-box :is(.input, .select) { font-size: 16px; }
}
@media (max-width: 360px) { .modal-box .form-row-2 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .page.active .page-scroll, .chart-wrap .bar, .modal-backdrop.show .modal-box { animation: none; }
}
