:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --border: #e2e5e0;
  --text: #1c2421;
  --muted: #66716c;
  --primary: #0f766e;
  --primary-soft: #e3f3f1;
  --primary-text: #ffffff;
  --red: #c2410c;
  --red-soft: #fdece4;
  --yellow: #a16207;
  --yellow-soft: #fdf4dc;
  --green: #15803d;
  --green-soft: #e4f5e9;
  --blue: #1d4ed8;
  --blue-soft: #e6edfd;
  --l1: #7c2d12; --l2: #6d28d9; --l3: #0f766e; --l4: #1d4ed8; --l5: #4b5563;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111614; --surface: #19201d; --surface-2: #212a26; --border: #2d3833;
    --text: #e6ebe8; --muted: #93a19a; --primary: #2dd4bf; --primary-soft: #133a35; --primary-text: #062a26;
    --red: #fb923c; --red-soft: #3a1f12; --yellow: #facc15; --yellow-soft: #352c0e; --green: #4ade80; --green-soft: #12301d;
    --blue: #93b4ff; --blue-soft: #1a2542;
    --l1: #fdba74; --l2: #c4b5fd; --l3: #5eead4; --l4: #93c5fd; --l5: #cbd5e1;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111614; --surface: #19201d; --surface-2: #212a26; --border: #2d3833;
  --text: #e6ebe8; --muted: #93a19a; --primary: #2dd4bf; --primary-soft: #133a35; --primary-text: #062a26;
  --red: #fb923c; --red-soft: #3a1f12; --yellow: #facc15; --yellow-soft: #352c0e; --green: #4ade80; --green-soft: #12301d;
  --blue: #93b4ff; --blue-soft: #1a2542;
  --l1: #fdba74; --l2: #c4b5fd; --l3: #5eead4; --l4: #93c5fd; --l5: #cbd5e1;
  --shadow: none; color-scheme: dark;
}

/* فونت وزیرمتن روی همین سرور (فقط حروف فارسی؛ حروف لاتین با فونت خود گوشی که هم‌خانواده است). یک فایل برای همه وزن‌ها */
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/Vazirmatn-NL.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Vazirmatn, Roboto, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
code, .ltr { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ── Layout */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side {
  background: var(--surface); border-inline-start: 0; border-inline-end: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.me-card { background: var(--surface-2); border-radius: var(--radius); padding: 12px; }
.me-card .name { font-weight: 700; }
.me-card .title { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .sep { font-size: 11.5px; color: var(--muted); padding: 12px 10px 4px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav a .ico { width: 18px; text-align: center; opacity: .8; }
.side .foot { margin-top: auto; display: flex; gap: 6px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ── Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }

.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--primary); }
.tile .num { font-size: 30px; font-weight: 800; line-height: 1.2; }
.tile .lbl { color: var(--muted); font-size: 13px; }
.tile.red .num { color: var(--red); }
.tile.yellow .num { color: var(--yellow); }
.tile.blue .num { color: var(--blue); }
.tile.green .num { color: var(--green); }

.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 3px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.yellow { background: var(--yellow-soft); color: var(--yellow); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.primary { background: var(--primary-soft); color: var(--primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }
.lvl { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.lvl-1 { color: var(--l1); } .lvl-2 { color: var(--l2); } .lvl-3 { color: var(--l3); } .lvl-4 { color: var(--l4); } .lvl-5 { color: var(--l5); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.item { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 2px; color: var(--text); }
a.item:hover { text-decoration: none; background: var(--surface-2); border-radius: 8px; }
.item .t { font-weight: 600; }
.item .m { font-size: 12.5px; color: var(--muted); }
.item .side-info { text-align: left; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.empty { color: var(--muted); padding: 14px 2px; font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { width: 100%; min-height: 90px; resize: vertical; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.field input, .field select { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks.boxed { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.bar.red > span { background: var(--red); } .bar.yellow > span { background: var(--yellow); }

.unit-card { display: block; color: var(--text); }
.unit-card:hover { text-decoration: none; border-color: var(--primary); }
.unit-card .stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.why { border: 1px dashed var(--primary); background: var(--primary-soft); border-radius: var(--radius); padding: 12px 14px; font-size: 13.5px; }
.why b { color: var(--primary); }
.factors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.factor { border-radius: 10px; padding: 10px; text-align: center; border: 1px solid var(--border); background: var(--surface); }
.factor .f-t { font-size: 12px; color: var(--muted); }
.factor .f-v { font-weight: 800; font-size: 15px; }
.factor.ok { border-color: var(--green); } .factor.ok .f-v { color: var(--green); }
.factor.no { border-color: var(--red); } .factor.no .f-v { color: var(--red); }

.result { border-radius: var(--radius); padding: 16px; font-weight: 700; font-size: 16px; }
.result.ok { background: var(--green-soft); color: var(--green); }
.result.no { background: var(--red-soft); color: var(--red); }

.matrix td, .matrix th { text-align: center; padding: 6px; font-size: 12px; }
.matrix th:first-child, .matrix td:first-child { text-align: start; font-weight: 700; white-space: nowrap; }
.mcell { display: inline-flex; gap: 2px; }
.mcell span { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); opacity: .35; }
.mcell span.on { opacity: 1; }
.mcell span.v.on { background: var(--blue-soft); color: var(--blue); }
.mcell span.c.on { background: var(--green-soft); color: var(--green); }
.mcell span.e.on { background: var(--yellow-soft); color: var(--yellow); }
.mcell span.d.on { background: var(--red-soft); color: var(--red); }
.mcell span.s.on { background: var(--l2); color: #fff; }

.grant { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.grant + .grant { margin-top: 12px; }
.grant.template { background: var(--surface-2); }
.grant .row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--border); align-items: start; }
.grant .row:first-of-type { border-top: 0; }
.grant .row > b { font-size: 12.5px; color: var(--muted); padding-top: 2px; }

.lvl-table td:first-child { white-space: nowrap; }
.today-hero { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000)); color: #fff; border-radius: 16px; padding: 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.today-hero h1 { color: #fff; }
.today-hero p { margin: 4px 0 0; opacity: .9; }
.today-hero .btn { background: #fff; color: #0f766e; border-color: #fff; font-size: 15px; padding: 10px 18px; }
:root[data-theme="dark"] .today-hero, :root:not([data-theme="light"]) .today-hero { color: #fff; }

/* ── Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.login-form { padding: 48px 40px; background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-form form { display: grid; gap: 12px; }
.login-demo { padding: 48px 40px; overflow-y: auto; }
.demo-level { margin-bottom: 20px; }
.demo-level h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.demo-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.demo-user { text-align: start; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.demo-user:hover { border-color: var(--primary); }
.demo-user b { display: block; }
.demo-user span { font-size: 12px; color: var(--muted); }
.error { color: var(--red); font-size: 13px; min-height: 1em; scroll-margin-top: 80px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); color: #fff; }

/* ── Responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 280px; z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .factors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-form, .login-demo { padding: 28px 16px; }
  .grant .row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: 1fr 1fr; } .tile .num { font-size: 24px; } }

/* ── Simplified UI */
.login-simple { max-width: 880px; margin: 0 auto; padding: 40px 16px; display: flex; flex-direction: column; gap: 18px; }
.login-simple .demo-level h3 { color: var(--muted); font-size: 13px; }
.demo-user { padding: 14px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--primary); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '‹ '; display: inline-block; transition: transform .15s; }
details[open] > summary::before { transform: rotate(-90deg); }
summary.btn::before { content: none; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 5px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; font-weight: 600; }
.tab:hover { text-decoration: none; border-color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.unit-pill { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); border-inline-start: 4px solid var(--green); }
.unit-pill.warn { border-inline-start-color: var(--red); }
.unit-pill:hover { text-decoration: none; background: var(--surface-2); }
.unit-pill span { font-size: 12.5px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.facts > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.facts span { font-size: 12px; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input, .level-pick input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 14px; border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.seg input:focus-visible + span, .level-pick input:focus-visible + span { outline: 2px solid var(--primary); }
.level-pick { display: grid; gap: 8px; margin-top: 10px; }
.level-pick span { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.level-pick small { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.level-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.nav a { padding: 10px 12px; font-size: 15px; }

/* ── App (PWA) */
#offline { position: fixed; top: 0; inset-inline: 0; z-index: 60; background: var(--yellow-soft); color: var(--yellow); text-align: center; font-weight: 700; font-size: 13.5px; padding: calc(6px + env(safe-area-inset-top)) 16px 6px; }
.install-btn { min-height: 44px; justify-content: center; }
.side .install-btn { width: 100%; }
@media (display-mode: standalone) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
  .side { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  body { -webkit-tap-highlight-color: transparent; }
}
button, a, .tab, summary { touch-action: manipulation; }

/* ── جلوگیری از انتخاب ناخواسته متن با لمس */
a, button, summary, label, .btn, .tab, .item, .tile, .unit-pill, .demo-user, .chip, .lvl, .nav, .brand, .me-card, .topbar, .seg, .level-pick, .card-head, th {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
@media (display-mode: standalone), (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, select, [contenteditable], .selectable { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
}
.danger-zone { border-color: var(--red); }
.danger-zone h3 { color: var(--red); }

/* ── اثر انگشت */
.fp-icon { width: 22px; height: 22px; flex-shrink: 0; }
.bio-btn { min-height: 48px; font-size: 15.5px; padding: 10px 20px; }
.bio-login { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bio-login .bio-btn { width: 100%; max-width: 360px; justify-content: center; }
.bio-login .fp-icon { width: 26px; height: 26px; }
.bio-offer { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-color: var(--primary); background: var(--primary-soft); }
.bio-offer-text { display: flex; gap: 12px; align-items: flex-start; }
.bio-offer-text .fp-icon { width: 34px; height: 34px; color: var(--primary); }
.bio-offer p { margin: 2px 0 0; }
.login-simple .field { display: grid; gap: 4px; }

/* ── رفع بیرون‌زدگی صفحه در موبایل: ورودی‌های رادیویی پنهان نباید عرض کامل بگیرند */
.seg label, .level-pick label { position: relative; }
.seg input, .level-pick input, .field .seg input, .field .level-pick input { width: 1px; height: 1px; inset-inline-start: 0; top: 0; margin: 0; }
.field { min-width: 0; }
select { max-width: 100%; }
html { overflow-x: clip; }

/* ── انتخابگر تاریخ شمسی */
.jdate { position: relative; }
.jdate-btn { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer; text-align: start; }
.jdate-btn svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.jdate-btn:focus-visible, .jdate-pop button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.jdate-pop { position: absolute; z-index: 45; top: calc(100% + 6px); inset-inline-start: 0; width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 10px; }
.jdate-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.jdate-nav { width: 40px; height: 40px; border: 0; background: var(--surface-2); color: var(--text); border-radius: 8px; font-size: 20px; cursor: pointer; }
.jdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdate-wd { font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.jdate-wd.fri, .jdate-day.fri { color: var(--red); }
.jdate-day { height: 40px; border: 0; background: transparent; color: var(--text); border-radius: 8px; font: inherit; cursor: pointer; }
.jdate-day:hover { background: var(--surface-2); }
.jdate-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.jdate-day.sel { background: var(--primary); color: var(--primary-text); font-weight: 700; }
.jdate-foot { display: flex; gap: 6px; justify-content: space-between; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.unit-row { align-items: center; gap: 8px; }
/* ── منو و نوار بالا (طراحی جدید) */
.ico { width: 20px; height: 20px; flex-shrink: 0; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.icon-btn:hover { border-color: var(--primary); }
.icon-btn:active { background: var(--surface-2); }
.icon-btn .ico { width: 22px; height: 22px; }
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 14px; flex-shrink: 0; }
.avatar:hover { text-decoration: none; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }

.side { gap: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-close { display: none; }
.me-card { display: flex; gap: 12px; align-items: center; }
.me-info { min-width: 0; }
.me-info .name { overflow-wrap: anywhere; }
.nav { gap: 4px; }
.nav a { position: relative; min-height: 46px; gap: 12px; padding: 10px 14px; border-radius: 10px; color: var(--text); font-weight: 500; transition: background .15s, color .15s; }
.nav a .ico { color: var(--muted); transition: color .15s; }
.nav a:hover .ico { color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav a.active .ico { color: var(--primary); }
.nav a.active::before { content: ''; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--primary); }
.nav a:focus-visible, .nav-btn:focus-visible, .icon-btn:focus-visible, .avatar:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.side .install-btn { gap: 10px; }
.side .foot { margin-top: auto; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 500; border-radius: 10px; cursor: pointer; text-align: start; }
.nav-btn .ico { color: var(--muted); }
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.danger, .nav-btn.danger .ico { color: var(--red); }
.nav-btn.danger .ico { transform: scaleX(-1); }
.scrim { display: none; }

@media (max-width: 860px) {
  .topbar { display: flex; align-items: center; gap: 12px; justify-content: flex-start; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .topbar-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .topbar-title b { display: block; font-size: 15px; line-height: 1.3; }
  .topbar-title span { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side { position: fixed; inset: 0 0 0 auto; width: min(300px, 86vw); height: 100dvh; z-index: 50; transform: translateX(100%); visibility: hidden;
    transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s linear .28s; box-shadow: -12px 0 40px rgba(0,0,0,.25); border-inline-end: 0; border-inline-start: 1px solid var(--border);
    padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.menu-open .side { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s; }
  .side-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .side, .scrim, body.menu-open .side { transition: none !important; } }
.topbar-title .logo { display: grid; place-items: center; flex-shrink: 0; background: var(--primary); color: var(--primary-text); font-weight: 800; }
/* ── لوگوی مؤسسه */
.logo-img { width: 40px; height: 40px; border-radius: 10px; display: block; flex-shrink: 0; object-fit: cover; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.logo-img.sm { width: 34px; height: 34px; border-radius: 9px; }
.logo-img.lg { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.login-brand { flex-direction: column; justify-content: center; gap: 12px; text-align: center; }
/* ── اعلان‌ها */
:root { --badge: #d92d20; }
#pushOffer:empty, #bioOffer:empty { display: none; }
.bell { position: relative; flex-shrink: 0; }
.bell:hover { text-decoration: none; }
.badge { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 11.5px; font-weight: 800; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.nav-count { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--badge); color: #fff; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
[data-unread][hidden] { display: none; }
@media (max-width: 860px) { .topbar { gap: 10px; } }
.push-offer .bio-offer-text > .ico { width: 30px; height: 30px; color: var(--primary); margin-top: 2px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; margin: 0 -10px; min-height: 48px; color: var(--text); border-radius: 10px; transition: background .15s; }
.notif:hover { text-decoration: none; background: var(--surface-2); }
.notif:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; box-shadow: inset 0 0 0 1.5px var(--border); }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.notif.unread:hover { background: var(--primary-soft); }
.notif.unread .notif-dot { background: var(--primary); box-shadow: none; }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-body .t { font-weight: 600; line-height: 1.5; }
.notif.unread .notif-body .t { font-weight: 800; }
.notif-body .m { font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.notif-time { font-size: 12px; color: var(--muted); white-space: nowrap; margin-top: 3px; flex-shrink: 0; }
.notif-empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.notif-empty > .ico { width: 40px; height: 40px; color: var(--primary); opacity: .7; }
.notif-empty p { margin: 6px 0 0; }
.notif-empty b { color: var(--text); }
.push-card .notify-all { border-top: 1px solid var(--border); padding-top: 12px; line-height: 1.6; align-items: flex-start; }
.push-card .notify-all input { margin-top: 4px; }
#pushMsg:empty { display: none; }
.push-steps { margin: 0; padding-inline-start: 20px; font-size: 13.5px; line-height: 1.9; }
.push-steps b { color: var(--text); }
.android-dl { align-self: center; justify-content: center; gap: 10px; min-height: 44px; }
.side .android-dl { align-self: stretch; }
/* عنصری که hidden دارد همیشه پنهان بماند (کلاس‌هایی مثل .btn نمایش را بازنویسی می‌کردند) */
[hidden] { display: none !important; }
/* چک‌باکس در فرم‌ها: کنار متن خودش، نه تمام‌عرض */
.field .check { display: flex; align-items: flex-start; gap: 8px; line-height: 1.7; }
.field .check input { width: auto; flex-shrink: 0; margin: 5px 0 0; }
/* ── نمایش رمز و رنگ فیلدهای پرشده خودکار */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.pw-toggle .ico { width: 20px; height: 20px; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset; box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s ease-out 0s;
}
/* دکمه‌های کارت اعلان روی گوشی: دست‌کم ۴۴ پیکسل برای لمس راحت */
.push-card .btn, .push-offer .btn { min-height: 44px; }
/* ── گزارش روزانه */
.grow { flex: 1; min-width: 0; }
.req { color: var(--red); }
.hint { margin: 4px 0 0; }
.hint:empty { display: none; }
.btn-lg { min-height: 48px; padding: 10px 20px; font-size: 15.5px; justify-content: center; }
.report-page { max-width: 760px; }
.report-form textarea, #revComment { font-size: 16px; line-height: 1.8; }
.report-form textarea[aria-invalid="true"] { border-color: var(--red); }
.report-title { font-size: 19px; }
.report-sec h3 { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.report-sec p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-sec + .report-sec { padding-top: 14px; border-top: 1px dashed var(--border); }
.review-box { border-top: 1px solid var(--border); padding-top: 14px; }
.review-box h3 { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.review-list .review { padding: 12px 0; }
.review-list .review:first-child { padding-top: 0; }
.review-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.review p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.item .preview { color: var(--text); opacity: .85; margin-top: 2px; }
.day-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.day-nav > .btn { min-height: 44px; justify-content: center; }
.day-pick { min-width: 0; }
@media (max-width: 600px) {
  .day-nav { grid-template-columns: 1fr 1fr; grid-template-areas: "pick pick" "prev next"; }
  .day-nav .day-pick { grid-area: pick; } .day-nav .prev { grid-area: prev; } .day-nav .next { grid-area: next; }
}
.day-stats { margin: 0; }
.missing summary { padding: 2px 0; min-height: 32px; }
.missing .list { margin-top: 8px; }
.score-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.score-pick legend { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 6px; }
.score-opts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.score-opts label { position: relative; min-width: 0; }
.score-opts input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; top: 0; inset-inline-start: 0; pointer-events: none; }
.score-opts span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; padding: 6px 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.score-opts span:hover { border-color: var(--primary); }
.score-opts b { font-size: 18px; line-height: 1.2; }
.score-opts small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.score-opts input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.score-opts input:checked + span small { color: inherit; }
.score-opts input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.tiles2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile .num .of { font-size: 15px; font-weight: 600; color: var(--muted); }
.report-offer .bio-offer-text > .ico { width: 30px; height: 30px; color: var(--primary); margin-top: 2px; }
.report-done { display: flex; align-items: center; gap: 12px; color: var(--text); min-height: 48px; }
.report-done:hover { text-decoration: none; border-color: var(--primary); }
.report-done > .ico { width: 28px; height: 28px; color: var(--green); }
.report-done .grow { display: flex; flex-direction: column; }
@media (prefers-reduced-motion: reduce) { .score-opts span { transition: none; } }
@media (max-width: 400px) { .score-opts small { font-size: 10.5px; } .score-opts { gap: 4px; } }
/* ── کارهای سپرده‌شده که انجام شده‌اند */
.done-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.done-head h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.done-item .t { display: flex; gap: 6px; align-items: flex-start; }
.done-item .t .ico { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; margin-top: 4px; }
/* ── درخواست خرید */
.pr-row .t { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.pr-qty { font-weight: 500; color: var(--muted); font-size: 13px; }
.pr-amount { font-weight: 800; font-size: 14.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pr-turn { font-weight: 700; }
.pr-setup { display: flex; gap: 12px; align-items: flex-start; border-color: var(--yellow); background: var(--yellow-soft); }
.pr-setup > .ico { width: 26px; height: 26px; color: var(--yellow); flex-shrink: 0; margin-top: 2px; }
.pr-setup p { margin: 2px 0 8px; }
.pr-form { max-width: 760px; }
/* گروه‌های فرم: عنوان گروه داخل خود گروه (legend روی خط حاشیه نمی‌نشیند) */
.pr-fs { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pr-fs + .pr-fs { margin-top: 22px !important; }
.pr-fs legend { float: right; width: 100%; font-size: 15px; font-weight: 800; padding: 0 0 8px; margin: 0 0 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.pr-fs legend + * { clear: both; }
.pr-form input:not([type=checkbox]):not([type=radio]), .pr-form select, .pr-form textarea, .pr-action input:not([type=checkbox]):not([type=file]), .pr-action textarea { min-height: 44px; font-size: 16px; }
.pr-qty-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.qty-stepper { display: flex; align-items: stretch; gap: 6px; }
.qty-stepper input { flex: 1; text-align: center; min-width: 0; }
.qty-btn { width: 44px; min-height: 44px; flex-shrink: 0; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer; }
.qty-btn:hover { border-color: var(--primary); }
.qty-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.money { position: relative; display: flex; align-items: center; }
/* عدد سمت راست (شروع خواندن فارسی) و «تومان» سمت چپ؛ ورودی ltr است پس فاصله‌ها فیزیکی تعیین می‌شوند */
.money input { width: 100%; text-align: right; padding-right: 12px; padding-left: 64px; font-size: 18px !important; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.money span { position: absolute; left: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.pr-form [aria-invalid="true"], .pr-action [aria-invalid="true"] { border-color: var(--red); }
.pr-urgent { align-items: center; flex-wrap: wrap; min-height: 32px; }
.pr-route { border: 1px dashed var(--primary); background: var(--primary-soft); border-radius: var(--radius); padding: 12px 14px; }
.pr-route-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--primary); }
.pr-route-head .ico { width: 18px; height: 18px; }
.pr-route ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pr-route li { display: flex; gap: 10px; align-items: flex-start; }
.pr-route li > div { display: flex; flex-direction: column; min-width: 0; }
.pr-route li span:not(.pr-num) { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.pr-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; font-size: 12.5px; font-weight: 800; flex-shrink: 0; }
.pr-route li.skip { opacity: .75; }
.pr-route li.skip .pr-num { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--muted); }
.pr-route li.hot .pr-num { background: var(--yellow); color: var(--surface); }
.pr-route-note { margin: 8px 0 0; color: var(--text); }
.pr-route-note:empty { display: none; }
.pr-note-card { display: flex; gap: 10px; align-items: flex-start; max-width: 760px; margin-bottom: 16px; }
.pr-note-card.warn, .pr-action.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.pr-note-card > .ico { width: 22px; height: 22px; color: var(--yellow); flex-shrink: 0; margin-top: 3px; }
.pr-note-card p { margin: 4px 0 0; white-space: pre-wrap; }
.pr-page { max-width: 820px; }
.pr-head h1 { margin: 10px 0 4px; font-size: 21px; overflow-wrap: anywhere; }
.pr-head .pr-qty { font-size: 15px; }
.pr-page .facts { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.pr-big-amount { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.pr-big-amount b { font-size: 26px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.3; }
.pr-big-amount span { font-size: 12.5px; color: var(--muted); }
#prFlash:empty { display: none; }
#prFlash { background: var(--green-soft); color: var(--green); border-radius: var(--radius); padding: 10px 14px; font-weight: 700; }
.pr-action { border: 1.5px solid var(--primary); }
.pr-action h3 { margin-bottom: 8px; }
.pr-action .field { margin-bottom: 10px; }
.pr-action .error:empty { display: none; }
.pr-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pr-btns .btn .ico { width: 18px; height: 18px; }
.pr-btns .btn.danger { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.pr-override { border-style: dashed; border-color: var(--border); }
.pr-override > summary { padding: 4px 0; min-height: 36px; }
.pr-override[open] > summary { margin-bottom: 8px; }
.pr-cancel-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pr-desc, .pr-quote { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; }
.pr-quote { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
/* مسیر درخواست: عمودی، هر مرحله با نشانه و متن (نه فقط رنگ) */
.pr-steps { list-style: none; margin: 0; padding: 0; }
.pr-steps li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.pr-steps li:last-child { padding-bottom: 0; }
.pr-steps li:not(:last-child)::before { content: ""; position: absolute; top: 30px; bottom: 2px; inset-inline-start: 13px; width: 2px; background: var(--border); }
.pr-steps li.ps-done:not(:last-child)::before { background: var(--green); }
.ps-dot { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; border: 2px solid var(--border); background: var(--surface); color: var(--muted); }
.ps-dot .ico { width: 16px; height: 16px; }
.ps-done .ps-dot { background: var(--green); border-color: var(--green); color: var(--surface); }
.ps-fail .ps-dot { background: var(--red); border-color: var(--red); color: var(--surface); }
.ps-warn .ps-dot { background: var(--yellow); border-color: var(--yellow); color: var(--surface); }
.ps-skip .ps-dot { border-style: dashed; }
.ps-current .ps-dot { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.ps-off { opacity: .45; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: prPulse 1.6s ease-in-out infinite; }
@keyframes prPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.6); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.ps-body { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.ps-current .ps-body > b { color: var(--primary); }
.ps-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.ps-body q, .pr-history q { display: block; margin-top: 6px; background: var(--surface-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-body q::before, .pr-history q::before { content: "«"; }
.ps-body q::after, .pr-history q::after { content: "»"; }
.pr-history .item { align-items: flex-start; }
.pr-history time { white-space: nowrap; flex-shrink: 0; }
/* عکس فاکتور */
.pr-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.pr-photo { position: relative; }
.pr-thumb { display: block; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; width: 96px; height: 96px; }
.pr-thumb img { width: 96px; height: 96px; object-fit: cover; display: block; }
.pr-thumb:focus-visible, .pr-add:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.pr-rm { position: absolute; top: -8px; inset-inline-end: -8px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); background: var(--red); color: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; }
.pr-rm .ico { width: 14px; height: 14px; }
.pr-add { width: 96px; height: 96px; border: 2px dashed var(--primary); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--primary); text-align: center; font-size: 12px; font-weight: 700; cursor: pointer; background: var(--primary-soft); padding: 6px; line-height: 1.4; }
.pr-add .ico { width: 26px; height: 26px; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .88); display: grid; place-items: center; padding: 56px 12px 12px; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 80px); border-radius: 8px; background: #fff; }
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); inset-inline-end: 12px; background: rgba(255, 255, 255, .15); color: #fff; border-color: transparent; }
.pr-home h3 { display: flex; align-items: center; gap: 8px; }
.pr-home h3 .ico { color: var(--primary); }
@media (max-width: 480px) {
  .pr-btns .btn-lg { flex: 1 1 100%; }
  .pr-big-amount b { font-size: 23px; }
}

/* ── صفحه شروع و نوار بارگذاری بالای صفحه */
.boot { place-content: center; justify-items: center; gap: 14px; height: 100dvh; font-weight: 600; }
.boot-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: bootSpin .8s linear infinite; }
@keyframes bootSpin { to { transform: rotate(360deg); } }
#routeBar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 65; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .15s; }
#routeBar::before { content: ""; position: absolute; inset: 0; background: var(--primary); transform: translateX(100%) scaleX(.35); }
#routeBar.on { opacity: 1; transition-duration: .25s; }
#routeBar.on::before { animation: routeSlide 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes routeSlide { from { transform: translateX(100%) scaleX(.35); } to { transform: translateX(-100%) scaleX(.35); } }
.main:focus { outline: none; }

/* ── نوار پایین (فقط گوشی و تبلت کوچک) */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  #menuBtn, .topbar .bell { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; padding: 7px 2px 6px; font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.3; color: var(--muted);
    background: none; border: 0; border-radius: 0; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .bottom-nav .ico { width: 24px; height: 24px; transition: transform .12s; }
  .bottom-nav a:active .ico, .bottom-nav button:active .ico { transform: scale(.9); }
  .bottom-nav span:not(.badge) { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav .active { color: var(--primary); font-weight: 800; }
  .bottom-nav .active::before { content: ""; position: absolute; top: 0; left: 50%; width: 32px; height: 3px; margin-left: -16px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .bottom-nav a:focus-visible, .bottom-nav button:focus-visible { outline: 2px solid var(--primary); outline-offset: -5px; border-radius: 12px; }
  /* اول مقدارهای منطقی، بعد فیزیکی؛ وگرنه inset-inline-end در راست‌به‌چپ همان left را خنثی می‌کند */
  .bottom-nav .badge { inset-inline-start: auto; inset-inline-end: auto; top: 3px; right: calc(50% + 4px); left: auto; }
  .has-bnav .main, .has-bnav.kb-open .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .has-bnav #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .has-bnav .error { scroll-margin-bottom: calc(92px + env(safe-area-inset-bottom)); } /* پیام خطا بالای نوار پایین دیده شود */
  /* هنگام تایپ، نوار جا را از صفحه‌کلید نمی‌گیرد */
  .kb-open .bottom-nav { display: none; }
  .has-bnav.kb-open #toast { bottom: 20px; }
}

/* ── اندازه لمسی کنترل‌ها روی صفحه‌های لمسی */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; padding: 6px 12px; font-size: 13px; }
  .tab { min-height: 40px; display: inline-flex; align-items: center; }
  input, select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .boot-spin { animation-duration: 2.4s; }
  #routeBar.on::before { animation: none; transform: none; opacity: .5; }
  .bottom-nav .ico { transition: none; }
}

/* ── کادر هشدار (مثلاً حساب بدون دسترسی) */
.warn-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--yellow-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--yellow) 35%, transparent); font-size: 14px; line-height: 1.8; }
.warn-box .ico { flex-shrink: 0; width: 20px; height: 20px; color: var(--yellow); margin-top: 3px; }

/* ── دستگاه‌های واردشده (صفحه اثر انگشت و رمز) */
.sess-actions { margin-top: 12px; }
.sess-note { margin: 10px 0 0; }

/* ── جمع‌بندی و گزارش کلی گزارش‌های روزانه */
.sum-tiles .tile { box-shadow: none; }
.sum-group { padding: 0; }
.sum-group > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px; min-height: 52px; color: var(--text); font-weight: 400; }
.sum-group > summary::-webkit-details-marker { display: none; }
.sum-group > summary::before { content: none; }
.sum-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius); }
.sum-title { font-weight: 800; font-size: 15px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.sum-caret { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; margin-inline-start: auto; transition: transform .15s; }
.sum-group[open] .sum-caret { transform: rotate(180deg); }
.sum-group > .list { padding: 0 16px 6px; border-top: 1px solid var(--border); }
.sum-group .item .t { overflow-wrap: anywhere; }
.sum-issue { display: flex; gap: 6px; align-items: flex-start; color: var(--red); margin-top: 3px; }
.sum-issue .ico { width: 15px; height: 15px; flex-shrink: 0; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .sum-caret { transition: none; } }

/* ── پیش‌نویس «ثبت جدید»: نوشته نیمه‌کاره‌ای که برگردانده شد */
.draft-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); }

/* ── روز تعطیل و صفحه «روزهای تعطیل» */
.holiday-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--blue-soft); color: var(--text); }
.holiday-note .ico { width: 20px; height: 20px; flex-shrink: 0; color: var(--blue); margin-top: 2px; }
.week-days { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.week-days .check { min-height: 44px; }
.hol-add { border-top: 1px solid var(--border); padding-top: 14px; }

/* ── انتخاب چند همکار (مسئولان انجام) */
.people-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.people-field legend { padding: 0; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.pick-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 32px; margin-bottom: 8px; }
.pick-chip { display: inline-flex; align-items: center; gap: 2px; padding-block: 2px; padding-inline: 12px 2px; border-radius: 99px; background: var(--primary-soft); color: var(--text); font-size: 13.5px; font-weight: 600; }
.pick-x { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; }
.pick-x .ico { width: 16px; height: 16px; }
.pick-x:hover, .pick-x:focus-visible { color: var(--red); background: var(--surface); }
.people-panel { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.people-list { max-height: min(50vh, 360px); overflow: auto; overscroll-behavior: contain; margin-top: 8px; }
.people-unit { position: sticky; top: 0; padding: 8px 4px 4px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; }
/* «.field label» (برچسب فیلدها) نباید روی ردیف‌های فهرست بنشیند */
.field .people-row { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; padding: 4px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.field .people-row:hover { background: var(--surface-2); }
.field .people-row small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.field .people-row input { width: 18px; height: 18px; flex-shrink: 0; margin: 0; }
