/* ============================================================
   حساب دوکان — طراحی نو (نیلی/بنفش)، شیشه‌ای، انعطاف‌پذیر
   ============================================================ */

:root {
  --font: "Vazirmatn", -apple-system, BlinkMacSystemFont, "SF Pro Text", "IRANSansX", "Tahoma", sans-serif;

  --ink: #171a2e;
  --muted: #6c7290;
  --line: rgba(23, 26, 46, .1);

  --glass: rgba(255, 255, 255, .62);
  --glass-brd: rgba(255, 255, 255, .8);
  --glass-hl: rgba(255, 255, 255, .9);
  --blur: 26px;

  --field-bg: rgba(255, 255, 255, .72);
  --field-focus: rgba(255, 255, 255, .95);
  --soft: rgba(255, 255, 255, .5);
  --soft-hover: rgba(255, 255, 255, .82);
  --seg-bg: rgba(23, 26, 46, .07);
  --seg-thumb: #ffffff;

  --accent: #5b5bf5;
  --accent-2: #8b5cf6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 91, 245, .14);

  --money: #0e9f6e;
  --money-soft: rgba(16, 185, 129, .15);
  --warn: #d98200;
  --warn-soft: rgba(245, 158, 11, .18);
  --danger: #e04a4f;
  --danger-soft: rgba(239, 68, 68, .14);

  --blob1: #c3c6ff;
  --blob2: #bfe7ff;
  --blob3: #ffd9ec;
  --blob-op: .55;

  --bg:
    radial-gradient(1200px 800px at 88% -14%, #e6e7ff 0%, transparent 55%),
    radial-gradient(1000px 760px at 4% 4%, #dff1ff 0%, transparent 52%),
    radial-gradient(1000px 800px at 50% 118%, #f6e6ff 0%, transparent 55%),
    linear-gradient(165deg, #f2f3fb 0%, #eef1fa 55%, #f4f2fb 100%);

  --r-lg: 30px;
  --r: 22px;
  --r-sm: 14px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
}

html[data-theme="dark"] {
  --ink: #eceefb;
  --muted: #9aa0c0;
  --line: rgba(255, 255, 255, .12);

  --glass: rgba(24, 26, 46, .64);
  --glass-brd: rgba(255, 255, 255, .1);
  --glass-hl: rgba(255, 255, 255, .12);

  --field-bg: rgba(255, 255, 255, .07);
  --field-focus: rgba(255, 255, 255, .13);
  --soft: rgba(255, 255, 255, .06);
  --soft-hover: rgba(255, 255, 255, .1);
  --seg-bg: rgba(255, 255, 255, .1);
  --seg-thumb: #2c3155;

  --accent: #7b78ff;
  --accent-2: #a78bfa;
  --accent-soft: rgba(123, 120, 255, .22);

  --money: #34d399;
  --money-soft: rgba(52, 211, 153, .18);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .18);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .18);

  --blob-op: .32;

  --bg:
    radial-gradient(1200px 800px at 88% -14%, #1c1e3a 0%, transparent 55%),
    radial-gradient(1000px 760px at 4% 4%, #14243a 0%, transparent 52%),
    radial-gradient(1000px 800px at 50% 118%, #201a38 0%, transparent 55%),
    linear-gradient(165deg, #0c0e1c 0%, #0f1226 55%, #0d1020 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .5s var(--ease), color .35s var(--ease);
}

.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs::before, .bg-blobs::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--blob-op);
  animation: float 18s var(--ease) infinite alternate;
  transition: background .5s var(--ease);
}
.bg-blobs::before { width: 460px; height: 460px; background: var(--blob1); top: -150px; right: -110px; }
.bg-blobs::after { width: 500px; height: 500px; background: var(--blob2); bottom: -190px; left: -140px; animation-delay: -7s; }
@keyframes float { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(0, 44px, 0) scale(1.09); } }

.glass {
  background: var(--glass);
  border: .5px solid var(--glass-brd);
  box-shadow:
    0 26px 60px -36px rgba(12, 14, 40, .5),
    0 2px 10px -6px rgba(12, 14, 40, .2),
    inset 0 1px 0 var(--glass-hl);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  transition: background .5s var(--ease), border-color .5s var(--ease), box-shadow .5s var(--ease);
}

/* ---------------- چیدمان کلی ---------------- */
.app { display: flex; min-height: 100vh; }

.side { display: none; }

.content {
  flex: 1; min-width: 0;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 14px 16px 108px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  position: sticky; top: 10px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; border-radius: 20px;
}
.brand-mini { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 42px; height: 42px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; font-size: 19px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 26px -12px rgba(91, 91, 245, .9);
}
.brand-logo.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; }
.brand-txt strong { font-size: 14.5px; font-weight: 700; }
.brand-txt span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.iconbtn {
  width: 40px; height: 40px; flex: none;
  border: .5px solid var(--glass-brd); border-radius: 50%;
  background: var(--field-bg); color: var(--ink);
  font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .3s var(--spring), background .3s var(--ease), color .3s var(--ease);
}
.iconbtn:hover { transform: translateY(-2px); }
.iconbtn:active { transform: scale(.92); }

/* ---------------- نوار پایین (موبایل) ---------------- */
.tabbar {
  position: fixed; z-index: 40;
  left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 7px; border-radius: 24px;
}
.tab-btn {
  border: 0; background: transparent; font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px; border-radius: 17px; color: var(--muted);
  transition: color .3s var(--ease), background .3s var(--ease), transform .3s var(--spring);
}
.tab-btn span { font-size: 17px; line-height: 1; }
.tab-btn small { font-size: 10.5px; font-weight: 600; }
.tab-btn.active { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 24px -14px rgba(91, 91, 245, .95); }
.tab-btn:active { transform: scale(.94); }

/* ---------------- هدر صفحه ---------------- */
.view { display: flex; flex-direction: column; gap: 18px; animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.hello h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.sub { margin: 5px 0 0; font-size: 13px; color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }

/* ---------------- هرو ---------------- */
.hero { border-radius: var(--r-lg); padding: 24px 26px 26px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero-badge {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 5px 13px;
}
.hero-num {
  margin-top: 12px; font-size: clamp(40px, 8.5vw, 66px); font-weight: 300;
  letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums;
}
.hero-num span { font-size: 15px; font-weight: 600; color: var(--muted); }
.hero-line {
  margin-top: 16px; padding-top: 14px; border-top: .5px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--muted);
}
.hero-line b { color: var(--money); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- کاشی‌ها ---------------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  background: var(--soft); border: .5px solid var(--glass-brd); border-radius: var(--r);
  padding: 16px 18px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; gap: 5px;
  animation: rise .5s var(--ease) both;
  transition: transform .35s var(--spring), background .35s var(--ease);
}
.tile:hover { transform: translateY(-3px); background: var(--soft-hover); }
.tile .tl { font-size: 12.5px; color: var(--muted); }
.tile b { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .ts { font-size: 11.5px; color: var(--muted); }
.tile b.warn { color: var(--warn); }
.tile b.money { color: var(--money); }
.tile b.danger { color: var(--danger); }

/* ---------------- کارت ---------------- */
.card { border-radius: var(--r-lg); padding: 22px 24px; }
.card > h2 { margin: 0 0 16px; font-size: 16.5px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.linkbtn {
  border: 0; background: transparent; color: var(--accent); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 10px;
  transition: background .25s var(--ease);
}
.linkbtn:hover { background: var(--accent-soft); }

/* ---------------- دکمه‌ها ---------------- */
.btn-primary {
  border: 0; font-family: inherit; cursor: pointer;
  color: var(--accent-ink); font-size: 15px; font-weight: 700;
  padding: 13px 30px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 30px -16px rgba(91, 91, 245, .95);
  transition: transform .3s var(--spring), box-shadow .3s var(--ease), filter .3s var(--ease);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 36px -16px rgba(91, 91, 245, 1); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.sm { padding: 10px 20px; font-size: 13.5px; }
.btn-primary.block { display: block; width: 100%; margin-top: 18px; }
.btn-ghost {
  border: .5px solid var(--line); background: var(--field-bg); color: var(--ink);
  font-family: inherit; cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 12px 24px; border-radius: 999px;
  transition: transform .25s var(--spring), background .3s var(--ease);
}
.btn-ghost:hover { transform: translateY(-1px); }
.btn-ghost:active { transform: scale(.96); }

/* ---------------- فرم ---------------- */
.grid { display: grid; gap: 13px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

input, select, .set-input {
  font-family: inherit; color: var(--ink);
  background: var(--field-bg); border: .5px solid var(--line); outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .4s var(--ease);
}
.field input, .field select, .set-input { width: 100%; font-size: 15px; border-radius: var(--r-sm); padding: 12px 14px; }
input:focus, select:focus, .set-input:focus { border-color: var(--accent); background: var(--field-focus); box-shadow: 0 0 0 4px var(--accent-soft); }

.pill-select, .mini-input {
  font-family: inherit; color: var(--ink); background: var(--field-bg);
  border: .5px solid var(--line); outline: none; cursor: pointer;
  font-size: 13.5px; border-radius: 999px; padding: 9px 16px;
  -webkit-appearance: none; appearance: none;
}
.mini-input { width: 120px; cursor: text; text-align: left; }

/* ---------------- نوار جستجو ---------------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  border-radius: 999px; padding: 12px 18px;
}
.searchbar.inner { margin-bottom: 12px; border-radius: var(--r-sm); }
.searchbar .si { font-size: 17px; color: var(--muted); }
.searchbar input { flex: 1; border: 0; background: transparent; font-size: 15px; padding: 0; }
.searchbar input:focus { box-shadow: none; }

/* ---------------- فهرست کالا ---------------- */
.plist { display: flex; flex-direction: column; gap: 11px; }
.prod {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; border-radius: var(--r);
  background: var(--soft); border: .5px solid var(--glass-brd);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  cursor: pointer; animation: rise .45s var(--ease) both;
  transition: transform .3s var(--spring), background .3s var(--ease), box-shadow .3s var(--ease);
}
.prod:hover { transform: translateX(-3px); background: var(--soft-hover); box-shadow: 0 16px 30px -24px rgba(12, 14, 40, .6); }
.prod.low { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.pico {
  width: 46px; height: 46px; flex: none; border-radius: 15px;
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.prod.low .pico { background: var(--warn-soft); color: var(--warn); }
.pmid { flex: 1; min-width: 0; }
.pname { font-size: 15px; font-weight: 700; }
.pmeta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pstock { text-align: left; flex: none; }
.pstock b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pstock span { display: block; font-size: 11px; color: var(--muted); }
.pstock.low b { color: var(--warn); }
.pprice { text-align: left; font-size: 12px; color: var(--muted); flex: none; }
.pprice b { display: block; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------- انتخابگر کالا (فروش) ---------------- */
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; max-height: 220px; overflow-y: auto; }
.pick {
  border: .5px solid var(--line); background: var(--field-bg); color: var(--ink);
  font-family: inherit; cursor: pointer; text-align: right;
  padding: 9px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 600;
  transition: transform .25s var(--spring), background .3s var(--ease), border-color .3s var(--ease);
}
.pick:hover { transform: translateY(-2px); border-color: var(--accent); }
.pick:active { transform: scale(.95); }
.pick small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.pick:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- سبد ---------------- */
.cart { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.citem {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--soft); border: .5px solid var(--glass-brd);
  animation: rise .35s var(--ease) both;
}
.citem .cname { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.citem .cname small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.qty { display: flex; align-items: center; gap: 6px; flex: none; }
.qty button {
  width: 30px; height: 30px; border-radius: 10px; cursor: pointer;
  border: .5px solid var(--line); background: var(--field-bg); color: var(--ink);
  font-size: 16px; line-height: 1; font-family: inherit;
  transition: transform .2s var(--spring), background .25s var(--ease);
}
.qty button:active { transform: scale(.9); }
.qty input {
  width: 54px; text-align: center; border-radius: 10px; padding: 6px; font-size: 14px;
  background: var(--field-bg); border: .5px solid var(--line); color: var(--ink);
}
.citem .ctot { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; min-width: 74px; text-align: left; font-size: 14px; }
.cdel { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 16px; padding: 6px; border-radius: 10px; transition: background .25s; }
.cdel:hover { background: var(--danger-soft); }

.sale-summary { border-top: .5px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.ss-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; color: var(--muted); }
.ss-row b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.ss-row.total { border-top: .5px solid var(--line); margin-top: 6px; padding-top: 12px; }
.ss-row.total b { font-size: 19px; font-weight: 800; color: var(--accent); }
.ss-row.due b { color: var(--danger); }

.mini-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: .5px solid var(--line); font-size: 13.5px; }
.mrow:last-child { border-bottom: 0; }
.mrow .mmain { min-width: 0; }
.mrow .mmain small { display: block; font-size: 11.5px; color: var(--muted); }
.mrow .mamt { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }

/* ---------------- ردیف فروش / مشتری ---------------- */
.srow {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px; margin-bottom: 9px; border-radius: var(--r);
  background: var(--soft); border: .5px solid var(--glass-brd); cursor: pointer;
  animation: rise .4s var(--ease) both;
  transition: transform .3s var(--spring), background .3s var(--ease);
}
.srow:hover { transform: translateX(-3px); background: var(--soft-hover); }
.srow .sico { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px; }
.srow .smain { flex: 1; min-width: 0; }
.srow .stitle { font-size: 14.5px; font-weight: 700; }
.srow .ssub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.srow .samt { text-align: left; flex: none; }
.srow .samt b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.srow .samt small { display: block; font-size: 11.5px; color: var(--danger); margin-top: 2px; }
.srow .samt small.ok { color: var(--money); }
.rowbtns { display: flex; gap: 6px; flex: none; }
.minibt {
  border: .5px solid var(--line); background: var(--field-bg); color: var(--ink);
  font-family: inherit; cursor: pointer; font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px;
  transition: transform .25s var(--spring), background .3s var(--ease);
}
.minibt:hover { transform: translateY(-1px); }
.minibt.pay { background: var(--money-soft); color: var(--money); border-color: transparent; }

/* ---------------- نمودار (میله عمودی) ---------------- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 168px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.bar-fill {
  width: 100%; max-width: 44px; height: 0; border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px -12px rgba(91, 91, 245, .9);
  transition: height .7s var(--ease);
}
.bar-cap { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------- رتبه‌ها (میله افقی) ---------------- */
.rank-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rank-name { width: 108px; flex: none; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { flex: 1; height: 12px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.rank-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .7s var(--ease); }
.rank-val { width: 92px; flex: none; text-align: left; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 14px; line-height: 2; animation: rise .5s var(--ease) both; }

/* ---------------- سگمنت ---------------- */
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  width: 100%; padding: 3px; background: var(--seg-bg); border-radius: 15px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .4s var(--ease);
}
.seg-thumb {
  position: absolute; top: 3px; left: 0; height: calc(100% - 6px); width: 0;
  background: var(--seg-thumb); border-radius: 12px;
  box-shadow: 0 4px 10px rgba(12, 14, 40, .2);
  transition: transform .34s var(--spring), width .34s var(--spring), background .4s var(--ease);
  will-change: transform, width;
}
.seg-btn {
  position: relative; z-index: 1; border: 0; background: transparent; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 10px 8px; border-radius: 12px; cursor: pointer;
  transition: color .3s var(--ease), transform .2s var(--ease);
}
.seg-btn.active { color: var(--ink); }
.seg-btn:active { transform: scale(.97); }

/* ---------------- مودال ---------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 12, 34, .42);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .35s var(--ease);
}
.backdrop.show { opacity: 1; }

.modal {
  position: fixed; z-index: 70; left: 50%; bottom: 0;
  width: min(600px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 22px 24px 26px; border-radius: 26px 26px 0 0;
  transform: translate(-50%, 100%);
  transition: transform .45s var(--spring);
}
.modal.show { transform: translate(-50%, 0); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.pay-who { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.pay-who b { color: var(--ink); }

/* ---------------- رسید ---------------- */
.receipt {
  background: #fff; color: #12142c; border-radius: var(--r-sm);
  padding: 20px 18px; font-size: 13px;
}
.receipt .rhead { text-align: center; border-bottom: 1px dashed #c9cbe0; padding-bottom: 12px; margin-bottom: 12px; }
.receipt .rhead strong { display: block; font-size: 17px; }
.receipt .rhead span { font-size: 12px; color: #6c7290; }
.receipt table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.receipt th, .receipt td { text-align: right; padding: 6px 4px; font-size: 12.5px; }
.receipt thead th { border-bottom: 1px solid #e3e4ef; color: #6c7290; font-weight: 600; }
.receipt tbody tr { border-bottom: .5px solid #eef0f7; }
.receipt .rtot { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.receipt .rtot.big { font-size: 16px; font-weight: 800; border-top: 1px dashed #c9cbe0; margin-top: 8px; padding-top: 10px; }
.receipt .rfoot { text-align: center; font-size: 11.5px; color: #6c7290; margin-top: 14px; }

/* ---------------- تنظیمات ---------------- */
.sheet {
  position: fixed; z-index: 70; left: 50%; bottom: 0;
  width: min(540px, 100%); max-height: 88vh; overflow-y: auto;
  padding: 10px 24px 28px; border-radius: 28px 28px 0 0;
  transform: translate(-50%, 100%);
  transition: transform .45s var(--spring);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(120, 128, 170, .5); margin: 8px auto 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.set-group { margin-bottom: 20px; }
.set-label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.set-row-label { font-size: 14.5px; font-weight: 600; }
.switch-input { display: none; }
.switch-ui { position: relative; width: 52px; height: 32px; border-radius: 999px; flex: none; background: var(--seg-bg); transition: background .3s var(--ease); }
.switch-ui::after { content: ""; position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(12, 14, 40, .3); transition: transform .3s var(--spring); }
.switch-input:checked + .switch-ui { background: var(--accent); }
.switch-input:checked + .switch-ui::after { transform: translateX(-20px); }

.db-status { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); }
.db-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; transition: background .3s, box-shadow .3s; }
.db-dot.ok { background: var(--money); box-shadow: 0 0 0 4px var(--money-soft); }
.db-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }

/* ---------------- فوتر و توست ---------------- */
.foot { text-align: center; color: var(--muted); font-size: 12px; padding-top: 4px; }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translate(-50%, 24px);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  padding: 12px 24px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; z-index: 90;
  box-shadow: 0 22px 44px -18px rgba(91, 91, 245, .9);
  transition: opacity .3s var(--ease), transform .35s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- دسکتاپ ---------------- */
@media (min-width: 1024px) {
  .content { padding: 26px 34px 60px; max-width: 1040px; }
  .topbar { display: none; }
  .tabbar { display: none; }

  .app { gap: 26px; padding: 22px; max-width: 1360px; margin: 0 auto; }
  .side {
    display: flex; flex-direction: column; gap: 8px;
    width: 252px; flex: none; position: sticky; top: 22px;
    align-self: flex-start; height: calc(100vh - 44px);
    border-radius: var(--r-lg); padding: 22px 18px;
  }
  .brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 16px; }
  .nav { display: flex; flex-direction: column; gap: 4px; }
  .nav-btn {
    display: flex; align-items: center; gap: 12px;
    border: 0; background: transparent; font-family: inherit; cursor: pointer;
    color: var(--muted); font-size: 14.5px; font-weight: 600; text-align: right;
    padding: 12px 14px; border-radius: 14px;
    transition: color .3s var(--ease), background .3s var(--ease), transform .3s var(--spring);
  }
  .nav-btn .ni { font-size: 15px; width: 18px; text-align: center; }
  .nav-btn:hover { color: var(--ink); background: var(--soft); transform: translateX(-3px); }
  .nav-btn.active { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 26px -16px rgba(91, 91, 245, .95); }
  .side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 16px; }
  .side-cur { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

  .tiles { grid-template-columns: repeat(4, 1fr); }
  .modal, .sheet { bottom: auto; top: 50%; border-radius: 30px; padding-top: 24px; transform: translate(-50%, -46%) scale(.94); opacity: 0; transition: transform .4s var(--ease), opacity .3s var(--ease); }
  .modal.show, .sheet.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-grab { display: none; }
  .toast { bottom: 34px; }
}

/* ---------------- موبایل ---------------- */
@media (max-width: 640px) {
  .card { padding: 18px 16px; }
  .hero { padding: 20px 18px 22px; }
  .hello h1 { font-size: 21px; }
  .page-head h1 { font-size: 19px; }
  .rank-name { width: 84px; font-size: 12px; }
  .rank-val { width: 76px; font-size: 12px; }
  .citem .ctot { min-width: 60px; font-size: 13px; }
}

/* ---------------- چاپ ---------------- */
@media print {
  .app, .tabbar, .topbar, .backdrop, .sheet, .toast, .bg-blobs { display: none !important; }
  body { background: #fff; }
  .modal { position: static !important; transform: none !important; box-shadow: none; border: 0; background: #fff; backdrop-filter: none; padding: 0; max-height: none; overflow: visible; }
  .modal:not(#receiptModal) { display: none !important; }
  .receipt-actions, .modal-head { display: none !important; }
}

/* ---------------- کاهش حرکت ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
