/* ==========================================================================
   حساب طلا — سیستم طراحی
   دو تم: «لوکس» (تیره و طلایی) و «روشن» (مدرن و مینیمال)
   ========================================================================== */
/* فونت ایران‌سنس (IRANSansX): فایل لایسنس‌دار را با نام fonts/IRANSansX.woff2 قرار دهید؛ تا آن موقع وزیرمتن نمایش داده می‌شود */
@font-face {
  font-family: 'IRANSansX';
  src: local('IRANSansX'), local('IRANSansX-Regular'), local('IRANSans'), url('../fonts/IRANSansX.woff2') format('woff2-variations'), url('../fonts/IRANSansX.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn.woff2') format('woff2-variations'), url('../fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* رنگ‌های برند زرمایه: سرمه‌ای #001F4E و طلایی #F4C35A */
:root, :root[data-theme="light"] {
  --bg: #f3f5fa; --bg-2: #eaeef6;
  --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #eef2f8;
  --text: #0b1a3d; --text-2: #243458; --muted: #5f6d8c; --faint: #97a3bd;
  --border: #e2e7f1; --border-strong: #cfd7e6;
  --gold: #d9a232; --gold-hi: #f4c35a; --gold-ink: #946608; --gold-soft: #fdf3da; --gold-line: #efd394;
  --grad-gold: linear-gradient(135deg, #ffe3a1 0%, #f4c35a 50%, #dca33a 100%);
  --btn-ink: #001f4e;
  --side-bg: #001f4e; --side-text: #c3cee6; --side-muted: #7f92bb; --side-hover: rgba(255, 255, 255, .06); --side-active-bg: rgba(244, 195, 90, .14); --side-active: #f4c35a; --side-border: rgba(255, 255, 255, .06); --side-title: #ffffff;
  --green: #0e8a5f; --green-soft: #e2f4ec; --red: #d03b45; --red-soft: #fce9ea; --blue: #1f5fd1; --blue-soft: #e7eefc;
  --violet: #6a47c9; --violet-soft: #eee9fb; --orange: #c86b17; --orange-soft: #fcefe0;
  --shadow-sm: 0 1px 2px rgba(0, 31, 78, .06);
  --shadow: 0 1px 2px rgba(0, 31, 78, .04), 0 10px 28px -12px rgba(0, 31, 78, .14);
  --shadow-lg: 0 28px 70px -14px rgba(0, 20, 60, .35);
  --hero-bg: radial-gradient(130% 140% at 100% 0%, #1b4596 0%, #002a68 40%, #001f4e 75%, #001640 100%); --hero-text: #ffffff; --hero-muted: #b9c6e4;
  --focus: 0 0 0 3px rgba(244, 195, 90, .35);
  --radius: 18px; --radius-md: 14px; --radius-sm: 11px;
  --font: 'IRANSansX', 'IRANSans', 'Vazirmatn', Tahoma, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #00132f; --bg-2: #001838;
  --surface: #06214d; --surface-2: #0a2858; --surface-3: #0f3066;
  --text: #eef3fc; --text-2: #d2dcf0; --muted: #9aabcf; --faint: #6c80aa;
  --border: rgba(164, 190, 240, .12); --border-strong: rgba(164, 190, 240, .22);
  --gold: #f4c35a; --gold-hi: #ffd98a; --gold-ink: #f7cf72; --gold-soft: rgba(244, 195, 90, .13); --gold-line: rgba(244, 195, 90, .4);
  --grad-gold: linear-gradient(135deg, #ffe3a1 0%, #f4c35a 50%, #dca33a 100%);
  --btn-ink: #001f4e;
  --side-bg: #001029; --side-text: #b5c3e2; --side-muted: #6a7fa8; --side-hover: rgba(255, 255, 255, .05); --side-active-bg: rgba(244, 195, 90, .12); --side-active: #f7cf72; --side-border: rgba(164, 190, 240, .08); --side-title: #ffffff;
  --green: #3dd18f; --green-soft: rgba(61, 209, 143, .12); --red: #ff7a82; --red-soft: rgba(255, 122, 130, .12); --blue: #7fa9ff; --blue-soft: rgba(127, 169, 255, .12);
  --violet: #b39cff; --violet-soft: rgba(179, 156, 255, .12); --orange: #ffab63; --orange-soft: rgba(255, 171, 99, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -10px rgba(0, 0, 0, .75);
  --hero-bg: radial-gradient(120% 140% at 100% 0%, rgba(244, 195, 90, .22) 0%, #0b2f6b 35%, #06214d 70%, #041a3f 100%); --hero-text: #ffffff; --hero-muted: #b9c6e4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.75; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:root[data-theme="dark"] body { background: radial-gradient(1200px 700px at 85% -10%, rgba(36, 86, 170, .35), transparent 60%), radial-gradient(800px 500px at 0% 110%, rgba(244, 195, 90, .06), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(212, 164, 67, .3); }
.num { font-feature-settings: 'ss01', 'tnum'; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 30; border-left: 1px solid var(--side-border); }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand .logo { width: 42px; height: 42px; border-radius: 13px; background: var(--grad-gold); display: grid; place-items: center; color: #001f4e; font-weight: 900; font-size: 19px; box-shadow: 0 6px 18px -4px rgba(244, 195, 90, .45), inset 0 1px 0 rgba(255, 255, 255, .5); overflow: hidden; flex-shrink: 0; }
.brand b { display: block; font-size: 15.5px; color: var(--side-title); font-weight: 800; letter-spacing: -.2px; line-height: 1.4; }
.brand small { color: var(--side-muted); font-size: 11.5px; }
.nav { padding: 4px 12px 20px; flex: 1; }
.nav .sec { font-size: 11px; color: var(--side-muted); padding: 18px 12px 6px; font-weight: 700; letter-spacing: .3px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; margin: 1px 0; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav a svg { width: 19px; height: 19px; opacity: .75; flex-shrink: 0; }
.nav a:hover { background: var(--side-hover); color: var(--side-title); }
.nav a.active { background: var(--side-active-bg); color: var(--side-active); font-weight: 700; }
.nav a.active svg { opacity: 1; }
.nav a.active::before { content: ''; position: absolute; right: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px 0 0 3px; background: var(--grad-gold); }
.nav .badge { margin-inline-start: auto; background: var(--grad-gold); color: #001f4e; border: 0; font-size: 11px; font-weight: 800; border-radius: 20px; padding: 0 8px; line-height: 20px; }
.side-foot { margin: 12px; padding: 12px; border-radius: 14px; background: var(--side-hover); border: 1px solid var(--side-border); font-size: 12px; display: flex; align-items: center; gap: 10px; }
.side-foot .avatar { width: 36px; height: 36px; font-size: 13px; }
.side-foot b { color: var(--side-title); font-weight: 700; font-size: 13px; display: block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 30px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 440px; }
.search input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 40px 9px 60px; outline: none; transition: border .15s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--gold); box-shadow: var(--focus); }
.search > svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--faint); }
.search kbd { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font); font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; direction: ltr; }
.search .results { position: absolute; top: calc(100% + 8px); right: 0; left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; display: none; max-height: 440px; overflow: auto; }
.search .results.open { display: block; animation: pop .15s; }
.search .results h6 { margin: 8px 10px 4px; font-size: 11px; color: var(--faint); font-weight: 700; }
.search .results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.search .results a:hover { background: var(--gold-soft); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.today { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* live price ticker */
.ticker { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; box-shadow: var(--shadow-sm); cursor: pointer; transition: border .15s; }
.ticker:hover { border-color: var(--gold-line); }
.ticker .tk { padding: 3px 12px; border-radius: 10px; line-height: 1.35; white-space: nowrap; }
.ticker .tk + .tk { border-right: 1px solid var(--border); border-radius: 0; }
.ticker .tk small { display: block; font-size: 10.5px; color: var(--muted); }
.ticker .tk b { font-size: 13.5px; font-weight: 800; }
.ticker .tk b.up { color: var(--green); } .ticker .tk b.down { color: var(--red); }
.ticker .tk.main { background: var(--gold-soft); border-radius: 10px; }
.ticker .tk.main b { color: var(--gold-ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; margin-left: 6px; vertical-align: 1px; }
.live-dot.on { background: var(--green); box-shadow: 0 0 0 0 rgba(15, 138, 95, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(15, 138, 95, 0); } 100% { box-shadow: 0 0 0 0 rgba(15, 138, 95, 0); } }
.theme-switch { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.theme-switch button { border: 0; background: transparent; width: 32px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.theme-switch button svg { width: 17px; }
.theme-switch button.on { background: var(--gold-soft); color: var(--gold-ink); }

.content { padding: 28px 30px 70px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: -.4px; line-height: 1.4; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); min-height: 58px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.card-h .more { margin-inline-start: auto; font-size: 12.5px; color: var(--gold); font-weight: 600; }
.card-h .more:hover { text-decoration: underline; }
.card-b { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.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)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.pos { color: var(--red); } .neg { color: var(--green); }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--border); margin: 14px 0; }
.empty { text-align: center; padding: 44px 16px; color: var(--faint); font-size: 13.5px; }
.empty svg { width: 44px; height: 44px; opacity: .45; margin-bottom: 8px; display: block; margin-inline: auto; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); padding: 8px 15px; border-radius: 12px; cursor: pointer; font-size: 13.5px; font-weight: 600; transition: all .15s; white-space: nowrap; box-shadow: var(--shadow-sm); line-height: 1.6; }
.btn:hover { border-color: var(--gold-line); color: var(--gold-ink); background: var(--gold-soft); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--grad-gold); border-color: transparent; color: var(--btn-ink); box-shadow: 0 6px 18px -6px rgba(244, 195, 90, .75), inset 0 1px 0 rgba(255, 255, 255, .5); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.05) saturate(1.05); color: var(--btn-ink); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 10px; border-radius: 20px; font-weight: 700; background: var(--surface-3); color: var(--muted); border: 1px solid transparent; white-space: nowrap; line-height: 1.9; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }

.avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; color: #fff; flex-shrink: 0; font-size: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th { text-align: right; font-weight: 700; color: var(--muted); font-size: 12px; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover { background: var(--gold-soft); }
.t td.n, .t th.n { text-align: left; white-space: nowrap; direction: rtl; }
.t tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border-strong); }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.f label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.f .hint { font-size: 11.5px; color: var(--gold-ink); margin-top: 5px; min-height: 1em; font-weight: 500; }
.inp, .f input:not([type=checkbox]):not([type=radio]), .f select, .f textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 13px; outline: none; transition: border .15s, box-shadow .15s, background .15s; min-height: 42px;
}
.inp:hover, .f input:hover, .f select:hover, .f textarea:hover { border-color: var(--gold-line); }
.f textarea { min-height: 88px; resize: vertical; }
.inp:focus, .f input:focus, .f select:focus, .f textarea:focus { border-color: var(--gold); box-shadow: var(--focus); }
select.inp, .f select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239d9585' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; background-size: 16px; padding-left: 32px; }
input.money, input.ltr { direction: ltr; text-align: right; }
input.money { font-weight: 700; letter-spacing: .2px; }
.wt { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; transition: border .15s, box-shadow .15s; min-height: 42px; }
.wt:hover { border-color: var(--gold-line); }
.wt:focus-within { border-color: var(--gold); box-shadow: var(--focus); }
.wt input { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; min-width: 0; padding: 6px 8px !important; text-align: center; direction: ltr; background: transparent !important; min-height: 0 !important; font-weight: 700; }
.wt input.g { flex: 1.3; } .wt input.s { flex: 1; }
.wt span { display: grid; place-items: center; padding: 0 10px; background: var(--gold-soft); color: var(--gold-ink); font-size: 11.5px; font-weight: 700; }
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 13px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 14px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; font-weight: 600; transition: all .15s; }
.seg button:hover { color: var(--text); }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); font-weight: 800; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { accent-color: var(--gold); width: 18px; height: 18px; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .val { font-size: 22px; font-weight: 900; margin-top: 2px; letter-spacing: -.4px; line-height: 1.5; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.hero { background: var(--hero-bg); color: var(--hero-text); border: 1px solid rgba(244, 195, 90, .28); }
.kpi.hero .lbl, .kpi.hero .sub { color: var(--hero-muted); }
.kpi.hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 217, 138, .8), transparent); }
.kpi.hero::after { content: ''; position: absolute; left: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(244, 195, 90, .3), transparent 70%); pointer-events: none; }
.kpi.hero .ic { background: rgba(244, 195, 90, .16); color: #ffd98a; }
.kpi.hero .gold-amt i { color: var(--hero-muted); }
.ic.gold { background: var(--gold-soft); color: var(--gold); } .ic.green { background: var(--green-soft); color: var(--green); }
.ic.red { background: var(--red-soft); color: var(--red); } .ic.blue { background: var(--blue-soft); color: var(--blue); }
.ic.violet { background: var(--violet-soft); color: var(--violet); } .ic.orange { background: var(--orange-soft); color: var(--orange); }

.gold-amt { white-space: nowrap; direction: rtl; }
.gold-amt i { font-style: normal; font-size: .74em; color: var(--muted); margin: 0 2px 0 5px; font-weight: 600; }

/* ---------- list items ---------- */
.li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background .12s; }
.li:last-child { border-bottom: 0; }
.li .t1 { font-weight: 700; font-size: 13.5px; }
.li .t2 { font-size: 12px; color: var(--muted); }
.li .end { margin-inline-start: auto; text-align: left; }
a.li:hover { background: var(--surface-2); }

/* ---------- party profile ---------- */
.profile-head { padding: 24px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .avatar { width: 68px; height: 68px; font-size: 24px; border-radius: 20px; }
.profile-head h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -.3px; }
.bal-box { border-radius: 14px; padding: 12px 18px; background: var(--surface-2); border: 1px solid var(--border); min-width: 200px; }
.bal-box .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.bal-box .v { font-size: 19px; font-weight: 900; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.tabs a { padding: 13px 14px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; font-weight: 600; transition: color .15s; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--gold-ink); border-color: var(--gold); font-weight: 800; }
.timeline { padding: 10px 22px 20px; }
.tl { display: flex; gap: 14px; position: relative; padding: 11px 0; }
.tl::before { content: ''; position: absolute; right: 18px; top: 48px; bottom: -11px; width: 2px; background: var(--border); }
.tl:last-child::before { display: none; }
.tl .dot { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.tl .dot svg { width: 17px; }
.tl .body { flex: 1; min-width: 0; }
.tl .when { font-size: 11.5px; color: var(--faint); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 440px; }
.col-h { padding: 14px 16px; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; }
.col-h .bar { width: 10px; height: 10px; border-radius: 4px; }
.col-h .cnt { margin-inline-start: auto; font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface); border-radius: 20px; padding: 0 9px; border: 1px solid var(--border); }
.col-b { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.col.drop { outline: 2px dashed var(--gold); outline-offset: -4px; }
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; cursor: grab; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border .12s; }
.deal:hover { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: var(--shadow); }
.deal.dragging { opacity: .45; }
.deal .t1 { font-weight: 700; }

/* ---------- invoice editor ---------- */
.items-table td { padding: 8px 5px; vertical-align: top; }
.items-table th { padding: 10px 6px; }
.items-table .inp, .items-table select { min-height: 38px; padding: 6px 9px; font-size: 13px; width: 100%; }
.items-table select.inp { padding-left: 26px; background-position: left 6px center; }
.items-table select.cat { min-height: 30px !important; font-size: 12px !important; padding: 2px 8px 2px 24px !important; color: var(--muted); }
.items-table .wt { min-height: 38px; }
.items-table .wt span { padding: 0 7px; }
.items-table .tot { font-weight: 800; white-space: nowrap; padding-top: 15px; }
.sum-box { display: grid; gap: 9px; }
.sum-box .r { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.sum-box .r.big { font-size: 18px; font-weight: 900; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.pick { position: relative; }
.pick .dd { position: absolute; top: calc(100% + 6px); right: 0; min-width: 100%; width: max-content; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 320px; overflow: auto; padding: 6px; display: none; }
.pick .dd.open { display: block; animation: pop .12s; }
.pick .dd a { display: flex; gap: 10px; justify-content: space-between; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.pick .dd a:hover, .pick .dd a.hl { background: var(--gold-soft); }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 12, 34, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; width: 100%; max-width: 580px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .9, .3, 1.15); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-h h3 { margin: 0; font-size: 16.5px; font-weight: 900; }
.modal-h .x { margin-inline-start: auto; }
.modal-b { padding: 20px 22px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 22px 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: 0; } }
.toasts { position: fixed; bottom: 24px; left: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #001f4e; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .2s; display: flex; gap: 10px; align-items: center; max-width: 400px; border: 1px solid rgba(244, 195, 90, .3); }
.toast.err { background: #3a1212; border-color: rgba(240, 113, 113, .35); }
.toast svg { width: 18px; color: #f4c35a; flex-shrink: 0; }

/* ---------- datepicker ---------- */
.dp { position: absolute; z-index: 120; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 14px; width: 284px; user-select: none; animation: pop .12s; }
.dp-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 800; }
.dp-h button { border: 0; background: var(--surface-3); width: 32px; height: 32px; border-radius: 10px; cursor: pointer; font-size: 16px; }
.dp-h button:hover { background: var(--gold-soft); color: var(--gold-ink); }
.dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.dp-g span { font-size: 11px; color: var(--faint); padding: 4px 0; font-weight: 700; }
.dp-g button { border: 0; background: transparent; height: 34px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; }
.dp-g button:hover { background: var(--gold-soft); }
.dp-g button.sel { background: var(--grad-gold); color: #001f4e; font-weight: 900; }
.dp-g button.today { box-shadow: inset 0 0 0 1.5px var(--gold); }
.dp-f { display: flex; justify-content: space-between; margin-top: 10px; }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 3 5; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: #001f4e; color: #fff; font-size: 12px; padding: 8px 12px; border-radius: 10px; z-index: 300; box-shadow: var(--shadow-lg); white-space: nowrap; display: none; border: 1px solid rgba(244, 195, 90, .3); line-height: 1.8; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) 1.15fr; background: var(--bg); }
.login .art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 56px; color: #fff; background: radial-gradient(120% 90% at 90% 10%, #1b4596 0%, #002a68 40%, #001f4e 70%, #00143a 100%); }
.login .art::before { content: ''; position: absolute; width: 640px; height: 640px; border-radius: 50%; top: -220px; left: -160px; background: radial-gradient(circle, rgba(244, 195, 90, .28), transparent 62%); }
.login .art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 70% 30%, #000, transparent 70%); }
.login .art h2 { font-size: 38px; margin: 0 0 10px; position: relative; font-weight: 900; letter-spacing: -.6px; background: linear-gradient(90deg, #ffe7b0, #f4c35a); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.5; }
.login .art p { color: #c3cee6; position: relative; max-width: 460px; font-size: 15px; margin: 0; }
.login .art .feats { position: relative; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.login .art .feats span { border: 1px solid rgba(244, 195, 90, .3); background: rgba(244, 195, 90, .07); border-radius: 30px; padding: 4px 14px; font-size: 12.5px; color: #ffe3a1; }
.login .bars { position: absolute; top: 70px; right: 60px; z-index: 1; width: 300px; height: 315px; background: url('../icons/logo-gold.png') center/contain no-repeat; filter: drop-shadow(0 20px 40px rgba(0,0,0,.45)); opacity: .95; }
.login .bars div { display: none; }
.login .bars div { width: 130px; height: 60px; border-radius: 9px; background: linear-gradient(135deg, #fff0bf 0%, #e8bd5c 35%, #b8862b 70%, #7d5714 100%); box-shadow: 0 30px 50px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -3px 0 rgba(0, 0, 0, .2); }
.login .bars div:nth-child(2) { margin-top: 44px; } .login .bars div:nth-child(3) { margin-top: 12px; }
.login form { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 28px; display: grid; gap: 16px; }
.login form h1 { margin: 10px 0 2px; font-size: 27px; font-weight: 900; letter-spacing: -.4px; }
.login form .btn.primary { padding: 11px; font-size: 14.5px; }

/* ---------- printable invoice ---------- */
.print-bar { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.paper { --ink: #0b1a3d; --pgold: #d9a232; background: #fff; color: var(--ink); max-width: 860px; margin: 0 auto; padding: 0; border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; font-size: 13px; }
.paper .inv-top { position: relative; padding: 30px 36px 22px; background: radial-gradient(120% 160% at 100% 0%, #1b4596 0%, #002a68 45%, #001f4e 100%); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.paper .inv-top::after { content: ''; position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, #dca33a, #f4c35a, #ffe3a1, #f4c35a, #dca33a); }
.paper .inv-shop { display: flex; align-items: center; gap: 14px; }
.paper .inv-logo { width: 62px; height: 62px; border-radius: 16px; background: #001f4e; border: 1px solid rgba(244, 195, 90, .35); display: grid; place-items: center; color: #f4c35a; font-weight: 900; font-size: 24px; overflow: hidden; }
.paper .inv-logo img { width: 100%; height: 100%; object-fit: contain; }
.paper .inv-shop h2 { margin: 0; font-size: 22px; font-weight: 900; color: #f4c35a; }
.paper .inv-shop div small { color: #c3cee6; font-size: 12px; }
.paper .inv-title { text-align: left; }
.paper .inv-title .k { font-size: 22px; font-weight: 900; color: #fff; }
.paper .inv-title .m { font-size: 12.5px; color: #c3cee6; }
.paper .inv-body { padding: 24px 36px 30px; }
.paper .inv-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.paper .inv-meta div { background: #f5f7fc; border: 1px solid #e2e8f4; border-radius: 10px; padding: 9px 13px; }
.paper .inv-meta small { display: block; color: #6a7899; font-size: 11px; font-weight: 700; }
.paper .inv-meta b { font-size: 13.5px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.paper th { background: #001f4e; color: #f4c35a; padding: 9px 8px; font-weight: 700; font-size: 12px; }
.paper th:first-child { border-radius: 0 8px 0 0; } .paper th:last-child { border-radius: 8px 0 0 0; }
.paper td { padding: 9px 8px; border-bottom: 1px solid #e6ebf4; text-align: center; }
.paper tbody tr:nth-child(even) td { background: #f8fafd; }
.paper td.r { text-align: right; }
.paper .inv-sum { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 18px; align-items: start; }
.paper .inv-sum .words { background: #fdf8ea; border: 1px dashed #e8c77a; border-radius: 10px; padding: 12px 14px; color: #4d3a0c; font-size: 12.5px; line-height: 2; }
.paper .inv-sum .tots > div { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px solid #e9edf5; }
.paper .inv-sum .tots > div.grand { border: 0; margin-top: 6px; padding: 11px 14px; border-radius: 10px; background: #001f4e; color: #f4c35a; font-weight: 900; font-size: 15px; }
.paper .inv-foot { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; text-align: center; font-size: 12px; color: #4d5b7a; }
.paper .inv-foot .sig { border-top: 1px solid #c9d2e3; padding-top: 8px; margin-top: 44px; }
.paper .inv-note { margin-top: 22px; padding-top: 12px; border-top: 1px solid #e6ebf4; display: flex; justify-content: space-between; font-size: 11.5px; color: #6a7899; }
/* رسید ۸ سانتی */
.paper.receipt { max-width: 80mm; font-size: 11.5px; border-radius: 4px; }
.paper.receipt .inv-top { padding: 14px; flex-direction: column; text-align: center; }
.paper.receipt .inv-shop { flex-direction: column; gap: 6px; }
.paper.receipt .inv-title { text-align: center; }
.paper.receipt .inv-title .k { font-size: 15px; }
.paper.receipt .inv-body { padding: 12px; }
.paper.receipt .inv-meta { grid-template-columns: 1fr; gap: 6px; }
.paper.receipt .inv-meta div { padding: 5px 9px; }
.paper.receipt .inv-sum { grid-template-columns: 1fr; }
.paper.receipt th, .paper.receipt td { padding: 5px 3px; font-size: 10.5px; }
.paper.receipt .inv-foot { grid-template-columns: 1fr; }
.paper.receipt .inv-foot .sig { margin-top: 20px; }
.paper.a5 { max-width: 148mm; font-size: 11.5px; }
.paper.a5 .inv-top, .paper.a5 .inv-body { padding-inline: 20px; }
.paper.a5 .inv-sum { grid-template-columns: 1fr; }

@media print {
  @page { margin: 8mm; }
  .sidebar, .topbar, .no-print, .toasts, .print-bar { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; animation: none; }
  body { background: #fff !important; }
  .paper { box-shadow: none; border-radius: 0; max-width: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper.receipt { width: 76mm; } .paper.a5 { width: 136mm; }
  .card { box-shadow: none; }
}

/* ---------- misc ---------- */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; text-align: left; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.note { border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--gold-ink); border-radius: 14px; padding: 12px 16px; font-size: 13px; }
.mobile-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } .ticker .tk.opt { display: none; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; right: 0; width: 280px; transform: translateX(100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .topbar { padding: 10px 14px; gap: 8px; } .topbar .menu-btn { display: inline-flex; }
  .today, .search kbd { display: none; }
  .content { padding: 18px 14px 90px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login .art { display: none; }
  .page-head h1 { font-size: 20px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 4px 8px; border-radius: 10px; font-weight: 600; }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--gold-ink); }
  .mobile-nav a.fab { background: var(--grad-gold); color: #001f4e; width: 48px; height: 48px; border-radius: 16px; justify-content: center; margin-top: -18px; box-shadow: 0 8px 20px -6px rgba(212, 164, 67, .8); }
  .toasts { bottom: 84px; left: 12px; right: 12px; }
  .paper .inv-meta { grid-template-columns: 1fr 1fr; } .paper .inv-sum { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g4 { grid-template-columns: 1fr; } .search { max-width: none; } .ticker .tk:not(.main) { display: none; } }

/* ---------- invoice items (card rows) ---------- */
table.items-table { width: 100%; border-collapse: separate; border-spacing: 0 10px; padding: 4px 16px 0; }
table.items-table td { padding: 0; }
.item { display: grid; grid-template-columns: 30px repeat(6, minmax(0, 1fr)) 170px 40px; grid-template-areas: "no prod prod prod w w ayar tot rm" ". cat oj pr fx st stk tot rm"; gap: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; transition: border .15s; }
.item:focus-within { border-color: var(--gold-line); }
.item .il { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.item .inp, .item select.inp { min-height: 40px; width: 100%; font-size: 13.5px; }
.item .wt { min-height: 40px; }
.item-no { grid-area: no; width: 28px; height: 28px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-ink); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; margin-top: 22px; }
.c-prod { grid-area: prod; } .c-w { grid-area: w; } .c-ayar { grid-area: ayar; } .c-cat { grid-area: cat; } .c-oj { grid-area: oj; } .c-pr { grid-area: pr; } .c-fx { grid-area: fx; } .c-st { grid-area: st; } .c-stk { grid-area: stk; }
.c-tot { grid-area: tot; border-right: 1px dashed var(--border-strong); padding-right: 14px; display: flex; flex-direction: column; justify-content: center; }
.c-tot [data-tot] { font-size: 16px; font-weight: 900; line-height: 1.6; }
.c-rm { grid-area: rm; align-self: start; margin-top: 20px; }
@media (max-width: 1100px) {
  .item { grid-template-columns: 30px repeat(4, minmax(0, 1fr)) 40px; grid-template-areas: "no prod prod prod prod rm" ". w w ayar cat ." ". oj pr fx fx ." ". st stk stk tot tot"; }
  .c-tot { border-right: 0; padding-right: 0; }
}
@media (max-width: 640px) {
  .item { grid-template-columns: 1fr 1fr 36px; grid-template-areas: "prod prod rm" "w w w" "ayar cat cat" "oj pr pr" "fx fx fx" "st stk stk" "tot tot tot"; }
  .item-no { display: none; }
  table.items-table { padding: 4px 8px 0; }
}
/* رسید حرارتی: بدون پس‌زمینه‌ی تیره تا جوهر/کاغذ هدر نرود */
.paper.receipt .inv-top { background: #fff; color: #111; border-bottom: 1px dashed #999; }
.paper.receipt .inv-top::after { display: none; }
.paper.receipt .inv-shop h2 { color: #111; }
.paper.receipt .inv-shop div small, .paper.receipt .inv-title .m { color: #555; }
.paper.receipt .inv-title .k { color: #111; }
.paper.receipt .inv-logo { background: #fff; border: 1px solid #ddd; color: #111; width: 46px; height: 46px; }
.paper.receipt th { background: #fff; color: #111; border-bottom: 1.5px solid #111; border-radius: 0 !important; }
.paper.receipt .inv-meta div, .paper.receipt .inv-sum .words { background: #fff; border-color: #ccc; }
.paper.receipt .inv-sum .tots > div.grand { background: #fff; color: #111; border: 1.5px solid #111; }
.paper.receipt tbody tr:nth-child(even) td { background: #fff; }
/* حالت اپ نصب‌شده روی گوشی */
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
}
.install-bar { display: none; }
@media (max-width: 900px) { .install-bar.show { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: var(--gold-soft); border: 1px solid var(--gold-line); font-size: 13px; } }
.main { overflow-x: clip; }
@media (max-width: 560px) { .grid > * { grid-column: auto !important; } .page-head .actions { width: 100%; } .page-head .actions .btn { flex: 1; } }
.login .brand b { color: var(--text); }

/* ======================= موبایل (بازطراحی واکنش‌گرا) ======================= */
.grid > *, .card { min-width: 0; }
.side-backdrop { display: none; }
.top-user { display: none; }
@media (max-width: 900px) {
  .sidebar { z-index: 60; width: 300px; max-width: 86vw; padding-bottom: env(safe-area-inset-bottom); }
  .side-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 10, 30, .5); backdrop-filter: blur(3px); z-index: 55; animation: fade .15s; }
  .topbar { gap: 8px; }
  .search { flex: 0 0 auto; width: 42px; transition: width .2s; }
  .search input { padding: 9px 38px 9px 10px; height: 42px; }
  .search input::placeholder { color: transparent; }
  .search.open { position: absolute; inset: 8px 12px; width: auto; z-index: 5; }
  .search.open input::placeholder { color: var(--faint); }
  .top-actions { gap: 6px; }
  .ticker { padding: 3px; } .ticker .tk { padding: 2px 9px; } .ticker .tk b { font-size: 12.5px; }
  .theme-switch button { width: 30px; height: 30px; }
  .theme-switch button:not(.on) { display: none; }
  .top-user { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 0; padding: 0; background: none; cursor: pointer; }
  .top-user .avatar { width: 36px; height: 36px; font-size: 12px; border-radius: 12px; }
  .user-menu { position: fixed; top: 60px; left: 12px; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; min-width: 220px; animation: pop .15s; }
  .user-menu .um-h { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
  .user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; background: none; border-radius: 10px; font-size: 14px; cursor: pointer; text-align: right; }
  .user-menu a:hover, .user-menu button:hover { background: var(--surface-3); }
  .user-menu svg { width: 18px; }
  .user-menu .danger { color: var(--red); }
  .page-head { align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .page-head .actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-head .actions > * { width: 100%; }
  .kpi { padding: 14px 16px; } .kpi .val { font-size: 19px; } .kpi .ic { width: 36px; height: 36px; margin-bottom: 8px; }
  .card-h { padding: 12px 14px; flex-wrap: wrap; min-height: 0; } .card-b { padding: 14px; }
  .card-h .seg { max-width: 100%; overflow-x: auto; }
  .card-h > .inp, .card-h > input.inp { max-width: none !important; width: 100%; margin: 0 !important; }
  .li { padding: 11px 14px; }
  .toasts { top: 70px; bottom: auto; }
  .profile-head { padding: 16px; } .profile-head .avatar { width: 54px; height: 54px; }
  .bal-box { min-width: 0; flex: 1 1 140px; }
  /* جدول‌ها ← کارت */
  .table-wrap { overflow: visible; }
  table.t, .t tbody, .t tfoot { display: block; width: 100%; }
  .t thead { display: none; }
  .t tbody tr, .t tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .t td { display: flex; flex-direction: column; gap: 1px; padding: 0; border: 0 !important; min-width: 0; text-align: right !important; white-space: normal; }
  .t td[data-l]::before { content: attr(data-l); font-size: 10.5px; color: var(--faint); font-weight: 600; }
  .t td:first-child { grid-column: 1 / -1; font-size: 14.5px; }
  .t td:empty { display: none; }
  .t td.n:last-child:has(.btn) { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 6px; }
  .t td.n:last-child:has(.btn)::before { display: none; }
  .t tbody tr.link:active { background: var(--gold-soft); }
  .t tfoot tr { background: var(--surface-2); }
  /* مدال به‌صورت برگه‌ی پایین */
  .overlay { place-items: end center; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; animation: sheet .22s cubic-bezier(.2, .9, .3, 1); }
  .modal-f { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  .modal-b .seg { display: flex; overflow-x: auto; }
  .dp { position: fixed !important; left: 50% !important; top: auto !important; bottom: 16px; transform: translateX(-50%); width: min(340px, calc(100vw - 24px)); }
  /* فاکتور */
  table.items-table, table.items-table tbody, table.items-table tr, table.items-table td { display: block; width: 100%; }
  .sum-box .r.big { font-size: 16px; }
  .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; } .col { scroll-snap-align: start; }
  .tabs { padding: 0 8px; } .tabs a { padding: 11px 10px; font-size: 13px; }
  .paper .inv-top { padding: 18px; } .paper .inv-body { padding: 16px; }
  .paper table { font-size: 11px; } .paper th, .paper td { padding: 6px 4px; }
  .print-bar .seg { width: 100%; justify-content: center; } .print-bar .btn { width: 100%; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
