/* Mizan · ميزان — design system */
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/readex-pro-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/readex-pro-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F2F5F4;
  --panel: #FFFFFF;
  --panel-2: #F8FAF9;
  --ink: #0E1F1B;
  --ink-2: #44554F;
  --ink-3: #7C8C87;
  --ink-4: #A9B6B2;
  --line: #E2E8E6;
  --line-2: #EDF1EF;
  --brand: #0E7A66;
  --brand-500: #13967E;
  --brand-600: #0C6C5C;
  --brand-700: #0A5A4D;
  --brand-800: #073F36;
  --brand-900: #052B25;
  --brand-50: #EAF6F2;
  --brand-100: #D2EEE5;
  --gold: #EFA52E;
  --gold-600: #D88C14;
  --gold-700: #9C6208;
  --gold-50: #FEF5E3;
  --rose: #D63F5B;
  --rose-700: #A82943;
  --rose-50: #FCEDF0;
  --sky: #2B74DB;
  --sky-50: #EAF2FD;
  --violet: #6C4FE0;
  --violet-50: #F0ECFD;
  --amber-50: #FFF7E6;
  --ok: #12936F;
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --r-xs: 9px;
  --sh-1: 0 1px 2px rgba(14, 31, 27, .05);
  --sh-2: 0 1px 2px rgba(14, 31, 27, .04), 0 10px 28px -12px rgba(14, 31, 27, .14);
  --sh-3: 0 30px 70px -20px rgba(5, 43, 37, .35), 0 8px 20px -8px rgba(5, 43, 37, .18);
  --ring: 0 0 0 4px rgba(19, 150, 126, .16);
  --side: 264px;
  --tab: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'tnum' 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
.num, .money, td.n, .tnum { font-variant-numeric: tabular-nums; }
[dir='rtl'] .ltr { direction: ltr; unicode-bidi: isolate; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.pos { color: var(--ok); }
.neg { color: var(--rose); }
.gold { color: var(--gold-700); }
.ic { width: 20px; height: 20px; flex: none; }
.ic.inl { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.row-flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mt3 { margin-top: 28px; }
.mb { margin-bottom: 12px; }
.sep { height: 1px; background: var(--line-2); margin: 14px 0; border: 0; }
::selection { background: var(--brand-100); }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; border-radius: 18px; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.main { padding: 0 16px calc(var(--tab) + var(--safe-b) + 28px); max-width: 1360px; margin: 0 auto; }
.mbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 12px 0 14px;
  background: rgba(242, 245, 244, .86);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.mbar.scrolled { border-bottom-color: var(--line); }
.mbar .logo { border-radius: 10px; }
.mbar h1 { font-size: 18px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--ink-2); flex: none; position: relative;
}
.icon-btn:hover { background: rgba(14, 31, 27, .05); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg); }

.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); padding: 6px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 147, 111, .16); }
.sync.off i { background: var(--ink-4); box-shadow: none; }
.sync.busy i { background: var(--gold); animation: pulse 1s infinite; }
.mbar .sync span { display: none; }
.mbar .sync { padding: 6px; border: 0; background: transparent; }

/* bottom tab bar */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--ink-3); padding: 8px 0; background: none; border: 0;
}
.tabbar a .ic { width: 23px; height: 23px; }
.tabbar a.on { color: var(--brand-600); font-weight: 600; }
.tabbar a.on .ic { stroke-width: 2.2; }
.fab {
  justify-self: center; width: 58px; height: 58px; margin-top: -24px; border-radius: 20px; border: 0;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 10px 24px -6px rgba(12, 108, 92, .55), 0 0 0 5px var(--bg), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s;
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.93) rotate(45deg); }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--side) 1fr; }
  .mbar, .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 20px 14px 16px; background: var(--panel); border-inline-end: 1px solid var(--line);
  }
  .main { padding: 0 36px 60px; width: 100%; }
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand .logo { border-radius: 12px; box-shadow: 0 6px 16px -6px rgba(12,108,92,.5); }
.brand b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand small { display: block; color: var(--ink-3); font-size: 12px; }
.side .new-btn { margin: 0 4px 14px; }
.nav-label { font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; margin: 1px 0;
  border-radius: 12px; color: var(--ink-2); font-weight: 500; position: relative;
}
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; inset-inline-start: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-600); }
[dir='rtl'] .nav a.on::before { border-radius: 4px 0 0 4px; }
.nav a .badge { margin-inline-start: auto; }
.side-foot { margin-top: auto; padding-top: 14px; }
.org-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); }
.org-card b { font-size: 13.5px; display: block; }
.org-card small { font-size: 12px; color: var(--ink-3); }

/* page header (desktop) */
.phead { display: flex; align-items: center; gap: 14px; padding: 26px 0 20px; flex-wrap: wrap; }
.phead h1 { font-size: 26px; font-weight: 600; letter-spacing: -.015em; }
.phead .sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.phead .acts { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.searchbox {
  display: flex; align-items: center; gap: 10px; height: 42px; min-width: 260px; padding: 0 12px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-3);
  cursor: pointer; font-size: 14px;
}
.searchbox kbd { margin-inline-start: auto; font-family: inherit; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--ink-3); background: var(--panel-2); }
@media (max-width: 1023px) {
  .phead { padding: 8px 0 14px; }
  .phead h1 { display: none; }
  .phead .sub { display: none; }
  .phead .acts { margin-inline: -16px; padding: 0 16px 2px; width: calc(100% + 32px); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .phead .acts::-webkit-scrollbar { display: none; }
  .phead .acts .btn { height: 40px; padding: 0 13px; font-size: 13.5px; flex: none; }
  .phead .acts .btn.primary { order: -1; }
  .phead.keep h1 { display: block; font-size: 22px; }
  .searchbox { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-weight: 500; white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .1s, border-color .15s;
}
.btn:hover { border-color: #cfd8d5; background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .ic { width: 19px; height: 19px; }
.btn.primary {
  border: 0; color: #fff; font-weight: 600;
  background: linear-gradient(160deg, var(--brand-500), var(--brand-600) 55%, var(--brand-700));
  box-shadow: 0 6px 16px -6px rgba(12, 108, 92, .55), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.gold { border: 0; color: #3b2603; font-weight: 600; background: linear-gradient(160deg, #FFD27A, var(--gold)); box-shadow: 0 6px 16px -6px rgba(216, 140, 20, .5); }
.btn.danger { border-color: #f2c7cf; color: var(--rose-700); background: var(--rose-50); }
.btn.danger.solid { background: var(--rose); color: #fff; border: 0; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(14,31,27,.05); }
.btn.soft { border-color: transparent; background: var(--brand-50); color: var(--brand-700); }
.btn.soft:hover { background: var(--brand-100); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { height: 54px; padding: 0 22px; font-size: 16px; border-radius: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 36px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card.pad { padding: 18px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.card-h h3 { font-size: 15.5px; font-weight: 600; }
.card-h .link { margin-inline-start: auto; font-size: 13px; color: var(--brand-600); font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }
.card-h .link .ic { width: 16px; height: 16px; }
[dir='rtl'] .card-h .link .ic, [dir='rtl'] .flip { transform: scaleX(-1); }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > *, .ed-grid > *, .dv-grid > * { min-width: 0; }
.shell { overflow-x: clip; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .md-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .lg-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .lg-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 759px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid { gap: 12px; } }

/* hero (deep green with khatam pattern) */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 26px; padding: 22px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(25, 174, 143, .55), transparent 55%),
    radial-gradient(90% 120% at 100% 100%, rgba(239, 165, 46, .20), transparent 60%),
    linear-gradient(150deg, #0C6C5C, #073F36 70%);
  box-shadow: var(--sh-3);
}
.hero::before {
  content: ''; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.3'%3E%3Crect x='18' y='18' width='28' height='28'/%3E%3Crect x='18' y='18' width='28' height='28' transform='rotate(45 32 32)'/%3E%3Cpath d='M0 32h8M56 32h8M32 0v8M32 56v8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(110deg, transparent 15%, #000 70%);
  mask-image: linear-gradient(110deg, transparent 15%, #000 70%);
}
.hero > * { position: relative; }
.hero .eyebrow { font-size: 13px; color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 8px; }
.hero .big { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: 17px; font-weight: 500; opacity: .75; margin-inline-start: 4px; }
.hero .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.14); margin-top: 10px; }
.hero .delta .ic { width: 15px; height: 15px; }
.hero-grid { display: grid; gap: 18px; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr 1fr; align-items: end; } .hero { padding: 28px 30px; } .hero .big { font-size: 48px; } }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.hero-stat { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 11px 12px; min-width: 0; }
.hero-stat span { display: block; font-size: 11.5px; color: rgba(255,255,255,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stat b { display: block; font-size: clamp(13px, 3.7vw, 16px); font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
@media (max-width: 420px) { .hero-stats { gap: 7px; } .hero-stat { padding: 9px 9px; } .hero-stat b small { display: none; } }
@media (max-width: 1023px) { .phead.home-head { display: none; } }
.week-bars { display: flex; align-items: flex-end; gap: 8px; height: 132px; }
.week-bars .wb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.week-bars .bar { width: 100%; max-width: 38px; border-radius: 9px 9px 4px 4px; background: rgba(255,255,255,.22); position: relative; min-height: 4px; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.week-bars .bar.prev { position: absolute; inset: auto 0 0 0; background: transparent; border: 1.5px dashed rgba(255,255,255,.28); border-bottom: 0; }
.week-bars .wb.today .bar { background: linear-gradient(180deg, #FFD98A, var(--gold)); box-shadow: 0 6px 18px -4px rgba(239,165,46,.6); }
.week-bars .wb span { font-size: 11px; color: rgba(255,255,255,.65); }
.week-bars .wb.today span { color: #fff; font-weight: 600; }
.week-bars .barwrap { width: 100%; display: flex; justify-content: center; align-items: flex-end; flex: 1; position: relative; }

/* KPI tiles */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .k-top { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; }
.kpi .k-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.kpi .k-ic .ic { width: 18px; height: 18px; }
.kpi .k-val { font-size: 23px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { font-size: 12.5px; color: var(--ink-3); }
a.kpi:hover { border-color: #cfd8d5; }
.tone-brand { background: var(--brand-50); color: var(--brand-600); }
.tone-gold { background: var(--gold-50); color: var(--gold-700); }
.tone-rose { background: var(--rose-50); color: var(--rose); }
.tone-sky { background: var(--sky-50); color: var(--sky); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
@media (max-width: 759px) {
  .kpi { padding: 14px; } .kpi .k-val { font-size: 19px; } .kpi .k-ic { width: 30px; height: 30px; }
  .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .g3 .kpi { padding: 11px 10px; gap: 3px; border-radius: 16px; }
  .g3 .kpi .k-ic, .g3 .kpi .k-sub { display: none; }
  .g3 .kpi .k-top { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .g3 .kpi .k-val { font-size: 15px; }
}

/* quick actions */
.qa { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.qa button, .qa a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 14px 6px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); min-height: 92px; box-shadow: var(--sh-1);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.qa button:hover, .qa a:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: #d2dbd8; }
.qa .q-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.qa .q-ic .ic { width: 22px; height: 22px; }
@media (min-width: 1100px) { .qa.wide { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; min-height: 64px;
  border-top: 1px solid var(--line-2); position: relative; background: transparent; width: 100%; text-align: start; border-inline: 0; border-bottom: 0;
}
.item:first-child { border-top: 0; }
a.item:hover, button.item:hover { background: var(--panel-2); }
.item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item .end { text-align: end; flex: none; }
.item .end .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .end .s { margin-top: 2px; }
.list.tight .item { min-height: 54px; padding: 9px 16px; }
.avatar {
  width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 15px; color: #fff; text-transform: uppercase; letter-spacing: -.02em;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 24px; }
.ticon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.ticon .ic { width: 20px; height: 20px; }
.list-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: center; }

/* chips & badges */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip.dv { background: var(--sky-50); color: var(--sky); }
.chip.bl { background: var(--brand-50); color: var(--brand-600); }
.chip.fa { background: var(--violet-50); color: var(--violet); }
.chip.av { background: var(--rose-50); color: var(--rose); }
.chip.ba { background: var(--gold-50); color: var(--gold-700); }
.chip.adj { background: #EEF1F0; color: var(--ink-2); }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.paid { color: var(--ok); }
.st.part { color: var(--gold-600); }
.st.due { color: var(--rose); }
.st.neutral { color: var(--ink-3); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; background: var(--rose); color: #fff; }
.badge.soft { background: var(--brand-50); color: var(--brand-700); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill .n { font-size: 11.5px; opacity: .7; }
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pills::-webkit-scrollbar { display: none; }

/* segmented */
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: #E8EEEC; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(14,31,27,.12); font-weight: 600; }
.seg.block { display: flex; } .seg.block button { flex: 1; justify-content: center; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 15px;
}
.field textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%237C8C87' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
[dir='rtl'] .field select { background-position: left 12px center; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.field.big input { height: 58px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fgrid { display: grid; gap: 14px; }
@media (min-width: 640px) { .fgrid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .span2 { grid-column: span 2; } }
.affix { position: relative; display: flex; align-items: center; }
.affix input { padding-inline-end: 52px !important; }
.affix span { position: absolute; inset-inline-end: 14px; font-size: 13px; color: var(--ink-3); pointer-events: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand-600); flex: none; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #D5DEDB; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--brand-500); }
.switch input:checked + i::after { transform: translateX(18px); }
[dir='rtl'] .switch input:checked + i::after { transform: translateX(-18px); }
.opt-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.opt-row:first-child { border-top: 0; }
.opt-row .grow b { display: block; font-weight: 500; }
.opt-row .grow small { color: var(--ink-3); font-size: 12.5px; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-pick button { height: 36px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chips-pick button.on { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand-500); }
.chips-pick button .ic { width: 17px; height: 17px; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tsearch { position: relative; flex: 1; min-width: 200px; }
.tsearch .ic { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }
.tsearch input { width: 100%; height: 44px; padding-inline-start: 40px; padding-inline-end: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); outline: none; font-size: 14.5px; }
.tsearch input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.n, .tbl td.n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--panel-2); }
.tbl tfoot td { font-weight: 600; background: var(--panel-2); border-top: 1px solid var(--line); }
.tbl .zero { color: var(--ink-4); }
.tbl.matrix td, .tbl.matrix th { padding: 8px 10px; }
.tbl.matrix td:first-child, .tbl.matrix th:first-child { position: sticky; inset-inline-start: 0; background: var(--panel); z-index: 1; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl.matrix th:first-child { background: var(--panel-2); z-index: 2; }
.tbl.matrix tfoot td:first-child { background: var(--panel-2); }
.tbl.matrix td.tot { font-weight: 600; background: var(--brand-50); }
.heat { border-radius: 6px; padding: 2px 6px; }

/* empty */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .e-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.empty .e-ic .ic { width: 30px; height: 30px; }
.empty h3 { color: var(--ink); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 14px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

/* skeleton */
.sk { background: linear-gradient(90deg, #ECF0EE 0%, #F6F8F7 50%, #ECF0EE 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- sheets (bottom sheet on phone, dialog on PC) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 25, 21, .42); opacity: 0; transition: opacity .25s; backdrop-filter: blur(2px); }
.sheet {
  position: relative; width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 26px 26px 0 0; box-shadow: var(--sh-3);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .9, .25, 1);
  padding-bottom: var(--safe-b);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: #D7DFDC; margin: 9px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 20px; flex: none; }
[dir='rtl'] .sheet-head { padding: 10px 20px 10px 14px; }
.sheet-head h2 { font-size: 18px; font-weight: 600; flex: 1; min-width: 0; }
.sheet-body { padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line-2); flex: none; }
.sheet-foot .btn { flex: 1; }
.sheet.flush .sheet-body { padding: 0 0 12px; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { max-width: 520px; border-radius: 26px; transform: translateY(20px) scale(.97); opacity: 0; transition: transform .25s cubic-bezier(.2,.9,.25,1), opacity .2s; }
  .sheet.wide { max-width: 760px; }
  .sheet.xwide { max-width: 1000px; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
}
.sheet.dialog .sheet-body p { color: var(--ink-2); }

/* toasts */
#toasts { position: fixed; z-index: 200; inset-inline: 0; bottom: calc(var(--tab) + var(--safe-b) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
@media (min-width: 1024px) { #toasts { bottom: 24px; inset-inline-start: var(--side); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: max-content;
  background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 14px; font-size: 14px; box-shadow: var(--sh-3);
  animation: toastIn .3s cubic-bezier(.2,.9,.25,1);
}
.toast .ic { color: #6EE7C5; }
.toast.bad .ic { color: #FF9DB0; }
.toast.warn .ic { color: #FFD27A; }
.toast.live { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.toast.live .ic { color: var(--brand-600); }
.toast button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 9px; padding: 5px 10px; font-weight: 600; font-size: 13px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }

/* ---------- welcome ---------- */
.welcome { min-height: 100vh; display: grid; }
@media (min-width: 960px) { .welcome { grid-template-columns: 1.05fr 1fr; } }
.w-art {
  position: relative; overflow: hidden; color: #fff; padding: 36px 28px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background: radial-gradient(110% 90% at 10% 0%, rgba(25,174,143,.6), transparent 55%), radial-gradient(70% 70% at 100% 100%, rgba(239,165,46,.28), transparent 60%), linear-gradient(160deg, #0C6C5C, #052B25);
}
.w-art::before {
  content: ''; position: absolute; inset: 0; opacity: .1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.4'%3E%3Crect x='24' y='24' width='40' height='40'/%3E%3Crect x='24' y='24' width='40' height='40' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='9'/%3E%3Cpath d='M0 44h10M78 44h10M44 0v10M44 78v10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px;
}
.w-art > * { position: relative; }
.w-top { display: flex; align-items: center; gap: 14px; }
.w-top .logo { border-radius: 16px; box-shadow: 0 10px 30px -8px rgba(0,0,0,.4); }
.w-top b { font-size: 26px; font-weight: 700; display: block; line-height: 1; }
.w-top small { opacity: .75; font-size: 14px; }
.w-top .lang { margin-inline-start: auto; }
.w-title { font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; max-width: 560px; }
.w-title em { font-style: normal; color: #FFD98A; }
.w-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.w-feat { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); font-size: 13.5px; }
.w-feat .ic { color: #FFD98A; }
.w-mock { display: none; }
@media (min-width: 960px) { .w-art { padding: 48px 56px; } .w-title { font-size: 46px; } .w-mock { display: block; } }
.w-panel { display: flex; align-items: center; justify-content: center; padding: 28px 20px 48px; }
.w-box { width: 100%; max-width: 420px; }
.w-box h2 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.w-box > p { color: var(--ink-3); margin: 6px 0 22px; }
.lang-btn { height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.code-box { font-size: 30px; font-weight: 700; letter-spacing: .14em; text-align: center; padding: 18px; border-radius: 18px; background: var(--brand-50); color: var(--brand-700); border: 1.5px dashed var(--brand-500); font-variant-numeric: tabular-nums; direction: ltr; }
.code-input { text-transform: uppercase; letter-spacing: .18em; font-weight: 600; text-align: center; direction: ltr; }
.mock-card { background: rgba(255,255,255,.96); color: var(--ink); border-radius: 22px; padding: 16px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); max-width: 420px; transform: rotate(-2deg); }
[dir='rtl'] .mock-card { transform: rotate(2deg); }
.mock-card .item { padding: 9px 4px; min-height: 0; }

/* ---------- editor ---------- */
.ed { padding-top: 6px; }
.ed-head { display: flex; align-items: center; gap: 12px; padding: 18px 0 16px; flex-wrap: wrap; }
.ed-head h1 { font-size: 22px; font-weight: 600; }
.ed-head .acts { margin-inline-start: auto; display: flex; gap: 8px; }
.ed-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .ed-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .ed-side { position: sticky; top: 20px; } }
@media (max-width: 1023px) {
  .ed-head { padding: 6px 0 12px; }
  .ed-title { display: none; }
  .ed-head .seg { flex: 1; }
  .ed-head .seg button { flex: 1; justify-content: center; }
}
.ed-more { margin-top: 12px; }
.ed-more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--brand-600); font-weight: 500; }
.ed-more summary::-webkit-details-marker { display: none; }
.ed-more summary .ic { width: 16px; height: 16px; transition: transform .2s; }
.ed-more[open] summary .ic { transform: rotate(180deg); }
.party-pick {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 18px;
  border: 1.5px dashed #C9D5D1; background: var(--panel-2); text-align: start; min-height: 70px;
}
.party-pick:hover { border-color: var(--brand-500); background: var(--brand-50); }
.party-pick.set { border-style: solid; border-color: var(--line); background: var(--panel); }
.party-pick .t { font-weight: 600; font-size: 16px; }
.ed-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
@media (max-width: 759px) {
  .ptiles { grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-template-columns: none; grid-auto-columns: 40%; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; margin-inline: -18px; padding-inline: 18px; }
  .ptiles::-webkit-scrollbar { display: none; }
  .ptiles .ptile { scroll-snap-align: start; }
}
.mainwrap { min-width: 0; }
.ptile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start;
  padding: 11px 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--panel); min-height: 68px;
  transition: transform .12s, border-color .15s, box-shadow .15s, background .15s;
}
.ptile:hover { border-color: var(--brand-500); box-shadow: var(--sh-2); }
.ptile:active { transform: scale(.97); }
.ptile b { font-weight: 600; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ptile small { color: var(--ink-3); font-size: 12px; }
.ptile .pp { margin-top: auto; font-size: 12.5px; color: var(--brand-700); font-weight: 600; font-variant-numeric: tabular-nums; }
.ptile.in { background: var(--brand-50); border-color: var(--brand-500); }
.ptile .cnt { position: absolute; top: 8px; inset-inline-end: 8px; background: var(--brand-600); color: #fff; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 7px; }
.ptile.low small.stk { color: var(--rose); }
.psearch { position: relative; }
.presults { position: absolute; z-index: 20; inset-inline: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-3); max-height: 320px; overflow-y: auto; }
.presults button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: 0; background: none; text-align: start; border-top: 1px solid var(--line-2); }
.presults button:first-child { border-top: 0; }
.presults button:hover, .presults button.hl { background: var(--brand-50); }
.lines { display: flex; flex-direction: column; gap: 10px; }
.ln {
  border: 1px solid var(--line); border-radius: 18px; padding: 12px 10px 12px 14px; background: var(--panel); animation: lnIn .25s ease;
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  grid-template-areas: "name name tot del" "qty x price price" "more more more more";
}
[dir='rtl'] .ln { padding: 12px 14px 12px 10px; }
@keyframes lnIn { from { opacity: 0; transform: translateY(-6px); } }
.ln-name { grid-area: name; min-width: 0; }
.ln-name b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.ln-name small { color: var(--ink-3); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln-name input { width: 100%; height: 40px; border: 1px dashed var(--line); border-radius: 10px; padding: 0 10px; outline: none; font-weight: 600; background: var(--panel-2); }
.ln-qty { grid-area: qty; }
.ln-x { grid-area: x; color: var(--ink-4); font-weight: 600; text-align: center; }
.ln-price { grid-area: price; }
.ln-tot { grid-area: tot; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 16px; text-align: end; }
.ln-del { grid-area: del; display: flex; }
.ln-del .icon-btn { width: 36px; height: 36px; }
.ln-del .icon-btn .ic { width: 18px; height: 18px; }
.ln .affix input { width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--line); outline: none; font-size: 18px; font-weight: 600; text-align: center; padding-inline: 10px 46px !important; font-variant-numeric: tabular-nums; background: var(--panel); }
.ln .affix input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.ln .affix span { inset-inline-end: 10px; font-size: 12px; }
.ln.adj { grid-template-areas: "name name name del" "qty qty qty qty"; }
@media (min-width: 760px) {
  .ln { grid-template-columns: minmax(0, 1fr) 150px 14px 150px 110px auto; grid-template-areas: "name qty x price tot del" "more more more more more more"; padding: 10px 10px 10px 16px; }
  .ln .affix input { height: 46px; font-size: 17px; }
}
.ln-more { grid-area: more; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ln-more:empty { display: none; }
.ln-more .hint-chip { height: 28px; padding: 0 10px; border-radius: 9px; border: 1px dashed var(--gold); background: var(--gold-50); color: var(--gold-700); font-size: 12px; font-weight: 500; }
.ln-more select, .ln-more input { height: 32px; border-radius: 9px; border: 1px solid var(--line); padding: 0 8px; font-size: 13px; background: var(--panel); width: auto; }
.ln-more label { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.totals { display: flex; flex-direction: column; gap: 8px; }
.totals .tr { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.totals .tr.grand { font-size: 15px; color: var(--ink); font-weight: 600; padding-top: 12px; margin-top: 4px; border-top: 1px dashed var(--line); align-items: baseline; }
.totals .tr.grand b { font-size: 30px; letter-spacing: -.02em; }
.totals .tr.grand:first-child, .totals .seg + .tr.grand { border-top: 0; padding-top: 0; margin-top: 0; }
.ed-bar {
  position: sticky; bottom: calc(var(--tab) + var(--safe-b) + 10px); z-index: 25; margin-top: 16px;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 20px;
  background: var(--ink); color: #fff; box-shadow: var(--sh-3);
}
[dir='rtl'] .ed-bar { padding: 10px 18px 10px 10px; }
.ed-bar .tt { flex: 1; min-width: 0; }
.ed-bar .tt small { display: block; font-size: 12px; opacity: .65; }
.ed-bar .tt b { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ed-bar .btn.primary { height: 48px; }
@media (min-width: 1100px) { .ed-bar { display: none; } }
.paybox .amt-row { display: flex; gap: 8px; }
.paybox .amt-row .field { flex: 1; }
.newbal { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: 13.5px; margin-top: 12px; }

/* ---------- document paper (screen + print) ---------- */
.paper {
  background: #fff; color: #111; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 20px 50px -20px rgba(14,31,27,.25);
  padding: 34px 36px; font-size: 13px; line-height: 1.45; direction: ltr; text-align: left; border: 1px solid var(--line-2);
}
.paper.rtl-doc { direction: rtl; text-align: right; }
.pp-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.pp-co { display: flex; gap: 14px; align-items: flex-start; max-width: 60%; }
.pp-co img { max-width: 110px; max-height: 70px; object-fit: contain; }
.pp-co b { font-size: 17px; display: block; }
.pp-co div { color: #444; font-size: 12px; }
.pp-title { text-align: right; }
.paper.rtl-doc .pp-title { text-align: left; }
.pp-title h2 { font-size: 24px; font-weight: 700; letter-spacing: .02em; color: var(--brand-700); text-transform: uppercase; }
.pp-title .ar { font-size: 15px; color: #666; font-weight: 500; }
.pp-title table { margin-top: 8px; margin-inline-start: auto; border-collapse: collapse; font-size: 12.5px; }
.pp-title td { padding: 2px 0 2px 12px; }
.pp-title td:first-child { color: #666; }
.pp-band { height: 4px; border-radius: 4px; margin: 18px 0; background: linear-gradient(90deg, var(--brand-600), var(--brand-500) 60%, var(--gold)); }
.pp-parties { display: flex; justify-content: space-between; gap: 20px; }
.pp-box { border: 1px solid #e3e3e3; border-radius: 10px; padding: 10px 14px; min-width: 46%; }
.pp-box small { color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.pp-box b { display: block; font-size: 15px; margin: 2px 0; }
.pp-lines { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 12.5px; }
.pp-lines th { background: #0C6C5C; color: #fff; font-weight: 600; padding: 8px 10px; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.paper.rtl-doc .pp-lines th { text-align: right; }
.pp-lines th:first-child { border-radius: 8px 0 0 8px; }
.pp-lines th:last-child { border-radius: 0 8px 8px 0; }
.pp-lines td { padding: 8px 10px; border-bottom: 1px solid #ececec; }
.pp-lines .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paper.rtl-doc .pp-lines .n { text-align: left; }
.pp-lines tr:nth-child(even) td { background: #fafbfa; }
.pp-sum { display: flex; justify-content: space-between; gap: 24px; margin-top: 16px; align-items: flex-start; }
.pp-words { flex: 1; font-size: 12px; color: #333; padding-top: 6px; }
.pp-words b { display: block; margin-top: 3px; font-size: 12.5px; }
.pp-tot { min-width: 250px; border-collapse: collapse; font-size: 13px; }
.pp-tot td { padding: 5px 10px; }
.pp-tot td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pp-tot tr.g td { background: #0C6C5C; color: #fff; font-weight: 700; font-size: 15px; }
.pp-tot tr.g td:first-child { border-radius: 8px 0 0 8px; }
.pp-tot tr.g td:last-child { border-radius: 0 8px 8px 0; }
.pp-sign { display: flex; justify-content: flex-end; margin-top: 26px; }
.pp-sign div { width: 220px; height: 90px; border: 1px dashed #bbb; border-radius: 10px; font-size: 11px; color: #888; padding: 8px; }
.pp-note { margin-top: 16px; font-size: 12px; color: #444; white-space: pre-wrap; }
.pp-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid #e5e5e5; font-size: 10.5px; color: #666; text-align: center; line-height: 1.6; }
.pp-stamp { display: inline-block; border: 2px solid; border-radius: 8px; padding: 2px 10px; font-weight: 700; font-size: 13px; transform: rotate(-6deg); letter-spacing: .06em; }
.pp-stamp.paid { color: #12936F; } .pp-stamp.due { color: #D63F5B; } .pp-stamp.part { color: #D88C14; }
@media (max-width: 700px) {
  .paper { padding: 18px 16px; font-size: 12px; }
  .pp-head { flex-direction: column; }
  .pp-co { max-width: 100%; }
  .pp-title, .paper.rtl-doc .pp-title { text-align: start; }
  .pp-title table { margin-inline-start: 0; }
  .pp-parties { flex-direction: column; }
  .pp-sum { flex-direction: column; }
  .pp-tot { width: 100%; min-width: 0; }
  .pp-lines .hide-sm { display: none; }
}

/* doc view */
.dv-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .dv-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .dv-side { position: sticky; top: 20px; } }
.dv-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dv-actions .btn { justify-content: flex-start; white-space: normal; height: auto; min-height: 44px; padding: 8px 12px; font-size: 13.5px; text-align: start; line-height: 1.25; }
bdi { unicode-bidi: isolate; }
.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-500), var(--ok)); transition: width .6s; }
.progress.warn i { background: linear-gradient(90deg, var(--gold), var(--rose)); }
.success-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800); margin-bottom: 16px; animation: lnIn .4s ease; }
.success-banner .ok { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-600); color: #fff; display: grid; place-items: center; flex: none; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(0); } }

/* party detail */
.p-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.p-hero .who { flex: 1; min-width: 200px; }
.p-hero h2 { font-size: 22px; font-weight: 600; }
.p-bal { text-align: end; }
.p-bal small { display: block; color: var(--ink-3); font-size: 13px; }
.p-bal b { font-size: 32px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .p-bal { text-align: start; width: 100%; } }
.gauge { margin-top: 14px; }
.gauge .progress { height: 10px; }
.gauge .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.p-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.ledger td.d { white-space: nowrap; color: var(--ink-2); }
.ledger tr.pay td:nth-child(2) { color: var(--ok); }

/* products */
.stock-bar { width: 70px; height: 6px; border-radius: 9px; background: var(--line-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.stock-bar i { display: block; height: 100%; background: var(--brand-500); border-radius: 9px; }
.stock-bar.low i { background: var(--rose); }
.price-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.price-row:first-child { border-top: 0; }
.price-row .grow b { font-weight: 600; display: block; }
.price-row .grow small { color: var(--ink-3); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 38px; height: 46px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; }
.stepper button .ic { width: 16px; height: 16px; }
.stepper input { width: 96px; height: 46px; border-radius: 11px; border: 1px solid var(--line); text-align: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; }
.stepper input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.stepper input.changed { border-color: var(--gold); background: var(--gold-50); }
.spark { width: 100%; height: 60px; }

/* cash */
.acct-card { position: relative; overflow: hidden; padding: 18px; border-radius: 22px; color: #fff; min-height: 128px; }
.acct-card.cash { background: linear-gradient(150deg, #13967E, #0A5A4D); box-shadow: 0 16px 34px -16px rgba(10,90,77,.7); }
.acct-card.bank { background: linear-gradient(150deg, #2B4A6F, #16263C); box-shadow: 0 16px 34px -16px rgba(22,38,60,.7); }
.acct-card::after { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; border: 26px solid rgba(255,255,255,.06); inset-inline-end: -60px; top: -60px; }
.acct-card small { opacity: .8; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.acct-card b { display: block; font-size: 28px; font-weight: 600; margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.acct-card .io { display: flex; gap: 14px; margin-top: 10px; font-size: 12.5px; opacity: .9; flex-wrap: wrap; }
.day-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: var(--panel-2); border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); font-weight: 500; position: sticky; top: 60px; z-index: 2; }
@media (min-width: 1024px) { .day-head { top: 0; } }
.day-head:first-child { border-top: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.close-box { display: grid; gap: 10px; }
.close-box .tr { display: flex; justify-content: space-between; font-size: 15px; font-variant-numeric: tabular-nums; }
.close-box .tr.big { font-size: 18px; font-weight: 600; border-top: 1px dashed var(--line); padding-top: 10px; }

/* search palette */
.palette .sheet-body { padding: 0 0 10px; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 4px 18px 12px; border-bottom: 1px solid var(--line-2); }
.pal-in input { flex: 1; height: 46px; border: 0; outline: none; font-size: 17px; background: transparent; }
.pal-group { padding: 10px 18px 4px; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.palette .item.hl { background: var(--brand-50); }

/* misc */
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; font-weight: 600; }
.section-title .link { margin-inline-start: auto; font-size: 13.5px; color: var(--brand-600); font-weight: 500; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--gold-50); color: #6b4505; font-size: 14px; border: 1px solid #F6E0B5; }
.notice .ic { color: var(--gold-600); margin-top: 1px; }
.notice.info { background: var(--sky-50); border-color: #CFE0F8; color: #1d4a8a; }
.notice.info .ic { color: var(--sky); }
.kbd-hint { font-size: 12px; color: var(--ink-3); }
.bars-h { display: flex; flex-direction: column; gap: 10px; padding: 6px 18px 18px; }
.bar-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar-h .nm { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-h .vv { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-h .track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar-h .track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); }
.chart-box { padding: 6px 12px 12px; }
.chart-box svg { width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); padding: 0 18px 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.copy-line { display: flex; gap: 8px; align-items: center; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.member:first-child { border-top: 0; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(18,147,111,.15); display: inline-block; }
.pending { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gold-700); background: var(--gold-50); padding: 2px 8px; border-radius: 99px; }
.fade-in { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.count-up { font-variant-numeric: tabular-nums; }

/* ---------- print ---------- */
#print { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; }
  #print .paper { box-shadow: none; border: 0; padding: 0; border-radius: 0; font-size: 11.5px; }
  #print .pp-lines th, #print .pp-tot tr.g td, #print .pp-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print table { page-break-inside: auto; }
  #print tr { page-break-inside: avoid; }
  #print .rep h1 { font-size: 18px; }
  #print .rep table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
  #print .rep th, #print .rep td { border: 1px solid #ddd; padding: 4px 6px; }
  #print .rep th { background: #eef4f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print .rep .n { text-align: right; }
}
