  :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;
    /* حباب‌های گفت‌وگو: «من» با اکسنتِ ملایمِ سبز، طرفِ مقابل روی سطحِ کارت */
    --bubble-mine: #dcf3e4;       --bubble-theirs: #ffffff;
    --chat-bg: #f4f5f7;           --tick-seen: #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;
    --info-bg:    #eff6ff;  --info-fg:    #1d4ed8;  --info-bd:    #bfdbfe;
    --violet-bg:  #f5f3ff;  --violet-fg:  #6d28d9;  --violet-bd:  #ddd6fe;
    --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.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }
  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;
    --bubble-mine: #17372b;       --bubble-theirs: #1c1c1f;
    --chat-bg: #101013;           --tick-seen: #60a5fa;
    --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);
    --info-bg:    rgba(59,130,246,.15); --info-fg:    #93c5fd;  --info-bd:    rgba(59,130,246,.35);
    --violet-bg:  rgba(139,92,246,.15); --violet-fg:  #c4b5fd;  --violet-bd:  rgba(139,92,246,.35);
    --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; }
  /* متنِ کاربر (از جمله لینک، نام و نقطه‌های بی‌فاصله) در همهٔ کارت‌ها داخلِ کادر بماند.
     anywhere به فرزندان ارث می‌رسد و حداقل عرضِ محتوای flex/grid را هم محدود می‌کند. */
  .wrap { max-width: 680px; margin: 0 auto; padding: 12px; padding-bottom: 90px;
    overflow-wrap: anywhere; }
  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); }
  /* بجِ عددیِ تب (درخواست‌های بلاتکلیفِ جلسه) — تسک ۱۰۰، کامنتِ ۵۴۳ */
  .tab-badge { display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; margin-inline-start: 6px;
    border-radius: 999px; background: #ef4444; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 1px; }
  .tab.active .tab-badge { background: var(--btn-fg); color: var(--btn); }
  /* صفِ زمان‌بندی فقط برای دستیار؛ رنگِ مستقل باعث می‌شود با صفِ تأیید اشتباه نشود. */
  .tab-badge.tab-badge-schedule { background: #7c3aed; color: #fff; }
  .tab.active .tab-badge.tab-badge-schedule { background: #c4b5fd; color: #2e1065; }
  .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;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px
      max(16px, env(safe-area-inset-bottom, 0px)); }
  .jdp-modal { background: var(--card, #fff); color: inherit; border-radius: 16px; padding: 14px;
    width: 320px; max-width: 100%; max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    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; }
  .account-transfer-actions { display: grid; gap: 8px; margin-top: 14px; }
  .account-transfer-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .account-transfer-actions button { display: flex; align-items: center; justify-content: center;
    height: 40px; min-width: 0; padding: 0 12px; font-size: 13px; line-height: 1.4;
    white-space: nowrap; }
  .contact-account-field { position: relative; margin-top: 6px; }
  .contact-account-field > input.f { margin-top: 0; }
  .contact-account-field.has-transfer > input.f { padding-left: 124px; }
  .contact-account-field > .contact-account-transfer { position: absolute; left: 6px; top: 50%;
    transform: translateY(-50%); display: inline-flex; align-items: center; gap: 4px;
    height: 30px; padding: 0 8px; font-size: 12px; line-height: 1; white-space: nowrap;
    border-radius: 6px; background: var(--secondary); }
  /* مودالِ زمان‌بندی بلند است: فقط بدنه اسکرول می‌شود و دکمه‌های ثبت/انصراف
     همیشه در پایینِ کارت در دسترس می‌مانند. */
  .sch-modal-card { display: flex; flex-direction: column; overflow: hidden; }
  .sch-modal-scroll { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; padding-inline: 2px; }
  .sch-modal-card > .jdp-actions { flex: none; padding-top: 12px; margin-top: 0;
    border-top: 1px solid var(--border); background: var(--card); }
  .sch-time-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin: -4px 0 12px; }
  .sch-exact-panel { width: 100%; padding: 10px; border: 1px solid var(--border);
    border-radius: 12px; background: var(--secondary); }
  .sch-exact-panel .jdp-steppers { margin-bottom: 10px; }
  .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); }
  .tab-badge { background: var(--destructive, #ef4444); color: #fff; box-shadow: var(--shadow-sm); }
  .tab.active .tab-badge { background: var(--primary-foreground); color: var(--primary); }
  .tab-badge.tab-badge-schedule { background: #7c3aed; color: #fff; }
  .tab.active .tab-badge.tab-badge-schedule { background: #c4b5fd; color: #2e1065; }

  /* 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(--button-primary, 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: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
  .pill.purple { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-bd); }
  .pill.gray { background: var(--secondary); color: var(--muted); border-color: var(--border-c); }
  /* نمونه‌رنگ‌های انتخابِ رنگِ بخشِ پروژه (آینه‌ی SECTION_PALETTE در projects.js) */
  .secswatch { display: inline-flex; align-items: center; border-radius: 999px; border: none;
    width: 26px; height: 26px; cursor: pointer; }
  .sc-blue   { background: #3b82f6; } .sc-green  { background: #16a34a; }
  .sc-amber  { background: #d97706; } .sc-red    { background: #dc2626; }
  .sc-violet { background: #7c3aed; } .sc-teal   { background: #0d9488; }
  .sc-pink   { background: #db2777; } .sc-gray   { background: #64748b; }

  /* ====== تسک ۱۹۸: بخش‌های آکاردئونیِ پروژه ====== */
  .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); }
  .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-due { margin-top: 4px; font-size: 11px; color: var(--muted-foreground); display: flex; align-items: center; gap: 4px; }
  .sec-due.missing, .project-deadline-summary .missing { color: var(--danger); }
  .project-deadline-summary { margin: 4px 0 10px; padding: 8px 10px; border-radius: 9px;
    background: var(--secondary); font-size: 11.5px; color: var(--muted-foreground); }
  .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; }
  /* تب‌های سگمنتیِ داخلِ هر بخش */
  .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; }
  .fbar .f { margin-top: 0; }
  .fchip { cursor: pointer; user-select: none; }
  .fchip.sel { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }

  /* 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; }

  /* فهرستِ کارت‌های مجزا (کارها / گزارش) — هم‌زبانِ فهرستِ جلسات (.mr-record-list):
     هر کار یک کارتِ مستقل با فاصله، به‌جای ردیف‌های چسبیده با خطِ جداساز. اندازه‌ی
     متن دست نمی‌خورد تا فشردگیِ فعلیِ فهرست حفظ شود؛ فقط قاب عوض می‌شود. */
  .cardlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .cardlist > .item { background: var(--card-bg); color: var(--card-foreground);
    border: 1px solid var(--border-c); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 11px 13px;
    transition: border-color .15s, box-shadow .15s; }
  .cardlist > .item:hover { border-color: color-mix(in srgb, var(--primary) 38%, var(--border-c));
    box-shadow: var(--shadow); }
  /* لبه‌ی کهرباییِ «در انتظار بررسی مدیر» باید هم‌قدِ کارت و چسبیده به لبه‌اش باشد،
     نه یک خطِ شناور وسطِ padding. */
  .cardlist > .item.review { border-inline-start: 2px solid var(--warn); padding-inline-start: 12px; }
  /* متنِ گزارش در فهرستِ «در انتظار تأیید» — جعبه‌ی نقل‌قول، نه کارتِ تودرتو */
  .quotebox { margin-top: 6px; padding: 7px 9px; border-radius: 9px;
    background: var(--secondary); border-inline-start: 2px solid var(--border-c);
    font-size: 11.5px; line-height: 1.75; color: var(--foreground);
    white-space: pre-wrap; overflow-wrap: anywhere; }

  /* متنِ کاربر در جزئیاتِ کار (کامنت/گزارش/توضیحات): توکنِ بلندِ بی‌فاصله مثلِ
     لینکِ طولانی باید بشکند تا از عرضِ صفحه بیرون نزند و اسکرولِ افقی نسازد.
     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: 4px; border-radius: 999px; background: var(--secondary); position: relative; direction: ltr; }
  .dlbar .track .elapsed { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
  .dlbar.warn .track .elapsed { background: var(--warn); }
  .dlbar.over .track .elapsed { background: var(--danger); }
  .dlbar .track .review-tail { position: absolute; top: 0; height: 100%; border-radius: 999px;
    background: color-mix(in srgb, #7c3aed 55%, var(--secondary)); }
  .dlbar .report-marker { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%;
    background: #7c3aed; border: 2px solid var(--card-bg); box-shadow: 0 0 0 1px #7c3aed;
    transform: translate(-50%, -50%); }
  .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); }
  .dl-report-note { margin-top: 5px; font-size: 10px; line-height: 1.65; color: #6d28d9; }

  /* ردیفِ فرد: آواتار + متن (تبِ افراد) */
  .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; }
  /* تیم‌های صفحهٔ افراد؛ نام و شمار اعضا بیرون از فهرستِ بازشونده می‌مانند. */
  .people-toolbar { display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
  .people-toolbar h1 { margin-bottom: 2px; }
  .people-toolbar .muted { font-size: 12px; }
  .people-team { border: 1px solid var(--border-c); border-radius: var(--radius);
    background: var(--card-bg); margin-bottom: 10px; overflow: hidden; }
  .people-team > summary { list-style: none; display: flex; align-items: center; gap: 10px;
    padding: 12px; font-size: 14px; color: var(--foreground); cursor: pointer; }
  .people-team > summary::-webkit-details-marker { display: none; }
  .people-team > summary:hover { background: var(--accent); }
  .people-team > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
  .people-team-icon { width: 34px; height: 34px; display: inline-flex; align-items: center;
    justify-content: center; border-radius: 9px; background: var(--accent); color: var(--primary); flex: none; }
  .people-team-icon.unassigned { background: var(--secondary); color: var(--muted-foreground); }
  .people-team-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
  .people-team-count { margin-inline-start: auto; white-space: nowrap; color: var(--muted-foreground); font-size: 12px; }
  .people-team-chevron { flex: none; }
  .people-team[open] > summary .people-team-chevron { transform: rotate(180deg); }
  .people-team[open] > summary { border-bottom: 1px solid var(--border-c); }
  .people-team-body { padding: 0 12px 8px; }
  .people-team-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--border-c); }
  .people-team-tools .people-team-delete { color: var(--danger); margin-inline-start: auto; }
  .people-team-body .prow { padding: 6px 0; border: 0; align-items: center; }
  .people-team-empty { padding: 12px 0; color: var(--muted-foreground); font-size: 12px; }
  .people-team-modal { width: min(480px, 100%); overflow-y: auto; }
  .people-team-modal > label { display: block; font-size: 13px; margin-top: 12px; }
  .people-member-heading { margin-top: 16px; }
  .people-member-hint { font-size: 12px; line-height: 1.8; margin: 6px 0; }
  .people-members { max-height: 38vh; overflow-y: auto; margin: 10px 0 14px; }
  .people-member { display: flex; align-items: center; gap: 10px; padding: 10px 4px;
    border-bottom: 1px solid var(--border-c); cursor: pointer; }
  .people-member[hidden], #pt-no-match[hidden] { display: none; }
  .people-member:last-child { border-bottom: 0; }
  .people-member:has(input:checked) { background: var(--accent); }
  .people-member input { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
  .people-member-info { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
  .people-member-info .muted { font-size: 11px; }
  /* آواتار: عکسِ پروفایلِ تلگرام یا حروفِ اول روی دایره‌ی رنگی (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-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; }

  /* تسک‌های ۲۳۲/۲۷۷/۲۷۹: قفسه‌ی شخصی — سه تبِ کوچکِ داخلی (الگوی تب‌های «گزارش»). */
  #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; }


  /* ====== گفت‌وگوی حبابی (سبکِ واتساپ) ======
     صفحه RTL است: در فلکسِ ردیفی flex-start = راست و flex-end = چپ. حبابِ «من»
     سمتِ راست می‌نشیند و حبابِ طرفِ مقابل سمتِ چپ — همان چیدمانِ واتساپِ فارسی.
     ترتیب زمانی است (قدیم بالا، جدید پایین) و فهرست خودش اسکرول می‌شود، پس
     کامپوزرِ زیرِ آن با اسکرولِ پیام‌ها تکان نمی‌خورد. */
  /* گفت‌وگوی کوتاه جمع‌وجور است؛ پیام‌های زیاد تا ارتفاعِ قبلی رشد می‌کنند. */
  .chatpane { display: flex; flex-direction: column;
    height: auto; min-height: 160px; max-height: max(340px, 68vh);
    border: 1px solid var(--border-c); border-radius: var(--radius);
    background: var(--chat-bg); overflow: hidden; box-shadow: var(--shadow-sm); }
  @supports (height: 68dvh) { .chatpane { max-height: max(340px, 68dvh); } }
  /* در ابتدا و انتهای پیام‌ها، اسکرول عمودی به صفحه ادامه پیدا می‌کند. */
  .chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 10px 10px 4px; overscroll-behavior: contain auto;
    display: flex; flex-direction: column; }
  .cb-log { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
  .chat-empty { text-align: center; padding: 24px 12px; font-size: 13px; }
  .cb-row { display: flex; width: 100%; }
  .cb-row.mine   { justify-content: flex-start; }   /* RTL ⇒ راست */
  .cb-row.theirs { justify-content: flex-end; }     /* RTL ⇒ چپ  */
  .cb { max-width: min(84%, 520px); padding: 8px 11px 6px; border-radius: 14px;
    box-shadow: var(--shadow-sm); font-size: 13.5px; line-height: 1.7; word-break: break-word; }
  /* دُمِ حباب سمتِ خودِ فرستنده تیز می‌ماند: منِ راست ⇒ پایین-راست (end-start در RTL). */
  .cb-row.mine .cb { background: var(--bubble-mine); border-end-start-radius: 4px; }
  .cb-row.theirs .cb { background: var(--bubble-theirs); border: 1px solid var(--border-c);
    border-end-end-radius: 4px; }
  .cb.editing { max-width: 100%; width: 100%; }
  .cb-who { font-size: 11.5px; font-weight: 700; color: var(--accent-foreground); margin-bottom: 2px; }
  .cb-text { white-space: pre-wrap; }
  /* لینکِ داخلِ متنِ کاربر (کامنت/گزارش/توضیحات/گفت‌وگو/یادداشت) — چیپِ ظریفِ
     کلیک‌پذیر و تک‌خطی. متنِ آدرس هرگز وسطِ رشته نمی‌شکند؛ اگر جا نشد با «…» از
     ته بریده می‌شود (JS هم یک سقفِ نویسه دارد، این‌جا برشِ عرض‌محور). */
  .lnk { display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
    vertical-align: bottom; color: var(--link); text-decoration: none;
    background: rgba(127, 127, 127, .13); border-radius: 6px; padding: 0 6px; }
  .lnk:hover { background: rgba(127, 127, 127, .22); }
  .lnk > bdi { direction: ltr; unicode-bidi: isolate; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lnk:hover > bdi { text-decoration: underline; }
  .lnk .ic { width: 11px; height: 11px; flex: none; opacity: .6; }
  .cb-foot { display: flex; align-items: center; gap: 5px; margin-top: 3px;
    font-size: 10.5px; color: var(--muted-foreground); }
  .cb-time { flex: 1 1 auto; min-width: 0; }
  /* تیکِ رسید: یک تیک = ثبت شده ولی ندیده؛ دو تیکِ آبی = دیده. */
  .cb-ticks { flex: none; display: inline-flex; align-items: center; opacity: .55; }
  .cb-ticks .ic { width: 15px; height: 15px; stroke-width: 2.6; }
  .cb-ticks.seen { opacity: 1; color: var(--tick-seen); }
  .cb-foot .btn-icon { padding: 0 3px; min-height: 0; height: 18px; box-shadow: none;
    background: none; border: none; }
  /* رویدادهای لایف‌سایکل (گزارش/تأیید/رد/مرحله): نوارِ وسط‌چینِ سیستمی، نه حباب. */
  .cb-sys { align-self: center; max-width: 92%; text-align: center; font-size: 12px;
    color: var(--muted-foreground); background: var(--secondary); border-radius: 10px;
    padding: 6px 11px; }
  /* کامپوزر: کفِ پنلِ چت، جدا با یک خط، و همیشه دیده می‌شود. */
  .chatpane .composer { flex: 0 0 auto; margin: 0; border: none; border-radius: 0;
    border-top: 1px solid var(--border-c); box-shadow: none;
    background: var(--chat-bg); padding: 10px; max-height: 46%; overflow-y: auto; }
  .chatpane .composer textarea { min-height: 42px; }
  /* ورودیِ پیام به سبک واتساپ؛ در RTL دکمه‌ی گرد سمت چپِ کادر است. */
  .message-compose { display: flex; align-items: flex-end; gap: 8px; min-width: 0;
    --compose-action: #008b76; }
  .dark .message-compose { --compose-action: #00a884; }
  .message-compose-field { display: flex; align-items: flex-end; flex: 1 1 auto;
    min-width: 0; min-height: 48px; border: 1px solid var(--border-c); border-radius: 24px;
    background: var(--card-bg); box-shadow: var(--shadow-sm); overflow: hidden; }
  .message-compose-field:focus-within { border-color: var(--compose-action);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--compose-action) 15%, transparent); }
  textarea.f.message-compose-text { flex: 1 1 auto; min-width: 0; min-height: 46px;
    max-height: 94px; margin: 0; padding: 11px 14px; border: 0; border-radius: 0;
    background: transparent; color: var(--fg); font-size: 15px; line-height: 24px;
    resize: none; overflow-y: auto; outline: none; box-shadow: none; }
  textarea.f.message-compose-text::placeholder { color: var(--muted-foreground); }
  button.message-compose-attach { display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 44px; width: 44px; height: 46px; padding: 0; margin: 0 0 0 4px;
    border: 0; border-radius: 50%; background: transparent; color: var(--muted-foreground);
    box-shadow: none; }
  button.message-compose-attach:hover { color: var(--compose-action); background: var(--secondary); }
  button.message-compose-action { display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 48px; width: 48px; height: 48px; min-height: 48px; padding: 0;
    border: 0; border-radius: 50%; background: var(--compose-action); color: #fff;
    box-shadow: var(--shadow-sm); }
  button.message-compose-action:hover { filter: brightness(.94); }
  button.message-compose-action:disabled { opacity: .55; cursor: default; }
  .message-compose-action .ic { width: 23px; height: 23px; margin: 0; vertical-align: 0; }
  .message-compose-attach .ic { width: 22px; height: 22px; margin: 0; vertical-align: 0; }
  .message-compose button:focus-visible { outline: 2px solid var(--compose-action); outline-offset: 3px; }
  .message-compose-action.is-sending .ic { animation: compose-spin 1s linear infinite; }
  @keyframes compose-spin { to { transform: rotate(360deg); } }
  .message-compose-file { display: flex; align-items: center; gap: 7px; min-width: 0;
    margin-top: 8px; padding: 5px 8px; border: 1px solid var(--border-c);
    border-radius: 12px; background: var(--card-bg); color: var(--muted-foreground); font-size: 12px; }
  .message-compose-file > span { flex: 1 1 auto; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .message-compose-file > .ic, .message-compose-file > button { flex: none; }
  .message-compose-file > button { padding: 4px; border: 0; background: transparent; }
  @media (prefers-reduced-motion: reduce) { .message-compose-action.is-sending .ic { animation: none; } }
  .message-compose-shell { min-width: 0; --compose-action: #008b76; }
  .dark .message-compose-shell { --compose-action: #00a884; }
  .voice-compose { padding: 12px; border-radius: 24px; background: var(--card-bg);
    border: 1px solid var(--border-c); box-shadow: var(--shadow-sm); }
  .voice-compose-live { display: flex; align-items: center; gap: 10px; height: 42px; direction: ltr; }
  .voice-compose-time { flex: none; min-width: 54px; font-size: 20px; font-variant-numeric: tabular-nums; }
  .voice-compose-live canvas { flex: 1; min-width: 0; width: 100%; height: 30px; color: var(--muted-foreground); }
  .voice-compose-live .rec-dot { flex: none; width: 7px; height: 7px; }
  .voice-compose-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; direction: ltr; }
  .voice-compose-controls button { height: 48px; border: 0; padding: 0; }
  .voice-compose-controls .ic { width: 23px; height: 23px; margin: 0; vertical-align: 0; }
  .voice-compose-delete { display: flex; align-items: center; justify-content: center;
    width: 48px; flex: 0 0 48px; border-radius: 50%; background: var(--danger-bg); color: var(--danger-fg2); }
  .voice-compose-toggle { display: flex; align-items: center; justify-content: center; gap: 10px;
    flex: 1; min-width: 0; border-radius: 999px; direction: rtl; background: var(--secondary); color: var(--fg); }
  .voice-compose.is-paused .voice-compose-toggle { background: var(--bubble-mine); color: var(--compose-action); }
  .voice-compose button:focus-visible { outline: 2px solid var(--compose-action); outline-offset: 3px; }
  .voice-compose-preview { min-width: 0; min-height: 42px; }
  .voice-compose-preview .ap { min-width: 0; width: 100%; padding: 0; border: 0;
    background: transparent; box-shadow: none; direction: ltr; }
  .voice-compose-preview .ap-rate { display: none; }
  .voice-compose .voice-compose-preview .ap { --ap-on: var(--compose-action);
    --ap-off: color-mix(in srgb, var(--muted-foreground) 45%, transparent); }
  .voice-compose-preview .ap-mid { display: flex; align-items: center; gap: 10px; }
  .voice-compose-preview .ap-wave { flex: 1; min-width: 0; }
  .voice-compose-preview .ap-play { flex: 0 0 40px; width: 40px; height: 40px;
    background: transparent; color: var(--fg); }
  .voice-compose-preview .ap-play .ic { width: 25px; height: 25px; }
  .voice-compose-preview .ap-times { flex: none; font-size: 20px; min-width: 54px; direction: ltr; }
  .voice-compose-preview .ap-cur { display: none; }
  .voice-compose.is-pending { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 8px; }
  .voice-compose.is-pending .voice-compose-preview { flex: 1; }
  .voice-compose.is-pending .voice-compose-controls { margin: 0; }
  .voice-compose.is-pending [data-voice-toggle], .voice-compose.is-pending [data-voice-send] { display: none; }

  /* صفحهٔ چت‌بات تمام viewport را می‌گیرد؛ فقط فهرستِ پیام‌ها اسکرول می‌شود. */
  body:has(.chat-screen) { overflow: hidden; }
  body:has(.chat-screen) .theme-fab { display: none; }
  .wrap:has(.chat-screen) > :not(#view) { display: none; }
  .chat-screen { position: fixed; inset: 0; top: var(--chat-top, 0px); bottom: auto;
    z-index: 10; height: var(--chat-height, 100dvh); display: flex; flex-direction: column;
    background-color: #efeae2; color: var(--fg); overflow: hidden;
    background-image: radial-gradient(rgba(112, 128, 111, .10) .8px, transparent .8px);
    background-size: 18px 18px; }
  .dark .chat-screen { background-color: #0b141a;
    background-image: radial-gradient(rgba(134, 150, 143, .10) .8px, transparent .8px); }
  .chat-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: 70px;
    padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 10px
      max(10px, env(safe-area-inset-left, 0px)); background: var(--card-bg); border-bottom: 1px solid var(--border-c); }
  .chat-head-icon, .chat-menu summary { width: 40px; height: 40px; flex: 0 0 40px;
    display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%;
    background: transparent; color: var(--fg); cursor: pointer; }
  .chat-head .ic { width: 21px; height: 21px; margin: 0; }
  .chat-head-icon:hover, .chat-menu summary:hover { background: var(--secondary); }
  .chat-avatar { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
    background: var(--bubble-mine); border-radius: 50%; color: #008b76; }
  .chat-avatar .ic { width: 26px; height: 26px; }
  .chat-head-title { flex: 1; min-width: 0; }
  .chat-head-title h1 { margin: 0; font-size: 16px; }
  .chat-head-title span { display: block; color: var(--muted-foreground); font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-menu { position: relative; }
  .chat-menu summary { list-style: none; }
  .chat-menu summary::-webkit-details-marker { display: none; }
  .chat-menu-items { position: absolute; top: 46px; left: 0; z-index: 2; width: 200px;
    padding: 6px; background: var(--popover); border: 1px solid var(--border-c); border-radius: 14px; box-shadow: var(--shadow-lg); }
  .chat-menu-items button { display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 8px; background: transparent; color: var(--fg); text-align: right; font-size: 13px; }
  .chat-menu-items button:hover { background: var(--secondary); }
  .chat-screen .chat-log { flex: 1; min-height: 0; max-height: none; overflow-y: auto;
    overscroll-behavior: contain; padding: 18px max(14px, calc((100vw - 900px) / 2)); gap: 10px; }
  .chat-screen .bubble { flex: none; max-width: min(86%, 720px); padding: 9px 12px;
    border-radius: 12px; box-shadow: var(--shadow-sm); line-height: 1.7; }
  .chat-screen .bubble.user { background: var(--bubble-mine); color: var(--fg); border-top-right-radius: 3px; }
  .chat-screen .bubble.bot { background: var(--bubble-theirs); border: 0; border-top-left-radius: 3px; }
  .chat-screen .bubble.user .progress { background: var(--border-c); }
  .chat-screen .bubble.user .progress > div { background: #008b76; }
  .chat-screen .bubble.user .attach-prog-cancel { color: var(--fg); border-color: var(--border-c); }
  .chat-composer { flex: none; width: 100%; padding: 10px max(10px, calc((100vw - 900px) / 2))
      max(10px, env(safe-area-inset-bottom, 0px)); background: var(--chat-bg); }
  .chat-composer .message-compose-file { margin-top: 0; margin-bottom: 8px; }
  .chat-welcome { align-self: center; margin: auto 0; padding: 22px; text-align: center;
    max-width: 320px; border-radius: 24px; background: var(--card-bg); box-shadow: var(--shadow-sm); }
  .chat-welcome-icon { display: grid; place-items: center; width: 58px; height: 58px;
    margin: 0 auto; border-radius: 50%; background: var(--bubble-mine); color: #008b76; }
  .chat-welcome-icon .ic { width: 30px; height: 30px; }
  .chat-welcome h2 { font-size: 16px; margin: 12px 0 6px; }
  .chat-welcome p { color: var(--muted-foreground); font-size: 13px; margin: 0; }
  /* ردیفِ «یادآور پیگیری» زیرِ دکمه‌ی ارسال — یک خطِ کم‌ارتفاع تا کامپوزر شلوغ نشود. */
  .fu-row { display: flex; align-items: center; gap: 6px; margin-top: 8px;
    font-size: 12px; color: var(--muted-foreground); cursor: pointer; user-select: none; }
  .fu-row input { flex: none; width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
  .fu-row .ic { width: 14px; height: 14px; vertical-align: -2px; }
  .fu-when { margin-inline-start: auto; font-weight: 700; color: var(--accent-foreground);
    font-size: 11.5px; white-space: nowrap; }

  /* ====== پخش‌کننده‌ی صوتیِ سفارشی (waveform + سرعت + seek) ====== */
  .ap { --ap-on: var(--accent-foreground); --ap-off: rgba(127,127,127,.38);
    display: flex; align-items: center; gap: 9px; min-width: 200px; }
  .ap-play { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--btn); color: var(--btn-fg); border: none; box-shadow: var(--shadow-sm); }
  .ap-play .ic { width: 16px; height: 16px; }
  .ap-mid { flex: 1 1 auto; min-width: 0; }
  .ap-wave { height: 30px; cursor: pointer; touch-action: none; }
  .ap-wave canvas { display: block; width: 100%; height: 100%; }
  .ap-wave:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
  .ap-times { display: flex; justify-content: space-between; font-size: 10px;
    color: var(--muted-foreground); font-variant-numeric: tabular-nums; margin-top: 1px; }
  .ap-rate { flex: none; direction: ltr; min-width: 34px; height: 24px; padding: 0 7px; font-size: 11px;
    font-weight: 700; border-radius: 999px; background: var(--secondary);
    color: var(--secondary-foreground); border: 1px solid var(--border-c); box-shadow: none; }
  /* داخلِ حبابِ «من» رنگ‌ها باید روی زمینه‌ی سبز هم خوانا بمانند. */
  .cb-row.mine .ap { --ap-off: rgba(0,0,0,.20); }
  html.dark .cb-row.mine .ap { --ap-off: rgba(255,255,255,.22); }

  /* 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; }

  /* داشبوردِ شخصی (سه بخشِ بالای صفحه) */
  .dash-grid { display: grid; gap: 10px; }
  .dash-grid > .card { min-width: 0; }
  .dash-h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px;
    display: flex; align-items: center; gap: 6px; }
  .dash-h2 .ic { width: 15px; height: 15px; }
  .dash-main { display: flex; align-items: center; gap: 14px; }
  /* حلقه‌ی باز/عقب‌افتاده */
  .donut { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
  .donut svg { width: 80px; height: 80px; transform: rotate(-90deg); }
  .donut circle { fill: none; stroke-width: 9; }
  .donut .dn-open  { stroke: var(--primary); opacity: .7; }
  .donut .dn-over  { stroke: var(--danger); stroke-linecap: round; }
  .donut .dn-empty { stroke: var(--secondary); }
  .donut-c { position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 1px; }
  .donut-c b { font-size: 19px; line-height: 1; font-variant-numeric: tabular-nums; }
  .donut-c span { font-size: 10px; color: var(--muted); }
  /* سه عددِ کنارِ حلقه */
  .dash-stats { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
  .ds { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
  .ds b { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 22px; }
  .ds span { color: var(--muted); }
  .ds.red b { color: var(--danger); }
  .ds.green b { color: var(--ok); }
  .dash-note { font-size: 11.5px; color: var(--muted); margin-top: 10px;
    padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.7; }
  .dash-people { margin-top: 8px; }
  .dash-spark { margin-top: 10px; }
  .dash-spark-h { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .trend.sm { height: 46px; }
  .trend.sm .trend-bars span { width: 14px; }

  /* 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; }
  /* margin-top صفر: وگرنه بلوکِ .field بلندتر از خودِ input می‌شود و آیکون‌های top:50%
     (قفل/چشم) بالاتر از وسطِ فیلد می‌نشینند. */
  .field input.f { padding-inline-start: 40px; height: 48px; border-radius: 13px; text-align: left; margin-top: 0; }
  .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; }
  /* سوییچِ روشِ ورود (کد / رمز) */
  .login-seg { margin: 4px 0 18px; padding: 4px; border-radius: 13px; }
  .login-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 4px; border-radius: 10px; font-size: 12.5px; color: var(--muted-foreground);
    transition: background .18s, color .18s, box-shadow .18s; }
  .login-seg button .ic { width: 15px; height: 15px; }
  .login-seg button[aria-selected="true"] { color: var(--primary); }
  #lg-s1, #lg-s2, #lg-pw, #lg-s3 { animation: lg-in .22s ease-out; }
  @keyframes lg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  /* فیلدِ رمز با دکمه‌ی نمایش/پنهان (سمتِ راستِ فیلدِ LTR) */
  .pw-field input.f { padding-inline-end: 44px; letter-spacing: .02em; }
  .pw-eye { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px;
    width: 36px; height: 36px; padding: 0; border-radius: 10px; display: inline-flex;
    align-items: center; justify-content: center; background: transparent;
    color: var(--muted-foreground); border: 0; cursor: pointer; }
  .pw-eye:hover { background: var(--secondary); color: var(--foreground); }
  .pw-eye, .pw-eye:hover { box-shadow: none; filter: none; }
  .pw-eye:active { transform: translateY(-50%); }
  .pw-eye .ic { width: 18px; height: 18px; }
  .pw-meter { display: flex; align-items: center; gap: 5px; margin: 8px 2px 0; direction: rtl; }
  .pw-meter i { flex: 1; height: 4px; border-radius: 4px; background: var(--secondary); transition: background .2s; }
  .pw-meter span { flex: none; min-width: 70px; font-size: 11.5px; text-align: start; color: var(--muted-foreground); }
  .pw-meter[data-level="-1"] i:first-child { background: var(--danger, #ef4444); }
  .pw-meter[data-level="1"] i:nth-child(-n+1) { background: #f59e0b; }
  .pw-meter[data-level="2"] i:nth-child(-n+2) { background: #22c55e; }
  .pw-meter[data-level="3"] i:nth-child(-n+3) { background: #16a34a; }
  .link-btn { display: inline-flex; align-items: center; gap: 5px; margin-top: 14px; padding: 4px 6px;
    background: transparent; border: 0; color: var(--primary); font: inherit; font-size: 12.5px;
    font-weight: 500; cursor: pointer; }
  .link-btn:hover { text-decoration: underline; }
  .link-btn .ic { width: 14px; height: 14px; }
  /* کارتِ رمز در تنظیمات: سربرگِ یک‌خطی، فرم فقط با کلیک باز می‌شود */
  .pw-card { padding: 14px 16px; }
  .pw-head { display: flex; align-items: center; gap: 12px; }
  .pw-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: inline-flex;
    align-items: center; justify-content: center; color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent); }
  .pw-ico .ic { width: 19px; height: 19px; }
  .pw-txt { flex: 1; min-width: 0; }
  .pw-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
  .pw-txt .muted { font-size: 12px; margin-top: 2px; }
  .pw-head > button { flex: none; }
  .pw-status { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; }
  .pw-status.on { color: var(--success-fg); background: var(--success-bg); }
  .pw-status.off { color: var(--muted-foreground); background: var(--secondary); }
  .pw-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 14px;
    padding-top: 14px; border-top: 1px solid var(--border-c); animation: lg-in .2s ease-out; }
  .pw-form.hidden { display: none; }
  .pw-form .pw-full { grid-column: 1 / -1; }
  .pw-form .field input.f { margin: 0; height: 40px; border-radius: 10px; font-size: 13.5px; }
  .pw-form .field .fic { width: 16px; height: 16px; }
  .pw-form .pw-eye { width: 32px; height: 32px; }
  .pw-form .pw-meter { margin-top: 6px; }
  .pw-form .pw-meter i { height: 3px; }
  .pw-form #pw-code-hint { font-size: 11.5px; margin-top: 5px; }
  .pw-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .pw-actions .link-btn { margin: 0; }
  .pw-actions .pw-del { margin-inline-start: auto; color: var(--danger-fg2); }
  .pw-code input.f { text-align: center; letter-spacing: .3em; font-weight: 700; }
  @media (max-width: 520px) { .pw-form { grid-template-columns: 1fr; } }
  /* دکمه‌ی شناورِ تغییرِ تم (فقط در مرورگر — خارج از اپِ تلگرام) */
  .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"], .seg button[aria-selected="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; }
  /* Voiceprintِ ثبت‌شده یک تنظیمِ کم‌تغییر است؛ پس در حالتِ عادی فقط وضعیتِ فشرده
     نشان داده می‌شود و کارهای حساسِ ضبط دوباره/حذف پشتِ آکاردئون می‌مانند. */
  .vp-card-ready { margin-bottom: 12px; background: var(--card-bg); color: var(--card-foreground);
    border: 1px solid var(--border-c); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
  .vp-card-ready > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex;
    align-items: center; gap: 8px; user-select: none; }
  .vp-card-ready > summary::-webkit-details-marker { display: none; }
  .vp-card-ready > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
  .vp-summary-title { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; }
  .vp-summary-state { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 2px 7px;
    border-radius: 999px; background: var(--success-bg); color: var(--success-fg); font-size: 11.5px; font-weight: 600; }
  .vp-summary-state .ic { width: 13px; height: 13px; }
  .vp-chevron { color: var(--muted); transition: transform .16s ease; }
  .vp-card-ready[open] .vp-chevron { transform: rotate(180deg); }
  .vp-card-body { border-top: 1px solid var(--border-c); padding: 0 12px 12px; }
  /* تاریخچهٔ تحویلِ پیامک فقط در صورت نیاز باز می‌شود تا کارتِ تنظیمات کوتاه بماند. */
  .sms-log-details { margin-top: 12px; border-top: 1px solid var(--border-c); }
  .sms-log-details > summary { list-style: none; cursor: pointer; padding: 9px 0 3px; display: flex;
    align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; user-select: none; }
  .sms-log-details > summary::-webkit-details-marker { display: none; }
  .sms-log-details > summary > span { flex: 1 1 auto; }
  .sms-log-details > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
  .sms-log-chevron { color: var(--muted); transition: transform .16s ease; }
  .sms-log-details[open] .sms-log-chevron { transform: rotate(180deg); }
  .sms-log-details > #sms-log { padding-top: 5px; }
  /* متنِ گوینده‌دار: هر نوبت یک ردیف با چیپِ قابل‌تغییرِ گوینده */
  .tr-turns { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto;
    border: 1px solid var(--border-c); border-radius: 12px; padding: 6px; }
  .tr-turn { padding: 8px 10px; border-radius: 10px; border-inline-start: 3px solid var(--spk); }
  .tr-turn:hover { background: var(--muted-surface); }
  .tr-spk { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--spk) 12%, transparent);
    color: var(--spk); font-size: 12.5px; font-weight: 600; cursor: pointer; }
  .tr-spk:focus-within { outline: 2px solid var(--ring); outline-offset: 1px; }
  .tr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--spk); flex: none; }
  .tr-spk .pp { margin: 0; max-width: 60vw; }
  .tr-spk .pp-btn { height: auto; min-height: 0; padding: 1px 0; gap: 6px; border: 0; border-radius: 999px; background: transparent;
    box-shadow: none; color: inherit; }
  .tr-spk .pp-btn:focus-visible { box-shadow: none; }
  .tr-spk .pp-btn .pp-name { font-size: 12.5px; color: inherit; }
  .tr-spk .pp-btn .pp-sub { display: none; }
  .tr-spk .pp-btn .avatar.pp-av { width: 20px; height: 20px; font-size: 9px; }
  .tr-spk .pp-chev { color: inherit; }
  .tr-text { margin-top: 4px; font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
  .tr-note { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0; padding: 8px 10px; border-radius: 10px;
    background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd); font-size: 12.5px; }
  /* آرشیوِ جلسات */
  .arc-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
  .arc-spacer { flex: 1; }
  .arc-row { display: block; width: 100%; text-align: start; color: inherit; font: inherit; cursor: pointer; }
  .arc-title { font-weight: 700; font-size: 14.5px; }
  .arc-meta { font-size: 12px; margin-top: 2px; }
  .arc-topic { font-size: 13px; margin-top: 6px; line-height: 1.7; }
  .arc-people { font-size: 12px; margin-top: 4px; }
  .arc-snippet { font-size: 12.5px; margin-top: 6px; padding: 6px 8px; border-radius: 8px;
    background: var(--muted-surface); line-height: 1.7; overflow-wrap: anywhere; }
  .arc-row mark, .arc-snippet mark { background: var(--warn-bd); color: inherit; border-radius: 3px; padding: 0 2px; }
  .arc-spk { padding: 2px 8px; cursor: default; }
  .arc-field { display: block; margin: 8px 0; font-size: 13px; }
  .arc-field .f { margin-top: 4px; }
  .arc-transcript { margin-top: 8px; max-height: 70vh; overflow-y: auto; }
  .arc-turn-edit { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
  .arc-turn-edit input.f { max-width: 240px; font-weight: 600; }
  /* پیش‌نمایشِ زنده */
  .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; }
  /* در صفحه‌ی گفت‌وگو، دکمه‌ی شناورِ تم (چپ-پایین) یا روی دکمه‌ی «ارسال کامنت» می‌افتد
     یا روی خودِ پیام‌ها — هر دو بد است و جای امنی هم نمانده. چون انتخابِ تم در
     localStorage می‌ماند و از هر صفحه‌ی دیگری قابلِ تغییر است، این‌جا پنهانش می‌کنیم. */
  body:has(.chatpane) .theme-fab { display: none; }
  /* رنگِ نقش */
  .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; }

  /* گفت‌وگو زیرِ درخواستِ جلسه (تسک ۱۰۰/ویسِ ۴۸۸) — مذاکره‌ی مدیر و درخواست‌دهنده
     قبل از تأیید. دو طرفه است، پس مثلِ چت پیامِ خودی و طرفِ مقابل تفکیک می‌شوند. */
  .mr-talk-list { display: flex; flex-direction: column; gap: 9px; }
  .mr-msg { border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px;
    background: var(--bg); max-width: 92%; align-self: flex-end; }
  .mr-msg.mine { align-self: flex-start; background: var(--card);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
  .mr-msg-h { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
  .mr-msg-who { font-size: 12.5px; font-weight: 600; }
  .mr-msg-t { font-size: 11.5px; margin-inline-start: auto; }
  .mr-msg-b { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.85; }
  .mr-msg .mr-msg-del { padding: 2px 5px; line-height: 1; }
  .mr-talk-send { display: flex; gap: 7px; align-items: flex-end; margin-top: 10px; }

  /* ===== درخواست جلسه (تسک ۱۰۰ — بازطراحیِ ۲۷ مرداد ۱۴۰۵) ===== */
  .mr-page-head { margin-bottom: 12px; align-items: flex-start; }
  .mr-page-head h1 { margin: 0; }
  .mr-page-head > div { min-width: 0; }
  .mr-manage-open { margin: 0 0 12px; }
  .mr-primary-wide { width: 100%; min-height: 46px; display: inline-flex; align-items: center;
    justify-content: center; gap: 7px; }
  .mr-empty { text-align: center; padding: 24px; color: var(--muted); }
  .mr-record-list { display: flex; flex-direction: column; gap: 8px; }
  button.mr-record { width: 100%; text-align: right; color: var(--fg); margin: 0;
    background: var(--card); padding: 12px 13px; }
  button.mr-record:hover { border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
    box-shadow: var(--shadow-sm); }
  .mr-record .title, .mr-record strong { min-width: 0; overflow-wrap: anywhere; }
  .mr-record-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px;
    color: var(--muted); font-size: 12.5px; margin-top: 7px; }
  .mr-record-meta > span { display: inline-flex; align-items: center; gap: 4px; }
  .mr-record-meta .mr-priority-meta { color: var(--fg); font-weight: 700; }
  .mr-record-note { font-size: 12.5px; margin-top: 6px; }
  /* ظرفِ بج‌های کنارِ عنوان — spread فرزندها را پخش می‌کند، پس باید یکی باشند. */
  .mr-badges { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
  /* جلسه‌ی «تأیید شده»ای که وقتش گذشته: کم‌رنگ، ولی نه آن‌قدر که ناخوانا شود.
     روی هاور کاملاً برمی‌گردد، چون هنوز قابلِ بازکردن است. */
  button.mr-record.is-past { opacity: 0.62; }
  button.mr-record.is-past:hover, button.mr-record.is-past:focus-visible { opacity: 1; }
  /* چهار دسته‌ی چرخه‌ی جلسه (منتظر تأیید / منتظر زمان‌بندی / تأیید شده / لغوشده) */
  .mr-bucket { margin-top: 18px; }
  .mr-bucket:first-of-type { margin-top: 12px; }
  .mr-bucket-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
    font-size: 13.5px; font-weight: 700; }
  .mr-bucket-head .ic { color: var(--primary); }
  .mr-bucket-head > span:first-of-type { margin-inline-end: 2px; }
  /* «نمایش بیشتر» هر دسته — صفحه‌بندیِ سمت‌سرورِ همان دسته */
  .mr-more { width: 100%; margin: 8px 0 0; display: inline-flex; align-items: center;
    justify-content: center; gap: 6px; font-size: 12.5px; }
  .mr-more .muted { font-size: 11.5px; }
  /* خطِ «ثبت: … · تأیید: …» زیرِ عنوانِ جلسه */
  .mr-dates { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
    color: var(--muted); font-size: 11.5px; margin-top: 5px; }
  .mr-dates .ic { width: 13px; height: 13px; margin-inline-end: 2px; vertical-align: -2px; }
  .mr-dates-sep { opacity: .55; }
  .mr-det-head { padding: 13px; }
  .mr-det-head .title { font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
  /* فرمِ مشترکِ ثبت/ویرایش */
  .mr-field { display: block; margin-bottom: 16px; }
  .mr-field > span { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 650; }
  .mr-field > label:not(.ghost) { display: flex; align-items: center; gap: 4px;
    font-size: 13.5px; font-weight: 650; }
  .mr-field > span b { color: var(--danger); }
  .mr-field > label:not(.ghost) b { color: var(--danger); }
  .mr-field small { display: block; color: var(--muted); margin-top: 4px; font-size: 11.5px; }
  /* راهنمای کوتاهِ زیرِ فیلد (زمان‌های پیشنهادی، وضعیتِ ایمیلِ حاضرین) */
  .mr-hint { margin-top: 4px; margin-bottom: 6px; font-size: 11.5px; line-height: 1.7; }
  .mr-field input:focus, .mr-field textarea:focus, .mr-field select:focus { outline: none;
    border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent); }
  .mr-form-card { padding: 15px; }
  .mr-file { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
  .mr-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
  .mr-priority-chips, .mr-duration-chips { margin: 7px 0 0; }
  .mr-att-options { max-height: 152px; overflow: auto; margin-top: 7px; }
  .mr-dashboard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mr-dashboard-stats .card { margin: 0; text-align: center; padding: 10px 5px; }
  .mr-dashboard-stats strong { display: block; font-size: 21px; color: var(--primary); }
  .mr-dashboard-stats span { display: block; font-size: 10.5px; color: var(--muted); }
  /* نوارِ ضبط/پیش‌نمایشِ پیامِ صوتیِ گفت‌وگو */
  .mr-rec-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 7px 9px;
    border: 1px solid var(--border); border-radius: 11px; background: var(--secondary); font-size: 12.5px; }
  .mr-rec-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--danger);
    flex: none; animation: mr-rec-pulse 1.1s ease-in-out infinite; }
  @keyframes mr-rec-pulse { 50% { opacity: .25; } }

  @media (max-width: 460px) {
    .mr-page-head .muted { font-size: 11.5px; }
    .mr-page-head > button { flex: none; }
    .mr-dashboard-stats { gap: 5px; }
    .mr-dashboard-stats strong { font-size: 18px; }
    .mr-rec-bar { flex-wrap: wrap; }
  }

  @media (prefers-reduced-motion: reduce) {
    .mr-rec-dot { animation: none; }
  }

  /* انتخابِ دامنه‌ی دید (ویسِ علوی): تا امروز هر سه گزینه تقریباً هم‌شکل بودند و
     این حس را می‌داد که نقش هر سه دسترسی را دارد. حالا انتخاب‌شده پُر و تیک‌دار
     است و دو تای دیگر آشکارا کم‌رنگ — «انتخاب‌شده» با «موجود» اشتباه نمی‌شود. */
  .seg.seg-pick button { display: flex; align-items: center; justify-content: center; gap: 5px;
    opacity: .5; font-weight: 500; }
  .seg.seg-pick button .seg-check { display: none; }
  .seg.seg-pick button .seg-check svg { width: 14px; height: 14px; }
  .seg.seg-pick button[aria-pressed="true"] { background: var(--primary);
    color: var(--primary-foreground); opacity: 1; font-weight: 800;
    box-shadow: var(--shadow-sm); }
  .seg.seg-pick button[aria-pressed="true"] .seg-check { display: inline-flex; }
  .seg.seg-pick button:hover { opacity: .85; }
  .seg.seg-pick button[aria-pressed="true"]:hover { opacity: 1; }
  .scope-now { margin-top: 9px; display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--fg); }
  .scope-now svg { width: 15px; height: 15px; color: var(--primary); }

  /* ===== تنظیمات: ردیفِ دسته‌ها (حساب من / سازمان / دسترسی / سرویس‌ها) ===== */
  .set-cats { margin: 0 0 12px; }
  .set-cats button { display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    white-space: nowrap; padding: 8px 4px; min-width: 0; }
  .set-cats button .ic { width: 15px; height: 15px; flex: none; }
  .set-cats button span { overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 360px) { .set-cats button { font-size: 12px; gap: 4px; } }
  .scope-now b { color: var(--primary); }

/* ضبطِ مستقیمِ جلسه (meeting-recorder.js) — ظاهرِ رکوردرِ واقعی */
.mrec { margin-bottom: 14px; --mrec-red: #ef3b3b; --mrec-bar: var(--mrec-red); --mrec-idle: #a1a1aa; }
.mrec-deck { position: relative; text-align: center; padding: 10px 12px 10px; border-radius: 16px;
  background: radial-gradient(120% 90% at 50% 0%, var(--accent) 0%, transparent 70%), var(--muted-surface, var(--card));
  border: 1px solid var(--border-c, var(--border)); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.mrec-deck.is-live { border-color: rgba(239,59,59,.45); box-shadow: 0 0 0 4px rgba(239,59,59,.08); }
.mrec-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--card, var(--bg)); border: 1px solid var(--border-c, var(--border)); }
.is-live .mrec-status { color: var(--mrec-red); }
.mrec-clock { font-size: 30px; font-weight: 500; letter-spacing: 1px; line-height: 1.1; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; direction: ltr; }
.mrec-clock.dim { opacity: .35; }
.mrec-wave { display: block; width: 100%; height: 34px; margin: 2px 0 4px; }
.mrec-transport { display: flex; justify-content: center; align-items: flex-start; gap: 20px; margin: 6px 0 2px; }
.mrec-ctl { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-foreground, inherit); min-width: 54px; }
.mrec-btn { border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease; }
.mrec-btn:active { transform: scale(.93); }
.mrec-btn.side { width: 40px; height: 40px; margin-top: 8px; background: var(--card, var(--bg)); color: var(--fg);
  border: 1px solid var(--border-c, var(--border)); box-shadow: var(--shadow-sm); }
.mrec-btn.side svg { width: 17px; height: 17px; }
.mrec-btn.main { width: 56px; height: 56px; background: var(--card, #fff); border: 3px solid var(--border-c, var(--border));
  box-shadow: var(--shadow); }
.mrec-btn.main.send, .mrec-btn.side.send { background: var(--btn); color: var(--btn-fg, #fff); border-color: transparent; }
.mrec-btn.main.send svg { width: 22px; height: 22px; }
.mrec-rd { width: 24px; height: 24px; border-radius: 50%; background: var(--mrec-red); display: block;
  box-shadow: 0 2px 10px rgba(239,59,59,.45); }
.mrec-btn.side .mrec-rd { width: 15px; height: 15px; }
.mrec-btn.rec { animation: mrec-breathe 2.4s ease-in-out infinite; }
.mrec-btn.stop { border-color: rgba(239,59,59,.35); animation: mrec-ring 1.6s ease-out infinite; }
.is-paused .mrec-btn.stop { animation: none; }
.mrec-sq { width: 19px; height: 19px; border-radius: 5px; background: var(--mrec-red); display: block; }
@keyframes mrec-breathe { 50% { box-shadow: 0 0 0 6px rgba(239,59,59,.12), var(--shadow); } }
@keyframes mrec-ring { 0% { box-shadow: 0 0 0 0 rgba(239,59,59,.35); } 100% { box-shadow: 0 0 0 9px rgba(239,59,59,0); } }
.mrec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mrec-red, #ef3b3b); display: inline-block;
  animation: mrec-blink 1.2s ease-in-out infinite; flex: none; }
.mrec-dot.paused { background: var(--warn); animation: none; }
.mrec-float { padding: 10px; text-align: center; }
.mrec-float .row { justify-content: center; margin-top: 8px; }
.mrec-float .mrec-clock { font-variant-numeric: tabular-nums; }
.meeting-recent-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: start; }
.meeting-recent-row span { min-width: 0; overflow-wrap: anywhere; }
.meeting-recent-row .muted { display: block; font-size: 12px; }
.meeting-drafts > summary { cursor: pointer; }
.meeting-drafts > #m-history { margin-top: 8px; }
@keyframes mrec-blink { 50% { opacity: .25; } }
@media (max-width: 1023px) { .mrec-tab-dot { margin-inline-start: 6px; } }
@media (prefers-reduced-motion: reduce) { .mrec-tab-dot { animation: none; } }
.mrec-safe { font-size: 11px; color: var(--muted-foreground, inherit); opacity: .85; margin-top: 4px; line-height: 1.7; }
.mrec-safe svg { width: 13px; height: 13px; vertical-align: -2px; }
.mrec-note { margin: 4px auto 8px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; background: var(--card, var(--bg));
  border: 1px solid var(--border-c, var(--border)); max-width: 420px; }
.mrec-warn { margin-top: 8px; font-size: 12.5px; color: var(--danger); }
.mrec-foot { font-size: 11px; color: var(--muted-foreground, inherit); margin-top: 4px; }
.mrec-link { background: none; border: 0; color: var(--danger); padding: 0 4px; font-size: 11.5px; cursor: pointer; box-shadow: none; }
.mrec-link svg { width: 12px; height: 12px; vertical-align: -2px; }
.mrec-pill { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 6px; border-radius: 999px; padding: 8px 14px; box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.2)); }

  /* انتخاب‌گرِ افراد (مسئول/درخواست‌دهنده): جایگزینِ dropdownِ مرورگر — آواتار + نام + سمت + جست‌وجو */
  .pp { position: relative; min-width: 0; margin-top: 8px; }
  .fbar .pp, .row .pp { margin-top: 0; }
  select.pp-native { display: none !important; }
  .pp-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: start;
    padding: 7px 11px; min-height: 44px; font: inherit; font-weight: 400; cursor: pointer;
    background: var(--background); color: var(--foreground);
    border: 1px solid var(--input-c); border-radius: calc(var(--radius) - 2px);
    box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
  .pp-btn:hover { border-color: color-mix(in srgb, var(--ring) 45%, var(--input-c)); }
  .pp.open .pp-btn, .pp-btn:focus-visible { outline: none; border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 32%, transparent); }
  .pp-chev { margin-inline-start: auto; color: var(--muted-foreground); display: inline-flex;
    transition: transform .18s; }
  .pp.open .pp-chev { transform: rotate(180deg); }
  .avatar.pp-av { width: 30px; height: 30px; font-size: 12px; }
  .pp-ico { width: 30px; height: 30px; flex: none; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; background: var(--muted-surface);
    color: var(--muted-foreground); }
  .pp-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .pp-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pp-name.pp-ph { font-weight: 500; color: var(--muted-foreground); }
  .pp-sub { font-size: 11.5px; color: var(--muted-foreground); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .pp-panel { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 60;
    min-width: 240px; background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border-c); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    overflow: hidden; animation: pp-in .14s ease-out; }
  .pp-panel.up { top: auto; bottom: calc(100% + 6px); }
  @keyframes pp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  .pp-search { display: flex; align-items: center; gap: 8px; padding: 8px 11px;
    border-bottom: 1px solid var(--border-c); color: var(--muted-foreground); }
  .pp-q { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent;
    color: var(--foreground); font: inherit; font-size: 14px; padding: 4px 0; }
  .pp-q::-webkit-search-cancel-button { display: none; }
  .pp-list { max-height: min(320px, 46vh); overflow-y: auto; padding: 4px;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .pp-opt { width: 100%; display: flex; align-items: center; gap: 10px; text-align: start;
    padding: 7px 8px; border: 0; border-radius: calc(var(--radius) - 3px); background: transparent;
    color: inherit; font: inherit; font-weight: 400; cursor: pointer; min-height: 44px; }
  .pp-opt:hover, .pp-opt:focus-visible { background: var(--muted-surface); outline: none; }
  .pp-opt.on { background: var(--accent); }
  .pp-opt.on .pp-name { color: var(--accent-foreground); }
  .pp-check { margin-inline-start: auto; color: var(--primary); display: inline-flex; }
  .pp-empty { padding: 14px; text-align: center; font-size: 13px; }

  /* ============================================================ */
  /* راهنمای درون‌برنامه‌ای — دکمه‌ی «i» و تورِ قدم‌به‌قدم (help.js)  */
  /* ============================================================ */
  .help-btn { display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0; margin-inline-start: 2px; flex: none;
    border-radius: 999px; border: 0; background: transparent; color: var(--muted-foreground);
    opacity: .7; cursor: pointer; vertical-align: middle; line-height: 1; box-shadow: none;
    transition: background .15s, color .15s, opacity .15s; }
  .help-btn .ic { width: 15px; height: 15px; }
  .help-btn:hover, .help-btn:focus-visible { opacity: 1; background: var(--accent); color: var(--accent-foreground); filter: none; }
  .help-btn.on { opacity: 1; background: var(--primary); color: var(--primary-foreground); }
  h1 .help-btn, h2 .help-btn, .title .help-btn, .ov-h .help-btn { font-weight: 400; }
  h2 .help-btn { width: 20px; height: 20px; }
  h2 .help-btn .ic { width: 13px; height: 13px; }
  .chat-head .help-btn { width: 40px; height: 40px; flex: 0 0 40px; opacity: 1;
    color: var(--muted-foreground); border-radius: 50%; }
  .chat-head .help-btn .ic { width: 20px; height: 20px; }
  .chat-head .help-btn:hover { background: var(--secondary); color: var(--foreground); }

  /* تورِ قدم‌به‌قدم: پس‌زمینه‌ی تیره + قابِ روشنِ تپنده دورِ هدف + کارتِ توضیح */
  html.tour-open { overflow: hidden; }
  .tour { position: fixed; inset: 0; z-index: 80; }
  .tour.hidden { display: none; }
  .tour.intro { background: rgba(15, 23, 42, .62); animation: tour-fade .2s ease-out; }
  .tour-spot { position: fixed; border-radius: calc(var(--radius) + 2px); pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, .62), 0 0 0 3px var(--primary);
    transition: left .32s cubic-bezier(.2,.8,.2,1), top .32s cubic-bezier(.2,.8,.2,1),
      width .32s cubic-bezier(.2,.8,.2,1), height .32s cubic-bezier(.2,.8,.2,1); }
  .tour-spot::after { content: ""; position: absolute; inset: -3px; border-radius: inherit;
    border: 3px solid var(--primary); animation: tour-pulse 1.6s ease-out infinite; }
  .tour.intro .tour-spot { display: none; }
  @keyframes tour-pulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.12); } }
  @keyframes tour-fade { from { opacity: 0; } to { opacity: 1; } }
  .tour-card { position: fixed; padding: 14px 15px 12px; background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border-c); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg);
    font-size: 14px; line-height: 1.85; transition: left .32s cubic-bezier(.2,.8,.2,1), top .32s cubic-bezier(.2,.8,.2,1); }
  .tour-card.in { animation: tour-in .28s cubic-bezier(.2,.8,.2,1); }
  @keyframes tour-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
  .tour-arrow { position: absolute; left: var(--tour-arrow-x, 24px); top: -7px; width: 13px; height: 13px;
    margin-left: -7px; transform: rotate(45deg); background: var(--popover);
    border-left: 1px solid var(--border-c); border-top: 1px solid var(--border-c); }
  .tour-card.up .tour-arrow { top: auto; bottom: -7px; border: 0;
    border-right: 1px solid var(--border-c); border-bottom: 1px solid var(--border-c); }
  .tour.intro .tour-arrow, .tour-card.flat .tour-arrow { display: none; }
  .tour-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
  .tour-num { flex: none; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
    background: var(--accent); color: var(--accent-foreground); }
  .tour-num:empty { display: none; }
  .tour-title { flex: 1 1 auto; font-weight: 700; font-size: 15px; }
  .tour-x { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px;
    background: transparent; color: var(--muted-foreground); display: inline-flex;
    align-items: center; justify-content: center; box-shadow: none; }
  .tour-x .ic { width: 16px; height: 16px; }
  .tour-x:hover { background: var(--secondary); color: var(--foreground); filter: none; }
  .tour-body b { font-weight: 650; }
  .tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
  .tour-dots { flex: 1 1 auto; display: flex; gap: 5px; flex-wrap: wrap; }
  .tour-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--border-c); transition: width .2s, background .2s; }
  .tour-dots i.on { width: 18px; background: var(--primary); }
  .tour-foot .hidden { display: none; }
  @media (prefers-reduced-motion: reduce) {
    .tour-spot, .tour-card { transition: none; }
    .tour-spot::after, .tour-card.in, .tour.intro { animation: none; }
  }

/* Private scheduling uses the same card, chips and voice composer as the rest of the miniapp. */
.mr-coordination > summary { display:flex; align-items:center; flex-wrap:wrap; gap:8px; cursor:pointer; list-style:none; min-height:36px; }
.mr-coordination > summary::-webkit-details-marker { display:none; }
.mr-coordination > summary > span:first-child { font-weight:650; display:flex; align-items:center; gap:6px; }
.mr-coordination > summary::after { content:'‹'; margin-inline-start:auto; font-size:22px; color:var(--muted); }
.mr-coordination[open] > summary::after { transform:rotate(-90deg); }
.mr-coordination > summary:focus-visible, .mr-rules > summary:focus-visible { outline:2px solid var(--ring); outline-offset:4px; border-radius:var(--radius); }
.mr-coord-status { font-size:12px; }
.mr-coord-unread { font-size:11px; }
.mr-coord-body { padding-top:10px; }
.mr-coord-privacy { font-size:12px; margin:0 0 10px; }
.mr-coord-suggestions { display:flex; gap:6px; flex-wrap:wrap; }
.mr-coord-suggestions .jdp-chip { white-space:normal; text-align:start; font-size:12px; }
.mr-coord-tools { gap:6px; margin:8px 0 12px; flex-wrap:wrap; }
.mr-coord-messages { max-height:360px; overflow-y:auto; overscroll-behavior:auto; padding:6px; }
.mr-coord-proposal { display:grid; gap:7px; margin-top:6px; }
.mr-coord-proposal button { justify-self:start; }
.mr-rules { margin-top:12px; padding-top:10px; border-top:1px solid var(--border); }
.mr-rules > summary { cursor:pointer; font-size:13px; }
.mr-rules-body { margin-top:10px; }
.mr-rules-body > label { display:block; font-size:13px; margin-bottom:10px; }

/* ====== بازبینیِ اکشن‌های جلسه (قراردادِ استخراجِ v2) ====== */
.mtg-review, .mtg-review .item { min-width: 0; overflow-wrap: anywhere; }
.mtg-review select.f { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.mtg-banner { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-bottom: 10px;
  border-radius: 12px; border: 1px solid; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.mtg-banner > .ic { flex: none; margin-top: 3px; }
.mtg-banner.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.mtg-banner.bad { background: var(--danger-bg); color: var(--danger-fg2); border-color: var(--danger-bd); border-width: 2px; }
.mtg-banner-sub { margin-top: 4px; font-weight: 600; }
.mi-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.mi-badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 6px; }
.mi-badges .pill { display: inline-flex; align-items: center; gap: 3px; }
.mi-sp { flex: 1 1 auto; }
.mi-ok[aria-pressed="true"] { color: var(--muted-foreground); }
.mi-reasons { margin: 0 0 6px; padding-inline-start: 18px; font-size: 12.5px; color: var(--warn-fg); }
.mi-reasons li { margin: 1px 0; }
.mi-cands { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 6px 0 4px; font-size: 12.5px; }
.mi-cand[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.mi-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.mi-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 9px;
  border-radius: 999px; font-size: 12px; background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd); }
.mi-chip-x { background: transparent; color: inherit; padding: 0 3px; border-radius: 999px; line-height: 1; display: inline-flex; }
.mi-chip-x .ic { width: 13px; height: 13px; }
.mtg-review input.f.d.nodue { color: var(--muted-foreground); }
.mi-sim { margin-top: 8px; padding: 8px; border-radius: 10px; background: var(--muted-surface); border: 1px solid var(--border-c); font-size: 12.5px; }
.mi-sim-line { margin-bottom: 6px; }
.mi-seg { flex-wrap: wrap; }
.mi-seg button { font-size: 12.5px; padding: 6px 8px; min-width: 0; white-space: normal; }
.mi-linked-note { margin-top: 6px; color: var(--info-fg); }
.item.mi.linked { border-inline-start: 2px solid var(--info-fg); padding-inline-start: 8px; }
.mi-ev { margin-top: 8px; font-size: 12.5px; }
.mi-ev > summary { cursor: pointer; }
.mi-ev-q { margin: 6px 0; padding: 6px 10px; border-inline-start: 3px solid var(--border-c);
  background: var(--muted-surface); border-radius: 6px; white-space: pre-wrap; }
.mi-ev-miss { margin: 4px 0; }
mark.ev-hit { background: var(--warn-bg); color: var(--foreground); outline: 2px solid var(--warn-bd); border-radius: 3px; }
.mi-group { border: 1px solid var(--border-c); border-radius: 12px; padding: 0 10px; margin-bottom: 8px; }
.mi-group > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 0; cursor: pointer; }
.mi-group-name { font-weight: 600; color: var(--foreground); }
.mi-skipped { margin-top: 10px; border: 1px dashed var(--border-c); border-radius: 12px; padding: 0 10px; }
.mi-skipped > summary { padding: 9px 0; cursor: pointer; }
.mi-skip-hd { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mi-desc-ro { font-size: 12.5px; margin-top: 3px; }
.mi-convert { margin-top: 6px; }
.mi-others-open { margin-bottom: 6px; padding: 8px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-bd); }
.mi-others-open > b { color: var(--warn-fg); font-size: 13px; }

/* ذخیره‌ی نامعلوم: فرم قفل است تا نتیجه روشن شود (ویجت‌های ارتقایافته‌ی select هم کلیک نگیرند). */
.mtg-review.locked #m-items, .mtg-review.locked #m-tools, .mtg-review.locked #m-skipped,
.mtg-review.locked #m-add { pointer-events: none; opacity: .6; }

/* Search filters only the already-authorized people directory. */
.people-search { margin-bottom: 16px; }
.people-search-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.people-search-input { position: relative; }
.people-search-input .f { padding-inline-end: 46px; }
#p-search::-webkit-search-cancel-button { -webkit-appearance: none; }
#p-search-clear { position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-40%); padding: 5px; border: 0; }
#p-search-status:empty { display: none; }
#p-search-status { margin-top: 8px; font-size: 12px; }
.chatpane > .task-chat-heading { flex: 0 0 auto; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border-c); }
.personal-note-list > .note-item { margin-top: 0; }
/* Concise connection card; detailed explanations live in the guided tour. */
.gs-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#gs-guide { font-size: 12px; color: var(--muted); margin-top: 12px; }
#gs-guide p { margin: 6px 0; }
.gs-field-label { display: block; margin-top: 18px; font-size: 12px; }
.gs-actions { margin-top: 14px; }
#gs-status { font-size: 12px; color: var(--muted); }
.settings-org-column { display: contents; }
#view > section[data-settings-cat="org"]:not(.hidden) { display: grid; grid-template-columns: minmax(0, 1fr); }
.settings-org-column > #settings-workhours { order: 0; }
.settings-org-column > #settings-weekly { order: 1; }
.settings-org-column > #settings-unseen { order: 2; }
.settings-org-column > #settings-followup { order: 3; }
.mr-detail-layout { display: flex; flex-direction: column; }
.mr-detail-main, .mr-detail-side { display: contents; }
.mr-detail-main > .mr-det-head { order: 0; }
.mr-detail-side > .mr-detail-timeline { order: 1; }
.mr-detail-main > .mr-detail-data { order: 2; }
.mr-detail-side > .card:not(.mr-detail-timeline) { order: 3; }
#mr-coordination { order: 4; }
#mr-talk { order: 5; }

.task-view-switch { display: none; }

/* Long pending reports scroll independently; review actions remain outside. */
#t-pend .quotebox { max-height: 160px; overflow-y: auto; overscroll-behavior-y: contain;
  scrollbar-width: thin; overflow-wrap: anywhere; }
#t-pend .quotebox:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (min-width: 1024px) {
  #t-pend .cardlist { align-items: start; }
}

/* Opaque dark action surfaces avoid pale transition frames with bright labels. */
html.dark {
  --button-primary: #2563eb;
  --success-bg: #163d2b; --success-fg: #bbf7d0; --success-bd: #42a371;
  --warn-bg: #4a3412; --warn-fg: #fde68a; --warn-bd: #b08b3b;
  --danger-bg: #511f28; --danger-fg2: #fecdd3; --danger-bd: #bd6473;
}
html.dark button.ok { background: var(--success-bg); color: var(--success-fg); border: 1px solid var(--success-bd); }
html.dark button.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-bd); }
html.dark button.danger { background: var(--danger-bg); color: var(--danger-fg2); border: 1px solid var(--danger-bd); }
html.dark button.ok, html.dark button.warn, html.dark button.danger,
html.dark .tab.active, html.dark .task-view-switch > button {
  transition: transform .05s, box-shadow .15s, border-color .15s;
}
html.dark .btn-main, html.dark .seg.seg-pick button[aria-pressed="true"] {
  background: var(--button-primary); color: var(--primary-foreground);
}
@media (max-width: 1023px) {
  html.dark .tab.active { background: var(--button-primary); color: var(--primary-foreground); }
}

/* Compact, dated index of task and conversation files. */
.task-files-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.task-file-list { max-height: 360px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; }
.task-file { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 7px 10px; padding: 13px 0; border-bottom: 1px solid var(--border-c); }
.task-file:first-child { padding-top: 0; }
.task-file:last-child { border-bottom: 0; padding-bottom: 0; }
.task-file-icon { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 8px; background: var(--secondary); color: var(--muted-foreground); }
.task-file-icon .ic { width: 17px; height: 17px; margin: 0; }
.task-file-info { min-width: 0; }
.task-file-name { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; line-height: 1.9; }
.task-file-meta { color: var(--muted-foreground); font-size: 11px; margin-top: 4px; overflow-wrap: anywhere; }
.task-file-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 7px; }
.task-file-actions > a { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--border-c); border-radius: 7px; padding: 4px 9px; color: var(--link); text-decoration: none; font-size: 11px; }
.task-file-actions > a:hover { background: var(--accent); }
.task-file-actions .ic { width: 13px; height: 13px; margin: 0; }
.task-file-preview { grid-column: 2; min-width: 0; }
.task-file-preview > summary { font-size: 11px; }
.task-file-list:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 4px; }
@media (min-width: 1280px) {
  .task-file { grid-template-columns: 30px minmax(0,1fr) auto; align-items: start; }
  .task-file-actions { grid-column: 3; }
  .task-file-preview { grid-column: 2 / -1; }
}
html.dark button:hover { filter: none; }
.billing-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;margin:8px 0;padding:8px 12px;font-size:13px;background:var(--card-bg);border:1px solid var(--border);border-radius:var(--radius)}.billing-bar a{font-weight:600;color:var(--primary)}.billing-bar-warning{border-color:#d97706}
.billing-bar a{display:inline-flex;align-items:center;min-height:40px}
