/* ==========================================================================
   theme-v2 — منبع یگانه رنگ‌های روز و شب
   ==========================================================================

   چرا این فایل

   حالت شب در پنج جای جدا تعریف شده بود (tokens، brand، shell، shell2،
   theme دو بار) و هر کدام دیگری را بازنویسی می‌کرد. هر صفحه ترکیبی از
   سه چهار پالت بود. این فایل آخرین شیوه‌نامه است و همه متغیرهای رنگ را
   یک‌جا تعریف می‌کند — هر دو حالت، کنار هم، تا هم‌خوانی‌شان دیده شود.

   ریشه پالت: سه رنگ لوگو
     فیروزه‌ای  #18B3B7   ← رنگ اصلی (برای متن و دکمه یک درجه تیره‌تر)
     خاکستری    #4B4B4D   ← خاکستری‌های گرم سامانه
     طلایی      #DFAE38   ← هشدار و «انجام نشد»

   قاعده حالت شب
     - زمینه زغالی، نه مشکی و نه آبی تیره
     - متن سفید خالص نیست — چشم را در شیفت شب نمی‌زند
     - رنگ‌های پر (دکمه، نشان) روشن‌اند و متن رویشان تیره (--on-fill)

   متغیرهای قدیمی (ink، paper، white، oxide، bcd-*) حذف نشده‌اند؛ اینجا
   به پالت تازه نگاشت شده‌اند تا ده‌ها فایل موجود بی تغییر رنگ تازه
   بگیرند.
   ========================================================================== */

:root {
  /* ---------------------------------------------------------- پالت پایه */
  --c-canvas:     #EEF0F1;   /* زمینه صفحه */
  --c-surface:    #FFFFFF;   /* کارت */
  --c-sunken:     #F5F6F7;   /* سرجدول، خانه خالی، زمینه ورودی */
  --c-sunken-2:   #E6E9EB;   /* hover روی sunken */

  --c-ink:        #1E2022;
  --c-ink-2:      #4B4B4D;   /* خاکستری لوگو */
  --c-ink-3:      #6C7175;   /* راهنما — روی سفید ۴٫۸:۱ */

  --c-line:       rgba(30, 32, 34, 0.10);
  --c-line-2:     rgba(30, 32, 34, 0.16);
  --c-line-3:     rgba(30, 32, 34, 0.28);

  --c-primary:      #0E7C80;   /* فیروزه‌ای لوگو، خوانا روی سفید */
  --c-primary-2:    #0A6467;   /* hover */
  --c-primary-tint: #E2F3F3;
  --c-primary-ink:  #0A5C5F;   /* متن روی tint */
  --c-logo-teal:    #18B3B7;   /* فقط تزئین — متن نه */

  --c-info:       #2B74AD;
  --c-info-tint:  #E6F0F8;

  --c-ok:         #1E7A4C;
  --c-ok-tint:    #E3F2E9;
  --c-warn:       #95680C;
  --c-warn-tint:  #FBF1DA;
  --c-danger:     #BE3A2E;
  --c-danger-tint:#FBE8E6;
  --c-idle:       #7A8086;
  --c-idle-tint:  #EEF0F1;
  --c-gold:       #DFAE38;   /* طلایی لوگو */
  --c-skip:       #F1CF6E;   /* خانه «انجام نشد» — طلایی توپر */
  --c-skip-ink:   #4A3405;

  --on-fill:      #FFFFFF;   /* متن روی رنگ پر */

  --c-shadow:     0 1px 2px rgba(30, 32, 34, .05), 0 4px 14px rgba(30, 32, 34, .05);
  --c-focus:      0 0 0 3px rgba(14, 124, 128, .28);

  /* پیام‌رسان */
  --chat-wall:    #E3E9E9;
  --chat-mine:    #D7EFEF;
  --chat-theirs:  #FFFFFF;
  --chat-tick:    #11A2A6;

  color-scheme: light;
}

html[data-theme="dark"] {
  --c-canvas:     #121416;
  --c-surface:    #1A1D20;
  --c-sunken:     #212428;
  --c-sunken-2:   #2A2E33;

  --c-ink:        #E4E6E8;
  --c-ink-2:      #B3B8BD;
  --c-ink-3:      #8A9096;

  --c-line:       rgba(228, 230, 232, 0.08);
  --c-line-2:     rgba(228, 230, 232, 0.14);
  --c-line-3:     rgba(228, 230, 232, 0.26);

  --c-primary:      #2EC4C8;
  --c-primary-2:    #5BD3D6;
  --c-primary-tint: #16302F;
  --c-primary-ink:  #7FDDE0;
  --c-logo-teal:    #2EC4C8;

  --c-info:       #6AA8E0;
  --c-info-tint:  #172636;

  --c-ok:         #4FC38A;
  --c-ok-tint:    #15291F;
  --c-warn:       #E5B84A;
  --c-warn-tint:  #2C2615;
  --c-danger:     #F2766B;
  --c-danger-tint:#33201E;
  --c-idle:       #8A9096;
  --c-idle-tint:  #23272B;
  --c-gold:       #E5B84A;
  --c-skip:       #D9A93A;
  --c-skip-ink:   #1E1606;

  --on-fill:      #0E1214;

  --c-shadow:     0 1px 2px rgba(0, 0, 0, .35);
  --c-focus:      0 0 0 3px rgba(46, 196, 200, .32);

  --chat-wall:    #15181B;
  --chat-mine:    #1C4446;
  --chat-theirs:  #22262A;
  --chat-tick:    #4FD6DA;

  color-scheme: dark;
}

/* ------------------------------------------- نگاشت متغیرهای قدیمی — هر دو حالت
   یک بار، با ارجاع به پالت. چون مقدارها var() هستند، با عوض شدن
   data-theme خودشان عوض می‌شوند و بلوک جداگانه شب لازم ندارند. */

:root,
html[data-theme="dark"] {
  --ink:          var(--c-ink);
  --ink-soft:     var(--c-ink-2);
  --ink-faint:    var(--c-ink-3);

  --paper:        var(--c-canvas);
  --white:        var(--c-surface);
  --concrete:     var(--c-sunken);
  --concrete-dk:  var(--c-sunken-2);

  --line:         var(--c-line);
  --line-mid:     var(--c-line-2);
  --line-strong:  var(--c-line-3);

  /* اکسید و نقشه — رنگ اصلی پیشین؛ حالا فیروزه‌ای */
  --oxide:        var(--c-primary);
  --oxide-lt:     var(--c-primary-2);
  --oxide-pale:   var(--c-primary-tint);
  --blueprint:    var(--c-primary);
  --blueprint-lt: var(--c-primary-2);
  --brass:        var(--c-warn);

  /*
  | یک رنگ تأکید، نه دو. سامانه آبی (bcd-blue) و فیروزه‌ای را کنار هم
  | به‌جای «رنگ اصلی» به کار برده بود — زبانه آبی، دکمه فیروزه‌ای.
  | هر دو حالا رنگ اصلی‌اند. آبی فقط برای «اطلاع» می‌ماند (--c-info).
  */
  --bcd-teal:      var(--c-primary);
  --bcd-teal-dp:   var(--c-primary);
  --bcd-teal-lt:   var(--c-primary-2);
  --bcd-teal-pale: var(--c-primary-tint);
  --bcd-brass:     var(--c-gold);
  --bcd-brass-pale:var(--c-warn-tint);
  --bcd-gold:      var(--c-gold);
  --bcd-gray:      var(--c-ink-2);

  --bcd-blue:      var(--c-primary);
  --bcd-blue-lt:   var(--c-primary-2);
  --bcd-blue-dk:   var(--c-primary-2);
  --bcd-blue-pale: var(--c-primary-tint);

  --bcd-red:       var(--c-danger);
  --bcd-red-pale:  var(--c-danger-tint);

  /*
  | «نرمال» پیش‌تر فیروزه‌ای بود — همرنگ دکمه‌ها. در کاردکس، خانه
  | نرمال و دکمه ثبت از هم جدا نمی‌شدند. حالا سبز است.
  */
  --ok:           var(--c-ok);
  --ok-pale:      var(--c-ok-tint);
  --warn:         var(--c-warn);
  --warn-pale:    var(--c-warn-tint);
  --danger:       var(--c-danger);
  --danger-pale:  var(--c-danger-tint);
  --idle:         var(--c-idle);
  --idle-pale:    var(--c-idle-tint);

  --skip:         var(--c-skip-ink);
  --skip-pale:    var(--c-skip);
  --skip-line:    color-mix(in srgb, var(--c-skip-ink) 40%, transparent);

  --surface:      var(--c-surface);
  --surface-dark: var(--c-sunken);
  --surface-dark-hi: var(--c-sunken-2);
  --muted:        var(--c-ink-3);

  --side-bg:      var(--c-surface);
  --side-ink:     var(--c-ink);
  --side-soft:    var(--c-ink-3);
  --side-line:    var(--c-line);
  --side-hover:   var(--c-sunken);
  --side-active:  var(--c-primary-tint);

  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .04);
  --shadow:       var(--c-shadow);
}

/* ==========================================================================
   پایه
   ========================================================================== */

body,
body.app {
  background: var(--c-canvas);
  color: var(--c-ink);
}

::selection { background: var(--c-primary); color: var(--on-fill); }

:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

a:not(.btn):not(.logo):hover { color: var(--c-primary); }

/* ورودی‌ها — زمینه کمی فرورفته، حلقه تمرکز فیروزه‌ای */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
  background-color: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-line-2);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: var(--c-primary);
  box-shadow: var(--c-focus);
  outline: none;
}

input::placeholder,
textarea::placeholder { color: var(--c-ink-3); opacity: 1; }

input[type="checkbox"],
input[type="radio"] { accent-color: var(--c-primary); }

/* ==========================================================================
   حالت شب — جایگزین قاعده‌های پراکنده قدیمی
   ==========================================================================
   این قاعده‌ها همان انتخابگرهای فایل‌های پیشین را دارند و چون این فایل
   آخر بارگذاری می‌شود، بر آن‌ها غالب‌اند. رنگ ثابت در آن‌ها نیست —
   فقط متغیر. */

html[data-theme="dark"] .kpi                { background: var(--c-sunken); border-color: var(--c-line-2); }
html[data-theme="dark"] .kpi--ok            { background: var(--c-ok-tint); }
html[data-theme="dark"] .kpi--warn          { background: var(--c-warn-tint); }
html[data-theme="dark"] .kpi--danger        { background: var(--c-danger-tint); }
html[data-theme="dark"] .kpi--info          { background: var(--c-info-tint); }

html[data-theme="dark"] .tbl .ref           { color: var(--c-primary-ink); }

/* نوار پایین موبایل — رنگ‌های ثابت سبز‌آبی قدیم */
html[data-theme="dark"] .mbar.mbar--v2      { background: var(--c-surface); border-color: var(--c-line-2); }
html[data-theme="dark"] .mbar--v2 .mbar__b,
html[data-theme="dark"] .mbar--v2 .mbar__b--fab { color: var(--c-ink-3); }
html[data-theme="dark"] .mbar--v2 .mbar__b.is-on,
html[data-theme="dark"] .mbar--v2 .mbar__b--fab.is-on { color: var(--c-primary); }
html[data-theme="dark"] .mbar--v2 .mbar__b:not(.mbar__b--fab)::before { background: var(--c-primary-tint); }
html[data-theme="dark"] .mbar--v2 .mbar__fab,
html[data-theme="dark"] .mbar--v2 .mbar__fab .mbar__n { border-color: var(--c-surface); }
html[data-theme="dark"] .mbar--v2 .mbar__b.is-tap::after { background: var(--c-primary-tint); }

/* ==========================================================================
   رنگ پر + متن رویش
   ==========================================================================
   دکمه اصلی و نشان‌های پر. در شب رنگ پر روشن است، پس متن تیره. */

.btn:not(.btn--ghost):not(.btn--gh):not(.btn--warn):not(.btn--danger):not(.btn--normal):not(.btn--abnormal):not(.btn--skipped):not(.btn--yes):not(.btn--no):not(.btn--link):not(.btn--outline) {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: var(--on-fill);
}

.btn:not(.btn--ghost):not(.btn--gh):not(.btn--warn):not(.btn--danger):not(.btn--normal):not(.btn--abnormal):not(.btn--skipped):not(.btn--yes):not(.btn--no):not(.btn--link):not(.btn--outline):hover {
  background: var(--c-primary-2);
  border-color: var(--c-primary-2);
  color: var(--on-fill);
}

.btn--ghost,
.btn--gh {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line-2);
}

.btn--ghost:hover,
.btn--gh:hover {
  background: var(--c-sunken);
  border-color: var(--c-line-3);
  color: var(--c-ink);
}

.btn--warn,
.btn--danger {
  background: transparent;
  color: var(--c-danger);
  border-color: color-mix(in srgb, var(--c-danger) 45%, transparent);
}

.btn--warn:hover,
.btn--danger:hover {
  background: var(--c-danger-tint);
  color: var(--c-danger);
}

/* ==========================================================================
   کارت و جدول
   ========================================================================== */

.card {
  background: var(--c-surface);
  border-color: var(--c-line);
}

.tbl thead th {
  background: var(--c-sunken);
  color: var(--c-ink-2);
  border-color: var(--c-line);
}

.tbl tbody td { border-color: var(--c-line); }

.tbl tbody tr:hover td { background: color-mix(in srgb, var(--c-primary) 4%, transparent); }

/* ==========================================================================
   کاردکس — سه وضعیت، هم با رنگ و هم با نماد
   ========================================================================== */

/*
| نرمال آرام است، استثناها توپر — چشم اول به غیرنرمال و انجام‌نشده می‌افتد.
| در شب رنگ‌های توپر روشن‌اند و نماد رویشان تیره.
*/
.kx-cell.mk--normal,
html[data-theme="dark"] .kx-cell.mk--normal {
  background: var(--c-ok-tint);
  color: var(--c-ok);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-ok) 35%, transparent);
}
.kx-cell.mk--normal .kx-mark,
html[data-theme="dark"] .kx-cell.mk--normal .kx-mark { color: var(--c-ok); }
.kx-cell.mk--normal:hover { background: color-mix(in srgb, var(--c-ok) 22%, var(--c-surface)); }

.kx-cell.mk--abnormal,
html[data-theme="dark"] .kx-cell.mk--abnormal {
  background: var(--c-danger);
  color: var(--on-fill);
  box-shadow: none;
}
.kx-cell.mk--abnormal .kx-mark,
html[data-theme="dark"] .kx-cell.mk--abnormal .kx-mark { color: var(--on-fill); }
.kx-cell.mk--abnormal:hover { background: color-mix(in srgb, var(--c-danger) 85%, var(--c-ink)); }

.kx-cell.is-today,
.kx-day.is-today { box-shadow: inset 0 0 0 2px var(--c-primary); }

/* ==========================================================================
   پیام‌رسان — به سبک تلگرام
   ==========================================================================
   زمینه نقش‌دار، حباب بی‌قاب با سایه نرم، دُم فقط روی آخرین پیام هر
   دسته، رنگ ثابت برای نام هر نفر، ساعت و تیک داخل حباب. */

/*
| زمینه گفتگو — نشان «بلند چینه دژ»، ریز و کم‌رنگ، در ردیف‌های پلکانی.
| دو کاشی جدا برای روز و شب: رنگ نشان با زمینه هم‌خانواده است و فقط
| حس «اینجا سامانه خودمان است» را می‌دهد، نه اینکه با متن رقابت کند.
| background-attachment: local تا نقش همراه پیام‌ها بلغزد، مثل تلگرام.
*/
.chat .chat-thread {
  background-color: var(--chat-wall);
  background-image: url('../img/chat-wall-light-v2.png');
  background-size: 150px 110px;
  background-repeat: repeat;
  background-attachment: local;
  padding: 16px 18px 10px;
  gap: 2px;
}
html[data-theme="dark"] .chat .chat-thread { background-image: url('../img/chat-wall-dark-v2.png'); }

.chat .chat-msg { gap: 8px; margin-top: 8px; }
.chat .chat-msg.is-cont { margin-top: 0; }

/* تصویر فقط کنار آخرین پیام دسته — جای خالی‌اش برای بقیه نگه داشته می‌شود */
.chat .chat-msg.is-run .chat-msg__av { visibility: hidden; }
.chat .chat-msg.is-cont .chat-bub__name { display: none; }

.chat .chat-bub {
  border: 0;
  border-radius: 16px;
  background: var(--chat-theirs);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  padding: 6px 11px 4px;
}

.chat .chat-msg.is-mine .chat-bub {
  background: var(--chat-mine);
  border: 0;
}

/* دُم: گوشه تیز رو به لبه خود، فقط روی آخرین پیام دسته */
.chat .chat-msg.is-mine .chat-bub            { border-end-start-radius: 16px; }
.chat .chat-msg:not(.is-mine) .chat-bub      { border-end-end-radius: 16px; }
.chat .chat-msg.is-mine:not(.is-run) .chat-bub       { border-end-start-radius: 4px; }
.chat .chat-msg:not(.is-mine):not(.is-run) .chat-bub { border-end-end-radius: 4px; }
/* وسط دسته: گوشه سمت لبه کمی جمع‌تر — حباب‌ها به هم می‌چسبند */
.chat .chat-msg.is-mine.is-cont .chat-bub            { border-start-start-radius: 6px; }
.chat .chat-msg:not(.is-mine).is-cont .chat-bub      { border-start-end-radius: 6px; }
.chat .chat-msg.is-mine.is-run .chat-bub             { border-end-start-radius: 6px; }
.chat .chat-msg:not(.is-mine).is-run .chat-bub       { border-end-end-radius: 6px; }

.chat .chat-bub.is-deleted {
  background: color-mix(in srgb, var(--chat-theirs) 70%, transparent);
  color: var(--c-ink-3);
}

/* رنگ نام — هفت رنگ ثابت، هر نفر یکی (data-hue از شناسه کاربر) */
.chat .chat-bub__name                 { font-weight: 600; color: var(--c-primary); }
.chat .chat-bub__name[data-hue="1"]   { color: #C2571A; }
.chat .chat-bub__name[data-hue="2"]   { color: #7A4FB5; }
.chat .chat-bub__name[data-hue="3"]   { color: #2E7D32; }
.chat .chat-bub__name[data-hue="4"]   { color: #B23A6B; }
.chat .chat-bub__name[data-hue="5"]   { color: #2B74AD; }
.chat .chat-bub__name[data-hue="6"]   { color: #9A6E10; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="1"] { color: #F0956A; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="2"] { color: #B79AE8; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="3"] { color: #7FD08A; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="4"] { color: #F08DB6; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="5"] { color: #7DB7EA; }
html[data-theme="dark"] .chat .chat-bub__name[data-hue="6"] { color: #E5B84A; }

.chat .chat-bub__reply {
  border-inline-start-color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary) 9%, transparent);
  border-radius: 6px;
}
.chat .chat-bub__reply strong { color: var(--c-primary); }

.chat .chat-bub__meta { color: var(--c-ink-3); gap: 4px; margin-top: 0; }
.chat .chat-msg.is-mine .chat-bub__meta { color: color-mix(in srgb, var(--c-primary-ink) 75%, transparent); }

.chat .chat-seen.is-seen { color: var(--chat-tick); }

/* جداکننده روز — شناور روی زمینه نقش‌دار */
.chat .chat-day {
  background: color-mix(in srgb, var(--c-ink) 32%, transparent);
  color: #FFFFFF;
  font-weight: 500;
  backdrop-filter: none;
}
html[data-theme="dark"] .chat .chat-day {
  background: color-mix(in srgb, var(--c-surface) 85%, transparent);
  color: var(--c-ink-2);
}

.chat .chat-sys {
  background: color-mix(in srgb, var(--c-surface) 70%, transparent);
  border-radius: 999px;
  padding: 2px 12px;
}

/* ==========================================================================
   میز خدمات (صفحه‌های عمومی گزارش خرابی)
   ==========================================================================
   سرصفحه روشن با خط زیرین، نه نوار رنگی پر — در گوشی، نوار پر بالای
   صفحه بیش از محتوا به چشم می‌آمد و متن کم‌رنگش روی فیروزه‌ای خوانا نبود. */

.desk-top {
  background: var(--c-surface);
  color: var(--c-ink);
  border-bottom: 1px solid var(--c-line-2);
  box-shadow: inset 0 3px 0 var(--c-primary);
}
.desk-top [class*="desk-top__"]        { color: var(--c-ink-2); }
.desk-top [class*="desk-top__"]:active { background: var(--c-sunken); }
.desk-top strong,
.desk-top b                             { color: var(--c-ink); }
.desk-top .desk-top__sep                { background: var(--c-line-2); }

/* ------------------------------------------------- واکنش و سنجاق */

.chat .chat-menu__rx {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-bottom: 1px solid var(--c-line);
  margin-bottom: 4px;
}
.chat .chat-menu__rx button {
  flex: 1 1 0;
  min-width: 34px;
  padding: 4px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: var(--t-md);
  line-height: 1.2;
  cursor: pointer;
}
.chat .chat-menu__rx button:hover { background: var(--c-sunken); }
.chat .chat-menu__rx button.is-on  { background: var(--c-primary-tint); }

.chat .chat-rx { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.chat .chat-rx__i {
  border: 1px solid var(--c-line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c-surface) 60%, transparent);
  color: var(--c-ink-2);
  padding: 0 8px;
  font: inherit;
  font-size: var(--t-xs);
  line-height: 1.9;
  cursor: pointer;
}
.chat .chat-rx__i.is-mine {
  border-color: var(--c-primary);
  background: var(--c-primary-tint);
  color: var(--c-primary-ink);
}

.chat .chat-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 14px;
  border: 0;
  border-bottom: 1px solid var(--c-line);
  border-inline-start: 3px solid var(--c-primary);
  background: var(--c-surface);
  color: var(--c-ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.chat .chat-pin__t { display: flex; flex-direction: column; min-width: 0; }
.chat .chat-pin__t strong { font-size: var(--t-xs); color: var(--c-primary); font-weight: 600; }
.chat .chat-pin__t span   { font-size: 14px; color: var(--c-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* کلید روز و شب میز خدمات */
.desk-theme {
  flex: none;
  width: 36px;
  height: 36px;
  margin-inline-start: 6px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--c-line-2);
  border-radius: 10px;
  background: var(--c-sunken);
  color: var(--c-ink-2);
  cursor: pointer;
}
.desk-theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.desk-theme__moon { fill: currentColor; stroke: none; }
.desk-theme__sun  { display: none; }
html[data-theme="dark"] .desk-theme__sun  { display: block; }
html[data-theme="dark"] .desk-theme__moon { display: none; }
.desk-theme:active { transform: scale(.94); }

/* ==========================================================================
   اعلان درون‌برنامه و نوار نصب — رنگ ثابت تیره داشتند و متنشان در شب
   تیره می‌شد. حالا زمینه و متن هر دو از پالت می‌آیند.
   ========================================================================== */

:root {
  --toast-bg:  #23272B;
  --toast-ink: #F2F3F4;
  --toast-line: transparent;
}
html[data-theme="dark"] {
  --toast-bg:  #2E3338;
  --toast-ink: #ECEEF0;
  --toast-line: rgba(228, 230, 232, .14);
}

.al-toast,
.pwa-bar {
  background: var(--toast-bg);
  color: var(--toast-ink);
  border: 1px solid var(--toast-line);
}
.al-toast a,
.al-toast button,
.pwa-bar button,
.pwa-bar a          { color: var(--toast-ink); }
.al-toast a,
.pwa-bar__no        { background: color-mix(in srgb, var(--toast-ink) 14%, transparent); }

/* بحرانی و هشدار: رنگ پر وضعیت، متن رویش */
.al-toast--critical,
.al-toast--critical a,
.al-toast--critical button { background-color: var(--c-danger); color: var(--on-fill); }
.al-toast--warn,
.al-toast--warn a,
.al-toast--warn button     { background-color: var(--c-warn); color: var(--on-fill); }
.al-toast--critical a,
.al-toast--warn a          { background: color-mix(in srgb, var(--on-fill) 18%, transparent); }
.al-toast--critical button,
.al-toast--warn button     { background: none; }

/* دکمه‌های رنگ ثابت میز خدمات */
.desk-now__btn.is-set,
.desk-jdt__now.is-set,
.desk-call { background: var(--c-primary); color: var(--on-fill); }

/* منوی کناری: گزینه فعال */
.side__nav a[aria-current="page"] {
  background: var(--side-active);
  color: var(--c-primary-ink);
  box-shadow: inset 3px 0 0 var(--c-primary);
}
.side__nav a[aria-current="page"] svg { color: var(--c-primary); }
html[data-theme="dark"] .side__signout:hover { color: var(--c-ink); }

/* ==========================================================================
   جزیره پایین (نوار ناوبری موبایل)
   ==========================================================================
   روز: روشن، ولی جدا از صفحه — ته‌رنگ فیروزه‌ای، قاب و سایه.
   شب: تیره، ولی یک پله روشن‌تر از کارت‌ها — تا روی صفحه شناور دیده شود. */

:root {
  --island-bg:     color-mix(in srgb, #0E7C80 7%, #FFFFFF);
  --island-line:   rgba(14, 124, 128, .22);
  --island-ink:    #5A6064;
  --island-shadow: 0 10px 28px rgba(20, 40, 44, .18), 0 2px 6px rgba(20, 40, 44, .08);
}
html[data-theme="dark"] {
  --island-bg:     #2A2F34;
  --island-line:   rgba(228, 230, 232, .14);
  --island-ink:    #A3AAB1;
  --island-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

@media screen and (max-width: 900px) {
  .mbar.mbar--v2,
  html[data-theme="dark"] .mbar.mbar--v2 {
    background: var(--island-bg);
    border: 1px solid var(--island-line);
    box-shadow: var(--island-shadow);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .mbar--v2 .mbar__b,
  .mbar--v2 .mbar__b--fab,
  html[data-theme="dark"] .mbar--v2 .mbar__b,
  html[data-theme="dark"] .mbar--v2 .mbar__b--fab { color: var(--island-ink); }

  .mbar--v2 .mbar__b.is-on,
  .mbar--v2 .mbar__b--fab.is-on,
  html[data-theme="dark"] .mbar--v2 .mbar__b.is-on,
  html[data-theme="dark"] .mbar--v2 .mbar__b--fab.is-on { color: var(--c-primary); }

  .mbar--v2 .mbar__b:not(.mbar__b--fab)::before,
  html[data-theme="dark"] .mbar--v2 .mbar__b:not(.mbar__b--fab)::before { background: var(--c-primary-tint); }

  .mbar--v2 .mbar__b.is-tap::after,
  html[data-theme="dark"] .mbar--v2 .mbar__b.is-tap::after { background: color-mix(in srgb, var(--c-primary) 25%, transparent); }

  /* دکمه وسط: فیروزه‌ای پر، قابش همرنگ جزیره تا «بریده» دیده شود */
  .mbar--v2 .mbar__fab,
  html[data-theme="dark"] .mbar--v2 .mbar__fab {
    background: linear-gradient(145deg, var(--c-primary-2) 0%, var(--c-primary) 70%);
    color: var(--on-fill);
    border-color: var(--island-bg);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--c-primary) 40%, transparent);
  }
  .mbar--v2 .mbar__fab .mbar__n,
  html[data-theme="dark"] .mbar--v2 .mbar__fab .mbar__n { border-color: var(--island-bg); }

  .mbar--v2 .mbar__b--fab.is-on .mbar__fab {
    box-shadow: 0 0 0 3px var(--c-primary-tint), 0 8px 20px color-mix(in srgb, var(--c-primary) 45%, transparent);
  }
}

/* ------------------------------------------------- نخوانده، پایین گفتگو، در حال نوشتن */

.chat .chat-unread {
  align-self: stretch;
  margin: 10px -18px 6px;
  padding: 3px 0;
  text-align: center;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-primary-ink);
  background: color-mix(in srgb, var(--c-primary) 12%, transparent);
}

.chat .chat-down {
  position: absolute;
  inset-inline-start: 16px;
  bottom: 78px;
  z-index: 4;
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  border: 1px solid var(--c-line-2);
  border-radius: 50%;
  background: var(--c-surface);
  color: var(--c-ink-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
  cursor: pointer;
}
.chat .chat-down.is-on { display: grid; }
.chat .chat-down__ic { font-size: 22px; line-height: 1; margin-top: -6px; }
.chat .chat-down__n {
  position: absolute;
  top: -6px;
  inset-inline-end: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-primary);
  color: var(--on-fill);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
}
.chat .chat-down__n[hidden] { display: none; }

.chat [data-sub].is-typing { color: var(--c-primary); }

/* --- typography: weight scale is 400/500/600/700; tabular digits in tables */
.tbl td, .tbl th, .kx-grid, .num { font-variant-numeric: tabular-nums; }
h1, .page-head h1 { font-weight: 700; letter-spacing: 0; }

/* ------------------------------------------------- پیوست چندگانه — نوار پیش‌نمایش */

.chat .chat-attach {
  display: block;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
}
.chat .chat-att {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.chat .chat-att__i {
  position: relative;
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  border: 1px solid var(--c-line-2);
  background: var(--c-sunken);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}
.chat .chat-att__i.is-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat .chat-att__ic { font-size: 24px; line-height: 1; }
.chat .chat-att__n {
  max-width: 68px;
  font-size: 13px;
  color: var(--c-ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
}
.chat .chat-att__s {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  font-size: 13px;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  padding: 6px 0 2px;
}
.chat .chat-att__i:not(.is-img) .chat-att__s { position: static; background: none; color: var(--c-ink-3); padding: 0; }
.chat .chat-att__x {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 15px;
  line-height: 22px;
  padding: 0;
  cursor: pointer;
}
.chat .chat-att__x:hover { background: var(--c-danger); }
.chat .chat-att__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--t-xs);
  color: var(--c-ink-3);
  padding: 2px 2px 0;
}
.chat .chat-att__clr {
  border: 0;
  background: none;
  color: var(--c-danger);
  font: inherit;
  font-size: var(--t-xs);
  cursor: pointer;
}

/* شمارنده ارسال چندتایی روی دکمه */
.chat [data-send][data-n] { position: relative; }
.chat [data-send][data-n]::after {
  content: attr(data-n);
  position: absolute;
  top: -8px;
  inset-inline-start: -6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-ink);
  color: var(--c-canvas);
  font-size: 13px;
  line-height: 17px;
}

/* کشیدن و رها کردن */
.chat .is-drop [data-thread] {
  outline: 2px dashed var(--c-primary);
  outline-offset: -8px;
}

/* ------------------------------------------------- دستیار سامانه */

.chat .chat-av--bot {
  background: linear-gradient(145deg, var(--c-primary-2), var(--c-primary));
  color: var(--on-fill);
}
.chat .chat-msg.is-bot .chat-bub {
  background: var(--chat-theirs);
  border-inline-start: 3px solid var(--c-primary);
}
.chat .chat-msg.is-bot .chat-bub__text { line-height: 2; }

/* ------------------------------------------------- فرم درخواست اداری */

.chat .chat-hr {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .38);
}
.chat .chat-hr__box {
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 18px 18px;
  border-radius: 14px;
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat .chat-hr__head { display: flex; justify-content: space-between; align-items: center; }
.chat .chat-hr__head strong { font-size: var(--t-base); }
.chat .chat-hr__x { border: 0; background: none; font-size: 22px; color: var(--c-ink-3); cursor: pointer; }
.chat .chat-hr__kinds { display: flex; gap: 6px; }
.chat .chat-hr__kinds label { flex: 1; }
.chat .chat-hr__kinds input { position: absolute; opacity: 0; pointer-events: none; }
.chat .chat-hr__kinds span {
  display: block;
  text-align: center;
  padding: 7px 0;
  border: 1px solid var(--c-line-2);
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  color: var(--c-ink-2);
}
.chat .chat-hr__kinds input:checked + span {
  border-color: var(--c-primary);
  background: var(--c-primary-tint);
  color: var(--c-primary-ink);
}
.chat .chat-hr__f { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--c-ink-2); }
.chat .chat-hr__f[hidden], .chat .chat-hr__hint[hidden] { display: none; }
.chat .chat-hr__f input,
.chat .chat-hr__f select,
.chat .chat-hr__f textarea {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--c-line-2);
  border-radius: 9px;
  background: var(--c-surface);
  color: var(--c-ink);
}
.chat .chat-hr__hint { margin: -4px 0 0; font-size: var(--t-xs); color: var(--c-ok); }
.chat .chat-hr__go { margin-top: 4px; padding: 10px; font-size: 14px; }

/* ==========================================================================
   ارجاع دوباره رخداد و ردیابی علت
   ========================================================================== */

.inc-reassign { border-inline-start: 4px solid var(--c-warn); }
.inc-reassign .card__head h2 { color: var(--c-warn); }
.inc-reassign__now {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--c-warn-tint);
  color: var(--c-ink);
  font-size: 14px;
}

.inc-trail__why { margin: 2px 0; font-size: 14px; color: var(--c-ink-2); }
.inc-trail__why strong { color: var(--c-ink); }
.inc-trail__why .is-fault,
.rp-reassign .is-fault,
.rp-fault-n { color: var(--c-danger); font-weight: 700; }

.rp-reassign th.is-fault { color: var(--c-danger); }
.rp-reassign td.is-fault { background: var(--c-danger-tint); }
.rp-reassign__recent { padding: 12px 16px 16px; border-top: 1px solid var(--c-line); }
.rp-reassign__recent h3 { font-size: 14px; margin: 0 0 8px; }
.rp-reassign__recent ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.rp-fault { font-weight: 700; }

/* ==========================================================================
   انبار — مرور درختی کالاها و دفتر شماره‌گذاری
   ========================================================================== */

.stk-browse {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .stk-browse { grid-template-columns: 1fr; } }

.stk-tree {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
}
@media (max-width: 900px) { .stk-tree { position: static; max-height: 360px; } }

.stk-tree__head { padding: 10px 12px; border-bottom: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 6px; }
.stk-tree__q { font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.stk-tree__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.stk-tree__list li[hidden] { display: none; }
.stk-tree__foot {
  padding: 9px 12px;
  border-top: 1px solid var(--c-line);
  font-size: var(--t-xs);
  color: var(--c-primary);
  background: var(--c-sunken);
}

.stk-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  padding-inline-start: calc(6px + var(--d, 0) * 14px);
  border-radius: 8px;
  color: var(--c-ink);
  font-size: 14px;
}
.stk-node:hover { background: var(--c-sunken); }
.stk-node.is-path { font-weight: 600; }
.stk-node.is-on { background: var(--c-primary-tint); color: var(--c-primary-ink); font-weight: 600; }
.stk-node > a { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; color: inherit; }
a.stk-node { color: inherit; }
.stk-node__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stk-node__code { font-size: 13px; padding: 0 5px; border-radius: 5px; background: var(--c-sunken); color: var(--c-ink-2); }
.stk-node.is-on .stk-node__code { background: var(--c-surface); }
.stk-node__n {
  margin-inline-start: auto;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-sunken-2);
  color: var(--c-ink-2);
  font-size: var(--t-xs);
  text-align: center;
}
.stk-node__n.is-zero { opacity: .45; }
.stk-node__tw {
  flex: none;
  width: 20px;
  height: 20px;
  border: 0;
  background: none;
  color: var(--c-ink-3);
  cursor: pointer;
  transition: transform .15s;
  font-size: 15px;
  line-height: 1;
}
.stk-node__tw.is-open { transform: rotate(-90deg); }
.stk-node__tw.is-leaf { cursor: default; }
.stk-node--warn .stk-node__name { color: var(--c-warn); }

.stk-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--c-primary-tint);
  font-size: 14px;
}
.stk-crumb a { color: var(--c-primary-ink); }
.stk-crumb a.is-last { font-weight: 700; }
.stk-crumb__sep { color: var(--c-ink-3); }
.stk-crumb__x { margin-inline-start: auto; font-size: var(--t-md); line-height: 1; color: var(--c-ink-3) !important; }

.stk-kids { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.stk-kid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--c-line-2);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--t-xs);
}
.stk-kid:hover { border-color: var(--c-primary); }
.stk-kid .num { color: var(--c-ink-3); }

.stk-coding__cat { padding-inline-start: calc(var(--d, 0) * 18px); display: flex; align-items: center; gap: 6px; }
.stk-copy {
  border: 1px dashed var(--c-primary);
  border-radius: 6px;
  background: var(--c-primary-tint);
  color: var(--c-primary-ink);
  padding: 1px 8px;
  cursor: pointer;
  font: inherit;
}
.stk-copy.is-done { border-style: solid; }
.progress__fill--warn { background: var(--c-warn); }

/* ==========================================================================
   ابزارها و پشتیبان‌ها
   ========================================================================== */

.tl-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.tl-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-inline-start: 4px solid var(--c-line-3);
  border-radius: 10px;
  background: var(--c-surface);
  color: var(--c-ink);
}
a.tl-stat:hover { border-color: var(--c-line-2); box-shadow: var(--c-shadow); }
.tl-stat strong   { font-size: var(--t-base); font-weight: 700; }
.tl-stat__l       { font-size: var(--t-xs); color: var(--c-ink-3); }
.tl-stat__s       { font-size: var(--t-xs); color: var(--c-ink-2); }
.tl-stat.is-ok    { border-inline-start-color: var(--c-ok); }
.tl-stat.is-warn  { border-inline-start-color: var(--c-warn); background: var(--c-warn-tint); }
.tl-stat.is-bad   { border-inline-start-color: var(--c-danger); background: var(--c-danger-tint); }
.tl-stat.is-bad strong { color: var(--c-danger); }

.tl-sec { font-size: 14px; font-weight: 600; color: var(--c-ink-3); margin: 22px 0 10px; }

.tl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.tl-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-ink);
}
.tl-card--link:hover { border-color: var(--c-primary); box-shadow: var(--c-shadow); }
.tl-card__ic {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--c-primary-tint);
  color: var(--c-primary);
  font-size: 20px;
}
.tl-card__b { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: flex-start; }
.tl-card__b h3 { margin: 0; font-size: 15px; font-weight: 700; }
.tl-card__b p  { margin: 0; font-size: 14px; color: var(--c-ink-2); line-height: 1.9; }
.tl-card__links { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-chip {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--c-line-2);
  border-radius: 999px;
  font-size: var(--t-xs);
  color: var(--c-ink-2);
  background: var(--c-sunken);
}
.tl-chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.tl-foot { margin-top: 18px; }
.pg-actions .is-inline { display: inline-block; }

/* ==========================================================================
   تمدید کاردکس (بازطراحی) و واحدها
   ========================================================================== */

.rn2-units {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.rn2-unit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-top: 3px solid var(--uc, var(--c-primary));
  border-radius: 10px;
  background: var(--c-surface);
  color: var(--c-ink);
}
.rn2-unit:hover { box-shadow: var(--c-shadow); }
.rn2-unit.is-on { border-color: var(--uc, var(--c-primary)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--uc, var(--c-primary)) 35%, transparent); }
.rn2-unit--none { border-top-color: var(--c-danger); }
.rn2-unit__n { font-weight: 700; font-size: 14px; }
.rn2-unit__bar, .un-bar { display: block; height: 5px; border-radius: 99px; background: var(--c-sunken-2); overflow: hidden; }
.rn2-unit__bar i, .un-bar i { display: block; height: 100%; background: var(--uc, var(--c-primary)); border-radius: inherit; }
.rn2-unit__m { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--t-xs); color: var(--c-ink-2); }
.rn2-unit__m em, .un-item__m em { font-style: normal; padding: 0 6px; border-radius: 99px; background: var(--c-sunken); }
.rn2-unit__m em.is-warn { background: var(--c-warn-tint); color: var(--c-warn); }
.rn2-unit__m em.is-bad, .un-item__m em.is-bad { background: var(--c-danger-tint); color: var(--c-danger); }

.rn2__head { gap: 12px; flex-wrap: wrap; }
.rn2__head .is-warn { color: var(--c-warn); }
.rn2__filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--c-line); }
.rn2-chip { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--c-line-2); font-size: 14px; color: var(--c-ink-2); }
.rn2-chip.is-on { background: var(--c-primary-tint); border-color: var(--c-primary); color: var(--c-primary-ink); font-weight: 600; }
.rn2__q { margin-inline-start: auto; min-width: 220px; font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; }

.rn2-tbl td { vertical-align: top; }
.rn2-tbl tr.is-renew td:first-child { box-shadow: inset -3px 0 0 var(--c-warn); }
.rn2-tbl tr.is-sel td { background: color-mix(in srgb, var(--c-primary) 7%, transparent); }
.rn2-name { margin-inline-start: 6px; }
.rn2-k { font-size: var(--t-xs); color: var(--c-ink-2); }
.rn2-k.is-ok { color: var(--c-ok); font-weight: 600; }
.rn2-pend { font-size: var(--t-xs); color: var(--c-ink-3); }
.rn2-pend.is-warn { color: var(--c-warn); font-weight: 600; }
.rn2-asg { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rn2-who { font-size: var(--t-xs); padding: 1px 8px; border-radius: 99px; background: var(--c-sunken); color: var(--c-ink-2); white-space: nowrap; }
.rn2-who b { font-weight: 600; color: var(--c-ink-3); margin-inline-end: 3px; }
.rn2-who.is-unit { background: var(--c-info-tint); color: var(--c-info); }
.rn2-who.is-def { opacity: .75; }

.rn2-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--c-line-2);
  background: var(--c-surface);
  border-radius: 0 0 12px 12px;
}
.rn2-bar.is-on { box-shadow: 0 -6px 18px rgba(0, 0, 0, .08); }
.rn2-bar__n { font-size: 14px; color: var(--c-ink-2); font-weight: 600; }
.rn2-bar__acts { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.rn2-panel { flex-basis: 100%; padding: 10px 0 2px; border-top: 1px dashed var(--c-line-2); }
.rn2-panel[hidden] { display: none; }
.rn2-freqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 8px 0; }
.rn2-freq { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-sunken); }
.rn2-freq select, .rn2-panel__acts select { font: inherit; font-size: 14px; padding: 5px 8px; border-radius: 7px; }
.rn2-panel__acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* واحدها */
.un-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .un-layout { grid-template-columns: 1fr; } }
.un-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
@media (max-width: 900px) { .un-list { position: static; flex-direction: row; overflow-x: auto; } }
.un-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--c-line);
  border-inline-start: 4px solid var(--uc, var(--c-primary));
  background: var(--c-surface); color: var(--c-ink); min-width: 170px;
}
.un-item.is-on { background: var(--c-primary-tint); border-color: var(--uc, var(--c-primary)); }
.un-item--none { border-inline-start-color: var(--c-danger); }
.un-item__n { font-weight: 700; font-size: 14px; }
.un-item__m { font-size: var(--t-xs); color: var(--c-ink-2); }
.un-head { border-top: 4px solid var(--uc, var(--c-primary)); }
.un-head h2 { margin: 0 0 12px; }
.un-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.un-person { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; border-radius: 99px; background: var(--c-sunken); font-size: 14px; }
.un-person small { color: var(--c-ink-3); font-size: 13px; }
.un-person.is-sup { background: var(--c-primary-tint); color: var(--c-primary-ink); }
.un-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.un-k { display: inline-flex; align-items: center; gap: 6px; color: var(--c-ink); }
.un-k .un-bar { width: 70px; --uc: var(--c-ok); }

/* ==========================================================================
   کارت «زنگ اعلان» — ورود و محو شدن نرم
   ========================================================================== */

.push-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--c-primary) 28%, var(--c-line));
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c-primary) 14%, transparent) 0%, transparent 60%),
    var(--c-surface);
  opacity: 0;
  transform: translateY(-8px) scale(.99);
  transition: opacity .38s ease, transform .38s ease, max-height .38s ease, margin .38s ease, padding .38s ease;
  max-height: 400px;
}
.push-card.is-in      { opacity: 1; transform: none; }
.push-card.is-leaving { opacity: 0; transform: translateY(-10px) scale(.98); max-height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.push-card.is-on      { border-color: color-mix(in srgb, var(--c-ok) 35%, var(--c-line)); background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c-ok) 12%, transparent) 0%, transparent 60%), var(--c-surface); }
.push-card__ic {
  background: var(--c-primary-tint) !important;
  color: var(--c-primary) !important;
  border-radius: 12px !important;
}
.push-card.is-on .push-card__ic { background: var(--c-ok-tint) !important; color: var(--c-ok) !important; }
.push-card:not(.is-on) .push-card__ic svg { animation: push-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes push-ring { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(12deg); } 82% { transform: rotate(-10deg); } 88% { transform: rotate(6deg); } 94% { transform: rotate(-3deg); } }
.push-state--ok   { color: var(--c-ok) !important; font-weight: 600; }
.push-state--warn { color: var(--c-warn) !important; }
.push-card__x {
  position: absolute;
  top: 8px;
  inset-inline-start: 10px;
  width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--c-ink-3);
  font-size: var(--t-md); line-height: 1;
  cursor: pointer;
}
.push-card__x:hover { background: var(--c-sunken); color: var(--c-ink); }

.push-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 5px 14px;
  border: 1px solid var(--c-line-2);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-ink-2);
  font: inherit;
  font-size: var(--t-xs);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s ease, transform .3s ease;
}
.push-pill.is-in { opacity: 1; transform: none; }
.push-pill[hidden] { display: none; }
.push-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-warn); }
.push-pill.is-on .push-pill__dot { background: var(--c-ok); box-shadow: 0 0 0 3px var(--c-ok-tint); }
.push-pill:hover { border-color: var(--c-primary); color: var(--c-ink); }

@media (max-width: 640px) {
  .push-card__main { flex-wrap: wrap; }
  .push-card__btns { width: 100%; }
  .push-card__btns .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .push-card, .push-pill { transition: none; }
  .push-card:not(.is-on) .push-card__ic svg { animation: none; }
}

/* ==========================================================================
   پخش‌کننده صدای پیام‌رسان
   ========================================================================== */

.chat .aud {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  max-width: 300px;
  padding: 2px 0;
  user-select: none;
}
.chat .aud__play {
  flex: none;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: var(--c-primary);
  color: var(--on-fill);
  cursor: pointer;
  position: relative;
}
.chat .aud__play::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0; height: 0;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
  transform: translateX(2px);
}
.chat .aud.is-playing .aud__play::before {
  width: 12px; height: 14px;
  border: 0;
  border-inline: 4px solid currentColor;
  transform: none;
}
.chat .aud__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat .aud__name { font-size: var(--t-xs); color: var(--c-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.chat .aud__wave {
  display: flex;
  flex-direction: row;   /* در صفحه راست‌به‌چپ، میله نخست سمت راست — پیشرفت از راست */
  align-items: center;
  gap: 2px;
  height: 28px;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.chat .aud__wave:focus-visible { box-shadow: 0 0 0 2px var(--c-primary); border-radius: 4px; }
.chat .aud__wave i {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--c-ink-3) 45%, transparent);
  transition: background .12s;
}
.chat .aud__wave i.is-on { background: var(--c-primary); }
.chat .chat-msg.is-mine .aud__wave i.is-on { background: var(--c-primary-ink); }
.chat .aud__meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--c-ink-3); }
.chat .aud__t { font-variant-numeric: tabular-nums; }
.chat .aud__spd {
  border: 1px solid var(--c-line-2);
  border-radius: 99px;
  background: transparent;
  color: var(--c-ink-2);
  font: inherit;
  font-size: 13px;
  padding: 0 7px;
  cursor: pointer;
}

/* ==========================================================================
   پیام‌رسان تمام‌صفحه (دسکتاپ)
   ==========================================================================
   کادر پیام‌ها از هر سو به لبه ناحیه محتوا می‌چسبد — بی‌فاصله، و با
   کوچک‌نمایی (zoom out) هم کل ارتفاع را می‌گیرد، چون اندازه‌اش از
   ارتفاع پنجره می‌آید نه از عددی ثابت. */

@media (min-width: 901px) {
  .main:has(> .chat) {
    max-width: none;
    padding: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .main:has(> .chat) > .topbar {
    flex: none;
    margin: 0;
    border-radius: 0;
    border-width: 0 0 1px 0;
  }
  .main:has(> .chat) > .flash { margin: 8px 12px 0; }
  .main:has(> .chat) > .chat {
    --chat-h: auto;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
}

/* ==========================================================================
   کارت همکار (کلیک روی تصویر)
   ========================================================================== */

.chat .chat-av[data-uid] { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.chat .chat-av[data-uid]:hover { transform: scale(1.06); box-shadow: 0 0 0 2px var(--c-primary); }

.chat .pc {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0);
  transition: background .22s ease;
}
.chat .pc.is-in { background: rgba(0, 0, 0, .42); }
.chat .pc__box {
  position: relative;
  width: min(360px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .22s ease, transform .22s ease;
}
.chat .pc.is-in .pc__box { opacity: 1; transform: none; }
.chat .pc__load { text-align: center; color: var(--c-ink-3); padding: 30px 0; }
.chat .pc__x {
  position: absolute; top: 10px; inset-inline-start: 10px;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--c-sunken); color: var(--c-ink-2); font-size: var(--t-md); cursor: pointer;
}
.chat .pc__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.chat .pc__av {
  width: 108px; height: 108px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(145deg, var(--c-primary-2), var(--c-primary));
  color: var(--on-fill); font-size: 42px; font-weight: 700;
  box-shadow: 0 0 0 4px var(--c-surface), 0 0 0 6px color-mix(in srgb, var(--c-primary) 35%, transparent);
  margin-bottom: 8px;
  transition: width .25s ease, height .25s ease, border-radius .25s ease;
}
.chat .pc__av img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.chat .pc__av.is-zoom { width: 220px; height: 220px; border-radius: 18px; }
.chat .pc__av.is-zoom img { cursor: zoom-out; }
.chat .pc__name { margin: 0; font-size: var(--t-md); font-weight: 700; }
.chat .pc__role { font-size: 14px; color: var(--c-ink-2); }
.chat .pc__seen { font-size: var(--t-xs); color: var(--c-ink-3); }
.chat .pc__shift {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin: 12px 0 0; padding: 7px 12px; border-radius: 10px;
  background: var(--c-ok-tint); color: var(--c-ok); font-size: 14px; font-weight: 600;
}
.chat .pc__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.chat .pc__units { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.chat .pc__unit {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 10px; border-radius: 99px; font-size: var(--t-xs);
  background: color-mix(in srgb, var(--uc, var(--c-primary)) 14%, var(--c-surface));
  border: 1px solid color-mix(in srgb, var(--uc, var(--c-primary)) 35%, transparent);
}
.chat .pc__unit small { color: var(--c-ink-3); font-size: 13px; }
.chat .pc__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.chat .pc__stat { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 10px; background: var(--c-sunken); }
.chat .pc__stat b { font-size: var(--t-md); }
.chat .pc__stat span { font-size: var(--t-xs); color: var(--c-ink-3); }
.chat .pc__acts { display: flex; gap: 8px; margin-top: 14px; }
.chat .pc__acts > * { flex: 1; text-align: center; justify-content: center; }

@media (max-width: 640px) {
  .chat .pc { align-items: end; padding: 0; }
  .chat .pc__box { width: 100%; border-radius: 18px 18px 0 0; transform: translateY(30px); }
}

/* ==========================================================================
   دسته‌های خدمت
   ========================================================================== */

/* فرم «دسته تازه» فقط با دکمه بالای صفحه باز می‌شود */
details.cat-new:not([open]) { display: none; }
details.cat-new[open] {
  border: 1px solid color-mix(in srgb, var(--c-primary) 35%, var(--c-line));
  box-shadow: 0 0 0 4px var(--c-primary-tint);
  animation: cat-in .25s ease;
}
details.cat-new > summary { list-style: none; cursor: pointer; font-weight: 700; }
details.cat-new > summary::-webkit-details-marker { display: none; }
details.cat-new > summary::after { content: '×'; float: left; color: var(--c-ink-3); font-size: var(--t-md); }
@keyframes cat-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.cat-jump {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 2px;
  margin-bottom: 12px;
  background: var(--c-canvas);
  scrollbar-width: thin;
}
.cat-jump__i {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--c-line-2);
  border-radius: 99px;
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: var(--t-xs);
  white-space: nowrap;
}
.cat-jump__i:hover { border-color: var(--c-primary); color: var(--c-ink); }
.cat-jump__i i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-ink-3); }
.cat-jump__i.is-ok i   { background: var(--c-ok); }
.cat-jump__i.is-warn i { background: var(--c-warn); }
.cat-jump__i.is-bad i  { background: var(--c-danger); }
.cat-jump__i.is-off    { opacity: .55; }

section.cat { border-inline-start: 4px solid var(--uc, var(--c-primary)); scroll-margin-top: 60px; }
section.cat.is-off { opacity: .7; }
section.cat .cat__head { flex-wrap: wrap; }
.cat__counts { display: flex; gap: 6px; margin-inline-start: auto; align-self: center; }
.cat__counts span {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--c-sunken);
  font-size: var(--t-xs);
  color: var(--c-ink-2);
}
.cat__counts b { color: var(--c-ink); margin-inline-end: 3px; }
.cat__counts .is-warn { background: var(--c-warn-tint); color: var(--c-warn); }
.cat__counts .is-bad  { background: var(--c-danger-tint); color: var(--c-danger); }

details.cat__more > summary.cat__more-t {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  border-top: 1px solid var(--c-line);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
details.cat__more > summary::-webkit-details-marker { display: none; }
details.cat__more > summary::before { content: '‹'; display: inline-block; transition: transform .2s; font-size: var(--t-base); }
details.cat__more[open] > summary::before { transform: rotate(-90deg); }
details.cat__more[open] > summary { background: var(--c-sunken); }
details.cat__more[open] > .cat__body { animation: cat-in .2s ease; }

/* ------------------------------------------------- گزینش‌گر شکلک */

.chat .emo {
  position: absolute;
  bottom: 70px;
  inset-inline-end: 12px;
  z-index: 35;
  width: min(352px, calc(100% - 24px));
  height: 340px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-line-2);
  border-radius: 14px;
  background: var(--c-surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .22);
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .16s ease, transform .16s ease;
}
.chat .emo.is-in { opacity: 1; transform: none; }
.chat .emo__tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--c-line); overflow-x: auto; }
.chat .emo__tabs button { flex: none; width: 36px; height: 32px; border: 0; border-radius: 8px; background: none; font-size: var(--t-md); cursor: pointer; opacity: .65; }
.chat .emo__tabs button.is-on { background: var(--c-primary-tint); opacity: 1; }
.chat .emo__grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  align-content: start;
  gap: 2px;
}
.chat .emo__h { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--c-ink-3); padding: 2px 4px 4px; }
.chat .emo__e { height: 38px; border: 0; border-radius: 8px; background: none; font-size: 24px; line-height: 1; cursor: pointer; }
.chat .emo__e:hover { background: var(--c-sunken); transform: scale(1.12); }
.chat .chat-menu__more { flex: 0 0 34px !important; font-size: var(--t-base) !important; color: var(--c-ink-3); border: 1px dashed var(--c-line-2) !important; }

@media (max-width: 640px) {
  .chat .emo { inset-inline: 0; bottom: 0; width: 100%; height: 46vh; border-radius: 16px 16px 0 0; }
}

/* ------------------------------------------------- تنظیم گروه */

.chat .grp-set {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  margin: 6px 0 12px;
  border-radius: 12px;
  background: var(--c-sunken);
}
.chat .grp-set__av {
  position: relative;
  flex: none;
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--c-primary-2), var(--c-primary));
  color: var(--on-fill);
  font-size: 28px; font-weight: 700;
  cursor: pointer;
}
.chat .grp-set__av img { width: 100%; height: 100%; object-fit: cover; }
.chat .grp-set__av em {
  position: absolute; inset-inline: 0; bottom: 0;
  font-style: normal; font-size: 14px; text-align: center;
  background: rgba(0, 0, 0, .45); padding: 2px 0;
}
.chat .grp-set__r { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.chat .grp-set__r input { font: inherit; padding: 7px 10px; border-radius: 8px; }
.chat .grp-set__acts { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-dlg:focus { outline: none; }

/* ==========================================================================
   گزارش «وضعیت عملیات» — نمای ماه
   ========================================================================== */

.op2 {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 20px 22px;
  margin-bottom: 16px;
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--c-primary) 8%, transparent), transparent 60%),
    var(--c-surface);
}
.op2__ring { position: relative; width: 180px; height: 180px; justify-self: center; }
.op2__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.op2__track { fill: none; stroke: var(--c-sunken-2); stroke-width: 10; }
.op2__arc {
  fill: none;
  stroke: var(--rc, var(--c-primary));
  stroke-width: 10;
  stroke-linecap: round;
  animation: op2-arc 1s ease-out both;
}
@keyframes op2-arc { from { stroke-dasharray: 0 100; } }
.op2__ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.op2__ring-in b { font-size: 34px; font-weight: 700; line-height: 1.1; }
.op2__ring-in span { font-size: var(--t-xs); color: var(--c-ink-3); }

.op2__main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.op2__tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.op2__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--c-sunken);
  border: 1px solid var(--c-line);
}
.op2__tile i {
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  font-style: normal;
  font-size: 15px;
  opacity: .55;
}
.op2__tile span { font-size: var(--t-xs); color: var(--c-ink-3); }
.op2__tile b { font-size: 22px; font-weight: 700; }
.op2__tile.is-ok  { background: var(--c-ok-tint); border-color: color-mix(in srgb, var(--c-ok) 25%, transparent); }
.op2__tile.is-ok b { color: var(--c-ok); }
.op2__tile.is-bad { background: var(--c-danger-tint); border-color: color-mix(in srgb, var(--c-danger) 30%, transparent); }
.op2__tile.is-bad b { color: var(--c-danger); }

.op2__prog-bar { height: 10px; border-radius: 99px; background: var(--c-sunken-2); overflow: hidden; }
.op2__prog-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c-ok), color-mix(in srgb, var(--c-ok) 70%, var(--c-primary))); animation: op2-grow .9s ease-out both; }
@keyframes op2-grow { from { width: 0; } }
.op2__prog-l { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--c-ink-3); margin-top: 4px; }

.op2__flow-t { font-size: var(--t-xs); color: var(--c-ink-3); margin-bottom: 6px; }
.op2__flow-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--c-sunken-2); gap: 2px; }
.op2__flow-bar i { display: block; min-width: 6px; }
.op2__flow-l { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: var(--t-xs); color: var(--c-ink-2); }
.op2__flow-l span { display: inline-flex; align-items: center; gap: 6px; }
.op2__flow-l em { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.op2 .is-open { --fc: var(--c-info); }
.op2 .is-wait { --fc: var(--c-warn); }
.op2 .is-ret  { --fc: var(--c-danger); }
.op2 .is-ok   { --fc: var(--c-ok); }
.op2__flow-bar i, .op2__flow-l em { background: var(--fc); }

/* فهرست‌های «همین حالا» — نوار رنگی بالا و عدد درشت‌تر */
.op-now .op-list { border-radius: 12px; }
.op-now .op-list__h b { font-size: 30px; font-weight: 700; }

@media (max-width: 900px) {
  .op2 { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .op2__ring { width: 150px; height: 150px; }
  .op2__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .op2__arc, .op2__prog-bar i { animation: none; }
}

/* تجهیزات پرمشکل — شاخص‌ها سه‌تایی در دو ردیف */
.kpis.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) {
  .kpis.kpis--3 { gap: 8px; }
  .kpis.kpis--3 .kpi { padding: 10px 8px; min-width: 0; }
  .kpis.kpis--3 .kpi__v, .kpis.kpis--3 .kpi b { font-size: 20px; }
  .kpis.kpis--3 .kpi__k { font-size: 13px; }
}

/* ==========================================================================
   گزارش عملکرد تکنسین‌ها
   ========================================================================== */

.tp-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.tp {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 1fr) minmax(0, 2.4fr);
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-ink);
  transition: border-color .15s, box-shadow .15s;
}
.tp:hover { border-color: var(--c-primary); box-shadow: var(--c-shadow); }
.tp__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tp__who strong { display: block; font-size: 15px; }
.tp__who span { font-size: var(--t-xs); color: var(--c-ink-3); }
.tp__av {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--c-primary-2), var(--c-primary));
  color: var(--on-fill); font-weight: 700; font-size: var(--t-base);
}
.tp__prog-h { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--c-ink-3); margin-bottom: 4px; }
.tp__prog-h b { color: var(--c-ink); font-size: 14px; }
.tp__bar { height: 8px; border-radius: 99px; background: var(--c-sunken-2); overflow: hidden; }
.tp__bar i { display: block; height: 100%; border-radius: inherit; background: var(--c-primary); }
.tp__bar.is-ok i { background: var(--c-ok); }
.tp__bar.is-warn i { background: var(--c-warn); }
.tp__bar.is-bad i { background: var(--c-danger); }
.tp__nums { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.tp__nums span {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 4px; border-radius: 8px; background: var(--c-sunken);
  font-size: 13px; color: var(--c-ink-3); text-align: center;
}
.tp__nums b { font-size: 15px; color: var(--c-ink); }
.tp__nums .is-ok b   { color: var(--c-ok); }
.tp__nums .is-warn   { background: var(--c-warn-tint); }
.tp__nums .is-warn b { color: var(--c-warn); }
.tp__nums .is-bad    { background: var(--c-danger-tint); }
.tp__nums .is-bad b  { color: var(--c-danger); }

.tp-help > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--c-primary); }
.tp-help p { margin: 0 0 8px; font-size: 14px; color: var(--c-ink-2); line-height: 2; }

@media (max-width: 1100px) {
  .tp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tp__nums { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .tp { grid-template-columns: 1fr; gap: 10px; }
  .tp__nums { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* جدول ارجاع دوباره — در موبایل هر ردیف یک کارت، فقط علت‌های غیرصفر */
@media (max-width: 760px) {
  .rp-tbl thead { display: none; }
  .rp-tbl, .rp-tbl tbody, .rp-tbl tr, .rp-tbl td { display: block; width: 100%; }
  .rp-tbl tr { padding: 10px 12px; border-bottom: 1px solid var(--c-line); display: flex; flex-wrap: wrap; gap: 6px; }
  .rp-tbl td { width: auto; padding: 3px 10px !important; border: 0 !important; border-radius: 99px; background: var(--c-sunken); font-size: var(--t-xs); }
  .rp-tbl td.rp-tbl__name { flex-basis: 100%; background: none; padding: 0 0 4px !important; font-size: 14px; }
  .rp-tbl td[data-label]::before { content: attr(data-label) ': '; color: var(--c-ink-3); }
  .rp-tbl td.is-zero { display: none; }
  .rp-reassign__recent li { padding-bottom: 6px; border-bottom: 1px dashed var(--c-line); }
}

/* ==========================================================================
   کارنامه فعالیت کاربر
   ========================================================================== */

.act__head { flex-wrap: wrap; gap: 10px; }
.act__days { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--c-sunken); }
.act__days a { padding: 4px 12px; border-radius: 8px; font-size: var(--t-xs); color: var(--c-ink-2); }
.act__days a.is-on { background: var(--c-surface); color: var(--c-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.act__filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; border-bottom: 1px solid var(--c-line); }
.act__f { flex: none; padding: 4px 12px; border: 1px solid var(--c-line-2); border-radius: 99px; font-size: var(--t-xs); color: var(--c-ink-2); white-space: nowrap; }
.act__f span { margin-inline-start: 4px; padding: 0 6px; border-radius: 99px; background: var(--c-sunken); font-size: 13px; }
.act__f.is-on { border-color: var(--c-primary); background: var(--c-primary-tint); color: var(--c-primary-ink); font-weight: 600; }

.act__day { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--c-line); }
.act__day:last-of-type { border-bottom: 0; }
.act__date { position: sticky; top: 8px; align-self: start; display: flex; flex-direction: column; }
.act__date b { font-size: 14px; }
.act__date span { font-size: var(--t-xs); color: var(--c-ink-3); }
.act__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.act__i {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; border-radius: 10px;
  border-inline-start: 3px solid var(--c-line-2);
  background: var(--c-surface);
}
.act__i:hover { background: var(--c-sunken); }
.act__i--kardex   { border-inline-start-color: var(--c-ok); }
.act__i--incident { border-inline-start-color: var(--c-danger); }
.act__i--work     { border-inline-start-color: var(--c-warn); }
.act__i--stock    { border-inline-start-color: #7A4FB5; }
.act__i--asset    { border-inline-start-color: var(--c-primary); }
.act__i--auth     { border-inline-start-color: var(--c-ink-3); opacity: .85; }
.act__i--hr       { border-inline-start-color: #B23A6B; }
.act__i.is-bad .act__d { color: var(--c-danger); }
.act__ic { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--c-sunken); font-size: 14px; }
.act__b { flex: 1; min-width: 0; }
.act__l { font-size: 14px; font-weight: 600; }
.act__l a { color: inherit; }
.act__l a:hover { color: var(--c-primary); }
.act__d { font-size: var(--t-xs); color: var(--c-ink-2); overflow-wrap: anywhere; }
.act__t { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: var(--t-xs); color: var(--c-ink-3); }
.act__t small { font-size: 13px; opacity: .8; }
.act__pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 12px; }

@media (max-width: 640px) {
  .act__day { grid-template-columns: 1fr; gap: 6px; }
  .act__date { position: static; flex-direction: row; gap: 8px; align-items: baseline; }
  .act__t small { display: none; }
}

/* ==========================================================================
   میز خدمات — حالت شب صفحه پیگیری
   ==========================================================================
   رنگ‌های وضعیت (سربرگ، کارت تأمین، گام‌ها) ثابت و روشن بودند: در شب
   زمینه روشن با متنی که حالت شب روشنش کرده بود — ناخوانا. حالا هر
   وضعیت در شب زمینه تیره‌ی ته‌رنگ‌دار و متن روشن هم‌خانواده دارد. */

html[data-theme="dark"] .desk-rc,
html[data-theme="dark"] .desk-hero          { --t-line: #6E7780; --t-soft: #22262A; --t-ink: #C9CFD4; }
html[data-theme="dark"] .desk-rc--ok,
html[data-theme="dark"] .desk-hero--ok      { --t-line: #4FC38A; --t-soft: #15291F; --t-ink: #8FDDB4; }
html[data-theme="dark"] .desk-rc--check,
html[data-theme="dark"] .desk-hero--check   { --t-line: #2EC4C8; --t-soft: #16302F; --t-ink: #7FDDE0; }
html[data-theme="dark"] .desk-rc--work,
html[data-theme="dark"] .desk-hero--work    { --t-line: #E5B84A; --t-soft: #2C2615; --t-ink: #EDCB7A; }
html[data-theme="dark"] .desk-rc--supply,
html[data-theme="dark"] .desk-hero--supply  { --t-line: #6AA8E0; --t-soft: #172636; --t-ink: #A9CBEF; }
html[data-theme="dark"] .desk-rc--wait,
html[data-theme="dark"] .desk-hero--wait    { --t-line: #F2766B; --t-soft: #33201E; --t-ink: #F6A49B; }
html[data-theme="dark"] .desk-rc--void,
html[data-theme="dark"] .desk-hero--void    { --t-line: #8A9096; --t-soft: #212428; --t-ink: #B3B8BD; }

html[data-theme="dark"] .desk-hero__fact strong,
html[data-theme="dark"] .desk-hero__name    { color: var(--c-ink); }

html[data-theme="dark"] .desk-act--supply,
html[data-theme="dark"] .sd-supply-wait     { background: #172636; border-color: #6AA8E0; }
html[data-theme="dark"] .desk-act__t,
html[data-theme="dark"] .desk-now__btn,
html[data-theme="dark"] .desk-jdt__now,
html[data-theme="dark"] .desk-prog__i.is-now .desk-prog__l { color: #A9CBEF; }
html[data-theme="dark"] .desk-act__need     { background: var(--c-sunken); border-inline-start-color: #6AA8E0; color: var(--c-ink); }
html[data-theme="dark"] .desk-now__btn:hover,
html[data-theme="dark"] .desk-jdt__now:hover { background: #1E3349; }
html[data-theme="dark"] .desk-sum__i.is-hot { background: #2C2615; }
html[data-theme="dark"] .desk-sum__i.is-hot strong { color: #EDCB7A; }
html[data-theme="dark"] .pwa-ios            { background: #2C2615; color: #EDCB7A; }
html[data-theme="dark"] .pwa-ios .pwa-bar__no { color: #EDCB7A; }
html[data-theme="dark"] .desk-recent__ic,
html[data-theme="dark"] .pwa-bar__yes       { color: var(--c-primary); }
html[data-theme="dark"] .desk-offline__p    { color: var(--c-ink-3); }
html[data-theme="dark"] .photo-note.is-ok,
html[data-theme="dark"] .desk-tel           { color: var(--c-primary-ink); }
html[data-theme="dark"] .trl__card          { background: var(--c-surface); }
html[data-theme="dark"] .trl__l             { color: var(--c-ink); }
html[data-theme="dark"] .trl__tag           { background: var(--c-sunken); color: var(--c-ink-2); }
html[data-theme="dark"] .trl__to            { color: var(--c-primary-ink); }
html[data-theme="dark"] .trl__note          { color: var(--c-ink-2); }

/* گام‌های پیشرفت در شب — خط و نقطه‌های خاموش روشن‌تر */
html[data-theme="dark"] .desk-prog__i::before { background: var(--c-line-3); }
html[data-theme="dark"] .desk-prog__dot     { background: var(--c-sunken-2); }
html[data-theme="dark"] .desk-prog__l       { color: var(--c-ink-3); }

/* ==========================================================================
   کادر نوشتن پیام — سینی ابزار، ارسال/ضبط یک‌جا، پیش‌نمایش صدا
   ========================================================================== */

.chat .chat-compose__row { gap: 6px; align-items: flex-end; }
.chat .chat-compose__row textarea { flex: 1 1 auto; min-width: 0; }

/* تا متنی نیست: میکروفون؛ با نوشتن یا پیوست: ارسال */
.chat .chat-compose:not(.is-typing) [data-send] { display: none; }
.chat .chat-compose.is-typing [data-act="record"] { display: none; }
.chat .chat-compose .chat-rec.is-rec { display: inline-flex !important; }
.chat .chat-compose.has-voice .chat-compose__row { display: none; }

.chat .chat-plus { transition: transform .2s, background .2s; }
.chat .chat-plus.is-on { transform: rotate(45deg); background: var(--c-primary-tint); color: var(--c-primary); }

.chat .chat-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 10px 4px;
  animation: cat-in .18s ease;
}
.chat .chat-tools[hidden] { display: none; }
.chat .chat-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: var(--c-sunken);
  color: var(--c-ink-2);
  font: inherit;
  font-size: var(--t-xs);
  cursor: pointer;
  text-align: center;
}
.chat .chat-tool:hover { border-color: var(--c-primary); color: var(--c-ink); }
.chat .chat-tool__ic { font-size: 22px; line-height: 1; }

.chat .chat-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
}
.chat .chat-voice[hidden] { display: none; }
.chat .chat-voice .aud { flex: 1; max-width: none; }
.chat .chat-voice__acts { display: flex; gap: 6px; flex: none; }
.chat .chat-voice__del,
.chat .chat-voice__go {
  border: 0;
  border-radius: 99px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.chat .chat-voice__del { background: var(--c-danger-tint); color: var(--c-danger); }
.chat .chat-voice__go  { background: var(--c-primary); color: var(--on-fill); }

@media (max-width: 640px) {
  .chat .chat-compose__row { padding-inline: 6px; }
  .chat .chat-compose__row textarea { font-size: var(--t-base); }   /* iOS: بی بزرگ‌نمایی خودکار */
  .chat .chat-voice { flex-wrap: wrap; }
  .chat .chat-voice__acts { width: 100%; }
  .chat .chat-voice__acts button { flex: 1; }
}

/* منوی پیام — هرگز پهن‌تر از کادر گفتگو؛ ردیف شکلک در صورت لزوم اسکرول */
.chat .chat-menu { max-width: calc(100vw - 32px); }
.chat .chat-menu__rx { overflow-x: auto; scrollbar-width: none; }
.chat .chat-menu__rx::-webkit-scrollbar { display: none; }
@media (max-width: 640px) {
  .chat .emo { border-radius: 16px; inset-inline: 8px; width: auto; }
}

/* ==========================================================================
   سایدبار — سه دکمه دسترسی سریع
   ========================================================================== */

.side-quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 14px 10px;
}
.side-quick > a,
.side-quick .bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--qc) 30%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--qc) 16%, var(--c-surface)), color-mix(in srgb, var(--qc) 7%, var(--c-surface)));
  color: color-mix(in srgb, var(--qc) 70%, var(--c-ink));
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.side-quick > a:hover,
.side-quick .bell:hover { transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--qc) 25%, transparent); }
.side-quick > a.is-on { background: var(--qc); color: #fff; border-color: var(--qc); }
.side-quick svg { width: 18px; height: 18px; flex: none; }
.side-quick .bell     { --qc: #C98A0B; }
.side-quick .side-chat{ --qc: #0E7C80; }
.side-quick .side-plan{ --qc: #6B4FB0; }
html[data-theme="dark"] .side-quick .bell      { --qc: #E5B84A; }
html[data-theme="dark"] .side-quick .side-chat { --qc: #2EC4C8; }
html[data-theme="dark"] .side-quick .side-plan { --qc: #A98BEA; }
html[data-theme="dark"] .side-quick > a.is-on  { color: #0E1214; }
.side-quick .bell__txt, .side-quick .side-chat__t, .side-quick .side-plan__t { flex: none; }
.side-quick .bell__n,
.side-quick .side-chat__n,
.side-quick .side-plan__n {
  position: absolute;
  top: 50%;
  inset-inline-start: 12px;
  transform: translateY(-50%);
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--c-danger);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.side-quick .side-plan__n { background: var(--qc); }
html[data-theme="dark"] .side-quick .side-plan__n { color: #0E1214; }

/* ==========================================================================
   دفترچه
   ========================================================================== */

.pl__head .pg-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl__search { font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 10px; min-width: 200px; }
.pl__grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .pl__grid { grid-template-columns: 1fr; } }

.pl-cal { padding: 14px; position: sticky; top: 12px; }
@media (max-width: 900px) { .pl-cal { position: static; } }
.pl-cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pl-cal__nav strong { font-size: var(--t-base); }
.pl-cal__nav button {
  width: 34px; height: 34px; border: 1px solid var(--c-line-2); border-radius: 10px;
  background: var(--c-surface); color: var(--c-ink-2); font-size: var(--t-md); cursor: pointer;
}
.pl-cal__dow, .pl-cal__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.pl-cal__dow span { font-size: var(--t-xs); color: var(--c-ink-3); padding: 4px 0; }
.pl-cal__dow span:last-child { color: var(--c-danger); }
.pl-cal__d {
  position: relative;
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--c-sunken); color: var(--c-ink);
  font: inherit; cursor: pointer;
  transition: background .12s, transform .12s;
}
.pl-cal__d b { font-size: 14px; font-weight: 600; }
.pl-cal__d:hover { background: var(--c-sunken-2); transform: scale(1.04); }
.pl-cal__d.is-fri b { color: var(--c-danger); }
.pl-cal__d.is-today { border-color: var(--c-primary); }
.pl-cal__d.is-sel { background: var(--c-primary); color: var(--on-fill); }
.pl-cal__d.is-sel b { color: var(--on-fill); }
.pl-cal__dots { display: flex; gap: 3px; height: 6px; }
.pl-cal__dots i, .pl-cal__legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.pl .is-task  { background: #6B4FB0; }
.pl .is-task.is-urgent { background: var(--c-danger); }
.pl .is-done  { background: var(--c-ok); }
.pl .is-event { background: var(--c-info); }
.pl .is-note  { background: var(--c-warn); }
.pl-cal__d.is-sel .pl-cal__dots i { box-shadow: 0 0 0 1.5px var(--c-surface); }
.pl-cal__today { margin-top: 10px; width: 100%; padding: 7px; border: 1px dashed var(--c-line-2); border-radius: 10px; background: none; color: var(--c-primary); font: inherit; font-weight: 600; cursor: pointer; }
.pl-cal__legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: var(--t-xs); color: var(--c-ink-3); }
.pl-cal__legend i { margin-inline-end: 4px; }

.pl-day { min-width: 0; }
.pl-day__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pl-day__head h2 { margin: 0; font-size: var(--t-md); }

.pl-quick { padding: 10px; border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-surface); margin-bottom: 14px; }
.pl-quick__kinds, .pl-ed__kinds { display: flex; gap: 6px; margin-bottom: 8px; }
.pl-quick__kinds input, .pl-ed__kinds input { position: absolute; opacity: 0; pointer-events: none; }
.pl-quick__kinds span, .pl-ed__kinds span {
  display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--c-line-2);
  font-size: var(--t-xs); color: var(--c-ink-2); cursor: pointer;
}
.pl-quick__kinds input:checked + span, .pl-ed__kinds input:checked + span { background: #6B4FB0; border-color: #6B4FB0; color: #fff; }
.pl-quick__row { display: flex; gap: 8px; }
.pl-quick__row input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 10px; }

.pl-sec { margin-bottom: 14px; }
.pl-sec__t { font-size: 14px; color: var(--c-ink-3); margin: 0 0 8px; }
.pl-sec__t.is-bad { color: var(--c-danger); }
.pl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pl-empty { text-align: center; color: var(--c-ink-3); padding: 24px 0; font-size: 14px; }

.pl-item {
  --ic: #6B4FB0;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-inline-start: 4px solid var(--ic);
  border-radius: 12px;
  background: var(--c-surface);
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.pl-item:hover { box-shadow: var(--c-shadow); transform: translateY(-1px); }
.pl-item--event { --ic: var(--c-info); }
.pl-item--note  { --ic: var(--c-warn); background: color-mix(in srgb, var(--c-warn) 5%, var(--c-surface)); }
.pl-item.is-urgent { border-color: color-mix(in srgb, var(--c-danger) 40%, var(--c-line)); }
.pl-item.is-done { opacity: .6; }
.pl-item.is-done .pl-item__t { text-decoration: line-through; }
.pl-item__cb, .pl-step__cb {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid var(--ic); border-radius: 7px; background: none; cursor: pointer; position: relative;
}
.pl-item.is-done .pl-item__cb, li.is-done > .pl-step__cb { background: var(--c-ok); border-color: var(--c-ok); }
.pl-item.is-done .pl-item__cb::after, li.is-done > .pl-step__cb::after {
  content: '✓'; position: absolute; inset: 0; color: #fff; font-size: 14px; line-height: 18px; text-align: center;
}
.pl-item__ic { flex: none; width: 22px; text-align: center; }
.pl-item__b { flex: 1; min-width: 0; }
.pl-item__t { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pl-item__pin { margin-inline-end: 4px; }
.pl-item__m { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.pl-item__m span { font-size: var(--t-xs); padding: 1px 8px; border-radius: 99px; background: var(--c-sunken); color: var(--c-ink-2); }
.pl-item__m .is-time { background: color-mix(in srgb, var(--c-info) 14%, var(--c-surface)); color: var(--c-info); font-weight: 600; }
.pl-item__m .is-rem  { background: var(--c-warn-tint); color: var(--c-warn); }
.pl-item__m .is-sent { opacity: .6; }
.pl-item__m .is-urgent { background: var(--c-danger-tint); color: var(--c-danger); font-weight: 600; }
.pl-item__m .is-imp    { background: var(--c-warn-tint); color: var(--c-warn); }
.pl-item__body { margin-top: 6px; font-size: 14px; color: var(--c-ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.pl-item__prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--t-xs); color: var(--c-ink-3); }
.pl-item__bar { flex: 1; max-width: 160px; height: 6px; border-radius: 99px; background: var(--c-sunken-2); overflow: hidden; }
.pl-item__bar i { display: block; height: 100%; background: var(--c-ok); border-radius: inherit; }
.pl-item__steps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-item__steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--c-ink-2); }
.pl-item__steps li.is-done span { text-decoration: line-through; opacity: .7; }
.pl-step__cb { width: 18px; height: 18px; border-radius: 5px; border-width: 1.5px; }
li.is-done > .pl-step__cb::after { font-size: 13px; line-height: 15px; }

/* ویرایشگر */
.pl-ed { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0); transition: background .18s; }
.pl-ed.is-in { background: rgba(0, 0, 0, .42); }
.pl-ed[hidden] { display: none; }
.pl-ed__box {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 16px 18px; border-radius: 18px; background: var(--c-surface); color: var(--c-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .18s, transform .18s;
}
.pl-ed.is-in .pl-ed__box { opacity: 1; transform: none; }
.pl-ed__top { display: flex; justify-content: space-between; align-items: center; }
.pl-ed__x { border: 0; background: var(--c-sunken); width: 32px; height: 32px; border-radius: 50%; font-size: var(--t-md); cursor: pointer; color: var(--c-ink-2); }
.pl-ed__title { font: inherit; font-size: var(--t-base); font-weight: 700; padding: 8px 10px; border-radius: 10px; }
.pl-ed__body { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 10px; resize: vertical; }
.pl-ed__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pl-ed__grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-xs); color: var(--c-ink-3); }
.pl-ed__grid label[hidden], .pl-ed [data-not-note][hidden] { display: none; }
.pl-ed__grid input, .pl-ed__grid select { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 9px; }
.pl-ed__colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-ed__colors label { cursor: pointer; }
.pl-ed__colors input { position: absolute; opacity: 0; }
.pl-ed__colors i { display: block; width: 24px; height: 24px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 3px transparent; }
.pl-ed__colors input:checked + i { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-ink-2); }
.pl-ed__pin { margin-inline-start: auto; font-size: 14px; color: var(--c-ink-2); display: inline-flex; gap: 6px; align-items: center; }
.pl-ed__pin input { position: static; opacity: 1; }
.pl-ed__steps { padding: 10px; border-radius: 12px; background: var(--c-sunken); }
.pl-ed__steps-h { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.pl-ed__steps ul { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-ed__step { display: flex; gap: 6px; align-items: center; }
.pl-ed__step input[type=text] { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.pl-ed__step.is-done input[type=text] { text-decoration: line-through; opacity: .65; }
.pl-ed__mv, .pl-ed__rm { border: 0; background: none; color: var(--c-ink-3); cursor: pointer; font-size: 15px; width: 26px; }
.pl-ed__rm:hover { color: var(--c-danger); }
.pl-ed__step-add { display: flex; gap: 6px; }
.pl-ed__step-add input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.pl-ed__acts { display: flex; gap: 8px; justify-content: space-between; }
@media (max-width: 640px) {
  .pl-ed { align-items: end; padding: 0; }
  .pl-ed__box { width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; }
}

.pl-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 99px; background: var(--toast-bg, #23272B); color: var(--toast-ink, #fff);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 300;
}
.pl-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   جلسه — کارت در پیام‌رسان، چشمک در دفترچه
   ========================================================================== */

.chat .chat-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.chat .chat-bub.has-meet { padding: 6px; min-width: min(320px, 78vw); }
.chat .mt {
  --mc: var(--c-info);
  border: 1px solid color-mix(in srgb, var(--mc) 35%, transparent);
  border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 12%, var(--c-surface)), var(--c-surface) 70%);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background .4s ease, border-color .4s ease;
}
.chat .mt.is-ok     { --mc: var(--c-ok); }
.chat .mt.is-no     { --mc: var(--c-danger); }
.chat .mt.is-cancel { --mc: var(--c-ink-3); opacity: .75; }
.chat .mt.is-flip   { animation: mt-flip .5s ease; }
@keyframes mt-flip { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: none; } }
.chat .mt__h { display: flex; gap: 10px; align-items: center; }
.chat .mt__ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--mc) 18%, var(--c-surface)); font-size: var(--t-md); }
.chat .mt__h strong { display: block; font-size: 15px; }
.chat .mt__h span { font-size: var(--t-xs); color: var(--c-ink-3); }
.chat .mt__facts { display: flex; flex-wrap: wrap; gap: 6px; }
.chat .mt__facts span { font-size: var(--t-xs); padding: 2px 9px; border-radius: 99px; background: var(--c-sunken); }
.chat .mt__agenda { font-size: var(--t-xs); color: var(--c-ink-2); white-space: pre-line; padding: 6px 8px; border-radius: 8px; background: var(--c-sunken); }
.chat .mt__ppl { display: flex; flex-wrap: wrap; gap: 4px; }
.chat .mt__p { font-size: var(--t-xs); padding: 1px 8px; border-radius: 99px; border: 1px solid var(--c-line-2); color: var(--c-ink-2); }
.chat .mt__p.is-accepted { border-color: color-mix(in srgb, var(--c-ok) 45%, transparent); color: var(--c-ok); }
.chat .mt__p.is-declined { border-color: color-mix(in srgb, var(--c-danger) 45%, transparent); color: var(--c-danger); text-decoration: line-through; }
.chat .mt__p.is-in { background: var(--c-ok-tint); font-weight: 600; }
.chat .mt__acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat .mt__btn { border: 0; border-radius: 10px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.chat .mt__btn--yes { background: var(--c-ok); color: #fff; flex: 1; }
.chat .mt__btn--no  { background: var(--c-danger); color: #fff; flex: 1; }
html[data-theme="dark"] .chat .mt__btn--yes, html[data-theme="dark"] .chat .mt__btn--no { color: #0E1214; }
.chat .mt__btn--go  { background: var(--c-primary); color: var(--on-fill); }
.chat .mt__btn--ghost { background: none; border: 1px solid var(--c-line-2); color: var(--c-ink-3); font-weight: 400; }
.chat .mt__state { font-size: var(--t-xs); font-weight: 600; color: var(--mc); }
.chat .chat-mt-inv { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.chat .chat-mt-inv label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--c-ink); }

/* دفترچه: چشمک پنج‌باره سطر و روز تازه‌ثبت‌شده */
.pl-item.is-blink,
.pl-cal__d.is-blink { animation: pl-blink 1.1s ease-in-out 5; }
@keyframes pl-blink {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-ok) 0%, transparent); transform: none; }
  45%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c-ok) 45%, transparent), 0 0 22px color-mix(in srgb, var(--c-ok) 55%, transparent); transform: scale(1.025); }
}
.pl-flash {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--c-ok-tint); color: var(--c-ok); font-weight: 600;
  animation: cat-in .3s ease; transition: opacity .6s ease, transform .6s ease;
}
.pl-flash.is-out { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .pl-item.is-blink, .pl-cal__d.is-blink { animation-iteration-count: 2; } }

/* ==========================================================================
   ساختار سازمانی
   ========================================================================== */

.org { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.org-g {
  margin-inline-start: calc(var(--d, 0) * 28px);
  border-inline-start: 4px solid var(--gc, var(--c-primary));
  padding: 12px 16px;
}
.org-g.is-off { opacity: .6; }
.org-g__h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.org-g__t { display: flex; align-items: center; gap: 8px; }
.org-g__t strong { font-size: 15px; }
.org-g__mgr { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--c-ink-2); }
.org-g__mgr .is-none b { color: var(--c-warn); }
.org-g__acts { margin-inline-start: auto; display: flex; gap: 6px; }
.org-g__m { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.org-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--c-sunken); font-size: 14px; }
.org-chip small { color: var(--c-ink-3); font-size: 13px; }
.org-chip.is-orphan { background: var(--c-danger-tint); padding-inline-end: 10px; }
.org-chip__x { border: 0; background: none; color: var(--c-ink-3); cursor: pointer; font-size: 15px; width: 20px; }
.org-chip__x:hover { color: var(--c-danger); }
.org-g__add { display: flex; gap: 6px; margin-top: 10px; }
.org-g__add select { font: inherit; font-size: 14px; padding: 5px 8px; border-radius: 8px; max-width: 280px; }
@media (max-width: 640px) { .org-g { margin-inline-start: calc(var(--d, 0) * 12px); } }

/* ==========================================================================
   خوانایی در موبایل — کف اندازه قلم
   ==========================================================================
   برچسب‌ها، تراشه‌ها و زمان پیام‌ها در چند جای قدیمی ۱۰ تا ۱۲ پیکسل
   بودند؛ روی گوشی ناخوانا. در صفحه‌های کوچک، کف ۱۳ پیکسل. */
@media (max-width: 640px) {
  .chip, .role, .hint, .field__hint, .sd-pill,
  .chat .chat-bub__meta, .chat .chat-bub__meta span, .chat .chat-seen,
  .chat .chat-day, .chat .chat-top__who span, .chat .chat-ref span,
  .chat .chat-item__t, .chat .chat-item__p, .chat-item__time,
  .of-bar span, .tp__nums span, .org-chip small, .un-person small { font-size: 13px !important; }
  .tl-stat strong { font-size: var(--t-md); }
  .card__head h2 { font-size: var(--t-md); }
}

/* ==========================================================================
   برگه‌های پایین‌آمدنی در موبایل و جزیره ناوبری
   ==========================================================================
   کارت همکار، ویرایشگر دفترچه، فرم‌های پیام‌رسان و گزینش‌گر شکلک در
   گوشی از پایین بالا می‌آیند — و جزیره ناوبری روی بخش پایینشان
   می‌نشست؛ دکمه «ذخیره» و ادامه کارت پنهان می‌ماند. تا یکی از این‌ها باز
   است، جزیره کنار می‌رود؛ و دکمه‌های پایان هر برگه همیشه دیده می‌شوند. */

@media screen and (max-width: 900px) {
  body:has(.pl-ed:not([hidden])) .mbar,
  body:has(.chat .pc) .mbar,
  body:has(.chat .chat-hr) .mbar,
  body:has(.chat .emo) .mbar,
  body:has(dialog[open]) .mbar {
    transform: translateY(140%);
    opacity: 0;
    pointer-events: none;
  }
  .mbar { transition: transform .22s ease, opacity .22s ease; }
}

@media (max-width: 640px) {
  .pl-ed__box,
  .chat .pc__box,
  .chat .chat-hr__box { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

  /* دکمه‌های پایان ویرایشگر دفترچه — چسبیده به پایین برگه */
  .pl-ed__acts {
    position: sticky;
    bottom: calc(-16px - env(safe-area-inset-bottom, 0px));
    margin: 0 -18px calc(-16px - env(safe-area-inset-bottom, 0px));
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--c-surface);
    border-top: 1px solid var(--c-line);
    z-index: 2;
  }
  .pl-ed__acts .btn { flex: 1; }

  /* کارت همکار — بلندتر از صفحه نشود */
  .chat .pc__box { max-height: 88dvh; }
}

/* ==========================================================================
   فشرده‌تر و یکدست — صفحه‌های تازه هم‌اندازه بقیه سامانه
   ========================================================================== */
.tl-status { gap: 8px; margin-bottom: 14px; }
.tl-stat { padding: 9px 12px; gap: 1px; }
.tl-stat strong { font-size: 16px; }
.tl-stat__l, .tl-stat__s { font-size: 13px; }
.stk-node, .of-row, .pf-p, .tp, .pl-item, .act__i { padding-block: 8px; }
.of-row, .pf-p { padding-inline: 12px; }
.tp { gap: 14px; }
.tp__nums span { padding: 4px 3px; }
.tp__nums b { font-size: 14px; }
.pf-p__s { width: 44px; height: 44px; font-size: 17px; border-radius: 12px; }
.pf-sum__score { width: 84px; height: 84px; }
.pf-sum__score b { font-size: 28px; }
.wn-chips span { padding: 8px 12px; font-size: 14px; }
.wn-qb { padding: 6px 10px; font-size: 14px; }
.pl-item { gap: 10px; }
.pl-cal__d b { font-size: 13px; }
.org-g { padding: 10px 14px; }
.side-quick > a, .side-quick .bell { min-height: 38px; font-size: 14px; padding: 6px 12px; }
@media (max-width: 640px) { .tl-stat strong { font-size: 16px; } }

/* اعلان‌ها — در صفحه خودش رنگ پر، مثل پیام‌ها و دفترچه */
.side-quick .bell.is-on { background: var(--qc) !important; color: #fff !important; border-color: var(--qc) !important; }
html[data-theme="dark"] .side-quick .bell.is-on { color: #0E1214 !important; }
.side-quick .bell.is-on svg { color: inherit; }

/* ==========================================================================
   دکمه بازگشت — سر نوار بالا
   ========================================================================== */
.tb-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 34px;
  padding: 0 12px 0 8px;
  margin-inline-end: 10px;
  border: 1px solid var(--c-line-2);
  border-radius: 10px;
  background: var(--c-surface);
  color: var(--c-ink-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.tb-back:hover { border-color: var(--c-primary); color: var(--c-primary); }
.tb-back svg { flex: none; }
@media (max-width: 640px) {
  .tb-back { padding: 0 8px; height: 32px; margin-inline-end: 6px; }
  .tb-back span { display: none; }
}

/* ==========================================================================
   کاشی‌های وضعیت — جان‌دارتر: رنگ پر ملایم، عدد درشت و پررنگ
   ==========================================================================
   پیشتر فقط لبه کاشی رنگ داشت و بقیه یکدست بود. حالا هر کاشی زمینه
   رنگی ملایم، نوار رنگی بالا و عدد درشت به همان رنگ دارد. */

.tl-stat {
  --sc: var(--c-primary);
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--sc) 22%, var(--c-line));
  border-inline-start: 1px solid color-mix(in srgb, var(--sc) 22%, var(--c-line));
  border-radius: 14px;
  padding: 14px 14px 12px;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--sc) 14%, transparent), transparent 65%),
    var(--c-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tl-stat::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--sc), color-mix(in srgb, var(--sc) 55%, #fff));
}
a.tl-stat:hover, .tl-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--sc) 18%, transparent); }
.tl-stat.is-ok   { --sc: var(--c-ok); }
.tl-stat.is-warn { --sc: var(--c-warn); }
.tl-stat.is-bad  { --sc: var(--c-danger); }
.tl-stat.is-warn, .tl-stat.is-bad { background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--sc) 16%, transparent), transparent 65%),
    var(--c-surface); }
.tl-stat__l { font-size: 13px; font-weight: 700; color: var(--c-ink-2); }
.tl-stat strong {
  font-size: 23px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--sc);
  letter-spacing: -.2px;
}
.tl-stat.is-bad strong { color: var(--c-danger); }
.tl-stat__s { font-size: 12.5px; color: var(--c-ink-3); }
@media (max-width: 640px) { .tl-stat strong { font-size: 20px; } .tl-stat { padding: 12px 12px 10px; } }

/* سربرگ کارت‌ها — عنوان پررنگ‌تر با نشانه رنگی */
.card__head h2 { font-weight: 800; }
.of-row__b strong, .pf-p__b strong, .tp__who strong, .pl-item__t, .org-g__t strong { font-weight: 800; }

/* ==========================================================================
   حضور و غیاب — صفحه مدیریت
   ========================================================================== */

.ci-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--c-line); }
.ci-toolbar input[type=search] { flex: 1; min-width: 180px; font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.ci-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--c-sunken); }
.ci-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font: inherit; font-size: 13.5px; color: var(--c-ink-2); cursor: pointer; }
.ci-tabs button.is-on { background: var(--c-surface); color: var(--c-primary); font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.ci-tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.ci-tbl th { position: sticky; top: 0; z-index: 1; background: var(--c-sunken); font-size: 13px; font-weight: 700; color: var(--c-ink-3); text-align: right; padding: 10px 14px; }
.ci-tbl td { padding: 10px 14px; border-bottom: 1px solid var(--c-line); vertical-align: middle; font-size: 14px; }
.ci-tbl tr:hover td { background: color-mix(in srgb, var(--c-primary) 4%, transparent); }
.ci-tbl tr.is-req td:first-child { box-shadow: inset -4px 0 0 var(--c-primary); }
.ci-who { display: flex; align-items: center; gap: 10px; }
.ci-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none;
  background: linear-gradient(145deg, var(--rc, #0E9AA0), color-mix(in srgb, var(--rc, #0E7C80) 70%, #000)); }
.ci-who b { display: block; font-weight: 800; }
.ci-who small { color: var(--c-ink-3); font-size: 12.5px; }
.ci-role { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700;
  background: color-mix(in srgb, var(--rc) 14%, var(--c-surface)); color: color-mix(in srgb, var(--rc) 75%, var(--c-ink)); }
.ci-st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.ci-st::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ci-st.is-in   { color: var(--c-ok); background: var(--c-ok-tint); }
.ci-st.is-wait { color: var(--c-warn); background: var(--c-warn-tint); }
.ci-st.is-out  { color: var(--c-danger); background: var(--c-danger-tint); }
.ci-st.is-na   { color: var(--c-ink-3); background: var(--c-sunken); }

/* کلید روشن/خاموش */
.ci-sw { position: relative; display: inline-block; width: 46px; height: 26px; }
.ci-sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.ci-sw i { position: absolute; inset: 0; border-radius: 99px; background: var(--c-line-3); transition: background .2s; }
.ci-sw i::after { content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.ci-sw input:checked + i { background: var(--c-primary); }
.ci-sw input:checked + i::after { transform: translateX(-20px); }
.ci-sw input:focus-visible + i { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.ci-save { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px;
  background: var(--c-surface); border-top: 1px solid var(--c-line); border-radius: 0 0 14px 14px; }
.ci-save span { font-size: 14px; color: var(--c-ink-2); }
.ci-save b { color: var(--c-primary); font-weight: 800; }

@media (max-width: 760px) {
  .ci-tbl thead { display: none; }
  .ci-tbl, .ci-tbl tbody, .ci-tbl tr, .ci-tbl td { display: block; }
  .ci-tbl tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
  .ci-tbl td { padding: 0; border: 0; }
  .ci-tbl td.ci-c-who { grid-column: 1; }
  .ci-tbl td.ci-c-sw  { grid-column: 2; grid-row: 1; align-self: center; }
  .ci-tbl td.ci-c-role, .ci-tbl td.ci-c-unit, .ci-tbl td.ci-c-st { grid-column: 1 / -1; display: inline-block; }
}

/* برگه‌های QR — کارت‌های جدا با فیلدهای برچسب‌دار */
.ci-points { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ci-pt {
  border: 1px solid var(--c-line); border-radius: 16px; background: var(--c-surface); overflow: hidden;
  display: flex; flex-direction: column;
}
.ci-pt__h { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c-primary) 12%, var(--c-surface)), var(--c-surface)); border-bottom: 1px solid var(--c-line); }
.ci-pt__qr { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--c-surface); border: 1px solid var(--c-line-2); }
.ci-pt__h b { display: block; font-weight: 800; font-size: 15.5px; }
.ci-pt__h small { color: var(--c-ink-3); font-size: 12.5px; }
.ci-pt__h .ci-st { margin-inline-start: auto; }
.ci-pt__b { padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ci-f { display: flex; flex-direction: column; gap: 5px; }
.ci-f--wide { grid-column: 1 / -1; }
.ci-f label { font-size: 13px; font-weight: 700; color: var(--c-ink-2); }
.ci-f input { font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 10px; width: 100%; box-sizing: border-box; }
.ci-f small { font-size: 12px; color: var(--c-ink-3); }
.ci-pt__f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px dashed var(--c-line); background: var(--c-sunken); }
.ci-pt__f .ci-act { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--c-ink-2); margin-inline-end: auto; }
.ci-pt--new { border-style: dashed; border-width: 2px; border-color: color-mix(in srgb, var(--c-primary) 40%, var(--c-line)); }
.ci-pt--new .ci-pt__h { background: var(--c-primary-tint); }
@media (max-width: 640px) { .ci-pt__b { grid-template-columns: 1fr; } }

/* ==========================================================================
   دروازه اعلام حضور — در theme-v2 تا به شیوه‌نامه دیگری وابسته نباشد
   ========================================================================== */
.cg { display: flex; justify-content: center; padding: 16px 0 28px; }
.cg__card { width: min(540px, 100%); border-radius: 22px; overflow: hidden; background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: 0 18px 50px rgba(0,0,0,.10); }
.cg__hero {
  position: relative; text-align: center; padding: 26px 22px 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2EC4C8 0%, transparent 55%), linear-gradient(140deg, #0E7C80, #0B5E62);
}
html[data-theme="dark"] .cg__hero { background: radial-gradient(120% 140% at 100% 0%, rgba(46,196,200,.45) 0%, transparent 55%), linear-gradient(140deg, #0F5457, #0A3C3F); }
.cg__badge {
  width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); box-shadow: 0 10px 24px rgba(0,0,0,.18);
  animation: cg-pulse 2.6s ease-in-out infinite;
}
@keyframes cg-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.35), 0 10px 24px rgba(0,0,0,.18); } 50% { box-shadow: 0 0 0 10px rgba(255,255,255,0), 0 10px 24px rgba(0,0,0,.18); } }
.cg__hero h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; color: #fff; }
.cg__hero p { margin: 0 auto; max-width: 400px; font-size: 14.5px; line-height: 1.9; opacity: .92; }
.cg__time { display: inline-flex; gap: 10px; align-items: baseline; margin-top: 12px; padding: 5px 14px; border-radius: 99px; background: rgba(0,0,0,.18); font-size: 13.5px; }
.cg__time b { font-size: 17px; font-weight: 800; }

.cg__steps { list-style: none; margin: 0; padding: 18px 18px 6px; display: flex; flex-direction: column; gap: 10px; }
.cg__steps li {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: var(--c-sunken); border: 1px solid transparent; color: var(--c-ink-3); transition: all .2s;
}
.cg__steps li b {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-line-3); color: #fff; font-size: 15px; font-weight: 800;
}
.cg__steps li strong { display: block; font-size: 15px; font-weight: 800; color: var(--c-ink-2); }
.cg__steps li span { font-size: 13.5px; line-height: 1.8; }
.cg__steps li.is-now { background: var(--c-primary-tint); border-color: color-mix(in srgb, var(--c-primary) 45%, transparent); color: var(--c-ink-2); box-shadow: 0 6px 16px color-mix(in srgb, var(--c-primary) 15%, transparent); }
.cg__steps li.is-now b { background: var(--c-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary) 25%, transparent); }
.cg__steps li.is-now strong { color: var(--c-ink); }
.cg__steps li.is-done { background: var(--c-ok-tint); color: var(--c-ink-2); }
.cg__steps li.is-done b { background: var(--c-ok); }
.cg__link { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: 10px; background: var(--c-surface); border: 1px solid var(--c-primary); color: var(--c-primary); font-weight: 700; font-size: 13.5px; }

.cg__form { display: flex; gap: 10px; padding: 12px 18px 4px; }
.cg__form input {
  flex: 1; min-width: 0; height: 56px; border-radius: 14px; text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 800; letter-spacing: 8px;
  border: 2px solid var(--c-primary); background: var(--c-surface); color: var(--c-ink);
}
.cg__form input::placeholder { letter-spacing: 6px; color: var(--c-line-3); font-size: 16px; }
.cg__go { flex: none; padding: 0 22px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #0E9AA0, #0E7C80); color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(14,124,128,.3); }
html[data-theme="dark"] .cg__go { background: linear-gradient(135deg, #2EC4C8, #1E9EA2); color: #0E1214; }
.cg__form.is-off input { border-color: var(--c-line-2); background: var(--c-sunken); }
.cg__form.is-off .cg__go { background: var(--c-line-3); box-shadow: none; cursor: not-allowed; }
.cg__hint { margin: 8px 18px 0; text-align: center; font-size: 13.5px; color: var(--c-warn); font-weight: 700; }
.cg__help { display: flex; gap: 10px; align-items: flex-start; margin: 16px 18px 18px; padding: 12px 14px; border-radius: 14px; background: var(--c-warn-tint); color: var(--c-ink-2); font-size: 13.5px; line-height: 1.8; }
@media (max-width: 640px) {
  .cg { padding: 6px 0 16px; }
  .cg__form { flex-direction: column; }
  .cg__go { height: 50px; }
}
@media (prefers-reduced-motion: reduce) { .cg__badge { animation: none; } }
