/* برج الماس — سیستمِ طراحی.
 * مصالح: سنگِ تیره‌ی سبزآبیِ لابی (سطح‌ها)، برنج (عملِ اصلی)، یخِ تراش‌خورده (چیزهای زنده و وضعیت).
 * رنگ‌های وضعیت به نامِ گوهرها: یشم، کهربا، یاقوت، یاقوتِ کبود.
 * تنها عنصرِ پرجلوه: نمای برج (tower-art.js) و گوشه‌های تراش‌خوردهٔ دکمهٔ اصلی. بقیه آرام. */

:root {
  --font: 'Estedad Variable', 'Estedad', 'Vazirmatn', Tahoma, system-ui, sans-serif;
  --night: #0a1317;
  --stone: #0e1b20;
  --slab: #13252c;
  --slab-2: #193038;
  --vein: #2a4652;
  --pearl: #f1f4f2;
  --brass: #cfa65c;
  --brass-hi: #e2c07e;
  --brass-deep: #8a6527;
  --ice: #8fe3dd;
  --ice-deep: #16737a;
  --jade: #2fa37a;
  --amber: #e0a33a;
  --garnet: #d04a67;
  --sapphire: #5682e8;

  --r-sheet: 26px;
  --r-panel: 18px;
  --r-ctl: 12px;
  --r-chip: 999px;
  --cut: 11px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;
  --dock-h: 74px;
  --side-w: 272px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ----------------------------------------------------------- تم: پیش‌فرض تیره (سنگ)، روشن (مروارید) */
:root, :root[data-theme='dark'] {
  color-scheme: dark;
  --bg: var(--stone);
  --bg-deep: var(--night);
  --surface: var(--slab);
  --surface-2: var(--slab-2);
  --line: rgba(143, 227, 221, .09);
  --line-2: rgba(143, 227, 221, .17);
  --text: #e8efec;
  --text-2: #a8b9b6;
  --muted: #7c8f8c;
  --accent: var(--brass);
  --accent-hi: var(--brass-hi);
  --on-accent: #1d1608;
  --live: var(--ice);
  --live-soft: rgba(143, 227, 221, .12);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --glass: rgba(14, 27, 32, .78);
  --hl: inset 0 1px 0 rgba(255, 255, 255, .045);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: var(--pearl);
    --bg-deep: #e6ebe8;
    --surface: #ffffff;
    --surface-2: #f6f8f7;
    --line: rgba(16, 36, 42, .09);
    --line-2: rgba(16, 36, 42, .16);
    --text: #102429;
    --text-2: #405459;
    --muted: #6c7e81;
    --accent: var(--brass-deep);
    --accent-hi: #a87c35;
    --on-accent: #ffffff;
    --live: var(--ice-deep);
    --live-soft: rgba(22, 115, 122, .09);
    --shadow: 0 16px 36px -20px rgba(16, 36, 42, .35);
    --glass: rgba(241, 244, 242, .82);
    --hl: inset 0 1px 0 rgba(255, 255, 255, .8);
  }
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: var(--pearl);
  --bg-deep: #e6ebe8;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --line: rgba(16, 36, 42, .09);
  --line-2: rgba(16, 36, 42, .16);
  --text: #102429;
  --text-2: #405459;
  --muted: #6c7e81;
  --accent: var(--brass-deep);
  --accent-hi: #a87c35;
  --on-accent: #ffffff;
  --live: var(--ice-deep);
  --live-soft: rgba(22, 115, 122, .09);
  --shadow: 0 16px 36px -20px rgba(16, 36, 42, .35);
  --glass: rgba(241, 244, 242, .82);
  --hl: inset 0 1px 0 rgba(255, 255, 255, .8);
}

/* ----------------------------------------------------------- پایه */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'ss01';
  overscroll-behavior-y: none;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--live-soft); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.tiny { font-size: 12px; line-height: 1.6; }
.small { font-size: 13.5px; line-height: 1.7; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--s3); }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack.tight { gap: var(--s2); }
.stack.loose { gap: var(--s6); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 560px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hide-m { }
@media (max-width: 899px) { .hide-m { display: none !important; } }
@media (min-width: 900px) { .hide-d { display: none !important; } }

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.35; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 850; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; font-weight: 750; }
p { margin: 0; }

/* ----------------------------------------------------------- پوسته */
.boot { min-height: 100dvh; display: grid; place-items: center; background: var(--bg); }
.boot svg { width: 64px; height: 64px; }

.shell { min-height: 100dvh; display: flex; }
.side {
  position: sticky; top: 0; height: 100dvh; width: var(--side-w); flex: none;
  background: var(--bg-deep); border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--s5) var(--s4); gap: var(--s4); overflow-y: auto;
}
@media (max-width: 899px) { .side { display: none; } }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s2); }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand b { font-size: 17px; font-weight: 850; display: block; line-height: 1.3; }
.brand span { font-size: 12px; color: var(--muted); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group > small { font-size: 12px; color: var(--muted); padding: var(--s2) var(--s3) var(--s1); }
.nav-link {
  display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s3); border-radius: var(--r-ctl);
  color: var(--text-2); font-weight: 600; font-size: 14.5px; position: relative; transition: background .15s, color .15s;
}
.nav-link svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.on { background: var(--surface); color: var(--text); box-shadow: var(--hl); }
.nav-link.on::before {
  content: ''; position: absolute; inset-inline-start: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent);
}
.nav-link .count { margin-inline-start: auto; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s3);
  padding: calc(var(--safe-t) + 10px) var(--s4) 10px; background: var(--glass);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar .title { font-weight: 800; font-size: 16px; line-height: 1.3; }
.topbar .title small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.topbar .brand-m { display: flex; align-items: center; gap: var(--s2); }
.topbar .brand-m svg { width: 30px; height: 30px; }
.content { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s5) var(--s4) calc(var(--dock-h) + var(--safe-b) + 28px); }
@media (min-width: 900px) { .content { padding: var(--s7) var(--s7) var(--s8); } }
.content.narrow { max-width: 760px; }

/* داکِ پایینِ موبایل با دکمهٔ تراش‌خوردهٔ وسط */
.dock {
  position: fixed; z-index: 40; inset-inline: 10px; bottom: calc(10px + var(--safe-b)); height: 64px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--glass); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow);
  backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px);
}
@media (min-width: 900px) { .dock { display: none; } }
.dock a, .dock button.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%;
  border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 650; position: relative;
}
.dock a svg, .dock button.tab svg { width: 23px; height: 23px; }
.dock a.on { color: var(--text); }
.dock a.on::after { content: ''; position: absolute; bottom: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dock .dot { position: absolute; top: 9px; inset-inline-end: calc(50% - 18px); }
.facet-btn {
  justify-self: center; width: 58px; height: 58px; margin-top: -26px; border: 0; background: none; position: relative; isolation: isolate;
  color: var(--on-accent); display: grid; place-items: center;
}
.facet-btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, var(--accent-hi), var(--accent) 60%);
  clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%, 0 30%);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35));
}
.facet-btn svg { width: 26px; height: 26px; }
.facet-btn:active::before { transform: scale(.94); }

/* ----------------------------------------------------------- صفحه */
.page-head { display: flex; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s5); }
.page-head h1 { flex: 1 1 auto; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 14px; }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
@media (max-width: 899px) { .page-head h1 { font-size: 22px; } .page-head { flex-wrap: wrap; } }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: var(--s2); }
.back svg { width: 16px; height: 16px; transform: scaleX(-1); }

.section { display: flex; flex-direction: column; gap: var(--s3); }
.section > header { display: flex; align-items: baseline; gap: var(--s3); }
.section > header h2 { flex: 1 1 auto; }
.section > header a, .section > header button.link { font-size: 13px; color: var(--live); font-weight: 650; background: none; border: 0; padding: 0; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--hl);
  padding: var(--s4);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel.tight { padding: var(--s3); }
.panel.live { border-color: color-mix(in srgb, var(--live) 40%, transparent); background: linear-gradient(0deg, var(--live-soft), var(--live-soft)), var(--surface); }
.panel.warn { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.panel.danger { border-color: color-mix(in srgb, var(--garnet) 55%, transparent); background: linear-gradient(0deg, rgba(208, 74, 103, .08), rgba(208, 74, 103, .08)), var(--surface); }
.hr { height: 1px; background: var(--line); border: 0; margin: var(--s3) 0; }

/* ----------------------------------------------------------- دکمه */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--h); padding: 0 var(--s5);
  border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 14.5px; white-space: nowrap; position: relative; isolation: isolate;
  transition: transform .12s var(--ease), background .15s, border-color .15s; user-select: none;
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:hover { border-color: var(--vein); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.small { --h: 36px; padding: 0 var(--s3); font-size: 13px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.live { color: var(--live); border-color: color-mix(in srgb, var(--live) 35%, transparent); background: var(--live-soft); }
.btn.danger { color: #fff; background: var(--garnet); border-color: transparent; }
/* عملِ اصلی: برنجِ تراش‌خورده — گوشه‌ها روی لایهٔ پشت بریده می‌شوند تا حلقهٔ فوکوس بریده نشود. */
.btn.primary { color: var(--on-accent); border: 0; background: none; }
.btn.primary::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 4px;
  background: linear-gradient(165deg, var(--accent-hi), var(--accent) 55%);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.btn.primary:hover::before { filter: brightness(1.06); }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); position: relative; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 7px; }
.link { color: var(--live); font-weight: 650; background: none; border: 0; padding: 0; }

/* ----------------------------------------------------------- فرم */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.field .err { font-size: 12.5px; color: var(--garnet); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.6; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; }
.select { padding-inline-end: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: 18px 21px, 12px 21px; background-size: 6px 6px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--live); box-shadow: 0 0 0 3px var(--live-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input.ltr { text-align: left; }
.input.big { font-size: 22px; font-weight: 800; letter-spacing: .02em; text-align: center; }
.check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; }
.switch { width: 46px; height: 28px; flex: none; border-radius: 99px; background: var(--vein); position: relative; transition: background .2s; border: 0; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--jade); }
.switch.on::after { inset-inline-start: 21px; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--bg-deep); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; min-height: 38px; padding: 0 var(--s3); border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 650; font-size: 13.5px; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--hl), 0 1px 3px rgba(0,0,0,.15); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-chip); border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.chip.on { background: var(--live-soft); color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, transparent); }
.form-actions { display: flex; gap: var(--s3); justify-content: flex-start; flex-wrap: wrap; margin-top: var(--s2); }
.file-drop { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--r-ctl); border: 1px dashed var(--line-2); background: var(--bg); min-height: 56px; }
.file-drop img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* ----------------------------------------------------------- فهرست */
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: var(--s3); padding: 13px var(--s4); min-height: 60px; width: 100%; text-align: start; background: none; border: 0; color: inherit; }
button.item:hover, a.item:hover { background: var(--surface-2); }
.item .ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--bg-deep); color: var(--text-2); }
.item .ico svg { width: 21px; height: 21px; }
.item .ico.live { color: var(--live); background: var(--live-soft); }
.item .ico.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.item .ico.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.item .ico.danger { color: var(--garnet); background: color-mix(in srgb, var(--garnet) 14%, transparent); }
.item .t { font-weight: 700; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .s { font-size: 13px; color: var(--muted); line-height: 1.6; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .m { font-size: 12.5px; color: var(--text-2); text-align: end; flex: none; }
.item .chev { width: 18px; height: 18px; color: var(--muted); flex: none; transform: scaleX(-1); }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px var(--s4); align-items: baseline; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; border-radius: var(--r-panel); border: 1px solid var(--line); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }

/* ----------------------------------------------------------- نشان و وضعیت */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--bg-deep); color: var(--text-2); border: 1px solid var(--line); }
.badge.jade { color: var(--jade); background: color-mix(in srgb, var(--jade) 13%, transparent); border-color: transparent; }
.badge.amber { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); border-color: transparent; }
.badge.garnet { color: var(--garnet); background: color-mix(in srgb, var(--garnet) 13%, transparent); border-color: transparent; }
.badge.sapphire { color: var(--sapphire); background: color-mix(in srgb, var(--sapphire) 14%, transparent); border-color: transparent; }
.badge.ice { color: var(--live); background: var(--live-soft); border-color: transparent; }
.badge.solid { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--garnet); box-shadow: 0 0 0 2px var(--bg); display: inline-block; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--garnet); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.pulse { position: relative; }
.pulse::after { content: ''; position: absolute; inset: -4px; border-radius: inherit; border: 2px solid currentColor; opacity: 0; animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0% { opacity: .6; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.25); } }

/* ----------------------------------------------------------- عدد و مبلغ */
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure b { font-size: 30px; font-weight: 850; line-height: 1.2; letter-spacing: -.01em; }
.figure span { font-size: 13px; color: var(--muted); }
.money { white-space: nowrap; }
td .money, .tbl .money { font-variant-numeric: tabular-nums; }
.money small { font-size: .72em; color: var(--muted); font-weight: 600; margin-inline-start: 3px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.tile { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--hl); min-height: 108px; position: relative; color: inherit; }
.tile:hover { border-color: var(--line-2); }
.tile svg { width: 24px; height: 24px; color: var(--accent); }
.tile b { font-size: 14.5px; font-weight: 750; line-height: 1.4; }
.tile small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.tile .count { position: absolute; top: 12px; inset-inline-end: 12px; }

.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--s2) var(--s3); }
.launch { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: var(--s3) 4px; border-radius: 16px; text-align: center; font-size: 12.5px; font-weight: 650; color: var(--text-2); position: relative; }
.launch:hover { background: var(--surface); color: var(--text); }
.launch i { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--hl); color: var(--accent); }
.launch i svg { width: 25px; height: 25px; }
.launch .count { position: absolute; top: 6px; inset-inline-end: calc(50% - 34px); }

/* ----------------------------------------------------------- برگه (Sheet) و پیام */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(4, 10, 12, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .18s ease; }
.sheet {
  position: fixed; z-index: 81; inset-inline: 0; bottom: 0; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0; border: 1px solid var(--line-2); border-bottom: 0;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .6); animation: rise .28s var(--ease); padding-bottom: var(--safe-b);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 10px auto 2px; flex: none; }
.sheet header { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s5) var(--s3); flex: none; }
.sheet header h2 { flex: 1 1 auto; font-size: 18px; }
.sheet .body { padding: 0 var(--s5) var(--s5); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet footer { padding: var(--s3) var(--s5) var(--s4); border-top: 1px solid var(--line); display: flex; gap: var(--s3); flex: none; }
@media (min-width: 720px) {
  .sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 48px)); max-height: 86dvh; border-radius: var(--r-sheet); border-bottom: 1px solid var(--line-2); animation: pop .22s var(--ease); padding-bottom: 0; }
  .sheet.wide { width: min(860px, calc(100vw - 48px)); }
  .sheet .grab { display: none; }
  .sheet header { padding-top: var(--s5); }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translate(-50%, -46%) scale(.98); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts { position: fixed; z-index: 120; inset-inline: 0; top: calc(var(--safe-t) + 12px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(520px, calc(100vw - 24px)); padding: 12px 16px; border-radius: 14px; background: var(--slab-2); color: #eef4f1; font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow); border: 1px solid rgba(143, 227, 221, .15); display: flex; gap: 10px; align-items: center; animation: drop .25s var(--ease); }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--jade); }
.toast.err svg { color: var(--garnet); }
.toast.live svg { color: var(--ice); }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); padding: var(--s7) var(--s4); color: var(--text-2); }
.empty svg { width: 46px; height: 46px; color: var(--muted); margin-bottom: var(--s2); }
.empty b { color: var(--text); font-size: 16px; }
.empty p { max-width: 38ch; font-size: 14px; }
.error-box { padding: var(--s3) var(--s4); border-radius: var(--r-ctl); background: color-mix(in srgb, var(--garnet) 12%, transparent); color: var(--garnet); font-weight: 600; font-size: 14px; }
.note-box { padding: var(--s3) var(--s4); border-radius: var(--r-ctl); background: var(--live-soft); color: var(--text); font-size: 14px; }
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.3s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 2px 12px; color: var(--muted); font-weight: 700; font-size: 14.5px; position: relative; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

/* ----------------------------------------------------------- پلاکِ ایران */
.plate { display: inline-flex; align-items: stretch; height: 34px; border-radius: 6px; overflow: hidden; border: 1.5px solid #222; background: #fdfdfb; color: #111; font-weight: 850; direction: ltr; font-size: 17px; line-height: 1; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.plate .ir { width: 18px; background: #1d4fae; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 3px; font-size: 6px; font-weight: 700; letter-spacing: .02em; }
.plate .ir::before { content: ''; width: 10px; height: 7px; margin-bottom: auto; margin-top: 4px; background: linear-gradient(#239f40 0 33%, #fff 33% 66%, #da0000 66%); }
.plate .pl-main { display: flex; align-items: center; gap: 6px; padding: 0 9px; font-family: var(--font); }
.plate .pl-reg { border-inline-start: 1.5px solid #222; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 7px; font-size: 15px; }
.plate .pl-reg i { font-style: normal; font-size: 7px; font-weight: 700; }
.plate.small { height: 26px; font-size: 13px; }
.plate.small .ir { width: 13px; font-size: 0; }
.plate.small .pl-reg { font-size: 12px; padding: 0 5px; }
.plate.small .pl-reg i { display: none; }
.plate.raw { padding: 0 10px; align-items: center; }
.plate-input { display: grid; grid-template-columns: 1.1fr 1.3fr 1.4fr 1.1fr; gap: 6px; direction: ltr; }
.plate-input .input { text-align: center; font-weight: 800; font-size: 18px; padding: 8px 4px; }

/* ----------------------------------------------------------- تقویمِ خورشیدیِ انتخابگر */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.days::-webkit-scrollbar { display: none; }
.day { flex: none; width: 62px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg); text-align: center; scroll-snap-align: start; }
.day small { display: block; font-size: 11px; color: var(--muted); }
.day b { display: block; font-size: 19px; font-weight: 850; line-height: 1.3; }
.day.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.day.on small { color: inherit; opacity: .8; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .wd { font-size: 11.5px; color: var(--muted); padding: 4px 0; }
.cal button { aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; font-weight: 650; font-size: 14px; }
.cal button:hover { background: var(--surface-2); }
.cal button.on { background: var(--accent); color: var(--on-accent); }
.cal button.today { box-shadow: inset 0 0 0 1px var(--live); }
.cal button[disabled] { opacity: .3; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.slot { padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); text-align: center; font-weight: 700; font-size: 13.5px; }
.slot small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.slot.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.slot.mine { border-color: var(--live); }
.slot[disabled] { opacity: .4; text-decoration: line-through; }

/* ----------------------------------------------------------- برج (tower-art.js) */
.tower { width: 100%; height: auto; overflow: visible; }
.tower .sky { fill: transparent; }
.tower .facade { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1; }
.tower .floor { fill: color-mix(in srgb, var(--live) 7%, transparent); }
.tower .floor.lit { fill: var(--live); filter: url(#glow); }
.tower .cell { fill: color-mix(in srgb, var(--text) 9%, transparent); stroke: var(--bg); stroke-width: .6; cursor: pointer; transition: fill .2s; }
.tower .cell.ok { fill: color-mix(in srgb, var(--jade) 55%, transparent); }
.tower .cell.debt { fill: var(--garnet); }
.tower .cell.debt2 { fill: color-mix(in srgb, var(--garnet) 55%, transparent); }
.tower .cell.vacant { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.tower .cell.mine { fill: var(--live); }
.tower .cell:hover { stroke: var(--text); stroke-width: 1.4; }
.tower .crown { fill: url(#facet); }
.tower .spark { fill: #fff; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .tower .spark { animation: glint 6s ease-in-out infinite; }
  .tower .floor.rise { animation: rise-floor .5s var(--ease) both; }
}
@keyframes glint { 0%, 84%, 100% { opacity: 0; } 90% { opacity: .9; } }
@keyframes rise-floor { from { opacity: 0; } to { opacity: 1; } }

/* ----------------------------------------------------------- خانهٔ ساکن */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: var(--s5); align-items: end; margin-bottom: var(--s6); }
.hero .hello { font-size: 14px; color: var(--muted); }
.hero h1 { font-size: 30px; line-height: 1.25; margin: 2px 0 var(--s3); }
.hero .unit-line { display: flex; flex-wrap: wrap; gap: var(--s2); }
.hero .tower { max-height: 230px; }
@media (max-width: 560px) { .hero { grid-template-columns: minmax(0, 1fr) 92px; gap: var(--s3); } .hero h1 { font-size: 24px; } }
.focus-card { display: flex; flex-direction: column; gap: var(--s3); }
.focus-card .amount { font-size: 34px; font-weight: 850; line-height: 1.15; letter-spacing: -.01em; }
.focus-card .amount .money small { font-size: 15px; }

/* کارتِ پاسِ مهمان */
.pass { border-radius: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.pass .top { padding: var(--s5); background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--live) 22%, transparent), transparent 60%), var(--surface-2); }
.pass .code { font-size: 38px; font-weight: 900; letter-spacing: .14em; font-variant-numeric: tabular-nums; direction: ltr; text-align: center; }
.pass .perf { height: 18px; background: radial-gradient(circle at 0 50%, var(--bg) 9px, transparent 10px) left / 18px 18px no-repeat, radial-gradient(circle at 100% 50%, var(--bg) 9px, transparent 10px) right / 18px 18px no-repeat; position: relative; }
.pass .perf::after { content: ''; position: absolute; inset-inline: 20px; top: 50%; border-top: 2px dashed var(--line-2); }
.pass .bottom { padding: var(--s4) var(--s5) var(--s5); display: grid; grid-template-columns: 1fr auto; gap: var(--s4); align-items: center; }
.pass .qr { width: 112px; height: 112px; background: #fff; border-radius: 12px; padding: 6px; }

/* نقشهٔ پارکینگ */
.pmap { width: 100%; height: auto; background: var(--bg-deep); border-radius: var(--r-panel); border: 1px solid var(--line); }
.pmap .spot { fill: var(--surface-2); stroke: var(--line-2); stroke-width: .08; }
.pmap .spot.guest { fill: color-mix(in srgb, var(--live) 16%, var(--surface-2)); }
.pmap .spot.busy { fill: var(--amber); }
.pmap .spot.in { fill: var(--garnet); }
.pmap .spot.mine { fill: var(--accent); }
.pmap .spot.off { fill: url(#hatch); }
.pmap text { font-size: .9px; font-weight: 800; fill: var(--text); text-anchor: middle; dominant-baseline: central; font-family: var(--font); }
.pmap .core { fill: var(--live); }
.pmap .path { fill: none; stroke: var(--live); stroke-width: .25; stroke-dasharray: .6 .5; }

/* لابی */
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
@media (max-width: 1080px) { .lobby-grid { grid-template-columns: 1fr; } }
.sos-banner { position: sticky; top: calc(var(--safe-t) + 70px); z-index: 25; }
.hold { position: relative; overflow: hidden; }
.hold .fill { position: absolute; inset: 0; background: rgba(255,255,255,.22); transform-origin: right; transform: scaleX(0); }
.hold.holding .fill { transform: scaleX(1); transition: transform 1.6s linear; }

/* چاپ (اخطاریه، صورت‌حساب) */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .side, .topbar, .dock, .no-print, .toasts { display: none !important; }
  .content { padding: 0; max-width: none; }
  .print-only { display: block; }
  .panel { border: 0; box-shadow: none; padding: 0; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
