/* ==========================================================================
   پنل مدیریت نارنج — Base, layout and components (uses tokens.css only)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-default);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
::selection { background: var(--brand); color: var(--text-on-brand); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.icon--sm { width: 1rem; height: 1rem; }
.icon--lg { width: 1.5rem; height: 1.5rem; }
.num { font-feature-settings: "tnum"; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--t-base); }
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  background: var(--bg-sidebar);
  border-inline-start: 1px solid var(--border-default);
  box-shadow: -1px 0 0 rgba(0,0,0,.6), 0 0 40px rgba(0,0,0,.5);
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-1) var(--sp-2) var(--sp-5); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--sp-5); }
.brand__mark {
  width: 44px; height: 44px; border-radius: var(--r-md); flex: none;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, var(--orange-400), var(--orange-600));
  color: var(--text-on-brand);
  box-shadow: 0 8px 24px -8px var(--brand-glow);
}
.brand__mark .icon { width: 1.5rem; height: 1.5rem; }
.brand__name { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-strong); line-height: var(--lh-tight); white-space: nowrap; }
.brand__sub { font-size: var(--fs-2xs); color: var(--text-faint); letter-spacing: .18em; font-family: var(--font-latin); text-transform: uppercase; }
.sidebar__toggle { margin-inline-start: auto; width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-muted); border: 1px solid var(--border-default); }
.sidebar__toggle:hover { color: var(--text-strong); background: var(--bg-raised); }

.nav { display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav__label { font-size: var(--fs-xs); color: var(--text-faint); padding: var(--sp-3) var(--sp-3) var(--sp-1); }
.nav__item {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  padding: .8rem var(--sp-4); border-radius: var(--r-lg);
  color: var(--text-muted); font-size: var(--fs-md); font-weight: var(--fw-medium);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.nav__item:hover { color: var(--text-strong); background: rgba(255,255,255,.03); }
.nav__item.is-active { color: var(--text-strong); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.nav__item.is-active::after {
  content: ""; position: absolute; inset-inline-end: -1px; top: 24%; bottom: 24%; width: 3px;
  background: var(--brand); border-radius: var(--r-pill);
}
.nav__item.is-active .icon { color: var(--brand); }
.nav__badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--brand); color: var(--text-on-brand); font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.sidebar__foot { border-top: 1px solid var(--border-subtle); padding-top: var(--sp-4); margin-top: var(--sp-4); }
.nav__item--danger:hover { color: var(--danger-500); background: var(--danger-bg); }

.app.is-collapsed .brand__text, .app.is-collapsed .nav__text, .app.is-collapsed .nav__badge, .app.is-collapsed .nav__label { display: none; }
.app.is-collapsed .nav__item { justify-content: center; padding-inline: 0; }
.app.is-collapsed .brand { flex-direction: column; gap: var(--sp-3); padding-inline: 0; }
.app.is-collapsed .sidebar__toggle { margin: 0; }
.app.is-collapsed .sidebar__toggle .icon { transform: scaleX(-1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); padding: 0 var(--sp-8);
  display: flex; align-items: center; gap: var(--sp-5);
  background: color-mix(in srgb, var(--bg-page) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.page-title { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.page-title__chip { width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line); flex: none; }
.page-title h1 { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-strong); line-height: var(--lh-tight); }
.crumbs { display: flex; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-faint); }
.crumbs span + span::before { content: "/"; margin-inline-end: var(--sp-2); }

.search { position: relative; flex: 1; max-width: 460px; margin-inline: auto; }
.search input {
  width: 100%; height: 46px; padding-inline: 2.9rem 1rem;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--r-md);
  font-size: var(--fs-md); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }
.search .icon { position: absolute; inset-inline-start: 1rem; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }

.topbar__actions { display: flex; align-items: center; gap: var(--sp-3); margin-inline-start: auto; }
.icon-btn { position: relative; width: 46px; height: 46px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-muted); transition: var(--t-fast); }
.icon-btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
.icon-btn .dot { position: absolute; top: 11px; inset-inline-end: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--bg-surface); }
.profile { display: flex; align-items: center; gap: var(--sp-3); padding: 4px var(--sp-3) 4px 4px; border-radius: var(--r-pill); }
.profile:hover { background: var(--bg-surface); }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--bg-raised); border: 2px solid var(--border-default); flex: none; }
.profile__name { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-strong); line-height: 1.3; }
.profile__role { font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.3; }
.profile .icon { color: var(--text-faint); }

.content { padding: var(--sp-8); width: 100%; max-width: var(--content-max); margin-inline: auto; display: grid; gap: var(--sp-5); }

/* ---------------------------------------------------------------- cards */
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-xl); box-shadow: var(--shadow-card); padding: var(--sp-6); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-strong); }
.card__hint { font-size: var(--fs-xs); color: var(--text-faint); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
.stat { display: flex; flex-direction: column; gap: var(--sp-5); position: relative; overflow: hidden; }
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.stat__chip { width: 46px; height: 46px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--brand); border: 1px solid var(--brand-line); background: var(--brand-soft); flex: none; }
.stat__label { font-size: var(--fs-md); color: var(--text-muted); font-weight: var(--fw-medium); }
.stat__bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); }
.stat__value { font-size: var(--fs-2xl); font-weight: var(--fw-black); color: var(--text-strong); line-height: 1.2; letter-spacing: -.01em; }
.stat__unit { font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--text-faint); margin-inline-start: .35rem; }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; }
.delta--up { color: var(--success-500); background: var(--success-bg); }
.delta--down { color: var(--danger-500); background: var(--danger-bg); }
.delta--warn { color: var(--warning-500); background: var(--warning-bg); }

/* promo banner */
.banner { display: flex; align-items: center; gap: var(--sp-8); padding: var(--sp-5) var(--sp-8); overflow: hidden; position: relative; background: linear-gradient(110deg, var(--bg-surface) 40%, rgba(254,113,0,.10)); }
.banner__art { position: relative; width: 132px; height: 132px; flex: none; display: grid; place-items: center; }
.banner__art::before, .banner__art::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid var(--border-subtle); }
.banner__art::before { inset: -22px; }
.banner__art::after { inset: -46px; border-color: rgba(255,255,255,.035); }
.banner__art img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 3px solid var(--brand); box-shadow: 0 0 40px -6px var(--brand-glow); position: relative; z-index: 1; }
.banner__body { display: grid; gap: var(--sp-2); }
.banner__title { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-strong); }
.banner__title em { font-style: normal; color: var(--brand); }
.banner__eyebrow { font-family: var(--font-latin); font-size: var(--fs-xs); letter-spacing: .5em; color: var(--text-faint); text-transform: uppercase; }
.banner__text { color: var(--text-muted); max-width: 52ch; }
.banner .btn { margin-inline-start: auto; }

/* ---------------------------------------------------------------- buttons / chips / inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 46px; padding: 0 var(--sp-6); border-radius: var(--r-md); font-weight: var(--fw-semibold); font-size: var(--fs-md); white-space: nowrap; transition: var(--t-fast); }
.btn--primary { background: var(--brand); color: var(--text-on-brand); box-shadow: 0 10px 26px -12px var(--brand-glow); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--primary:active { background: var(--brand-press); }
.btn--light { background: var(--neutral-50); color: var(--neutral-900); }
.btn--light:hover { background: var(--neutral-0); }
.btn--ghost { border: 1px solid var(--border-default); color: var(--text-default); }
.btn--ghost:hover { background: var(--bg-raised); border-color: var(--border-strong); }
.btn--sm { height: 34px; padding: 0 var(--sp-4); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn--ok { background: var(--success-bg); color: var(--success-500); }
.btn--ok:hover { background: rgba(47,191,113,.22); }
.btn--no { background: var(--danger-bg); color: var(--danger-500); }
.btn--no:hover { background: rgba(240,82,79,.22); }

.select { display: inline-flex; align-items: center; gap: var(--sp-2); height: 38px; padding: 0 var(--sp-4); border: 1px solid var(--border-default); border-radius: var(--r-sm); background: var(--bg-surface); font-size: var(--fs-sm); color: var(--text-default); }
.select select { appearance: none; background: transparent; border: 0; outline: 0; color: inherit; padding-inline-end: var(--sp-1); cursor: pointer; }
.select select option { background: var(--bg-raised); }
.select .icon { color: var(--text-faint); }

.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip { height: 38px; padding: 0 var(--sp-4); border: 1px solid var(--border-default); border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-muted); transition: var(--t-fast); display: inline-flex; align-items: center; gap: var(--sp-2); }
.chip:hover { color: var(--text-strong); border-color: var(--border-strong); }
.chip.is-active { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); font-weight: var(--fw-semibold); }
.chip__count { font-size: var(--fs-2xs); opacity: .8; }

.status { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.status--done { color: var(--success-500); }
.status--wait { color: var(--warning-500); }
.status--fail { color: var(--danger-500); }
.status--cancel { color: var(--text-faint); }

/* ---------------------------------------------------------------- chart */
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-5); }
.side { display: grid; gap: var(--sp-5); align-content: start; }
.chart { position: relative; height: 320px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart__grid line { stroke: var(--border-subtle); stroke-width: 1; }
.chart__axis text { fill: var(--text-faint); font-size: 11px; font-family: var(--font-sans); }
.chart__line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart__dot { fill: var(--neutral-0); stroke: var(--brand); stroke-width: 2.5; }
.chart__cursor { stroke: var(--border-strong); stroke-dasharray: 3 4; }
.chart__tip { position: absolute; pointer-events: none; transform: translate(-50%, -110%); background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); white-space: nowrap; box-shadow: var(--shadow-pop); opacity: 0; transition: opacity var(--t-fast); }
.chart__tip b { display: block; color: var(--text-strong); font-size: var(--fs-md); }
.chart__tip.is-on { opacity: 1; }

/* pending receipts / panels */
.list { display: grid; }
.list__row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) 0; border-top: 1px solid var(--border-subtle); }
.list__row:first-child { border-top: 0; padding-top: 0; }
.list__row:last-child { padding-bottom: 0; }
.list__main { min-width: 0; flex: 1; }
.list__title { font-weight: var(--fw-semibold); color: var(--text-strong); font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: var(--fs-xs); color: var(--text-faint); }
.list__actions { display: flex; gap: var(--sp-2); }
.mini-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-raised); color: var(--brand); font-weight: var(--fw-bold); border: 1px solid var(--border-default); flex: none; }
.meter { height: 6px; border-radius: var(--r-pill); background: var(--bg-raised); overflow: hidden; margin-top: var(--sp-2); }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange-600), var(--orange-400)); }
.meter > i.is-hot { background: linear-gradient(90deg, #c93a37, var(--danger-500)); }
.empty-note { color: var(--text-faint); font-size: var(--fs-sm); text-align: center; padding: var(--sp-6) 0; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th { background: var(--bg-raised); color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); text-align: start; padding: var(--sp-3) var(--sp-4); white-space: nowrap; }
thead th:first-child { border-start-start-radius: var(--r-md); border-end-start-radius: var(--r-md); }
thead th:last-child { border-start-end-radius: var(--r-md); border-end-end-radius: var(--r-md); }
tbody td { padding: var(--sp-4); border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-md); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.cell-user { display: flex; align-items: center; gap: var(--sp-3); }
.cell-user small { display: block; color: var(--text-faint); font-size: var(--fs-xs); line-height: 1.3; }
.muted { color: var(--text-muted); }
.strong { color: var(--text-strong); font-weight: var(--fw-semibold); }
.link { color: var(--brand); font-size: var(--fs-sm); font-weight: var(--fw-medium); display: inline-flex; align-items: center; gap: var(--sp-2); }
.link:hover { color: var(--brand-hover); }

/* ---------------------------------------------------------------- mobile bottom nav + sheet */
.bottomnav { display: none; }
.sheet-backdrop { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .app, .app.is-collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--sp-5); gap: var(--sp-3); }
  .topbar .search { display: none; }
  .content { padding: var(--sp-5) var(--sp-4) calc(var(--bottomnav-h) + var(--sp-8)); }
  .profile__meta, .profile > .icon { display: none; }
  .profile { padding: 0; }

  /* menu moves to the bottom */
  .bottomnav {
    position: fixed; inset-inline: var(--sp-3); bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px)); z-index: 40;
    height: var(--bottomnav-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; gap: 2px;
    padding: 0 var(--sp-2); border-radius: var(--r-xl);
    background: color-mix(in srgb, var(--neutral-850) 88%, transparent); backdrop-filter: blur(18px);
    border: 1px solid var(--border-default); box-shadow: var(--shadow-pop);
  }
  .bottomnav__item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; border-radius: var(--r-lg); color: var(--text-faint); font-size: var(--fs-2xs); font-weight: var(--fw-medium); transition: var(--t-fast); }
  .bottomnav__item.is-active { color: var(--brand); background: var(--brand-soft); }
  .bottomnav__item .icon { width: 1.4rem; height: 1.4rem; }
  .bottomnav__item .dot { position: absolute; top: 8px; inset-inline-end: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity var(--t-base); }
  .sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 51; background: var(--bg-surface); border-radius: var(--r-xl) var(--r-xl) 0 0; border-top: 1px solid var(--border-default); padding: var(--sp-4) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform var(--t-base); }
  .sheet::before { content: ""; display: block; width: 44px; height: 4px; border-radius: var(--r-pill); background: var(--border-strong); margin: 0 auto var(--sp-4); }
  .sheet { max-height: 82vh; overflow-y: auto; }
  .sheet .nav { overflow: visible; gap: var(--sp-1); }
  .sheet .nav__item { padding: .75rem var(--sp-4); }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  body.sheet-open .sheet { transform: none; }
}

@media (min-width: 1025px) { .sheet { display: none; } .sheet-backdrop { display: none !important; } }

@media (max-width: 720px) {
  .stats { gap: var(--sp-3); }
  .stat { padding: var(--sp-4); gap: var(--sp-4); }
  .stat__chip { width: 38px; height: 38px; }
  .stat__label { font-size: var(--fs-sm); }
  .stat__value { font-size: var(--fs-xl); }
  .stat__bottom { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .card { padding: var(--sp-4); border-radius: var(--r-lg); }
  .page-title__chip { width: 38px; height: 38px; }
  .page-title h1 { font-size: var(--fs-lg); }
  .crumbs { display: none; }
  .banner { flex-wrap: wrap; padding: var(--sp-5); gap: var(--sp-5); }
  .banner__art { width: 84px; height: 84px; }
  .banner__art::before { inset: -14px; } .banner__art::after { inset: -28px; }
  .banner .btn { margin-inline-start: 0; width: 100%; }
  .banner__text { display: none; }
  .chart { height: 240px; }

  /* table becomes stacked cards */
  table, thead, tbody, tr, td { display: block; min-width: 0; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); background: var(--bg-raised); }
  tbody td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border: 0; font-size: var(--fs-sm); }
  tbody td::before { content: attr(data-label); color: var(--text-faint); font-size: var(--fs-xs); }
  tbody tr:hover td { background: none; }
}

/* ==========================================================================
   Inner-page components: toolbar, forms, switch, tabs, badges, modal, toast…
   ========================================================================== */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.page-head h2 { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-strong); }
.page-head p { color: var(--text-faint); font-size: var(--fs-sm); }
.toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .spacer { margin-inline-start: auto; }

.field { display: grid; gap: var(--sp-2); min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); }
.input, .textarea, .select-native {
  width: 100%; min-height: 44px; padding: 0 var(--sp-4);
  background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: var(--r-md);
  color: var(--text-default); font-size: var(--fs-md); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { padding: var(--sp-3) var(--sp-4); min-height: 110px; resize: vertical; line-height: var(--lh-normal); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select-native:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }
.select-native { appearance: none; padding-inline-end: 2.4rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a39f9b' 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: left 14px center; cursor: pointer; }
.select-native option { background: var(--bg-raised); }
.input--ltr { direction: ltr; text-align: left; font-family: var(--font-latin); }
.hint { font-size: var(--fs-xs); color: var(--text-faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid .full { grid-column: 1 / -1; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 var(--sp-4); background: var(--bg-hover); border: 1px solid var(--border-default); border-inline-end: 0; border-start-end-radius: var(--r-md); border-end-end-radius: var(--r-md); color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; order: 2; }
.input-group .input { order: 1; }

.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--neutral-600); position: relative; transition: background var(--t-fast); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t-fast); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(-18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }

.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-default); border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-muted); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.check:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); color: var(--text-strong); }

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: var(--sp-3) var(--sp-4); color: var(--text-muted); font-weight: var(--fw-medium); white-space: nowrap; font-size: var(--fs-md); }
.tab:hover { color: var(--text-strong); }
.tab.is-active { color: var(--brand); }
.tab.is-active::after { content: ""; position: absolute; inset-inline: var(--sp-3); bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; background: var(--bg-raised); color: var(--text-muted); }
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.badge--ok { background: var(--success-bg); color: var(--success-500); }
.badge--warn { background: var(--warning-bg); color: var(--warning-500); }
.badge--bad { background: var(--danger-bg); color: var(--danger-500); }
.badge--info { background: var(--info-bg); color: var(--info-500); }

.icon-btn--sm { width: 34px; height: 34px; border-radius: var(--r-sm); }
.icon-btn--sm .icon { width: 1.05rem; height: 1.05rem; }
.icon-btn--danger:hover { color: var(--danger-500); border-color: rgba(240,82,79,.4); }
.row-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.btn--danger { background: var(--danger-bg); color: var(--danger-500); }
.btn--danger:hover { background: rgba(240,82,79,.22); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; color: var(--text-faint); font-size: var(--fs-sm); }
.pager__btns { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pager__btns button { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: var(--r-sm); color: var(--text-muted); font-size: var(--fs-sm); }
.pager__btns button:hover { color: var(--text-strong); border-color: var(--border-strong); }
.pager__btns button.is-active { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.pager__btns button:disabled { opacity: .35; cursor: default; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-6); }
.kv > div { min-width: 0; }
.kv dt { font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: 2px; }
.kv dd { margin: 0; color: var(--text-strong); font-weight: var(--fw-medium); word-break: break-word; }
.kv--1 { grid-template-columns: 1fr; }
.copy { font-family: var(--font-latin); direction: ltr; unicode-bidi: embed; font-size: var(--fs-sm); color: var(--text-muted); word-break: break-all; }

.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.stack { display: grid; gap: var(--sp-5); }
.mt { margin-top: var(--sp-5); }

.entity { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); background: var(--bg-raised); }
.entity__main { min-width: 0; flex: 1; }
.entity__title { font-weight: var(--fw-semibold); color: var(--text-strong); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.entity__meta { font-size: var(--fs-xs); color: var(--text-faint); display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: 2px; }
.entity-list { display: grid; gap: var(--sp-3); }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-4); }
.entity-grid .entity { flex-wrap: wrap; align-items: flex-start; }

.hero-user { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.avatar--lg { width: 72px; height: 72px; font-size: var(--fs-xl); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: var(--fw-bold); border-color: var(--brand-line); }

.timeline { display: grid; gap: 0; }
.timeline__item { position: relative; padding: 0 var(--sp-6) var(--sp-5) 0; border-inline-start: 0; }
.timeline__item::before { content: ""; position: absolute; inset-inline-start: auto; right: 5px; top: 8px; bottom: -8px; width: 1px; background: var(--border-default); }
.timeline__item:last-child::before { display: none; }
.timeline__item::after { content: ""; position: absolute; right: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline__item small { color: var(--text-faint); display: block; font-size: var(--fs-xs); }

.legend { display: grid; gap: var(--sp-3); }
.legend__row { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.legend__row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend__row b { margin-inline-start: auto; color: var(--text-strong); font-weight: var(--fw-semibold); }
.donut-wrap { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 170px; height: 170px; flex: none; }
.donut__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut__center b { font-size: var(--fs-xl); color: var(--text-strong); font-weight: var(--fw-black); line-height: 1.2; }
.donut__center span { font-size: var(--fs-xs); color: var(--text-faint); }
.hbar { display: grid; gap: var(--sp-4); }
.hbar__row { display: grid; gap: 6px; }
.hbar__top { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); }
.hbar__top span:first-child { color: var(--text-default); }
.hbar__top span:last-child { color: var(--text-muted); }

.receipt-img { aspect-ratio: 3/4; border-radius: var(--r-lg); border: 1px dashed var(--border-strong); background: repeating-linear-gradient(45deg, var(--bg-raised), var(--bg-raised) 12px, var(--bg-surface) 12px, var(--bg-surface) 24px); display: grid; place-content: center; text-align: center; color: var(--text-faint); gap: var(--sp-2); }
.callout { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); background: var(--warning-bg); color: var(--warning-500); font-size: var(--fs-sm); }
.callout--info { background: var(--info-bg); color: var(--info-500); }
.callout--bad { background: var(--danger-bg); color: var(--danger-500); }
.tg-preview { background: #17212b; border-radius: var(--r-lg); padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.tg-preview__bubble { background: #182533; border-radius: 14px 14px 14px 4px; padding: var(--sp-3) var(--sp-4); color: #e8eef4; white-space: pre-wrap; font-size: var(--fs-md); line-height: 1.7; }
.tg-preview__btn { background: #2b5278; color: #fff; text-align: center; border-radius: 8px; padding: 8px; font-size: var(--fs-sm); }
.code-tag { display: inline-block; direction: ltr; font-family: var(--font-latin); font-size: var(--fs-xs); background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: 6px; padding: 1px 8px; color: var(--brand); cursor: pointer; }
.code-tag:hover { background: var(--brand-soft); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-4) 0; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-row__text { min-width: 0; flex: 1 1 260px; }
.setting-row__text b { display: block; color: var(--text-strong); font-weight: var(--fw-semibold); }
.setting-row__text small { color: var(--text-faint); font-size: var(--fs-xs); }
.setting-row .input, .setting-row .select-native { width: 220px; }
.sticky-save { position: sticky; bottom: var(--sp-4); display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4); background: color-mix(in srgb, var(--bg-surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border-default); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.side-menu { display: grid; gap: var(--sp-1); position: sticky; top: calc(var(--topbar-h) + var(--sp-5)); }
.side-menu button { text-align: start; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); color: var(--text-muted); font-weight: var(--fw-medium); }
.side-menu button:hover { background: var(--bg-raised); color: var(--text-strong); }
.side-menu button.is-active { background: var(--brand-soft); color: var(--text-strong); box-shadow: inset 0 0 0 1px var(--brand-line); }
.side-menu button.is-active .icon { color: var(--brand); }
.bank-card { border-radius: var(--r-lg); padding: var(--sp-5); min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(120% 140% at 100% 0%, rgba(254,113,0,.35), transparent 60%), linear-gradient(135deg, #2a2724, #171615); border: 1px solid var(--border-default); color: var(--text-strong); position: relative; }
.bank-card__num { font-family: var(--font-latin); direction: ltr; letter-spacing: .12em; font-size: var(--fs-xl); }
.bank-card__row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-default); }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--brand); }
.export-btns { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* modal + toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); display: grid; place-items: center; padding: var(--sp-4); animation: fade .18s var(--ease); }
.modal { width: min(620px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); animation: rise .22s var(--ease); }
.modal--lg { width: min(860px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-subtle); }
.modal__head h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-strong); }
.modal__body { padding: var(--sp-6); overflow-y: auto; display: grid; gap: var(--sp-4); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.toast-wrap { position: fixed; inset-inline-start: var(--sp-5); bottom: var(--sp-5); z-index: 200; display: grid; gap: var(--sp-2); }
.toast { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); background: var(--bg-raised); border: 1px solid var(--border-default); border-radius: var(--r-md); box-shadow: var(--shadow-pop); animation: rise .22s var(--ease); font-size: var(--fs-sm); }
.toast .icon { color: var(--success-500); }
.toast--bad .icon { color: var(--danger-500); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.view { display: grid; gap: var(--sp-5); animation: fade .2s var(--ease); }

.nav__group { display: grid; gap: var(--sp-1); }

@media (max-width: 1280px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } .side-menu { position: static; display: flex; overflow-x: auto; scrollbar-width: none; } .side-menu button { white-space: nowrap; } }
@media (max-width: 720px) {
  .cols-3, .cols-2, .form-grid, .kv { grid-template-columns: 1fr; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
  .modal__body, .modal__head, .modal__foot { padding-inline: var(--sp-4); }
  .toast-wrap { inset-inline: var(--sp-4); bottom: calc(var(--bottomnav-h) + var(--sp-6)); }
  .setting-row .input, .setting-row .select-native { width: 100%; }
  .entity-grid { grid-template-columns: 1fr; }
  .toolbar .grow { min-width: 100%; }
}
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1280px) { .stats--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.content { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr) !important; } .legend { flex-wrap: wrap; } }
.flow td { white-space: normal !important; }

.chart svg { position: absolute; inset: 0; }
.tagbar { padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--bg-raised); }
.tagbar .code-tag small { margin-inline-start: 4px; font-family: var(--font-sans); direction: rtl; }

.brand__mark--logo { background: none; box-shadow: none; width: 46px; height: 46px; }
.brand__mark--logo img { width: 100%; height: 100%; object-fit: contain; }
.brand__mark--logo { flex: none; display: grid; place-items: center; }
.brand__mark--logo img { width: auto; height: 100%; max-width: 100%; }
