/* مطب پلاس — استایل پایه
   ایده طراحی: محیط آرام و خوانا برای کار ۸ ساعته منشی؛ تنها عنصر پررنگ «صف روز» است. */

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

:root {
  --bg: #EEF3F2;
  --surface: #FFFFFF;
  --surface-2: #F6F9F8;
  --ink: #16302F;
  --muted: #5E7471;
  --line: #D5DFDD;
  --primary: #0E5E5B;
  --primary-hover: #0A4A48;
  --primary-soft: #DCEBE9;
  --danger: #B4533C;
  --danger-soft: #F6E3DE;
  --success: #2E7D4F;
  --success-soft: #DFF0E5;
  --warn: #A86A12;
  --warn-soft: #F7EBD4;

  /* رنگ وضعیت نوبت‌ها — معنا دارند، تزئینی نیستند */
  --st-booked: #7C8E8B;
  --st-waiting: #A86A12;
  --st-in_visit: #2C5FA8;
  --st-visited: #2E7D4F;
  --st-referred: #6B4FA0;
  --st-discharged: #0E5E5B;
  --st-absent: #B4533C;
  --st-cancelled: #A3B0AE;

  --radius-s: 6px;
  --radius-m: 10px;
  --sidebar: 232px;
  --fs-xs: 12px; --fs-s: 13px; --fs-m: 15px; --fs-l: 18px; --fs-xl: 24px; --fs-xxl: 34px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: var(--fs-m);
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-l); }
h3 { font-size: var(--fs-m); }
code, [dir="ltr"] { font-family: "Vazirmatn", Consolas, monospace; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- قاب اصلی ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: #C9D8D6;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { color: #fff; font-weight: 800; font-size: var(--fs-l); padding: 0 10px 4px; }
.brand-sub { font-size: var(--fs-xs); color: #8FA6A3; padding: 0 10px 18px; }
.nav-group { font-size: var(--fs-xs); color: #7F9794; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #D9E5E3; padding: 8px 10px; border-radius: var(--radius-s);
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .today { font-weight: 600; }
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .user { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-s); }
.topbar .menu-toggle { display: none; }
.content { padding: 24px 28px 60px; max-width: 1280px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: var(--fs-s); }

/* ---------- اجزای پایه ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: var(--fs-m); font-weight: 700; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: var(--fs-s); font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; line-height: 1.5;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #E7C2B8; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-s { padding: 4px 10px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: var(--fs-s); font-weight: 600; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-size: var(--fs-m); color: var(--ink);
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[dir="ltr"] { text-align: left; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 0 0 6px; accent-color: var(--primary); }
.check { display: inline-flex; align-items: center; font-weight: 500; color: var(--ink); }
.field-error { display: block; color: var(--danger); font-weight: 500; margin-top: 2px; }
.has-error input, .has-error select { border-color: var(--danger); }
.hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 16px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: var(--fs-s); }

.alert { padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 14px; font-size: var(--fs-s); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
th { text-align: right; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #E8EEED; vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: var(--fs-xs); padding: 1px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .btn { margin-top: 10px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); font-size: var(--fs-s); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-weight: 400; opacity: .7; }

.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }

/* ---------- صف روز (عنصر اصلی) ---------- */
.day-nav { display: flex; align-items: center; gap: 8px; }
.day-nav .date-label { font-size: var(--fs-l); font-weight: 700; min-width: 220px; text-align: center; }

.queue { list-style: none; margin: 0; padding: 0; }
.queue-item {
  display: grid;
  grid-template-columns: 72px 70px 1fr auto;
  align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--st, var(--st-booked));
  border-radius: var(--radius-m);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.queue-no {
  font-size: var(--fs-xxl); font-weight: 800; line-height: 1;
  color: var(--st, var(--ink)); text-align: center; font-variant-numeric: tabular-nums;
}
.queue-time { font-weight: 700; font-size: var(--fs-l); font-variant-numeric: tabular-nums; }
.queue-time small { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.queue-who .name { font-weight: 700; font-size: var(--fs-m); }
.queue-who .meta { font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.queue-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { font-size: var(--fs-xs); font-weight: 700; color: var(--st); padding: 2px 10px; border-radius: 20px; background: rgba(22, 48, 47, .06); background: color-mix(in srgb, var(--st) 12%, white); }
.queue-item.is-cancelled, .queue-item.is-absent { opacity: .62; }

.st-booked { --st: var(--st-booked); }
.st-waiting { --st: var(--st-waiting); }
.st-in_visit { --st: var(--st-in_visit); }
.st-visited { --st: var(--st-visited); }
.st-referred { --st: var(--st-referred); }
.st-discharged { --st: var(--st-discharged); }
.st-absent { --st: var(--st-absent); }
.st-cancelled { --st: var(--st-cancelled); }

/* ---------- انتخاب زمان ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.slot {
  padding: 6px 0; text-align: center; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: #fff; cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; font-size: var(--fs-s);
}
.slot:hover { border-color: var(--primary); }
.slot.taken { background: var(--surface-2); color: #A9B6B4; cursor: not-allowed; text-decoration: line-through; }
.slot.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- جستجوی مراجع ---------- */
.ac-list {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 8px 24px rgba(22,48,47,.12); max-height: 360px; overflow-y: auto;
}
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #EEF2F1; }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--primary-soft); }
.ac-item .n { font-weight: 700; }
.ac-item .m { font-size: var(--fs-xs); color: var(--muted); }
.ac-new { color: var(--primary); font-weight: 600; }

.picked-patient {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--primary-soft); border-radius: var(--radius-m); padding: 10px 14px;
}

/* ---------- تقویم شمسی ---------- */
.jdp { position: absolute; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 10px 30px rgba(22,48,47,.16); padding: 10px; width: 272px; font-size: var(--fs-s); }
.jdp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 700; }
.jdp-head button { border: 0; background: none; cursor: pointer; font: inherit; padding: 2px 8px; border-radius: 4px; }
.jdp-head button:hover { background: var(--surface-2); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdp-grid .wd { color: var(--muted); font-size: var(--fs-xs); padding: 2px 0; }
.jdp-grid button { border: 0; background: none; font: inherit; padding: 5px 0; border-radius: 4px; cursor: pointer; }
.jdp-grid button:hover { background: var(--primary-soft); }
.jdp-grid button.today { font-weight: 800; color: var(--primary); }
.jdp-grid button.sel { background: var(--primary); color: #fff; }
.jdp-grid button.fri { color: var(--danger); }

/* ---------- پرونده بیمار ---------- */
.profile-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.profile-name { font-size: var(--fs-xl); font-weight: 800; margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; margin-top: 12px; }
.facts div { font-size: var(--fs-s); }
.facts dt { color: var(--muted); font-size: var(--fs-xs); }
.facts dd { margin: 0; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid #E8EEED; font-size: var(--fs-s); align-items: center; }

/* ---------- پیشخوان ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.stat .v { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--fs-xs); color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- برنامه هفتگی ---------- */
.week-grid td, .week-grid th { text-align: center; }
.week-grid input { margin: 0; text-align: center; padding: 5px; }

/* ---------- ورود ---------- */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; }
.auth-title { font-size: var(--fs-xl); margin-bottom: 4px; }
.auth-card form > * + * { margin-top: 14px; }
.req-list { list-style: none; padding: 0; font-size: var(--fs-s); }
.req-list .ok { color: var(--success); }
.req-list .fail { color: var(--danger); font-weight: 700; }

/* ---------- رسید چاپی (فیش حرارتی ۸۰ میلی‌متری) ---------- */
.receipt { width: 72mm; margin: 0 auto; padding: 4mm 0; font-size: 12px; color: #000; background: #fff; }
.receipt h2 { text-align: center; font-size: 15px; margin: 0 0 2mm; }
.receipt .big { text-align: center; font-size: 40px; font-weight: 800; line-height: 1.1; margin: 3mm 0; }
.receipt .row { display: flex; justify-content: space-between; border-bottom: 1px dashed #999; padding: 1.5mm 0; }
.receipt .foot { text-align: center; margin-top: 3mm; font-size: 11px; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  @page { size: 80mm auto; margin: 0; }
}

/* ---------- موبایل/تبلت ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; right: 0; left: auto; height: 100%; width: 270px; max-width: 86vw; z-index: 60; transform: translateX(100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .topbar .today { display: none; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .queue-item { grid-template-columns: 52px 1fr; }
  .queue-time { grid-column: 2; grid-row: 1; }
  .queue-who { grid-column: 1 / -1; }
  .queue-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- پرونده: گالری و فایل‌ها ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); display: block; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.file-card { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.file-card img, .file-pdf { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.file-pdf { display: grid; place-items: center; font-weight: 800; color: var(--danger); font-size: var(--fs-xl); }
.file-card figcaption { padding: 8px 10px; font-size: var(--fs-s); display: flex; flex-direction: column; gap: 2px; }
.dx-chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 2px; }

/* ---------- سود و زیان ---------- */
.pnl th { text-align: right; color: var(--ink); padding-top: 14px; }
.pnl tr.sub td { font-weight: 700; border-top: 1px solid var(--line); }
.pnl tr.total td { font-weight: 800; font-size: var(--fs-l); border-top: 2px solid var(--ink); }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; }
.trend .bars { height: 140px; display: flex; gap: 3px; align-items: flex-end; justify-content: center; }
.trend .bars span { width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; }
.b-in { background: var(--success); } .b-out { background: var(--danger); opacity: .75; }
.trend .lbl { text-align: center; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- صفحه عمومی نوبت‌دهی ---------- */
body.public { background: var(--bg); }
.pub-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.pub-head { background: var(--ink); color: #fff; padding: 12px 0; }
.pub-head .pub-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pub-head nav { margin-inline-start: auto; display: flex; gap: 14px; }
.pub-head a { color: #CFE0DE; }
.pub-hero { padding: 26px 0 10px; }
.pub-hero h1 { font-size: var(--fs-xxl); margin-bottom: 4px; }
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.day-chip { flex: none; width: 68px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; padding: 8px 0;
  border: 1px solid var(--line); border-radius: var(--radius-m); background: #fff; font: inherit; font-size: var(--fs-xs); cursor: pointer; color: var(--muted); }
.day-chip strong { font-size: var(--fs-l); color: var(--ink); }
.day-chip.selected { background: var(--primary); border-color: var(--primary); color: #D6EAE8; }
.day-chip.selected strong { color: #fff; }

/* ---------- انتخاب بیمه نسخه ---------- */
.ins-warning strong { font-family: Consolas, monospace; margin-inline-end: 6px; }
.ins-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ins-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 2px solid var(--line);
  border-radius: var(--radius-m); background: #fff; color: var(--ink); font-weight: 700; text-align: center; }
.ins-choice:hover { text-decoration: none; border-color: var(--c, var(--primary)); }
.ins-choice small { font-weight: 500; color: var(--muted); font-size: var(--fs-xs); }
.ins-choice .ins-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.ins-choice.selected { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, white); }
.ins-tamin { --c: #1F5FA8; } .ins-salamat { --c: #2E7D4F; } .ins-mosalah { --c: #7A5B2E; } .ins-paper { --c: #7C8E8B; }
.ins-inquiry { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: var(--fs-s); }

/* ---------- بارگذاری داده نمایشی ---------- */
.demo-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 10px 0 14px; }
.demo-bar span { display: block; height: 100%; background: var(--primary); transition: width .3s; }
.demo-steps { list-style: none; padding: 0; margin: 0; columns: 2; font-size: var(--fs-s); }
.demo-steps li { padding: 4px 0; break-inside: avoid; }
.demo-steps .st { display: inline-block; width: 18px; font-weight: 800; color: var(--muted); }
.demo-steps li.ok .st { color: var(--success); } .demo-steps li.fail .st { color: var(--danger); } .demo-steps li.run { font-weight: 700; }
@media (max-width: 960px) { .demo-steps { columns: 1; } }

/* =====================================================================
   تم «فیروزه» (پیش‌فرض) — الهام از کاشی لاجوردی و فیروزه‌ای یزد
   تم «ساده» همان متغیرهای :root بالای فایل است.
   ===================================================================== */
:root[data-theme="firouzeh"] {
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F4F7FB;
  --ink: #17224A;
  --muted: #5A6485;
  --line: #DCE3EE;
  --primary: #0F7F88;
  --primary-hover: #0B666E;
  --primary-soft: #DDF1F1;
  --lapis: #1C2C5E;
  --lapis-deep: #121D42;
  --firouzeh: #3FC1C0;
  --saffron: #D29A2C;
  --radius-s: 8px;
  --radius-m: 14px;
  --lift: 0 1px 2px rgba(23, 34, 74, .05), 0 10px 28px -18px rgba(23, 34, 74, .35);
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.075' stroke-width='1.1'%3E%3Cpath d='M32 8l7 17 17 7-17 7-7 17-7-17-17-7 17-7z'/%3E%3Cpath d='M32 20l12 12-12 12-12-12z'/%3E%3Cpath d='M0 0l8 8M64 0l-8 8M0 64l8-8M64 64l-8-8'/%3E%3C/g%3E%3C/svg%3E");
}

/* نوار کناری لاجوردی با نقش گره */
[data-theme="firouzeh"] .sidebar {
  background: var(--girih), linear-gradient(180deg, var(--lapis) 0%, var(--lapis-deep) 100%);
  color: #C9D3F0;
  padding-top: 26px;
}
[data-theme="firouzeh"] .brand { font-size: 20px; letter-spacing: -.2px; }
[data-theme="firouzeh"] .brand-sub { color: var(--saffron); font-weight: 700; padding-bottom: 22px; position: relative; }
[data-theme="firouzeh"] .brand-sub::after {
  content: ""; position: absolute; right: 10px; bottom: 10px; width: 36px; height: 2px;
  background: linear-gradient(90deg, var(--firouzeh), transparent);
}
[data-theme="firouzeh"] .nav-group { color: #8C99C4; }
[data-theme="firouzeh"] .nav a { color: #DCE3FA; border-radius: 10px; padding: 9px 12px; }
[data-theme="firouzeh"] .nav a:hover { background: rgba(255, 255, 255, .07); }
[data-theme="firouzeh"] .nav a.active {
  background: linear-gradient(270deg, rgba(63, 193, 192, .28), rgba(63, 193, 192, .06));
  box-shadow: inset -3px 0 0 var(--firouzeh);
  color: #fff;
}
[data-theme="firouzeh"] .nav a.active svg { opacity: 1; color: var(--firouzeh); }

/* نوار بالا شیشه‌ای */
[data-theme="firouzeh"] .topbar {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom-color: rgba(220, 227, 238, .8);
}
[data-theme="firouzeh"] .topbar .today { color: var(--lapis); }
[data-theme="firouzeh"] .topbar .search input { background: var(--surface-2); border-color: transparent; border-radius: 999px; padding-inline: 18px; }
[data-theme="firouzeh"] .topbar .search input:focus { background: #fff; border-color: var(--primary); }

/* تیترها و پنل‌ها */
[data-theme="firouzeh"] h1 { color: var(--lapis); font-weight: 800; letter-spacing: -.3px; }
[data-theme="firouzeh"] .panel, [data-theme="firouzeh"] .stat { border-color: transparent; box-shadow: var(--lift); }
[data-theme="firouzeh"] .panel-title { color: var(--lapis); }
[data-theme="firouzeh"] .stat .v { color: var(--lapis); }
[data-theme="firouzeh"] .stat { position: relative; overflow: hidden; }
[data-theme="firouzeh"] .stat::before {
  content: ""; position: absolute; top: 14px; bottom: 14px; right: 0; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--st, var(--firouzeh));
}

/* دکمه‌ها */
[data-theme="firouzeh"] .btn { border-radius: 10px; }
[data-theme="firouzeh"] .btn-primary { background: linear-gradient(180deg, #12909A, var(--primary)); border-color: var(--primary); box-shadow: 0 6px 14px -8px rgba(15, 127, 136, .8); }
[data-theme="firouzeh"] .btn-primary:hover { background: var(--primary-hover); }

/* تب‌ها: قرص به‌جای خط زیر */
[data-theme="firouzeh"] .tabs { border-bottom: 0; gap: 6px; background: var(--surface); padding: 6px; border-radius: 12px; box-shadow: var(--lift); }
[data-theme="firouzeh"] .tabs a { border: 0; border-radius: 8px; padding: 7px 14px; }
[data-theme="firouzeh"] .tabs a:hover { background: var(--surface-2); }
[data-theme="firouzeh"] .tabs a.active { background: var(--lapis); color: #fff; }
[data-theme="firouzeh"] .tabs a.active .count { opacity: .75; }

/* صف روز — عنصر اصلی */
[data-theme="firouzeh"] .queue-item {
  border: 0; box-shadow: var(--lift); border-radius: 16px;
  border-inline-start: 5px solid var(--st, var(--st-booked));
  padding: 14px 18px;
}
[data-theme="firouzeh"] .queue-no {
  width: 60px; height: 60px; display: grid; place-items: center; font-size: 28px; border-radius: 16px;
  background: color-mix(in srgb, var(--st) 11%, white);
}
[data-theme="firouzeh"] .queue-time { color: var(--lapis); }
[data-theme="firouzeh"] .status-pill { padding: 3px 12px; }

/* جدول‌ها و فرم */
[data-theme="firouzeh"] th { color: var(--muted); font-weight: 700; }
[data-theme="firouzeh"] tbody tr:hover { background: #F2F8F8; }
[data-theme="firouzeh"] input, [data-theme="firouzeh"] select, [data-theme="firouzeh"] textarea { border-radius: 10px; }
[data-theme="firouzeh"] .tag { background: var(--primary-soft); color: var(--primary); }
[data-theme="firouzeh"] .alert { border-radius: 12px; }

/* صفحه ورود و صفحات عمومی */
[data-theme="firouzeh"] body.auth-page { background: var(--girih), radial-gradient(circle at 70% 20%, #2A3F80 0%, var(--lapis) 45%, var(--lapis-deep) 100%); }
[data-theme="firouzeh"] .auth-card { border: 0; border-radius: 22px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .55); border-top: 4px solid var(--firouzeh); }
[data-theme="firouzeh"] .auth-title { color: var(--lapis); }
[data-theme="firouzeh"] .pub-head { background: var(--girih), linear-gradient(90deg, var(--lapis-deep), var(--lapis)); }
[data-theme="firouzeh"] .day-chip { border-radius: 14px; }
[data-theme="firouzeh"] .day-chip.selected { background: var(--lapis); border-color: var(--lapis); }

/* ---------- سوییچ تم ---------- */
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-inline-start: auto; }
.theme-switch button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; font: inherit; font-size: var(--fs-xs);
  font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.theme-switch button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.theme-switch .sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sw-firouzeh { background: conic-gradient(#1C2C5E 0 50%, #3FC1C0 0 100%); }
.sw-simple { background: conic-gradient(#16302F 0 50%, #EEF3F2 0 100%); border: 1px solid #C9D5D3; }
.topbar .theme-switch + .user { margin-inline-start: 0; }
@media (max-width: 960px) { .theme-switch button { font-size: 0; gap: 0; padding: 6px; } }
@media print { [data-theme] .sidebar, [data-theme] .topbar { display: none; } }

/* ---------- ویجت دسترسی سریع ---------- */
.qa-fab { position: fixed; left: 22px; bottom: 22px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.qa-main { width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; font-size: 30px; line-height: 1; color: #fff;
  background: var(--primary); box-shadow: 0 10px 24px -8px rgba(15, 80, 90, .55); transition: transform .15s; }
.qa-main[aria-expanded="true"] { transform: rotate(45deg); }
.qa-menu { background: var(--surface); border-radius: 14px; padding: 6px; box-shadow: 0 16px 40px -12px rgba(23, 34, 74, .35); min-width: 230px; }
.qa-menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; border: 0; background: none; font: inherit;
  font-weight: 600; color: var(--ink); padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: start; }
.qa-menu button:hover, .qa-menu button:focus-visible { background: var(--primary-soft); }
kbd { font-family: inherit; font-size: var(--fs-xs); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; direction: ltr; }
.qa-dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, 94vw); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .45); }
.qa-dialog::backdrop { background: rgba(18, 29, 66, .45); }
.qa-dialog-in { padding: 18px 20px 20px; }
.qa-today { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.qa-today button { display: flex; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 8px 10px; font: inherit; cursor: pointer; text-align: start; border-inline-start: 4px solid var(--st, var(--line)); }
.qa-today button:hover { background: var(--primary-soft); }
.qa-today .queue-no { font-size: var(--fs-l); width: 32px; color: var(--st, var(--ink)); }
.qa-today small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.btn.qa { border-color: var(--primary-soft); color: var(--primary); }

/* ---------- فعالیت روی مراجع ---------- */
.act-card { background: var(--surface); border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 10px; border: 1px solid var(--line); }
[data-theme="firouzeh"] .act-card { border-color: transparent; box-shadow: var(--lift); }
.act-card header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.act-card .act-meta { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--muted); }
.act-card p { margin: 6px 0; font-size: var(--fs-s); }
.act-card form { text-align: end; }
.act-items { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.act-items li { background: var(--surface-2); border-radius: 8px; padding: 2px 10px; font-size: var(--fs-s); }
.act-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.act-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; display: block; }
.act-queue { list-style: none; padding: 0; margin: 0; }
.act-queue li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.act-queue .queue-no { font-size: var(--fs-l); min-width: 34px; color: var(--st); }
[data-theme="firouzeh"] .act-queue .queue-no { width: 40px; height: 40px; font-size: var(--fs-l); border-radius: 12px; }
.act-queue .who { flex: 1; min-width: 160px; }
.act-queue .who small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.photo-drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius-m); padding: 18px; text-align: center; cursor: pointer; color: var(--muted); }
.photo-drop:hover { border-color: var(--primary); color: var(--primary); }
.photo-drop input { margin: 0 auto 8px; max-width: 320px; }
@media (max-width: 960px) { .qa-fab { bottom: 16px; left: 16px; } }

.quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.quick-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: start; }
.quick-tile b { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.quick-tile span { flex: 1; }
.quick-tile:hover { border-color: var(--primary); }
[data-theme="firouzeh"] .quick-tile { border-color: transparent; box-shadow: var(--lift); }

[data-theme] .qa-today .queue-no { width: 34px; height: 34px; font-size: var(--fs-m); border-radius: 10px; flex: none; }

/* ---------- نوار داده نمونه ---------- */
.demo-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-m);
  background: var(--surface); border: 1px dashed var(--line); font-size: var(--fs-s); }
.demo-banner span { flex: 1; min-width: 200px; }
.demo-banner.on { background: var(--warn-soft); border-color: #E6C98E; color: #6B4A10; }
.demo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }


/* =====================================================================
   موبایل و تبلت — بازنویسی (نسخه ۴.۶)
   ===================================================================== */
.nav-close { display: none; }
.nav-backdrop { display: none; } /* فقط در موبایل؛ روی دسکتاپ نباید خانه‌ای از گرید را بگیرد */
code { overflow-wrap: anywhere; word-break: break-word; }
.stat .v { overflow-wrap: anywhere; }
.form-actions { flex-wrap: wrap; }

@media (max-width: 960px) {
  html, body { max-width: 100%; }
  body.nav-open { overflow: hidden; }
  /* پرده پشت منو — لمس آن منو را می‌بندد */
  .nav-backdrop { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(15, 22, 45, .45); z-index: 55;
    opacity: 0; visibility: hidden; transition: opacity .2s; }
  body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
  .sidebar { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 40px; box-shadow: -12px 0 40px rgba(0, 0, 0, .25); }
  .nav-close { display: inline-flex; position: absolute; left: 12px; top: 14px; width: 34px; height: 34px; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 20px; cursor: pointer; }
  .nav a { padding: 11px 12px; }

  /* نوار بالا: ردیف اول دکمه‌ها، ردیف دوم جستجو */
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .topbar .search { order: 10; flex: 1 1 100%; max-width: none; }
  .topbar .user span { display: none; }
  .topbar .theme-switch { margin-inline-start: auto; }

  .content { padding: 14px 12px 90px; }
  .page-head { align-items: stretch; }
  .page-head > div, .page-head > form, .page-head > a, .page-head > button { max-width: 100%; }
  .page-head form { flex-wrap: wrap; }
  .page-head form label { flex: 1 1 120px; }
  .page-head form input[style*="width"] { width: 100% !important; }
  .day-nav { width: 100%; justify-content: space-between; }
  .day-nav .date-label { min-width: 0; font-size: var(--fs-m); }

  .panel { padding: 14px; }
  .panel-title { flex-wrap: wrap; gap: 6px; }
  /* جدول‌ها داخل خودشان اسکرول می‌شوند، نه کل صفحه */
  .panel table, .content > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .panel table td[style*="max-width"] { white-space: normal; min-width: 220px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .v { font-size: var(--fs-l); }
  .quick-row { grid-template-columns: 1fr; gap: 8px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-head { grid-template-columns: 1fr; }
  .profile-head > div:last-child { flex-direction: row !important; flex-wrap: wrap; }
  .timeline li { grid-template-columns: 80px 1fr; }
  .timeline li .status-pill { grid-column: 2; justify-self: start; }
  .tabs { margin-inline: -2px; }
  .demo-steps { columns: 1; }
  .ins-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .act-queue li { gap: 6px; }
  .week-grid input { min-width: 64px; }
  .qa-dialog { width: 96vw; max-height: 86vh; }
  .theme-switch button { padding: 6px 8px; }
  dl.facts dd { overflow-wrap: anywhere; }
  .trend .bars { height: 100px; }
  .trend .bars span { width: 9px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .queue-item { padding: 10px 12px; gap: 8px; }
  [data-theme="firouzeh"] .queue-no { width: 46px; height: 46px; font-size: 22px; }
  .queue-actions .btn-s { padding: 5px 8px; }
}

.profile-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 12px; }
.profile-card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 2px solid var(--line); border-radius: var(--radius-m); cursor: pointer; color: var(--ink); font-weight: 700; }
.profile-card input { display: none; }
.profile-card b { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 22px; }
.profile-card small { display: block; font-weight: 500; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.profile-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.profile-card input:checked + b { background: var(--primary); color: #fff; }

/* ستون‌های گرید نباید با محتوای عریض (جدول) بزرگ‌تر از صفحه شوند */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.main, .content, .panel, .grid-2 > *, .form-grid > * { min-width: 0; }
.main { overflow-x: clip; }
@media (max-width: 960px) {
  .grid-2, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-width: 100%; }
}
@media (max-width: 960px) { .sidebar .brand { padding-left: 46px; font-size: var(--fs-l); } .timeline li > span:nth-child(2) { overflow-wrap: anywhere; } }

.rx-card:target { box-shadow: 0 0 0 3px var(--primary-soft), var(--lift, none); border-color: var(--primary); }
