  :root {
    --radius: 0.65rem;
    --background: #ffffff;        --foreground: #0a0a0a;
    --card-bg: #ffffff;           --card-foreground: #0a0a0a;
    --popover: #ffffff;           --popover-foreground: #0a0a0a;
    --primary: #2563eb;           --primary-foreground: #f8fafc;
    --secondary: #f4f4f5;         --secondary-foreground: #171717;
    --muted-surface: #f4f4f5;     --muted-foreground: #71717a;
    --accent: #eff4ff;            --accent-foreground: #1d4ed8;
    --ring: #2563eb;
    --border-c: #e4e4e7;          --input-c: #e4e4e7;
    --danger: #dc2626;            --ok: #16a34a;            --warn: #d97706;
    --success-bg: #f0fdf4;  --success-fg: #15803d;  --success-bd: #bbf7d0;
    --warn-bg:    #fffbeb;  --warn-fg:    #b45309;  --warn-bd:    #fde68a;
    --danger-bg:  #fef2f2;  --danger-fg2: #b91c1c;  --danger-bd:  #fecaca;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
    --shadow:    0 1px 3px 0 rgba(0,0,0,.07), 0 1px 2px -1px rgba(0,0,0,.07);
    --shadow-lg: 0 12px 32px -10px rgba(0,0,0,.28);
    /* legacy aliases used throughout the markup */
    --bg: var(--background);      --fg: var(--foreground);
    --muted: var(--muted-foreground);   --link: #2563eb;
    --btn: var(--primary);        --btn-fg: var(--primary-foreground);
    --card: var(--card-bg);       --border: var(--border-c);
  }
  html.dark {
    --background: #0a0a0a;        --foreground: #fafafa;
    --card-bg: #161618;           --card-foreground: #fafafa;
    --popover: #1c1c1f;           --popover-foreground: #fafafa;
    --primary: #3b82f6;           --primary-foreground: #f8fafc;
    --secondary: #27272a;         --secondary-foreground: #fafafa;
    --muted-surface: #1f1f22;     --muted-foreground: #a1a1aa;
    --accent: #1e293b;            --accent-foreground: #bfdbfe;
    --ring: #3b82f6;
    --border-c: rgba(255,255,255,.10);  --input-c: rgba(255,255,255,.14);
    --danger: #ef4444;            --ok: #22c55e;            --warn: #f59e0b;
    --link: #60a5fa;
    --success-bg: rgba(34,197,94,.13);  --success-fg: #4ade80;  --success-bd: rgba(34,197,94,.30);
    --warn-bg:    rgba(245,158,11,.13); --warn-fg:    #fbbf24;  --warn-bd:    rgba(245,158,11,.30);
    --danger-bg:  rgba(239,68,68,.13);  --danger-fg2: #f87171;  --danger-bd:  rgba(239,68,68,.30);
    --shadow-lg: 0 12px 32px -10px rgba(0,0,0,.6);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Vazirmatn", "IRANSans", "Tahoma", sans-serif;
    font-size: 15px; line-height: 1.6; }
  .wrap { max-width: 680px; margin: 0 auto; padding: 12px; padding-bottom: 90px; }
  h1 { font-size: 17px; margin: 4px 0 10px; }
  h2 { font-size: 15px; margin: 16px 0 8px; }
  .tabbar { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px;
    -webkit-overflow-scrolling: touch; position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .tab { white-space: nowrap; padding: 7px 13px; border-radius: 999px; cursor: pointer;
    background: var(--card); border: 1px solid var(--border); color: var(--fg); font-size: 14px; }
  .tab.active { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
  .card { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    padding: 13px; margin-bottom: 10px; }
  .drop { border: 2px dashed var(--border); border-radius: 14px; padding: 24px 14px;
    text-align: center; background: var(--card); cursor: pointer; }
  .drop.drag { border-color: var(--btn); }
  .drop .big { font-size: 32px; }
  input[type=file] { display: none; }
  button { background: var(--btn); color: var(--btn-fg); border: 0; border-radius: 10px;
    padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
  button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
  button.danger { background: var(--danger); }
  button.ok { background: var(--ok); }
  button.warn { background: var(--warn); }
  button.sm { padding: 6px 10px; font-size: 13px; }
  button:disabled { opacity: .5; cursor: not-allowed; }
  .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .pill { display: inline-block; padding: 1px 8px; border-radius: 999px;
    background: rgba(0,0,0,0.06); color: var(--muted); font-size: 12px; }
  .pill.red { background: #fde2e0; color: #b3261e; }
  .pill.green { background: #def3e4; color: #1c7c3f; }
  .pill.amber { background: #fdebc8; color: #8a5a00; }
  .pill.blue { background: #dce9fd; color: #1a4fa0; }
  .pill.gray { background: rgba(0,0,0,0.06); color: var(--muted); }
  .item { padding: 11px 0; border-bottom: 1px solid var(--border); }
  .item:last-child { border-bottom: 0; }
  .item .title { font-weight: 600; }
  .item .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
  input.f, textarea.f, select.f { width: 100%; border: 1px solid var(--border); border-radius: 9px;
    padding: 9px 10px; background: var(--bg); color: var(--fg); font: inherit; margin-top: 6px; }
  textarea.f { resize: vertical; min-height: 56px; }
  .progress { height: 4px; background: rgba(0,0,0,0.08); border-radius: 999px; overflow: hidden; margin-top: 12px; }
  .progress > div { height: 100%; background: var(--btn); width: 0%; transition: width .15s; }
  .progress.indeterminate { background: linear-gradient(90deg, rgba(0,0,0,0.06) 0%, var(--btn) 50%, rgba(0,0,0,0.06) 100%);
    background-size: 200% 100%; animation: indet 1.2s linear infinite; }
  .progress.indeterminate > div { display: none; }
  @keyframes indet { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
  /* نوارِ پیشرفتِ ضمیمهٔ چت روی حبابِ رنگیِ کاربر: رنگِ پیش‌فرضِ نوار (accent) روی حبابِ
     accent نامرئی می‌شود؛ پس فِیل/شِمِر را به رنگِ متنِ حباب (روشن) می‌بریم. */
  .bubble.user .progress { background: rgba(255,255,255,.28); margin-top: 8px; }
  .bubble.user .progress > div { background: var(--primary-foreground); }
  .bubble.user .progress.indeterminate {
    background: linear-gradient(90deg, rgba(255,255,255,.18) 0%, var(--primary-foreground) 50%, rgba(255,255,255,.18) 100%);
    background-size: 200% 100%;
  }
  .bubble.user .attach-prog-cancel { color: var(--primary-foreground); border-color: rgba(255,255,255,.4); }
  .muted { color: var(--muted); font-size: 13px; }
  .err { color: var(--danger); }
  .ok-t { color: var(--ok); }
  .hidden { display: none !important; }
  pre.transcript { background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px; max-height: 180px; overflow: auto; font-family: inherit; white-space: pre-wrap;
    font-size: 13px; color: var(--muted); }
  details > summary { cursor: pointer; color: var(--link); font-size: 13px; }
  /* چت */
  .chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; padding: 4px; }
  .bubble { max-width: 84%; padding: 8px 11px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
  .bubble.user { align-self: flex-start; background: var(--btn); color: var(--btn-fg); border-bottom-right-radius: 4px; }
  .bubble.bot { align-self: flex-end; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
  /* رندرِ Markdownِ پاسخِ ربات */
  .bubble .md { white-space: normal; }
  .bubble .md > :first-child { margin-top: 0; }
  .bubble .md > :last-child { margin-bottom: 0; }
  .bubble .md p { margin: 6px 0; }
  .bubble .md h3 { font-size: 15px; font-weight: 700; margin: 10px 0 6px; }
  .bubble .md h4 { font-size: 14px; font-weight: 700; margin: 9px 0 5px; }
  .bubble .md h5 { font-size: 13px; font-weight: 700; margin: 8px 0 4px; }
  .bubble .md ul, .bubble .md ol { margin: 6px 0; padding-inline-start: 20px; }
  .bubble .md li { margin: 2px 0; }
  .bubble .md strong { font-weight: 700; }
  .bubble .md code { background: rgba(127,127,127,.18); padding: 1px 5px; border-radius: 5px;
    font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
  .bubble .md pre { background: rgba(127,127,127,.14); padding: 8px 10px; border-radius: 8px;
    overflow-x: auto; margin: 6px 0; }
  .bubble .md pre code { background: none; padding: 0; }
  .bubble .md blockquote { margin: 6px 0; padding: 2px 10px; border-inline-start: 3px solid var(--border); color: var(--muted); }
  .bubble .md a { color: var(--link); }
  .bubble .md hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
  .bubble .md table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
  .bubble .md th, .bubble .md td { border: 1px solid var(--border); padding: 3px 8px; }
  .chat-input { display: flex; gap: 6px; margin-top: 10px; }
  .chat-input textarea { flex: 1; min-height: 40px; max-height: 120px; }
  /* گانت */
  .gantt-row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
  .gantt-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gantt-track { position: relative; height: 16px; background: rgba(0,0,0,0.05); border-radius: 6px; }
  .gantt-bar { position: absolute; top: 2px; height: 12px; border-radius: 6px; background: var(--btn); }
  .gantt-bar.done { background: var(--ok); }
  .gantt-bar.over { background: var(--danger); }
  .toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    background: #111; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 50; max-width: 90%; }

  /* تقویمِ شمسی (date picker) */
  .jdp-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 16px; }
  .jdp-modal { background: var(--card, #fff); color: inherit; border-radius: 16px; padding: 14px;
    width: 320px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
  .jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .jdp-title { font-weight: 600; }
  .jdp-week, .jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .jdp-week > div { text-align: center; font-size: 11px; color: var(--muted-foreground, #888); padding: 4px 0; }
  .jdp-grid > button { aspect-ratio: 1; border: 0; background: transparent; color: inherit;
    border-radius: 8px; font-size: 13px; cursor: pointer; padding: 0; }
  .jdp-grid > button:hover { background: rgba(0,0,0,0.06); }
  .jdp-grid > button.sel { background: var(--btn, #2563eb); color: #fff; }
  .jdp-grid > button.today { outline: 1px solid var(--btn, #2563eb); }
  .jdp-grid > button.empty { visibility: hidden; cursor: default; }
  .jdp-time { display: block; margin: 12px 2px 4px; font-size: 13px; }
  .jdp-allday-wrap { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
    color: var(--muted-foreground); cursor: pointer; }
  /* چیپ‌های ساعتِ آماده */
  .jdp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
  .jdp-chip { padding: 6px 11px; border-radius: calc(var(--radius) - 3px);
    border: 1px solid var(--border-c); background: var(--background); color: var(--foreground);
    font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow-sm);
    font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, color .15s; }
  .jdp-chip:hover { background: var(--accent); }
  .jdp-chip.sel { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
  /* استپرِ ساعت/دقیقه — دکمه‌های ریزِ + و − بالا و پایینِ مقدار.
     direction: ltr تا ساعت سمتِ چپ و دقیقه سمتِ راست بیفتد (مثلِ ۰۹:۳۰). */
  .jdp-steppers { display: flex; direction: ltr; align-items: center; justify-content: center; gap: 14px; }
  .jdp-stepper { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .jdp-stepper-lbl { font-size: 11px; color: var(--muted-foreground); }
  .jdp-stepper-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .jdp-step { width: 30px; height: 22px; padding: 0; border-radius: 8px; font-size: 16px;
    font-weight: 600; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .jdp-stepper-val { min-width: 40px; text-align: center; font-size: 22px; font-weight: 600;
    font-variant-numeric: tabular-nums; letter-spacing: .02em; }
  .jdp-actions { display: flex; gap: 8px; margin-top: 12px; }
  .jdp-actions > button { flex: 1; }
  .dark .jdp-modal { background: var(--card, #1c1c1e); }
  .dark .jdp-grid > button:hover { background: rgba(255,255,255,0.08); }

  /* ============================================================ */
  /* ShadCN-style refinements (latest "new-york" neutral aesthetic) */
  /* ============================================================ */
  html, body { background: var(--background); color: var(--foreground);
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility; letter-spacing: -0.006em; }
  .wrap { padding: 14px 14px 96px; }
  h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.021em; margin: 6px 0 14px; }
  h2 { font-size: 13px; font-weight: 600; color: var(--muted-foreground);
    letter-spacing: 0.01em; margin: 20px 0 8px; }

  /* segmented tab bar */
  .tabbar { gap: 6px; padding: 8px 0 12px; margin: 0 -2px;
    background: color-mix(in srgb, var(--background) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
  .tab { padding: 8px 14px; border-radius: calc(var(--radius) + 2px); font-size: 13.5px; font-weight: 500;
    background: var(--secondary); border: 1px solid transparent; color: var(--secondary-foreground);
    box-shadow: none; transition: background .15s, color .15s, box-shadow .15s, transform .05s; }
  .tab:hover { background: var(--accent); }
  .tab:active { transform: scale(.97); }
  .tab.active { background: var(--primary); color: var(--primary-foreground);
    border-color: var(--primary); box-shadow: var(--shadow-sm); }

  /* cards */
  .card { background: var(--card-bg); color: var(--card-foreground);
    border: 1px solid var(--border-c); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); position: relative; }

  /* buttons */
  button { background: var(--primary); color: var(--primary-foreground);
    border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
    padding: 9px 16px; font-size: 13.5px; font-weight: 500; line-height: 1.25;
    box-shadow: var(--shadow-sm);
    transition: transform .05s, filter .15s, background .15s, box-shadow .15s, border-color .15s; }
  button:hover { filter: brightness(1.08); }
  button:active { transform: translateY(.5px) scale(.985); }
  button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
  button.ghost { background: transparent; color: var(--foreground);
    border: 1px solid var(--border-c); box-shadow: none; }
  button.ghost:hover { background: var(--accent); filter: none; }
  button.danger { background: var(--danger); color: #fff; }
  button.ok { background: var(--ok); color: #fff; }
  button.warn { background: var(--warn); color: #fff; }
  button.sm { padding: 6px 11px; font-size: 12.5px; border-radius: calc(var(--radius) - 3px); }
  button:disabled { opacity: .5; }
  /* ردیفِ دکمه‌های اکشن: همه هم‌اندازه، در یک ردیفِ مرتب */
  .actions { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
  .actions > button { flex: 1 1 0; min-width: 0; text-align: center; }
  .actions > .pill { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; text-align: center; }

  /* form controls */
  input.f, textarea.f, select.f { border: 1px solid var(--input-c);
    border-radius: calc(var(--radius) - 2px); padding: 9px 11px;
    background: var(--background); color: var(--foreground);
    box-shadow: var(--shadow-sm); margin-top: 8px;
    transition: border-color .15s, box-shadow .15s; }
  input.f:focus, textarea.f:focus, select.f:focus { outline: none; border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 32%, transparent); }
  input.f::placeholder, textarea.f::placeholder { color: var(--muted-foreground); }

  /* badges / pills */
  .pill { padding: 2px 9px; border-radius: calc(var(--radius) - 2px); font-size: 11.5px; font-weight: 500;
    background: var(--secondary); color: var(--secondary-foreground); border: 1px solid var(--border-c); }
  .pill.red { background: var(--danger-bg); color: var(--danger-fg2); border-color: var(--danger-bd); }
  .pill.green { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
  .pill.amber { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
  .pill.blue { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
  .pill.gray { background: var(--secondary); color: var(--muted); border-color: var(--border-c); }
  /* تسک ۲۴۴: کادرِ «آخرین یادداشتِ پیگیری» در کارتِ کارتابل */
  .last-note { font-size: 12.5px; color: var(--fg); background: var(--bg); padding: 8px 10px;
    border-radius: 8px; border-inline-start: 3px solid var(--accent-foreground, var(--link)); }

  /* تگ‌ها / دسته‌بندی — چیپ‌های رنگیِ تو‌پر (در هر دو تم خوانا) */
  .tagpill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.7;
    color: #fff; border: none; white-space: nowrap; max-width: 100%; }
  .tagpill .tx { overflow: hidden; text-overflow: ellipsis; }
  .tagpill.personal::before { content: "★"; font-size: 9px; opacity: .85; }
  .tagpill .rm { cursor: pointer; opacity: .8; font-weight: 700; margin-inline-start: 1px; }
  .tagpill .rm:hover { opacity: 1; }
  .tagpill.pick { cursor: pointer; opacity: .55; filter: grayscale(.2); }
  .tagpill.pick.on { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px currentColor; }
  .tagrow { display: flex; flex-wrap: wrap; gap: 5px; }
  .tag-blue   { background: #3b82f6; } .tag-green  { background: #16a34a; }
  .tag-amber  { background: #d97706; } .tag-red    { background: #dc2626; }
  .tag-violet { background: #7c3aed; } .tag-teal   { background: #0d9488; }
  .tag-pink   { background: #db2777; } .tag-gray   { background: #64748b; }
  /* حباب‌های ریزِ تگ روی کارت‌های فهرست */
  .item .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

  /* ====== تسک ۱۹۸: بخش‌های آکاردئونیِ پروژه ====== */
  .sections-wrap { margin-top: 6px; }
  .sec { border: 1px solid var(--border-c); border-radius: var(--radius); background: var(--card-bg);
    box-shadow: var(--shadow-sm); margin-bottom: 10px; overflow: hidden; position: relative;
    border-inline-start: 3px solid var(--accent-strip, var(--border-c)); }
  .sec-head { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; cursor: pointer; user-select: none; }
  .sec-head:hover { background: color-mix(in srgb, var(--accent) 45%, transparent); }
  .sec .chev { flex: 0 0 auto; margin-top: 3px; color: var(--muted-foreground); transition: transform .2s; display: inline-flex; }
  .sec.open .chev { transform: rotate(180deg); }
  /* هدرِ دوردیفه: ردیفِ اول عنوان + شمارنده + دکمه‌های ابزار؛ ردیفِ دومِ اختیاری، تگ‌ها.
     این‌طور تگ‌ها هرگز عنوان یا دکمه‌ها را نمی‌پوشانند و آزادانه wrap می‌شوند. */
  .sec-hd-main { flex: 1 1 auto; min-width: 0; }
  .sec-hd-top { display: flex; align-items: center; gap: 8px; }
  /* عنوانِ بلند باید به خطِ بعد بیفتد (نه سه‌نقطه)؛ overflow-wrap برای واژه‌های بلندِ بی‌فاصله. */
  .sec-title { font-weight: 600; font-size: 14.5px; flex: 1 1 auto; min-width: 0;
    overflow-wrap: anywhere; line-height: 1.4; }
  .sec-count { flex: 0 0 auto; color: var(--muted-foreground); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
  .sec-tagline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
  .sec-mini { width: 74px; }
  /* آکاردئونِ نرم: ترفندِ grid-template-rows 0fr↔1fr (بدونِ ارتفاعِ ثابت، بی‌پرش).
     محتوا در .sec-body-inner است که overflow:hidden دارد تا هنگامِ جمع‌شدن بریده شود. */
  .sec-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
  .sec.open .sec-body { grid-template-rows: 1fr; }
  .sec-body-inner { overflow: hidden; min-height: 0; padding: 0 14px; transition: padding .28s ease; }
  .sec.open .sec-body-inner { padding: 4px 14px 14px; border-top: 1px solid var(--border-c); }
  @media (prefers-reduced-motion: reduce) {
    .sec-body, .sec-body-inner, .sec .chev { transition: none; }
  }
  .sec-tools { flex: 0 0 auto; display: flex; gap: 3px; margin-inline-start: 2px; }
  .sec.pinned { background: color-mix(in srgb, var(--accent) 34%, var(--card-bg)); }
  .sec-pin { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
    padding: 1px 8px; border-radius: 999px; background: var(--primary); color: #fff; white-space: nowrap; }
  /* تب‌های سگمنتیِ داخلِ هر بخش */
  .subtabs { display: flex; gap: 6px; overflow-x: auto; padding: 11px 0 12px; }
  .subtab { white-space: nowrap; padding: 6px 12px; border-radius: calc(var(--radius) + 2px); font-size: 12.5px; font-weight: 500;
    cursor: pointer; background: var(--secondary); border: 1px solid transparent; color: var(--secondary-foreground);
    display: inline-flex; align-items: center; gap: 5px; }
  .subtab:hover { background: var(--accent); }
  .subtab.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); box-shadow: var(--shadow-sm); }
  .subpanel { display: none; }
  .subpanel.on { display: block; }
  .newsec { display: flex; gap: 8px; align-items: stretch; margin: 6px 0 12px; }
  .newsec input { flex: 1 1 auto; margin-top: 0; }
  /* دکمه‌ی «+ بخش» هم‌ارتفاعِ فیلدِ کنارش (کششی) و محتوایش وسط‌چین. */
  .newsec .sm { display: inline-flex; align-items: center; justify-content: center; }
  .badge-proj { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 9px;
    border-radius: 999px; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; white-space: nowrap; vertical-align: middle; }
  /* نشانِ «پروژه» در فهرست‌ها/گزارش‌ها: دوشاخه‌ی بنفشِ کوچک کنارِ عنوان. */
  .proj-mark { color: #7c3aed; }
  html.dark .proj-mark { color: #a78bfa; }
  .proj-mark .ic { width: 13px; height: 13px; vertical-align: -1px; }
  /* کارتِ بالای «جزئیاتِ کار»: عنوان بولد و بزرگ‌تر؛ بقیه‌ی اطلاعات (مسئول/ددلاین/…) کمرنگ‌تر. */
  .dt-title { font-size: 17px; font-weight: 700; line-height: 1.55; letter-spacing: -0.015em; }
  .dt-sub { opacity: .72; }

  /* نوارِ فیلترِ کارها */
  .fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 12px; }
  .fchip { cursor: pointer; user-select: none; }
  .fchip.sel { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }

  /* نوارِ ابزار: منوی سورت + دکمه‌ی تاشوی «فیلترها» */
  .ftools { display: flex; gap: 8px; align-items: center; }
  .ftools .sortsel { flex: 1 1 auto; margin-top: 0; }
  .ffold { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; white-space: nowrap; }
  .ffold.on { background: var(--accent); }
  .ffold svg:last-child { transition: transform .18s; }
  .ffold.on svg:last-child { transform: rotate(180deg); }
  /* نشانگرِ تعدادِ فیلترِ فعال روی دکمه‌ی «فیلترها» */
  .fcount { display: inline-flex; align-items: center; justify-content: center;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: var(--btn); color: var(--btn-fg); font-size: 10.5px; font-weight: 600; line-height: 1; }
  /* پنلِ تاشوی فیلترها: بسته = مخفی؛ باز = همان چیدمانِ ردیفیِ wrapِ نوار */
  .filter-panel { display: none; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
  .filter-panel.open { display: flex; }
  .filter-panel .f { margin-top: 0; }

  /* list items — فشرده و ریز تا کارهای پیش‌رو در یک نگاه دیده شوند */
  .item { padding: 6px 0; border-bottom: 1px solid var(--border-c); }
  .item .title { font-weight: 600; letter-spacing: -0.011em; font-size: 12px; line-height: 1.45; }
  .item .meta { color: var(--muted-foreground); font-size: 10px; margin-top: 1px; line-height: 1.55; }
  .item .actions { margin-top: 6px; }
  .item-hd { display: flex; align-items: flex-start; gap: 6px; }
  .item-hd > .title { flex: 1; min-width: 0; }
  .item-tools { display: flex; gap: 3px; flex-shrink: 0; padding-top: 1px; opacity: 0.45; transition: opacity .18s; }
  .item:hover .item-tools { opacity: 1; }
  .card-tools { position: absolute; top: 14px; inset-inline-end: 14px; display: flex; gap: 4px; opacity: 0.45; transition: opacity .18s; }
  .card:hover .card-tools { opacity: 1; }
  button.btn-icon { padding: 0; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; }
  /* تسکِ «در انتظار بررسی مدیر» — لبهٔ کهربایی برای تفکیکِ یک‌نگاهی در فهرست */
  .item.review { border-inline-start: 2px solid var(--warn); padding-inline-start: 8px; }

  /* متنِ کاربر در جزئیاتِ کار (کامنت/گزارش/توضیحات): توکنِ بلندِ بی‌فاصله مثلِ
     لینکِ طولانی باید بشکند تا از عرضِ صفحه بیرون نزند و اسکرولِ افقی نسازد.
     overflow-wrap ارث‌بری می‌شود، پس یک قانون روی کلِ بدنه کافی‌ست. */
  #d-body { overflow-wrap: anywhere; word-break: break-word; }

  /* پراگرس‌بارِ مهلت: سهمِ سپری‌شده از بازه‌ی «ایجاد → سررسید» */
  .dlbar { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
  .dlbar .track { flex: 1 1 auto; height: 3px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
  .dlbar .track > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
  .dlbar.warn .track > span { background: var(--warn); }
  .dlbar.over .track > span { background: var(--danger); }
  .dlbar .lbl { font-size: 9px; color: var(--muted-foreground); white-space: nowrap; flex: none;
    font-variant-numeric: tabular-nums; }
  .dlbar.over .lbl { color: var(--danger); }

  /* ردیفِ فرد: آواتار + متن (تبِ افراد) */
  .prow { display: flex; align-items: center; gap: 11px; }
  .prow .pinfo { flex: 1 1 auto; min-width: 0; }
  /* نام/نقش آزادانه می‌شکنند (تا نشانِ ادمین پنهان نشود)؛ خطِ متا یک‌خطی با … */
  .prow .pinfo .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* آواتار: عکسِ پروفایلِ تلگرام یا حروفِ اول روی دایره‌ی رنگی (fallback) */
  .avatar { width: 40px; height: 40px; flex: none; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600; color: #fff; line-height: 1;
    background-color: var(--muted-surface); background-size: cover; background-position: center;
    overflow: hidden; user-select: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
  .avatar.has-img { color: transparent; }

  /* dropzone */
  .drop { border: 1.5px dashed var(--border-c); border-radius: var(--radius);
    padding: 28px 16px; background: var(--muted-surface);
    transition: border-color .15s, background .15s; }
  .drop:hover, .drop.drag { border-color: var(--ring); background: var(--accent); }
  .drop .big { font-size: 30px; opacity: .85; }

  /* progress */
  .progress { height: 6px; background: var(--secondary); }
  .progress > div { background: var(--primary); }

  .muted { color: var(--muted-foreground); }
  pre.transcript { background: var(--muted-surface); border: 1px solid var(--border-c);
    border-radius: calc(var(--radius) - 2px); color: var(--muted-foreground); }
  details > summary { color: var(--muted-foreground); font-weight: 500; }
  details > summary:hover { color: var(--foreground); }

  /* chat bubbles */
  .bubble { padding: 9px 13px; border-radius: 16px; font-size: 14px; box-shadow: var(--shadow-sm); }
  .bubble.user { background: var(--primary); color: var(--primary-foreground); border-bottom-right-radius: 5px; }
  .bubble.bot { background: var(--card-bg); color: var(--card-foreground);
    border: 1px solid var(--border-c); border-bottom-left-radius: 5px; }

  /* یادداشت‌های شخصیِ خصوصی روی تسک — ظاهرِ خنثی، مثلِ بقیه‌ی کارت‌های جزئیات.
     (رنگِ متمایز عمداً برداشته شد؛ تمایزِ رنگی برای «سوابقِ پیگیری» رزرو است.) */
  .note-card { background: var(--bg); border-color: var(--border-c); }
  .note-card > summary { color: var(--card-foreground); }
  .note-item { background: var(--card-bg); border: 1px solid var(--border-c);
    border-inline-start: 3px solid var(--border-c); border-radius: calc(var(--radius) - 2px);
    padding: 9px 11px; margin-top: 8px; box-shadow: var(--shadow-sm); }
  .note-item .note-body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; word-break: break-word; }
  .note-item .note-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
  .note-item .note-foot .when { flex: 1 1 auto; min-width: 0; color: var(--muted-foreground);
    font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }

  /* تسک ۲۴۴: «سوابقِ پیگیری» — بخشِ کلیدیِ CRM؛ عمداً با اکسنتِ آبی متمایز شده تا
     در میانِ کارت‌های خنثیِ جزئیات پیدا باشد (هم‌خانواده با کادرِ .last-note در کارتابل). */
  .pursuit-card { background: color-mix(in srgb, var(--accent) 55%, var(--card-bg));
    border-color: color-mix(in srgb, var(--accent-foreground) 30%, var(--border-c));
    border-inline-start: 3px solid var(--accent-foreground); }
  .pursuit-card > summary { color: var(--accent-foreground); font-weight: 700; }
  .pursuit-card > summary:hover { color: var(--accent-foreground); }
  .pursuit-card .item { border-bottom-color: color-mix(in srgb, var(--accent-foreground) 20%, transparent); }

  /* تسک ۲۴۴ فاز ۳: بجِ وضعیتِ پیگیری روی کارت‌های تبِ «کارها» و «سوابق» — «چند بار پیگیری
     شده و نوبتِ بعدی کِی است، در یک نگاه». هم‌خانواده‌ی .pursuit-card (همان اکسنتِ آبی)
     تا چشم بین کارتابلِ پیگیری و فهرستِ کارها همان زبان را ببیند. */
  .pu-badge { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
    padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
    white-space: nowrap; border: 1px solid transparent; }
  .pu-badge.pu-next { background: color-mix(in srgb, var(--accent-foreground) 12%, transparent);
    color: var(--accent-foreground);
    border-color: color-mix(in srgb, var(--accent-foreground) 30%, transparent); }
  .pu-badge.pu-today { background: color-mix(in srgb, var(--accent-foreground) 22%, transparent);
    color: var(--accent-foreground);
    border-color: color-mix(in srgb, var(--accent-foreground) 52%, transparent); }
  .pu-badge.pu-late { background: var(--danger-bg); color: var(--danger-fg2);
    border-color: var(--danger-bd); }

  /* تسک‌های ۲۳۲/۲۷۷/۲۷۹: قفسه‌ی شخصی — سه تبِ کوچکِ داخلی (الگوی تب‌های «گزارش»). */
  #pv-tabs { gap: 6px; flex-wrap: wrap; }
  #pv-tabs > button { display: inline-flex; align-items: center; gap: 5px; }
  #pv-tabs > button.sel { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
  #pv-tabs > button.sel .pv-count { background: rgba(255,255,255,.22); color: inherit; }
  .pv-count { font-size: 11.5px; font-weight: 700; color: var(--accent-foreground);
    background: color-mix(in srgb, var(--accent-foreground) 14%, transparent);
    border-radius: 999px; padding: 0 7px; }
  .pv-composer { margin-bottom: 10px; }

  /* --- چک‌لیست‌های تسک (بخشِ جزئیات) --- */
  .chk-card { background: var(--bg); }
  .chk-head { display: flex; align-items: center; gap: 6px; }
  .chk-head .t { flex: 1 1 auto; min-width: 0; font-weight: 700; word-break: break-word; }
  .chk-prog { height: 4px; background: var(--secondary); border-radius: 999px; overflow: hidden; margin: 8px 0 2px; }
  .chk-prog > div { height: 100%; background: var(--btn); transition: width .2s; }
  .chk-prog.done > div { background: var(--ok); }
  .chk-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; }
  /* جداکننده با border-top روی ردیفِ غیرِ اول — چون بینِ ردیف‌ها .chk-detail هم می‌نشیند
     و last-of-type/last-child قابلِ اتکا نیست */
  .chk-row + .chk-row, .chk-detail + .chk-row { border-top: 1px solid var(--border-c); }
  /* چک‌باکسِ لمس‌راحت: خودِ مربع ۲۲px است ولی ::after ناحیه‌ی لمس را بزرگ می‌کند */
  .chk-tick { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--border-c);
    background: var(--card-bg); display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; margin-top: 1px; box-shadow: none; color: transparent; position: relative; }
  /* ناحیه‌ی لمسِ واقعی ≥۴۴px بدونِ بزرگ‌شدنِ ظاهرِ مربع — هدفِ کلیک از خودِ دکمه بیرون می‌زند */
  .chk-tick::after { content: ""; position: absolute; inset: -11px; }
  .chk-tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
  .chk-tick:disabled { opacity: .55; cursor: default; }
  .chk-text { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.65; word-break: break-word; cursor: pointer; }
  .chk-text.done { text-decoration: line-through; color: var(--muted-foreground); }
  .chk-meta { flex: none; display: flex; align-items: center; gap: 4px; color: var(--muted-foreground); font-size: 11px; margin-top: 3px; }
  .chk-detail { margin: 0 0 8px; margin-inline-start: 30px; padding: 8px 10px;
    border-inline-start: 2px solid var(--border-c); background: var(--card-bg);
    border-radius: 8px; font-size: 13px; }
  .chk-detail .desc { white-space: pre-wrap; word-break: break-word; line-height: 1.65; }

  /* gantt */
  .gantt-track { background: var(--secondary); border-radius: 7px; height: 18px; }
  .gantt-div { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: .6; pointer-events: none; }
  .gantt-body { position: relative; }
  .gantt-today { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; z-index: 2; }
  .gantt-today::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; border-radius: 2px; background: var(--warn); opacity: .4; }
  .gantt-today::after { content: ""; position: absolute; top: -4px; left: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--card); }
  .gantt-bar { background: var(--primary); border-radius: 7px; height: 14px; top: 2px; }
  .gantt-bar.done { background: var(--ok); }
  .gantt-bar.over { background: var(--danger); }

  /* dashboard overview */
  .ov-grid { display: grid; gap: 10px; }
  /* آیتم‌های گرید min-width:auto دارند؛ بدونِ این، عنوانِ بلندِ nowrap (مثلاً در
     «عقب‌افتاده‌ترین کارها») ترکِ گرید را گشاد می‌کند و کلِ داشبورد اسکرولِ افقی می‌گیرد. */
  .ov-grid > .card { min-width: 0; }
  .ov-h { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 5px; }
  .ov-h .ic { width: 14px; height: 14px; }
  /* روند هفتگی */
  .trend { display: flex; align-items: flex-end; gap: 6px; height: 78px; padding-top: 4px; }
  .trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
  .trend-bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
  .trend-bars span { width: 7px; border-radius: 3px 3px 0 0; min-height: 2px; }
  .trend-bars .op { background: var(--primary); opacity: .55; }
  .trend-bars .cl { background: var(--ok); }
  .trend-x { font-size: 10px; color: var(--muted); }
  .legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 6px; }
  .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-inline-end: 4px; vertical-align: -1px; }
  /* بارِ کاریِ افراد */
  .wl-row { margin: 9px 0; }
  .wl-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 4px; }
  .wl-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .wl-meta { color: var(--muted); font-size: 11px; flex-shrink: 0; padding-inline-start: 8px; }
  .wl-bar { height: 12px; border-radius: 6px; background: var(--secondary); overflow: hidden; display: flex; }
  .wl-bar span { height: 100%; }
  .wl-bar .over { background: var(--danger); }
  .wl-bar .open { background: var(--primary); opacity: .7; }
  .ov-od { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
  .ov-od:last-child { border-bottom: 0; }
  .ov-od b { color: var(--danger); font-variant-numeric: tabular-nums; white-space: nowrap; }

  /* toast */
  .toast { background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border-c); box-shadow: var(--shadow-lg);
    border-radius: var(--radius); padding: 11px 16px; font-size: 13px; font-weight: 500; }

  /* lucide icons */
  /* pointer-events:none تا هدفِ کلیک همیشه خودِ دکمه/لینک باشد، نه آیکن. lucide آیکنِ
     <i> را با <svg> جایگزین می‌کند؛ اگر این جابه‌جایی بینِ press و release رخ دهد و آیکن
     هدفِ کلیک باشد، مرورگر کلیک را حذف می‌کند و دکمه «گاهی فریز می‌شود». با این قانون
     کلیک از روی آیکن به دکمه می‌رسد و این ریس به‌کلی از بین می‌رود (سراسری برای کلِ اپ). */
  .ic { width: 1.05em; height: 1.05em; stroke-width: 2; vertical-align: -0.16em;
    display: inline-block; flex: none; pointer-events: none; }
  h1 .ic { width: 1.1em; height: 1.1em; vertical-align: -0.12em; opacity: .9; }
  h2 .ic { width: 1em; height: 1em; vertical-align: -0.14em; }
  .tab .ic { width: 1em; height: 1em; vertical-align: -0.13em; margin-inline-end: 5px; }
  .item .title .ic, .item .meta .ic { vertical-align: -0.16em; }
  .card .title .ic { vertical-align: -0.15em; }
  .toast .ic { vertical-align: -0.18em; margin-inline-end: 4px; }
  .priodot { display: inline-block; width: 9px; height: 9px; border-radius: 999px;
    vertical-align: middle; margin-inline-end: 1px; }
  .priodot.high { background: var(--danger); }
  .priodot.normal { background: #3b82f6; }
  .priodot.low { background: #a1a1aa; }
  /* لودینگِ زیبا: اسپینرِ حلقه‌ای + اسکلتونِ shimmer */
  .loading { display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 56px 16px; color: var(--muted); }
  .spinner { width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--primary);
    animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-label { font-size: 13px; animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
  .rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger);
    flex: none; animation: pulse 1s ease-in-out infinite; }
  .skel-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    padding: 14px; margin-bottom: 10px; }
  .skel { border-radius: 7px; background: var(--muted-surface); position: relative; overflow: hidden; }
  .skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
    animation: shimmer 1.3s infinite; }
  html.dark .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
  @keyframes shimmer { 100% { transform: translateX(100%); } }
  .skel.line { height: 12px; margin: 8px 0; }
  .skel.line.mid { width: 70%; }
  .skel.line.short { width: 42%; }
  /* ورود با کدِ یک‌بارمصرف (خارج از تلگرام) */
  .auth-header { display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 9px 12px; margin-bottom: 12px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
  .auth-header .who { display: inline-flex; align-items: center; gap: 8px; min-width: 0;
    font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .auth-header .who-av { display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; flex: none; color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c3aed); }
  .auth-header .who-av .ic { width: 15px; height: 15px; }

  .login-wrap { display: flex; align-items: center; justify-content: center;
    min-height: 78vh; padding: 16px 2px; }
  .login-card { width: 100%; max-width: 400px; padding: 30px 24px 24px;
    border-radius: 20px; box-shadow: var(--shadow-lg); text-align: center; }
  .login-badge { width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center; color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    box-shadow: 0 10px 24px -8px rgba(59,130,246,.55); }
  .login-badge .ic { width: 29px; height: 29px; }
  .login-card h2 { margin: 0 0 7px; font-size: 19px; font-weight: 700; }
  .login-card .sub { margin: 0 0 20px; font-size: 12.5px; line-height: 1.75;
    color: var(--muted-foreground); }
  /* فیلدِ شناسه LTR است (یوزرنیم/شماره چپ‌چین، آیکون سمتِ چپ) */
  .field { position: relative; }
  .field .fic { position: absolute; top: 50%; transform: translateY(-50%);
    inset-inline-start: 13px; width: 18px; height: 18px;
    color: var(--muted-foreground); pointer-events: none; }
  .field input.f { padding-inline-start: 40px; height: 48px; border-radius: 13px; text-align: left; }
  .btn-main { width: 100%; height: 48px; border-radius: 13px; font-weight: 600;
    font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 14px; }
  .login-actions { display: flex; gap: 8px; margin-top: 10px; }
  .login-actions button { flex: 1; height: 40px; border-radius: 12px; font-size: 12.5px; }
  .otp-boxes { display: flex; gap: 9px; justify-content: center; direction: ltr; margin: 4px 0 2px; }
  .otp-boxes input { flex: 1 1 0; min-width: 0; max-width: 62px; height: 60px; text-align: center;
    font-size: 26px; font-weight: 700; border: 1.5px solid var(--input-c); border-radius: 14px;
    background: var(--card-bg); color: var(--foreground); caret-color: var(--primary);
    transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; }
  .otp-boxes input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(59,130,246,.28); }
  .otp-boxes input.filled { border-color: var(--primary); }
  .login-msg { margin-top: 16px; font-size: 13px; min-height: 20px; line-height: 1.6; border-radius: 11px; }
  .login-msg.info { color: var(--muted-foreground); }
  .login-msg.err { color: var(--danger-fg2); background: var(--danger-bg);
    border: 1px solid var(--danger-bd); padding: 10px 12px; }
  .login-msg.ok { color: var(--success-fg); background: var(--success-bg);
    border: 1px solid var(--success-bd); padding: 10px 12px; }
  /* دکمه‌ی شناورِ تغییرِ تم (فقط در مرورگر — خارج از اپِ تلگرام) */
  .theme-fab { position: fixed; bottom: 16px; left: 16px; z-index: 60; display: none;
    width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center;
    background: var(--card-bg); color: var(--foreground); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); cursor: pointer; padding: 0; }
  .theme-fab.show { display: inline-flex; }
  .theme-fab .ic { width: 20px; height: 20px; }

  /* ===== نقش‌ها و سطوح دسترسی (فاز ۲) ===== */
  /* سگمنتِ دامنه‌ی دید */
  .seg { display: flex; background: var(--secondary); border-radius: 10px; padding: 3px; gap: 3px; }
  .seg button { flex: 1; border: 0; background: transparent; color: var(--fg); font: inherit;
    font-size: 13px; font-weight: 600; padding: 7px 4px; border-radius: 8px; cursor: pointer; }
  .seg button[aria-pressed="true"] { background: var(--card); color: var(--primary);
    box-shadow: var(--shadow-sm); }
  /* سوییچِ مجوز */
  .sw { width: 38px; height: 22px; border-radius: 999px; border: 0; padding: 0; flex: none;
    cursor: pointer; background: rgba(0,0,0,.14); position: relative; transition: background .16s; }
  html.dark .sw { background: rgba(255,255,255,.18); }
  .sw::after { content: ""; position: absolute; top: 2.5px; right: 2.5px; width: 17px; height: 17px;
    border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .16s; }
  .sw[aria-checked="true"] { background: var(--primary); }
  .sw[aria-checked="true"]::after { transform: translateX(-16px); }
  .sw:disabled { opacity: .45; cursor: not-allowed; }
  /* ردیفِ مجوز — کنترل در انتهای ردیف، مثلِ .spread */
  .prow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0;
    border-bottom: 1px solid var(--border); }
  .prow:last-child { border-bottom: 0; }
  .prow > .txt { flex: 1 1 auto; min-width: 0; }
  .prow > .sw { margin-top: 2px; }
  .prow.child { padding-inline-start: 16px; border-inline-start: 2px solid var(--border);
    margin-inline-start: 4px; }
  .prow .lbl { font-size: 14px; font-weight: 600; display: flex; align-items: center;
    gap: 6px; flex-wrap: wrap; }
  .prow .dsc { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
  .prow .dep { font-size: 12px; color: var(--warn); margin-top: 4px; display: none; }
  .prow.needs .dep { display: block; }
  /* آکاردئونِ گروهِ مجوزها */
  .pgrp { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px;
    overflow: hidden; background: var(--card); }
  .pgrp > summary { list-style: none; cursor: pointer; padding: 11px 13px; display: flex;
    align-items: center; gap: 9px; font-weight: 600; font-size: 14px; user-select: none; }
  .pgrp > summary::-webkit-details-marker { display: none; }
  .pgrp > summary .cnt { margin-inline-start: auto; font-size: 12px; color: var(--muted);
    font-variant-numeric: tabular-nums; }
  .pgrp > summary .chev { transition: transform .16s; }
  .pgrp[open] > summary .chev { transform: rotate(180deg); }
  .pgrp .pbody { padding: 0 13px 10px; }
  /* پیش‌نمایشِ زنده */
  .pvbox { background: var(--muted-surface); border-radius: 12px; padding: 12px; margin-top: 10px; }
  .pvbox h4 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .06em; color: var(--muted);
    font-weight: 700; }
  .pvtabs { display: flex; gap: 6px; flex-wrap: wrap; }
  .pvtabs span { background: var(--card); border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 10px; font-size: 12.5px; }
  .pvkbd { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .pvkbd span { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 7px 6px; font-size: 12.5px; text-align: center; }
  .pvkbd span.solo { grid-column: span 2; }
  .pvsum { font-size: 13px; color: var(--fg); line-height: 1.9; }
  .pvsum b { color: var(--primary); }
  /* نوارِ چسبانِ ذخیره */
  .savebar { position: sticky; bottom: 0; background: var(--card); border: 1px solid var(--border);
    border-radius: 14px; padding: 11px 13px; margin-top: 10px; box-shadow: var(--shadow-lg); }
  /* دکمه‌ی شناورِ تم (فقط در مرورگر) روی نوارِ چسبانِ ذخیره می‌افتاد؛ بالاتر می‌رود. */
  body:has(.savebar) .theme-fab { bottom: 80px; }
  /* رنگِ نقش */
  .swatch { width: 22px; height: 22px; border-radius: 999px; border: 2px solid transparent;
    cursor: pointer; padding: 0; }
  .swatch[aria-pressed="true"] { border-color: var(--fg); }
  .rolecolor { width: 10px; height: 10px; border-radius: 999px; display: inline-block;
    margin-inline-end: 5px; vertical-align: middle; }
