/* ==========================================================================
   Bayand Admin — Design System (demo)
   RTL-first, token-driven, light + dark
   ========================================================================== */

:root {
  /* Brand */
  --primary: #0e7c66;
  --primary-hover: #0a6553;
  --primary-soft: #e6f4f0;
  --primary-on: #ffffff;
  --ring: #0e7c6640;

  /* Surfaces */
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f5;
  --border: #e2e7ec;
  --border-strong: #cfd6de;

  /* Text */
  --text: #101828;
  --text-2: #475467;
  --text-3: #63707f;

  /* Sidebar */
  --side-bg: #ffffff;
  --side-text: #475467;
  --side-text-strong: #101828;
  --side-muted: #63707f;
  --side-hover: #f2f5f7;
  --side-active: #e6f4f0;
  --side-active-text: #0a6553;
  --side-border: #e2e7ec;
  --side-chip: #eef1f4;
  --side-chip-text: #344054;
  --side-scroll: #cfd6de;

  /* Semantic tones: fg / bg / border */
  --ok: #157f3c;    --ok-bg: #e7f6ec;    --ok-bd: #b7e2c4;
  --warn: #a35a00;  --warn-bg: #fff4e0;  --warn-bd: #f6d49a;
  --bad: #c0322a;   --bad-bg: #fdecea;   --bad-bd: #f5bcb6;
  --info: #1d5fd1;  --info-bg: #eaf1fd;  --info-bd: #bcd2f7;
  --bank: #6a3fc8;  --bank-bg: #f2edfd;  --bank-bd: #d6c8f6;
  --neu: #4d5867;   --neu-bg: #eef1f4;   --neu-bd: #d7dde4;

  /* Chart */
  --c1: #0e7c66; --c2: #d64545; --c3: #3b82f6; --c4: #f59e0b; --c5: #8b95a5;

  /* Radius / shadow / motion */
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 20px;
  --sh-1: 0 1px 2px #1018280d;
  --sh-2: 0 4px 12px -2px #10182814, 0 2px 4px -2px #1018280a;
  --sh-3: 0 20px 40px -8px #10182833;
  --ease: cubic-bezier(.2,.8,.2,1);
  --dur: 180ms;

  /* Layout */
  --side-w: 268px;
  --top-h: 60px;
  --demo-h: 40px;
  --z-sticky: 20; --z-side: 40; --z-drop: 60; --z-modal: 100; --z-toast: 200;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #2bb596;
  --primary-hover: #3cc9a8;
  --primary-soft: #12352f;
  --primary-on: #04140f;
  --ring: #2bb59666;

  --bg: #0a0f17;
  --surface: #111824;
  --surface-2: #151e2c;
  --surface-3: #1b2636;
  --border: #233042;
  --border-strong: #2f3e53;

  --text: #e8eef5;
  --text-2: #aab6c6;
  --text-3: #8b98aa;

  --side-bg: #0b121d;
  --side-text: #b8c4d3;
  --side-text-strong: #ffffff;
  --side-muted: #7c8a9c;
  --side-hover: #ffffff0f;
  --side-active: #2bb59626;
  --side-active-text: #ffffff;
  --side-border: #ffffff14;
  --side-chip: #ffffff1c;
  --side-chip-text: #ffffff;
  --side-scroll: #ffffff22;

  --ok: #4ccf7f;    --ok-bg: #12301f;    --ok-bd: #1f5135;
  --warn: #f2b24c;  --warn-bg: #33250d;  --warn-bd: #5a4113;
  --bad: #f2776e;   --bad-bg: #3a1714;   --bad-bd: #5f2520;
  --info: #79a8f5;  --info-bg: #142540;  --info-bd: #20406f;
  --bank: #b39af2;  --bank-bg: #261c40;  --bank-bd: #3d2e69;
  --neu: #a8b3c2;   --neu-bg: #1d2735;   --neu-bd: #2e3a4c;

  --c1: #2bb596; --c2: #f2776e; --c3: #79a8f5; --c4: #f2b24c; --c5: #7d8899;

  --sh-1: 0 1px 2px #0006;
  --sh-2: 0 6px 16px -4px #0008;
  --sh-3: 0 24px 48px -8px #000a;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.35; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary-soft); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 999; background: var(--primary); color: var(--primary-on); padding: 8px 14px; border-radius: var(--r); }
.skip-link:focus { top: 12px; }
.ic { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
.hide { display: none !important; }

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

/* --------------------------------------------------------------- demo bar */
.demo-bar {
  position: sticky; top: 0; z-index: calc(var(--z-side) + 1);
  height: var(--demo-h);
  display: flex; align-items: center; gap: 12px;
  padding-inline: 16px;
  background: repeating-linear-gradient(-45deg, #1b2533, #1b2533 12px, #1e2938 12px, #1e2938 24px);
  color: #dbe3ec; font-size: 12.5px;
}
.demo-bar .tag { background: #f59e0b; color: #1b1300; font-weight: 700; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; }
.demo-bar .seg { display: inline-flex; background: #ffffff14; border-radius: 8px; padding: 2px; }
.demo-bar .seg button { border: 0; background: none; color: #cfd8e3; padding: 3px 10px; border-radius: 6px; font-size: 12px; }
.demo-bar .seg button[aria-pressed="true"] { background: #fff; color: #0d1726; font-weight: 600; }
.demo-bar .spacer { flex: 1; }
.demo-bar .link { background: none; border: 0; color: #fff; display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 6px; font-size: 12.5px; }
.demo-bar .link:hover { background: #ffffff1a; }
@media (max-width: 640px) { .demo-bar .hide-sm { display: none; } }

/* ----------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100dvh - var(--demo-h)); }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1480px; margin-inline: auto; }
.content:focus { outline: none; }
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 18px 16px 40px; }
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: var(--demo-h); height: calc(100dvh - var(--demo-h));
  background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column;
  z-index: var(--z-side);
  border-inline-end: 1px solid var(--side-border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; color: var(--side-text-strong); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #18b892, #0e7c66); display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; box-shadow: inset 0 -2px 0 #0003; }
.brand b { display: block; font-size: 16px; line-height: 1.2; }
.brand small { color: var(--side-muted); font-size: 11.5px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: var(--side-scroll) transparent; }
.nav-group { margin-top: 14px; }
.nav-caption { font-size: 11px; font-weight: 600; color: var(--side-muted); padding: 0 10px 6px; letter-spacing: .2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-text); background: none; border: 0; text-align: start;
  font-size: 13.5px; transition: background var(--dur) var(--ease), color var(--dur);
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text-strong); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--side-active); color: var(--side-active-text); font-weight: 600; box-shadow: inset -3px 0 0 var(--primary); }
.nav-item .ic { opacity: .85; }
.nav-item .count { margin-inline-start: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--side-chip); color: var(--side-chip-text); font-size: 11.5px; display: grid; place-items: center; font-weight: 600; }
.nav-item .count.hot { background: #f59e0b; color: #1b1300; }
.nav-sub { padding-inline-start: 28px; display: grid; gap: 2px; margin-top: 2px; }
.nav-sub .nav-item { min-height: 36px; font-size: 13px; }
.nav-parent .chev { margin-inline-start: auto; transition: transform var(--dur) var(--ease); }
.nav-parent[aria-expanded="false"] .chev { transform: rotate(90deg); }
.side-foot { border-top: 1px solid var(--side-border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { color: var(--side-text-strong); font-size: 13px; display: block; }
.side-foot .who small { color: var(--side-muted); font-size: 11.5px; }
.side-foot .icon-btn { color: var(--side-text); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: var(--side-text-strong); }
.side-avatar { background: var(--side-chip); color: var(--side-chip-text); }
.scrim { position: fixed; inset: 0; background: #0b1220a0; z-index: calc(var(--z-side) - 1); opacity: 0; pointer-events: none; transition: opacity var(--dur); }
@media (max-width: 1024px) {
  .sidebar { position: fixed; inset-block: var(--demo-h) 0; inset-inline-start: 0; width: min(86vw, var(--side-w)); height: auto; transform: translateX(100%); transition: transform 220ms var(--ease); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--sh-3); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
}

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: var(--demo-h); z-index: var(--z-sticky);
  height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding-inline: 28px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
@media (max-width: 1024px) { .topbar { padding-inline: 12px; } .topbar .menu-btn { display: inline-flex; } }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 38px; width: min(420px, 100%);
  padding-inline: 12px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2); color: var(--text-3); font-size: 13px;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-inline-start: auto; }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--text-3); background: var(--surface); direction: ltr; }
.topbar .grow { flex: 1; }
@media (max-width: 640px) { .search-trigger span, .search-trigger kbd { display: none; } .search-trigger { width: 38px; justify-content: center; padding: 0; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  --_bg: var(--surface); --_fg: var(--text); --_bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: var(--r);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur), transform 80ms;
  text-decoration: none !important; touch-action: manipulation;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { --_bg: var(--primary); --_fg: var(--primary-on); --_bd: var(--primary); box-shadow: 0 1px 0 #0000001a, inset 0 1px 0 #ffffff1f; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { --_bg: var(--bad); --_fg: #fff; --_bd: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }
.btn-danger-soft { --_bg: var(--bad-bg); --_fg: var(--bad); --_bd: var(--bad-bd); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--bad-bg) 70%, var(--bad-bd)); }
.btn-warn-soft { --_bg: var(--warn-bg); --_fg: var(--warn); --_bd: var(--warn-bd); }
.btn-ghost { --_bg: transparent; --_bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .spinner { width: 15px; height: 15px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r);
  background: none; border: 0; color: var(--text-2); position: relative;
  transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tooltip for icon-only controls */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; z-index: var(--z-drop);
}

/* ------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin-top: 4px; font-size: 13.5px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; list-style: none; padding: 0; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--primary); }
.crumbs li + li::before { content: "/"; margin-inline-end: 6px; color: var(--border-strong); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { flex: 1; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-side-l { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-side, .g-side-l { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .g-4 { grid-template-columns: minmax(0, 1fr); } }
.sticky-side { position: sticky; top: calc(var(--demo-h) + var(--top-h) + 16px); }
@media (max-width: 1200px) { .sticky-side { position: static; } }

/* KPI */
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; text-decoration: none !important; color: inherit; transition: border-color var(--dur), box-shadow var(--dur); }
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.kpi .kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi .label { color: var(--text-2); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--ok); } .trend-down { color: var(--bad); }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-bank { background: var(--bank-bg); color: var(--bank); }
.tone-neu { background: var(--neu-bg); color: var(--neu); }
.tone-pri { background: var(--primary-soft); color: var(--primary); }

/* ----------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; line-height: 1;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.no-dot::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-bd); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.badge.bank { background: var(--bank-bg); color: var(--bank); border-color: var(--bank-bd); }
.badge.neu { background: var(--neu-bg); color: var(--neu); border-color: var(--neu-bd); }
.badge.pri { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.lg { height: 28px; font-size: 13px; padding: 0 12px; }
.pill-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.actor { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); }

/* ------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; padding-inline: 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px; min-height: 46px;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab[aria-selected="true"] .pill-count { background: var(--primary-soft); color: var(--primary); }
.card > .tabs { padding-inline: 12px; }

.seg-ctl { display: inline-flex; background: var(--surface-3); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg-ctl button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); min-height: 30px; }
.seg-ctl button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

/* ------------------------------------------------------------------ table */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.toolbar .grow { flex: 1; }
.input-search { position: relative; min-width: 220px; flex: 1; max-width: 340px; }
.input-search .ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-search input { padding-inline-start: 36px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  text-align: start; font-weight: 600; color: var(--text-2); font-size: 12.5px;
  background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0;
}
.tbl th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tbl th button:focus-visible { outline: 2px solid var(--primary); border-radius: 4px; }
.tbl th .sort-ic { opacity: .35; width: 14px; height: 14px; }
.tbl th[aria-sort] .sort-ic { opacity: 1; color: var(--primary); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background var(--dur); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .t-end { text-align: end; }
.tbl .t-center { text-align: center; }
.tbl .cell-user { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.tbl .cell-user b { font-weight: 600; display: block; }
.tbl .cell-user small { color: var(--text-3); font-size: 12px; }
.tbl .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.tbl .row-actions .icon-btn { width: 34px; height: 34px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.pager .grow { flex: 1; }
.pager select { width: auto; min-height: 32px; padding-block: 0; }
.pager .pages { display: flex; gap: 4px; }
.pager .pages button { min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.pager .pages button[aria-current="page"] { background: var(--primary); color: var(--primary-on); border-color: var(--primary); }
.pager .pages button:disabled { opacity: .4; cursor: default; }

@media (max-width: 760px) {
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .tbl.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: start !important; }
  .tbl.responsive td::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; flex: none; }
  .tbl.responsive td.cell-primary { padding-bottom: 8px; }
  .tbl.responsive td.cell-primary::before { display: none; }
  .tbl.responsive td.cell-actions::before { display: none; }
  .tbl.responsive td.cell-actions { justify-content: flex-end; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 6px; }
  .input-search { max-width: none; }
}

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--bad); margin-inline-start: 2px; }
.help { font-size: 12px; color: var(--text-3); }
.err { font-size: 12.5px; color: var(--bad); display: flex; gap: 4px; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color var(--dur), box-shadow var(--dur);
  font-size: 14px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.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 12px; border: 1px solid var(--border-strong); border-inline-start: 0; border-start-end-radius: var(--r); border-end-end-radius: var(--r); background: var(--surface-2); color: var(--text-3); font-size: 13px; white-space: nowrap; }
.input-wrap { position: relative; }
.input-wrap .trail { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }
.select { appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2363707f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 680px) { .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 10px; padding: 0; }
.fieldset-box { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.fieldset-box + .fieldset-box { margin-top: 14px; }

.check, .radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 0; min-height: 36px; }
.check input, .radio input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; cursor: pointer; }
.check-card { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; transition: border-color var(--dur), background var(--dur); }
.check-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.check .meta { font-size: 12px; color: var(--text-3); display: block; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background var(--dur); margin: 0; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform var(--dur) var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(-16px); }
.range-field input[type=range] { width: 100%; accent-color: var(--primary); }
.range-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.range-value { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 20px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color var(--dur), background var(--dur);
  display: grid; gap: 6px; justify-items: center; color: var(--text-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .ic-lg { color: var(--primary); }
.file-chip { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; background: var(--surface); }
.file-chip .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* filter bar */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); align-items: end; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); font-size: 12.5px; }
.chip button { all: unset; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.chip button:hover { background: var(--border); }

/* --------------------------------------------------------- key/value list */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.kv.cols-1 { grid-template-columns: minmax(0, 1fr); }
.kv.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv > div { padding: 10px 0; border-bottom: 1px dashed var(--border); display: grid; gap: 2px; min-width: 0; padding-inline-end: 12px; }
.kv dt { font-size: 12.5px; color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 680px) { .kv, .kv.cols-3 { grid-template-columns: minmax(0, 1fr); } }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money small { font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-inline-start: 3px; }

/* ----------------------------------------------------------------- callout */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid; align-items: flex-start; }
.callout .ic { margin-top: 2px; }
.callout b { display: block; margin-bottom: 2px; }
.callout.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn); }
.callout.bad { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad); }
.callout.info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.callout.neu { background: var(--neu-bg); border-color: var(--neu-bd); color: var(--neu); }
.callout .body { color: var(--text); flex: 1; }
.callout .body p { color: var(--text-2); }

/* -------------------------------------------------------------- stepper */
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: thin; }
.step { flex: 1; min-width: 108px; display: grid; justify-items: center; text-align: center; gap: 6px; position: relative; padding: 0 4px; }
.step::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--primary); }
.step .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); font-weight: 700; font-size: 13px; position: relative; z-index: 1; }
.step.done .dot { background: var(--primary); border-color: var(--primary); color: var(--primary-on); }
.step.current .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 5px var(--ring); }
.step.blocked .dot { border-color: var(--bad); color: var(--bad); box-shadow: 0 0 0 5px var(--bad-bg); }
.step .lbl { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.step.current .lbl { color: var(--text); font-weight: 700; }
.step .who { font-size: 11px; color: var(--text-3); }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.mini-steps { display: flex; gap: 3px; align-items: center; }
.mini-steps i { width: 10px; height: 4px; border-radius: 2px; background: var(--border); display: block; }
.mini-steps i.on { background: var(--primary); }
.mini-steps i.bad { background: var(--bad); }

/* wizard steps (vertical) */
.wsteps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; counter-reset: ws; }
.wstep { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-3); font-weight: 600; }
.wstep .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; }
.wstep.on { color: var(--text); border-color: var(--primary); }
.wstep.on .n { background: var(--primary); color: var(--primary-on); }
.wstep.done .n { background: var(--ok-bg); color: var(--ok); }

/* --------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 18px; }
.timeline li::before { content: ""; position: absolute; top: 32px; bottom: 0; right: 15px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .t-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.timeline .t-ic .ic { width: 16px; height: 16px; }
.timeline .t-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.timeline .t-body { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--r); color: var(--text-2); }

/* -------------------------------------------------------------- chat */
.chat { display: grid; gap: 14px; }
.msg { max-width: min(560px, 88%); display: grid; gap: 4px; }
.msg .bubble { padding: 10px 14px; border-radius: 14px; background: var(--surface-3); line-height: 1.8; }
.msg.me { justify-self: end; }
.msg.me .bubble { background: var(--primary); color: var(--primary-on); border-end-end-radius: 4px; }
.msg.them .bubble { border-end-start-radius: 4px; }
.msg .meta { font-size: 11.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.msg.me .meta { justify-content: flex-end; }
.attach { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: #ffffff26; font-size: 12.5px; color: inherit; }
.msg.them .attach { background: var(--surface); border: 1px solid var(--border); }

/* --------------------------------------------------------------- avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; background: var(--primary-soft); color: var(--primary); }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.sq { border-radius: 10px; }

/* ------------------------------------------------------------- empty */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--text-3); }
.empty .e-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.empty b { color: var(--text); font-size: 15px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* -------------------------------------------------------------- modal */
.modal-root { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: #0a1220a6; animation: fade 160ms var(--ease); }
.modal {
  position: relative; width: min(560px, 100%); max-height: min(88dvh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); border: 1px solid var(--border);
  animation: pop 200ms var(--ease);
}
.modal.lg { width: min(820px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head .m-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-head .sub { font-size: 13px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-end-start-radius: var(--r-xl); border-end-end-radius: var(--r-xl); }
.modal-foot .grow { flex: 1; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 640px) {
  .modal-root { place-items: end center; padding: 0; }
  .modal, .modal.lg, .modal.xl, .modal.sm { width: 100%; border-end-start-radius: 0; border-end-end-radius: 0; max-height: 92dvh; animation: sheet 240ms var(--ease); }
  .modal-foot { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

/* drawer */
.drawer-root { position: fixed; inset: 0; z-index: var(--z-modal); }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(520px, 100%); background: var(--surface); box-shadow: var(--sh-3); display: flex; flex-direction: column; animation: slide 240ms var(--ease); border-inline-start: 1px solid var(--border); }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }

/* ------------------------------------------------------------- dropdown */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 220px; z-index: var(--z-drop);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-3); padding: 6px;
  animation: pop 140ms var(--ease);
}
.menu.start { inset-inline-end: auto; inset-inline-start: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; min-height: 40px; border-radius: 8px; background: none; border: 0; text-align: start; font-size: 13.5px; color: var(--text); text-decoration: none !important; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item .ic { color: var(--text-3); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger .ic { color: var(--bad); }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item .desc { display: block; font-size: 12px; color: var(--text-3); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-label { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 2px; font-weight: 600; }

/* -------------------------------------------------------------- toast */
.toasts { position: fixed; bottom: 20px; left: 20px; z-index: var(--z-toast); display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); background: #111a27; color: #f1f5f9; box-shadow: var(--sh-3); animation: pop 200ms var(--ease); font-size: 13.5px; }
.toast .ic { margin-top: 2px; }
.toast.ok .ic { color: #4ccf7f; } .toast.bad .ic { color: #f2776e; } .toast.warn .ic { color: #f2b24c; } .toast.info .ic { color: #79a8f5; }
.toast .t-body { flex: 1; }
.toast button { background: none; border: 0; color: #9fd8c9; font-weight: 700; padding: 0 4px; }
.toast .x { color: #94a3b8; }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; } }

/* ------------------------------------------------------------ palette */
.palette { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.palette .p-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette .p-input input { border: 0; outline: none; background: none; flex: 1; font-size: 15px; }
.palette .p-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .p-item[aria-selected="true"] { background: var(--primary-soft); }
.palette .p-group { font-size: 11.5px; color: var(--text-3); padding: 8px 10px 4px; font-weight: 600; }

/* ------------------------------------------------------------- charts */
.chart { width: 100%; height: 280px; display: block; overflow: visible; }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis-t { fill: var(--text-3); font-size: 11px; font-family: inherit; }
.chart .hover-l { stroke: var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 3px 10px; font-size: 12.5px; color: var(--text-2); min-height: 30px; }
.legend button[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2); border-radius: var(--r); padding: 8px 10px; font-size: 12.5px; min-width: 150px; z-index: 5; }
.chart-tip .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-box { position: relative; }
.stat-list { display: grid; gap: 4px; }
.stat-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--border); }
.stat-row:last-child { border: 0; }
.stat-row .s-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat-row .s-lbl { flex: 1; color: var(--text-2); }
.stat-row .s-val { font-weight: 750; font-variant-numeric: tabular-nums; font-size: 16px; }
.bar-mini { height: 8px; border-radius: 99px; background: var(--surface-3); display: flex; overflow: hidden; }
.bar-mini span { display: block; height: 100%; }

/* --------------------------------------------------------- queue list */
.queue { list-style: none; margin: 0; padding: 0; }
.queue li a { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; transition: background var(--dur); }
.queue li:last-child a { border-bottom: 0; }
.queue li a:hover { background: var(--surface-2); }
.queue .q-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.queue .q-txt { flex: 1; min-width: 0; }
.queue .q-txt b { display: block; font-weight: 600; }
.queue .q-txt small { color: var(--text-3); font-size: 12.5px; }
.queue .q-n { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------- doc cards */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.doc { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; transition: border-color var(--dur), box-shadow var(--dur); }
.doc .thumb { aspect-ratio: 4 / 3; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); position: relative; }
.doc .thumb svg.paper { width: 62%; height: auto; }
.doc .thumb .type { position: absolute; top: 8px; inset-inline-start: 8px; }
.doc .d-body { padding: 10px 12px; display: grid; gap: 2px; }
.doc .d-body b { font-size: 13px; }
.doc .d-body small { color: var(--text-3); font-size: 12px; }
.doc .d-foot { display: flex; gap: 4px; padding: 0 8px 8px; }
.doc.selectable { cursor: pointer; }
.doc.selectable:hover { border-color: var(--border-strong); }
.doc.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.doc .pick { position: absolute; top: 8px; inset-inline-end: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: grid; place-items: center; }
.doc.selected .pick { background: var(--primary); border-color: var(--primary); color: var(--primary-on); }
.bucket { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 10px; min-height: 76px; display: grid; gap: 8px; align-content: start; transition: border-color var(--dur), background var(--dur); }
.bucket.drag { border-color: var(--primary); background: var(--primary-soft); }
.bucket h4 { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.bucket .placeholder { font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------- vendor card */
.vendor-card { overflow: hidden; display: flex; flex-direction: column; }
.vendor-card .banner { height: 84px; position: relative; }
.vendor-card .logo { position: absolute; bottom: -22px; inset-inline-start: 16px; width: 52px; height: 52px; border-radius: 14px; background: var(--surface); border: 3px solid var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 20px; box-shadow: var(--sh-2); }
.vendor-card .v-body { padding: 30px 16px 14px; display: grid; gap: 6px; flex: 1; }
.vendor-card .v-foot { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; gap: 6px; }

/* ---------------------------------------------------------- auth page */
.auth { min-height: calc(100dvh - var(--demo-h)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form .box { width: min(380px, 100%); display: grid; gap: 18px; }
.auth-art { background: radial-gradient(1200px 600px at 100% 0%, #18b89244, transparent 60%), linear-gradient(160deg, #0d1726, #0b2a2a); color: #e6f2ef; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .points { display: grid; gap: 14px; margin-top: 28px; }
.auth-art .points div { display: flex; gap: 12px; align-items: flex-start; }
.auth-art .points .ic { color: #18b892; margin-top: 3px; }
.auth-art h2 { font-size: 28px; line-height: 1.5; max-width: 460px; }
.auth-art .ring { position: absolute; border-radius: 50%; border: 1px solid #ffffff14; }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-art { display: none; } }

/* ------------------------------------------------------------ misc */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: grid; gap: 4px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.gap-2 { gap: 12px; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }
.danger-zone { border: 1px solid var(--bad-bd); border-radius: var(--r-lg); padding: 14px; background: color-mix(in srgb, var(--bad-bg) 45%, transparent); }
.danger-zone h3 { color: var(--bad); font-size: 13.5px; margin-bottom: 4px; }
.action-panel .primary-action { display: grid; gap: 8px; }
.action-panel .hint { font-size: 12.5px; color: var(--text-3); }
.note-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; color: var(--text-2); line-height: 1.8; }
.verify-list { display: grid; gap: 8px; }
.verify-list .check { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); }
.verify-list .check:has(input:checked) { border-color: var(--ok-bd); background: var(--ok-bg); }
.verify-list .when { margin-inline-start: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.inline-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* jalali date picker */
.jdp { position: absolute; z-index: var(--z-drop); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-3); padding: 10px; width: 280px; animation: pop 140ms var(--ease); }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 700; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdp-grid .wd { font-size: 11.5px; color: var(--text-3); padding: 4px 0; }
.jdp-grid button { height: 34px; border: 0; background: none; border-radius: 8px; font-size: 13px; }
.jdp-grid button:hover { background: var(--surface-3); }
.jdp-grid button.today { box-shadow: inset 0 0 0 1px var(--primary); }
.jdp-grid button.sel { background: var(--primary); color: var(--primary-on); }
.jdp-grid button.fri { color: var(--bad); }
.jdp-foot { display: flex; justify-content: space-between; margin-top: 6px; }

/* scenario drawer */
.scen-list { display: grid; gap: 8px; }
.scen { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); color: inherit; text-decoration: none !important; transition: border-color var(--dur), background var(--dur); }
.scen:hover { border-color: var(--primary); background: var(--primary-soft); }
.scen .n { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.scen b { display: block; font-size: 13.5px; }
.scen small { color: var(--text-3); font-size: 12.5px; }

/* print */
@media print {
  .demo-bar, .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* programmatic focus targets (route change) should not show a ring */
[tabindex="-1"]:focus { outline: none; }
.g-side-wide { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 1200px) { .g-side-wide { grid-template-columns: minmax(0, 1fr); } }
.filters-toggle { display: none; margin: 12px 16px 0; width: calc(100% - 32px); }
@media (max-width: 760px) {
  .filters-toggle { display: flex; }
  .filters.collapsed { display: none; }
}
@media (max-width: 1200px) { .actions-first > aside { order: -1; } }

/* ------------------------------------------------- loan process builder */
.form-jump { position: sticky; top: -18px; z-index: 2; display: flex; gap: 4px; overflow-x: auto; margin: -4px 0 14px; padding: 6px 0; background: var(--surface); scrollbar-width: none; }
.form-jump a { flex: none; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; background: var(--surface-3); }
.form-jump a:hover { color: var(--primary); background: var(--primary-soft); }
.fieldset-box[id] { scroll-margin-top: 48px; }
.flow-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.flow-tools .select { flex: 1; min-width: 0; }
.flow-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.flow-step { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); position: relative; transition: border-color var(--dur), box-shadow var(--dur); }
.flow-step:focus-within { border-color: var(--primary); }
.flow-step.fixed { background: var(--surface-2); }
.flow-step.dragging { opacity: .45; }
.flow-step.drop-before { box-shadow: 0 -3px 0 var(--primary); }
.flow-step.drop-after { box-shadow: 0 3px 0 var(--primary); }
.fs-handle { color: var(--text-3); display: grid; place-items: center; width: 22px; height: 36px; }
.fs-handle[data-handle] { cursor: grab; }
.fs-handle[data-handle]:hover { color: var(--text); }
.fs-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--text-2); }
.fs-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.fs-main { display: grid; gap: 6px; min-width: 0; }
.fs-label { font-weight: 600; }
.fs-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.fs-meta .select { width: auto; min-width: 150px; height: 34px; font-size: 13px; }
.fs-sla { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.fs-sla .input { width: 56px; height: 34px; text-align: center; padding: 0 6px; }
.fs-act { display: flex; gap: 2px; align-self: start; }
.fs-act .icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.flow-step.open [data-more] { background: var(--primary-soft); color: var(--primary); }
.fs-detail { grid-column: 1 / -1; border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 2px; }
.fs-detail[hidden] { display: none; }
.stack-sm { display: grid; gap: 8px; }
.stack-sm .callout { align-items: center; }
.flow-preview { margin-top: 14px; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.flow-preview .who { white-space: nowrap; }
.flow-mini { all: unset; cursor: pointer; display: grid; gap: 5px; font-size: 12.5px; padding: 4px 6px; margin: -4px -6px; border-radius: var(--r-sm); }
.flow-mini:hover { background: var(--surface-3); }
.flow-mini:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.flow-mini .mini-steps i { width: 8px; height: 5px; }
.mini-steps i.tone-info { background: var(--info); }
.mini-steps i.tone-warn { background: var(--warn); }
.mini-steps i.tone-bank { background: var(--bank); }
.mini-steps i.tone-pri { background: var(--primary); }
.mini-steps i.tone-neu { background: var(--text-3); }
#lf-col-opts[hidden], [data-col-show][hidden], #lf-col-none[hidden] { display: none; }
#lf-col-none { margin-top: 12px; }
@media (max-width: 680px) {
  .flow-tools { grid-template-columns: minmax(0, 1fr); }
  .flow-step { grid-template-columns: auto auto minmax(0, 1fr); }
  .fs-ic { display: none; }
  .fs-act { grid-column: 1 / -1; justify-content: flex-end; }
  .fs-meta .select { min-width: 0; flex: 1; }
}
