@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/vazirmatn-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/vazirmatn-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/vazirmatn-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/vazirmatn-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/vazirmatn-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/vazirmatn-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/vazirmatn-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/vazirmatn-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/vazirmatn-arabic-800-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/vazirmatn-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* Layout: graphite sidebar (right, RTL) + white page header bar + content on a cool-grey ground.
   One accent: Absun crimson for actions; Absun indigo for identifiers; the logo gradient only as the active-nav marker. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #fafbfc; --fg: #101828; --fg-2: #344054; --muted: #667085; --faint: #98a2b3;
  --line: #e4e7ec; --line-2: #f0f2f5; --head: #f9fafb; --hover: #f9fafb; --sel: #f2f4f7;
  --primary: #6c5ce7; --primary-hover: #5a4ad6; --primary-fg: #ffffff; --primary-soft: #f1effd; --ring: rgba(108, 92, 231, .2);
  --brand: #3c335f;
  --ok: #067647; --ok-soft: #ecfdf3; --ok-line: #abefc6;
  --bad: #b42318; --bad-soft: #fef3f2; --bad-line: #fecdca;
  --wait: #b54708; --wait-soft: #fffaeb; --wait-line: #fedf89;
  --side-bg: #ffffff; --side-fg: #101828; --side-muted: #667085; --side-line: #e4e7ec; --side-hover: #f5f6f8; --side-act: #f2f4f7; --avatar: #eaecf0;
  --mark: #fde7a9; --shade: rgba(16, 24, 40, .45);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05); --shadow-lg: 0 20px 48px -12px rgba(16, 24, 40, .25);
  --logo: linear-gradient(180deg, #fcb040, #d81e46 55%, #8b2b5c);
  --font: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; --r: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0c0e14; --surface: #151821; --surface-2: #181b25; --fg: #f2f4f7; --fg-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
  --line: #262a36; --line-2: #1e222c; --head: #181b25; --hover: #1b1f2a; --sel: #1f2430;
  --primary: #8f80ff; --primary-hover: #a397ff; --primary-fg: #ffffff; --primary-soft: #231f3d; --ring: rgba(143, 128, 255, .3);
  --brand: #b9b0e6;
  --ok: #47cd89; --ok-soft: #0f2a1d; --ok-line: #1e5a3c; --bad: #f97066; --bad-soft: #2d1513; --bad-line: #5e2620; --wait: #fdb022; --wait-soft: #2b2010; --wait-line: #5a4314;
  --side-bg: #11131a; --side-fg: #f2f4f7; --side-muted: #98a2b3; --side-line: rgba(255, 255, 255, .07); --side-hover: rgba(255, 255, 255, .05); --side-act: rgba(255, 255, 255, .09); --avatar: #2a2e3b; --mark: #6b4e14; --shade: rgba(0, 0, 0, .6); --shadow-sm: none; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0c0e14; --surface: #151821; --surface-2: #181b25; --fg: #f2f4f7; --fg-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
  --line: #262a36; --line-2: #1e222c; --head: #181b25; --hover: #1b1f2a; --sel: #1f2430;
  --primary: #8f80ff; --primary-hover: #a397ff; --primary-fg: #ffffff; --primary-soft: #231f3d; --ring: rgba(143, 128, 255, .3);
  --brand: #b9b0e6;
  --ok: #47cd89; --ok-soft: #0f2a1d; --ok-line: #1e5a3c; --bad: #f97066; --bad-soft: #2d1513; --bad-line: #5e2620; --wait: #fdb022; --wait-soft: #2b2010; --wait-line: #5a4314;
  --side-bg: #11131a; --side-fg: #f2f4f7; --side-muted: #98a2b3; --side-line: rgba(255, 255, 255, .07); --side-hover: rgba(255, 255, 255, .05); --side-act: rgba(255, 255, 255, .09); --avatar: #2a2e3b; --mark: #6b4e14; --shade: rgba(0, 0, 0, .6); --shadow-sm: none; color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html, body { height: 100%; }
html { direction: rtl; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 13.5px; line-height: 1.6; margin: 0; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tab { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
svg.i { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--side-bg); }

/* ================= shell ================= */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side-bg); color: var(--side-fg); border-left: 1px solid var(--side-line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding-right: env(safe-area-inset-right, 0px); }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; border-bottom: 1px solid var(--side-line); }
.side-brand img { width: 32px; height: auto; }
.side-brand b { display: block; font-size: .95rem; font-weight: 700; line-height: 1.35; }
.side-brand small { display: block; font-size: .72rem; color: var(--side-muted); }
.side nav { display: grid; gap: 1px; padding: 10px 12px; overflow-y: auto; }
.side .navlbl { font-size: .68rem; color: var(--side-muted); padding: 14px 10px 6px; font-weight: 500; opacity: .75; }
.side nav a { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px; color: var(--side-muted); text-decoration: none; font-weight: 500; font-size: .86rem; }
.side nav a:hover { background: var(--side-hover); color: var(--side-fg); }
.side nav a[aria-current="page"] { background: var(--side-act); color: var(--side-fg); }
.side nav a[aria-current="page"]::before { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; background: var(--logo); border-radius: 3px 0 0 3px; }
.side nav a .cnt { margin-inline-start: auto; font-size: .72rem; color: var(--side-muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--side-line); }
.user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--avatar); color: var(--side-fg); font-size: .8rem; font-weight: 700; flex: none; }
.user b { display: block; font-size: .8rem; font-weight: 600; }
.user select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--side-muted); font-size: .72rem; padding: 0; cursor: pointer; }
.user select option { color: #101828; background: #fff; }
.side-foot small { display: block; padding: 8px 8px 0; font-size: .68rem; color: var(--side-muted); opacity: .7; line-height: 1.5; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: env(safe-area-inset-top, 0px); height: auto; z-index: 20; flex-direction: row; align-items: center; flex-wrap: wrap; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .side-brand { padding: 10px 8px; border: 0; }
  .side .navlbl, .side-brand small, .side-foot small, .user b { display: none; }
  .side nav { display: flex; overflow-x: auto; padding: 4px 0 8px; width: 100%; gap: 2px; order: 3; }
  .side nav a { white-space: nowrap; height: 32px; }
  .side nav a[aria-current="page"]::before { right: 8px; left: 8px; top: auto; bottom: -4px; width: auto; height: 2px; border-radius: 2px; }
  .side-foot { margin: 0 auto 0 0; border: 0; padding: 4px; }
}

/* page header bar + content */
.main { min-width: 0; }
.main > section { padding: 0 24px 32px; padding-left: max(24px, env(safe-area-inset-left, 0px)); }
.phdr { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 -24px 20px; margin-left: calc(-1 * max(24px, env(safe-area-inset-left, 0px))); padding: 16px 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 72px; }
.phdr h1 { margin: 0; font-size: 1.15rem; font-weight: 700; text-wrap: balance; }
.phdr p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.phdr .acts { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 900px) { .main > section { padding: 0 16px 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); } .phdr { margin: 0 -16px 16px; padding: 14px 16px; } }

/* ================= buttons ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); color: var(--fg-2); font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #d0d5dd; color: var(--fg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: .78rem; }
.btn.danger { color: var(--bad); }
.btn.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.iconbar { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); }
.iconbar button { width: 34px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.iconbar button + button { border-right: 1px solid var(--line); }
.iconbar button:hover { color: var(--fg); background: var(--hover); }
.iconbar button:first-child { border-radius: 0 7px 7px 0; } .iconbar button:last-child { border-radius: 7px 0 0 7px; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #101828; color: #fff; font-size: .72rem; font-weight: 500; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 50; pointer-events: none; }
.icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 6px; border: 0; background: transparent; color: var(--faint); cursor: pointer; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--sel); color: var(--fg); }
.icon-btn.del:hover { color: var(--bad); background: var(--bad-soft); }
.icon-btn.armed { color: #fff; background: var(--bad); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }

/* ================= toolbar ================= */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search input { width: 100%; height: 34px; padding: 0 34px 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); font-size: .84rem; }
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.search svg { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--sel); color: var(--fg-2); font-size: .78rem; border: 1px solid var(--line); cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--faint); }
.chip svg { width: 13px; height: 13px; }

/* ================= grid ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.grid-wrap { overflow: hidden; }
.grid-scroll { overflow: auto; max-height: calc(100dvh - 232px); min-height: 280px; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; width: max-content; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line-2); padding: 0 10px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid thead th { position: sticky; z-index: 2; background: var(--head); color: var(--muted); font-weight: 600; font-size: 12px; border-bottom-color: var(--line); border-left: 1px solid var(--line-2); }
.grid thead tr.h1 th { top: 0; height: 38px; }
.grid thead tr.h2 th { top: 38px; height: 28px; font-weight: 500; }
.grid thead tr.hf th { top: 66px; height: 40px; background: var(--surface); padding: 5px; }
.grid thead th.grp { text-align: center; color: var(--fg-2); }
.hcell { display: flex; align-items: center; gap: 4px; }
.hcell .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--fg-2); }
.hcell .menu-btn { width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--faint); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.grid th:hover .menu-btn, .menu-btn:focus-visible, .menu-btn[aria-expanded="true"], th.sorted .menu-btn, th.filtered .menu-btn { opacity: 1; }
@media (hover: none) { .hcell .menu-btn { opacity: 1; } }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: var(--line); color: var(--fg); }
th.sorted .lbl, th.filtered .lbl { color: var(--primary); }
th.filtered .lbl::after { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); margin-inline-start: 5px; vertical-align: middle; }
.sort-ind { color: var(--primary); display: grid; }
.sort-ind svg { width: 14px; height: 14px; }
.fcell { display: flex; align-items: center; gap: 3px; }
.fcell input, .fcell select { width: 100%; min-width: 0; height: 29px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12.5px; color: var(--fg); }
.fcell select { color: var(--muted); }
.fcell input:focus, .fcell select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--ring); }
.fcell .op { width: 26px; height: 29px; flex: none; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--faint); cursor: pointer; display: grid; place-items: center; }
.fcell .op:hover { color: var(--fg); }
.fcell .op.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.fcell .op svg { width: 13px; height: 13px; }
.grid tbody td { height: 42px; color: var(--fg); }
.grid tbody tr:hover td { background: var(--hover); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .c-idx { position: sticky; right: 0; z-index: 1; background: var(--surface); text-align: center; color: var(--faint); font-size: 12px; border-left: 1px solid var(--line-2); }
.grid thead .c-idx { z-index: 3; background: var(--head); }
.grid thead tr.hf .c-idx { background: var(--surface); }
.grid .c-act { position: sticky; left: 0; z-index: 1; background: var(--surface); border-right: 1px solid var(--line-2); padding: 0 4px; }
.grid thead .c-act { z-index: 3; background: var(--head); border-left: 0; }
.grid thead tr.hf .c-act { background: var(--surface); }
.grid tbody tr:hover .c-idx, .grid tbody tr:hover .c-act { background: var(--hover); }
.arch-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin-inline-start: 4px; vertical-align: middle; }
.row-actions { display: flex; gap: 2px; justify-content: center; }
.empty-row td { height: 200px !important; text-align: center !important; color: var(--muted); background: var(--surface) !important; white-space: normal !important; }
.grid-foot { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 2px; }
.pager button { min-width: 30px; height: 30px; border: 1px solid transparent; background: transparent; border-radius: 6px; cursor: pointer; padding: 0 8px; color: var(--muted); font-weight: 500; }
.pager button:hover:not(:disabled) { background: var(--sel); color: var(--fg); }
.pager button[aria-current="true"] { background: var(--sel); color: var(--fg); border-color: var(--line); font-weight: 700; }
.pager button:disabled { opacity: .35; cursor: default; }
.grid-foot select { height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); margin-inline-start: 6px; }

/* ================= status badges ================= */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 0 9px; height: 22px; border-radius: 999px; background: var(--sel); color: var(--fg-2); border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.pill.wait { background: var(--wait-soft); color: var(--wait); border-color: var(--wait-line); }
.pill.plain { font-weight: 500; color: var(--muted); }
.pill.plain::before { display: none; }

/* ================= popovers ================= */
.pop { position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; font-size: .84rem; }
.pop .mi { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: right; color: var(--fg-2); font-weight: 500; }
.pop .mi svg { color: var(--faint); }
.pop .mi:hover, .pop .mi.open { background: var(--sel); color: var(--fg); }
.pop .mi .chev { margin-inline-start: auto; }
.pop .mi.active { color: var(--primary); }
.pop .mi.active svg { color: var(--primary); }
.pop .mi.danger, .pop .mi.danger svg { color: var(--bad); }
.pop .mi.danger.armed { background: var(--bad); color: #fff; } .pop .mi.danger.armed svg { color: #fff; }
.pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 2px; }
.pop.sub { width: 260px; padding: 8px; }
.pop .vsearch { position: relative; margin-bottom: 6px; }
.pop .vsearch input { width: 100%; height: 34px; padding: 0 32px 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.pop .vsearch input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.pop .vsearch svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.vlist { max-height: 230px; overflow: auto; display: grid; gap: 1px; margin: 4px 0 8px; }
.vlist label, .pop .allrow { display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 0 8px; border-radius: 6px; cursor: pointer; color: var(--fg-2); }
.vlist label:hover { background: var(--sel); }
.vlist .cnt { margin-inline-start: auto; color: var(--faint); font-size: .74rem; }
.pop .row { display: flex; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.pop .row .btn { flex: 1; }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }
.pop.range { width: 340px; padding: 14px; display: grid; gap: 12px; }
.dsel { display: grid; grid-template-columns: 64px 1fr 78px; gap: 6px; }
.dsel select, .ctl > select { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); min-width: 0; width: 100%; }
.dsel select:focus, .ctl > select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .75rem; cursor: pointer; color: var(--fg-2); font-weight: 500; }
.presets button:hover { border-color: var(--primary); color: var(--primary); }

/* ================= dialogs ================= */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--fg); }
dialog::backdrop { background: var(--shade); }
dialog.drawer { margin: auto; width: min(1080px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 48px); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.drawer .dlg { max-height: calc(100dvh - 48px); }
dialog.drawer[open], dialog.modal[open] { animation: rise .16s ease-out; }
dialog[open]::backdrop { animation: fade .16s ease-out; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog[open], dialog[open]::backdrop { animation: none; } }
@media (min-width: 1100px) { dialog.drawer .fgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { dialog.drawer { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; } dialog.drawer .dlg { max-height: 100dvh; height: 100%; } }
.dlg { display: flex; flex-direction: column; height: 100%; }
.dlg-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 1rem; font-weight: 700; flex: 1; }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 28px; display: grid; gap: 24px; align-content: start; }
.dlg-foot { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 24px max(14px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface-2); }
.dlg-foot .msg { color: var(--bad); font-size: .8rem; flex-basis: 100%; }
.sec { display: grid; gap: 12px; }
.sec h3 { margin: 0; font-size: .78rem; font-weight: 700; color: var(--fg-2); }
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line-2); }
.sec:last-of-type .fgrid { border-bottom: 0; padding-bottom: 0; }
@media (max-width: 680px) { .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 440px) { .fgrid { grid-template-columns: minmax(0, 1fr); } }
.fld { display: grid; gap: 5px; min-width: 0; align-content: start; }
.fld > span { font-size: .76rem; color: var(--fg-2); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.fld > span i { color: var(--primary); font-style: normal; }
.fld input, .fld select { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: .86rem; box-shadow: var(--shadow-sm); }
.fld input:focus, .fld select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.fld.err input, .fld.err select, .fld.err .msel { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.fld .hint { font-size: .7rem; color: var(--faint); }
.fld.locked input, .fld.locked select { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; opacity: 1; }
.fld.locked > span { color: var(--muted); }
.pair { display: grid; grid-template-columns: 1.5fr 1fr; gap: 6px; }
.timepair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; align-items: center; direction: ltr; }
.span2 { grid-column: span 2; }
@media (max-width: 440px) { .span2 { grid-column: auto; } }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2); font-size: .8rem; }
.banner svg { margin-top: 4px; color: var(--muted); }
.msel { width: 100%; min-height: 38px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; text-align: right; cursor: pointer; box-shadow: var(--shadow-sm); }
.msel:hover { border-color: #d0d5dd; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--sel); border: 1px solid var(--line); color: var(--fg-2); font-size: .76rem; font-weight: 500; }

dialog.modal { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 12px; box-shadow: var(--shadow-lg); }
@media (max-width: 560px) { dialog.modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; } }
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 28px 16px; text-align: center; display: grid; gap: 6px; justify-items: center; background: var(--surface-2); cursor: pointer; }
.drop:hover { border-color: var(--faint); }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.sheets { width: 100%; border-collapse: collapse; font-size: .84rem; }
.sheets th, .sheets td { padding: 9px 6px; border-bottom: 1px solid var(--line-2); text-align: right; }
.sheets th { color: var(--muted); font-weight: 500; font-size: .74rem; }
.sheets select { height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.note { font-size: .76rem; color: var(--muted); margin: 0; }
.loading { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 60%, transparent); display: grid; place-items: center; }
.loading div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 20px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-lg); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 12px)); left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: .82rem; z-index: 70; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); }

/* ================= projects ================= */
.proj { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .proj { grid-template-columns: minmax(0, 1fr); } }
.plist { overflow: hidden; position: sticky; top: 16px; }
@media (max-width: 1100px) { .plist { position: static; } }
.plist-head { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.plist-head .search { max-width: none; }
.seg { display: inline-flex; background: var(--sel); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-size: .78rem; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.plist-items { max-height: calc(100dvh - 280px); overflow: auto; }
@media (max-width: 1100px) { .plist-items { max-height: 320px; } }
.pitem { display: grid; gap: 3px; width: 100%; text-align: right; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; cursor: pointer; position: relative; }
.pitem:hover { background: var(--hover); }
.pitem[aria-current="true"] { background: var(--sel); }
.pitem[aria-current="true"]::before { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--logo); }
.pitem .t { display: flex; align-items: center; gap: 8px; }
.pitem .no { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pitem .sub { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; display: flex; margin-top: 6px; }
.prog i { display: block; height: 100%; }
.p-ok { background: #12b76a; } .p-bad { background: #f04438; } .p-wait { background: #fdb022; }
.pdetail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.phead { padding: 20px 22px; display: grid; gap: 14px; }
.phead .top { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.phead .big { font-size: 1.35rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.phead .emp { font-size: .95rem; font-weight: 600; color: var(--fg-2); }
.phead .top .acts { margin-inline-start: auto; display: flex; gap: 6px; }
.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 20px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line-2); }
.info div { min-width: 0; }
.info dt { font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
.info dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--line); }
.kpi { padding: 14px 22px; border-left: 1px solid var(--line-2); }
.kpi:last-child { border-left: 0; }
.kpi span { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); }
.kpi b { display: block; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.5; }
.kpi.ok span::before, .kpi.bad span::before, .kpi.wait span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.kpi.ok span::before { background: #12b76a; } .kpi.bad span::before { background: #f04438; } .kpi.wait span::before { background: #fdb022; }
.tbl { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: var(--head); color: var(--muted); font-weight: 600; font-size: 12px; text-align: right; padding: 10px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--hover); }
.tbl .n { text-align: left; font-variant-numeric: tabular-nums; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sec-head h3 { margin: 0; font-size: .88rem; font-weight: 700; flex: 1; }
.blank { padding: 64px 20px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.blank b { color: var(--fg); font-size: .95rem; font-weight: 600; }

/* ================= reports ================= */
.rctl { padding: 16px 18px; display: grid; gap: 14px; }
.rrow { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.ctl { display: grid; gap: 5px; min-width: 0; }
.ctl > span { font-size: .74rem; color: var(--fg-2); font-weight: 500; }
.ctl > select { width: auto; min-width: 160px; }
.rtitle { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 2px 0; }
.rtitle h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .rgrid { grid-template-columns: minmax(0, 1fr); } }
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-2); min-width: 90px; }
.bar i { display: block; height: 100%; }
.rstack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

/* ================= list settings ================= */
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 16px; align-items: start; }
.setlist { display: grid; padding: 4px 10px; max-height: 420px; overflow: auto; }
.setrow { display: flex; align-items: center; gap: 8px; padding: 4px; border-bottom: 1px solid var(--line-2); }
.setrow:last-child { border-bottom: 0; }
.setrow .grip { width: 22px; text-align: center; color: var(--faint); font-size: .72rem; flex: none; }
.setin { flex: 1; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.setin:hover { border-color: var(--line); }
.setin:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }
.setrow select { height: 30px; max-width: 180px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: .74rem; color: var(--fg-2); }
.flag { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.setacts { display: flex; }
.setadd { display: flex; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 10px 10px; }
.setadd input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.setadd input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* ================= analytics ================= */
/* categorical slots (validated order) + status colours; each mode has its own steps */
:root { --c1: #ec8db5; --c2: #6fa3ec; --c3: #f4926c; --c4: #3fb6d3; --c5: #e57f7f; --c6: #9b87ec; --c7: #d9a334; --c-other: #c9cdd6;
  --st-ok: #4fbf86; --st-wait: #f2c46b; --st-bad: #ef8a8a; }
:root[data-theme="dark"] { --c-other: #4c5160; }
.actl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; padding: 14px 18px; margin-bottom: 16px; }
.actl .presets { margin-inline-start: auto; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dash > * { min-width: 0; }
.kpirow { grid-column: span 12; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpirow .kpi { border-left: 1px solid var(--line-2); }
.kpirow .kpi:last-child { border-left: 0; }
@media (max-width: 900px) { .kpirow { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpirow .kpi { border-bottom: 1px solid var(--line-2); } }
.panel { overflow: hidden; }
.w12 { grid-column: span 12; } .w7 { grid-column: span 7; } .w5 { grid-column: span 5; }
@media (max-width: 1100px) { .w7, .w5 { grid-column: span 12; } }
.ph { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 4px; }
.ph h3 { margin: 0; font-size: .86rem; font-weight: 700; color: var(--fg); }
.ph .muted { font-size: .74rem; }
.pb { padding: 8px 14px 10px; min-height: 120px; }
.pb svg text { font-family: var(--font); }
.pb .mk { transition: opacity .12s; cursor: default; }
.pb svg:hover .mk { opacity: .55; } .pb svg .mk:hover { opacity: 1; }
.pf { padding: 0 18px 14px; }
.lg { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .74rem; color: var(--fg-2); }
.lg span { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 6px 0; min-width: 0; }
.donut-wrap svg { flex: none; }
.dl { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; flex: 1 1 200px; max-width: 100%; font-size: .8rem; }
.dl li { display: flex; align-items: center; gap: 8px; }
.dl i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dl span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.dl b { font-weight: 700; }
.dl em { font-style: normal; color: var(--faint); min-width: 26px; text-align: left; }
.vtip { position: fixed; z-index: 80; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 7px 10px; display: grid; gap: 1px; font-size: .76rem; color: var(--muted); max-width: 260px; }
.vtip b { color: var(--fg); font-size: .86rem; }
.themebtn { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; margin-top: 8px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--side-line); background: transparent; color: var(--side-muted); font-size: .78rem; font-weight: 500; cursor: pointer; }
.themebtn:hover { background: var(--side-hover); color: var(--side-fg); }
.themebtn .ti-sun { display: none; }
:root[data-theme="dark"] .themebtn .ti-sun { display: inline-flex; } :root[data-theme="dark"] .themebtn .ti-moon { display: none; }
.themebtn span { display: inline-flex; }
@media (max-width: 900px) { .side-foot { display: flex; align-items: center; gap: 6px; } .themebtn { width: auto; margin: 0; } #themeLbl { display: none; } }


/* =====================================================================
   افزوده‌های نسخه‌ی کامل
   ===================================================================== */
:root {
  --zebra: #fffbe3; --row-hover: #f3efff; --opt-hover: #efeafd; --opt-on: #e6defc;
  --g1: #fff3c4; --g1-line: #ecd27a; --g2: #e2eeff; --g2-line: #a8c6f2; --g3: #ece6fd; --g3-line: #c3b4f3;
  --g4: #ffe6d8; --g4-line: #f3bb99; --g5: #fde3ee; --g5-line: #efb0cc; --g6: #d9f3f2; --g6-line: #95d6d2;
  --col-line: #e7e9ef;
}
:root[data-theme="dark"] {
  --zebra: #22262f; --row-hover: #2b2840; --opt-hover: #2d2847; --opt-on: #38305a;
  --g1: rgba(252, 211, 77, .13); --g1-line: rgba(252, 211, 77, .45); --g2: rgba(96, 165, 250, .14); --g2-line: rgba(96, 165, 250, .45);
  --g3: rgba(167, 139, 250, .15); --g3-line: rgba(167, 139, 250, .5); --g4: rgba(251, 146, 60, .14); --g4-line: rgba(251, 146, 60, .45);
  --g5: rgba(244, 114, 182, .14); --g5-line: rgba(244, 114, 182, .45); --g6: rgba(45, 212, 191, .13); --g6-line: rgba(45, 212, 191, .45);
  --col-line: #2c313d;
}

/* ---------- جدول: رنگ گروه ستون‌ها، جداکننده‌ی ستون‌ها، سطرهای یکی‌درمیان ---------- */
.grid th, .grid td { border-left: 1px solid var(--col-line); }
.grid thead th.g1 { background: var(--g1); } .grid thead th.g2 { background: var(--g2); } .grid thead th.g3 { background: var(--g3); }
.grid thead th.g4 { background: var(--g4); } .grid thead th.g5 { background: var(--g5); } .grid thead th.g6 { background: var(--g6); }
.grid thead tr.h1 th.g1, .grid thead tr.h2 th.g1 { box-shadow: inset 0 -2px 0 var(--g1-line); }
.grid thead tr.h1 th.g2, .grid thead tr.h2 th.g2 { box-shadow: inset 0 -2px 0 var(--g2-line); }
.grid thead tr.h1 th.g3, .grid thead tr.h2 th.g3 { box-shadow: inset 0 -2px 0 var(--g3-line); }
.grid thead tr.h1 th.g4, .grid thead tr.h2 th.g4 { box-shadow: inset 0 -2px 0 var(--g4-line); }
.grid thead tr.h1 th.g5, .grid thead tr.h2 th.g5 { box-shadow: inset 0 -2px 0 var(--g5-line); }
.grid thead tr.h1 th.g6, .grid thead tr.h2 th.g6 { box-shadow: inset 0 -2px 0 var(--g6-line); }
.grid thead th.grp { color: var(--fg); font-weight: 700; }
.grid thead th .hcell .lbl { color: var(--fg); }
.grid th.gs, .grid td.gs { border-right: 2px solid var(--line); }
.grid tbody tr:nth-child(odd) td { background: var(--surface); }
.grid tbody tr:nth-child(even) td { background: var(--zebra); }
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr:nth-child(even) .c-idx, .grid tbody tr:nth-child(even) .c-act { background: var(--zebra); }
.grid tbody tr:hover .c-idx, .grid tbody tr:hover .c-act { background: var(--row-hover); }
.grid tbody td { border-bottom-color: var(--col-line); }

/* ---------- فهرست کشویی سفارشی ---------- */
.cs-native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; overflow: hidden; }
.cs { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; height: 38px; padding: 0 11px 0 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--fg); font-size: .86rem; text-align: right; cursor: pointer; box-shadow: var(--shadow-sm); }
.cs:hover:not(:disabled) { border-color: #c9c2ef; }
.cs.open, .cs:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.cs:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.cs .cs-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs.ph .cs-v { color: var(--faint); }
.cs-chev { width: 15px; height: 15px; flex: none; color: var(--faint); transition: transform .15s; }
.cs.open .cs-chev { transform: rotate(180deg); }
.fcell .cs { height: 29px; font-size: 12.5px; border-radius: 6px; box-shadow: none; padding: 0 8px 0 5px; }
.dsel .cs, .ctl > .cs, .rrow .cs { height: 34px; }
.ctl > .cs { width: auto; min-width: 160px; }
.grid-foot .cs { height: 30px; width: auto; min-width: 70px; display: inline-flex; margin-inline-start: 6px; }
.sheets .cs, .setrow .cs { height: 30px; font-size: .76rem; max-width: 190px; }
.timepair .cs { direction: ltr; justify-content: center; }
.fld.err .cs { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.fld.locked .cs { background: var(--surface-2); color: var(--muted); }
.cs-list { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; max-height: min(320px, 60vh); display: flex; flex-direction: column; outline: none; max-width: min(420px, calc(100vw - 16px)); }
.cs-search { padding: 2px 2px 6px; }
.cs-search input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--fg); }
.cs-search input:focus { outline: none; border-color: var(--primary); }
.cs-items { overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 1px; }
.cs-opt { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px; border-radius: 7px; cursor: pointer; color: var(--fg); font-size: .86rem; }
.cs-opt span { overflow-wrap: anywhere; }
.cs-opt.act { background: var(--opt-hover); color: var(--fg); }
.cs-opt.on { font-weight: 600; }
.cs-opt.on.act, .cs-opt.on { background: var(--opt-on); }
.cs-opt.ph { color: var(--muted); }
.cs-opt.dis { opacity: .4; cursor: default; }
.cs-ok { width: 15px; height: 15px; flex: none; color: var(--primary); visibility: hidden; }
.cs-opt.on .cs-ok { visibility: visible; }

/* ---------- تقویم شمسی ---------- */
.dpbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; font-size: .84rem; white-space: nowrap; box-shadow: var(--shadow-sm); font-variant-numeric: tabular-nums; }
.dpbtn svg { color: var(--primary); }
.dpbtn:hover:not(:disabled) { border-color: #c9c2ef; }
.dpbtn[aria-expanded="true"], .dpbtn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.dpbtn.wide { width: 100%; height: 38px; justify-content: flex-start; }
.dpbtn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.dpbtn:disabled svg { color: var(--faint); }
.fld.err .dpbtn { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dsel { display: block; }
.dp { position: fixed; z-index: 95; width: 286px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  background: linear-gradient(160deg, #fff8fb 0%, #ffffff 35%, #f7f4ff 100%); color: var(--fg); }
:root[data-theme="dark"] .dp { background: linear-gradient(160deg, #241d2b 0%, #1a1d27 40%, #1f1c30 100%); }
.dp button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dp-nav { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--muted) !important; }
.dp-nav svg { width: 16px; height: 16px; }
.dp-nav:hover { background: var(--opt-hover) !important; color: var(--fg) !important; }
.dp-title { flex: 1; height: 32px; border: 1px solid var(--line) !important; border-radius: 9px; background: var(--surface) !important; font-weight: 600; font-size: .88rem; font-variant-numeric: tabular-nums; }
.dp-title:hover { border-color: var(--primary) !important; }
.dp-wd, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.dp-wd span { font-size: .72rem; color: var(--faint); padding: 2px 0 6px; font-weight: 600; }
.dp-wd .fri { color: #e0607e; }
.dp-d { height: 34px; border-radius: 9px; font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid transparent !important; }
.dp-d:hover { background: var(--opt-hover) !important; }
.dp-d.fri { color: #e0607e !important; }
.dp-d.today { border-color: #f2a7c3 !important; }
.dp-d.on { background: #fbd5e3 !important; border-color: #ef8fb3 !important; color: #8a1f48 !important; }
:root[data-theme="dark"] .dp-d.on { background: rgba(244, 114, 182, .28) !important; color: #ffd3e4 !important; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-m { height: 38px; border-radius: 9px; font-size: .84rem; border: 1px solid var(--line) !important; background: var(--surface) !important; }
.dp-m:hover { background: var(--opt-hover) !important; }
.dp-m.today { border-color: #f2a7c3 !important; }
.dp-m.on { background: #fbd5e3 !important; border-color: #ef8fb3 !important; color: #8a1f48 !important; font-weight: 600; }
:root[data-theme="dark"] .dp-m.on { background: rgba(244, 114, 182, .28) !important; color: #ffd3e4 !important; }
.dp-foot { display: flex; justify-content: center; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.dp-foot button { height: 28px; padding: 0 12px; border-radius: 7px; font-size: .78rem; color: var(--muted) !important; }
.dp-foot button:hover { background: var(--opt-hover) !important; color: var(--fg) !important; }

/* ---------- کاربر در نوار کناری ---------- */
.user { width: 100%; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: right; }
.user:hover, .user[aria-expanded="true"] { background: var(--side-hover); }
.u-txt { flex: 1; min-width: 0; display: grid; }
.u-txt b { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-txt small { font-size: .72rem; color: var(--side-muted); }
.u-chev { color: var(--side-muted); display: grid; }
.usermenu { min-width: 230px; }
.um-head { display: grid; gap: 1px; padding: 8px 10px 4px; }
.um-head b { font-size: .88rem; }
.um-head span { font-size: .74rem; color: var(--muted); direction: rtl; }
@media (max-width: 900px) { .u-txt, .u-chev { display: none; } .user { width: auto; padding: 4px; } }

/* ---------- صفحه‌ی ورود ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); position: relative; overflow: hidden; background: #f7f5fb; }
:root[data-theme="dark"] .login { background: #12111a; }
.lg-bg i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.lg-bg i:nth-child(1) { width: 420px; height: 420px; background: #fcd39b; top: -120px; right: -80px; }
.lg-bg i:nth-child(2) { width: 380px; height: 380px; background: #f7b5cd; bottom: -140px; left: -60px; }
.lg-bg i:nth-child(3) { width: 300px; height: 300px; background: #c9bdf7; top: 40%; left: 55%; }
:root[data-theme="dark"] .lg-bg i { opacity: .22; }
.lg-card { position: relative; width: min(400px, 100%); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 32px 28px 24px; display: grid; gap: 14px; }
.lg-logo { width: 72px; height: auto; justify-self: center; }
.lg-card h1 { margin: 0; text-align: center; font-size: 1.3rem; font-weight: 800; }
.lg-sub { margin: -8px 0 6px; text-align: center; color: var(--muted); font-size: .82rem; }
.lg-fld { display: grid; gap: 6px; }
.lg-fld > span:first-child { font-size: .8rem; font-weight: 600; color: var(--fg-2); }
.lg-in { position: relative; display: flex; align-items: center; }
.lg-in > svg { position: absolute; right: 12px; color: var(--faint); pointer-events: none; }
.lg-in input { width: 100%; height: 44px; padding: 0 40px 0 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); font-size: .95rem; text-align: right; }
.lg-in input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.lg-eye { position: absolute; left: 6px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--faint); border-radius: 8px; cursor: pointer; }
.lg-eye:hover, .lg-eye[aria-pressed="true"] { color: var(--primary); background: var(--opt-hover); }
.lg-msg { margin: 0; padding: 9px 12px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-size: .82rem; border: 1px solid var(--bad-line); }
.lg-btn { height: 44px; font-size: .95rem; margin-top: 4px; }
.lg-note { margin: 2px 0 0; text-align: center; color: var(--faint); font-size: .74rem; }
#app[hidden], #login[hidden] { display: none !important; }
