/* ══ بازبینی کامل ظاهر و کارکرد — دور بیست‌وسوم ══════════════════════════════
   «کل سامانه رو کامل و دقیق بررسی کن هر جایی که باید UI/UX درست بشه، درست
   کن». Three reviewers walked every page as each role at 1440, 1280 and 390;
   what they measured and this file fixes is written beside each rule. Loaded
   last, after shell.css. */

/* ── رنگ اقدامِ حذف روی هاور قرمز می‌ماند، نه بنفش ──
   The shared hover palette (interactions.css) paints every button's text in
   the house purple; a «حذف» turning purple under the pointer reads as a
   different, harmless action. The ids only outweigh that palette. */
.act-btn-danger:not(#k-none):not(#k-none-2):hover,
.btn.btn-danger-outline:not(#k-none):not(#k-none-2):hover {
    color: var(--red-deep) !important;
    background-color: #fdf1ef !important;
    border-color: var(--red-deep) !important;
    box-shadow: 0 0 0 3px rgba(184, 57, 42, 0.12) !important;
}
.act-btn-ok:not(#k-none):not(#k-none-2):hover {
    color: #1d7a4c !important;
    background-color: #eaf6ef !important;
    border-color: #1d7a4c !important;
}

/* ── عنوان پنل کنار نوار رنگی‌اش ──
   A panel head lays out its bar (::before), its title and its link. Heads
   that spread them with space-between pushed the title to the middle or the
   far end, away from its own bar (اعلان‌ها، هفته‌ی برنامه، گزارش ماهانه،
   مرور، نتیجه‌ی کلیدی). The title stays by its bar; a control at the end of
   the head goes to the far end by itself. */
.panel-head { justify-content: flex-start !important; }
.panel-head > :is(a, button, form, select, .btn, .act-btn, .panel-head-actions, .head-actions):last-child:not(:first-child) {
    margin-inline-start: auto;
}
.plan-head { display: flex; align-items: center; justify-content: flex-start; gap: 0.55rem; }
.plan-head > :is(a, button, form, .btn, .act-btn):last-child:not(:first-child) { margin-inline-start: auto; }

/* ── زیرعنوان صفحه زیر عنوان، نه در انتهای دیگر ردیف ──
   A muted line in a page head sat at the far left end of the title row on
   nine pages (KPI، گزارش‌ها، مانیتور، فرم‌ها، نرم‌افزارها، SOP، جلسات …). */
.page-head > :is(span.muted, p.muted, p.page-sub) {
    flex-basis: 100%;
    order: 2;
    margin: -0.35rem 0 0;
    font-size: 0.94rem;
}
.page-head.unit-head { justify-content: flex-start; }
.crm-sub { margin: -0.4rem 0 0.75rem; font-size: 0.92rem; }

/* ── شمارنده‌ی تب: روی تب فعال بنفش، روی بقیه کم‌رنگ ──
   It was the other way round — a leftover from when the active tab was a
   filled pill. */
.tab .tab-badge { background: var(--bg); color: var(--muted); }
.tab.active .tab-badge { background: var(--accent); color: var(--on-accent); }

/* ── برچسب‌ها و تراشه‌ها یک خط ──
   «در حال اجرا» broke into three lines on project cards; chips never wrap. */
.badge { white-space: nowrap; flex-shrink: 0; }
.project-card-head { align-items: flex-start; }
.project-card-head h3 { min-width: 0; }
.approval-verdict { white-space: nowrap; flex-shrink: 0; }
.approval-chip { justify-self: start; inline-size: fit-content; }

/* ── جدول‌ها: مبلغ یک‌تکه، ستون آخر داخل کارت ──
   On /crm/reports and /finance/monitor the tables ran 70–180px past their
   card and the last column was cut at the edge. A figure keeps its unit on
   its line; the table may wrap its words instead. */
.table td bdi { white-space: nowrap; }
.desk-grid .table td.nowrap, .fin-by-project td.nowrap { white-space: normal; }

/* ── تراشه‌های انتخابی و گزینه‌ها هاور دارند ──
   «هر جایی که قابل کلیک هست هاور دار باشه»: the activity kinds, the tick
   chips, the choice rows and the board's column heads gave no sign under the
   pointer. */
.crm-kind:hover span, .chip-check:hover .chip {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-ink);
}
label.tc-choice:hover, .picker-item:hover { background: var(--accent-soft); }
.can-arrange .crm-col-head:hover { background: var(--accent-soft); }

/* ── تیک‌های اول ردیف هم‌تراز بقیه ──
   The first tick chip rode 9.6px above its row: the CRM form's label margin
   reached it too. */
:is(.crm-edit-form, .crm-new-form, .crm-rules) .chip-check { margin: 0; }
.crm-rules > .chip-check { margin-top: 12px; }

/* ── تاریخ‌گزین باریک: «انتخاب تاریخ» یک خط ── */
.jp-display { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-deal-side .crm-two:has(.jalali-picker) { grid-template-columns: 1fr; }

/* ── مرحله‌های فروش: دکمه‌ها هم‌تراز ورودی‌ها، ستون‌ها روی هم ── */
.crm-stage-row > .btn { margin: 0; }
.crm-stage-row, .crm-stage-new {
    grid-template-columns: 2rem minmax(0, 1fr) 6.5rem 4.5rem 2.75rem 2.75rem 4.5rem;
}
.crm-stage-new > .btn { grid-column: 4 / -1; justify-self: stretch; margin: 0; }

/* ── فیلترها کنار هم، نه سه منوی تمام‌عرض روی هم ── */
.filter-bar select { width: auto; flex: 1 1 13rem; max-width: 18rem; min-height: 2.6rem; }
.filter-row .filter-field:has(> .btn) { flex: 0 0 auto; min-width: 0; }

/* ── تخته‌ی CRM در ۱۲۸۰: ستون‌ها کمتر از ۱۸۰ پیکسل نمی‌شوند ── */
.crm-col-title { align-items: flex-start; }
.crm-card-money, .crm-card-foot > span:last-child { white-space: nowrap; }

/* ── گفت‌وگو: جعبه‌ی نوشتن همیشه در دید ──
   The chat grid grew to the height of the 21-person list, so the box to type
   in sat at y=1383 on a 900px screen. */
@media (min-width: 901px) {
    body.section-chat .chat-shell { height: calc(100dvh - 186px); min-height: 460px; }
    body.section-chat .chat-shell > .chat-peers,
    body.section-chat .chat-shell > .chat-main { min-height: 0; max-height: 100%; }
    body.section-chat .work-side .side-fold { display: none; }
}

/* ── نام لاتین در جای خودش ── */
.oc-name { unicode-bidi: plaintext; }

/* ── فلش جمع کردن منو و شمارنده‌ها ──
   A count at the end of a menu row sat under the fold arrow. Rows leave the
   arrow its lane; the active tab still reaches the panel. */
@media (min-width: 901px) {
    .sidebar .side-link { padding-inline-end: 26px; }
    body.side-folded .sidebar .side-link { padding-inline-end: 20px; }
}

/* ── میز کار: بی اسکرول اضافه وقتی چیزی برای اسکرول نیست ── */
@media (min-width: 901px) {
    .work-side {
        height: calc(100vh - var(--topbar-h) - 60px);
        height: calc(100dvh - var(--topbar-h) - 60px);
    }
}
.side-fold > .side-panel-head { cursor: pointer; }

/* ── انتخاب همکار در اشتراک صورت‌جلسه: یک خط برای هر نفر ── */
.meeting-share-body .picker-item {
    display: flex; align-items: center; gap: 0.55rem; margin: 0; font-weight: 400;
}
.meeting-share-body .unit-checks { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

/* ── جدول پاسخ فرم‌ها: نرم، خوانا، بی خط سیاه ──
   (the black-ruled fixed grid now belongs to the printed schedule sheet only) */
.sheet-block .table-wrap { overflow-x: auto; }
.sheet-block .sheet-table:not(.sheet-answers) th,
.sheet-block .sheet-table:not(.sheet-answers) td { white-space: nowrap; padding: 0.55rem 0.75rem; }
.sheet-answers .num-cell { font-variant-numeric: normal; }

/* ── فرم آنلاین: کادرها دیده می‌شوند، همه یک رنگ ── */
.field-cell input, .field-cell select, .field-cell textarea {
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--gap-list);
    margin-bottom: 0.9rem;
}
.field-row label { margin-top: 0; }

/* ── ستون دکمه‌های ردیف کاربران: خط زیر ردیف سر جایش ── */
td.row-actions { display: table-cell; white-space: nowrap; }
td.row-actions > * + * { margin-inline-start: 0.5rem; }

/* ── کارت‌ها و تیتر‌هایی که لینک‌اند زیرخط نمی‌خورند ── */
a.card { text-decoration: none; color: inherit; }
.sop-row a.line-title { text-decoration: none; }

/* ── واحدها یک رنگ: بنفش فقط در نشانه‌ها ── */
:is(.unit-mark-blue, .unit-mark-green, .unit-mark-orange, .unit-mark-violet) {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

/* ── صفحه وقتی بلند یا کوتاه است جابه‌جا نمی‌شود ── */
html { scrollbar-gutter: stable; }

/* ── فلوچارت SOP روی گوشی ریز نمی‌شود؛ قابش خودش اسکرول دارد ── */
@media (max-width: 700px) {
    .sop-flow { min-width: 520px; }
}

/* ── گوشی: جدول‌های کارتی ──
   A value stayed by its label instead of flying to the far edge, which split
   «ریال» and phone numbers away from their figure. Only chips that do
   something get the 40px tap target. */
@media (max-width: 700px) {
    .table td { justify-content: flex-start; gap: 0.35rem; flex-wrap: wrap; }
    .table td[data-label]::before { margin-inline-end: auto; }
    .chip:not(a):not(button):not(label) { min-height: 0; }
    .panel-head:has(.btn) { flex-wrap: wrap; }
}

/* ── انتخاب فایل به فارسی (file-pick.js) ── */
.file-pick {
    display: flex; align-items: center; gap: 0.75rem;
    min-height: 2.6rem; padding: 0.4rem 0.6rem; margin: 0.35rem 0 0;
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    background: var(--bg); cursor: pointer; position: relative;
}
.file-pick:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-pick > input[type="file"] {
    position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none;
}
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-pick-btn { flex-shrink: 0; pointer-events: none; }
.file-pick-name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── تصویر پروفایلی که نیامد: حرف اول نام به‌جایش (avatar-fallback در base.html) ── */
.avatar-fallen {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
    font-weight: 700; font-size: 0.8em; flex-shrink: 0;
}

/* ── تقویم: فلش ماه قبل و بعد، و نشانه‌ی باز شدنِ «فیلتر نمایش» ── */
.cal-bar .btn-icon .icn { width: 16px; height: 16px; stroke-width: 2.4; }
.cal-bar .cal-next .icn { transform: scaleX(-1); }
.cal-filter > summary.panel-head::after {
    content: ""; margin-inline-start: auto;
    inline-size: 0.5rem; block-size: 0.5rem;
    border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor;
    transform: rotate(45deg); transition: transform 0.18s ease; opacity: 0.6;
}
.cal-filter[open] > summary.panel-head::after { transform: rotate(-135deg); }
.cal-filter > summary.panel-head:hover { background: var(--accent-soft); }

/* ── کارت همکار: یک‌اندازه، نام یک خط، و با کلیک گفت‌وگو با او ── */
.colleague-card { min-height: 60px; }
.colleague-card[data-href]:hover { border-color: var(--accent); background: var(--accent-soft); }
.colleague-card-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }

/* ── بخش ارزیابی: ردیف تب‌ها در همه‌ی صفحه‌هایش یک‌جا ──
   It sat at three heights (146, 171, 253px) because each page put a different
   amount above it. Now the head is the title alone; the line about the page
   and the month chips come under the tabs. */
.perf-sub { margin: -0.25rem 0 0.9rem; font-size: 0.92rem; max-width: 70rem; }
.tabs + .month-pick, .perf-sub + .month-pick { margin: 0 0 20px; max-width: 44rem; }
.score-col-lbl { white-space: nowrap; }

/* ── عددهای اعلامی: کمی بزرگ‌تر و پررنگ ──
   «اعداد اعلامی مانند اسکرین‌شات در کل سامانه هر جا هست سایزش کمی بزرگ‌تر و
   بولد بشه»: every count that tells how many — beside a panel title (باید
   انجام بدهم ۱۷), on a tab, on a menu row, on the bell, on a board column,
   on a to-do row — a size up and in Yekan Bakh's bold face. */
.badge.is-count {
    font-size: 0.9rem; font-weight: 800;
    min-width: 1.9rem; min-height: 1.8rem; padding: 0.15rem 0.55rem;
}
.tab-badge, .tab-badge-quiet {
    font-size: 0.85rem; font-weight: 800;
    min-width: 1.5rem; padding: 0.08rem 0.42rem;
}
.side-badge { font-size: 0.85rem; font-weight: 800; min-width: 22px; }
.bell-count, .qt-tool-count {
    font-size: 0.83rem; font-weight: 800;
    min-width: 19px; height: 19px; line-height: 19px;
}
.todo-count { font-size: 0.94rem; font-weight: 800; }
.crm-col-count { font-size: 0.9rem; font-weight: 800; min-width: 26px; height: 26px; }


/* ══ دستیار مدیرعامل ════════════════════════════════════════════════════════
   A conversation: the question on the right in the house colour, the answer
   under it as cards — a sentence first, then figures, then the chart, then
   the rows behind them and the way to the full page. */
.asst { display: flex; flex-direction: column; gap: 12px; max-width: 64rem; }
.asst-thread { display: flex; flex-direction: column; gap: 20px; }
.asst-hello .panel-body { display: flex; align-items: center; gap: 1rem; }
.asst-hello-mark {
    flex: 0 0 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: var(--accent); color: #fff;
}
.asst-hello p { margin: 0.15rem 0; }
.asst-turn { display: flex; flex-direction: column; gap: 12px; }
/* the page reopens on the last answer, clear of the sticky bar above it */
.asst-turn, #asstLast { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.asst-clear { margin: 0; }
.asst-q { display: flex; justify-content: flex-start; }
.asst-q > span {
    max-width: 80%; padding: 0.7rem 1.05rem; border-radius: 18px 18px 18px 6px;
    background: var(--accent); color: #fff; font-weight: 600; line-height: 1.8;
    white-space: pre-wrap;
}
.asst-a { display: flex; flex-direction: column; gap: 12px; }
.asst-understood { margin: 0; font-size: 0.9rem; }
.asst-card .panel-head .badge { margin-inline-start: 0.4rem; }
.asst-sub { margin: 0 0 0.35rem; font-size: 0.9rem; }
.asst-said { margin: 0 0 0.9rem; line-height: 2; font-size: 1.04rem; }
.asst-subhead { margin: 1.1rem 0 0.55rem; font-weight: 700; font-size: 0.96rem; color: #3f3f48; }
.asst-tiles {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
    margin-bottom: 0.9rem;
}
.asst-tile { background: var(--bg); border-radius: 16px; padding: 0.8rem 0.95rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.asst-tile-wide { grid-column: span 2; }
.asst-tile .stat-tile-num { font-size: 1.52rem; }
.asst-tile-wide .stat-tile-num { font-size: 1.22rem; }
.asst-score { display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem 1.2rem; margin-bottom: 0.9rem; }
.asst-score-num { min-width: 3.2rem; min-height: 3.2rem; justify-content: center; font-size: 1.38rem; font-weight: 800; border-radius: 14px; }
.asst-score-cap { display: flex; flex-direction: column; gap: 0.1rem; }
.asst-trend { display: inline-flex; align-items: center; gap: 0.6rem; margin-inline-start: auto; }
.asst-projects { display: flex; flex-direction: column; gap: 12px; }
.asst-proj { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.55rem 0.7rem; border-radius: 12px; text-decoration: none; color: inherit; }
.asst-proj:hover { background: var(--accent-soft); }
.asst-proj-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.asst-proj-name { font-weight: 700; }
.asst-proj-num { margin-inline-start: auto; font-size: 0.89rem; }
.asst-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.asst-list .line-row { gap: 0.6rem; }
.asst-list .line-row .chip { margin-inline-start: auto; flex-shrink: 0; }
.asst-notes { margin: 0.6rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.asst-note { padding: 0.55rem 0.8rem; border-radius: 12px; background: var(--bg); line-height: 1.8; }
.asst-note.tone-red { background: #fdf1ef; }
.asst-note.tone-orange { background: #fdf5ec; }
.asst-note.tone-green { background: #eaf6ef; }
.asst-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.asst-examples { margin-top: 4px; }
.asst-suggest { cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.asst-suggest:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.asst-ask {
    position: sticky; bottom: 12px; z-index: 5;
    display: flex; align-items: flex-end; gap: 0.6rem;
    background: var(--surface); border-radius: 22px; padding: 0.55rem;
    box-shadow: 0 10px 30px -12px rgba(28, 25, 60, 0.28);
}
.asst-field { flex: 1; min-width: 0; margin: 0; }
/* «دکمه و فیلد رو در یک راستا قرار بده»: one line of text is exactly the
   button's height (24px line + 2×11px padding + 2×1px border = 48px), the
   microphone sits in the middle of it, and when the question runs to more
   lines the field grows upward while the button stays on its last line. */
.asst-ask textarea {
    box-sizing: border-box; display: block;
    resize: none; height: 48px; min-height: 48px; max-height: 160px; border-radius: 16px;
    line-height: 24px; padding-block: 11px; margin: 0;
}
.asst-field .dictate-btn { top: 7px; }
.asst-send { flex-shrink: 0; height: 48px; min-height: 48px; margin: 0; border-radius: 16px; gap: 0.4rem; }
.asst-ask.is-busy .asst-send { opacity: 0.6; pointer-events: none; }
.asst-typing { display: inline-flex; gap: 6px; padding: 0.9rem 1rem; background: var(--surface); border-radius: 16px; width: max-content; }
.asst-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.35; animation: asst-dot 1s infinite ease-in-out; }
.asst-typing i:nth-child(2) { animation-delay: 0.15s; }
.asst-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes asst-dot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.asst-error { color: var(--red-deep); margin: 0; }
@media (max-width: 700px) {
    .asst-q > span { max-width: 92%; }
    .asst-tile-wide { grid-column: auto; }
    .asst-trend { margin-inline-start: 0; }
    .asst-ask { bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .asst-typing i { animation: none; opacity: 0.6; } }
.asst-suggest { font-size: 0.88rem; font-weight: 500; padding: 0.4rem 0.85rem; min-height: 2.1rem; border-radius: 999px; color: #3f3f48; }
@media (max-width: 700px) {
    .asst-examples { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .asst-examples .asst-suggest { flex-shrink: 0; white-space: nowrap; }
}

/* ── شمارنده‌های منو: سفید روی رنگ عمیق ──
   «هر جا زمینه به رنگ است نوشته سفید … اندازه‌اش را بگیر»: white on the
   flat orange measured 3.1:1, on the flat green 2.9:1 — a count is read, so
   it stands on the deep shade of its colour (≥ 4.5:1), light or dark. */
.side-badge.badge-orange { background: #c2410c; }
.side-badge.badge-green { background: #1d7a4c; }
.side-badge.badge-red { background: #b8392a; }
.side-badge.badge-blue { background: #1c5fb4; }

/* ── چهار دکمه‌ی بالای صفحه: هاور دایره‌ای ──
   «هاور دور ۴ گزینه بالا شامل عکس پروفایل، خروج، اعلان و مود تاریک و روشن
   دایره‌ای باشه»: the general hover painted a square ground and ring on the
   link around each circle. The link itself stays clear; the circle takes the
   ground and the ring, at every width (on a phone the link also holds the
   caption under the circle). The keyboard ring is the circle's too. */
.topbar-item { border-radius: 50%; }
.topbar-item:not(#k-none):not(#k-none-2):hover,
.topbar-item:not(#k-none):not(#k-none-2):focus-visible {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}
.topbar-item:not(#k-none):not(#k-none-2):hover .topbar-disc {
    background-color: var(--interaction-fill) !important;
    color: var(--interaction-ink) !important;
    box-shadow: var(--interaction-ring), 0 0 0 1px var(--interaction-purple) inset !important;
}
/* the photo keeps its own ring and gains the soft one outside it */
.topbar-item:not(#k-none):not(#k-none-2):hover .topbar-avatar {
    box-shadow: 0 0 0 2px var(--panel-bg), 0 0 0 3.5px var(--accent), 0 0 0 6.5px rgba(79, 70, 229, .14) !important;
}
.topbar-item:not(#k-none):not(#k-none-2):focus-visible :is(.topbar-disc, .topbar-avatar) {
    outline: 2px solid var(--interaction-purple);
    outline-offset: 2px;
}
@media (max-width: 900px) { .topbar-item { border-radius: 12px; } }

/* ── همکارانم: افزودن عضو جدید ──
   The last row of the list for the director and the internal manager: a +
   in an outlined circle the size of a face, written in the house colour.
   On hover the circle fills and the + turns white. */
.colleague-add-mark {
    display: flex; align-items: center; justify-content: center;
    box-sizing: border-box;
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent-ink);
}
.colleague-add-mark .icn { stroke-width: 2.4; }
.colleague-add .colleague-name { color: var(--accent-ink); font-weight: 600; }
a.colleague-add:hover .colleague-add-mark { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── گفت‌وگو روی گوشی: فرم ساختن گروه یا کانال جا دارد ──
   The list is a 220px box on a phone, and a form opened at its head was
   scrolled inside it. While a form is open the box takes its full height. */
@media (max-width: 760px) {
    .chat-peers:has(.group-new:not([hidden])) { max-height: none; }
}

/* ── گزارش مدیریتی مدیرعامل: «جریان کار» و «اجرای کار به تفکیک واحد» ──
   From the reference dashboard, in this portal's own dress: white boxes on a
   white panel, the counts in the house colour, and one orange mark for the
   stage where work has waited longest (app/flow.py). */
.wf-intro { margin: 0 0 var(--gap-list); font-size: 0.86rem; line-height: 1.9; }
/* the process named above its stages, so the stages have the panel's width */
.wf-row { padding: var(--gap-list) 0; border-top: 1px solid var(--border-soft); }
.wf-intro + .wf-row { border-top: 0; padding-top: 0; }
.wf-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-bottom: 10px; }
.wf-name b { font-size: 1.02rem; }
.wf-name .chip { font-size: 0.81rem; }
.wf-icon {
    display: inline-grid; place-items: center; flex: 0 0 34px; height: 34px;
    border-radius: 10px; background: var(--bg); color: var(--text);
}
.wf-name { margin-bottom: 4px; }
.wf-sentence { margin: 0 0 10px; font-size: 0.86rem; line-height: 1.9; color: #52525c; }
.wf-steps {
    list-style: none; margin: 0; padding: 4px 0 2px;
    display: flex; gap: 24px; overflow-x: auto; scrollbar-width: thin;
}
.wf-step { position: relative; flex: 1 1 0; min-width: 104px; }
/* «گزینه ج … فقط کارت ها هاور داشته باشه»: every box is a card that leads to
   its list — on hover it lifts a little, takes the house colour's soft ground
   and ring, and an arrow in its corner says it opens. */
.wf-box {
    position: relative;
    display: flex; flex-direction: column; gap: 2px; height: 100%;
    box-sizing: border-box; padding: 0.75rem 0.9rem 0.8rem;
    border: 1px solid var(--border); border-radius: 14px;
    background: var(--surface); color: inherit; text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
}
.wf-box:not(#k-none):not(#k-none-2):hover,
.wf-box:not(#k-none):not(#k-none-2):focus-visible {
    transform: translateY(-2px) !important;
    background: var(--interaction-fill) !important;
    border-color: var(--interaction-purple) !important;
    box-shadow: var(--interaction-ring), 0 6px 16px rgba(79, 70, 229, .10) !important;
    outline: none !important;
}
.wf-go {
    position: absolute; inset-inline-end: 12px; top: 10px;
    color: var(--accent-ink); font-size: 1.04rem; line-height: 1;
    opacity: 0; transform: translateX(4px); transition: opacity .18s ease, transform .18s ease;
}
.wf-box:hover .wf-go, .wf-box:focus-visible .wf-go { opacity: 1; transform: none; }
/* the way the work goes: right to left, as the page reads */
.wf-step + .wf-step::before {
    content: "←"; position: absolute; inset-inline-start: -19px; top: 50%;
    transform: translateY(-50%); color: var(--muted); font-size: 0.98rem; line-height: 1;
}
.wf-num { font-size: 1.68rem; font-weight: 800; line-height: 1.25; color: var(--accent-ink); }
.wf-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.wf-meta { font-size: 0.81rem; color: var(--muted); }
.wf-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wf-late, .wf-flag {
    padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.wf-late { color: #8f2c20; background: #fdecea; }
.wf-flag { color: #fff; background: #c2410c; }
/* how long this stage has waited, beside the longest wait in the process */
.wf-foot { display: block; margin-top: auto; padding-top: 10px; }
.wf-meter { display: block; height: 5px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.wf-meter i {
    display: block; height: 100%; border-radius: 999px; background: #7f77dd;
    transform-origin: right; animation: wf-grow .7s ease-out both;
}
.wf-step.is-slow .wf-meter i { background: #ea8a3c; }
@keyframes wf-grow { from { transform: scaleX(0); } }
/* a stage with nothing in it steps back: a dashed outline and a quiet count */
.wf-step.is-empty .wf-box { border-style: dashed; background: transparent; }
.wf-step.is-empty .wf-num { color: var(--muted); font-weight: 700; }
.wf-step.is-slow .wf-box { border-color: #ea8a3c; box-shadow: inset 0 0 0 1px #ea8a3c; }
.wf-step.is-slow .wf-box:not(#k-none):not(#k-none-2):hover {
    background: #fff7ed !important; border-color: #ea8a3c !important;
    box-shadow: 0 0 0 3px rgba(234, 138, 60, .18), 0 6px 16px rgba(194, 65, 12, .10) !important;
}
.wf-end > .wf-box { background: var(--bg); border-color: transparent; }
@media (prefers-reduced-motion: reduce) {
    .wf-box, .wf-go { transition: none; }
    .wf-box:not(#k-none):not(#k-none-2):hover { transform: none !important; }
    .wf-meter i { animation: none; }
}

.unit-run td { vertical-align: middle; }
.unit-run-name { font-weight: 700; color: var(--text); text-decoration: none; }
.unit-run-sub { font-size: 0.81rem; margin-top: 2px; }
.unit-run-num { font-weight: 700; font-size: 0.98rem; white-space: nowrap; }
.unit-run-num.is-late { color: #b8392a; }
.unit-run-of { font-weight: 500; font-size: 0.86rem; color: var(--muted); }
.unit-run-rate { display: flex; align-items: center; gap: 0.6rem; min-width: 150px; }
.unit-run-rate .meter { flex: 1; }
.unit-run-rate b { min-width: 2.6rem; }
.unit-run-rule { margin: var(--gap-list) 0 0; font-size: 0.84rem; line-height: 1.9; }

@media (max-width: 700px) {
    .wf-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
    .wf-step { min-width: 0; }
    .wf-step + .wf-step::before { display: none; }
}

/* ── نوار «عملکرد پرسنل»: راهنما در دو ردیفِ هم‌تراز ──
   The six keys need about 500px on one line. In a half-width panel they
   broke after the fifth, leaving «هنوز ارزیابی نشده» alone on a second line;
   where they do not fit they now stand as three aligned columns in two rows. */
.band-wrap { container-type: inline-size; }
@container (max-width: 505px) {
    .band-wrap .band-legend {
        display: grid; grid-template-columns: repeat(3, max-content);
        justify-content: space-between; gap: 0.45rem 0.9rem;
    }
}

/* ══ گوشی: هر بخش سامانه ══════════════════════════════════════════════════
   «هر بخش از سامانه که نیاز به ریسپانسیو شدن داره اعمال کن». Every page every
   role reaches was opened in a 390px frame and measured; these are what it
   found. (Tabs keep wrapping onto a second line on a phone — that was asked
   for, so a row of tabs never drifts under a finger.) */
@media (max-width: 900px) {
    /* iPhone's Safari zooms the page into any field set smaller than 16px the
       moment it is tapped, and leaves it zoomed. Every field is 16px here. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]),
    select, textarea { font-size: 16px !important; }
}
@media (max-width: 700px) {
    /* A last item alone on its row — the seventh month, the fifth monitoring
       button — takes the whole row instead of standing in one corner of it. */
    .month-pick > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
    .mon-sections > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    /* The evaluation colours: three even columns, not four and a ragged two. */
    .band-legend {
        display: grid; grid-template-columns: repeat(3, max-content);
        justify-content: space-between; gap: 0.45rem 0.9rem;
    }
    /* (below 360px, see the next rule: two columns) */
    /* «ایجاد وظیفه»: the project list stopped at 320px, 36px short of the
       fields above it; on a phone it is as wide as they are. */
    .tc-project select { max-width: none; width: 100%; }
}
/* The bar's search on a small phone: the logo, the menu button and the three
   rounds left it 8px at 320px, with a 56px field spilling over its neighbours.
   It is a magnifier there; tapped, it opens across the whole bar, and the
   results hang below it as before. */
@media (max-width: 480px) {
    .topbar-search { flex: 0 0 40px; justify-content: flex-start; }
    .topbar .search-wrap { width: 40px; }
    .topbar form.topbar-search input[type="search"] {
        width: 40px; min-width: 40px; padding-inline: 0; color: transparent; cursor: pointer;
    }
    .topbar form.topbar-search input[type="search"]::placeholder { color: transparent; }
    .topbar-search:focus-within {
        position: absolute; inset: 0; z-index: 6;
        display: flex; align-items: center; padding: 0 12px;
        background: inherit;
    }
    .topbar-search:focus-within .search-wrap { width: 100%; max-width: none; }
    .topbar form.topbar-search:focus-within input[type="search"] {
        width: 100%; padding-inline: 2.45rem 0.9rem; color: var(--text); cursor: text;
    }
    .topbar form.topbar-search:focus-within input[type="search"]::placeholder { color: #8a8a94; }
}
/* Tablets (and small laptops with the menu open): four figure tiles stood
   three in a row with the fourth stretched across a row of its own. They
   stand two by two there; on a wide screen they are four in a row. */
@media (min-width: 701px) and (max-width: 1150px) {
    .desk-kpis:has(> :nth-child(4):last-child) > * { flex-basis: calc(50% - var(--gap-list)); }
}
/* گفت‌وگو on a tablet showed two lists of colleagues side by side — the
   desk's «همکارانم» and chat's own. Chat keeps its own, as it already did on
   a wide screen and on a phone. */
body.section-chat .work-side .side-fold { display: none; }
/* A tablet is touched too: its rows of tabs wrap like a phone's rather than
   sliding sideways under the finger (the phone rule, from 700 up to 900). */
@media (min-width: 701px) and (max-width: 900px) {
    .tabs { flex-wrap: wrap; overflow: visible; row-gap: 0.15rem; }
    .tabs .tab { flex: 0 0 auto; }
    .tab-strip .tabs { overflow: visible; }
}
/* The narrowest phones (320px): three columns of colour keys were 16px too
   wide for the evaluation page's tile; there they stand two by two. */
@media (max-width: 360px) {
    .band-legend { grid-template-columns: repeat(2, max-content); }
}
@container (max-width: 300px) {
    .band-wrap .band-legend { grid-template-columns: repeat(2, max-content); }
}

/* ── گفت‌وگوی بلند: پیام‌های قدیمی‌تر ──
   A conversation opens on its latest 300 messages (app/threads.py); the
   earlier ones are one tap away, at the head of the thread. */
.chat-older {
    display: block; align-self: center; margin: 0 auto 12px; padding: 0.4rem 1rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
    color: var(--accent-ink); font-size: 0.86rem; font-weight: 600; text-decoration: none;
    width: max-content; max-width: 100%;
}
/* the letter being read, in the list of its own conversation */
.letter-thread .line-row.is-current { background: var(--accent-soft); border-radius: 10px; }
.letter-thread .line-row.is-current .line-title { font-weight: 700; }
/* the cartable's foot: how many of the box are on screen, and the next page */
.letters-more { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 20px 0 8px; }

/* ── تکرار وظیفه ──
   The repeat on the task form: the days of «روزانه» as pills, the same pills the
   CRM picks a kind with — shown only while «روزانه» is the one chosen. On a
   phone the seven days are their first letters so the week stays one row. */
.tc-repeat .repeat-days { display: none; flex-wrap: nowrap; gap: 6px; padding: 0.2rem 0 0.1rem; }
.tc-repeat:has(input[name="repeat_kind"][value="daily"]:checked) .repeat-days { display: flex; }
.day-chip { margin: 0; cursor: pointer; position: relative; flex: 0 0 auto; }
.day-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-chip > span {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 34px; min-width: 38px; padding: 0 0.7rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.86rem;
}
.day-chip:hover > span { border-color: var(--accent); }
.day-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day-chip input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.day-chip .d-short { display: none; }
@media (max-width: 600px) {
    /* seven equal pills sharing the row, however narrow the phone */
    .day-chip { flex: 1 1 0; min-width: 0; }
    .day-chip > span { width: 100%; min-width: 0; padding: 0; }
    .day-chip .d-full { display: none; }
    .day-chip .d-short { display: inline; }
}
/* the repeat mark keeps its icon beside its words when a meta line wraps */
.repeat-meta, .task-repeat { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
/* the task page: its series, one step either way */
.repeat-series { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin: -0.25rem 0 20px; font-size: 0.9rem; }

/* ── نامه و ادامه‌اش ──
   A letter's conversation under it (app/letter_threads.py): a line down the
   avatars, a card for every later letter and every paraf, and a mark where a
   new day starts — as Mizito drew it. The card of the message that was opened
   is ringed. */
.convo { position: relative; display: flex; flex-direction: column; gap: 12px; margin: 0 0 20px; }
.convo::before {
    content: ""; position: absolute; inset-block: 12px; inset-inline-start: 19px;
    width: 2px; border-radius: 2px; background: var(--border);
}
.convo-day { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.convo-day-date, .convo-day-ago {
    font-size: 0.84rem; padding: 0.2rem 0.8rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border-soft);
}
.convo-day-ago { color: var(--muted); }
.convo-item { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; }
.convo-avatar {
    position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 4px var(--bg);
}
.convo-card {
    min-width: 0; padding: 14px 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border-soft);
}
.convo-card-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
    padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--border-soft); font-size: 0.9rem;
}
.convo-who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.convo-time { font-size: 0.84rem; white-space: nowrap; }
.convo-subject { font-weight: 700; margin-bottom: 6px; }
.convo-text { white-space: pre-wrap; line-height: 2; overflow-wrap: anywhere; }
.convo-card .letter-files { margin-top: 12px; padding-top: 12px; }
.convo-card-paraf { padding: 10px 16px; }
.convo-card-paraf .convo-card-head { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.convo-card-paraf .convo-text { margin-top: 8px; }
.convo-item.is-current .convo-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.convo-acting { margin: -8px 0 12px; }
@media (max-width: 600px) {
    .convo-item { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; }
    .convo-avatar { width: 32px; height: 32px; }
    .convo::before { inset-inline-start: 15px; }
    .convo-card { padding: 12px 14px; }
}

/* ── گفت‌وگو در کارتابل ──
   A conversation is one row: a count with a caret before its subject, and its
   messages folded under the row until the caret opens them. */
.letter-subject-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.thread-toggle {
    display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0;
    min-height: 26px; padding: 0 8px; border-radius: 999px;
    border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted);
    font: inherit; font-size: 0.84rem; cursor: pointer;
}
.thread-caret { display: inline-flex; }
.thread-caret svg { transform: rotate(90deg); transition: transform 0.15s ease; }
.thread-toggle[aria-expanded="true"] .thread-caret svg { transform: rotate(-90deg); }
.thread-children {
    display: flex; flex-direction: column;
    margin-top: calc(var(--gap-list) * -1 + 4px); margin-inline-start: 24px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    overflow: hidden;
}
.thread-children[hidden] { display: none; }
.thread-child {
    display: grid; grid-template-columns: 28px minmax(0, 9rem) minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: 10px 16px; border-top: 1px solid var(--border-soft); color: var(--text); text-decoration: none;
}
.thread-child:first-child { border-top: 0; }
.thread-child-avatar {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.82rem;
}
.thread-child-who, .thread-child-text { font-size: 0.88rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-child-who { font-weight: 600; }
@media (max-width: 700px) {
    .thread-children { margin-inline-start: 12px; }
    .thread-child { grid-template-columns: 28px minmax(0, 1fr) auto; row-gap: 4px; }
    .thread-child-text { grid-column: 2 / -1; white-space: normal; }
}

/* ── برگه‌ی اصلی هفته ──
   The Mizito sheet a week of the plan was read from, above the table, with the
   rows taken from it marked in their status cell. */
.plan-source {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 12px; padding: 12px 16px; font-size: 0.9rem;
    border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg);
}
.plan-source-files { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-from-sheet { white-space: nowrap; }
/* The sheet's own cells wrap, a line to a line as written: «.table td» keeps every
   cell on one line, which pushed a long day's work over the next column. */
.plan-table td.plan-multiline { white-space: pre-line; overflow-wrap: anywhere; }

/* ── فلوچارت SOP: نمودار و ویرایشگرش، به شکل فلوچارت Aspose ──
   Compact shapes; an «فعالیت» box filled in the chart colour (navy by default) with small bold white
   lettering; start/end, decision, document and in/out drawn white with an outline of that colour; thin
   dark lines with small arrowheads. The same classes draw the procedure page (sop_flow.diagram_svg)
   and the editor (flow-editor.js). */
:root { --fl-navy: #173868; --fl-navy-line: #173868; --fl-line: #1f2937; --fl-ink: #172b4d; }
.sop-flow.fl-diagram { max-width: 100%; height: auto; }
.fl-shape { stroke-width: 1.6; }
.fl-shape.fl-process { fill: var(--fl-c, var(--fl-navy)); stroke: var(--fl-c, var(--fl-navy)); }
.fl-shape.fl-terminal, .fl-shape.fl-decision, .fl-shape.fl-document, .fl-shape.fl-io {
    fill: var(--surface); stroke: var(--fl-c-line, var(--fl-navy-line));
}
.fl-text { font-size: 13px; font-weight: 700; text-anchor: middle; fill: var(--fl-ink); direction: rtl; }
.fl-text.fl-on-process { fill: #fff; }
.fl-text.fl-owner { font-size: 11px; font-weight: 500; opacity: 0.9; }
.fl-edge { fill: none; stroke: var(--fl-line); stroke-width: 1.3; }
.fl-edge.fl-dashed { stroke-dasharray: 5 4; }
.fl-arrowhead { fill: var(--fl-line); }
.fl-edge-label {
    font-size: 12px; font-weight: 700; text-anchor: middle; fill: var(--fl-line); direction: rtl;
    paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round;
}
/* an upright line: the label stands to its left, its first letter at the line */
.fl-edge-label.fl-edge-label-side { text-anchor: start; }
/* «رنگ»: a filled box takes it as its ground (white lettering on each, all ≥ 4.5:1), an outlined
   shape as its line */
.fl-c-navy   { --fl-c: var(--fl-navy); --fl-c-line: var(--fl-navy-line); }
.fl-c-purple { --fl-c: var(--accent); --fl-c-line: var(--accent); }
.fl-c-green  { --fl-c: #1d7a4c; --fl-c-line: #1d7a4c; }
.fl-c-blue   { --fl-c: #1d4ed8; --fl-c-line: #1d4ed8; }
.fl-c-red    { --fl-c: #b42318; --fl-c-line: #b42318; }
.fl-c-gray   { --fl-c: #4b5563; --fl-c-line: #4b5563; }

.sop-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sop-flow-tools { display: inline-flex; align-items: center; gap: 8px; }

/* the editor: tools on top; «فلوچارت‌های آماده» and «شکل‌ها» on the right; the sheet; the style of what is
   selected on the left — the Aspose layout, mirrored */
.flow-editor { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.fl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.fl-group { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
/* the filled button beside the row-action ones: one height, one line (the form's own gap dropped) */
.fl-toolbar .btn, .sop-flow-tools .btn { height: 2.1rem; min-height: 0; padding-block: 0; display: inline-flex; align-items: center; box-sizing: border-box; }
.sop-flow-tools .inline-form { margin: 0; }
.fl-zoom { min-width: 3.2rem; text-align: center; font-size: 0.86rem; color: var(--muted); }
.fl-icon { min-width: 34px; font-weight: 700; }
.fl-status { margin-inline-start: auto; font-size: 0.86rem; }
.fl-status.is-dirty { color: var(--orange); }
.fl-body { display: grid; grid-template-columns: 236px minmax(0, 1fr) 236px; }
.fl-palette, .fl-format { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--bg); }
.fl-palette { border-inline-end: 1px solid var(--border-soft); max-height: 72vh; overflow-y: auto; overflow-x: hidden; }
.fl-format { border-inline-start: 1px solid var(--border-soft); }
.fl-fmt { display: flex; flex-direction: column; gap: 12px; }
.fl-fmt[hidden] { display: none; }
.fl-palette-head { font-size: 0.94rem; font-weight: 700; }
.fl-tpl-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fl-tpl-pick {
    display: flex; flex-direction: column; gap: 4px; padding: 6px; text-align: center; cursor: pointer;
    border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface);
    font: inherit; font-size: 0.8rem; line-height: 1.4; color: var(--text);
}
.fl-tpl-pick-thumb { display: flex; align-items: center; justify-content: center; height: 84px; overflow: hidden; }
.fl-tpl-pick-thumb svg { width: auto; max-width: 100%; height: 100%; min-width: 0 !important; pointer-events: none; }
.fl-shape-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fl-shape-pick {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; text-align: center;
    border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface);
    font: inherit; font-size: 0.8rem; line-height: 1.4; color: var(--text); cursor: grab; touch-action: none;
}
.fl-shape-pick svg { flex: none; width: 44px; height: 26px; }
.fl-shape-pick .fl-shape { stroke-width: 1.5; }
.fl-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: 0.9; box-shadow: var(--shadow); }
.fl-help { margin: 0; font-size: 0.84rem; line-height: 1.9; }
.fl-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.fl-field > span:first-child { color: var(--muted); }
.fl-field select, .fl-field input, .fl-field textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.89rem; }
.fl-field textarea { resize: vertical; min-height: 4.5rem; }
.fl-check { display: flex; align-items: center; gap: 8px; font-size: 0.89rem; }
.fl-format .act-btn { align-self: flex-start; }
.fl-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-swatch {
    width: 24px; height: 24px; padding: 0; border-radius: 50%; cursor: pointer;
    background: var(--fl-c, var(--fl-navy)); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
}
.fl-format .fl-swatch[aria-pressed="true"] { background: var(--fl-c, var(--fl-navy)); border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }
.fl-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fl-sheet { position: relative; }
.fl-canvas { display: block; width: 100%; height: 72vh; min-height: 420px; background: var(--surface); touch-action: none; user-select: none; }
.fl-grid-line { fill: none; stroke: var(--border-soft); stroke-width: 0.5; }
.fl-grid-line.fl-grid-major { stroke-width: 1; }
.fl-node { cursor: move; }
.fl-node.is-selected .fl-shape { stroke: var(--orange); stroke-width: 2.4; }
.fl-edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.fl-edge-g.is-selected .fl-edge { stroke: var(--orange); stroke-width: 2.4; }
.fl-port { fill: var(--surface); stroke: var(--fl-navy-line); stroke-width: 1.6; cursor: crosshair; }
.fl-port:hover { fill: var(--fl-navy-line); }
.fl-resize { fill: var(--fl-navy-line); cursor: nwse-resize; }
.fl-drawing { stroke-dasharray: 4 4; pointer-events: none; }
.fl-text-box {
    position: absolute; z-index: 5; padding: 6px 8px; resize: none; text-align: center;
    border: 2px solid var(--accent); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow);
    font: inherit; font-size: 13px; color: var(--text);
}
.sop-compose-flow .field-hint { margin: 0 0 12px; }
@media (max-width: 1180px) {
    .fl-body { grid-template-columns: 220px minmax(0, 1fr); }
    .fl-format { grid-column: 1 / -1; border-inline-start: 0; border-top: 1px solid var(--border-soft); }
    .fl-fmt { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
    .fl-fmt .fl-palette-head { flex-basis: 100%; }
    .fl-fmt .fl-field { min-width: 180px; flex: 1 1 180px; }
}
@media (max-width: 760px) {
    .fl-body { grid-template-columns: minmax(0, 1fr); }
    .fl-palette { max-height: none; border-inline-end: 0; border-bottom: 1px solid var(--border-soft); }
    .fl-tpl-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fl-shape-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .fl-palette .fl-help { display: none; }
    .fl-canvas { height: 64vh; }
}
@media print {
    .sop-flow-tools { display: none; }
}

/* A task with no due date, on its reminder day or the day it was made: the same card,
   drawn with a dashed edge, so it is not read as something owed that day. */
.calendar-task.calendar-task-undated {
    border: 1px dashed var(--cal-edge, var(--muted));
    border-inline-start: 3px dashed var(--cal-edge, var(--muted));
}

/* «قالب‌های آماده»: the gallery of ready-made charts */
.fl-tpl-lead { margin: 0 0 20px; max-width: 70ch; }
.fl-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.fl-tpl-card {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    padding: 16px; background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.fl-tpl-thumb {
    display: flex; align-items: center; justify-content: center; height: 220px; padding: 8px;
    background: var(--bg); border-radius: var(--radius-sm); overflow: hidden;
}
.fl-tpl-thumb svg { width: auto; max-width: 100%; height: 100%; min-width: 0 !important; }
.fl-tpl-name { font-weight: 700; font-size: 1.04rem; }
.fl-tpl-about { font-size: 0.89rem; line-height: 1.7; flex: 1; }
.fl-tpl-use { align-self: flex-start; height: 2.1rem; min-height: 0; padding-block: 0; display: inline-flex; align-items: center; }

/* the file own button beside each attachment: «دانلود», in the portal row-button look */
.act-btn.attachment-download { margin-inline-start: 12px; gap: 6px; text-decoration: none; }
.act-btn.attachment-download:hover { text-decoration: none; }

/* «دکمه دانلود و حذف در یک راستا»: a form in a row keeps no bottom margin of its own at any width,
   so the row centres «انتقال به…», the file, «دانلود» and «حذف» on one line */
.line-row .inline-form { margin: 0; }

/* «ساخت SOP»: one line a step, as before — description, owner, kind, and «برگشت با پاسخ» — under a line
   of column names. The draft takes the page's width, as the chart under it does, so the owner field is
   wide enough for a whole name or unit («فیلد … بزرگ‌تر بشه تا نامش یا واحدش کامل نمایش داده بشه»). */
#sop-draft { max-width: none; }
#sop-draft .sop-steps { gap: 8px; }
#sop-draft .sop-step-row {
    grid-template-columns: 1.6rem minmax(0, 1.35fr) minmax(13rem, 1fr) 7.5rem 7rem auto;
    gap: 8px 10px;
}
#sop-draft .sop-step-head { font-size: 0.85rem; font-weight: 500; color: var(--muted); padding-bottom: 2px; }
#sop-draft .sop-step-head > span { padding-inline-start: 4px; white-space: nowrap; }
#sop-draft .sop-step-answer.is-off { opacity: 0.45; pointer-events: none; }
#sop-draft .sop-steps-hint { margin: 12px 0 0; }
#sop-draft .is-missing { border-color: var(--red-deep); box-shadow: 0 0 0 3px rgba(184, 57, 42, 0.12); }

/* the owner: a field to write in, with a menu of the units — and, once one is chosen, its people */
.sop-owner { position: relative; display: block; min-width: 0; }
#sop-draft .sop-owner > input { padding-inline-end: 2.4rem; text-overflow: ellipsis; }
.sop-owner-open {
    position: absolute; inset-block: 0; inset-inline-end: 4px; margin: auto 0; width: 2rem; height: 2rem;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.sop-owner-open:hover { background: var(--accent-soft); color: var(--accent-ink); }
.sop-owner-menu {
    position: absolute; z-index: 40; top: calc(100% + 4px); inset-inline-start: 0;
    width: max(100%, 18rem); max-height: 20rem; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(20, 20, 40, 0.16));
}
.sop-owner-head { padding: 8px 10px 4px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.sop-owner-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 6px; background: transparent;
    font: inherit; font-size: 0.92rem; color: var(--text); text-align: start; cursor: pointer;
}
.sop-owner-item small { margin-inline-start: auto; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.sop-owner-item:hover, .sop-owner-item:focus-visible { background: var(--accent-soft); outline: none; }
/* a unit opens onto its people: a small chevron pointing on (left, in a right-to-left page) */
.sop-owner-item.has-more::after {
    content: ""; flex: none; width: 6px; height: 6px; margin-inline-start: 4px;
    border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg);
}
.sop-owner-item.has-more > span:first-child { margin-inline-end: auto; }
.sop-owner-item.has-more small { margin-inline-start: 0; }
.sop-owner-item.is-back { color: var(--accent-ink); font-size: 0.86rem; }
.sop-owner-item.is-back::before { content: "→"; }
.sop-owner-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* «ثبت فرآیند» with its answer beside it */
.sop-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
#sop-draft .sop-save-row .btn { margin-top: 0; }
#sop-save-note { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#sop-save-note:empty { display: none; }
.saved-note.sop-save-note { margin: 0; animation: none; }
.sop-save-open { text-decoration: none; }

@media (max-width: 1180px) {
    #sop-draft .sop-step-row { grid-template-columns: 1.6rem minmax(0, 1.2fr) minmax(11rem, 1fr) 6.5rem 6rem auto; }
}
@media (max-width: 760px) {
    /* on a phone each step is a small card: its text, then owner, then kind and answer side by side */
    #sop-draft .sop-step-head { display: none; }
    #sop-draft .sop-step-row {
        grid-template-columns: 1.6rem minmax(0, 1fr) minmax(0, 1fr) auto; padding: 12px;
        border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    }
    #sop-draft .sop-step-row > input[name=step_text] { grid-column: 2 / -1; }
    #sop-draft .sop-owner { grid-column: 2 / -1; }
    #sop-draft .sop-step-row > select[name=step_kind] { grid-column: 2; }
    #sop-draft .sop-step-row > select[name=step_back_on] { grid-column: 3; }
    #sop-draft .sop-step-tools { grid-column: 4; }
}

/* the draft card is scrolled to after «خواندن متن و ساخت مراحل»: clear of the sticky top bar */
#sop-draft { scroll-margin-top: 96px; }
/* the preview window: «دانلود» and «بستن» on the right, the file's name across from them */
.attachment-preview header > h2 { text-align: end; margin: 0; }

/* «نمایش … نامه‌ی قدیمی‌تر» opens on the last letter already read: clear of the sticky top bar, and marked
   for a moment so the eye finds where it was */
.letter-row[id^="letter-"] { scroll-margin-top: 96px; }
.letter-row:target { animation: letter-here 2.4s ease-out; }
@keyframes letter-here { 0%, 40% { background: var(--accent-soft); border-color: var(--accent-ink); } 100% { background: var(--surface); } }
@media (prefers-reduced-motion: reduce) { .letter-row:target { animation: none; } }

/* «فاصله دو دکمه روی کارت … بیشتر و متناسب کن»: the ways out of the login card stand 48px apart, centred
   on the card, with a hairline exactly halfway between them — the same distance on both sides */
.login-ways { justify-content: center; align-items: center; gap: 8px 48px; }
.login-ways > a { position: relative; padding: 6px 0; line-height: 1.6; }
.login-ways > a + a::before {
    content: ""; position: absolute; inset-inline-start: -24px; top: 8px; bottom: 8px;
    width: 1px; background: var(--login-edge);
}

/* «متن و موضوع تیکت در داخل یک فیلد نوشته شه که مشخص باشه»: what a ticket says, in its own card */
.ticket-card {
    margin: 16px 0 20px; padding: 20px; display: flex; flex-direction: column; gap: 16px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ticket-card-part { display: flex; flex-direction: column; gap: 6px; }
.ticket-card-part + .ticket-card-part { padding-top: 16px; border-top: 1px solid var(--border-soft); }
.ticket-card-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.ticket-card-subject { font-size: 1.06rem; font-weight: 700; color: var(--text); }
.ticket-card-text { white-space: pre-line; line-height: 1.9; color: var(--text); overflow-wrap: anywhere; }
.ticket-card-files { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ticket-card-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }

/* the list: each ticket's subject with the start of its text under it */
.ticket-cell { min-width: 16rem; }
.ticket-cell > a { font-weight: 600; }
.ticket-excerpt, .ticket-files { display: block; margin-top: 4px; font-size: 0.85rem; line-height: 1.7; }

/* «تیکت‌های واحدها»: how many each unit has filed, and how many are still open — a unit narrows the list */
.ticket-units { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.ticket-unit {
    display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 14px; min-width: 8.5rem;
    border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface);
    color: var(--text); text-decoration: none;
}
.ticket-unit:hover { border-color: var(--accent-ink); }
.ticket-unit.is-on { border-color: var(--accent-ink); background: var(--accent-soft); }
.ticket-unit-name { font-weight: 600; font-size: 0.92rem; }
.ticket-unit-count { font-size: 0.84rem; color: var(--muted); }

/* a refusal's reason: written in its own box, read under the decision */
.approval-form { flex-wrap: wrap; }
.approval-form .approval-note { flex: 1 1 100%; min-height: 2.6rem; margin: 0; }
.approval-note-text { font-size: 0.86rem; color: var(--text); background: var(--bg); border-radius: 8px; padding: 4px 10px; }


/* ══ دور ۳۳ — ۱۸ مهر ۱۴۰۵ ═════════════════════════════════════════════════════════════════════════════════ */

/* ── خانه‌ای که با نوشته بلند می‌شود ──
   «در گوشی موبایل … متن تایپ‌شده به صورت کامل نمایش داده نمی‌شود»: a line of a report is a textarea one line high
   that grows with what is written (form-helpers.js §۴). It never shows a scrollbar of its own, and the microphone
   keeps its corner at the top, where the first line is. */
textarea[data-autogrow] { overflow-y: hidden; }
textarea[data-single-line] {
    resize: none;
    min-height: 2.6rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.grid-table textarea[data-single-line] { min-height: 2.4rem; resize: none; }
.dictate-wrap > textarea[data-single-line] { padding-block: 0.45rem; }

/* ── مدت زمان: ساعت و دقیقه، هر کدام در خانه‌ی خودش ── */
.duration-input {
    display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: nowrap;
    max-width: 100%;
}
.duration-input input {
    width: 3.4rem !important; min-width: 0 !important; flex: 0 0 auto;
    text-align: center;
}
.duration-unit { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.grid-table .duration-input input { width: 3rem !important; }

/* ── تاریخی که سامانه می‌نویسد ── */
.field-auto {
    display: inline-flex; align-items: center; min-height: 2.6rem;
    padding: 0.45rem 0.75rem; border: 1px dashed var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text); font-size: 0.92rem;
}
.field-auto::after { content: "— امروز، خودکار"; color: var(--muted); font-size: 0.83rem; margin-inline-start: 0.4rem; }

/* ── پیوستِ ردیفِ گزارشی که ویرایش می‌شود ── */
.cell-kept { display: inline-flex; align-items: center; gap: 0.4rem; margin-block-end: 0.3rem; }
.cell-file { max-width: 100%; }

/* ── جدول فرم روی گوشی: هر ردیف یک کارت، هر خانه زیر عنوان خودش ──
   A report's table of seven columns was a strip to scroll sideways on a phone, each box a finger wide. Below 700px
   every line is a card: its number on top, then each cell under its own heading. */
@media (max-width: 700px) {
    .fill-form .table-wrap { overflow: visible; border: 0; }
    .fill-form .grid-table,
    .fill-form .grid-table tbody,
    .fill-form .grid-table tr,
    .fill-form .grid-table td { display: block; width: 100%; }
    .fill-form .grid-table { min-width: 0 !important; border: 0; }
    .fill-form .grid-table thead { display: none; }
    .fill-form .grid-table tr {
        border: 1px solid var(--border); border-radius: var(--radius-sm, 9px);
        padding: 0.65rem 0.75rem; margin-block-end: var(--gap-list, 12px);
        background: var(--surface);
    }
    .fill-form .grid-table td { padding: 0.3rem 0 !important; border: 0 !important; }
    .fill-form .grid-table td[data-label]::before {
        content: attr(data-label); display: block;
        font-size: 0.84rem; color: var(--muted); margin-block-end: 0.25rem;
    }
    .fill-form .grid-table td.grid-num {
        width: auto; text-align: start; font-size: 0; padding-block-end: 0.15rem !important;
    }
    .fill-form .grid-table td.grid-num::before {
        content: attr(data-row-label); font-size: 0.85rem; font-weight: 700; color: var(--text);
    }
    .fill-form .grid-table input,
    .fill-form .grid-table select,
    .fill-form .grid-table textarea { min-width: 0; font-size: 16px; }
}

/* ── اشاره‌ها به من ── */
.mention-list { display: flex; flex-direction: column; gap: var(--gap-list, 12px); }
.mention-card {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; border-radius: var(--radius, 12px);
    background: var(--surface); box-shadow: var(--shadow);
    color: var(--text); text-decoration: none;
    border-inline-start: 3px solid transparent;
}
.mention-card.is-new { border-inline-start-color: var(--accent, #4f46e5); }
.mention-face {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft, #eef0fe); color: var(--accent-ink, #3730a3); font-weight: 700;
}
.mention-face img { width: 100%; height: 100%; object-fit: cover; }
.mention-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; flex: 1; }
.mention-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mention-who { font-weight: 700; font-size: 0.94rem; }
.mention-when { font-size: 0.83rem; margin-inline-start: auto; }
.mention-new { min-height: 1.35rem; }
.mention-task { display: flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; color: var(--muted); min-width: 0; }
.mention-task-title { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mention-text { font-size: 0.92rem; line-height: 1.85; white-space: pre-line; overflow-wrap: anywhere; }
.report:target { outline: 2px solid var(--accent, #4f46e5); outline-offset: 4px; border-radius: 10px; }

/* ── پیام‌های ذخیره‌شده ── */
.chat-peer-saved { border-block-end: 1px solid var(--border-soft, #ececf0); }
.chat-peer-bookmark .icn { stroke: currentColor; }

/* ── تنخواه: منتظر تأیید و ارسال ── */
.petty-waiting-body {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.petty-source { display: block; font-size: 0.81rem; margin-block-start: 0.15rem; }
.petty-sum { font-size: 0.85rem; font-weight: 400; margin-inline-start: auto; }

/* ── تأیید اضافه‌کاری ── */
.overtime-person .panel-head { flex-wrap: wrap; gap: 0.5rem; }
.overtime-person-sum { font-size: 0.85rem; font-weight: 400; }
.overtime-week + .overtime-week { margin-block-start: var(--gap-block, 20px); }
.overtime-week-head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    font-size: 0.86rem; color: var(--muted); margin-block-end: 0.5rem;
}
.overtime-day {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.7rem 0; border-block-start: 1px solid var(--border-soft, #ececf0);
}
.overtime-day-what { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; min-width: 0; }
.overtime-day-desc { flex-basis: 100%; font-size: 0.86rem; overflow-wrap: anywhere; }
.overtime-day-acts { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.overtime-note-input { width: 14rem; max-width: 100%; }
.overtime-note { display: block; font-size: 0.83rem; margin-block-start: 0.2rem; }
@media (max-width: 700px) {
    .overtime-day-acts { width: 100%; }
    .overtime-note-input { flex: 1 1 100%; width: auto; }
}

/* ── «۳ روز مانده» کنار تاریخ ── */
.due-chip { min-height: 1.35rem; font-size: 0.8rem; white-space: nowrap; }

/* ── گزارشی که ویرایش شده، و دکمه‌ی ویرایشش ── */
.panel-head .sub-edit { margin-inline-start: auto; }
.sheet-total td { font-weight: 700; border-block-start: 2px solid var(--border); }


/* ══ دور ۳۳ — ریسپانسیو ══════════════════════════════════════════════════════════════════════════════════════
   «ریسپانسیو بودن در گوشی رو به صورت کامل بررسی کن … سامانه هیچ مشکل ریسپانسیوی از این به بعد نباید داشته
   باشه». Every page was walked as ten seats at 320, 360 and 390 (scratchpad/audit_mobile.py): what stuck out of the
   screen, what overlapped, what was cut off. Each rule below names what it fixed. */

/* ── نوار بالا روی گوشی ──
   The owner's screenshot: the magnifier half under the profile picture. With a phone's larger text the three
   captioned controls grew past the bar (15–40px at 320 and 345) while the magnifier, captionless and centred,
   sat lower than the circles beside it. Now the four are one even row — the same circle, each with its word
   under it — and the bar's gaps shrink so the row fits a 320px phone at 130% text. */
.search-cap { display: none; }
@media (max-width: 480px) {
    .topbar { padding-inline: 10px; gap: 8px; }
    .topbar-actions { gap: 6px; }
    .topbar-item { min-width: 40px; gap: 4px; }
    .topbar-cap { font-size: 0.8rem; }
    .topbar-avatar, .topbar-disc { width: 34px; height: 34px; }
    .topbar-search { flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center;
                     gap: 4px; min-width: 40px; }
    .topbar .search-wrap { width: 34px; }
    .topbar form.topbar-search input[type="search"] {
        width: 34px; min-width: 34px; height: 34px; min-height: 0; max-height: 34px;
        padding-block: 0; box-sizing: border-box; border-radius: 50%;
    }
    .topbar form.topbar-search:focus-within input[type="search"] { height: 40px; max-height: 40px; border-radius: 999px; }
    .search-cap { display: block; color: #52525c; }
    .topbar-search:focus-within .search-cap { display: none; }
}
html[data-theme="dark"] .search-cap { color: var(--muted); }
/* «پروفایل، اعلان‌ها و خروج کاملا سمت چپ قرار بگیرن»: on a phone the search is a magnifier that no longer takes the
   bar's spare width, so the three rounds sat right after it, mid-bar. They take that width in front of them now and
   end the bar at its left side, at every width (where the search still grows there is no spare width to take). */
.topbar-actions { margin-inline-start: auto; }
@media (max-width: 480px) {
    /* and the last circle's edge on the page's own left edge: the cards below start 1rem in, and a circle sits 3px
       inside its 40px item */
    .topbar { padding-inline-end: calc(1rem - 3px); }
}

/* ── خانه‌های میز کار روی گوشی: نام کامل، در دو خط اگر لازم بود ──
   «مانیتورینگ» and the new «اشاره‌ها» were cut to «مانیتوری…» in a sixth of a phone. */
@media (max-width: 700px) {
    .work-link { white-space: normal; font-size: 0.8rem; line-height: 1.25; }
    .work-link .side-label { overflow: visible; text-overflow: clip; overflow-wrap: normal; }
}
/* …but never broken inside a word: «مانیتورین / گ» on every phone under 390px (320 to 375 — most of them), because
   the line above once let a word break anywhere. Below 390px the six cells give their label the cell's whole width,
   and the label's size stops where the longest word («مانیتورینگ», about 4.1 times its size) still fits a sixth of
   the row — at the phone's own larger text sizes too. */
@media (max-width: 389px) {
    .work-nav { gap: 2px; container-type: inline-size; }
    .work-link { padding-inline: 0; font-size: min(0.7rem, calc((100cqi - 10px) / 6 / 4.2)); }
}

/* ── جدول‌ها روی گوشی: عنوانِ بلند می‌شکند، صفحه به پهلو نمی‌رود ──
   «وظایف در انتظار انجام» (گزارش و تحلیل): a task's title is a link that never wrapped; on a phone, where the
   table is a column of cards, one long title made the whole page 690px wide and it slid sideways. */
@media (max-width: 700px) {
    .table td .row-link, .table td a:not(.btn):not(.act-btn), .table td .wrap {
        white-space: normal; overflow-wrap: anywhere; min-width: 0; max-width: 100%;
    }
    /* and a cell's own words: «شرح کار» of a filed report ran past its card and was cut at the edge */
    .table td:not(.nowrap), .sheet-table td:not(.nowrap),
    .sheet-block .sheet-table:not(.sheet-answers) td:not(.nowrap) { white-space: normal; overflow-wrap: anywhere; }
    /* a table turned into cards sits inside its panel, not flush against the panel's sides */
    .panel-body > .table-wrap, .panel-body > .sheet-block { margin-inline: 0; }
}

/* ── «چیپِ تیک‌دار» با نوشته‌ی بلند ──
   CRM settings: «گزارش هفتگی فروش، شنبه‌ها ساعت ۹ …» ran onto two lines drawn on top of each other — the chip
   row's line-height of 0 (meant for a chip and its checkbox) also applied to plain words. */
.chip-check:not(:has(.chip)) { line-height: 1.7; align-items: flex-start; }
.chip-check:not(:has(.chip)) input { margin-block-start: 0.35em; }

/* ── مرحله‌های فروش روی گوشی ──
   Seven columns fixed for a desk (polish §مرحله‌های فروش) overrode the phone layout: the name, the percentage and
   four buttons crowded into 300px and overlapped. On a phone: the name and its percentage on one line, the four
   buttons evenly under them. */
@media (max-width: 700px) {
    .crm-stage-row, .crm-stage-new { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .crm-stage-row > .crm-stage-num { grid-column: span 1; grid-row: 1; }
    .crm-stage-row > input[type="text"] { grid-column: span 8; grid-row: 1; min-width: 0; }
    .crm-stage-row > .crm-prob { grid-column: span 3; grid-row: 1; }
    .crm-stage-row > .btn { grid-column: span 3; grid-row: 2; justify-self: stretch; }
    .crm-stage-new > .btn { grid-column: 1 / -1; }
}


/* ── نوشته‌ی بلندِ بی‌فاصله می‌شکند ──
   «قفسه انبار…»: a task's description held a run of characters with no space in it; on a phone it pushed its card
   — and with it the whole page — 107px past the screen («کارهای پیگیری از دیگران»). Words still break only where
   they must. */
.task-title, .task-desc, .task-meta, .report-text, .line-title, .comment-body, .bubble-body, .ticket-card-text,
.ticket-card-subject, .mention-text, .letter-subject, .chat-peer-name, .notif-body, .software-desc, .oc-title,
.page-head h1, .panel-head { overflow-wrap: anywhere; }

/* ── چارت سازمانی روی گوشی ──
   Each level steps in by an indent and every box was 220px whatever room was left: the fourth level ran off the
   left edge of a 320px phone. The boxes now take the room their level has, up to the same 220px. */
@media (max-width: 700px) {
    .oc-scroll { --oc-indent: 1rem; }
    .oc-node { width: 100%; min-width: 0; box-sizing: border-box; }
    .oc-node > .oc-children { align-self: stretch; width: 100%; min-width: 0; box-sizing: border-box; }
    .oc-box { width: min(var(--oc-w), 100%); min-width: 0; }
}

/* ── شاخص‌های واحدها: توضیحِ هر واحد در خط دوم ──
   «برای ۵ …»: the sentence beside each unit's name was cut to a few words on a phone. */
@media (max-width: 700px) {
    .unit-summary { flex-wrap: wrap; row-gap: 0.3rem; }
    .unit-why { flex: 1 0 100%; order: 5; white-space: normal; overflow: visible; text-overflow: clip; }
}

/* ── نتیجه‌ی کلیدی تازه: فهرست هدف‌ها و نام هدف تازه، زیر هم ── */
@media (max-width: 700px) {
    .okr-obj-pick { flex-wrap: wrap; width: 100%; min-width: 0; }
    .okr-obj-pick > select, .okr-kr-table td .okr-obj-pick > .okr-quick-newobj { flex: 1 1 100% !important; min-width: 0; }
}

/* ── ستون‌هایی که از گوشی پهن‌ترند ──
   «سند جامع پروژه» stood its cards in columns of at least 340px — wider than a 320px phone's panel — and the
   desk's two-column grid asked for 320px. On a phone each is one column of the width there is. */
.master-grid { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.master-contract { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
@media (max-width: 700px) {
    .desk-grid, .desk-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .master-line input[type="text"] { min-width: 0; width: 100%; }
}


/* ── یادداشتِ «انجام شد» بالای صفحه، در خط خودش ──
   Drawn inline it sat on the same line as «بازگشت» and pushed it along; on a line of its own the way back stays
   where it always is, and the note goes when it has faded (form-helpers.js). */
.saved-note.is-top { display: flex; width: fit-content; max-width: 100%; }


/* ── روزهای اضافه‌کاری، هر کدام به یک شکل ──
   One day's controls stood beside it and the next day's dropped under it, by a few pixels of difference in their
   text. On a desk every day is the same two columns — what was worked, and its controls on one line at the end;
   on a phone the controls go under, for every day alike. */
.overtime-day { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.6rem 1rem; }
.overtime-day-acts { flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 1100px) {
    .overtime-day { grid-template-columns: minmax(0, 1fr); }
    .overtime-day-acts { flex-wrap: wrap; justify-content: flex-start; }
}


/* ── کارتابل و پرسنل در ستونی باریک ──
   Measured at 768 and 1024 (a tablet, or a laptop with both menus open): a letter's row — sender, subject, labels,
   date, archive — stood on one line wider than its column, and the whole cartable slid 30–66px sideways; the
   personnel list's six columns ran 180px past their panel and were cut. The rows are now laid out by the room
   their own list has, not by the screen: a narrow list stacks each row the way a phone does. */
.letter-list { container-type: inline-size; container-name: letters; }
@container letters (max-width: 760px) {
    .letter-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 0.55rem; }
    .letter-sender { width: auto; min-width: 0; }
    .letter-sender-name { display: block; }
    .letter-sender-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; min-width: 0; }
    .letter-subject { overflow-wrap: anywhere; line-height: 1.7; }
    .letter-tags:empty { display: none; }
    .letter-side { flex-wrap: wrap; gap: 0.45rem 0.8rem; }
    .letter-side .inline-form { margin-inline-start: auto; }
}
.perf-list { container-type: inline-size; container-name: people; }
@container people (max-width: 860px) {
    .perf-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "who band" "score score" "parts parts" "trend next";
        gap: 0.5rem 0.75rem;
    }
    .perf-who { grid-area: who; }
    .perf-band { grid-area: band; }
    .perf-score { grid-area: score; }
    .perf-parts { grid-area: parts; }
    .perf-trend { grid-area: trend; }
    .perf-next { grid-area: next; }
}

/* ══ دور ۳۵ — وظایف مثل میزیتو ══════════════════════════════════════════════════════════════════════════════════
   «فیلتر وظایف دقیقا مثل اسکرین شات»، «با یک خط از هم جدا بشن … فقط بخشیش معلوم باشه»، «عکس پروفایل شخص کنار
   وظیفه»، «پاپ آپ دقیقا با تمام جزییاتی که در تصویر هست». */

/* ── the tab row: the reference's five, «دسته‌بندی کارها» opening its list ── */
/* the row wraps rather than scrolls, so «دسته‌بندی کارها» can open its list below it unclipped */
.tabs.task-tabs { align-items: stretch; overflow: visible; flex-wrap: wrap; }
.tab-menu { position: relative; }
.tab-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.tab-menu > summary::-webkit-details-marker { display: none; }
.tab-caret { display: inline-flex; transform: rotate(90deg); color: var(--muted); }
.tab-menu[open] .tab-caret { transform: rotate(-90deg); }
.tab-menu-list {
    position: absolute; inset-inline-start: 0; top: calc(100% + 0.35rem); z-index: 30;
    min-width: 240px; max-height: min(420px, 70vh); overflow-y: auto;
    padding: 0.35rem; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.tab-menu-list a {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.55rem 0.7rem; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-size: 0.92rem; white-space: nowrap;
}
.tab-menu-list a:hover, .tab-menu-list a.is-on { background: var(--accent-soft); color: var(--accent-ink); }
.tab-menu-empty { display: block; padding: 0.6rem 0.7rem; font-size: 0.89rem; }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: #43474e; }
.cat-dot.cat-red { background: #c0392b; }
.cat-dot.cat-orange { background: #d9730d; }
.cat-dot.cat-green { background: #1d7a4c; }
.cat-dot.cat-blue { background: #2f6fd0; }
.cat-dot.cat-purple { background: #6d3fc0; }
.cat-dot.cat-teal { background: #12857f; }
.cat-dot.cat-grey { background: #8a8d94; }

/* ── the switches row, in the reference's order, «فیلتر نمایش» at its far end ── */
.task-switches {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem;
    margin: 0 0 var(--gap-block);
}
.task-switches .cal-switch { white-space: nowrap; }
.switch-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 20px; padding: 0 6px;
    border-radius: 6px; background: #6a6a74; color: #fff;
    font-size: 0.81rem; font-weight: 700;
}
.cal-basis-menu, .cal-filter-pill { position: relative; }
.cal-basis-menu > summary, .cal-filter-pill > summary { list-style: none; cursor: pointer; }
.cal-basis-menu > summary::-webkit-details-marker,
.cal-filter-pill > summary::-webkit-details-marker { display: none; }
.cal-basis-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.9rem; color: #52525c; white-space: nowrap;
}
.cal-basis-btn b { font-weight: 600; color: var(--text); }
.cal-basis-btn:hover b { color: var(--accent-ink); }
.cal-basis-list {
    position: absolute; inset-inline-start: 0; top: calc(100% + 0.35rem); z-index: 30;
    min-width: 180px; padding: 0.35rem; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.cal-basis-list a {
    display: block; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-size: 0.92rem;
}
.cal-basis-list a:hover, .cal-basis-list a.is-on { background: var(--accent-soft); color: var(--accent-ink); }
.cal-filter-pill { margin-inline-start: auto; }
.pill-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    height: 34px; padding: 0 0.9rem;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: #52525c; font-size: 0.9rem; white-space: nowrap;
}
.pill-btn:hover, .cal-filter-pill[open] > .pill-btn { border-color: var(--accent); color: var(--accent-ink); }
.pill-btn.is-on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.cal-filter-pill .cal-filter-form {
    position: absolute; inset-inline-end: 0; top: calc(100% + 0.4rem); z-index: 30;
    width: min(560px, calc(100vw - 32px));
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem;
    padding: 1rem; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.cal-filter-pill .cal-filter-form label { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; font-size: 0.86rem; }
.cal-filter-pill .cal-filter-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; }

/* ── one task, one line: the list ── */
.tlist {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    margin-bottom: var(--gap-block); overflow: hidden;
}
.trow {
    display: flex; align-items: center; gap: 0.6rem;
    min-height: 48px; padding: 0.45rem 0.9rem;
    border-top: 1px solid var(--border-soft);
}
.trow:first-child { border-top: 0; }
.trow:hover { background: #fafafd; }
.trow-tick { margin: 0; display: inline-flex; flex-shrink: 0; }
.trow .task-check { margin: 0; display: inline-flex; align-items: center; justify-content: center; }
.trow-main {
    flex: 1 1 auto; min-width: 0;
    display: flex; align-items: center; gap: 0.5rem;
    overflow: hidden; white-space: nowrap;
    color: var(--text); text-decoration: none;
}
.trow-main:hover .trow-title { color: var(--accent-ink); }
.trow-title { font-weight: 600; font-size: 0.94rem; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.trow-desc { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 0.86rem; }
.trow-said {
    flex: 0 1 auto; min-width: 0; max-width: 60%;
    display: inline-flex; align-items: center; gap: 0.4rem;
    height: 28px; padding-block: 0; padding-inline: 0.25rem 0.6rem;
    border: 1px solid var(--border); border-radius: 999px;
    color: var(--muted); font-size: 0.85rem; overflow: hidden;
}
.trow-said-text { overflow: hidden; text-overflow: ellipsis; }
.trow-said-face { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.trow-said-face.is-letter { display: inline-grid; place-items: center; background: var(--bg); color: #52525c; font-size: 0.8rem; }
.trow-noted { color: #e0a100; display: inline-flex; flex-shrink: 0; }
.trow-kept { color: var(--accent-ink); display: inline-flex; flex-shrink: 0; }
.trow-progress {
    position: relative; flex-shrink: 0; width: 44px; height: 20px; border-radius: 6px;
    background: #e6e6ec; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
}
.trow-progress-bar { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--green); }
.trow-progress b { position: relative; font-size: 0.8rem; font-weight: 700; color: var(--text); }
.trow-progress.is-high b { color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.35); }
.trow-side { display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.trow-side .chip { white-space: nowrap; }
.trow-checks {
    display: inline-flex; align-items: center; gap: 0.25rem;
    height: 22px; padding: 0 0.4rem; border: 1px solid var(--border); border-radius: 6px;
    color: #52525c; font-size: 0.81rem;
}
.trow-checks b { font-weight: 600; }
.trow-repeat { color: var(--muted); display: inline-flex; }
.chip-more { background: var(--bg); color: #52525c; }
.trow .task-star, .calendar-task .task-star, .peek-title .task-star { color: #e0a100; display: inline-flex; flex-shrink: 0; }
.trow.is-first { box-shadow: inset -3px 0 0 #e0a100; }
.trow.is-done .trow-title { color: var(--muted); text-decoration: line-through; }
/* «نمایش کامل عناوین»: the whole of it, on as many lines as it takes */
.trow.is-full { align-items: flex-start; }
.trow.is-full .trow-main { white-space: normal; flex-wrap: wrap; align-items: baseline; }
.trow.is-full .trow-title, .trow.is-full .trow-desc, .trow.is-full .trow-said-text { overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.trow.is-full .trow-said { height: auto; max-width: 100%; padding-block: 0.2rem; border-radius: 14px; }
.cat-chip {
    display: inline-flex; align-items: center; gap: 0.3rem; height: 24px; padding: 0 0.55rem; border-radius: 6px;
    font-size: 0.83rem; font-weight: 600; text-decoration: none; white-space: nowrap;
    background: #eceef1; color: #43474e;
}
.cat-chip.cat-red { background: #fdecea; color: #a32b1c; }
.cat-chip.cat-orange { background: #fdf0e3; color: #8a4a06; }
.cat-chip.cat-green { background: #e7f4ec; color: #14603b; }
.cat-chip.cat-blue { background: #e8f0fd; color: #1c4e8f; }
.cat-chip.cat-purple { background: #f0eafc; color: #57309b; }
.cat-chip.cat-teal { background: #e6f2f1; color: #14605c; }
.cat-chip.cat-grey { background: #eceef1; color: #43474e; }

/* the faces of whoever carries a task — a picture, or a first letter on a colour of its own */
.faces { display: inline-flex; align-items: center; flex-shrink: 0; }
.face {
    width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    display: inline-grid; place-items: center;
    border: 2px solid var(--surface); margin-inline-start: -7px;
    font-size: 0.8rem; font-weight: 700; color: #fff; background: #6a6a74;
}
.faces .face:first-child { margin-inline-start: 0; }
.face-0 { background: #4f46e5; }
.face-1 { background: #be185d; }
.face-2 { background: #0f766e; }
.face-3 { background: #c2410c; }
.face-4 { background: #1d4ed8; }
.face-5 { background: #7c3aed; }
.face-more { background: var(--bg); color: #52525c; font-size: 0.75rem; }

@media (max-width: 700px) {
    .trow { flex-wrap: wrap; gap: 0.35rem 0.6rem; padding: 0.55rem 0.75rem; }
    .trow-main { flex: 1 1 calc(100% - 40px); }
    .trow-side { flex: 1 1 100%; flex-wrap: wrap; padding-inline-start: calc(22px + 0.6rem); }
    .trow-said { max-width: 100%; }
    .trow-main .trow-desc, .trow-main .trow-said { display: none; }
    .trow.is-full .trow-main .trow-desc, .trow.is-full .trow-main .trow-said { display: inline-flex; }
    .task-switches { gap: 0.6rem 1rem; }
    .cal-filter-pill { margin-inline-start: 0; }
    .cal-filter-pill .cal-filter-form {
        position: fixed; inset: auto 16px 16px 16px; top: auto; width: auto;
        grid-template-columns: 1fr; max-height: 75dvh; overflow-y: auto;
    }
    .tab-menu-list { position: fixed; inset: auto 16px 16px 16px; top: auto; min-width: 0; }
}

/* ── the month's cards: star, title, faces; a task over several days on each of them ── */
.calendar-task { display: flex; align-items: center; gap: 0.25rem; }
.calendar-task-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-grid.is-full .calendar-task-title { white-space: normal; overflow-wrap: anywhere; }
.calendar-task .faces .face { width: 18px; height: 18px; border-width: 1.5px; margin-inline-start: -5px; font-size: 0.56rem; }
.calendar-task .faces .face:first-child { margin-inline-start: 0; }
.calendar-task.span-middle, .calendar-task.span-last { opacity: 0.88; }
.calendar-task .span-mark { color: var(--muted); flex-shrink: 0; }
.calendar-task.is-first { box-shadow: inset 0 0 0 1px rgba(224, 161, 0, 0.55); }

/* ── «مشخصات وظیفه» — the window ── */
.peek-dialog {
    width: min(760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
    padding: 0; border: 0; border-radius: var(--radius-lg);
    background: var(--surface); color: var(--text);
    box-shadow: 0 28px 70px rgba(20, 18, 50, 0.3); overflow: hidden;
}
.peek-dialog[open] { display: flex; flex-direction: column; animation: qt-in 0.16s ease; }
.peek-dialog::backdrop { background: rgba(22, 20, 40, 0.45); }
@media (prefers-reduced-motion: reduce) { .peek-dialog[open] { animation: none; } }
.peek-slot { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.peek { position: relative; display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 32px); }
.peek-wait { padding: 2rem; color: var(--muted); text-align: center; }
.peek-mark { position: absolute; top: 0; inset-inline-end: 1.1rem; margin: 0; z-index: 2; }
.peek-ribbon {
    display: inline-grid; place-items: center; width: 34px; height: 40px;
    border: 0; border-radius: 0 0 8px 8px; background: var(--bg); color: var(--muted); cursor: pointer;
}
.peek-ribbon:hover { color: var(--accent-ink); }
.peek-ribbon.is-on { background: var(--accent); color: var(--on-accent); }
.peek-head {
    display: flex; align-items: center; gap: 0.75rem;
    padding-block: 1.4rem 0.8rem; padding-inline: 1.6rem 4rem;
}
.peek-heading { margin: 0; font-size: 1.32rem; font-weight: 800; }
.peek-heading:focus { outline: none; }
.peek-views { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.89rem; }
.peek-head-acts { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 0.35rem; }
.peek-edit {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; border-radius: var(--radius-sm);
    color: var(--accent-ink); font-weight: 700; font-size: 0.94rem; text-decoration: none;
}
.peek-edit:hover { background: var(--accent-soft); }
.peek-more { position: relative; }
.peek-more > summary { list-style: none; }
.peek-more > summary::-webkit-details-marker { display: none; }
.peek-icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; text-decoration: none;
}
.peek-icon-btn:hover, .peek-more[open] > .peek-icon-btn { background: var(--bg); color: var(--text); }
.peek-menu {
    position: absolute; inset-inline-end: 0; top: calc(100% + 0.3rem); z-index: 5; min-width: 200px;
    padding: 0.35rem; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.peek-menu a, .peek-menu button {
    display: block; width: 100%; padding: 0.55rem 0.75rem; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--text); text-decoration: none; text-align: start; font: inherit; font-size: 0.92rem; cursor: pointer;
}
.peek-menu a:hover, .peek-menu button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.peek-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: 0.4rem 1.6rem 1.2rem; display: flex; flex-direction: column; gap: 1rem;
}
.peek-field { display: flex; flex-direction: column; gap: 0.3rem; }
.peek-cap { font-size: 0.84rem; color: var(--accent-ink); }
.peek-title-row { display: flex; align-items: center; gap: 0.6rem; padding-bottom: 0.45rem; border-bottom: 2px solid var(--accent); }
.peek-tick { margin: 0; display: inline-flex; }
.peek-circle {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    display: inline-grid; place-items: center;
    border: 1.5px solid #9a9aa4; background: var(--surface); color: #fff; cursor: pointer; padding: 0;
}
.peek-circle.is-done { background: var(--green-deep); border-color: var(--green-deep); }
.peek-circle.is-locked { cursor: default; border-style: dashed; }
.peek-title { font-size: 1.06rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.35rem; }
.peek-title.is-done { color: var(--muted); text-decoration: line-through; }
.peek-desc { white-space: pre-line; line-height: 1.85; font-size: 0.96rem; overflow-wrap: anywhere; }
.peek-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.peek-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    height: 36px; padding: 0 0.75rem; border: 1.5px solid var(--border); border-radius: 999px;
    font-size: 0.9rem; color: #52525c; text-decoration: none; background: var(--surface);
}
.peek-chip .face { margin: 0; width: 26px; height: 26px; }
.peek-who { border-color: #d9730d; color: #8a4a06; font-weight: 700; padding-inline-start: 0.25rem; }
.peek-time { border-color: #1d7a4c; color: #14603b; font-weight: 600; }
.peek-repeat-mark { display: inline-flex; }
.peek-checks-chip { border-color: #12857f; color: #14605c; }
.peek-checklist { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.peek-check {
    display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0.35rem 0.8rem;
    border-top: 1px solid var(--border-soft); box-shadow: inset -2px 0 0 #f2b8b0;
}
.peek-check:first-child { border-top: 0; }
.peek-check form { margin: 0; display: inline-flex; }
.peek-box {
    width: 22px; height: 22px; flex-shrink: 0; padding: 0; display: inline-grid; place-items: center;
    border: 1.5px solid #6a6a74; border-radius: 4px; background: var(--surface); color: #fff; cursor: pointer;
}
.peek-check.is-done .peek-box { background: #43474e; border-color: #43474e; }
.peek-box.is-locked { cursor: default; border-style: dashed; }
.peek-check-text { flex: 1 1 auto; min-width: 0; font-size: 0.94rem; overflow-wrap: anywhere; }
.peek-check-who { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; color: var(--muted); white-space: nowrap; }
.peek-check-who .face { width: 22px; height: 22px; margin: 0; }
.peek-add-step { display: flex; gap: 0.5rem; margin: 0; }
.peek-add-step input { flex: 1 1 auto; }
.peek-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem 1.25rem; align-items: center; }
.peek-pair { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.94rem; }
.peek-cap-inline { color: #52525c; white-space: nowrap; }
.peek-value { color: var(--text); }
.peek-value-box {
    min-width: 64px; height: 32px; padding: 0 0.6rem; display: inline-grid; place-items: center;
    border: 1px solid var(--border); border-radius: 6px;
}
.peek-repeat { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; color: #1c4e8f; font-size: 0.94rem; }
.peek-repeat form { margin: 0; }
.btn-orange { background: #c2410c; color: #fff; border-color: #c2410c; }
.btn-orange:hover { background: #a3360a; border-color: #a3360a; }
.peek-row2 { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; }
.peek-progress {
    position: relative; width: 220px; max-width: 60vw; height: 20px; border-radius: 6px; background: #e6e6ec; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
}
.peek-progress span { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--green); }
.peek-progress b { position: relative; color: var(--text); font-size: 0.81rem; }
.peek-progress.is-high b { color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.4); }
.peek-board .inline-form { margin: 0; }
.peek-files { display: flex; flex-direction: column; gap: 0.4rem; }
.peek-reports { border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1rem 1.1rem; }
.peek-sub { margin: 0 0 0.75rem; font-size: 1.04rem; font-weight: 800; }
.peek-history { border-top: 1px solid var(--border-soft); padding-top: 0.9rem; }
.peek-history[hidden] { display: none; }
.peek-history-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px dashed var(--border-soft); font-size: 0.9rem; }
.peek-history-row:first-of-type { border-top: 0; }
.peek-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.75rem 1.6rem; border-top: 1px solid var(--border-soft); background: var(--surface);
}
.peek-foot-icons { display: inline-flex; gap: 0.25rem; order: -1; }
.peek-close {
    height: 2.5rem; padding: 0 1.2rem; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--accent-ink); font: inherit; font-size: 0.98rem; font-weight: 800; cursor: pointer;
}
.peek-close:hover { background: var(--accent-soft); }
@media (max-width: 700px) {
    /* round 91: «وقتی پاپ آپ‌ها تو گوشی تو هر بخشی باز میشن رسپانسیو نیستن (جای درستی از صفحه قرار نمیگیرن)» — a task's
       or a request's window stands in the middle of the screen with room round it, as on the desk, not risen from the
       bottom edge under the phone's own bars */
    .peek-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100vh - 32px); margin: auto;
                   border-radius: 18px; }
    .peek { max-height: calc(100vh - 32px); }
    dialog[open]:not(.chat-gallery) { max-width: calc(100vw - 24px); }
    .peek-head { padding-block: 1.1rem 0.6rem; padding-inline: 1rem 3.4rem; flex-wrap: wrap; }
    .peek-body { padding: 0.3rem 1rem 1rem; }
    .peek-grid { grid-template-columns: 1fr; }
    .peek-foot { padding: 0.6rem 1rem; }
    .peek-check { flex-wrap: wrap; }
    .peek-check-who { flex-basis: 100%; padding-inline-start: calc(22px + 0.6rem); }
}

/* ── the create window: the reminder with its repeat, the final approval, the start day ── */
.qt-remind-said, .qt-start-said { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.qt-repeat-mark { display: inline-flex; }
.qt-repeat-mark[hidden], .qt-remind-said[hidden] { display: none; }
.qt-pane-title { margin: 0 0 0.5rem; font-size: 0.9rem; font-weight: 700; }
.qt-pane-title:not(:first-child) { margin-top: 1rem; }
.qt-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.35rem 1rem; }
.qt-repeat-choices { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.qt-remind-pane .repeat-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.6rem 0 0.2rem; }
/* only what the choice needs: the clock once a reminder is chosen, the day only for «انتخاب تاریخ و زمان»; the days
   of «روزانه» while it is chosen, and «تکرار تا تاریخ» once any repeat is */
.qt-remind-pane .qt-remind-extra { display: none; }
.qt-remind-pane:has(input[name=remind_when]:not([value=none]):checked) .qt-remind-extra { display: flex; }
.qt-remind-pane .qt-remind-day { display: none; }
.qt-remind-pane:has(input[name=remind_when][value=custom]:checked) .qt-remind-day { display: inline-flex; }
.qt-remind-pane .repeat-days, .qt-remind-pane .qt-repeat-until { display: none; }
.qt-remind-pane:has(input[name=repeat_kind][value=daily]:checked) .repeat-days { display: flex; }
.qt-remind-pane:has(input[name=repeat_kind]:not([value=""]):checked) .qt-repeat-until { display: flex; }

/* ── dark ── */
html[data-theme="dark"] .trow:hover { background: rgba(255, 255, 255, 0.03); }
html[data-theme="dark"] .switch-count { background: #4b4b55; }
html[data-theme="dark"] .trow-progress, html[data-theme="dark"] .peek-progress { background: #33333d; }
html[data-theme="dark"] .cat-chip.cat-red { background: #3f1c18; color: #e6796b; }
html[data-theme="dark"] .cat-chip.cat-orange { background: #3f2b18; color: #e7a055; }
html[data-theme="dark"] .cat-chip.cat-green { background: #1b3b28; color: #5fdea0; }
html[data-theme="dark"] .cat-chip.cat-blue { background: #18273f; color: #659be1; }
html[data-theme="dark"] .cat-chip.cat-purple { background: #25183f; color: #a88adb; }
html[data-theme="dark"] .cat-chip.cat-teal { background: #1e3937; color: #5fded7; }
html[data-theme="dark"] .cat-chip.cat-grey, html[data-theme="dark"] .cat-chip { background: var(--bg); color: #979ca5; }
html[data-theme="dark"] .peek-who { border-color: #b8661f; color: #e7a055; }
html[data-theme="dark"] .peek-time { border-color: #2f8f5e; color: #5fdea0; }
html[data-theme="dark"] .peek-checks-chip { border-color: #2a8e88; color: #5fded7; }
html[data-theme="dark"] .peek-repeat { color: #659be1; }
html[data-theme="dark"] .peek-check { box-shadow: inset -2px 0 0 #6b2f28; }
html[data-theme="dark"] .peek-check.is-done .peek-box { background: #979ca5; border-color: #979ca5; color: #1c1c22; }
html[data-theme="dark"] .cal-basis-btn, html[data-theme="dark"] .pill-btn, html[data-theme="dark"] .peek-cap-inline,
html[data-theme="dark"] .trow-checks, html[data-theme="dark"] .chip-more { color: var(--muted); }

/* the deal's orange «حذف» beside «برنده شد», the same button as its neighbours */
.btn-deal-delete { gap: 0.35rem; }
.crm-deal-actions form { margin: 0; }

/* «پیام ارسال شد» — under the message just sent, fading once it has been read */
.sent-said { display: inline-flex; align-items: center; margin-inline-start: 0.5rem; font-weight: 700; transition: opacity 0.6s; }
.bubble-row.is-said .sent-said { opacity: 0; }
.bubble-row.is-sent .bubble { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ── «سازمانی یا ساختمانی» — two cards to choose between ── */
.project-kind { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-list); margin-bottom: var(--gap-list); }
.kind-card {
    display: flex; align-items: flex-start; gap: 0.6rem; margin: 0; padding: 0.9rem 1rem;
    border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 400;
}
.kind-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.kind-card input { margin-top: 0.2rem; flex-shrink: 0; }
.kind-card-body { display: flex; flex-direction: column; gap: 0.2rem; }
.kind-card-body b { font-size: 0.98rem; }
.kind-card-body .muted { font-size: 0.85rem; }
.kind-unit { display: none; flex-direction: column; gap: 0.35rem; max-width: 360px; }
.panel-body:has(input[name=kind][value=unit]:checked) .kind-unit { display: flex; }
.project-kind-inline { margin-bottom: 0.25rem; }
@media (max-width: 560px) { .project-kind { grid-template-columns: 1fr; } }

/* ── «حذف پروژه»: apart, last, saying what goes and what stays ── */
.danger-zone { border-color: #f2c4bd; }
.danger-zone > .panel-head { color: #a32b1c; }
.danger-list { margin: 0 0 var(--gap-list); padding-inline-start: 1.2rem; line-height: 2; font-size: 0.94rem; }
.danger-note { margin: 0; line-height: 1.9; color: #8a4a06; }
.btn-danger-solid {
    display: inline-flex; align-items: center; gap: 0.4rem; background: #b8392a; border-color: #b8392a; color: #fff;   /* 5.74:1 */
}
.btn-danger-solid:hover { background: #9c2f22; border-color: #9c2f22; }
.danger-confirm > summary { list-style: none; cursor: pointer; width: fit-content; }
.danger-confirm > summary::-webkit-details-marker { display: none; }
.danger-confirm[open] > summary { display: none; }
.danger-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--gap-list); margin: 0; }
.danger-form label { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; font-weight: 400; min-width: min(320px, 100%); }
html[data-theme="dark"] .danger-zone { border-color: #6b2f28; }
html[data-theme="dark"] .danger-zone > .panel-head { color: #e6796b; }
html[data-theme="dark"] .danger-note { color: #e7a055; }

/* the orange and the red buttons keep their colour in the dark — the dark theme paints every .btn in the accent */
html[data-theme="dark"] .btn.btn-orange { background: #c2410c; border-color: #c2410c; color: #fff; }
html[data-theme="dark"] .btn.btn-orange:hover { background: #a3360a; border-color: #a3360a; }
html[data-theme="dark"] .btn.btn-danger-solid { background: #b8392a; border-color: #b8392a; color: #fff; }
html[data-theme="dark"] .btn.btn-danger-solid:hover { background: #9c2f22; border-color: #9c2f22; }

/* ══ دور ۳۶ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   The task window edits in place, names are found in a small window, progress goes in fives, the month's cards
   read as sentences, and a repeating task stands on every day of its series. */

/* «نمایش بر اساس» on the line of the switches beside it: a summary drawn inline sat on the baseline of the 16px line
   inside its <details>, five pixels above the others; as a block-level flex box it takes the row's own centre. */
.task-switches .cal-basis-btn, .task-switches .pill-btn { display: flex; }

/* «بدون تکرار» on the line of «روزانه / هفتگی / ماهانه»: inside a form every label after the first takes the
   portal's top margin, and in a grid of choices that set the first one 14px above the rest */
.qt-choices > .tc-choice { margin: 0; }

/* ── the small window of names — «پنجره کوچک … و امکان جست و جو نام افراد» ── */
.qt-pane.qt-pop {
    position: fixed; z-index: 60; width: min(360px, calc(100vw - 32px)); overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.6rem;
    padding: 0.9rem 0.9rem 0.8rem;
    border: 1px solid var(--border-soft); border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 18px 48px rgba(20, 18, 50, 0.22);
}
.qt-pane.qt-pop[hidden] { display: none; }
.qt-pop-title { margin: 0; font-size: 0.98rem; font-weight: 800; }
.qt-pop-note { margin: 0; }
label.qt-find-wrap {
    display: flex; align-items: center; gap: 0.45rem; margin: 0; padding: 0 0.7rem; height: 2.6rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
    color: var(--muted); font-weight: 400; cursor: text;
}
label.qt-find-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qt-find-wrap input.qt-find {
    flex: 1 1 auto; min-width: 0; height: 100%; min-height: 0; margin: 0; padding: 0;
    border: 0; background: transparent; box-shadow: none; outline: none; font-size: 0.96rem;
}
.qt-pop .qt-people-list.picker-box { max-height: 252px; margin: 0; }
.qt-find-none { margin: 0.6rem 0.5rem; font-size: 0.92rem; }
.qt-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
@media (max-width: 700px) {
    .qt-pane.qt-pop { position: static; width: auto; overflow: visible; box-shadow: none; padding: 0.85rem 0 0; border: 0;
                      border-top: 1px solid var(--border-soft); border-radius: 0; }
    /* round 91: while the people picker is open its own «پاک کردن / تأیید» is the foot; the window's «انصراف / ایجاد»
       steps aside, so the two never cover each other or the names */
    :is(#quick-task, .qt-editing) .qt-form.qt-pane-open .qt-foot { display: none; }
    .qt-pane.qt-pop .qt-pop-foot {
        position: sticky; bottom: 0; z-index: 2; margin: 0.6rem 0 0; padding: 0.6rem 0 0.2rem;
        background: var(--surface); border-top: 1px solid var(--border-soft);
    }
    .qt-pane.qt-pop .qt-find-wrap input.qt-find { font-size: 16px; }
}
/* round 91: «در نسخه موبایل وقتی روی ایجاد وظیفه کلیک میشه پاپ آپش وسط صفحه باشه» — the task's window in the middle
   of a phone's screen, with room round it, not risen from the bottom edge */
@media (max-width: 700px) {
    dialog.quick-task {
        width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100vh - 32px);
        margin: auto; border-radius: 18px;
    }
    :is(#quick-task, .qt-editing) .qt-foot { border-radius: 0 0 18px 18px; }
}
@supports (height: 100dvh) {
    @media (max-width: 700px) { dialog.quick-task { max-height: calc(100dvh - 32px); } }
}

/* ── «ویرایش» inside the task's window: the window for a new task, filled in, scrolling inside ── */
.peek.qt-editing { overflow: hidden; }
.qt-editing .qt-form { overflow-y: auto; min-height: 0; max-height: calc(100dvh - 32px); }
.qt-editing .qt-foot {
    position: sticky; bottom: -1.35rem; z-index: 3;
    margin: 0 -1.8rem -1.35rem; padding: 0.8rem 1.8rem; background: var(--surface); border-top: 1px solid var(--border-soft);
}
.qt-editing .qt-picker .jalali-picker { display: block; }
@media (max-width: 700px) {
    .qt-editing .qt-form { max-height: 92dvh; }
    .qt-editing .qt-foot { bottom: -1rem; margin: 0 -1rem -1rem; padding: 0.7rem 1rem; }
}

/* ── «درصد پیشرفت» in fives: a slider laid over the bar, its steps showing while it is pointed at ── */
.peek-progress-form { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0; }
.peek-progress-live { cursor: pointer; }
.peek-progress-live .peek-progress-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--green); transition: width 0.12s ease; }
.peek-progress-live b { pointer-events: none; }
.peek-progress-form.is-high .peek-progress-live b { color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.4); }
.peek-progress-live::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.12s ease;
    background: repeating-linear-gradient(to left, transparent 0, transparent calc(5% - 1px), rgba(0, 0, 0, 0.16) calc(5% - 1px), rgba(0, 0, 0, 0.16) 5%);
}
.peek-progress-live:hover::after, .peek-progress-live:focus-within::after { opacity: 1; }
.peek-progress-live input[type=range] {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer;
    direction: rtl;
}
.peek-progress-live:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.peek-progress-said { font-size: 0.86rem; }
.peek-progress-send[hidden] { display: none; }

/* ── the month's cards: the title across the whole card, the faces and the repeat mark on a line under it ── */
.calendar-task { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; white-space: normal; }
.calendar-task-line { display: block; min-width: 0; }
.calendar-task-line .task-star { display: inline-flex; vertical-align: -1px; margin-inline-end: 0.2rem; }
.calendar-task-line .span-mark { margin-inline-end: 0.15rem; }
.calendar-task .calendar-task-title { display: inline; flex: none; min-width: 0; }
.calendar-grid:not(.is-full) .calendar-task-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-grid.is-full .calendar-task, .calendar-grid.is-full .calendar-task-line { overflow-wrap: break-word; word-break: normal; }
.calendar-grid.is-full .calendar-task .calendar-task-title { white-space: normal; overflow-wrap: break-word; }
.calendar-task-foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.3rem; min-height: 18px; }
.calendar-task-line .cal-repeat { display: inline-flex; vertical-align: -1px; margin-inline-end: 0.2rem; color: var(--muted); }
.calendar-task:hover .calendar-task-line .cal-repeat { color: inherit; }
.calendar-task.is-ghost { opacity: 0.78; background-image: none; border-inline-start-style: dashed; cursor: pointer; }
html[data-theme="dark"] .calendar-task.is-ghost { opacity: 0.7; }

/* ── a project's tasks: the task list's own rows, under the panel's heading with its switch and «ایجاد وظیفه» ── */
.project-tasks > .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1.25rem; flex-wrap: wrap; }
.project-tasks-tools { display: inline-flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; font-weight: 400; }
.project-tasks .panel-body > .task-group-title:first-child { margin-top: 0; }

/* ── the tickets' «اولویت ▾», as the letters' «برچسب‌ها ▾» ── */
.ticket-filter-row { margin: 0 0 var(--gap-list, 12px); }
.ticket-priority-menu > summary.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.ticket-filter-row > .ticket-priority-menu > .label-panel { width: 260px; inset-inline-start: 0; inset-inline-end: auto; }
.ticket-priority-count { font-size: 0.9rem; }
.ticket-filter-said { font-size: 0.94rem; }
.ticket-table .chip { white-space: nowrap; }

/* ── «درخواست‌ها»: who asked, and who covers for them, first on the line ── */
.request-row .request-who { display: inline-flex; flex-direction: column; gap: 0.1rem; min-width: 9.5rem; flex: 0 0 auto; }
.request-row .request-who b { font-weight: 700; }
.request-sub { font-size: 0.9rem; color: #8a4a06; }
html[data-theme="dark"] .request-sub { color: #e7a055; }
.sub-cancel { margin: 0; }
.sub-cancelled { margin: 0 0 var(--gap-list, 12px); padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: #f2f2f5; color: #43474e; font-size: 0.96rem; }
html[data-theme="dark"] .sub-cancelled { background: #26262e; color: #c9c9d1; }
.badge-grey { background: #eceef1; color: #43474e; }
html[data-theme="dark"] .badge-grey { background: #2c2c34; color: #c9c9d1; }
.sub-peek .peek-body > .panel { margin: 0; box-shadow: none; }
@media (max-width: 700px) {
    .request-row .request-who { min-width: 0; flex-basis: 100%; }
}

/* ── «گزارشات»: the units' daily reports, a week at a time, each day its cards ── */
.rw-bar { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0 0.9rem; flex-wrap: wrap; }
.rw-title { font-weight: 800; font-size: 1.1rem; }
.rw-now { margin-inline-start: auto; }
.rw-now-chip { margin-inline-start: auto; }
.rw-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.rw-day {
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.6rem 0.4rem;
    border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
    text-decoration: none; color: var(--text);
}
.rw-day:hover { border-color: var(--accent); }
.rw-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rw-day.is-future, .rw-day.is-off { opacity: 0.55; pointer-events: none; }
.rw-day-name { font-size: 0.9rem; color: var(--muted); }
.rw-day-date { font-weight: 700; font-size: 0.98rem; }
.rw-day-count {
    min-width: 1.9rem; padding: 0.1rem 0.5rem; border-radius: 999px; text-align: center;
    background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 0.9rem;
}
.rw-day-count.is-zero { background: var(--bg); color: var(--muted); }
.rw-section { margin-bottom: 20px; scroll-margin-top: 80px; }
.rw-section-head { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 12px; }
.rw-section-title { margin: 0; font-size: 1.16rem; font-weight: 800; display: inline-flex; align-items: center; gap: 0.5rem; }
.rw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rw-card {
    display: flex; flex-direction: column; gap: 0.55rem; padding: 0.95rem 1rem;
    border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
}
.rw-card-who { display: flex; align-items: center; gap: 0.6rem; }
.rw-face {
    width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.98rem;
}
.rw-card-names { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.rw-card-names b { font-size: 1.04rem; }
.rw-card-names .muted { font-size: 0.9rem; }
.rw-card-form { font-size: 0.96rem; }
.rw-card-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.9rem; }
.rw-card-paraf { font-size: 0.9rem; color: #14603b; }
html[data-theme="dark"] .rw-card-paraf { color: #5fdea0; }
.rw-card-acts { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; }
.rw-paraf { display: flex; align-items: center; gap: 0.4rem; flex: 1 1 auto; margin: 0; min-width: 0; }
.rw-paraf input[type=text] { flex: 1 1 8rem; min-width: 0; height: 2.1rem; min-height: 0; font-size: 0.9rem; }
.rw-missing { margin: 12px 0 0; padding: 0.55rem 0.85rem; border-radius: var(--radius-sm); background: #fdf3e6; color: #6b3a05; font-size: 0.94rem; line-height: 1.9; }
.rw-missing > summary { cursor: pointer; font-weight: 700; }
.rw-missing > p { margin: 0.35rem 0 0; }
.rw-bar .cal-next .icn { transform: scaleX(-1); }
html[data-theme="dark"] .rw-missing { background: #3a2a18; color: #e7c49a; }
@media (max-width: 700px) {
    .rw-strip { grid-template-columns: repeat(7, minmax(44px, 1fr)); overflow-x: auto; gap: 6px; }
    .rw-day { padding: 0.5rem 0.2rem; }
    .rw-day-name { font-size: 0.84rem; }
    .rw-day-date { font-size: 0.86rem; white-space: nowrap; }
    .rw-cards { grid-template-columns: 1fr; }
}

/* ── گفت‌وگو: the thread opens at its last message — «آخرین پیام رو نشون بده نه اولین پیام» ──
   The column's height (above) never took: the shell is a flex item with «flex: 1», whose 0% basis overrides
   «height», so in a column of no fixed height it grew to the whole conversation — 41,000px — and the window,
   not the thread, scrolled, standing at the first message. Sized by its height alone, the thread scrolls. */
@media (min-width: 761px) {
    body.section-chat .chat-shell { flex: 0 0 auto; height: calc(100dvh - 186px); min-height: 460px; }
    body.section-chat .chat-shell > .chat-peers,
    body.section-chat .chat-shell > .chat-main { min-height: 0; max-height: 100%; }
}

/* pictures and films where they were sent */
.bubble-media, .chat-media-list .bubble-media {
    display: block; margin-top: 0.35rem; max-width: min(340px, 100%); border-radius: 12px; overflow: hidden;
    background: rgba(0, 0, 0, 0.06); line-height: 0;
}
.bubble-media img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.bubble-video { display: block; margin-top: 0.35rem; width: min(340px, 100%); max-height: 360px; border-radius: 12px; background: #000; }
.bubble-row.mine .bubble-media { background: rgba(255, 255, 255, 0.18); }
.chat-media-list { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; }

/* what is about to be sent, above the box */
.chat-main { position: relative; }
.chat-tray {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 0.7rem 0.9rem 0.2rem;
    border-top: 1px solid var(--border-soft); background: var(--surface); flex-shrink: 0;
    max-height: 210px; overflow-y: auto;
}
.chat-tray[hidden] { display: none; }
.chat-chip {
    position: relative; display: grid; grid-template-columns: 1fr; align-content: start; gap: 0.15rem;
    width: 120px; padding: 6px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg);
}
.chat-chip.is-file { width: auto; max-width: 220px; padding-block: 0.5rem; padding-inline: 0.75rem 2.1rem; }
.chat-chip img, .chat-chip video { width: 106px; height: 80px; object-fit: cover; border-radius: 8px; background: #ddd; display: block; }
.chat-chip-name { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; }
.chat-chip-size { font-size: 0.84rem; color: var(--muted); }
.chat-chip-x {
    position: absolute; top: 4px; inset-inline-end: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%;
    background: rgba(20, 18, 40, 0.65); color: #fff; font-size: 1.04rem; line-height: 24px; text-align: center; cursor: pointer; padding: 0;
}
.chat-chip-x:hover { background: var(--red-deep, #b8392a); }
.chat-tray-warn { flex-basis: 100%; margin: 0; color: var(--red-deep, #b8392a); font-size: 0.92rem; }

/* «حالت دراپ و درگ»: a file carried over the conversation */
.chat-drop {
    position: absolute; inset: 0; z-index: 6; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
    background: rgba(238, 240, 254, 0.94); border: 2px dashed var(--accent); border-radius: inherit; color: var(--accent-ink);
    pointer-events: none; text-align: center; padding: 1rem;
}
.chat-drop b { font-size: 1.1rem; }
.chat-drop span:last-child { font-size: 0.94rem; }
.chat-main.is-dropping .chat-drop { display: flex; }
html[data-theme="dark"] .chat-drop { background: rgba(28, 26, 48, 0.94); }
html[data-theme="dark"] .chat-chip { background: #22222a; }

/* ── «دستیار … مثل چت جی پی تی یا پنل خودت»: the conversations in a column, the open one beside it, the box to
   write in centred under it — and in the middle of the page while a conversation is still empty ── */
.asst-app {
    display: grid; grid-template-columns: 264px minmax(0, 1fr);
    height: calc(100dvh - var(--topbar-h) - 60px); min-height: 520px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); overflow: hidden;
}
.asst-side {
    display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto;
    padding: 14px 12px; background: var(--bg); border-inline-end: 1px solid var(--border-soft);
}
.asst-new {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.85rem; margin-bottom: 6px;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
    color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.98rem;
}
.asst-new:hover { border-color: var(--accent); color: var(--accent-ink); }
.asst-chats { display: flex; flex-direction: column; gap: 2px; }
.asst-chats-day { margin: 14px 8px 6px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.asst-chats-day:first-child { margin-top: 6px; }
.asst-chats-none { margin: 10px 8px; font-size: 0.92rem; line-height: 1.9; }
.asst-chat { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.asst-chat > a {
    flex: 1 1 auto; min-width: 0; padding: 0.55rem 0.7rem; border-radius: 10px;
    color: var(--text); text-decoration: none; font-size: 0.96rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asst-chat:hover { background: rgba(0, 0, 0, 0.04); }
.asst-chat.is-on { background: var(--accent-soft); }
.asst-chat.is-on > a { color: var(--accent-ink); font-weight: 700; }
.asst-chat form { margin: 0; flex: 0 0 auto; }
.asst-chat-x {
    display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px;
    background: none; color: var(--muted); cursor: pointer; opacity: 0;
}
.asst-chat:hover .asst-chat-x, .asst-chat.is-on .asst-chat-x, .asst-chat-x:focus-visible { opacity: 1; }
.asst-chat-x:hover { background: #fdecea; color: #a32b1c; }

.asst-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.asst-top { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-soft); }
.asst-title { margin: 0; font-size: 1.1rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asst-side-toggle {
    display: none; align-items: center; gap: 0.4rem; height: 2.4rem; padding: 0 0.8rem; flex: 0 0 auto;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.94rem; cursor: pointer;
}
.asst-app .asst-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1.25rem 1.25rem 0.5rem; gap: 20px; }
.asst-app .asst-thread > * { width: min(800px, 100%); margin-inline: auto; }
.asst-app .asst-turn { scroll-margin-top: 16px; }
.asst-dock { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0.6rem 1.25rem 0.9rem; }
.asst-dock > * { width: min(800px, 100%); }
.asst-app .asst-ask { position: static; border: 1px solid var(--border); box-shadow: 0 6px 22px -14px rgba(28, 25, 60, 0.35); }
.asst-app .asst-ask:focus-within { border-color: var(--accent); }
.asst-foot { margin: 0; font-size: 0.86rem; text-align: center; }
.asst-app .asst-examples { justify-content: center; margin: 0; }
.asst-app .asst-hello { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.asst-app .asst-hello[hidden] { display: none; }
.asst-app .asst-hello-mark { width: 56px; height: 56px; flex: none; }
.asst-hello-said { margin: 0.4rem 0 0; font-size: 1.58rem; font-weight: 800; }
.asst-hello-sub { margin: 0; max-width: 34rem; line-height: 1.9; font-size: 0.98rem; }
/* a conversation with nothing in it yet: the greeting and the box in the middle of the page */
.asst-app.is-empty .asst-thread { display: none; }
.asst-app.is-empty .asst-main { justify-content: center; }
.asst-app.is-empty .asst-dock { margin-block: auto; gap: 16px; padding-bottom: 8vh; }

html[data-theme="dark"] .asst-side { background: #1b1b22; }
html[data-theme="dark"] .asst-new { background: #22222a; }
html[data-theme="dark"] .asst-chat:hover { background: rgba(255, 255, 255, 0.05); }
html[data-theme="dark"] .asst-chat-x:hover { background: #3f1c18; color: #e6796b; }

@media (max-width: 760px) {
    .asst-app { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--topbar-h) - 24px); min-height: 460px; }
    .asst-side {
        position: fixed; z-index: 70; inset-block: 0; inset-inline-start: 0; width: min(320px, 84vw);
        transform: translateX(105%); transition: transform 0.2s ease; box-shadow: -16px 0 40px rgba(20, 18, 50, 0.25);
    }
    .asst-app.side-open .asst-side { transform: none; }
    .asst-side-toggle { display: inline-flex; }
    .asst-top { padding: 0.65rem 0.85rem; }
    .asst-app .asst-thread { padding: 0.9rem 0.85rem 0.4rem; }
    .asst-dock { padding: 0.5rem 0.75rem 0.75rem; }
    .asst-hello-said { font-size: 1.32rem; }
    .asst-foot { display: none; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .asst-side { transition: none; } }

/* ── «رمز تازه»: the one moment a password is readable ── */
.pw-new .panel-body { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.pw-new-lead { margin: 0; font-size: 1.04rem; }
.pw-new-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pw-new-code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.58rem; font-weight: 700; letter-spacing: 0.08em;
    padding: 0.55rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); user-select: all;
}
.pw-new-notes { margin: 0; padding-inline-start: 1.2rem; line-height: 2; font-size: 0.96rem; color: var(--muted); }
.row-actions .inline-form { margin: 0; display: inline-flex; }

/* ══ دور ۳۷ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   ۲۱ مهر ۱۴۰۵ — the owner's sixteen. */

/* ── the tickets' «اولویت ▾» and «وضعیت ▾»: «روی هر مورد هاور داشته باشه که هر جاش زده میشه قابلیت کلیک کردن رو
   داشته باشه» — the whole line is the link and lights up under the pointer ── */
.ticket-filter-row { display: flex; align-items: center; gap: 0.6rem 0.75rem; flex-wrap: wrap; }
.label-panel-list > a.filter-pick {
    margin-inline: -0.5rem; padding: 0.45rem 0.5rem; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; cursor: pointer; transition: background-color 0.12s ease;
}
.label-panel-list > a.filter-pick:hover, .label-panel-list > a.filter-pick:focus-visible { background: var(--bg); }
.label-panel-list > a.filter-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.label-panel-list > a.filter-pick.is-on { background: var(--accent-soft); }
.label-panel-list > a.filter-pick .status { font-size: 0.86rem; }
html[data-theme="dark"] .label-panel-list > a.filter-pick:hover { background: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .label-panel-list > a.filter-pick.is-on { background: rgba(124, 116, 255, 0.16); }

/* ── «تنظیمات اعلان‌ها»: one switch to a line, the whole line pressable ── */
.notif-settings-link { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 0.4rem; }
.notif-topics { display: flex; flex-direction: column; gap: var(--gap-list, 12px); margin-top: 0.4rem; }
.notif-topic {
    margin: 0; position: relative; display: flex; align-items: center; gap: 0.9rem; padding: 0.85rem 1rem; border: 1px solid var(--border-soft);
    border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color 0.12s ease, background-color 0.12s ease;
}
.notif-topic:hover { border-color: var(--border); background: var(--bg); }
.notif-topic-box { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.notif-topic-knob {
    flex: 0 0 auto; position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--border);
    transition: background-color 0.15s ease;
}
.notif-topic-knob::after {
    content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: inset-inline-start 0.15s ease;
}
.notif-topic-box:checked + .notif-topic-knob { background: var(--accent); }
.notif-topic-box:checked + .notif-topic-knob::after { inset-inline-start: 21px; }
.notif-topic-box:focus-visible + .notif-topic-knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.notif-topic-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.notif-topic-text b { font-size: 1rem; }
.notif-topic-text .muted { font-size: 0.9rem; line-height: 1.7; }
.notif-settings-foot { display: flex; align-items: center; gap: 0.75rem; padding: 0 1.25rem 1.25rem; }
html[data-theme="dark"] .notif-topic { background: transparent; }
html[data-theme="dark"] .notif-topic:hover { background: rgba(255, 255, 255, 0.04); }
@media (prefers-reduced-motion: reduce) { .notif-topic-knob, .notif-topic-knob::after { transition: none; } }

/* ── «ثبت گزارش» of a task, as the reference draws it ── */
.treports { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; background: var(--surface); }
.treports-title { margin: 0 0 0.7rem; font-size: 1.08rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; }
.treports-count { font-size: 0.8rem; font-weight: 700; min-width: 1.5rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bg); color: var(--muted); text-align: center; }
.treport-form.report-form { border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; }
.treport-form.report-form:focus-within { box-shadow: none; }
.treport-form .report-label { margin-bottom: 0.1rem; font-size: 0.84rem; }
.treport-line {
    display: flex; align-items: flex-end; gap: 0.5rem; border-bottom: 1px solid var(--border);
    transition: border-color 0.15s ease;
}
.treport-form:focus-within .treport-line { border-bottom-color: var(--accent); }
.treport-form .treport-line textarea {
    flex: 1 1 auto; min-width: 0; min-height: 0; height: 2.75rem; max-height: 220px; resize: none; overflow-y: hidden;
    border: 0 !important; border-radius: 0 !important; padding: 0.4rem 0 !important; line-height: 1.8;
}
.treport-form .treport-line textarea:focus { border: 0 !important; }
.treport-tools { display: inline-flex; align-items: center; gap: 0.15rem; flex: 0 0 auto; padding-bottom: 0.25rem; }
.treport-tool {
    all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 0.25rem; min-height: 2rem;
    padding: 0.2rem 0.45rem; border-radius: var(--radius-sm); color: #52525c; font-size: 0.88rem; cursor: pointer; white-space: nowrap;
}
.treport-tool:hover, .treport-tool[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.treport-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.treport-smileys {
    position: absolute; z-index: 21; inset-inline-end: 0; top: 4.4rem; width: 17rem; max-width: 100%;
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.15rem; padding: 0.5rem; background: var(--surface);
    border-radius: var(--radius); box-shadow: 0 2px 8px rgba(28, 25, 60, 0.08), 0 18px 44px rgba(28, 25, 60, 0.16);
}
.treport-smileys[hidden] { display: none; }
.treport-smiley { all: unset; display: grid; place-items: center; height: 2rem; border-radius: 8px; font-size: 1.15rem; cursor: pointer; }
.treport-smiley:hover, .treport-smiley:focus-visible { background: var(--bg); }
.treport-send { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.6rem; }
.treport-send .btn { margin-inline-start: auto; }
.treport-form.js-ready:not(.has-text) .treport-send { display: none; }
.treport-thread { margin-top: 1rem; padding: 0.2rem 1rem; border-radius: var(--radius); background: var(--bg); }
.treport { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.treport:last-child { border-bottom: 0; }
.treport-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.treport-face { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; }
.treport-face img { width: 100%; height: 100%; object-fit: cover; }
.treport-face .face { width: 30px; height: 30px; margin: 0; border: 0; font-size: 0.82rem; }
.treport-meta { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0.1rem 0.35rem; min-width: 0; font-size: 0.88rem; color: var(--muted); }
.treport-who { color: var(--text); font-weight: 700; font-size: 0.92rem; }
.treport-ago { color: #0f766e; font-weight: 600; }
.treport-called { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }
.treport-called-faces { display: inline-flex; align-items: center; }
.treport-called-faces .face { width: 24px; height: 24px; margin-inline-start: -6px; border: 2px solid var(--bg); font-size: 0.7rem; }
.treport-called-faces .face:first-child { margin-inline-start: 0; }
.treport-at { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); color: var(--muted); }
.treport-text { margin-top: 0.45rem; padding-inline-start: 2.4rem; font-size: 0.96rem; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.treport-none { margin: 0.4rem 0 0; }
.treports-page { margin-bottom: var(--gap-block, 20px); }
.treports-page .treports { box-shadow: var(--shadow); border-color: var(--border-soft); }
.peek-body .treports { margin-top: 0.25rem; }
html[data-theme="dark"] .treports { background: transparent; }
/* the dark theme draws every report box as a card of its own: this one is a line inside the card */
html[data-theme="dark"] .treport-form.report-form { border: 0; background: transparent; box-shadow: none; }
html[data-theme="dark"] .treport-form .treport-line { border-bottom-color: var(--border); }
html[data-theme="dark"] .treport-form:focus-within .treport-line { border-bottom-color: var(--accent); }
html[data-theme="dark"] .treport-form .treport-line textarea { border: 0 !important; background: transparent !important; }
html[data-theme="dark"] .treport-thread { background: rgba(255, 255, 255, 0.04); }
html[data-theme="dark"] .treport { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .treport-tool { color: #b9bbc6; }
html[data-theme="dark"] .treport-ago { color: #5fded7; }
html[data-theme="dark"] .treport-at { background: rgba(255, 255, 255, 0.08); color: #b9bbc6; }
html[data-theme="dark"] .treport-called-faces .face { border-color: #1b1b22; }
@media (max-width: 600px) {
    .treports { padding: 0.85rem 0.85rem 0.95rem; }
    .treport-tool .clip-text, .treport-tool.mention-open span { display: none; }
    .treport-thread { padding-inline: 0.75rem; }
    .treport-text { padding-inline-start: 0; }
}

/* ── «وضعیت مشاهده وظیفه»: the eye opens a card of who has seen the task ── */
.peek-views-wrap { position: relative; display: inline-flex; }
button.peek-views { all: unset; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.45rem; border-radius: var(--radius-sm); color: var(--muted); font-size: 0.89rem; cursor: pointer; }
button.peek-views:hover, button.peek-views[aria-expanded="true"] { background: var(--bg); color: var(--text); }
button.peek-views:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.peek-seen {
    position: absolute; z-index: 30; top: calc(100% + 8px); inset-inline-start: -4rem; width: min(400px, calc(100vw - 48px));
    display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem 1.2rem 1rem; background: var(--surface); color: var(--text);
    border-radius: var(--radius); box-shadow: 0 4px 12px rgba(28, 25, 60, 0.1), 0 24px 56px rgba(28, 25, 60, 0.22);
}
.peek-seen[hidden] { display: none; }
.peek-seen-title { font-size: 1.04rem; font-weight: 800; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border-soft); }
.peek-seen-line { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; }
.peek-seen-line .face { width: 24px; height: 24px; margin: 0; border: 0; font-size: 0.7rem; }
.peek-seen-cap { color: var(--muted); }
.peek-seen-stamp { color: #0f766e; font-weight: 600; }
.peek-seen-tabs { display: flex; border-bottom: 1px solid var(--border); margin-top: 0.2rem; }
.peek-seen-tabs button {
    all: unset; flex: 1 1 0; text-align: center; padding: 0.55rem 0.4rem; font-size: 0.9rem; color: var(--muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.peek-seen-tabs button.is-on { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.peek-seen-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.peek-seen-list { display: flex; flex-direction: column; gap: 0.15rem; max-height: 16rem; overflow-y: auto; }
.peek-seen-list[hidden] { display: none; }
.peek-seen-note { display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0 0.35rem; font-size: 0.86rem; color: var(--muted); }
.peek-seen-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.2rem; }
.peek-seen-row .face { width: 30px; height: 30px; margin: 0; border: 0; font-size: 0.82rem; }
.peek-seen-name { font-weight: 600; font-size: 0.94rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-seen-time { margin-inline-start: auto; font-size: 0.86rem; color: var(--muted); white-space: nowrap; }
.peek-seen-none { padding: 0.4rem 0; font-size: 0.9rem; }
html[data-theme="dark"] .peek-seen { background: #24242c; }
html[data-theme="dark"] .peek-seen-stamp { color: #5fded7; }
@media (max-width: 700px) { .peek-seen { position: fixed; top: 4.5rem; inset-inline: 16px; width: auto; } }

/* ── the month's cards: «ساعت وظیفه و پروژه دسته‌بندیش رو زیر وظیفه نمایش بده مثل اسکرین شات» ── */
.calendar-task-cat { display: flex; align-items: center; gap: 0.3rem; min-width: 0; font-size: 0.8rem; line-height: 1.5; opacity: 0.92; }
.calendar-task-cat bdi { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-task-cat .cat-dot { width: 7px; height: 7px; }
.calendar-task-foot { justify-content: space-between; }
.calendar-task-foot .faces { margin-inline-start: auto; }
.calendar-task-time { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em; }
.calendar-task:hover .calendar-task-cat .cat-dot { box-shadow: 0 0 0 1.5px #fff; }
.calendar-grid .calendar-task-desc { display: none; }
/* seven equal days whatever a card holds: a long category name is cut with «…», it does not widen its day */
.calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-grid > .calendar-cell { min-width: 0; }
.calendar-grid .calendar-task { min-width: 0; max-width: 100%; }
.cal-has-work, .cal-day { display: none; }

/* ── the month on a phone: «هر روزی که وظیفه‌ای در آن هست با یک نقطه مشخص بشه و با کلیک کردن روی اون روز وظایف رو در یک
   پنجره زیر تقویم نمایش بده» ── */
@media (max-width: 700px) {
    .calendar-grid .calendar-task { display: none; }
    .calendar-cell { min-height: 64px; cursor: pointer; display: flex; flex-direction: column; }
    .calendar-weekday { font-size: 0.7rem; letter-spacing: -0.01em; }
    .calendar-weekday::after { content: none; }
    .cal-m { display: inline; font-size: 0.68rem; }
    /* «امروز: ۲۰ مهر» and «۲۸ شهریور» are wider than a seventh of a phone: the month goes under the day */
    .calendar-cell-head { align-items: flex-start; }
    .calendar-daynum { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.2rem; white-space: normal; overflow: visible; font-size: 0.78rem; line-height: 1.35; }
    .calendar-cell-today .cal-today-word { display: inline; font-size: 0.68rem; }
    .calendar-cell .calendar-add { display: none; }
    .cal-has-work { display: block; width: 8px; height: 8px; border-radius: 50%; background: #12857f; margin-top: auto; margin-inline-start: 2px; }
    .calendar-cell.is-chosen { box-shadow: inset 0 0 0 2px var(--accent-ink); background: var(--accent-soft); }
    .cal-day {
        display: block; position: relative; margin-top: var(--gap-block, 20px); padding: 0.9rem 0.85rem 4.2rem;
        border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface);
    }
    .cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
    .cal-day-name { font-size: 1.04rem; }
    .cal-day-count { padding: 0.2rem 0.75rem; border-radius: 999px; background: var(--bg); font-size: 0.88rem; font-weight: 600; color: #52525c; }
    .cal-day-list { display: flex; flex-direction: column; gap: 0.6rem; }
    .cal-day-list .calendar-task {
        display: flex; flex-direction: column; align-items: stretch; gap: 0.35rem; padding: 0.7rem 0.85rem; white-space: normal;
        font-size: 0.96rem; line-height: 1.7; border: 1px solid var(--border); border-inline-start-width: 4px;
        border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
    }
    .cal-day-list .calendar-task:hover { background: var(--surface); color: var(--text); border-color: var(--cal-edge, var(--border)); }
    .cal-day-list .calendar-task-line { white-space: normal; font-weight: 700; }
    .cal-day-list .calendar-task-title { white-space: normal; }
    .cal-day-list .calendar-task-desc {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        font-size: 0.88rem; line-height: 1.75; color: #52525c;
    }
    .cal-day-list .calendar-task-cat {
        align-self: flex-start; max-width: 100%; padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px;
        font-size: 0.82rem; background: var(--bg);
    }
    .cal-day-list .calendar-task-time { font-size: 0.86rem; color: #52525c; }
    .cal-day-none { margin: 0.25rem 0 0; }
    .cal-day-add {
        position: absolute; inset-inline-end: 1rem; bottom: 0.9rem; width: 48px; height: 48px; border-radius: 50%;
        display: grid; place-items: center; background: var(--orange, #e8721c); color: #fff; text-decoration: none;
        box-shadow: 0 6px 18px rgba(232, 114, 28, 0.38);
    }
    .cal-day-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
    html[data-theme="dark"] .cal-day { background: transparent; }
    html[data-theme="dark"] .cal-day-list .calendar-task { background: #22222a; }
    html[data-theme="dark"] .cal-day-list .calendar-task-desc, html[data-theme="dark"] .cal-day-list .calendar-task-time { color: #b9bbc6; }
    html[data-theme="dark"] .cal-day-count { background: rgba(255, 255, 255, 0.06); color: #b9bbc6; }
}

/* ── «در گزارش روزانه مدیر آتلیه فیلد گزارش به همتراز باقی فیلدها بشه»: a value the form states sits exactly where a
   field it asks for sits — its caption with a label's own space under it, its box an input's height, corners and type.
   Measured beside «تاریخ» and «نام مدیر آتلیه»: the caption was 5.6px higher and the box 2px shorter. ── */
.field-static > .field-label { display: block; margin-bottom: 0.35rem; }
.field-static .field-fixed {
    box-sizing: border-box; min-height: 2.6rem; display: flex; align-items: center;
    padding: 0.4rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.94rem; line-height: 1.5;
}

/* ── the assistant's box on a phone: «بخش نوشتن … نوشته نمونه که مثال زده درست نمایش داده بشه» — the send button is
   its arrow alone and the box grows to its whole example (assistant.js measures it) ── */
@media (max-width: 560px) {
    .asst-send { width: 48px; min-width: 48px; padding: 0; justify-content: center; }
    .asst-send-word { display: none; }
}

/* ── «برای دیدن گزارشات روزانه پرسنل که به صورت صفحه پاپ آپ باز میشه، امکان اسکرول کردن وجود نداره»: the report in the
   window is a .panel, which clips (overflow: hidden) — as a flex child of the window's body it shrank to the window's
   height and cut itself off, so the body had nothing to scroll. Nothing in a window's body shrinks: the body scrolls.
   The same held for a long request over «درخواست‌ها». ── */
.peek-body > * { flex-shrink: 0; }

/* ══ دور ۳۸ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   ۲۱ مهر ۱۴۰۵ — the owner's twenty-two. */

/* ── «طبق اسکرین شات فیلد جست و جو فرمش بهم ریخته»: the people search box drew a second box inside its own — the form-
   wide input rule (form input:not(…):not(…), 0-2-2) outranked the box's own (0-2-1). Said again, stronger. ── */
.qt-find-wrap input.qt-find[type="search"],
.qt-find-wrap input.qt-find[type="search"]:focus {
    min-height: 0; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; outline: none;
}

/* ── «فیلد دسته‌بندی پروژه با پنجره کلی فاصله داشته باشه، بخش زیرینش مخفی شده»: the edit window's foot sticks 1.35rem
   past the scroll edge, so it rose over the last field by as much; the field keeps that much room under it ── */
.qt-editing label.qt-project { margin-bottom: 1.6rem; }

/* ── «تیترهای تیکت پشتیبانی شامل موضوع و متن، ثبت‌کننده و غیره سایزشون بزرگتر و مشکی بشه» ── */
.ticket-table thead th { font-size: 0.98rem; font-weight: 700; color: var(--text); }
html[data-theme="dark"] .ticket-table thead th { color: #ececf2; }

/* ── «سابقه تغییرات وظیفه»: its own window over the task, as the reference draws it ── */
.thist { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(22, 20, 40, 0.45); }
.thist[hidden] { display: none; }
.thist-box {
    width: min(720px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
    background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 28px 70px rgba(20, 18, 50, 0.35);
}
.thist-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.95rem 1.2rem; background: #46658f; color: #fff; }
.thist-title { margin: 0; font-size: 1.12rem; font-weight: 800; color: #fff; }
.thist-order, .thist-x {
    all: unset; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    color: #fff; cursor: pointer; font-size: 1.05rem;
}
.thist-order { margin-inline-end: auto; }
.thist-x .icn { transform: rotate(45deg); }
.thist-order:hover, .thist-x:hover, .thist-order.is-on { background: rgba(255, 255, 255, 0.16); }
.thist-order:focus-visible, .thist-x:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.thist-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: var(--gap-list, 12px); }
.thist-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 0.95rem; background: var(--surface); }
.thist-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap;
              padding-bottom: 0.55rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border-soft); font-size: 0.9rem; }
.thist-who { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--text); }
.thist-who > .icn, .thist-when > .icn { color: #2f6fd0; }
.thist-who .face, .thist-faces .face { width: 24px; height: 24px; margin: 0; border: 0; font-size: 0.7rem; }
.thist-when { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.88rem; }
.thist-ago { color: var(--muted); }
.thist-lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.thist-lines li { position: relative; padding-inline-start: 0.9rem; font-size: 0.93rem; line-height: 1.9; }
.thist-lines li::before { content: ""; position: absolute; inset-inline-start: 0; top: 0.8em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.thist-label, .thist-to { color: #2f6fd0; font-weight: 700; }
.thist-faces { display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: middle; }
.thist-chip { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 6px; background: #12857f; color: #fff; font-weight: 700; font-size: 0.86rem; }
.thist-foot { padding: 0.75rem 1.2rem; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-start; }
.thist-none { margin: 0.5rem 0; }
.task-page-history { margin: var(--gap-block, 20px) 0; }
html[data-theme="dark"] .thist-box { background: #24242c; }
html[data-theme="dark"] .thist-item { background: transparent; border-color: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .thist-label, html[data-theme="dark"] .thist-to,
html[data-theme="dark"] .thist-who > .icn, html[data-theme="dark"] .thist-when > .icn { color: #7fb0f5; }
@media (max-width: 600px) { .thist { padding: 0; place-items: end stretch; } .thist-box { max-height: 92dvh; border-radius: 16px 16px 0 0; } }

/* ── the plan: a line a seat changed at its turn is marked at its edge; «نوشته‌های تغییر یافته هم رنگش آبی بشه» (round
   43): the writing that changed is blue, the rest of the line as it was ── */
.plan-table tr.row-changed > td:first-child { box-shadow: inset -3px 0 0 #1c5fb4; }
.plan-table textarea.is-changed, .plan-table .plan-cell-text.is-changed,
.plan-table td.plan-date.is-changed, .plan-table td.plan-date.is-changed .jp-display { color: #1c5fb4; font-weight: 600; }
.plan-changed { white-space: nowrap; }
.plan-table td.plan-who select { width: 100%; min-width: 9rem; font-size: 0.9rem; }
.plan-turn-edit { margin: 0.25rem 0 0.75rem; }
html[data-theme="dark"] .plan-table tr.row-changed > td:first-child { box-shadow: inset -3px 0 0 #7fb0f5; }
html[data-theme="dark"] .plan-table textarea.is-changed, html[data-theme="dark"] .plan-table .plan-cell-text.is-changed,
html[data-theme="dark"] .plan-table td.plan-date.is-changed, html[data-theme="dark"] .plan-table td.plan-date.is-changed .jp-display { color: #7fb0f5; }

/* ── «پاسخ به نامه» ── */
.reply-box { margin: 0.75rem 0 var(--gap-block, 20px); }
.reply-box > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.reply-box > summary::-webkit-details-marker { display: none; }
.reply-form { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.reply-to { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.reply-form > .btn { align-self: flex-start; }

/* ── CRM: «ایجاد گزارش» and «بایگانی» ── */
.crm-build { margin-bottom: var(--gap-block, 20px); }
.crm-build > summary { cursor: pointer; list-style: none; }
.crm-build > summary::-webkit-details-marker { display: none; }
.crm-build-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem 1rem; align-items: end; }
.crm-build-form > label { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; font-size: 0.9rem; }
.crm-build-acts { display: flex; align-items: center; gap: 0.6rem; }
.crm-build-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0 0.75rem; }
.crm-build-csv { margin-inline-start: auto; }
.crm-archive-tabs { margin-bottom: 0.75rem; }
.crm-archive-search { margin-bottom: var(--gap-list, 12px); }
.crm-archive-title { display: block; font-size: 0.86rem; }
.crm-type-hint { display: block; margin-top: 0.3rem; font-size: 0.84rem; font-weight: 400; }

/* ── a daily report kept on this device until it is sent ── */
.draft-note { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
              margin: 0 0 var(--gap-block, 20px); padding: 0.75rem 1rem; border-radius: var(--radius-sm);
              background: var(--accent-soft); color: var(--accent-ink); font-size: 0.94rem; }
html[data-theme="dark"] .draft-note { background: rgba(124, 116, 255, 0.16); color: #c9c5ff; }

/* ── reports: a picked day of the week ── */
.rw-day.is-picked { border-color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-ink); }
.rw-picked { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 var(--gap-list, 12px); font-weight: 700; }

/* ── a project's month ── */
.project-calendar-head { display: flex; align-items: center; gap: 0.8rem; }
.project-calendar-add { margin-inline-start: auto; }

/* the plan's eight columns: the day and its date at their own width (a date cut to «۱۸ م…» was the new column taking
   its share), «مسئول اجرا» enough for a name, the text columns the rest */
.plan-table col.plan-day-col { width: 5.2rem; }
.plan-table col.plan-date-col { width: 13.6rem; }
.plan-table col.plan-act-col { width: 8rem; }
/* the sheet's width on a screen wide enough for a table; on a phone it is cards, as wide as the phone */
@media (min-width: 701px) { .plan-table { min-width: 940px; } }
.reply-to .pick-chip { margin: 0; }

/* ══ دور ۳۹ و ۴۰ ═════════════════════════════════════════════════════════════════════════════════════════════════
   The paraf's note is a box of several lines across the page, its button (and «آرشیو کردن») under it. On a phone the
   letter's three acts (paraf, answer, refer) stand one under another at one width. */
.letter-actions .paraf-form { flex: 1 1 100%; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.paraf-form textarea[name="note"] { width: 100%; min-height: 2.9rem; margin: 0; box-sizing: border-box; }
.paraf-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
@media (max-width: 560px) {
    .letter-actions { flex-direction: column; align-items: stretch; gap: 12px; }
    .paraf-form-foot { flex-direction: column; align-items: stretch; }
    .letter-actions .btn, .letter-actions .act-btn,
    .reply-box > summary.btn, .refer-box > summary.btn, .refer-box > button.refer-open.btn { width: 100%; justify-content: center; box-sizing: border-box; }
}

/* ══ دور ۴۰ — برنامه زمان‌بندی ═══════════════════════════════════════════════════════════════════════════════════
   «جلوش یک علامت + نمایش داده بشه»: beside what is written in «کارهای اجرایی» and «خرید / توضیحات», a small round +
   that opens the task window. The box keeps the cell's width; the + sits at its end, at the top. */
.plan-cell { display: flex; align-items: flex-start; gap: 8px; width: 100%; box-sizing: border-box; }
.plan-cell > .dictate-wrap, .plan-cell > .plan-cell-text { flex: 1 1 auto; min-width: 0; }
.plan-cell-text { white-space: pre-line; overflow-wrap: anywhere; }
.plan-plus {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; margin-top: 4px; padding: 0; box-sizing: border-box;
    border-radius: 50%; border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.plan-plus:hover, .plan-plus:focus-visible { background: var(--accent); color: #fff; outline: none; }
/* an empty box keeps the +'s place, so every box of a column has one width */
.plan-plus.is-empty { visibility: hidden; pointer-events: none; }
.plan-plus svg.icn { width: 16px; height: 16px; }
@media print { .plan-plus { display: none !important; } }

/* ══ دور ۴۱ — مانیتورینگ ════════════════════════════════════════════════════════════════════════════════════════
   «وقتی ساید بار منو بسته میشه کلیدهای مانیتورینگ … هم عرض کارت پروژه‌ها بشن حالت ریسپانسیو رو داشته باشن»: the five
   section buttons fill the row as the cards under them do — auto-fit, not auto-fill, so a wider page (the menu folded)
   stretches them instead of leaving empty places; five even columns on a wide screen, two on a phone. */
.mon-sections { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (min-width: 1000px) { .mon-sections { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 700px) { .mon-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* «کارت بیشترین تاخیر هاور داشته باشه و بشه هر جاش کلیک کرد» */
.mon-card-link { cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s; }
.mon-card-link:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(79, 70, 229, 0.14); transform: translateY(-2px); }
.mon-card-link:hover .panel-head { color: var(--accent-ink, var(--accent)); }
/* «اسکرول به طرفین قسمت بالا … هدر پروژه‌ها، هدر چسبان باشه» */
.mon-top-scroll { overflow-x: auto; overflow-y: hidden; height: 14px; margin: 0 0 6px; }
.mon-top-scroll > div { height: 1px; }
@media (min-width: 701px) {
    .mon-projects-wrap { max-height: calc(100vh - 230px); overflow: auto; }
    .mon-projects-table thead th {
        position: sticky; top: 0; z-index: 3; background: var(--surface);
        box-shadow: inset 0 -1px 0 var(--border-soft);
    }
}
@media (max-width: 700px) { .mon-top-scroll { display: none; } }
.overdue-head { margin: 0 0 12px; }

/* ══ دور ۴۱ — تقویم ═════════════════════════════════════════════════════════════════════════════════════════════
   «وقتی در هر وظیفه واحد یا پروژه‌ای انتخاب شده جهت مشخص بودنش در یک هاور قرار بگیره یا رنگ نوشته‌اش فرق بکنه»: the
   project or unit of a card is a small white label with an edge and words in its own colour — it stands out on a card
   whatever the card's own tint, and on its hover. */
.calendar-task-cat {
    align-self: flex-start; width: fit-content; max-width: 100%; box-sizing: border-box;
    padding: 0 0.45rem; border-radius: 6px; font-weight: 700; opacity: 1;
    background: #fff; color: #43474e; border: 1px solid #c9ccd2;
}
.calendar-task-cat.cat-red { color: #a32b1c; border-color: #efb3aa; }
.calendar-task-cat.cat-orange { color: #8a4a06; border-color: #f0c79a; }
.calendar-task-cat.cat-green { color: #14603b; border-color: #9fd3b4; }
.calendar-task-cat.cat-blue { color: #1c4e8f; border-color: #a9c4ef; }
.calendar-task-cat.cat-purple { color: #57309b; border-color: #c8b4ef; }
.calendar-task-cat.cat-teal { color: #14605c; border-color: #98d0cc; }
.calendar-task-cat.cat-grey { color: #43474e; border-color: #c9ccd2; }
html[data-theme="dark"] .calendar-task-cat { background: #1c1c22; color: #b4b8c0; border-color: #3a3a44; }
html[data-theme="dark"] .calendar-task-cat.cat-red { color: #e6796b; border-color: #6b2c24; }
html[data-theme="dark"] .calendar-task-cat.cat-orange { color: #e7a055; border-color: #6b4524; }
html[data-theme="dark"] .calendar-task-cat.cat-green { color: #5fdea0; border-color: #24603d; }
html[data-theme="dark"] .calendar-task-cat.cat-blue { color: #659be1; border-color: #26416b; }
html[data-theme="dark"] .calendar-task-cat.cat-purple { color: #a88adb; border-color: #42286b; }
html[data-theme="dark"] .calendar-task-cat.cat-teal { color: #5fded7; border-color: #22605b; }
@media (max-width: 700px) {
    .cal-day-list .calendar-task-cat { padding: 0.15rem 0.6rem; background: #fff; }
    html[data-theme="dark"] .cal-day-list .calendar-task-cat { background: #1c1c22; }
}

/* ══ دور ۴۱ — مناسبت‌ها و زادروز در داشبورد ═════════════════════════════════════════════════════════════════════
   A white card for the day — its colour is in the emoji, which moves (a little, and not at all for whoever asked their
   device for less motion). */
.desk-celebrate { display: grid; gap: 12px; margin: 0 0 var(--gap-block, 20px); }
.celebrate-card {
    display: flex; align-items: center; gap: 16px; padding: 14px 18px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.celebrate-card.is-birthday { border-color: #f3c6d8; background: linear-gradient(90deg, #fff7fb, var(--surface) 60%); }
.celebrate-text { min-width: 0; }
.celebrate-text b { display: block; font-size: 1.02rem; }
.celebrate-text p { margin: 4px 0 0; line-height: 1.9; color: var(--text); }
.celebrate-emoji { display: inline-flex; gap: 2px; font-size: 1.9rem; line-height: 1; flex-shrink: 0; }
.celebrate-emoji > span { display: inline-block; animation: celebrate-sway 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.celebrate-card.is-birthday .celebrate-emoji > span { animation: celebrate-hop 1.4s ease-in-out infinite; }
.celebrate-card.is-birthday .celebrate-emoji > span:nth-child(2) { animation-delay: 0.2s; }
.celebrate-card.is-birthday .celebrate-emoji > span:nth-child(3) { animation-delay: 0.4s; }
@keyframes celebrate-hop { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-7px) rotate(-8deg); } 60% { transform: translateY(-3px) rotate(6deg); } }
@keyframes celebrate-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .celebrate-emoji > span { animation: none !important; } }
html[data-theme="dark"] .celebrate-card.is-birthday { border-color: #5a2a40; background: linear-gradient(90deg, #2c1a24, var(--surface) 60%); }
@media (max-width: 560px) {
    .celebrate-card { align-items: flex-start; padding: 12px 14px; gap: 12px; }
    .celebrate-emoji { font-size: 1.6rem; }
}

/* ══ دور ۴۱ — زادروز در پروفایل ═════════════════════════════════════════════════════════════════════════════════ */
.birthday-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.birthday-row label { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.birthday-row select { width: 100%; }
@media (max-width: 560px) { .birthday-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ══ دور ۴۱ — مالی: کارت پروژه، بایگانی، هزینه‌ها ═══════════════════════════════════════════════════════════════
   «دکمه‌های ویرایش و حذف بالای کارت هر پروژه قرار بگیره و زیبایی و خوانایی بهتری داشته باشه»: the card's head is its
   name with the two buttons beside it; each figure is a line of its own — what it is on one side, the number, large and
   in the house face, on the other — with a hairline between. The whole card opens the project. */
.fin-shelf-tabs { margin-bottom: var(--gap-block, 20px); }
.fin-project-card { cursor: pointer; padding: 16px 18px; gap: 12px; transition: box-shadow 0.15s, border-color 0.15s; }
.fin-project-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12); }
.fin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.fin-card-head h3 { margin: 0; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-card-actions { display: inline-flex; gap: 8px; flex-shrink: 0; }
.fin-card-actions .inline-form { margin: 0; display: inline-flex; }
.fin-card-actions .act-btn { height: 2rem; padding: 0 0.7rem; }
.fin-card-figures { margin: 0; display: flex; flex-direction: column; }
.fin-card-figures > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border-soft); }
.fin-card-figures > div:last-child { border-bottom: 0; }
.fin-card-figures dt { color: var(--muted); font-size: 0.9rem; }
.fin-card-figures dd { margin: 0; font-weight: 700; font-size: 1.08rem; white-space: nowrap; }
.fin-card-figures dd small { font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.fin-project-card .fin-project-open { align-self: flex-start; text-decoration: none; }

/* «بخش هزینه‌ها … درگ و دراپ با پیش‌نمایش و قابلیت حذف کردن» */
.fin-costs-total { margin-inline-start: auto; font-size: 0.9rem; font-weight: 600; }
#costs .panel-head { display: flex; align-items: center; gap: 12px; }
.fin-cost-form { margin-bottom: var(--gap-block, 20px); }
.file-drop { margin: 12px 0 0; }
.file-drop-zone {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
    min-height: 92px; padding: 16px; box-sizing: border-box; text-align: center; cursor: pointer;
    border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg); color: var(--muted);
    transition: border-color 0.15s, background 0.15s;
}
.file-drop-zone:hover, .file-drop-zone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.file-drop-zone > * { pointer-events: none; }
.file-drop-zone .file-drop-pick { pointer-events: auto; }
.file-drop-list, .fin-cost-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file-drop.has-files .file-drop-list { margin-top: 12px; }
.file-drop-card {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; box-sizing: border-box;
    border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface); min-width: 0;
}
.file-drop-thumb { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.file-drop-mark {
    display: grid; place-items: center; height: 96px; border-radius: 6px; background: var(--accent-soft);
    color: var(--accent-ink); font-weight: 700; letter-spacing: 0.04em; text-decoration: none;
}
.file-drop-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.file-drop-size { font-size: 0.75rem; color: var(--muted); }
.file-drop-card form { margin: 0; }
.file-drop-remove {
    position: absolute; top: 4px; inset-inline-start: 4px; width: 26px; height: 26px; padding: 0; border-radius: 50%;
    border: 0; background: rgba(20, 20, 30, 0.72); color: #fff; font-size: 1rem; line-height: 26px; cursor: pointer;
}
.file-drop-remove:hover { background: var(--red-deep, #b42318); }
.fin-cost { padding: 12px 0; border-top: 1px solid var(--border-soft); }
.fin-cost:first-of-type { border-top: 0; }
.fin-cost-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fin-cost-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 200px; }
.fin-cost-amount { font-weight: 700; white-space: nowrap; }
.fin-cost-amount small { font-weight: 500; color: var(--muted); }
.fin-cost-note { margin: 6px 0 0; }
.fin-cost-files { margin-top: 10px; }
html[data-theme="dark"] .file-drop-remove { background: rgba(0, 0, 0, 0.7); }
@media (max-width: 560px) {
    .fin-card-head { flex-wrap: wrap; }
    .file-drop-list, .fin-cost-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ===== round 42: «ویرایش» beside «حذف» on a cost — its form opens inside the cost's own card ===== */
.fin-cost-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fin-cost-actions .inline-form { margin: 0; display: inline-flex; }
.fin-cost-actions .act-btn { height: 2rem; padding: 0 0.7rem; }
.fin-cost-actions .act-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.fin-cost-edit {
    margin-top: 12px; padding: 16px; border: 1px solid var(--border-soft); border-radius: var(--radius);
    background: var(--bg);
}
.fin-cost-edit .form-actions { margin-bottom: 0; }
@media (max-width: 560px) {
    .fin-cost-actions { width: 100%; justify-content: flex-end; }
}

/* ===== round 43: the plan's cells as lists of fields — each its own box with its +, «افزودن فیلد» under them ===== */
.plan-fields { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.plan-fields .plan-field textarea { min-height: 2.5rem; resize: none; }
.plan-field-add {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; height: 1.9rem; padding: 0 0.6rem;
    border: 1px dashed var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--accent-ink);
    font: inherit; font-size: 0.84rem; cursor: pointer;
}
.plan-field-add:hover, .plan-field-add:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.plan-field-add svg.icn { width: 13px; height: 13px; }
/* read: each field a line of its own, its + at its end; the cell's own line breaks play no part */
.plan-fields-read { white-space: normal; gap: 6px; }
.plan-fields-read .plan-cell-text { padding-top: 4px; }
@media print { .plan-field-add { display: none !important; } }

/* ══ دور ۴۴ ════════════════════════════════════════════════════════════════════════════════════════════════════════
   CRM: «نوع مشتری» — a tab with its own menu before the pipeline (the strip lets the menu out, as the task tabs do);
   the new-lead row of three. */
.tabs.crm-tabs { overflow: visible; align-items: stretch; }
.crm-tabs .tab-menu-list { min-width: 200px; }
@media (min-width: 900px) { .crm-two.crm-three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* «حذف وظیفه» in the ⋯ of the task's window and of the window it is edited in */
.qt-menu .qt-delete, .peek-menu .peek-delete {
    display: flex; align-items: center; gap: 0.45rem; width: 100%; padding: 0.6rem 0.75rem; border: 0;
    border-radius: var(--radius-sm); background: none; color: var(--red-deep, #b42318); font: inherit; font-size: 0.92rem;
    text-align: start; cursor: pointer;
}
.qt-menu .qt-delete:hover, .peek-menu .peek-delete:hover { background: #fdf1ef; color: var(--red-deep, #b42318); }
.qt-menu .qt-delete svg.icn, .peek-menu .peek-delete svg.icn { width: 15px; height: 15px; }
html[data-theme="dark"] .qt-menu .qt-delete, html[data-theme="dark"] .peek-menu .peek-delete { color: #f0958a; }
html[data-theme="dark"] .qt-menu .qt-delete:hover, html[data-theme="dark"] .peek-menu .peek-delete:hover { background: rgba(192, 57, 43, 0.18); }

/* a report's initials, under the report */
.sub-parafs .panel-body { display: flex; flex-direction: column; gap: 12px; }
.sub-paraf { padding: 0.6rem 0.8rem; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--bg); }
.sub-paraf-who { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sub-paraf-note { margin: 0.4rem 0 0; white-space: pre-line; }
.sub-paraf-form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 0; }
.sub-paraf-form textarea { width: 100%; box-sizing: border-box; }
.report-paraf-chip { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the plan's notices on its project list */
.plan-news { margin-inline-start: 0.4rem; white-space: nowrap; }

/* «@» in a letter: the picker opens under the box it writes into */
.mention-zone { position: relative; }
.mention-zone .mention-panel { inset-inline-start: 0; }   /* the script sets its top: under the box */
.mention-zone .mention-find {
    margin: 0.75rem 0.75rem 0.4rem; width: auto !important; min-height: 2.5rem; padding: 0.5rem 0.9rem !important;
    border: 1px solid var(--border) !important; border-radius: var(--radius) !important; background: var(--surface) !important;
    font-size: 0.94rem;
}
.mention-zone .mention-find:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; outline: none; }
.mention-zone .mention-open { display: inline-flex; align-items: center; gap: 0.35rem; }
.reply-tools, .compose-mention { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.compose-mention { margin-top: 0.6rem; }
html[data-theme="dark"] .mention-zone .mention-find { background: #1b1b24 !important; border-color: #33333f !important; }
/* the picker's initials stay white on their own colour (the «منشن‌ها» page's cards gave every .mention-face the accent
   ink, which on those six grounds was unreadable — in a task's report as much as in a letter) */
.mention-menu .mention-face { color: #fff; }

/* ══ دور ۴۵ ════════════════════════════════════════════════════════════════════════════════════════════════════════
   «گفت‌وگو»: a box of several lines; one tick sent, two seen; a message's «⋯» (copy, pass on, correct, take back); the
   window that passes a message on. */
.chat-compose { align-items: flex-end; }
.chat-compose textarea { min-height: 2.4rem; max-height: 9rem; overflow-y: auto; }
.bubble { position: relative; }
.ticks { display: inline-block; font-size: 0.8rem; letter-spacing: -0.28em; padding-inline-end: 0.28em; line-height: 1;
         font-weight: 700; color: var(--muted); }
.ticks.is-seen { color: #1d7a4c; }
.bubble-row.mine .ticks { color: rgba(255, 255, 255, 0.85); }
.bubble-row.mine .ticks.is-seen { color: #a7f3d0; }
.bubble-edited, .treport-edited { font-size: 0.75rem; opacity: 0.8; }
/* the «⋯» stands just outside the bubble's outer edge, so it never covers a word of a full line */
.bubble-menu { position: absolute; top: 2px; inset-inline-end: -32px; }
.bubble-menu > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s;
    color: var(--muted); }
.bubble-menu > summary::-webkit-details-marker { display: none; }
.bubble-row:hover .bubble-menu > summary, .bubble-menu[open] > summary, .bubble-menu > summary:focus-visible { opacity: 1; }
.bubble-menu > summary:hover, .bubble-menu[open] > summary { background: var(--accent-soft); color: var(--accent-ink); }
@media (hover: none) { .bubble-menu > summary { opacity: 0.6; } }
.bubble-menu-list {
    position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 20; min-width: 170px; padding: 0.35rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border-soft); border-radius: var(--radius);
    box-shadow: var(--shadow-lift); display: flex; flex-direction: column;
}
.bubble-menu-list button, .bubble-menu-list .bubble-delete button {
    display: flex; align-items: center; gap: 0.45rem; width: 100%; padding: 0.5rem 0.65rem; border: 0; opacity: 1;
    border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-size: 0.9rem;
    text-align: start; cursor: pointer; text-decoration: none;
}
.bubble-menu-list button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.bubble-menu-list .bubble-delete { margin: 0; display: block; }
.bubble-menu-list .is-danger, .bubble-menu-list .is-danger:hover { color: var(--red-deep, #b42318); }
.bubble-menu-list .is-danger:hover { background: #fdf1ef; }
.bubble-menu-list svg.icn { width: 14px; height: 14px; }
.bubble.is-editing .bubble-body { display: none; }
.bubble-edit { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.2rem 0; min-width: min(22rem, 70vw); }
.bubble-edit textarea { width: 100%; box-sizing: border-box; background: var(--surface); color: var(--text); }
.bubble-edit-acts { display: flex; gap: 0.5rem; }
.bubble-row.mine .bubble-edit .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.chat-said {
    position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%) translateY(12px); z-index: 60;
    padding: 0.55rem 1rem; border-radius: 999px; background: #1f1f2e; color: #fff; font-size: 0.9rem;
    opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.chat-said.is-on { opacity: 1; transform: translateX(50%) translateY(0); }
.forward-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius-lg);
                  box-shadow: 0 24px 60px rgba(20, 18, 50, 0.28); background: var(--surface); color: var(--text); }
.forward-dialog::backdrop { background: rgba(20, 18, 40, 0.42); }
.forward-form { display: flex; flex-direction: column; gap: 12px; padding: 1rem 1.1rem; margin: 0; }
.forward-head { display: flex; align-items: center; justify-content: space-between; }
.forward-head h2 { margin: 0; font-size: 1.05rem; }
.forward-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.forward-group-title { font-size: 0.82rem; color: var(--muted); margin: 0.5rem 0 0.2rem; }
.forward-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.5rem; border-radius: var(--radius-sm);
                cursor: pointer; margin: 0; }
.forward-item:hover { background: var(--accent-soft); }
.forward-item[hidden] { display: none; }
.forward-foot { display: flex; gap: 12px; }

/* a task's report: its ticks, «ویرایش» under it and the box it opens */
.treport-meta .ticks { margin-inline-start: 0.35rem; }
.treport-edit-open { margin-top: 0.5rem; }
.treport-edit { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.treport-edit textarea { width: 100%; box-sizing: border-box; }
.treport-edit-acts { display: flex; gap: 0.5rem; }

/* «امکان حذف کردن فایل قبل از ارسال»: what was picked, each with its «×» */
.picked-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0.5rem 0; }
.picked-files[hidden] { display: none; }
.picked-file { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%; padding: 0.3rem 0.35rem 0.3rem 0.6rem;
               border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg); font-size: 0.85rem; }
.picked-file-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-file-size { color: var(--muted); font-size: 0.78rem; }
.picked-file-remove { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
                      border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.08); color: var(--text); cursor: pointer;
                      font-size: 1rem; line-height: 1; padding: 0; }
.picked-file-remove:hover { background: var(--red-deep, #b42318); color: #fff; }
.qt-pick { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
html[data-theme="dark"] .bubble-menu-list .is-danger:hover { background: rgba(192, 57, 43, 0.18); }
html[data-theme="dark"] .picked-file-remove { background: rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .ticks.is-seen { color: #7ee2a8; }
html[data-theme="dark"] .bubble-menu-list .is-danger { color: #f0958a; }
/* one's own bubbles stand at the far side: their «⋯» and its list face the middle of the conversation instead */
.bubble-row.mine .bubble-menu { inset-inline-end: auto; inset-inline-start: -32px; }
.bubble-row.mine .bubble-menu-list { inset-inline-end: auto; inset-inline-start: 0; }

/* ══ round 46 ══════════════════════════════════════════════════════════════════════════════════════════════
   «سند جامع»: «DATE / TIME» under every milestone — the day and, beside it, its hour */
/* the day and its hour under the line's name, a row of their own: beside it they left the name a word to a line */
.master-line:has(.master-when) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.master-when { display: flex; align-items: center; gap: 8px; width: 100%; }
.master-when .jalali-picker { flex: 1 1 auto; min-width: 0; }
.master-when .master-time { width: 6.5rem; flex: 0 0 6.5rem; margin: 0; text-align: center; font-variant-numeric: tabular-nums; }

/* «وقتی پاپ آپی باز هست صفحه زیرش اسکرول نشه»: while a window is open — a task's card, a request, the quick task,
   «ارسال به…», a file's preview, a task's history, the phone's menu — the page under it stands still; a page that had
   a scroll bar keeps the bar's place, so nothing under the window jumps sideways. The window's own body scrolls, and
   its end does not hand the scroll on to the page. */
html:has(dialog[open]),
html:has(.thist:not([hidden])) { overflow: hidden; }
html.page-scrolls:has(dialog[open]),
html.page-scrolls:has(.thist:not([hidden])) { scrollbar-gutter: stable; }
/* the menu and the assistant's list of conversations slide over the page only on a phone */
@media (max-width: 900px) { html:has(body.sidebar-open) { overflow: hidden; } }
@media (max-width: 760px) { html:has(.asst-app.side-open) { overflow: hidden; } }
dialog, dialog .peek-slot, .thist-box, .thist-body, .sidebar, .attachment-preview-body { overscroll-behavior: contain; }

/* «تمام وظیفه ها دارای ستاره تو خالی باشن»: the star the reader may press — hollow, in the text's own grey; filled
   gold once pressed. On a card that turns its colour under the cursor the hollow one turns white with the words. */
.task-star.is-toggle { cursor: pointer; border-radius: 4px; }
.task-star.is-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-star.is-off { color: var(--muted); }
.task-star.is-off > svg.icn { fill: none; stroke: currentColor; stroke-width: 1.6; }
.task-star.is-off:hover { color: #d18e00; }
.task-star.is-off:hover > svg.icn { fill: rgba(245, 180, 0, 0.25); }
.calendar-task:hover .task-star.is-off { color: inherit; }
.task-star.is-busy { opacity: 0.6; pointer-events: none; }
html[data-theme="dark"] .task-star.is-off { color: var(--muted); }
html[data-theme="dark"] .task-star.is-off > svg.icn { fill: none; stroke: currentColor; }
html[data-theme="dark"] .task-star.is-off:hover { color: #e7b855; }

/* «در تقویم وظایف جای تیک رو بذار»: the circle at the head of a month's card; its tick shows under the cursor, and
   green once pressed */
.cal-tick {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 14px; height: 14px; box-sizing: border-box; margin-inline-end: 0.25rem; vertical-align: -2px;
    border: 1.5px solid currentColor; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer;
}
.cal-tick > svg.icn { opacity: 0; stroke-width: 2.6; }
.cal-tick:hover > svg.icn, .cal-tick:focus-visible > svg.icn { opacity: 1; }
.cal-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.calendar-task:hover .cal-tick { color: inherit; }
.cal-tick.is-done { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.cal-tick.is-done > svg.icn { opacity: 1; }
.calendar-task.is-leaving { opacity: 0; transform: scale(0.96); transition: opacity 0.3s ease, transform 0.3s ease; }

/* «بازگشت» onto the same row (round 46): the ticket or the person the reader came back from stands clear of the bar
   and is lit for a moment */
tr.back-row { scroll-margin-top: calc(var(--topbar-h, 64px) + 24px); }
tr.back-row:target > td { animation: back-row-lit 2.4s ease; }
@keyframes back-row-lit { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { tr.back-row:target > td { animation: none; background: var(--accent-soft); } }

/* the internal manager's «تأیید لغو مرخصی» under a cancelled slip (round 46) */
.sub-cancel-seen { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 12px; }
.sub-cancel-seen-note { margin: 0 0 12px; }


/* «مثل تلگرام امکان پین کردن چت ها و پروژه ها»: the pin at the end of a conversation's row and on a project's card.
   A pinned one carries it in the house colour always; the others show it under the cursor — faintly on a touch
   screen, where there is no cursor. */
.pin-mark {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 26px; height: 26px; border-radius: 50%; color: var(--muted); cursor: pointer;
    opacity: 0; transition: opacity 0.15s ease, background 0.15s ease;
}
.pin-mark > svg.icn { transform: rotate(-35deg); }
.chat-peer:hover .pin-mark, .project-card:hover .pin-mark, .pin-mark:focus-visible { opacity: 1; }
.pin-mark:hover { background: var(--accent-soft); color: var(--accent-deep, var(--accent)); }
.pin-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pin-mark.is-on { opacity: 1; color: var(--accent); }
.pin-mark.is-on > svg.icn { fill: currentColor; }
.pin-mark.is-busy { pointer-events: none; opacity: 0.5; }
@media (hover: none) { .pin-mark { opacity: 0.45; } .pin-mark.is-on { opacity: 1; } }
.chat-peer .pin-mark { margin-inline-start: auto; }
.chat-peer .side-badge + .pin-mark { margin-inline-start: 0; }
.chat-peer .chat-peer-text { flex: 1 1 auto; min-width: 0; }
.project-card-head h3 { flex: 1 1 auto; min-width: 0; }
html[data-theme="dark"] .pin-mark.is-on { color: #b9a6ff; }
html[data-theme="dark"] .pin-mark:hover { background: rgba(185, 166, 255, 0.14); color: #d6cbff; }

/* «تمام وظیفه ها قابلیت جا به جایی داشته باشن» (round 46): the grip at the head of a line of the plan, the list of
   days it opens, and the cell a dragged line is over */
.plan-field { position: relative; }
.plan-grip {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: flex-start;
    width: 22px; height: 30px; margin-top: 2px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--muted); cursor: grab;
}
.plan-grip:hover { background: var(--accent-soft); color: var(--accent-deep, var(--accent)); }
.plan-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.plan-field.is-dragged { opacity: 0.45; }
.plan-field.is-moved textarea { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow 0.3s ease; }
.plan-fields.is-drop { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 8px; }
.plan-move-menu {
    position: absolute; z-index: 40; top: calc(100% + 4px); inset-inline-start: 0; min-width: 190px;
    display: flex; flex-direction: column; gap: 2px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; box-shadow: var(--shadow);
}
.plan-move-head { margin: 0 0 4px; padding: 0 6px; font-size: 0.82rem; color: var(--muted); }
.plan-move-day {
    display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
    color: var(--text); font: inherit; font-size: 0.9rem; text-align: start; cursor: pointer;
}
.plan-move-day:hover, .plan-move-day:focus-visible { background: var(--accent-soft); outline: none; }
@media print { .plan-grip, .plan-move-menu { display: none !important; } }


/* a picked picture, small, before it is sent (round 46) */
.picked-file.has-thumb { padding-inline-start: 0.3rem; }
.picked-file-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

/* «گفت‌وگوی پروژه» on the project's page (round 46): files under a message, its ticks, «ویرایش» / «حذف» while unread,
   and the picker beside the box */
.project-msg-head .ticks { margin-inline-start: 0.35rem; }
.project-msg-edited { font-size: 0.78rem; }
.project-msg .chat-media, .project-msg .media-grid { margin-top: 8px; }
.project-msg-acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 8px; }
.project-msg-edit > summary { list-style: none; cursor: pointer; }
.project-msg-edit > summary::-webkit-details-marker { display: none; }
.project-msg-edit-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; min-width: min(420px, 80vw); }
.project-msg-edit-form textarea { width: 100%; box-sizing: border-box; }
.project-msg-edit-form .btn { align-self: flex-start; }
.project-compose-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.project-compose-files .picked-files { margin: 0; }
.project-compose { flex-wrap: wrap; }
.project-compose textarea { flex: 1 1 0; min-width: 0; }
.project-compose-files { order: 3; flex: 1 0 100%; }

/* ══ دور ۴۷ — وظیفه‌های برنامه زمان‌بندی ══════════════════════════════════════════════════════════════════════════
   «وقتی کاری مشخص میشه و وظیفه اش تعیین میشه، در پنجره وظیفه دکمه ویرایش ظاهر بشه»: a line that has its task carries
   the task's button where its + was — filled, a task mark on it (a tick once the task is done) — and opens the task's
   window. «یک وظیفه از تاریخ 23 تا 30 … در تمام این روزها نمایش بده»: the days a task stands on with no line of their
   own carry it under the column, one card a task, its day of the span or its repeat beside its title. */
.plan-plus.has-task { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.plan-plus.has-task:hover, .plan-plus.has-task:focus-visible { background: var(--accent-deep); border-color: var(--accent-deep); }
.plan-plus.has-task.is-done { border-color: var(--green-deep); background: var(--green-deep); }
.plan-plus.is-busy { opacity: 0.55; pointer-events: none; }
.plan-line-tasks { display: flex; flex-direction: column; gap: 6px; width: 100%; box-sizing: border-box; margin-top: 8px; white-space: normal; }
.plan-line-task {
    display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 10px; box-sizing: border-box;
    border: 1px dashed var(--accent); border-radius: 8px; background: var(--accent-soft);
    color: var(--text); font-size: 0.86rem; line-height: 1.5; text-decoration: none;
}
.plan-line-task:hover, .plan-line-task:focus-visible { border-style: solid; outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.plan-line-task-mark {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
}
.plan-line-task-mark svg.icn { width: 12px; height: 12px; }
.plan-line-task-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-line-task-said { flex: 0 0 auto; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.plan-line-task.is-done .plan-line-task-mark { background: var(--green-deep); }
.plan-line-task.is-done .plan-line-task-title { color: var(--muted); text-decoration: line-through; }
@media print { .plan-line-task { border-style: solid; background: none; } .plan-line-task-mark { display: none; } }

/* «امکان ایجاد وظیفه تکراری وجود نداشته باشه و آلارم بده که این وظیفه قبلا ایجاد شده است»: the window that would
   have made a second one says so in a box of its own, the first one a press away; the task's window opened instead
   says it over the task */
.qt-error.is-twin, .peek-alarm {
    position: relative; display: block; margin: 0; padding: 10px 14px; padding-inline-start: 42px;
    border: 1px solid #f0c987; border-radius: var(--radius-sm); background: #fdf3e6; color: #8a4a06;
    font-size: 0.92rem; font-weight: 600; line-height: 1.8;
}
.qt-error.is-twin[hidden] { display: none; }
.qt-error.is-twin::before, .peek-alarm::before {
    content: "⚠"; position: absolute; inset-inline-start: 14px; top: 9px; font-size: 1.05rem; line-height: 1.6;
}
.qt-twin-open { display: inline-flex; vertical-align: middle; margin-block: 2px; margin-inline-start: 8px; }

/* the task's window: its newest change, the plan's line it came from, and its moves with how late they made it */
.peek-last .peek-value, .peek-plan-from .peek-value { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.peek-last-by { color: var(--muted); font-size: 0.86rem; }
.peek-last .act-btn { margin-inline-start: auto; }
.peek-plan-from a.peek-value { color: var(--accent-ink); text-decoration: none; }
.peek-plan-from a.peek-value:hover { text-decoration: underline; }
.peek-moves {
    display: flex; flex-direction: column; gap: 8px; padding: 12px 16px;
    border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
}
.peek-moves-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; font-size: 0.96rem; }
.peek-moves-head svg.icn { color: var(--accent); }
.peek-moves-late {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
    background: #e8f5ee; color: var(--green-deep); font-size: 0.84rem; font-weight: 700;
}
.peek-moves-late.is-late { background: #fdecea; color: var(--red-deep); }
.peek-moves-sum { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.8; }
.peek-moves-list { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.peek-moves-list li {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0;
    border-top: 1px dashed var(--border-soft); font-size: 0.9rem;
}
.peek-moves-list li:first-child { border-top: 0; }
.peek-move-n {
    flex: 0 0 auto; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-ink); font-size: 0.78rem; font-weight: 700;
}
.peek-move-what { flex: 1 1 220px; min-width: 0; }
.peek-move-days { color: var(--green-deep); font-size: 0.86rem; white-space: nowrap; }
.peek-move-days.is-late { color: var(--red-deep); }
.peek-move-by { flex: 1 0 100%; padding-inline-start: 32px; color: var(--muted); font-size: 0.82rem; }
html[data-theme="dark"] .qt-error.is-twin, html[data-theme="dark"] .peek-alarm {
    border-color: #6b4a1a; background: #2b2113; color: #f2c27b;
}
html[data-theme="dark"] .peek-moves-late { background: #14301f; color: #6fd19b; }
html[data-theme="dark"] .peek-moves-late.is-late { background: #3a1c18; color: #f29a8c; }
html[data-theme="dark"] .peek-move-days { color: #6fd19b; }
html[data-theme="dark"] .peek-move-days.is-late { color: #f29a8c; }

/* ══ دور ۴۸ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «وقتی کسی منشن میشه بتونه جواب گزارش رو بده»: «پاسخ» under somebody else's report, where «ویرایش» stands under
   one's own; on «منشن‌ها به من», «پاسخ» sits in the card's lower corner. */
.treport-reply { margin-top: 0.5rem; }
.treport-reply svg.icn, .mention-reply svg.icn { width: 14px; height: 14px; }
.mention-item { position: relative; }
.mention-item > .mention-card { padding-bottom: 3.1rem; }
.mention-reply { position: absolute; bottom: 0.75rem; inset-inline-end: 1rem; }

/* «وقتی … مدیرداخلی تایید میکنه امکان لغو درخواست رو نداشته باشه»: said where «لغو درخواست» was */
.sub-cancel-locked { white-space: nowrap; }

/* «در هر پروژه کنار کارت واریزی کارفرما، کارت هزینه ها رو ایجاد کن»: the costs' card, and in the list of costs the
   rows the finance flow registered on the project, each opening its record */
.fin-costs-tile .fin-costs-count { color: var(--accent-ink); }
.fin-flow-costs { display: flex; flex-direction: column; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.fin-flow-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin: 0 0 4px; }
.fin-flow-cost {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0;
    border-top: 1px dashed var(--border-soft); color: var(--text); text-decoration: none;
}
.fin-flow-cost:first-of-type { border-top: 0; }
.fin-flow-cost:hover .fin-cost-title b, .fin-flow-cost:focus-visible .fin-cost-title b { color: var(--accent-ink); }

/* ══ دور ۵۰ — لیست مالی، ثبت سند، هزینه‌های دفتر ══════════════════════════════════════════════════════════════════
   «طبق فرمی که برات میفرستم»: the sheet «رسید پرداختی» — ruled cells, the columns of the form, one per approving unit
   named for it; the column of the step the list stands at drawn in the house tint; «عدم تایید دارها کم رنگ بالاتر قرار
   بگیرن و تایید دارها پر رنگ در ادامه». */
.fin-sheet-head { align-items: center; }
.fin-sheet-state { font-size: 0.9rem; }
.fin-road { display: flex; flex-wrap: wrap; gap: 8px 6px; margin: 0 0 20px; padding: 0; list-style: none; }
.fin-road li {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 0.88rem;
}
.fin-road-dot {
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--border-soft); color: var(--muted); font-size: 0.78rem; font-weight: 700;
}
.fin-road li.is-done { color: var(--text); }
.fin-road li.is-done .fin-road-dot { background: var(--green-deep); color: #fff; }
.fin-road li.is-now { border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.fin-road li.is-now .fin-road-dot { background: var(--accent); color: var(--on-accent); }

.fin-sheet-panel { overflow: hidden; }
.fin-sheet-wrap { overflow-x: auto; }
.fin-sheet { width: 100%; min-width: 1000px; table-layout: fixed; border-collapse: collapse; font-size: 0.8rem; }
.fin-sheet.fin-draft { table-layout: auto; }
/* the house's tables keep a cell on one line; the sheet's narrow columns wrap inside their own cell instead */
.fin-sheet th, .fin-sheet td, .fin-sheet td bdi { white-space: normal; }
.fin-sheet .fin-c-desc, .fin-sheet .fin-c-who { text-align: start; }
/* the sheet's fifteen columns share whatever width the page has (the menu open or folded) — «توضیحات» the rest —
   and the long numbers wrap in their cells; under 1000px the sheet scrolls */
.fin-sheet .fin-c-n { width: 3.2%; }
.fin-sheet .fin-c-who { width: 6.6%; }
.fin-sheet .fin-c-date { width: 5%; }
.fin-sheet .fin-c-bank { width: 4.8%; overflow-wrap: normal; }
.fin-sheet .fin-c-card { width: 6.8%; word-break: break-all; font-size: 0.74rem; }
.fin-sheet .fin-c-card bdi { display: block; }
.fin-sheet .fin-c-pay { width: 5.6%; }
.fin-sheet .fin-c-proj { width: 4.4%; }
.fin-sheet .fin-c-topic { width: 6.8%; }
.fin-sheet th.fin-c-amount { width: 8%; }
.fin-sheet td.fin-c-amount { white-space: nowrap; overflow-wrap: normal; font-size: 0.78rem; }
.fin-sheet.fin-draft { min-width: 980px; }
.fin-sheet th, .fin-sheet td { border: 1px solid var(--border-soft); padding: 8px; vertical-align: top; overflow-wrap: anywhere; }
.fin-sheet thead th { background: var(--bg); font-size: 0.76rem; font-weight: 700; color: var(--text); line-height: 1.5; vertical-align: middle; }
.fin-sheet .fin-c-n { text-align: center; white-space: nowrap; }
.fin-sheet .fin-c-desc { width: auto; }
.fin-sheet .fin-c-ok { width: 7.6%; }
.fin-sheet .fin-c-ok .btn { padding-inline: 6px; font-size: 0.8rem; }
.fin-sheet .fin-c-amount { font-weight: 700; }
.fin-sheet .fin-c-topic input, .fin-sheet .fin-c-topic select { width: 100%; box-sizing: border-box; margin-bottom: 6px; font-size: 0.8rem; }
.fin-sheet th.is-now, .fin-sheet td.is-now { background: var(--accent-soft); }
.fin-sheet th.is-off, .fin-sheet td.is-off { background: var(--bg); }
.fin-sheet tr.is-kept td { font-weight: 600; }
.fin-sheet tr.is-refused td { opacity: 0.5; font-weight: 400; }
.fin-sheet tr.is-refused:hover td, .fin-sheet tr.is-refused:focus-within td { opacity: 0.85; }
.fin-sheet tr:target td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.fin-pay-pick { margin-inline-start: 6px; vertical-align: middle; }
.fin-petty-tag {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent-ink); font-size: 0.74rem; font-weight: 700;
}
.fin-row-title { display: block; color: var(--text); font-weight: 700; text-decoration: none; }
.fin-row-title:hover { color: var(--accent-ink); text-decoration: underline; }
.fin-row-kind, .fin-row-note, .fin-row-paid, .fin-row-moved, .fin-row-reason { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 400; }
.fin-row-paid { color: var(--green-deep); }
.fin-row-moved, .fin-row-reason { color: var(--red-deep); }
.fin-ok-chip { font-size: 0.78rem; }
.fin-ok-who { display: block; margin-top: 4px; color: var(--muted); font-size: 0.74rem; font-weight: 400; }
.fin-ok-reason { display: block; margin-top: 4px; color: var(--red-deep); font-size: 0.78rem; font-weight: 400; white-space: normal; }
.fin-behalf-tag {
    display: inline-flex; align-items: center; height: 20px; margin-inline-start: 4px; padding: 0 7px; border-radius: 999px;
    border: 1px solid var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 700;
}
.fin-ok-acts { display: flex; flex-direction: column; gap: 6px; }
.fin-ok-acts form { margin: 0; }
.fin-ok-acts .btn { width: 100%; justify-content: center; }
.fin-no > summary { list-style: none; width: 100%; justify-content: center; box-sizing: border-box; }
.fin-no > summary::-webkit-details-marker { display: none; }
.fin-no form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.fin-no textarea, .fin-unpaid textarea { width: 100%; box-sizing: border-box; min-height: 3.2rem; font-size: 0.84rem; }
.fin-no-reason { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 600; }
.fin-unpaid { margin-top: 6px; }
.fin-unpaid > summary { list-style: none; }
.fin-unpaid > summary::-webkit-details-marker { display: none; }
.fin-unpaid form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.fin-undo { margin: 4px 0 0; }
.fin-sheet-total td { background: var(--bg); font-weight: 800; }

.fin-signs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 20px; border-top: 1px solid var(--border-soft); }
.fin-sign { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; font-size: 0.88rem; }
.fin-sign-cap { color: var(--muted); font-size: 0.8rem; }
.fin-by-project { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; padding: 12px 20px; border-top: 1px solid var(--border-soft); font-size: 0.88rem; }
.fin-by-project-item { white-space: nowrap; }
.fin-send-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0; padding: 14px 20px; border-top: 1px solid var(--border-soft); background: var(--surface);
}
.panel-body > .fin-send-bar { padding-inline: 0; border-top: 0; }
.panel-body > .fin-by-project { padding-inline: 0; }
.fin-behalf {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 20px; padding: 12px 16px;
    border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--surface);
}
.fin-behalf.is-on { border-style: solid; background: var(--accent-soft); }
.chip-toggle {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--accent); background: var(--surface); color: var(--accent-ink); font-weight: 700; text-decoration: none;
}
.chip-toggle.is-on { background: var(--accent); color: var(--on-accent); }
.fin-payments { display: flex; flex-direction: column; gap: 12px; }
.fin-payment { padding: 12px 0; border-top: 1px solid var(--border-soft); }
.fin-payment:first-child { border-top: 0; padding-top: 0; }
.fin-payment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.fin-payment-amount { margin-inline-start: auto; font-weight: 700; }
.fin-payment-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fin-in-list {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
    margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.fin-in-list.is-paid { border-color: #bfe3c8; background: #f1faf3; color: #1f6b38; justify-content: flex-start; }
.fin-books-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 0 20px; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.fin-books-bar > span { display: inline-flex; align-items: center; gap: 8px; }
.seg-filter { display: inline-flex; margin-inline-start: auto; padding: 3px; border-radius: 999px; background: var(--bg); gap: 2px; }
.seg-filter .seg {
    display: inline-flex; align-items: center; height: 30px; padding: 0 16px; border-radius: 999px;
    color: var(--muted); font-size: 0.86rem; font-weight: 700; text-decoration: none;
}
.seg-filter .seg.is-on { background: var(--accent); color: var(--on-accent); }
#ceo-decisions .panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.fin-lists td { vertical-align: middle; }
tr.is-fresh td { background: var(--accent-soft); }

/* the project's eight cards, four to a row (two on a phone); a loss in red */
/* round 51: nine cards, three by three — money in, spent and owed; declared and what it left; percentages and credit */
.fin-tiles-3 { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fin-tiles-3 > * { min-width: 0; }
@media (max-width: 900px) {
    .fin-tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fin-tiles-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.fin-neg, .fin-card-figures dd.fin-neg { color: var(--red-deep); }
.fin-office-kpis { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* «ثبت سند»: the voucher window, as the office writes one */
.vch-dialog {
    width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0;
    border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lift);
}
.vch-dialog::backdrop { background: rgba(20, 20, 30, 0.45); }
.vch-form { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); margin: 0; }
.vch-head {
    position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
    padding: 20px 24px 14px; border-bottom: 1px solid var(--border-soft);
}
.vch-head-fields { display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; }
.vch-head-fields label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; white-space: nowrap; }
.vch-head-fields label > span:first-child, .vch-head-fields label { min-width: 0; }
.vch-head-fields input[type=text] { width: 150px; height: 2.1rem; }
.vch-head-fields .jalali-picker { width: 190px; }
.vch-head-read span { display: block; }
.vch-title { margin: 6px 0 0; font-size: 1.5rem; font-weight: 800; text-align: center; }
.vch-x {
    justify-self: end; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg);
    color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.vch-body { padding: 16px 24px; overflow: auto; }
.vch-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.vch-table th, .vch-table td { border: 1px solid var(--border); padding: 8px 10px; vertical-align: top; }
.vch-table thead th { background: var(--bg); font-weight: 800; text-align: center; }
.vch-table .vch-n { width: 48px; text-align: center; }
.vch-table .vch-money { width: 150px; white-space: nowrap; font-weight: 700; }
.vch-table .vch-acts { width: 1%; white-space: nowrap; }
.vch-table input { width: 100%; box-sizing: border-box; height: 2.1rem; }
.vch-line.is-editing td { background: var(--accent-soft); }
.vch-total td { background: var(--bg); font-weight: 800; }
.vch-balance { margin-inline-start: 12px; color: var(--green-deep); font-size: 0.82rem; }
.vch-balance.is-off { color: var(--red-deep); }
.vch-foot-note { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; font-size: 0.86rem; }
.vch-foot-note input { flex: 1 1 auto; max-width: 360px; }
.vch-signs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; font-size: 0.9rem; }
.vch-signs span:nth-child(2) { text-align: center; }
.vch-signs span:nth-child(3) { text-align: left; }
.vch-error { margin: 0 24px; color: var(--red-deep); font-weight: 700; }
.vch-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border-soft); }
.vch-foot .vch-pdf { margin-inline-start: auto; }
.vch-empty { margin: 12px 0 0; }
.vch-sheet { padding: 0 0 20px; }
.vch-sheet .table-wrap, .vch-sheet .vch-signs, .vch-sheet .vch-footnote { padding: 0 24px; }
.vch-footnote { margin: 8px 0 0; font-size: 0.84rem; color: var(--muted); }
/* on a phone the house turns a table into a card a row (responsive.js): the sheet keeps none of its column widths
   or ruled cells there, and the step's column stands out in the card */
@media (max-width: 700px) {
    .fin-sheet { min-width: 0; table-layout: auto; }
    .fin-sheet th, .fin-sheet td { width: auto !important; border: 0; border-block-end: 1px solid var(--border-soft); padding: 0.55rem 0; }
    .fin-sheet td.is-now { margin: 4px 0; padding: 8px 10px; border-radius: var(--radius-sm); }
    .fin-sheet td.is-off { display: none; }
    .fin-sheet .fin-ok-acts { flex-direction: row; flex-wrap: wrap; width: 100%; }
    .fin-sheet .fin-ok-acts > * { flex: 1 1 120px; }
    .fin-sheet-total td { background: none; }
}
@media (max-width: 700px) {
    .vch-head { grid-template-columns: 1fr; }
    .vch-title { text-align: start; }
    .vch-x { position: absolute; top: 12px; inset-inline-end: 12px; }
    .fin-signs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vch-signs { grid-template-columns: 1fr; }
    .vch-signs span:nth-child(n) { text-align: start; }
}
html[data-theme="dark"] .fin-in-list.is-paid { border-color: #24533a; background: #14301f; color: #8fe0b0; }
html[data-theme="dark"] .fin-sheet thead th, html[data-theme="dark"] .fin-sheet-total td,
html[data-theme="dark"] .vch-table thead th, html[data-theme="dark"] .vch-total td { background: rgba(255, 255, 255, 0.04); }

/* ══ دور ۵۱ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «بدهی پروژه»: the card beside «هزینه پروژه», and behind it each contractor — his contract, what was paid him by slip
   and what is left */
.fin-debt-tile .fin-costs-count { color: var(--accent-ink); }
.fin-debt-tile .stat-tile-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.fin-debtor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fin-debtor-head > .chip { margin-inline-start: auto; }
.fin-debt-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 20px; }
.fin-debt-sum > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); }
.fin-debt-sum dt { color: var(--muted); font-size: 0.86rem; }
.fin-debt-sum dd { margin: 0; font-size: 1.08rem; font-weight: 700; white-space: nowrap; }
.fin-debt-sum dd small { font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.fin-debt-label { margin: 20px 0 4px; font-weight: 700; font-size: 0.92rem; }
.fin-debt-label:first-of-type { margin-top: 0; }
.fin-debtor .fin-cost:first-of-type { border-top: 0; }
.fin-debt-pays td .attachment-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fin-debt-pending { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 0.86rem; }
.fin-debt-loose + .fin-debt-loose { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.fin-debt-loose .fin-flow-head .act-btn { margin-inline-start: auto; }
.fin-debt-tie { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.fin-debt-tie select { flex: 1 1 auto; width: auto; min-width: 180px; max-width: 300px; }
.fin-debt-tie select, .fin-debt-tie .act-btn { box-sizing: border-box; height: 38px; min-height: 38px; padding-block: 0; }
.fin-debt-tie .act-btn { flex: none; }
#unmatched .panel-body { padding-bottom: 20px; }
#new-contract { scroll-margin-top: 80px; }
@media (max-width: 700px) {
    .fin-debt-sum { grid-template-columns: 1fr; }
    .fin-debt-sum > div { flex-direction: row; align-items: baseline; justify-content: space-between; }
    .fin-debt-tie { flex-wrap: wrap; }
    .fin-debt-tie select { max-width: none; }
}

/* ══ دور ۵۲ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «ثبت قرارداد با سرپرست کارگاه باشه»: the supervisor's «قراردادها», a shelf a project; and «بدهی فقط از مانده مبلغ هر
   قرارداد باشه»: under each contract on «بدهی پروژه», what was paid against it and what is left */
.fin-contract-shelf .fin-cost:first-of-type { border-top: 0; }
.fin-contract-shelf .panel-body { padding-bottom: 8px; }
.fin-contract-balance { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin: 8px 0 0; font-size: 0.88rem; color: var(--muted); }
.fin-contract-balance b { color: var(--text); font-weight: 700; }
.fin-contract-balance .fin-contract-left b { color: #8a4a06; }
html[data-theme="dark"] .fin-contract-balance .fin-contract-left b { color: #e7a055; }
.fin-contract-balance .fin-neg b { color: inherit; }
.fin-debt-empty { margin: 12px 0; }
/* a contract card already ends in 12px of its own: the next label sits 20px below it, not 32 */
.fin-debtor .fin-cost + .fin-debt-label { margin-top: 8px; }

/* ══ دور ۵۴ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   the daily reports card by card: a field that opens on an answer, a drop-down of projects with a tick each, an hour
   of the day */
.field-grid.has-reveal { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.field-cell[hidden] { display: none !important; }
.multi-drop { position: relative; }
.multi-drop > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 2.6rem; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
    cursor: pointer; list-style: none; font-size: 0.92rem;
}
.multi-drop > summary::-webkit-details-marker { display: none; }
.multi-drop > summary::after { content: "▾"; color: var(--muted); }
.multi-drop[open] > summary::after { content: "▴"; }
.multi-drop-list {
    display: flex; flex-direction: column; gap: 2px; max-height: 15rem; overflow-y: auto; margin-top: 6px; padding: 6px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.multi-drop-item { display: flex; align-items: center; gap: 8px; margin: 0 !important; padding: 8px 10px; border-radius: 8px;
    font-weight: 500; cursor: pointer; }
.multi-drop-item:hover { background: var(--bg); }
/* an hour of the day reads «HH : MM» left to right, but stands where the page's fields start — on the right */
.clock-input { display: flex; width: 100%; direction: ltr; justify-content: flex-end; }

/* ══ دور ۵۵ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   a unit beside a box («روز»، «ریال»، «٪») is one word on one line, however narrow the phone's card */
.input-affix .affix { white-space: nowrap; flex: none; }

/* ══ دور ۵۶ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   the project manager's word on a contract; the technical unit's whole-list refusal and petty-cash numbers; the finance
   manager's two buttons beside each line of the project's costs */
.fin-contract-state { margin-inline-start: 8px; font-size: 0.78rem; vertical-align: middle; }
.fin-contract-why {
    margin: 8px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--red-soft, #fdecea);
    color: var(--red-deep); font-size: 0.88rem;
}
html[data-theme="dark"] .fin-contract-why { background: rgba(255, 143, 127, 0.1); }
.fin-review-acts, .fin-office-acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 12px; }
.fin-office-acts { margin-top: 0; }
.fin-review-no > summary { list-style: none; cursor: pointer; }
/* «تأیید» and «عدم تأیید» side by side, one height */
.fin-review-acts > form .btn, .fin-review-acts .fin-review-no > summary, .fin-office-acts > .act-btn,
.fin-office-acts .fin-review-no > summary {
    display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; height: 36px; min-height: 36px;
    padding-block: 0;
}
.fin-review-no > summary::-webkit-details-marker { display: none; }
.fin-review-no[open] > summary { margin-bottom: 8px; }
.fin-review-no form { display: flex; flex-direction: column; gap: 8px; min-width: min(320px, 100%); }
.fin-review-no form label { margin: 0; }
.fin-review-no form .btn { align-self: flex-start; }
/* in the sheet's narrow «توضیحات» cell: the words over the box, the box the cell's width */
.fin-petty-no { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin: 8px 0 0 !important;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.fin-petty-no input { width: 100% !important; min-width: 0; height: 2rem !important; min-height: 0; }
.fin-petty-bar { margin-top: 12px; }
.fin-list-refused { margin: 12px 0 0; }
.fin-flow-cost .fin-cost-title { color: var(--text); text-decoration: none; }
.fin-flow-cost .fin-entry-actions { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.fin-flow-cost .fin-cost-amount + .fin-entry-actions { margin-inline-start: 0; }

/* ══ دور ۵۷ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   a list per kind of entry and per project's petty cash; the writer's own names and accounts under the name field; the
   question before a row already paid; pictures in the sheet; the list's PDF */
.fin-draft-group + .fin-draft-group { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.fin-draft-group-head { margin: 0 0 12px; font-size: 0.98rem; font-weight: 800; }
.fin-draft-group-head .muted { font-weight: 500; font-size: 0.86rem; }
.panel-body > .fin-send-all { margin-bottom: 20px; padding: 12px 16px; border: 1px dashed var(--accent);
    border-radius: var(--radius); background: var(--accent-soft); }
.fin-draft-group > .fin-send-bar { padding-inline: 0; border-top: 0; background: transparent; }
.fin-draft-group > .fin-by-project { padding-inline: 0; }
.fin-petty-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 20px 0 0; padding: 12px 16px;
    border-radius: var(--radius-sm); background: var(--bg); font-size: 0.88rem; }
.fin-sheet-head-acts { display: inline-flex; align-items: center; gap: 12px; }
.fin-sheet-head-acts .btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; }
.fin-paid-day { display: block; margin-top: 4px; font-size: 0.74rem; font-weight: 400; }
.fin-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fin-thumb {
    display: inline-grid; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: 6px;
    border: 1px solid var(--border-soft); background: var(--bg); color: var(--accent-ink); font-size: 0.74rem;
    font-weight: 800; text-decoration: none;
}
.fin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fin-thumb:hover, .fin-thumb:focus-visible { border-color: var(--accent); }
/* the form: the pictures under the fields, the word on what is missing beside the box */
.fin-fields + .fin-files-field { margin-top: 12px; }
.fin-files-cap { display: block; margin-bottom: 6px; font-size: 0.9rem; font-weight: 600; }
.fin-files-field .file-drop { margin-top: 0; }
.fin-files-need { margin: 8px 0 0; color: var(--red-deep); font-size: 0.86rem; }
.fin-note { display: block; margin-top: 12px; }
.fin-note-need { color: var(--red-deep); font-size: 0.82rem; font-weight: 500; }
.fin-opt { display: inline-flex; align-items: center; height: 18px; margin-inline-start: 4px; padding: 0 6px;
    border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 0.74rem; font-weight: 600; vertical-align: middle; }
.fin-opt[hidden] { display: none; }
input.is-auto { background: var(--bg); color: var(--accent-ink); font-weight: 700; cursor: default; }
.fin-edit + .form-actions, .fin-edit ~ .form-actions { margin-top: 12px; }
/* «وقتی روی این فیلدهای نام … و شماره حساب کلیک میشه اون اطلاعات رو نمایش بده» */
.fin-payees {
    position: absolute; z-index: 60; max-height: 320px; overflow-y: auto; padding: 6px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    box-shadow: 0 12px 32px rgba(17, 17, 26, 0.16);
}
.fin-payees-head { padding: 6px 10px 8px; color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.fin-payee { display: flex; align-items: stretch; gap: 4px; }
.fin-payee-pick {
    flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 8px 10px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: start;
    font: inherit; cursor: pointer;
}
.fin-payee-pick b { font-size: 0.9rem; }
.fin-payee-pick .muted { font-size: 0.76rem; overflow-wrap: anywhere; }
.fin-payee-pick:hover, .fin-payee-pick.is-active, .fin-payee-pick:focus-visible { background: var(--accent-soft); color: var(--accent-ink); }
.fin-payee-drop {
    flex: none; width: 32px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
    font-size: 1.1rem; cursor: pointer;
}
.fin-payee-drop:hover, .fin-payee-drop:focus-visible { background: var(--red-soft, #fdecea); color: var(--red-deep); }
/* «قبلا برای این مورد پرداخت انجام شده … مورد تایید هست؟» */
.fin-twins { width: min(520px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); }
.fin-twins::backdrop { background: rgba(17, 17, 26, 0.45); }
.fin-twins h2 { margin: 0 0 12px; font-size: 1.05rem; color: var(--red-deep); }
.fin-twins-body p { margin: 0 0 6px; }
.fin-twins-body ul { margin: 0 0 12px; padding-inline-start: 20px; color: var(--muted); font-size: 0.88rem; }
.fin-twins-ask { margin: 12px 0; font-weight: 700; }
.fin-twins .form-actions { margin: 0; }
html[data-theme="dark"] .fin-payees { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .fin-payee-drop:hover { background: rgba(255, 143, 127, 0.12); }
@media (max-width: 640px) {
    .fin-sheet-head-acts { flex-wrap: wrap; justify-content: flex-start; }
    .panel-body > .fin-send-all { padding: 12px; }
}
.fin-cap { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
/* «شماره تنخواه رو واحد فنی دستی وارد کنه»: the list's number above its sheet */
.fin-petty-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 20px; padding: 12px 16px;
    border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--surface); }
.fin-petty-form label { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: min(260px, 100%); font-weight: 600; }
.fin-petty-form .btn { height: 40px; }
.fin-petty-form .muted { align-self: center; font-size: 0.86rem; }

/* ══ دور ۵۸ — «طبق اسکرین شاتی که برات فرستادم … فقط تا فیلد سرفصل»: new rows written on the sheet «رسید پرداختی» ═════ */
.fin-sheet-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 12px; }
.fin-sheet-top label { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: min(240px, 100%); font-weight: 600; }
.fin-sheet-top .muted { align-self: center; font-size: 0.86rem; }
.fin-entry-wrap { overflow-x: auto; }
.fin-entry-sheet { width: 100%; min-width: 1000px; table-layout: fixed; border-collapse: collapse; font-size: 0.84rem; }
.fin-entry-sheet th, .fin-entry-sheet td { border: 1px solid var(--border-soft); padding: 6px; vertical-align: top; white-space: normal; }
.fin-entry-sheet thead th { background: var(--bg); font-size: 0.76rem; font-weight: 700; color: var(--text); line-height: 1.5;
    text-align: center; vertical-align: middle; }
.fin-entry-sheet input, .fin-entry-sheet select { width: 100%; box-sizing: border-box; min-width: 0; height: 36px; min-height: 36px;
    margin: 0; font-size: 0.84rem; }
.fin-entry-sheet input[dir="ltr"] { font-size: 0.78rem; }
.fin-entry-sheet select { padding-inline: 6px 22px; background-position: left 6px center; font-size: 0.8rem; }
.fin-entry-sheet input { padding-inline: 8px; }
.fin-entry-sheet .jalali-picker { min-width: 0; }
/* the eleven columns share the width the page has, «شماره شبا» the most of it */
.fin-entry-sheet col.fin-e-n { width: 3.6%; } .fin-entry-sheet col.fin-e-who { width: 11.6%; }
.fin-entry-sheet col.fin-e-date { width: 10%; } .fin-entry-sheet col.fin-e-bank { width: 6.6%; }
.fin-entry-sheet col.fin-e-card { width: 12.6%; } .fin-entry-sheet col.fin-e-sheba { width: 16%; }
.fin-entry-sheet col.fin-e-amount { width: 9.6%; } .fin-entry-sheet col.fin-e-pay { width: 5.6%; }
.fin-entry-sheet col.fin-e-proj { width: 10.4%; } .fin-entry-sheet col.fin-e-topic { width: 6.8%; }
.fin-entry-sheet col.fin-e-files { width: 7.6%; }
/* the sheet's date box: the day alone, no ✕ beside it (a row is cleared by writing over it) */
.fin-entry-sheet .jalali-picker .jp-clear { display: none; }
.fin-entry-sheet .jalali-picker .jp-display { width: 100%; min-width: 0; padding-inline: 8px 30px; }
.fin-entry-sheet td.fin-e-n { text-align: center; vertical-align: middle; }
.fin-entry-sheet td.fin-e-pay { vertical-align: middle; text-align: center; font-size: 0.78rem; }
.fin-e-stack .fin-cell-field { display: block; }
.fin-e-stack .fin-cell-field + .fin-cell-field { margin-top: 6px; }
.fin-cell-field[hidden] { display: none !important; }
.fin-e-n .fin-item-drop { margin-top: 8px; padding: 0 6px; min-width: 0; }
.fin-e-files .fin-more-toggle { width: 100%; justify-content: center; margin-top: 6px; }
/* the picture box of a line: the button, and under it the pictures picked, small */
.fin-cell-drop { margin: 0; }
.fin-cell-drop .file-drop-zone { padding: 0; border: 0; background: transparent; min-height: 0; }
.fin-cell-drop .file-drop-pick { width: 100%; justify-content: center; gap: 4px; }
.fin-cell-drop.has-files .file-drop-list { margin-top: 6px; }
.fin-cell-drop .file-drop-list { display: flex; flex-wrap: wrap; gap: 4px; }
.fin-cell-drop .file-drop-card { position: relative; width: 34px; padding: 0; gap: 0; border: 0; background: transparent; }
.fin-cell-drop .file-drop-thumb, .fin-cell-drop .file-drop-mark { width: 34px; height: 34px; border-radius: 6px; font-size: 0.74rem; }
.fin-cell-drop .file-drop-name, .fin-cell-drop .file-drop-size { display: none; }
.fin-cell-drop .file-drop-remove { width: 18px; height: 18px; font-size: 0.8rem; line-height: 18px; top: -6px; inset-inline-start: -6px; }
.fin-e-files .fin-files-need { margin: 4px 0 0; font-size: 0.78rem; }
/* «جزئیات»: the line under a row */
.fin-entry-more td { background: var(--bg); }
.fin-more { display: grid; grid-template-columns: minmax(140px, 0.6fr) minmax(200px, 1fr) minmax(240px, 1.6fr); gap: 12px; align-items: start; }
.fin-more label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-weight: 600; }
.fin-more textarea { min-height: 36px; height: 36px; resize: vertical; }
.fin-entry-sheet tbody.fin-item + tbody.fin-item tr.fin-entry td { border-top-width: 2px; }
@media (max-width: 760px) {
    .fin-more { grid-template-columns: 1fr; }
}

/* ══ دور ۵۹ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   the list tab: the filter on top, larger letters in its tables, the breakdown one project a line; the sheet: a payment
   column at the row's end, decisions kept inside their cells; the row's page: its facts ruled, its files with a preview
   and «دانلود» beside them; the director's office costs by kind */
.fin-top-filter { margin: 0 0 20px; }
.fin-sheet.fin-draft { font-size: 0.92rem; }
.fin-sheet.fin-draft thead th { font-size: 0.84rem; }
.fin-sheet.fin-draft td.fin-c-amount { font-size: 0.9rem; }
.fin-entry-sheet { font-size: 0.88rem; }
.fin-entry-sheet input, .fin-entry-sheet select { font-size: 0.88rem; }
.fin-entry-sheet thead th { font-size: 0.8rem; }
.fin-sheet { font-size: 0.86rem; }
.fin-sheet thead th { font-size: 0.8rem; }
.fin-sheet td.fin-c-amount { font-size: 0.84rem; }
/* «تفکیک ریالی هر پروژه … هر پروژه زیر هم نوشته بشه … با یک خط از هم جدا بشن» */
.fin-by-project.is-stacked { display: block; }
.fin-by-project-cap { display: block; margin-bottom: 8px; }
.fin-by-project-list { list-style: none; margin: 0; padding: 0; max-width: 560px; border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); background: var(--surface); }
.fin-by-project-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px;
    font-size: 0.92rem; }
.fin-by-project-list li + li { border-top: 1px solid var(--border-soft); }
/* the sheet: the payment column, and a word of a unit that stays in its cell */
.fin-sheet .fin-c-paycol { width: 7.6%; text-align: center; }
.fin-sheet th.is-now.fin-c-paycol, .fin-sheet td.is-now.fin-c-paycol { background: var(--accent-soft); }
.fin-sheet .fin-c-ok, .fin-sheet .fin-c-paycol { overflow: hidden; }
.fin-sheet .fin-ok-chip { display: inline-flex; justify-content: center; max-width: 100%; height: auto; min-height: 22px;
    padding: 2px 8px; white-space: normal; line-height: 1.4; text-align: center; box-sizing: border-box; }
.fin-sheet .fin-ok-who, .fin-sheet .fin-ok-reason { overflow-wrap: anywhere; }
.fin-sheet .fin-no > summary, .fin-sheet .fin-unpaid > summary { width: 100%; box-sizing: border-box; justify-content: center;
    white-space: normal; height: auto; min-height: 32px; text-align: center; }
.fin-sheet .fin-no form .btn, .fin-sheet .fin-unpaid form .btn { width: 100%; white-space: normal; height: auto; min-height: 32px; }
.fin-sheet .fin-unpaid textarea, .fin-sheet .fin-no textarea { width: 100%; box-sizing: border-box; }
/* the row's page */
.fin-open-list-bar { display: flex; justify-content: flex-start; margin: 0 0 12px; }
.fin-facts.is-ruled { gap: 0; margin-top: 20px; border: 1px solid var(--border-soft); border-radius: var(--radius);
    overflow: hidden; background: var(--surface); }
.fin-facts.is-ruled > div { flex-direction: row; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px;
    box-sizing: border-box; }
.fin-facts.is-ruled > div:nth-child(n+3) { border-top: 1px solid var(--border-soft); }
.fin-facts.is-ruled > div:nth-child(odd) { border-inline-end: 1px solid var(--border-soft); }
.fin-facts.is-ruled .fin-fact-cap { flex: 0 0 150px; }
.fin-facts.is-ruled .fin-fact-val { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .fin-facts.is-ruled > div:nth-child(n+2) { border-top: 1px solid var(--border-soft); }
    .fin-facts.is-ruled > div:nth-child(odd) { border-inline-end: 0; }
    .fin-facts.is-ruled .fin-fact-cap { flex-basis: 120px; }
}
.fin-record-note { margin: 16px 0 0; padding: 12px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.fin-record-note .fin-fact-cap { margin-inline-end: 8px; }
.fin-record-files { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.fin-file-row { display: flex; align-items: center; gap: 12px; max-width: 620px; padding: 8px; box-sizing: border-box;
    border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface); }
.fin-file-face { flex: none; display: grid; place-items: center; width: 56px; height: 56px; overflow: hidden; border-radius: 8px;
    background: var(--bg); color: var(--accent-ink); font-size: 0.78rem; font-weight: 800; text-decoration: none; }
.fin-file-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fin-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text);
    text-decoration: none; }
.fin-file-name:hover { color: var(--accent-ink); }
.fin-file-get { flex: none; display: inline-flex; align-items: center; gap: 6px; }
/* a row waiting to be sent, put right in place */
.fin-draft-edit > td { background: var(--bg); padding: 12px; }
.fin-draft-edit .form-actions { margin-top: 12px; }
.fin-more.is-edit { grid-template-columns: minmax(150px, 0.8fr) minmax(120px, 0.6fr) minmax(130px, 0.6fr) minmax(180px, 1fr) minmax(200px, 1.4fr); }
@media (max-width: 1100px) { .fin-more.is-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the director's office costs, by kind */
.fin-office-filter .seg-filter { margin-inline-start: 0; flex-wrap: wrap; }
.fin-office-filter .seg { display: inline-flex; align-items: center; gap: 8px; }
.seg-sum { font-size: 0.8rem; opacity: 0.85; }
/* the sheet of a row put right in place sits inside the waiting rows' table: it takes that table's width */
.fin-draft-edit .fin-entry-wrap { overflow: visible; }
.fin-draft-edit .fin-entry-sheet { min-width: 0; }
.fin-entry-sheet thead th:first-child, .fin-entry-sheet td.fin-e-n { padding-inline: 2px; }
/* with «پرداخت» at the row's end the sheet's columns give a little each, so «توضیحات» keeps its room */
.fin-sheet .fin-c-card { width: 6.2%; }
.fin-sheet .fin-c-topic { width: 5.6%; }
.fin-sheet .fin-c-ok { width: 6.6%; }
.fin-sheet .fin-c-paycol { width: 6.6%; }
.fin-sheet .fin-c-desc { min-width: 120px; }
.fin-sheet .fin-c-paycol { width: 8%; }
.fin-sheet .fin-c-ok { width: 6.2%; }
.fin-sheet .fin-c-paycol .fin-unpaid > summary { white-space: nowrap; padding-inline: 4px; font-size: 0.78rem; }
.fin-sheet .fin-c-paycol .fin-ok-chip { white-space: nowrap; font-size: 0.78rem; padding-inline: 6px; }
.fin-sheet thead th { overflow-wrap: normal; word-break: normal; }

/* ══ دور ۶۰ — «کارت های هزینه دفتری به هم ریخته هست»، «اعداد داخل هم دیگه هستن»، «نام پروژه رو … نصفه نمایش میده»،
   «نوشته پروژه رو دو تیکه نشون میده» ══════════════════════════════════════════════════════════════════════════════ */
/* a card's figure keeps to its card: a long one a size smaller, a very long one smaller still, and wrapped as the last
   resort rather than running out of the card */
.stat-tile { min-width: 0; }
.stat-tile-num { max-width: 100%; min-width: 0; }
.stat-tile-num .fin-num { display: inline-block; max-width: 100%; overflow-wrap: anywhere; word-break: break-all; }
.stat-tile-num .fin-num.is-long { font-size: 1.45rem; }
.stat-tile-num .fin-num.is-xlong { font-size: 1.1rem; line-height: 1.35; }
.fin-office-kpis .stat-tile { overflow: hidden; }

/* the rows waiting to be sent: a project's name, a card, a sheba and an amount each on one line, whole — the
   description is the column that wraps */
.fin-sheet.fin-draft td.fin-c-num, .fin-sheet.fin-draft td.fin-c-num bdi { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.fin-sheet.fin-draft td.fin-c-word { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
.fin-sheet.fin-draft td.fin-c-desc { min-width: 140px; }
/* the sheet's project menu: the browser draws its own arrow, so no room is kept for one beside it, and the column is a
   little wider — the name shows whole */
.fin-entry-sheet select { padding-inline: 6px 2px; }
.fin-entry-sheet col.fin-e-who { width: 11.2%; } .fin-entry-sheet col.fin-e-sheba { width: 15.2%; }
.fin-entry-sheet col.fin-e-proj { width: 12%; } .fin-entry-sheet col.fin-e-topic { width: 6.4%; }
.fin-entry-sheet col.fin-e-files { width: 7.2%; }
.fin-sheet td.fin-c-word { overflow-wrap: normal; word-break: keep-all; }

/* ══ دور ۶۱ — «هر پیام، عکس … امکان حذف کردن وجود داشته باشه»؛ «ثبت هزینه افزودن فیلد داشته باشه»؛ هزینه‌های دفتر
   در مسیر تأیید «دقیقا مثل پروسه لیست مالی» ══════════════════════════════════════════════════════════════════════ */
/* a message of several files, sent before files went one to a message: each file with its own «حذف» at its corner */
.media-item { position: relative; max-width: min(340px, 100%); }
.media-item > .bubble-media, .media-item > .bubble-video { margin-top: 0.35rem; }
.media-item > .bubble-file, .media-item > .bubble-voice { padding-inline-end: 40px; }
.media-drop { position: absolute; top: 10px; inset-inline-end: 6px; margin: 0; }
.media-drop-btn {
    display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(17, 17, 26, 0.62); color: #fff; cursor: pointer; line-height: 0;
}
.media-drop-btn:hover, .media-drop-btn:focus-visible { background: var(--red-deep, #b42318); }

/* «ثبت هزینه»: a cost a row, «افزودن فیلد» for one more */
.fin-office-item { margin: 0 0 12px; padding: 12px 14px 4px; border: 1px solid var(--border-soft); border-radius: 12px; min-width: 0; }
.fin-office-item + .fin-office-item { margin-top: 12px; }
.fin-office-item-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 0 4px;
    font-size: 0.86rem; font-weight: 600; color: var(--muted);
}
.fin-office-form-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fin-office-item .fin-files-field { margin-top: 8px; }

/* the office's sheet of costs: the finance list's look, its own columns */
.fin-office-sheet { min-width: 980px; }
.fin-office-sheet .fin-c-kind { width: 9%; }
.fin-office-sheet .fin-c-date { width: 8.5%; }
.fin-office-sheet .fin-c-who { width: 10%; }
.fin-office-sheet .fin-c-state { width: 11rem; }
.fin-office-sheet td.fin-c-state .fin-ok-chip { white-space: nowrap; }
.fin-office-sheet td.fin-c-desc .fin-row-title { display: block; }
.fin-office-sheet .fin-cost-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fin-office-edit-row > td { background: var(--surface-soft, #fafafc); padding: 14px; }
.fin-office-edit-row .fin-cost-edit { margin: 0; }

/* what was picked, under every picker of the portal (file-pick.js), and under the boxes of a group and a channel */
.file-pick-list { margin: 0.5rem 0 0; }
.file-pick-list .picked-file { border-radius: 12px; padding: 0.3rem 0.35rem; }
.file-pick-list .picked-file-thumb, .picked-file-mark { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; }
.picked-file-mark {
    display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent);
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em;
}
.chat-compose > .compose-picked, .project-compose > .compose-picked { order: 9; flex: 1 0 100%; margin: 0.25rem 0 0; }
/* a letter already read with news on it — a paraf, a reply, a mention (round 61) */
.letter-news {
    display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--accent);
    color: #fff; font-size: 0.74rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
/* round 91: «نامه‌های خوانده‌نشده چه اصل متن و چه پاراف جدید باید متمایز باشند تا بشه سریع پیداشون کرد» — an unread row
   is tinted and its subject carries a dot; «خوانده‌نشده» and «پاراف تازه» say which */
.letter-row.letter-unread { background: #fff7ed; }
.letter-row.letter-unread .letter-subject { font-weight: 800; }
.letter-row.letter-unread .letter-subject::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 50%;
    background: var(--orange); vertical-align: middle;
}
.letter-news-unread { background: var(--orange); }
html[data-theme="dark"] .letter-row.letter-unread { background: rgba(232, 114, 28, 0.12); }
.letter-unread-only { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }

/* round 91: «ارجاع» in a window in front of the page */
.refer-dialog {
    width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 720px); padding: 0; border: 0; border-radius: 16px;
    background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}
.refer-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.refer-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.refer-dialog .refer-form { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 20px; overflow: hidden; }
.refer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.refer-head h2 { margin: 0; font-size: 1.05rem; }
.refer-dialog .field-hint { margin: 0; }
.refer-dialog .refer-people {
    display: flex; flex-direction: column; gap: 6px; min-height: 120px; max-height: 46vh; overflow-y: auto;
    padding: 4px; border: 1px solid var(--border-soft); border-radius: 12px; overscroll-behavior: contain;
}
.refer-dialog .refer-people .pick-chip {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.refer-dialog .refer-people .pick-chip:hover { background: var(--bg-soft, rgba(0, 0, 0, 0.04)); }
.refer-dialog .refer-people .pick-chip[hidden] { display: none; }
.refer-foot { display: flex; justify-content: flex-start; gap: 12px; }
@media (max-width: 700px) {
    .refer-dialog .refer-form { padding: 16px; }
    .refer-dialog input, .refer-dialog .refer-find { font-size: 16px; }
}

/* «روشن کردن اعلان‌ها» asked on every page of a device not asked yet (round 61) */
.push-ask {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 20px; padding: 12px 16px;
    border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface);
}
.push-ask[hidden] { display: none; }
.push-ask-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
                 background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.push-ask-text { flex: 1 1 260px; min-width: 0; font-size: 0.9rem; line-height: 1.7; }

/* the plan's printed sheet on the page's seven columns, one row a day, the signatures in boxes under it (round 61) */
.sheet-paper .sheet-table.sheet-week { min-width: 860px; }
.sheet-paper .sheet-week .sheet-num { width: 3.2rem; }
.sheet-paper .sheet-week .sheet-day { width: 5.6rem; }
.sheet-paper .sheet-week .sheet-date { width: 7.5rem; }
.sheet-paper .sheet-week .sheet-work { width: 30%; }
.sheet-paper .sheet-week .sheet-buy { width: 22%; }
.sheet-paper .sheet-week .sheet-who { width: 16%; }
.sheet-paper .sheet-week .sheet-state { width: 8rem; text-align: center; }
.sheet-paper .sheet-week td.plan-multiline { white-space: pre-line; line-height: 1.9; }
.sheet-paper .sheet-week tr.is-late td.sheet-state { color: #b42318; font-weight: 700; }
.sheet-signs {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px;
    border-top: 1px solid #1c1c22; border-inline-start: 1px solid #1c1c22;
}
.sheet-sign-box {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
    min-height: 4.6rem; padding: 0.5rem; text-align: center;
    border-bottom: 1px solid #1c1c22; border-inline-end: 1px solid #1c1c22;
}
.sheet-sign-cap { font-weight: 700; font-size: 0.84rem; background: #f2f2f5; align-self: stretch; padding: 2px 4px; }
@media print {
    .sheet-paper .sheet-table.sheet-week { min-width: 0; }
    .sheet-signs, .sheet-sign-box { border-color: #000; }
    .sheet-sign-cap { font-size: 8pt; }
}
@media (max-width: 700px) { .sheet-signs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fin-office-sheet .fin-c-ok { width: 7.6rem; }
.fin-office-sheet .fin-ok-acts .btn, .fin-office-sheet .fin-ok-acts summary { white-space: nowrap; }
.fin-office-sheet .fin-c-n { width: 3.6rem; white-space: nowrap; }

/* ══ دور ۶۲ — پنل مدیر مالی: «داشبورد مالی»، «ثبت سند»، «خلاصه مالی پروژه»، «گزارش مالی»؛ خط‌کشی همه‌ی هفته‌های برنامه ══ */
/* the dashboard: the lists' card of three beside the office's card; each opens below them */
.fin-dash { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.1fr); gap: 20px; margin: 0 0 20px; align-items: stretch; }
.fin-dash-group { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fin-dash-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1rem; font-weight: 700; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; flex: 1 1 auto; }
.fin-cards-5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.fin-cards > .stat-tile { margin: 0; }
/* a caption on two lines beside one on one: caption, figure and sum each keep one line across the row */
@supports (grid-template-rows: subgrid) {
    /* caption and figure at their own height, the sum's row takes what is left: both groups' cards end level */
    .fin-cards { grid-auto-rows: auto auto 1fr; }
    .fin-cards > .stat-tile { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 6px; align-content: start; }
    .fin-cards > .stat-tile > * { margin: 0; }
    .fin-cards > .stat-tile > .stat-tile-cap { align-self: start; }
    .fin-cards > .stat-tile > .stat-tile-num { align-self: end; }
}
.fin-pick { border: 1px solid var(--border-soft); box-shadow: none; transition: box-shadow 0.15s, border-color 0.15s; }
.fin-pick:hover { border-color: var(--accent); }
.fin-pick.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fin-pick .stat-tile-num { font-size: 1.7rem; }
.fin-dash-detail { scroll-margin-top: 96px; }
.fin-dash-sub { margin: 20px 0 12px; font-size: 0.92rem; font-weight: 700; color: var(--muted); }
.fin-desk-cards { margin: 0 0 20px; }
.fin-desk-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.fin-in-voucher { white-space: nowrap; }
.fin-in-voucher-note { font-size: 0.8rem; white-space: nowrap; }
.fin-pending td .chip { white-space: nowrap; }
.fin-holder-new[hidden] { display: none; }
.fin-summary-head { margin: 20px 0 12px; font-size: 0.98rem; font-weight: 700; }
@media (max-width: 900px) { .fin-dash { grid-template-columns: minmax(0, 1fr); } }
/* the two boxes of the filter share one width; on a phone each takes the row */
.fin-dash-filter label { flex: 0 0 240px; }
.fin-dash-filter label select { width: 100%; }
/* on a phone the cards sit two to a row, an odd last one across the row, so the page does not run a screen per card */
@media (max-width: 600px) {
    .fin-dash-filter label { flex: 1 1 100%; }
    .fin-cards, .fin-cards-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .fin-cards > .stat-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .fin-cards > .stat-tile { padding: 12px 14px; }
    .fin-pick .stat-tile-num { font-size: 1.35rem; }
}

/* «گزارش مالی»: a card per project, its sum beside its name and the lines that made it */
.fin-tile-project { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fin-tile-project-sum { font-weight: 800; white-space: nowrap; }
.fin-tile-project-count { margin: 0; font-size: 0.84rem; }
/* a project's lines fit its card: no table floor of 620px, the date and the sum keep to their width, the title wraps */
.fin-tile-lines { margin: 0; min-width: 0; width: 100%; table-layout: auto; }
.fin-tile-lines td { padding: 8px 6px; font-size: 0.86rem; vertical-align: top; }
.fin-tile-lines td:first-child { white-space: nowrap; width: 1%; }
.fin-tile-lines td:nth-child(2), .fin-tile-lines td:nth-child(2) > :not(.chip) { white-space: normal; overflow-wrap: anywhere; }
.fin-tile-lines td:nth-child(2) > .chip { display: inline-block; margin-top: 4px; }
.fin-tile-lines td:last-child { text-align: left; white-space: nowrap; width: 1%; }
.fin-tile-more > summary { cursor: pointer; font-size: 0.86rem; color: var(--accent); }

/* the plan's table ruled while it is written in, too */
.plan-table-ruled.is-editing td { vertical-align: top; }

/* ══ دور ۶۳ — «ثبت سند» و «داشبورد مالی» ═══════════════════════════════════════════════════════════════════════════ */

/* «تمام اعداد داخل کارت خودشون قرار بگیرن و از کارت خارج نشن»: a card's one column is the card's width, never its
   longest figure's; fit-figures.js sets a too-wide figure smaller, and breaks it between digit groups as a last resort */
.stat-tile { min-width: 0; }
@supports (grid-template-rows: subgrid) {
    .fin-cards > .stat-tile { grid-template-columns: minmax(0, 1fr); }
}
.stat-tile-sub { min-width: 0; max-width: 100%; }
.stat-tile-sub > span { min-width: 0; max-width: 100%; }
.fin-card-figures dd { min-width: 0; }
html.fig-fit .stat-tile-num .fin-num { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
html.fig-fit .stat-tile-sub bdi, html.fig-fit .fin-card-figures dd bdi { white-space: nowrap; }
.fig-wrap { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-all !important;
            line-height: 1.3; }
td .fin-num.is-xlong { white-space: normal; overflow-wrap: anywhere; }
.fig-wrap { display: inline-block; max-width: 100%; }
/* a project's lines in «گزارش مالی» on a phone: the day, the line and its sum one under another, each its full width
   (the 1% the wide screen gives the day and the sum is no width at all once the row is a card) */
@media (max-width: 700px) {
    .fin-tile-lines td, .fin-tile-lines td:first-child, .fin-tile-lines td:last-child { width: auto; }
    .fin-tile-lines td:last-child { justify-content: flex-start; font-weight: 700; }
}

/* «پیوست فایل کوچکتر بشه و فایل پیوست جلوی فیلد خودش قرار بگیره»: a small box the height of a field, and the files
   picked in a row in front of it */
.fin-attach-field { margin-top: 12px; }
.file-drop-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; }
.file-drop-inline .file-drop-zone {
    flex: 0 1 340px; min-height: 0; height: 44px; padding: 0 12px; gap: 8px; justify-content: flex-start;
    flex-wrap: nowrap; white-space: nowrap; border-width: 1.5px; font-size: 0.86rem;
}
.file-drop-inline .file-drop-zone .file-drop-pick { padding: 4px 12px; font-size: 0.84rem; }
.file-drop-inline .file-drop-zone .muted { overflow: hidden; text-overflow: ellipsis; }
.file-drop-inline.has-files .file-drop-list { margin-top: 0; }
.file-drop-inline .file-drop-list,
.fin-files-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.file-drop-inline .file-drop-card,
.fin-files-mini .file-drop-card {
    width: 44px; padding: 0; gap: 0; border: 0; background: transparent; position: relative; flex: 0 0 auto;
}
.file-drop-inline .file-drop-thumb, .file-drop-inline .file-drop-mark,
.fin-files-mini .file-drop-thumb, .fin-files-mini .file-drop-mark {
    width: 44px; height: 44px; border-radius: 8px; font-size: 0.74rem; border: 1px solid var(--border-soft);
    box-sizing: border-box;
}
.file-drop-inline .file-drop-name, .file-drop-inline .file-drop-size,
.fin-files-mini .file-drop-name { display: none; }
.file-drop-inline .file-drop-remove, .fin-files-mini .file-drop-remove {
    width: 20px; height: 20px; line-height: 20px; font-size: 0.8rem; top: -7px; inset-inline-start: -7px;
}
/* a saved file's picture stands on its item's line, between the title and the sum */
.fin-cost-head > .fin-files-mini { flex: 0 0 auto; }
.fin-pay-place { font-size: 0.82rem; }

/* «ثبت هزینه» and «شارژ تنخواه»: three fields a row — مبلغ، محل پرداخت، توضیح together */
.fin-cost-form .crm-two + .crm-two, .fin-cost-edit .crm-two + .crm-two { margin-top: 0; }
@media (min-width: 900px) { .crm-three > .fin-span-2 { grid-column: span 2; } }
.fin-cost-form select[name="pay_account"], .fin-cost-edit select[name="pay_account"] { width: 100%; text-overflow: ellipsis; }

/* «این تب ها … در کارت پرداخت های ثبت شده سایزشون بیشتر بشه خیلی ریز هستن» */
.fin-payments-table th { font-size: 0.95rem; color: var(--text); font-weight: 700; }
.fin-payments-table td { vertical-align: middle; }
/* the table keeps to its card: the account's long name wraps, the cells a little closer */
.fin-payments-table th, .fin-payments-table td { padding-inline: 12px; }
.fin-payments-table td:nth-child(4) { white-space: normal; min-width: 170px; }

/* «کارت های ثبت هر بخش بالای کارتش یک فلش داشته باشه برای جمع و باز کردن کارت» */
.fin-fold-head { display: flex; align-items: center; }
.fin-fold {
    margin-inline-start: auto; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
    border: 1px solid var(--border-soft); border-radius: 50%; background: var(--surface); color: var(--muted);
    cursor: pointer; flex: 0 0 auto; transition: color 0.15s, border-color 0.15s;
}
.fin-fold:hover { color: var(--accent); border-color: var(--accent); }
.fin-fold .icn { transform: rotate(-90deg); transition: transform 0.18s; }
.panel.is-folded .fin-fold .icn { transform: rotate(90deg); }
.panel.is-folded > .panel-body { display: none; }
.panel.is-folded > .panel-head { border-bottom: 0; }

/* «بازگشت به ثبت سند» above an item opened from «سندهایی که باید ثبت شود» */
.fin-pending .row-actions { white-space: nowrap; }

/* «وقتی پاپ آپ سند حسابداری باز میشه به صورت کامل نشون بده و نوار اسکرول به طرفین نداشته باشه»: the voucher shows
   whole — no box of its own that scrolls inside the window, no bar at its side, nothing wider than the window; one
   too tall for the screen moves as a whole under the wheel or the finger, its buttons kept in sight */
.vch-dialog { overflow-x: hidden; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.vch-dialog::-webkit-scrollbar { display: none; }
.vch-form { max-height: none; }
.vch-body { overflow: visible; padding: 12px 24px; }
.vch-table { table-layout: fixed; }
.vch-table th, .vch-table td { padding: 6px 8px; overflow-wrap: anywhere; }
.vch-table .vch-money { width: 132px; }
.vch-table .vch-acts { width: 96px; }
.vch-table td:not(.vch-acts), .vch-table td:not(.vch-acts) > .vch-show { white-space: normal; }
.vch-table td.vch-money { white-space: normal; }
.vch-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); }
@media (max-width: 700px) {
    .vch-head { grid-template-columns: minmax(0, 1fr) auto; }
    .vch-head-fields input[type=text], .vch-head-fields .jalali-picker { width: 100%; }
    .vch-body { padding: 12px; }
    .vch-table .vch-money { width: 96px; }
    .vch-table .vch-n { width: 32px; }
}


/* ══ دور ۶۴ (۲۸ مهر ۱۴۰۵) ═══════════════════════════════════════════════════════════════════════════════════════
   «در تمام جدول های سامانه تمام عنوان ها و نوشته های داخل جدول وسط چین باشن»: every heading and every cell of a table
   centred — the first column and the prose cells too, which stood at the edge before; the finance sheet's name and
   description columns, and the small tables of «گزارش مالی», no longer excepted. On the phone a table is drawn as cards
   (a label and its value on one line), which is not a table any more and stays as it is. */
.table th, .table td,
.table th:first-child, .table td:first-child,
.table th.wrap, .table td.wrap,
.fin-sheet .fin-c-desc, .fin-sheet .fin-c-who,
.fin-tile-lines td, .fin-tile-lines td:last-child,
.fin-entry-sheet th, .fin-entry-sheet td { text-align: center; }
.table td.row-actions, .table td.fin-entry-actions { text-align: center; }
.table td.row-actions > .inline-form, .table td.fin-entry-actions > .inline-form { vertical-align: middle; }
/* a cell of several lines (a title, its note, its pictures) keeps its lines centred under each other */
.fin-sheet .fin-c-desc .fin-row-title, .fin-sheet .fin-c-desc .fin-row-note, .fin-sheet .fin-c-desc .fin-row-kind,
.fin-sheet .fin-c-desc .fin-row-paid, .fin-sheet .fin-c-desc .fin-row-reason, .fin-sheet .fin-c-desc .fin-row-moved { text-align: center; }
.fin-sheet .fin-c-desc .fin-thumbs, .fin-sheet .fin-c-desc .fin-cost-actions { justify-content: center; }
.fin-sheet .fin-c-ok .fin-ok-acts, .fin-sheet .fin-c-ok .fin-no { align-items: center; }
.fin-sheet .fin-c-topic input[type=text] { text-align: center; }

/* «تب های داشبورد مالی، ثبت سند، خلاصه مالی پروژه و گزارش مالی رنگ فونتشون مشکی بشه و سایز فونتشون بیشتر و بولد بشه» —
   the finance manager's four tabs: the text's own colour (black by day, light by night), larger, bold; the open one
   keeps its underline */
.fin-tabs-desk .tab { color: var(--text); font-size: 1.08rem; font-weight: 700; padding: 0.65rem 1.05rem; }
.fin-tabs-desk .tab:hover { color: var(--accent-ink); }
.fin-tabs-desk .tab.active { color: var(--text); border-bottom-color: var(--accent-ink); border-bottom-width: 3px; }

/* a refused list: the sender's «حذف لیست», or the dead button of the unit that refused it */
.fin-list-refused-bar { flex-wrap: wrap; }
.fin-list-refused-bar .fin-list-refused { margin: 0; flex: 1 1 320px; }
.fin-list-refused-bar .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.fin-lists td.row-actions { white-space: nowrap; }

/* «ثبت سند»: the card inside a section («هزینه‌های ثبت‌شده», «واریزی‌ها», «شارژهای ثبت‌شده»), one card wide, opening
   its list under it */
.fin-inner-cards { margin: 0 0 20px; }
.fin-cards-1 { grid-template-columns: minmax(200px, 300px); }
.fin-inner-hint { color: var(--accent-ink); font-weight: 600; }
.fin-inner-hint::before { content: "·"; margin-inline-end: 0.4rem; color: var(--muted); font-weight: 400; }
/* the deposits, project by project */
.fin-deposit-groups { display: flex; flex-direction: column; gap: 20px; }
.fin-deposit-group { padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--surface); }
.fin-deposit-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 4px; font-size: 1.02rem; }
.fin-deposit-group-head small { font-weight: 500; font-size: 0.85rem; }
.fin-deposit-group-sum { font-weight: 800; white-space: nowrap; }
.fin-deposit-group-split { margin: 0 0 10px; font-size: 0.86rem; }
.fin-deposit-group .table-wrap { margin: 0; }
.fin-deposit-group .table { min-width: 0; }
/* «فیلد پیوست کنار فیلد توضیح قرار بگیره»: the attachment as one field of the row, its caption above the small box like
   a label's words above its field */
.fin-attach-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0 0 var(--gap-list, 12px); }
.fin-attach-cell .fin-files-cap { margin: 0; font-size: 0.9rem; font-weight: 600; line-height: 1.5; }
.fin-attach-cell .file-drop { margin: 0; }
.fin-attach-cell .file-drop-list:empty { display: none; }
.fin-row-attach { align-items: start; }

/* «گزارش مالی», a card opened: each project's lines on a table that can be read — headings over the columns, the
   figure bold and last, the rows roomy; the cards wide enough for the table */
.fin-tile-projects { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; }
.fin-tile-project { padding: 18px 20px; gap: 12px; }
.fin-tile-project .fin-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fin-tile-project .fin-card-head h3 { margin: 0; font-size: 1.08rem; }
.fin-tile-project-sum { font-size: 1.08rem; }
.fin-tile-project-sum small { font-weight: 500; font-size: 0.8rem; color: var(--muted); }
.fin-tile-project-count { font-size: 0.86rem; }
.fin-tile-table { min-width: 0; width: 100%; table-layout: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-md, 10px); overflow: hidden; }
.fin-tile-table th { font-size: 0.84rem; padding: 10px 12px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.fin-tile-table td { padding: 10px 12px; font-size: 0.94rem; vertical-align: middle; border-bottom: 1px solid var(--border-soft); }
.fin-tile-table tbody:last-of-type tr:last-child td { border-bottom: 0; }
.fin-tile-table td:first-child, .fin-tile-table td:last-child { width: auto; white-space: nowrap; }
.fin-tile-table td.wrap { white-space: normal; overflow-wrap: anywhere; }
.fin-tile-table td.fin-tile-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-tile-table td.fin-tile-amount .fin-num { font-size: inherit; }
.fin-tile-table td.fin-tile-amount.fin-neg { color: var(--red-deep); }
.fin-tile-table td.fin-tile-amount.fin-neg .fin-num { color: inherit; }
.fin-tile-table .chip { display: inline-block; }
.fin-tile-more-btn { align-self: center; }
@media (max-width: 640px) {
    .fin-tile-projects { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .fin-tile-project { padding: 14px; }
    .fin-tile-table th { font-size: 0.78rem; padding: 8px 8px; }
    .fin-tile-table td { padding: 8px 8px; font-size: 0.88rem; }
    .fin-attach-cell { margin-bottom: var(--gap-list, 12px); }
}

/* by night the four tabs keep the text colour too — dark.css paints every other tab muted */
html[data-theme="dark"] .fin-tabs-desk .tab, html[data-theme="dark"] .fin-tabs-desk .tab.active { color: var(--text); }


/* ══ دور ۶۵ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «طول فیلد پیوست فایل همتراز باقی فیلدها بشه»: the attachment is a cell of the form's grid — one column wide like
   every field — and its box as tall and as round as the fields beside it */
.fin-attach-row { margin-top: 0; }
.fin-attach-cell .file-drop-inline .file-drop-zone { height: 2.6rem; border-radius: 9px; width: 100%; max-width: none; }
/* «هزینه‌های دفتر یک کارت قابل کلیک باشه»: the office's card, pressed whole */
a.fin-office-card { text-decoration: none; color: inherit; cursor: pointer; justify-content: flex-start; }
.fin-office-card .fin-dash-head { color: var(--text); }
.fin-office-card .stat-tile-num { font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.fin-office-card .stat-tile-sub { font-size: 0.83rem; color: var(--muted); }
.fin-office-card:hover .fin-dash-head { color: var(--accent-ink); }
/* «ثبت سند دستی» beside «ثبت سند موارد انتخاب‌شده» */
.fin-books-acts { display: inline-flex; gap: 10px; flex-wrap: wrap; align-items: center; }


/* ══ دور ۶۶ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «فیلد پیوست فایل همتراز فیلد بالاییش باشه»: the attachment's cell is laid out exactly as a label of the form — the
   same caption size and weight, the same gap, bottom-aligned, no margin of its own — so its box sits level with the
   field above it and the one beside it */
.fin-attach-cell { justify-content: flex-end; gap: 0.35rem; margin: 0; font-size: 0.89rem; font-weight: 500; }
.fin-attach-cell .fin-files-cap { font-size: inherit; font-weight: inherit; line-height: inherit; margin: 0; }
.fin-attach-cell .file-drop-inline .file-drop-zone { height: 2.6rem; }
@media (max-width: 640px) { .fin-attach-cell { margin: 0; } }

/* «کارت هزینه دفتر … کارت قابل کلیک باشه که با کلیک کردن روی اون تمام هزینه های ثبت شده رو داخلش نمایش بده»: the card's
   head is a button; the sheet opens inside the card */
button.fin-open-head { width: 100%; border: 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; text-align: start; font: inherit; font-size: 1.06rem; font-weight: 800; color: var(--text); background: var(--surface); }
.fin-open-card:not(.is-open) > .fin-open-head { border-bottom: 0; }
.fin-open-head .fin-costs-total { font-weight: 500; }
.fin-open-hint { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.fin-open-hint .icn { transform: rotate(-90deg); transition: transform 0.18s; }
.fin-open-card.is-open .fin-open-hint .icn { transform: rotate(90deg); }
.fin-open-head:hover .fin-open-hint, .fin-open-head:focus-visible .fin-open-hint { text-decoration: underline; }
@media (max-width: 640px) {
    button.fin-open-head { flex-wrap: wrap; }
    .fin-open-hint { margin-inline-start: 0; width: 100%; justify-content: flex-start; }
}

/* «فیلدهای شماره سند، تاریخ و پیوست در یک راستا قرار بگیره و منظم باشن»: the window's head is its title, and under
   it one row of the three fields, each caption over its field, all of one height; «دکمه افزودن ردیف بیرون از جدول» */
.vch-form .vch-head { display: flex; flex-direction: column; gap: 14px; padding: 18px 24px 16px; }
.vch-form .vch-title { margin: 0; padding-inline-end: 44px; text-align: center; }
.vch-form .vch-x { position: absolute; top: 14px; inset-inline-end: 16px; }
.vch-form .vch-head-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.vch-form .vch-head-fields label { flex-direction: column; align-items: stretch; gap: 0.35rem; white-space: normal; font-weight: 600; font-size: 0.86rem; min-width: 0; }
.vch-form .vch-head-fields input[type=text], .vch-form .vch-head-fields .jalali-picker { width: 100%; height: 2.6rem; }
.vch-form .vch-head-fields .jalali-picker { min-width: 0; }
.vch-form .vch-head-fields .jalali-picker .jp-display { width: 100%; min-width: 0; }
.vch-total td.vch-mid { text-align: center; }
.vch-balance { margin: 0; font-weight: 800; font-size: 0.88rem; }
.vch-add-bar { display: flex; margin: 10px 0 0; }
@media (max-width: 700px) {
    .vch-form .vch-head { padding: 16px 16px 14px; }
    .vch-form .vch-head-fields { grid-template-columns: 1fr; }
    .vch-form .vch-title { text-align: start; padding-inline-end: 40px; }
}

/* the voucher's table on the phone: a table still, read sideways in its strip — not a stack of cards with the
   headings lost and «جمع» standing on end (round 66, the finance manager's panel read on the phone) */
.vch-scroll { overflow: visible; }
@media (max-width: 640px) {
    .vch-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
    .vch-dialog .vch-table { display: table; min-width: 620px; width: 100%; }
    .vch-dialog .vch-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: nowrap; }
    .vch-dialog .vch-table thead tr, .vch-dialog .vch-table tbody tr, .vch-dialog .vch-table tfoot tr { display: table-row; background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0; }
    .vch-dialog .vch-table tbody { display: table-row-group; }
    .vch-dialog .vch-table tfoot { display: table-footer-group; }
    .vch-dialog .vch-table th, .vch-dialog .vch-table td { display: table-cell; width: auto; white-space: nowrap; text-align: center; border: 1px solid var(--border); padding: 8px 10px; }
    .vch-dialog .vch-table td::before { content: none; }
    .vch-dialog .vch-table td.vch-n { width: 40px; }
    .vch-dialog .vch-table td.vch-money { width: 110px; }
    .vch-dialog .vch-table td.vch-acts { width: 1%; }
    .vch-dialog .vch-table input { min-width: 110px; }
}


/* ══ دور ۶۷ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   «فیلد پیوست فایل همتراز فیلدهای بالاییشون بشه»: the box takes the whole of its cell on every screen — its flex basis
   was 340px, so on a wide screen it stopped short of the field above it */
.fin-attach-cell .file-drop-inline .file-drop-zone { flex: 1 1 100%; width: 100%; max-width: none; }
/* «دکمه حذف در انتهای هر ردیف لیست مالی»: the sender's last column */
.fin-sheet .fin-c-del { width: 5%; white-space: nowrap; text-align: center; }
.fin-sheet .fin-c-del .inline-form { margin: 0; display: inline-flex; }


/* ══ دور ۷۱ ═══════════════════════════════════════════════════════════════════════════════════════════════════════
   the sheet a unit writes its rows on, one line a row: «شماره حساب» and «شرح» gone, «توضیحات» beside «سرفصل», «نوع
   پیوست» beside «پیوست» — twelve columns, their shares summing to the whole */
.fin-entry-sheet col.fin-e-n { width: 3.2%; } .fin-entry-sheet col.fin-e-who { width: 11%; }
.fin-entry-sheet col.fin-e-date { width: 9.2%; } .fin-entry-sheet col.fin-e-bank { width: 6.2%; }
.fin-entry-sheet col.fin-e-card { width: 11%; } .fin-entry-sheet col.fin-e-sheba { width: 14%; }
.fin-entry-sheet col.fin-e-amount { width: 9%; } .fin-entry-sheet col.fin-e-proj { width: 9.2%; }
.fin-entry-sheet col.fin-e-topic { width: 7.2%; } .fin-entry-sheet col.fin-e-note { width: 9.4%; }
.fin-entry-sheet col.fin-e-akind { width: 5.6%; } .fin-entry-sheet col.fin-e-files { width: 5%; }
.fin-entry-sheet td.fin-note { position: relative; }
.fin-entry-sheet td.fin-note .fin-note-need { display: block; margin-top: 4px; font-size: 0.76rem; color: var(--red-deep); }
/* «شماره لیست مالی», the last one sent written above the box */
.fin-last-number { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.fin-last-number b { font-weight: 700; color: var(--text); }
/* a unit's «داشبورد مالی»: one group of two cards */
.fin-dash-one { grid-template-columns: minmax(0, 1fr); }
.fin-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
/* the sheet of a list: «ردیف» and «حذف» inside their columns («نوشته ردیف از جدول خارج شده … دکمه حذف هم») */
.fin-sheet .fin-c-n { width: 3.4rem; }
.fin-sheet .fin-c-del { width: 5.6rem; }
.fin-sheet .fin-c-del .act-btn { padding: 0 0.5rem; }
/* a card of «گزارش مالی»: its count line is a line, not the card's filler — the table was pushed to the card's
   bottom by `.card p { flex: 1 }` («نمایش واریزی ها از بالا به پایین باشه») */
.fin-tile-project > p { flex: 0 0 auto; }

/* round 72: the sheet's cells — «عدد ۱ مثل عدد ۲ بالای علامت ضربدر قرار بگیره» (a narrow «۱» fitted beside the button, a
   wider «۲» wrapped under it: the number is a line of its own now), the column «شماره کارت» headed like the others (its
   head no longer wears the dashboard card head's class), «نوشته پیوست … در کادر خودش قرار بگیره», «نوع پیوست» whole */
.fin-entry-sheet .fin-item-no { display: block; line-height: 1.4; }
.fin-e-n .fin-item-drop { margin-top: 6px; }
.fin-entry-sheet col.fin-e-who { width: 10.4%; } .fin-entry-sheet col.fin-e-date { width: 8.6%; }
.fin-entry-sheet col.fin-e-bank { width: 5.8%; } .fin-entry-sheet col.fin-e-card { width: 10.6%; }
.fin-entry-sheet col.fin-e-sheba { width: 13.2%; } .fin-entry-sheet col.fin-e-amount { width: 8.8%; }
.fin-entry-sheet col.fin-e-proj { width: 8.8%; } .fin-entry-sheet col.fin-e-topic { width: 6.8%; }
.fin-entry-sheet col.fin-e-note { width: 8.6%; } .fin-entry-sheet col.fin-e-akind { width: 8%; }
.fin-entry-sheet col.fin-e-files { width: 7.2%; }
.fin-cell-drop .file-drop-pick { padding: 0 4px; font-size: 0.8rem; white-space: nowrap; min-width: 0; }
.fin-cell-drop .file-drop-pick svg { flex: 0 0 auto; }

/* round 73: the sheet's «توضیحات» cell wore the form note's rule (.fin-note: a block with 12px above), so its box sat a
   line lower than its neighbours — «خط اضافی بالای فیلد اختیاری رو حذف کن و فیلدش رو هم راستا با باقی فیلدها قرار بده» */
.fin-entry-sheet td.fin-note { display: table-cell; margin: 0; }

/* round 73, the owner's screenshot: "qarardad" cut short in the sheet's attachment-kind select - the native arrow takes
   about 24px and "fish/resid" 61px of text at 0.88rem; the column grows to 10.6% and the select's text steps to 0.82rem */
.fin-entry-sheet col.fin-e-who { width: 9.8%; } .fin-entry-sheet col.fin-e-date { width: 8.4%; }
.fin-entry-sheet col.fin-e-bank { width: 5.6%; } .fin-entry-sheet col.fin-e-card { width: 10.6%; }
.fin-entry-sheet col.fin-e-sheba { width: 13%; } .fin-entry-sheet col.fin-e-amount { width: 9%; }
.fin-entry-sheet col.fin-e-proj { width: 8.4%; } .fin-entry-sheet col.fin-e-topic { width: 6.4%; }
.fin-entry-sheet col.fin-e-note { width: 8%; } .fin-entry-sheet col.fin-e-akind { width: 10.6%; }
.fin-entry-sheet col.fin-e-files { width: 7%; }
.fin-entry-sheet td select { font-size: 0.82rem; }

/* round 74: «عرض فیلد نوع پیوست به همون اندازه قبلی برگرده» — the round-72 widths again; and the «هاله سفید» over the
   chosen word was the browser's own arrow box, painted over text that did not fit: the sheet's selects draw their own
   slim arrow instead (appearance none), the text keeps the rest of the box and ends in an ellipsis when it must */
.fin-entry-sheet col.fin-e-who { width: 10.4%; } .fin-entry-sheet col.fin-e-date { width: 8.6%; }
.fin-entry-sheet col.fin-e-bank { width: 5.8%; } .fin-entry-sheet col.fin-e-card { width: 10.6%; }
.fin-entry-sheet col.fin-e-sheba { width: 13.2%; } .fin-entry-sheet col.fin-e-amount { width: 8.8%; }
.fin-entry-sheet col.fin-e-proj { width: 8.8%; } .fin-entry-sheet col.fin-e-topic { width: 6.8%; }
.fin-entry-sheet col.fin-e-note { width: 8.6%; } .fin-entry-sheet col.fin-e-akind { width: 8%; }
.fin-entry-sheet col.fin-e-files { width: 7.2%; }
.fin-entry-sheet { --fin-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%231c1c22' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
html[data-theme="dark"] .fin-entry-sheet { --fin-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23e4e4ec' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fin-entry-sheet td select, .fin-entry-sheet td select:focus { -webkit-appearance: none; appearance: none;
    padding-inline: 5px 17px; background-image: var(--fin-chevron); background-repeat: no-repeat;
    background-position: left 4px center; background-size: 12px 12px; font-size: 0.82rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* «در فیلد توضیحات نوشته طولانی همه‌اش نمایش داده نمیشه، نوشته‌ها زیر هم قرار بگیرن تا همه نمایش داده بشه» */
.fin-entry-sheet td.fin-note textarea.fin-note-input { display: block; width: 100%; box-sizing: border-box; height: 36px;
    min-height: 36px; padding: 7px 8px; margin: 0; line-height: 1.45; font-size: 0.88rem; resize: none; overflow: hidden;
    white-space: pre-wrap; }
.fin-row-note { white-space: pre-line; }
/* the dark theme's own select rule (dark.css, form select) resets the background shorthand, arrow and all: say it again */
html[data-theme="dark"] .fin-entry-sheet td select, html[data-theme="dark"] .fin-entry-sheet td select:focus {
    background-image: var(--fin-chevron); background-repeat: no-repeat; background-position: left 4px center; background-size: 12px 12px; }

/* round 75: the list being prepared shows every column of the sheet — it scrolls sideways rather than crush them, a
   note keeps its lines, the pictures sit small as on the list sheet */
.fin-sheet.fin-draft { min-width: 1000px; }
.fin-sheet.fin-draft td.fin-c-note { white-space: pre-line; max-width: 16rem; }
.fin-sheet.fin-draft .fin-thumbs { justify-content: center; }

/* round 76: «وقتی فیلدها پر میشن موارد نوشته شده طولانی باشه کامل نشون نمیده» — the sheet's boxes are one-line
   textareas that wrap and grow with what is written (finance-form.js grow); figures break anywhere, left to right */
.fin-entry-sheet td textarea.fin-grow { display: block; width: 100%; box-sizing: border-box; height: 36px; min-height: 36px;
    padding: 7px 8px; margin: 0; line-height: 1.45; font-size: 0.88rem; resize: none; overflow: hidden; white-space: pre-wrap;
    overflow-wrap: anywhere; }
.fin-entry-sheet td textarea.fin-grow-ltr { direction: ltr; text-align: left; font-size: 0.78rem; word-break: break-all; }

/* round 77: «سرفصل» with its menu — the box wears a small arrow (a mask in the text colour, so both themes draw it), the
   menu lists «name — number» (static/js/topic-menu.js); the column takes a little of the sheba's room for the arrow */
.fin-entry-sheet col.fin-e-sheba { width: 11.6%; } .fin-entry-sheet col.fin-e-topic { width: 8.4%; }
.fin-topic-box { position: relative; display: block; }
.fin-topic-box::after { content: ""; position: absolute; left: 6px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
    background-color: var(--muted); pointer-events: none;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 12px;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 12px; }
.fin-topic-box > input.fin-topic-input, .fin-entry-sheet td .fin-topic-box > input.fin-topic-input { padding-inline: 6px 22px; cursor: pointer; }
/* seven figures beside the arrow in the narrowest sheet (1366): 0.82rem, the arrow's room trimmed (measured: 41px of 45) */
.fin-entry-sheet td .fin-topic-box > input.fin-topic-input { padding-inline: 4px 20px; font-size: 0.82rem; }
.fin-topics {
    position: absolute; z-index: 60; max-height: 340px; overflow-y: auto; padding: 6px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    box-shadow: 0 12px 32px rgba(17, 17, 26, 0.16);
}
.fin-topics-head { padding: 6px 10px 6px; color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.fin-topic { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: 0.88rem;
    text-align: start; cursor: pointer; }
.fin-topic + .fin-topic { margin-top: 2px; }
.fin-topic-code { color: var(--muted); font-size: 0.84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-topic.is-added { justify-content: flex-end; }
.fin-topic.is-added .fin-topic-code { color: var(--text); }
.fin-topic:hover, .fin-topic.is-active, .fin-topic:focus-visible { background: var(--accent-soft); color: var(--accent-ink); }
.fin-topic:hover .fin-topic-code, .fin-topic.is-active .fin-topic-code { color: var(--accent-ink); }
.fin-topic-add { margin-top: 6px; border-top: 1px solid var(--border-soft); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    color: var(--accent-ink); font-weight: 600; }
.fin-next-number { display: block; margin-top: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 400; }
/* round 77: «ثبت سند پرداختی» is longer — on the phone the finance tabs stay one row (they wrapped «گزارش مالی» under) */
@media (max-width: 480px) {
    .fin-tabs-desk { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .fin-tabs-desk .tab { padding: 0.65rem 0.6rem; font-size: 0.98rem; white-space: nowrap; flex: 0 0 auto; }
}

/* round 78: the buyer's list-number filter — the box and «خروجی PDF» on one line, the list under them */
.fin-lookup-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.fin-lookup-bar label { flex: 0 1 220px; margin: 0; }
.fin-lookup-bar .btn { min-height: 2.6rem; }
.fin-lookup-bar .btn.is-off { opacity: 0.45; pointer-events: auto; cursor: not-allowed; }
.fin-lookup-pdf-note { align-self: center; font-size: 0.8rem; }
.fin-lookup-result:not(:empty) { margin-top: 20px; }
.fin-lookup-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fin-lookup-head .act-btn { margin-inline-start: auto; }
.fin-lookup-none { margin: 0; }
.fin-sheet.fin-lookup-rows .fin-row-refused td { opacity: 0.55; }
/* «اصلاح و ارسال دوباره»: the sheet in the row page's card */
.fin-edit-sheet { margin-bottom: 12px; }
/* the rows of «لیست در حال تهیه» and of the filter: a name reads whole words, a date and a «سرفصل» one line */
.fin-sheet.fin-draft { min-width: 1080px; }
.fin-sheet.fin-draft td.fin-c-who { min-width: 8.5rem; overflow-wrap: normal; word-break: normal; }
.fin-sheet.fin-draft td.nowrap { white-space: nowrap; }
.fin-lookup-bar input { min-width: 0; }

/* round 79: the director's three cards on «داشبورد مالی»; «لیست‌های باز» opens on two panels, the steps unit by unit */
.fin-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 840px; }
@media (max-width: 640px) { .fin-cards-3 { grid-template-columns: minmax(0, 1fr); } }
.fin-open-sub { font-size: 0.82rem; font-weight: 400; margin-inline-start: 8px; }
.fin-open-step + .fin-open-step { margin-top: 20px; }
.fin-decided td .chip { white-space: nowrap; }

/* round 80: «پرداخت شد» / «پرداخت نشد» on the row, the payment card as a window, «ویرایش» after payment */
.fin-sheet .fin-c-paycol { width: 9.4%; }
.fin-pay-acts { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.fin-pay-acts .fin-pay-yes { width: 100%; justify-content: center; }
.fin-pay-acts .fin-unpaid summary { width: 100%; box-sizing: border-box; text-align: center; }
.fin-unpay { margin-top: 6px; }
.fin-unpay summary { width: 100%; box-sizing: border-box; text-align: center; }
.fin-pay-dialog { width: min(720px, calc(100vw - 32px)); padding: 0; overflow-x: hidden; overflow-y: auto; }
.fin-pay-dialog h2 { margin: 0; padding: 18px 20px 6px; color: var(--text); }
.fin-pay-dialog .fin-pay-dialog-row { margin: 0; padding: 0 20px 6px; color: var(--muted); font-size: 0.88rem; }
.fin-pay-dialog .fin-pay-dialog-body { padding: 8px 20px 20px; }
.fin-pay-dialog .form-actions { margin-top: 12px; }

/* round 81: the slips in the pay cell, «ویرایش» / «تبدیل به پرداخت‌نشده» under them; the payment's window with its slips;
   the project manager's contract form on «تأیید قراردادها» */
.fin-sheet .fin-c-paycol { width: 10.4%; }
.fin-sheet .fin-c-paycol .fin-slips { justify-content: center; margin-top: 8px; }
.fin-sheet .fin-c-paycol .fin-slips .fin-thumb { width: 46px; height: 46px; }
.fin-sheet .fin-c-paycol .fin-slips + .fin-pay-acts { margin-top: 8px; }
.fin-pay-acts .fin-pay-edit { width: 100%; box-sizing: border-box; justify-content: center; }
.fin-pay-word { color: var(--muted); }
.fin-slip-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.fin-slip-list .fin-files-cap { flex-basis: 100%; }
.fin-slip-list .file-drop-card { position: relative; }
.fin-review-new { margin-bottom: 20px; }
.fin-review-new .form-actions .muted { align-self: center; font-size: 0.82rem; }

/* round 82: the finance manager's sheet at the payment step says which rows it shows, the rest one click away */
.fin-rows-view { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 0 0 20px; padding: 10px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius);
    background: var(--surface); color: var(--muted); font-size: 0.86rem; }
.fin-rows-view .act-btn { white-space: nowrap; }

/* ══ round 83: the phone, page by page ═══════════════════════════════════════════════════════════════════════════
   «در نسخه موبایل خیلی از بخش های سامانه ریسپانسیو نیست … مدیر مالی در نسخه موبایل نمیتونه ثبت پرداخت انجام بده».
   Every page, as fourteen seats, opened in a phone's frame (390px, touch, a phone's browser) and measured
   (local-data/mobile_audit.py). The finance manager's phone is an iPhone on iOS 15: its Safari shows 553px of page,
   and it reads neither container queries nor colour mixes — each has its plain fallback here. */

/* a window is never taller than the screen; what does not fit scrolls inside it. The payment window (704px) stood
   under an iPhone 8's screen: its slip and «ثبت پرداخت» were out of reach, and the window did not scroll. */
dialog[open] { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); -webkit-overflow-scrolling: touch; }
.fin-pay-dialog[open], .fin-twins[open] { overflow-y: auto; }
@media (max-width: 640px) {
    .fin-pay-dialog { width: calc(100vw - 16px); max-width: none; }
    .fin-pay-dialog h2 { padding: 16px 16px 4px; }
    .fin-pay-dialog .fin-pay-dialog-row { padding: 0 16px 4px; }
    .fin-pay-dialog .fin-pay-dialog-body { padding: 4px 16px 16px; }
    .fin-pay-dialog .crm-two > label { margin-top: 10px; }
    .fin-pay-dialog .file-drop-zone { padding: 12px; }
    /* «ثبت پرداخت» stays in sight at the window's foot while the form above it scrolls */
    .fin-pay-dialog .form-actions { position: sticky; bottom: 0; margin: 12px -16px -16px; padding: 12px 16px 16px;
        background: var(--surface); border-top: 1px solid var(--border-soft); display: flex; gap: 12px; }
    .fin-pay-dialog .fin-files-field { margin-top: 12px; }
    .fin-pay-dialog .form-actions .btn { flex: 1 1 0; justify-content: center; }
}

/* the plan's title, start date and print buttons live in its table's header — which a phone keeps for screen readers
   alone (cards): there they stand above the cards, the columns' names still hidden */
@media screen and (max-width: 700px) {
    .plan-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal;
        display: block; }
    .plan-table thead tr { display: block; background: none; border: 0; box-shadow: none; margin: 0; padding: 0; }
    .plan-table thead tr:not(.plan-title-row):not(.plan-tools-row) { position: absolute; width: 1px; height: 1px;
        overflow: hidden; clip-path: inset(50%); }
    .plan-table thead th { display: block; width: auto; border: 0; padding: 0 0 12px; text-align: start; background: none; }
    .plan-table .plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
    .plan-table .plan-tools .jalali-picker { flex: 1 1 180px; min-width: 0; }
    .plan-table .plan-tools .btn { flex: 1 1 auto; justify-content: center; }
    .plan-table .plan-tools-note { flex: 1 0 100%; white-space: normal; }
    /* each day a card: its boxes across the card, not the desktop's column widths, and no ruled box around each */
    .plan-table tbody td, .plan-table tbody td.plan-num, .plan-table tbody td.plan-actions, .plan-table tbody td.plan-day {
        width: auto !important; text-align: start !important; padding-inline: 0 !important; }
    .plan-table-ruled tbody td, html[data-theme="dark"] .plan-table-ruled tbody td { border: 0;
        border-block-end: 1px solid var(--border-soft); }
    .plan-table tbody td:last-child { border-block-end: 0; }
}

/* iOS 15 reads no container query: the cartable's rows and the personnel list stack by the screen's width there */
@media (max-width: 760px) {
    .letter-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 0.55rem; }
    .letter-sender { width: auto; min-width: 0; }
    .letter-sender-name { display: block; }
    .letter-sender-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; min-width: 0; }
    .letter-subject { overflow-wrap: anywhere; line-height: 1.7; }
    .letter-tags:empty { display: none; }
    .letter-side { flex-wrap: wrap; gap: 0.45rem 0.8rem; }
    .letter-side .inline-form { margin-inline-start: auto; }
}
@media (max-width: 860px) {
    .perf-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "who band" "score score" "parts parts" "trend next";
        gap: 0.5rem 0.75rem;
    }
    .perf-who { grid-area: who; }
    .perf-band { grid-area: band; }
    .perf-score { grid-area: score; }
    .perf-parts { grid-area: parts; }
    .perf-trend { grid-area: trend; }
    .perf-next { grid-area: next; }
}
@media (max-width: 540px) {
    .band-wrap .band-legend { display: grid; grid-template-columns: repeat(3, max-content); justify-content: space-between;
        gap: 0.45rem 0.9rem; }
}

/* «ثبت سند پرداختی» on a phone: the twelve-column sheet (1000px, scrolled sideways inside its card, half its boxes out of
   sight and out of reach) becomes a card a row — each box under its own name, two short ones side by side, the long ones
   across; a box a kind does not ask for is not drawn */
@media screen and (max-width: 700px) {
    .fin-entry-wrap { overflow: visible; }
    .fin-entry-sheet { display: block; min-width: 0; width: 100%; table-layout: auto; border: 0; font-size: 1rem; }
    .fin-entry-sheet colgroup { display: none; }
    .fin-entry-sheet tbody.fin-item { display: block; margin: 0 0 12px; padding: 4px 14px 14px; background: var(--surface);
        border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
    /* round 112b: rows of flex, not a grid on a <tr> — an iPhone (iOS 26) froze on this card; the same two-by-two cards */
    .fin-entry-sheet tbody.fin-item tr.fin-entry, .fin-entry-sheet tbody.fin-item tr.fin-entry-more {
        display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 12px; row-gap: 0; margin: 0; padding: 0;
        border: 0; border-radius: 0; box-shadow: none; background: none; }
    .fin-entry-sheet tr.fin-entry > td, .fin-entry-sheet tr.fin-entry-more > td {
        display: block; flex: 0 0 100%; width: 100%; max-width: 100%; min-width: 0; border: 0; padding: 10px 0 0;
        text-align: start; vertical-align: top; box-sizing: border-box; }
    .fin-entry-sheet tbody.fin-item + tbody.fin-item tr.fin-entry td { border-top-width: 0; }
    .fin-entry-sheet tr.fin-entry > td[data-label]::before { display: block; margin: 0 0 6px; font-size: 0.82rem; }
    /* the short boxes two by two: date and bank, amount and project, «سرفصل» and «نوع پیوست» */
    .fin-entry-sheet tr.fin-entry > td:nth-child(3), .fin-entry-sheet tr.fin-entry > td:nth-child(4),
    .fin-entry-sheet tr.fin-entry > td:nth-child(7), .fin-entry-sheet tr.fin-entry > td:nth-child(8),
    .fin-entry-sheet tr.fin-entry > td:nth-child(9), .fin-entry-sheet tr.fin-entry > td:nth-child(11) {
        flex: 0 0 calc(50% - 6px); width: calc(50% - 6px); max-width: calc(50% - 6px); }
    .fin-entry-sheet tr.fin-entry > td:nth-child(11) { order: 10; }
    .fin-entry-sheet tr.fin-entry > td:nth-child(10) { order: 11; }
    .fin-entry-sheet tr.fin-entry > td:nth-child(12) { order: 12; }
    /* the row's number and its «✕» on the card's first line */
    .fin-entry-sheet tr.fin-entry > td.fin-e-n { display: flex; flex: 0 0 100%; align-items: center; gap: 8px; padding: 8px 0 10px;
        border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
    .fin-entry-sheet tr.fin-entry > td.fin-e-n::before { display: inline; margin: 0; }
    .fin-entry-sheet td.fin-e-n .fin-item-no { display: inline; }
    .fin-entry-sheet td.fin-e-n .fin-item-drop { margin: 0 auto 0 0; min-height: 36px; padding: 0 12px; }
    .fin-entry-sheet td.fin-note { display: block; }
    .fin-entry-sheet tr.fin-entry > td.fin-cell-off, .fin-entry-sheet tr.fin-entry-more > td.fin-cell-off { display: none; }
    .fin-entry-sheet td.fin-e-stack .fin-cell-field + .fin-cell-field { margin-top: 0; }
    .fin-entry-sheet input, .fin-entry-sheet select, .fin-entry-sheet td textarea.fin-grow,
    .fin-entry-sheet td.fin-note textarea.fin-note-input, .fin-entry-sheet .jalali-picker .jp-display {
        height: 44px; min-height: 44px; font-size: 16px; }
    .fin-entry-sheet td textarea.fin-grow-ltr { font-size: 16px; }
    .fin-entry-sheet .fin-cell-drop .file-drop-zone { justify-content: stretch; min-height: 0; padding: 0; border: 0; background: none; }
    .fin-entry-sheet .fin-cell-drop .file-drop-pick { width: 100%; justify-content: center; min-height: 44px; }
    .fin-entry-sheet td.fin-e-files .fin-files-need { margin-top: 6px; }
    .fin-sheet-top { gap: 12px; }
    .fin-sheet-top label { flex: 1 1 100%; }
    /* the sheets of rows already written: cards, not 1000px tables (a later rule pinned them wide again) */
    .fin-sheet.fin-draft, .fin-office-sheet { min-width: 0; }
}

/* an iPhone zooms the page into any box written smaller than 16px the moment it is touched — and stays zoomed, the page
   then wider than the screen; on a phone every box is written at 16px */
@media screen and (max-width: 700px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
    select, textarea { font-size: 16px !important; }
}

/* the cartable's labels: the panel opens inside the screen, its edit forms across it */
@media (max-width: 560px) {
    .letter-filter-row > .label-menu { position: static; }
    .letter-filter-row > .label-menu > .label-panel { position: absolute; inset-inline: 8px; width: auto; max-width: none; }
    .label-panel .label-form { flex-wrap: wrap; }
    .label-panel .label-form input[type="text"], .label-panel .label-form select { flex: 1 1 100%; min-width: 0; }
}

/* «ثبت سند»'s rows waiting for a voucher: on a phone the header is for screen readers alone — its «انتخاب همه» box
   stays in sight above the cards */
@media screen and (max-width: 700px) {
    .fin-pending thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; display: block; }
    .fin-pending thead tr { display: block; margin: 0 0 12px; padding: 0; border: 0; box-shadow: none; background: none; }
    .fin-pending thead th { display: none; }
    .fin-pending thead th.fin-c-n { display: flex; align-items: center; gap: 8px; width: auto; padding: 0 4px; border: 0;
        background: none; font-size: 0.9rem; font-weight: 600; color: var(--text); }
    .fin-pending thead th.fin-c-n::after { content: "انتخاب همه"; }
    .fin-pending thead th.fin-c-n input { width: 20px; height: 20px; margin: 0; }
}

/* a card's line holding a picture (a slip, a scan) — its name stands level with the picture, not under it */
@media screen and (max-width: 700px) {
    .table td:has(> .fin-thumbs, > .fin-thumb, > a > img, > img) { align-items: center; }
}

/* ══ دور ۸۵ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   ۲ آبان ۱۴۰۵ — the owner's seven screenshots, on the desk and on the phone alike. */

/* «فیلد بله کوچک و به اندازه باقی فیلدها در بخش خودش باشه»: a card of a report holding one short field (the technical
   office's «آیا گزارش سرپرستان کارگاه چک شده است؟») gave it the whole width; it takes one column, as the cards beside it
   do — and on a phone, where one column is the whole width, nothing changes */
.field-grid.is-lone { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* «کارهای مهم فردا»: a table of one column has no heading row any more (form_fill.html); the panel's pull-up of its
   table (-0.4rem, made for a heading row) would set the first box on the note — it keeps 12px under the note */
.panel-body > .table-wrap.is-one-col { margin-top: 0.4rem; }
@media (max-width: 700px) {
    .panel-body > .table-wrap.is-one-col { margin-top: 12px; }
}

/* «فیلد پروژه با خط زیریش فاصله داشته باشه»: the edit window's foot is sticky inside a form padded 1.35rem at its foot,
   and stuck that much above where it belongs — over «پروژه | دسته‌بندی». Round 38 said «bottom: -1.35rem», but the ids in
   style.css's :is(#quick-task, .qt-editing) outweighed it; said here with an id's weight. The field keeps the form's
   20px above the foot's line. */
.qt-editing .qt-form > .qt-foot:not(#k-none) { bottom: -1.35rem; }
@media (max-width: 700px) {
    .qt-editing .qt-form > .qt-foot:not(#k-none) { bottom: -1rem; }
}

/* «فیلدی که داخلش ذره بین هست کادر در کادر شده یک کادر داشته باشه»: the people search of «تأیید نهایی با» and «مسئول
   انجام» — its frame (the label) lights up on focus, and the box inside drew the portal's keyboard ring too
   (interactions.css, !important). The frame is the one box. */
label.qt-find-wrap input.qt-find:not(#k-none):not(#k-none-2),
label.qt-find-wrap input.qt-find:not(#k-none):not(#k-none-2):focus-visible,
label.qt-find-wrap input.qt-find:not(#k-none):not(#k-none-2):focus {
    outline: none !important; box-shadow: none !important; border: 0 !important; border-radius: 0 !important;
    background: transparent !important;
}
label.qt-find-wrap:has(input:focus-visible) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* «دکمه ارجاع به دیگران هم اندازه دکمه پاسخ به نامه باشه»: both are small buttons now (letter_detail.html), each a
   summary drawn the same way */
.refer-box > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.refer-box > summary::-webkit-details-marker { display: none; }
.reply-box > summary.btn, .refer-box > summary.btn, .refer-box > button.refer-open.btn { min-width: 8.5rem; justify-content: center; box-sizing: border-box; }

/* «فیلد تاریخ آشنایی با فیلد نوع تماس همتراز باشه»: in «ثبت لید»'s row of three the boxes stand level at their top; the
   word under «نوع تماس» hangs below its box rather than lifting it above «تاریخ آشنایی (تماس)» */
.crm-two.crm-row-top > label { justify-content: flex-start; }

/* ══ دور ۸۶ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   ۲ آبان ۱۴۰۵ — the finance lists' week (send شنبه/دوشنبه/چهارشنبه, pay the day after), their delays, the technical
   unit's corrections, «تأیید» with an optional word, the internal manager's lists kept to the finance manager and the
   director. */

/* «تأیید» opens a box for a word, as «عدم تأیید» does — the same drawer, the agreeing colour */
.fin-yes > summary { list-style: none; }
.fin-yes > summary::-webkit-details-marker { display: none; }
.fin-yes[open] > summary { opacity: 0.85; }
.fin-ok-word { display: block; margin-top: 4px; color: var(--green-deep); font-size: 0.78rem; font-weight: 400;
    white-space: normal; overflow-wrap: anywhere; }
.fin-contract-ok {
    margin: 8px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(29, 122, 76, 0.08);
    color: var(--green-deep); font-size: 0.88rem;
}
html[data-theme="dark"] .fin-contract-ok { background: rgba(110, 231, 160, 0.1); color: #7fd8a4; }
html[data-theme="dark"] .fin-ok-word { color: #7fd8a4; }
.fin-review-yes > summary { list-style: none; cursor: pointer; }
.fin-review-yes > summary::-webkit-details-marker { display: none; }

/* the technical unit's «ویرایش ردیف», the finance manager's «ویرایش توضیحات», and the mark of a row changed after it
   was sent */
.fin-sheet .fin-c-desc .fin-row-amend, .fin-sheet .fin-c-desc .fin-note-edit { margin-top: 8px; }
.fin-row-amend { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
/* the description column is narrow: its buttons wrap their words inside it, never past its edge */
.fin-sheet .fin-c-desc .fin-row-amend, .fin-sheet .fin-c-desc .fin-note-edit > summary {
    max-width: 100%; box-sizing: border-box; white-space: normal; height: auto; min-height: 30px; padding: 4px 8px;
    font-size: 0.78rem; line-height: 1.4; text-align: center; }
.fin-row-amended { display: block; margin-top: 4px; font-size: 0.76rem; font-weight: 500; color: var(--blue-deep, #1c5fb4); }
html[data-theme="dark"] .fin-row-amended { color: #8ab8f5; }
.fin-note-edit > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fin-note-edit > summary::-webkit-details-marker { display: none; }
.fin-note-edit form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; min-width: 180px; }
.fin-note-edit textarea { width: 100%; box-sizing: border-box; min-height: 4.2rem; font-size: 0.84rem; }
.fin-note-edit .btn { align-self: center; }

/* a list's hours, at its end */
.fin-timing { margin-top: 20px; }
.fin-timing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fin-timing-table td, .fin-timing-table th { white-space: normal; }
.fin-timing-table .nowrap { white-space: nowrap; }
.fin-timing-pay { margin: 12px 0 0; font-size: 0.86rem; }
.fin-timing-none { margin: 20px 0 0; font-size: 0.86rem; }
.fin-delay { white-space: nowrap; }

/* under a card's count: the lists that came in their hours, and those that came late */
.fin-late-split { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; flex-basis: 100%; margin-top: 2px; }
.fin-count-dot { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 700; color: #fff; white-space: nowrap; }
.fin-count-dot.is-green { background: #1d7a4c; }
.fin-count-dot.is-red { background: #b8392a; }

/* «لیست‌های باز»: each step's lists waiting, agreed to, refused */
.fin-open-step { padding-bottom: 4px; }
.fin-open-step + .fin-open-step { padding-top: 20px; border-top: 1px solid var(--border-soft); }
.fin-open-part + .fin-open-part { margin-top: 12px; }
.fin-open-part-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.9rem; font-weight: 700; }
.fin-open-agreed .fin-open-part-head { color: var(--green-deep); }
.fin-open-refused .fin-open-part-head { color: var(--red-deep); }
html[data-theme="dark"] .fin-open-agreed .fin-open-part-head { color: #7fd8a4; }
.fin-open-part > .muted { margin: 0; font-size: 0.86rem; }
@media (max-width: 700px) {
    .fin-timing-head { flex-direction: column; align-items: flex-start; }
    .fin-note-edit form { min-width: 0; }
}

/* ══ دور ۸۷ ══════════════════════════════════════════════════════════════════════════════════════════════════════
   ۲ آبان ۱۴۰۵ — «ثبت سند پرداختی» with its two cards, the contracts and their payments on every seat's page, the
   contractor's payments before a payment, the writer's × on a picture, the paid lists in blue, the sheet's round ✕. */

/* «لیست مالی» and «تنخواه», the site supervisor's and the project manager's two cards */
.fin-entry-cards { margin-bottom: 20px; }
.fin-entry-cards .stat-tile-cap { display: inline-flex; align-items: center; gap: 6px; }
.fin-entry-body { scroll-margin-top: 96px; }
.fin-petty-sub { margin: 0 0 12px; font-size: 0.88rem; }

/* «بالای هر عکسی که ارسال میکنه یک علامت ضربدر» — a small red disc on the picture's upper corner */
.fin-thumb-cell { position: relative; display: inline-flex; }
.fin-thumb-drop { position: absolute; top: -7px; inset-inline-start: -7px; z-index: 2; margin: 0; }
.fin-thumb-x {
    display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 2px solid var(--surface);
    border-radius: 50%; background: #b8392a; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 3px rgba(20, 20, 30, 0.3); transition: transform 0.25s ease, background 0.15s;
}
.fin-thumb-x:hover, .fin-thumb-x:focus-visible { background: #8f2a1f; transform: rotate(90deg); }
.fin-file-row { position: relative; }
.fin-file-row > .fin-thumb-drop { top: 2px; inset-inline-start: 2px; }
@media (max-width: 700px) {
    .fin-thumb-x { width: 24px; height: 24px; font-size: 15px; }
}

/* the writer's view of a list (its «حذف» column) left «توضیحات» and «مبلغ» 42px wide — a word a letter a line, and
   no room for a picture's ×: a reader's «پرداخت» column (a chip and a slip) and the writer's decision columns give
   way, the two columns that size to what is left get it */
.fin-sheet.is-reader .fin-c-paycol { width: 6.6%; }
.fin-sheet.has-del .fin-c-ok { width: 5.4%; }
.fin-sheet.has-del .fin-c-del { width: 4.8rem; }

/* the paid lists not looked at yet — blue, as the finance section's count is */
.fin-count-dot.is-blue { background: #1c5fb4; }
.fin-sheet .fin-count-dot, .fin-lists .fin-count-dot { font-size: 0.76rem; padding: 1px 8px; vertical-align: middle; }

/* a contract's payments, on every seat's page */
.fin-contract-pays { margin-top: 8px; }
.fin-contract-pays > summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--accent-ink, var(--accent)); }
.fin-contract-pays > .table-wrap, .fin-contract-pays > p { margin-top: 8px; }
.fin-contract-debt { margin-top: 8px; }

/* the contractor's payments before this one, in the payment's window */
.fin-pay-prior { margin: 0 0 12px; padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
    background: var(--bg); }
.fin-pay-prior[hidden] { display: none; }
.fin-prior-cap { display: block; margin-bottom: 6px; font-size: 0.92rem; }
.fin-prior-contract { margin: 0 0 8px; font-size: 0.86rem; line-height: 1.8; }
.fin-pay-prior .table-wrap { max-height: 220px; overflow-y: auto; }
.fin-prior-table td, .fin-prior-table th { font-size: 0.84rem; }

/* «زیر عددهای ردیف یک علامت ضربدر داره، در فرم دایره قرار بگیره و وقتی موس روش قرار بگیره حالت چرخشی داشته باشه» */
.fin-e-n .fin-item-drop {
    display: inline-grid; place-items: center; width: 26px; height: 26px; min-width: 26px; min-height: 0; padding: 0;
    margin-top: 6px; border-radius: 50%; font-size: 0.8rem; line-height: 1; transition: transform 0.35s ease, background 0.15s;
}
.fin-e-n .fin-item-drop[hidden] { display: none; }
.fin-e-n .fin-item-drop:hover, .fin-e-n .fin-item-drop:focus-visible { transform: rotate(180deg); }
/* round 88: «چرخش نداره و ضربدر وسط دایره قرار بگیره» — interactions.css stills every button on hover
   (transform: none !important); the turn is said with an id's weight. The ✕ is an icon now, drawn at the disc's
   centre (a font's ✕ sat off it by its own metrics) */
.fin-e-n .fin-item-drop:not(#k-none):not(#k-none-2):hover,
.fin-e-n .fin-item-drop:not(#k-none):not(#k-none-2):focus-visible { transform: rotate(180deg) !important; }
.fin-e-n .fin-item-drop .icn { display: block; width: 14px; height: 14px; margin: 0; }
.fin-e-n .fin-item-drop:not(#k-none):not(#k-none-2),
.fin-thumb-x:not(#k-none):not(#k-none-2) {
    transition: transform 0.35s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}
.fin-thumb-x:not(#k-none):not(#k-none-2):hover,
.fin-thumb-x:not(#k-none):not(#k-none-2):focus-visible { transform: rotate(90deg) !important; }
@media (prefers-reduced-motion: reduce) {
    .fin-e-n .fin-item-drop:not(#k-none):not(#k-none-2), .fin-thumb-x:not(#k-none):not(#k-none-2) { transition: none !important; }
}
@media (max-width: 700px) {
    .fin-entry-sheet td.fin-e-n .fin-item-drop { width: 32px; height: 32px; min-width: 32px; min-height: 0; padding: 0; }
}

/* round 88: «وقتی در گفت و گو عکس یا فیلمی فرستاده میشه و روش کلیک میشه پاپ آپ باز بشه و در اون پاپ آپ زیر عکس یا فیلم
   امکان زوم، ذخیره و اسکرول کردن به طرفین ... هم در نسخه دسکتاپ هم موبایل» — the conversation's window
   (static/js/chat-gallery.js): the picture on a dark ground, its tools under it, every item of the talk in a strip */
.bubble-video-wrap { position: relative; display: block; width: min(340px, 100%); margin-top: 0.35rem; }
.bubble-video-wrap > .bubble-video { width: 100%; margin-top: 0; }
.media-item > .bubble-video-wrap { margin-top: 0.35rem; }
.bubble-video-wrap > .bubble-video { aspect-ratio: 16 / 9; object-fit: contain; }
.media-play:not(#k-none):not(#k-none-2) {
    position: absolute; inset: 0; display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; margin: 0;
    padding: 0; border: 0; border-radius: 12px; background: transparent; color: #fff; cursor: pointer; box-shadow: none;
}
.media-play-disc {
    display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, 0.55);
    transition: background-color 0.15s ease;
}
.media-play-disc .icn { display: block; margin: 0; }
.media-play:not(#k-none):not(#k-none-2):hover .media-play-disc,
.media-play:not(#k-none):not(#k-none-2):focus-visible .media-play-disc { background: rgba(0, 0, 0, 0.78); }
.bubble-media[data-gallery-item] { cursor: zoom-in; }

html.cg-on, html.cg-on body { overflow: hidden; }
/* the scroll bar's kept place (html { scrollbar-gutter: stable } at the top) is a 15px band the whole-screen window cannot paint */
html.cg-on:not(#k-none) { scrollbar-gutter: auto; }
/* the whole screen: from the left edge (a page that keeps its scroll bar's place would otherwise push a right-to-left
   window 15px off it), and as tall as the screen (every other window stops 16px short: dialog[open] at the end) */
.chat-gallery {
    position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: 100vw; max-width: 100vw; height: 100%; margin: 0;
    padding: 0; border: 0; border-radius: 0; background: #111114; color: #fff; overflow: hidden;
}
.chat-gallery[open] { display: flex; flex-direction: column; max-height: none; }
.chat-gallery::backdrop { background: rgba(0, 0, 0, 0.85); }
@supports (height: 100dvh) { .chat-gallery { height: 100dvh; } }
.cg-head {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px; padding-top: max(12px, env(safe-area-inset-top));
    flex-shrink: 0; min-height: 56px;
}
.cg-count { flex-shrink: 0; font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cg-name {
    flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.72); text-align: start;
}
.chat-gallery .cg-btn:not(#k-none):not(#k-none-2) {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px;
    min-height: 0; margin: 0; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px;
    background: rgba(255, 255, 255, 0.08); color: #fff; font: inherit; font-size: 0.9rem; line-height: 1;
    text-decoration: none; cursor: pointer; box-shadow: none;
}
.chat-gallery .cg-btn:not(#k-none):not(#k-none-2):hover { background: rgba(255, 255, 255, 0.18); }
.chat-gallery .cg-btn:not(#k-none):not(#k-none-2):disabled { opacity: 0.4; cursor: default; background: rgba(255, 255, 255, 0.08); }
.chat-gallery .cg-btn .icn { display: block; flex-shrink: 0; margin: 0; }
.chat-gallery .cg-close:not(#k-none):not(#k-none-2) { width: 40px; padding: 0; flex-shrink: 0; }
.cg-stage {
    position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 0 64px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.cg-frame { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; pointer-events: none; }
.cg-media {
    display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center;
    pointer-events: auto; -webkit-user-drag: none; border-radius: 6px;
}
img.cg-media { cursor: zoom-in; }
.cg-stage.is-zoomed img.cg-media { cursor: grab; }
video.cg-media { background: #000; }
.chat-gallery .cg-side:not(#k-none):not(#k-none-2) {
    position: absolute; top: 50%; width: 44px; height: 44px; padding: 0; margin-top: -22px; z-index: 2;
    background: rgba(0, 0, 0, 0.45);
}
.chat-gallery .cg-prev { right: 12px; }
.chat-gallery .cg-next { left: 12px; }
.chat-gallery .cg-side[hidden] { display: none !important; }
.cg-tools {
    display: flex; align-items: center; justify-content: center; flex-wrap: nowrap; gap: 12px; padding: 12px 16px 0;
    flex-shrink: 0;
}
.cg-level { min-width: 52px; text-align: center; font-size: 0.92rem; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.85); }
.chat-gallery .cg-save:not(#k-none):not(#k-none-2) { background: var(--accent, #4f46e5); border-color: transparent; color: #fff; padding: 0 16px; }
.chat-gallery .cg-save:not(#k-none):not(#k-none-2):hover { background: var(--accent-deep, #352c99); }
.cg-strip {
    display: flex; gap: 8px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); flex-shrink: 0;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.chat-gallery .cg-thumb:not(#k-none):not(#k-none-2) {
    flex: 0 0 auto; display: grid; place-items: center; width: 64px; height: 64px; min-height: 0; margin: 0; padding: 0;
    border: 2px solid transparent; border-radius: 10px; background: #2a2a31; color: #fff; overflow: hidden;
    cursor: pointer; opacity: 0.6; scroll-snap-align: center; box-shadow: none;
}
.chat-gallery .cg-thumb:not(#k-none):not(#k-none-2):hover { opacity: 0.9; }
.chat-gallery .cg-thumb.is-on:not(#k-none):not(#k-none-2) { border-color: #fff; opacity: 1; }
.cg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cg-thumb .icn { margin: 0; }
@media (max-width: 700px) {
    .cg-head { padding-inline: 12px; }
    .cg-stage { padding: 0; }
    .chat-gallery .cg-side:not(#k-none):not(#k-none-2) { width: 40px; height: 40px; margin-top: -20px; }
    .chat-gallery .cg-prev { right: 8px; }
    .chat-gallery .cg-next { left: 8px; }
    .cg-tools { gap: 8px; padding-inline: 12px; }
    .chat-gallery .cg-fit .cg-btn-word { display: none; }
    .chat-gallery .cg-fit:not(#k-none):not(#k-none-2) { width: 40px; padding: 0; }
    .cg-level { min-width: 44px; }
    .cg-strip { padding-inline: 12px; }
    .chat-gallery .cg-thumb:not(#k-none):not(#k-none-2) { width: 56px; height: 56px; }
}
@supports (height: 100dvh) {
    @media (max-width: 700px) {
        .peek-dialog, .peek { max-height: calc(100dvh - 32px); }
    }
}

/* round 91: «در نسخه موبایل عدد اعلان خارج از کادر هست، ذره‌بین وسط کادر خودش نیست و لوگو و دکمه جست‌وجو در یک خط
   نیستن». Measured at 390px: the count's top at -1px (cut by the screen's edge) and 8px out past the bell; the magnifier
   2.7px off its circle's middle; the logo's middle 10px under the circles' row, because each circle carries its word
   under it and the bar centres the whole column. */
@media (max-width: 480px) {
    /* the logo and the menu button take the same word-high room under them as the circles: one middle line for all */
    .topbar .topbar-toggle, .topbar .brand-phone { margin-bottom: calc(4px + 0.96rem); }
    .topbar form.topbar-search:not(:focus-within) .search-mark {
        inset-inline-start: auto; left: 50%; right: auto; transform: translateX(-50%);
    }
    .topbar .bell-count { top: -3px; inset-inline-end: -5px; }
}

/* round 91: «در تقویم وظایف، وظایف نخست امور نخست همیشه رنگش سبز باشه و وظیفه‌های دیگه رنگشون نارنجی یا آبی باشه هر
   کدوم زیبایی بهتری داره». Two colours only: green for «نخست امور نخست» — starred, or carrying that label, which left it
   orange before (its priority stayed «ضروری») — and a calm blue for every other task, which reads apart from the green
   better than orange does beside the red of what is late. The id weight outranks every priority rule above. */
.calendar-task:not(#k-none) { --cal-edge: #2563eb; --cal-tint: #e9f0fe; }
.calendar-task.is-first:not(#k-none) { --cal-edge: #1d7a4c; --cal-tint: #e7f4ec; box-shadow: none; }
html[data-theme="dark"] .calendar-task:not(#k-none) { --cal-edge: #5b8def; --cal-tint: #1a2744; }
html[data-theme="dark"] .calendar-task.is-first:not(#k-none) { --cal-edge: #2f9e66; --cal-tint: #1b3b28; }
@media (max-width: 700px) {
    /* the phone's day list showed every card white with a grey edge: the colour comes back to its edge */
    .cal-day-list .calendar-task:not(#k-none) { border-inline-start-color: var(--cal-edge); background: var(--cal-tint); }
    html[data-theme="dark"] .cal-day-list .calendar-task:not(#k-none) { background: var(--cal-tint); }
}

/* round 91: a leave slip's or an advance's month, beside the one being decided */
.month-tally { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.month-tally .sub-head { margin: 0 0 8px; }
.month-tally-none { margin: 0; }
.month-tally-rows { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.month-tally-rows > div { display: flex; align-items: baseline; gap: 8px; }
.month-tally-rows dt { font-weight: 700; color: var(--muted); }
.month-tally-rows dd { margin: 0; font-weight: 700; }

/* round 91: گزارشات › اضافه کاری */
.ot-month-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.ot-month { margin: 0; font-size: 1.1rem; }
.ot-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.ot-scope { margin: 0; }
.ot-files { display: flex; flex-wrap: wrap; gap: 12px; }
.ot-list { display: flex; flex-direction: column; gap: 12px; }
.ot-sheet { margin: 0; padding: 0; }
.ot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 14px 16px; cursor: pointer; list-style: none; }
.ot-row::-webkit-details-marker { display: none; }
.ot-name { flex: 1 1 220px; min-width: 0; }
.ot-fig { white-space: nowrap; }
.ot-sheet .table-wrap { padding: 0 16px 16px; }
.ot-days td.ot-what { white-space: normal; min-width: 180px; }
.req-files { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }

/* round 91: an answer under a report's paraf */
.sub-paraf-reply { margin: 8px 0 0; padding: 8px 12px; border-inline-start: 3px solid var(--border); border-radius: 8px; background: var(--bg); }
.sub-paraf-reply p { margin: 4px 0 0; white-space: pre-line; }
.sub-paraf-answer { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; }
.sub-paraf-answer textarea { flex: 1 1 auto; min-width: 0; }
@media (max-width: 700px) { .sub-paraf-answer textarea { font-size: 16px; } }

/* round 91: «کارگاه غیر فعال» */
.site-idle-open { margin-inline-start: auto; }
.site-idle-dialog label { display: block; margin: 4px 0 -4px; font-weight: 700; }
.rw-idle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 14px;
           border: 1px dashed var(--border); border-radius: 12px; }

/* round 91: «در بخش لیست مالی، قسمت توضیحات برای نوشتن دلیل متن رو درست نمایش نمیده و کلمات زیر هم نوشته میشه و معلوم
   نیست چی نوشته شده … بشه کامل نوشت». Measured at 1440: the sheet's «توضیحات» box 80px wide — a sentence ran to nine
   lines of a word or two; the reason under «تأیید / عدم تأیید» about 50px in its column.
   · on the desk, the box being written in opens 320px wide over the columns beside it, and goes back when left;
   · a reason (approve, refuse, unpaid) is written in a panel in the middle of the screen, over a dimmed page — a press
     outside it closes it, as every floating menu does. */
.fin-entry-sheet td.fin-note { position: relative; }
@media (min-width: 701px) {
    .fin-entry-sheet td.fin-note textarea.fin-note-input:not(#k-none):focus {
        position: absolute; top: 4px; inset-inline-end: 4px; z-index: 6; width: 320px; max-width: none; min-width: 320px;
        min-height: 120px;
        overflow-y: auto; overflow-wrap: normal; word-break: normal; white-space: pre-wrap;
        background: var(--surface); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
    }
}
.fin-sheet .fin-no[open] > form, .fin-sheet .fin-unpaid[open] > form {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 60;
    width: min(380px, calc(100vw - 32px)); margin: 0; padding: 18px; gap: 12px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px;
    box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.38), 0 24px 60px rgba(15, 23, 42, 0.3);
}
.fin-sheet .fin-no[open] > form textarea, .fin-sheet .fin-unpaid[open] > form textarea {
    min-height: 6rem; font-size: 0.95rem; overflow-wrap: normal; word-break: normal;
}
.fin-sheet .fin-no[open] .fin-no-reason { font-size: 0.92rem; }
@media (max-width: 700px) {
    .fin-sheet .fin-no[open] > form textarea, .fin-sheet .fin-unpaid[open] > form textarea { font-size: 16px; }
}


/* Round 91: a project's own conversation is «گفت‌وگو»'s pane — its own height under the project's tabs, the messages
   scrolling inside it and the box to write in always at its foot. */
.chat-main.project-talk { height: calc(100vh - 300px); min-height: 440px; max-height: 820px; }
.chat-main.project-talk .chat-thread { min-height: 0; }
@media (max-width: 760px) {
    .chat-main.project-talk { height: calc(100vh - 180px); min-height: 380px; }
    @supports (height: 100dvh) { .chat-main.project-talk { height: calc(100dvh - 180px); } }
    .chat-main.project-talk .chat-thread { max-height: none; min-height: 0; }
}

/* Round 91: «امکان ثبت اضافه کاری در نسخه موبایل …» — the menu's «ثبت اضافه‌کاری» row is the phone's; on a wide
   screen the sheet is where it always was, «اضافه‌کاری روزانه‌ی من» on «فرم‌های اداری». */
@media (min-width: 761px) { .side-link.side-phone { display: none; } }

/* Round 91: «طبق اسکرین شات نمایش یه سری کارت های okr قابل نمایش نیست اصلاح بشه و ظاهر متناسبی داشته باشه». A
   card's title is a link, and every link of a row (.row-link) is kept on one line: the live goals run to 150 letters,
   so the title ran on under its status and its percentage, and on a phone it widened the page to three screens. On an
   OKR card, in its result lines and in the table's goal column, a title wraps like the sentence it is. */
.okr-card-title > a.row-link:not(#k-none),
.okr-card-title > a.row-link b,
.okr-kr-table td > a,
.okr-kr-table td.muted {
    white-space: normal;
    overflow-wrap: anywhere;
}
.okr-card-title > a.row-link:not(#k-none) { display: block; min-height: 0; line-height: 1.75; }
.okr-card-head > .okr-card-title { flex: 1 1 auto; }
/* the table: the result has the room, the goal two lines of it (all of it on hover and on its own page) */
.okr-kr-table td.okr-kr-titlecell { min-width: 15rem; }
.okr-kr-table td.okr-kr-titlecell textarea {
    width: 100%; min-width: 0; min-height: 2.4rem; resize: none; overflow: hidden; display: block;
    padding: 0.4rem 0.55rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); font: inherit; font-size: 0.9rem; line-height: 1.6; color: var(--text); box-sizing: border-box;
}
.okr-kr-table td.okr-kr-goal { max-width: 13rem; font-size: 0.86rem; }
.okr-kr-table td.okr-kr-goal > :is(a, span) {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    white-space: normal; overflow-wrap: anywhere; line-height: 1.6;
}
@media (max-width: 760px) {
    .okr-kr-table td.okr-kr-titlecell { min-width: 0; }
    .okr-kr-table td.okr-kr-goal { max-width: none; }
    .okr-kr-table td.okr-kr-goal > :is(a, span) { -webkit-line-clamp: 3; text-align: start; }
}

/* Round 91: «شاخص های ارزیابی عملکرد … درست نمایش بده» — the six-month chart says why it is empty */
.perf-trend-empty { margin: 0 0 12px; font-size: 0.86rem; line-height: 1.8; }
/* round 92: no self-evaluation column — its room goes to the portal's figure and the reasons (17+7+15+24+12+25) */
.apr-table col.apr-c-sys { width: 24%; }
.apr-table col.apr-c-note { width: 25%; }
/* a unit's KPI sheet: an indicator's name wraps (a .row-link keeps to one line everywhere else) */
.table td.kpi-name-cell > a.row-link:not(#k-none) { white-space: normal; overflow-wrap: anywhere; min-width: 9rem; display: inline; }

/* Round 92: «شاخص های عملکردی رو به صورت روزانه … حساب کن» — the month's working days on a person's page, each with
   its automatic score; a day whose daily report was not sent on its day carries its minus */
.perf-daily .panel-body { display: flex; flex-direction: column; gap: 12px; }
.perf-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.perf-day {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border-soft);
    border-top: 3px solid #9ca3af; text-align: center; min-width: 0;
}
.perf-day.perf-day-green { border-top-color: #1d7a4c; }
.perf-day.perf-day-blue { border-top-color: #2563eb; }
.perf-day.perf-day-teal { border-top-color: #0f766e; }
.perf-day.perf-day-orange { border-top-color: #c2410c; }
.perf-day.perf-day-red { border-top-color: #b8392a; }
.perf-day-date { font-size: 0.78rem; line-height: 1.5; color: var(--muted); }
.perf-day-score { font-size: 1.25rem; line-height: 1.2; }
.perf-day-report { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.perf-day.is-penalty .perf-day-report { color: #b8392a; }
.perf-day-minus {
    display: inline-block; font-size: 0.74rem; font-weight: 700; line-height: 1;
    padding: 3px 7px; border-radius: 999px; background: #fdecea; color: #b8392a;
}
.perf-daily-note { margin: 0; font-size: 0.86rem; line-height: 1.9; }
html[data-theme="dark"] .perf-day.is-penalty .perf-day-report { color: #ff8f7f; }
html[data-theme="dark"] .perf-day-minus { background: #3f1e18; color: #ff8f7f; }
@media (max-width: 760px) { .perf-days { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); } }

/* ══ Round 93 — the finance panels ══════════════════════════════════════════════════════════════════════════════════
   the finance manager's side column holds the office's costs and the buyer's requests, one above the other */
.fin-dash-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.fin-dash-side > .fin-dash-group { flex: 1 1 auto; }
.fin-pay-parts, .fin-deposit-parts { margin: 0 0 20px; }

/* «درخواست صدور چک/پرداخت» — the buyer's card */
.fin-cheque-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; margin: 0 0 20px; align-items: end; }
.fin-cheque-fields > label > input, .fin-cheque-fields > label .jalali-picker { margin: 0; }
.fin-cheque-fields input::placeholder { font-size: 0.8rem; }
.fin-cheque-fields > label { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.fin-cheque-opt { font-size: 0.78rem; font-weight: 400; }
.fin-ltr { direction: ltr; text-align: left; }
.fin-cheque-sub { margin: 0 0 12px; font-size: 1rem; }
.fin-cheque-list { border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.fin-cheque-list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; }
.fin-cheque-list-sum { margin-inline-start: auto; }
.fin-cheque-all { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; cursor: pointer; }
.fin-cheque-rows .fin-c-pick { width: 2.4rem; }
.fin-cheque-rows input[type="checkbox"], .fin-cheque-all input { width: 18px; height: 18px; accent-color: var(--accent); }
.fin-cheque-rows tr.is-closed td { color: var(--muted); }
.fin-cheque-bar {
    position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 14px; margin: 12px 0 0; border-radius: 12px; background: var(--surface);
    border: 1px solid var(--border-soft); box-shadow: var(--shadow);
}
.fin-cheque-total b { font-size: 1.05rem; }
.fin-cheque-note { display: block; font-size: 0.82rem; margin-top: 4px; }

/* the finance manager's view of the requests */
.fin-cheque-desk { display: flex; flex-direction: column; gap: 20px; }
.fin-cheque-req { border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px; }
.fin-cheque-req-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; }
.fin-cheque-req-sum { margin-inline-start: auto; font-weight: 700; }
.fin-cheque-req-who { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin: 0 0 12px; }
.fin-cheque-req-who dt { font-size: 0.8rem; color: var(--muted); }
.fin-cheque-req-who dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.fin-cheque-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.fin-cheque-answer input[type="text"] { flex: 1 1 260px; min-width: 0; margin: 0; }
@media (max-width: 900px) {
    .fin-cheque-fields, .fin-cheque-req-who { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .fin-cheque-fields, .fin-cheque-req-who { grid-template-columns: minmax(0, 1fr); }
    .fin-cheque-list-sum { margin-inline-start: 0; }
}

/* round 93: the dashboards' list tables fit their card at 1280–1440 — a list's title and its sender may take a second
   line, so the row's «باز کردن» stays in view instead of behind the table's sideways scroll */
.fin-dash-detail .fin-lists td:nth-child(1),
.fin-dash-detail .fin-lists td:nth-child(2),
.fin-dash-detail .fin-lists td:nth-child(1) .line-title { white-space: normal; }
.fin-dash-detail .fin-lists td:nth-child(1) { min-width: 11rem; }
@media (max-width: 1366px) {
    /* the date keeps «۳ آبان ۱۴۰۵» whole and lets its hour go under it */
    .fin-dash-detail .fin-lists td.nowrap.muted { white-space: normal; min-width: 6.4rem; }
    .fin-dash-detail .fin-lists td:nth-child(1) { min-width: 10rem; }
    .fin-dash-detail .fin-lists th, .fin-dash-detail .fin-lists td { padding-inline: 10px; }
}

/* round 94: the director's fourth card, «لیست‌های حذف‌شده» */
.fin-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1120px; }
@media (max-width: 900px) { .fin-cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .fin-cards-4 { grid-template-columns: minmax(0, 1fr); } }
/* «حذف» beside «باز کردن» on the finance manager's lines: side by side where there is room, one under the other
   where there is not, never wider than the cell */
.fin-row-acts-in { display: inline-flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 5.6rem; }
.fin-row-acts-in > .act-btn, .fin-row-acts-in > .fin-row-remove, .fin-row-acts-in .fin-row-remove > .act-btn {
    display: flex; justify-content: center; width: 100%; margin: 0; }
/* a form after a link in a cell takes a side margin from an older rule; in this column it stands flush */
.fin-dash-detail .fin-lists .fin-row-acts-in > .fin-row-remove { margin: 0; }
/* the director's deleted lists: who deleted it and why may take a second line */
.fin-deleted-table td:nth-child(5), .fin-deleted-table td:nth-child(6), .fin-deleted-table td:nth-child(8) { white-space: normal; }
.fin-deleted-table td:nth-child(8) { min-width: 6rem; }
.fin-deleted-note p { margin: 0 0 6px; }
.fin-deleted-note p:last-child { margin-bottom: 0; }
.fin-deleted-rows { min-width: 1080px; }
.fin-refund-attach { margin-top: 0.75rem; }
.fin-deleted-note-text { white-space: pre-line; }
.fin-deleted-rows td { vertical-align: middle; }

/* round 95: the registered signature under each name of a list's signature row — the technical unit's box makes five
   where it is on the road, so the boxes share the width whatever their number */
.fin-signs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fin-sign-who { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fin-sign-who + .fin-sign-who { margin-top: 10px; }
.fin-sign-img { display: block; width: auto; max-width: 150px; height: 56px; object-fit: contain; margin-top: 4px;
    background: #fff; border: 1px solid var(--border-soft); border-radius: 8px; padding: 4px 8px; }
.fin-sign-none { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 700px) { .fin-signs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* round 95: «حذف لیست» beside «خروجی PDF» on the list's own page */
.fin-sheet-head-acts .fin-row-remove { margin: 0; display: inline-flex; }
.fin-list-remove { color: var(--red-deep); }

/* round 96: the rows of a list sent back for correction, and «ارسال مجدد لیست» — a card of its own above the sheet */
.fin-resend-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; padding: 14px 16px;
    border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface, #fff); }
.fin-resend-bar p { margin: 0; flex: 1 1 100%; }
.fin-resend-rows { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.fin-resend-bar form { margin: 0; }

/* round 96: the OKR page — an objective's «ویرایش»/«حذف» at its card's foot and its fields opened in place; a key
   result's row reads as text until «ویرایش» opens its boxes */
.okr-card-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.okr-card-acts .inline-form { margin: 0; }
.okr-card-edit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.okr-kr-row:not(.is-editing) .okr-e { display: none; }
.okr-kr-row.is-editing .okr-v { display: none; }
.okr-acts { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.okr-acts .inline-form { margin: 0; display: inline-flex; }
/* the key result's buttons one under the other, as wide as each other — side by side they pushed «حذف» out of the card */
.okr-kr-acts .okr-acts { display: inline-flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 5.6rem; }
.okr-kr-row:not(.is-editing) .okr-kr-acts .okr-e { display: none; }
.okr-kr-row.is-editing .okr-kr-acts .okr-v { display: none; }
.okr-kr-acts .okr-acts > .act-btn, .okr-kr-acts .okr-acts > .btn, .okr-kr-acts .okr-acts .inline-form,
.okr-kr-acts .okr-acts .inline-form > .act-btn, .okr-kr-acts .okr-acts .inline-form > .btn {
    display: flex; justify-content: center; width: 100%; margin: 0; }
/* at 1280–1366 the key results' table keeps its last column — «ویرایش»/«حذف» — inside its card: the result's own column
   narrower there (its text still wraps whole, its box still grows) */
@media (max-width: 1366px) {
    .okr-kr-table td.okr-kr-titlecell { min-width: 9rem; }
}

/* round 97: the technical unit's «ارسال برای اصلاح به سرپرست کارگاه», its note beside it, in the same bar */
.fin-resend-bar .fin-send-back { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 100%; }
.fin-resend-bar .fin-send-back input[name="note"] { flex: 1 1 260px; min-width: 0; margin: 0; }

/* round 97: «ارتفاع پنجره گفت و گو پروژه ها در بخش پروژه ها بیشتر و تقریبا تمام صفحه باشه» — the project's conversation
   is the screen's height below the top bar, and the page brings it into view when its tab opens (project_detail.html) */
.chat-main.project-talk { height: calc(100vh - 104px); min-height: 520px; max-height: none; scroll-margin-top: 88px; }
@supports (height: 100dvh) { .chat-main.project-talk { height: calc(100dvh - 104px); } }
@media (max-width: 760px) {
    .chat-main.project-talk { height: calc(100vh - 96px); min-height: 420px; scroll-margin-top: 84px; }
    @supports (height: 100dvh) { .chat-main.project-talk { height: calc(100dvh - 96px); } }
}

/* round 97: the bar a form with files fills while they go (static/js/upload-progress.js) */
.upload-progress { position: fixed; inset-inline: 0; bottom: 20px; margin: 0 auto; z-index: 3000;
    width: min(460px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
    background: var(--surface, #fff); color: var(--text, #1f1f2e); border: 1px solid var(--border-soft);
    border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 20, 40, 0.18); }
.upload-progress[hidden] { display: none; }
.upload-progress-word { font-size: 0.95rem; }
.upload-progress-track { display: block; height: 10px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.upload-progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent);
    transition: width 0.2s ease; }
.upload-progress-detail { font-size: 0.84rem; color: var(--muted); }
.upload-progress.is-failed .upload-progress-word { color: var(--red-deep, #b42318); }
.upload-progress.is-failed .upload-progress-track { display: none; }
/* round 98: the bar's end — «ارسال شد ✓» — while the next page loads */
.upload-progress.is-done .upload-progress-word { color: var(--green-deep, #12805c); }
.upload-progress.is-done .upload-progress-fill { background: var(--green, #12805c); }

/* round 100: a group's pane — «گفت‌وگو» | «اعضا», and its people with «حذف» and «افزودن عضو» (templates/_talk_pane.html) */
.chat-pane-tabs { margin: 0; padding: 0 1.1rem; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.chat-pane-tabs .tab { padding-block: 0.6rem; }
.chat-members { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.chat-member-list { display: flex; flex-direction: column; gap: 12px; }
.chat-member { display: flex; align-items: center; gap: 12px; }
.chat-member .colleague-avatar { width: 36px; height: 36px; flex-shrink: 0; }
.chat-member-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-member-text b { font-weight: 600; }
.chat-member form { margin: 0; flex-shrink: 0; }
.chat-member-add { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.chat-member-add-head { padding: 0; border: 0; }
.chat-member-add .picker-box { max-height: 280px; overflow-y: auto; }
.chat-member-add .form-actions { margin: 0; }
.chat-member-find { width: 100%; }
/* round 100: «پرینت» beside «ذخیره», drawn as it is; a film has none */
.chat-gallery .cg-print:not(#k-none):not(#k-none-2) { background: var(--accent, #4f46e5); border-color: transparent; color: #fff; padding: 0 16px; }
.chat-gallery .cg-print:not(#k-none):not(#k-none-2):hover { background: var(--accent-deep, #352c99); }
.chat-gallery .cg-print[hidden] { display: none !important; }
@media (max-width: 700px) {
    /* round 100: on a phone «پرینت» is its icon, so the row of tools stays one line beside «ذخیره» */
    .chat-gallery .cg-print .cg-btn-word { display: none; }
    .chat-gallery .cg-print:not(#k-none):not(#k-none-2) { width: 40px; padding: 0; }
}

/* round 100: «بدون مهلت انجام» beside the due day — ticked, the day is set aside */
.qt-nodue:not(#k-none) { white-space: nowrap; font-size: 0.85rem; font-weight: 600; user-select: none; margin: 0; align-self: center; }
.qt-nodue input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.qt-when.is-off { opacity: 0.4; pointer-events: none; border-style: dashed; }
.tc-nodue { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; }
.tc-nodue input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.tc-fold-body.is-nodue .jalali-picker { opacity: 0.4; pointer-events: none; }
.crm-new-form fieldset[hidden] { display: none; }   /* round 100: «ملک و پروژه» on an investment lead */
/* round 100: the buyer's search — the lists an amount is found in, under the list its number names */
.fin-lookup-amounts { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.fin-lookup-amounts-head { font-weight: 600; }
.fin-lookup-amount { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* round 100: the window before a finance list's sending hour (_finance_send_prompt.html, finance-form.js) */
.fin-send-prompt { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 0;
    border: 1px solid var(--border-soft); border-radius: var(--radius, 14px); background: var(--surface, #fff); color: inherit; }
.fin-send-prompt::backdrop { background: rgba(15, 15, 25, 0.45); }
.fin-send-prompt-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.fin-send-prompt-body h2 { margin: 0; font-size: 1.1rem; }
.fin-send-prompt-body p { margin: 0; line-height: 1.8; }
.fin-send-prompt-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.fin-send-prompt-actions form { margin: 0; }
@media (max-width: 700px) {
    /* round 100: on a phone the window's three answers stand one under another, each the window's width */
    .fin-send-prompt-actions { flex-direction: column; }
    .fin-send-prompt-actions > *, .fin-send-prompt-actions form .btn { width: 100%; }
}

/* round 101: the finance dashboard's search box, and the lists a number or an amount names under it */
.fin-dash-filter .fin-find-box input { width: 100%; }
.fin-find-result:empty { display: none; }
.fin-find-hits { display: flex; flex-direction: column; gap: 12px; margin: 0 0 20px; padding: 16px 20px;
    background: var(--surface, #fff); border: 1px solid var(--border-soft); border-radius: var(--radius, 14px); }
.fin-find-head { font-weight: 600; }
.fin-find-hit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fin-find-hit .line-title { flex: 1 1 220px; min-width: 0; }
.fin-find-why { flex: 1 1 200px; min-width: 0; }

/* round 102: a corrected row's earlier word at a step, above its fresh «تأیید» / «عدم تأیید» */
.fin-before { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }

/* round 103: «در ایجاد وظیفه روزهای جمعه و تعطیل رو در نظر نگیر» — in a task's date field a Friday or a holiday is red
   and out of reach (its name in its title); dark.css's muted blocked day is outweighed on purpose */
.jp-popup .jp-cell.jp-off,
html[data-theme] .jp-popup .jp-cell.jp-off { color: var(--red-deep); opacity: 0.55; }

/* round 103: «روزهای تعطیل» under مدیریت کل — the day, its occasion, who wrote it in, and «حذف» at the row's end */
.holiday-add { margin-bottom: 20px; }
.holiday-table td.holiday-act { width: 1%; white-space: nowrap; text-align: end; }
.holiday-table td.holiday-act form { margin: 0; }

/* round 104: the line over «لید سایت» saying its leads wait there to be screened */
.crm-site-hint { margin: 0 0 var(--gap-list, 12px); line-height: 1.9; }

/* round 105: the number of «لید سایت» leads not opened yet, on «بایگانی» and «لید سایت» — red, white figures,
   active tab or not (polish.css line 52-53 make a tab's own count quiet) */
.tab .tab-badge.tab-badge-new,
.tab.active .tab-badge.tab-badge-new,
html[data-theme] .tab .tab-badge.tab-badge-new { background: #b8392a; color: #fff; }
.crm-new-chip { margin-inline-start: 6px; vertical-align: middle; }

/* round 106: a «checks» field — «نوشته های داخل پرانتز به صورت چک باکس … و انتهای هر چک باکس گزینه سایر»: every
   option a box to tick in a row that wraps, «سایر» last, its line under the boxes once it is ticked. The field-cell
   rule that stretches every input is undone for the boxes themselves. */
.checks-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.checks-item {
    display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
    font-size: 0.9rem; font-weight: 500; line-height: 1.6; color: var(--text); cursor: pointer;
}
.field-cell .checks-item input[type="checkbox"] {
    width: 18px; height: 18px; min-width: 18px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--accent);
}
.checks-item:hover { border-color: var(--accent); }
.checks-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.field-cell .checks-other-text { flex: 1 1 100%; margin-top: 4px; }
.checks-other-text[hidden] { display: none; }
/* «ذخیره» beside «ثبت گزارش», and what it last said */
.draft-said { align-self: center; font-size: 0.86rem; }
.draft-said.is-bad { color: var(--red-deep); }
.form-actions:has(.draft-said) { flex-wrap: wrap; }
.form-actions .draft-said { white-space: nowrap; }
@media (max-width: 700px) { .form-actions .draft-said { flex: 1 1 100%; } }

/* round 107: the questionnaire's comments — the same cards as a report's initials, pictures shown small, the stage
   it stands at beside the heading */
.taste-comments .panel-body { display: flex; flex-direction: column; gap: 12px; }
.taste-comments .sheet-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.taste-stage { margin-inline-start: auto; }
.taste-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.taste-thumb { display: block; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-soft); }
.taste-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.taste-comment-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.taste-comment-form textarea { width: 100%; box-sizing: border-box; }
.taste-comment-foot { display: flex; justify-content: flex-start; }
.taste-none { margin: 0; }
.taste-filter { margin-bottom: var(--gap-list, 12px); }
.taste-filter select { width: auto; min-width: 200px; }
.taste-table .taste-turn { margin-inline-start: 6px; vertical-align: middle; }

/* round 109: «طبق فایلی که برات فرستادم شاکله نمایش اینجوری باشه نه اینکه لینک دانلود بذاری» — a procedure's file on its
   page in the company's SOP form (templates/_sop_sheet.html): the framed sheet, its code and logo, the numbered steps in
   green lines with an arrow between each, each «گام» under its heading */
.sop-sheet { display: flex; flex-direction: column; gap: 20px; max-width: 860px; margin: 0 auto var(--gap-block, 20px); padding: 28px 32px;
    background: var(--surface); color: var(--text); border: 4px double var(--text); border-radius: 4px; }
.sop-sheet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sop-sheet-code { font-size: 0.86rem; white-space: nowrap; }
.sop-sheet-logo { width: 52px; height: auto; display: block; }
.sop-sheet-title { margin: 0; text-align: center; font-size: 1.3rem; font-weight: 800; }
.sop-sheet-who { margin: 0; font-weight: 700; line-height: 1.8; }
.sop-sheet-who b { font-weight: 800; }
.sop-sheet-flow { display: flex; flex-direction: column; gap: 20px; width: min(100%, 640px); margin: 8px auto; padding: 0; list-style: none; }
.sop-sheet-flow li { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); min-height: 46px; border: 1px solid var(--green, #12805c); border-radius: 2px; }
.sop-sheet-flow li + li::before { content: "↓"; position: absolute; top: -21px; inset-inline: 0; text-align: center; line-height: 20px; color: var(--muted); }
.sop-sheet-flow-no, .sop-sheet-flow-name { display: flex; align-items: center; justify-content: center; font-weight: 700; text-align: center; }
.sop-sheet-flow-no { border-inline-end: 1px solid var(--green, #12805c); }
.sop-sheet-flow-name { padding: 8px 12px; line-height: 1.7; }
.sop-sheet-part { display: flex; flex-direction: column; gap: 6px; }
.sop-sheet-part h3 { margin: 0 0 4px; font-size: 1.04rem; font-weight: 800; }
.sop-sheet-line { margin: 0; line-height: 1.9; }
.sop-sheet-line b { font-weight: 700; }
.sop-sheet-items { display: flex; flex-direction: column; gap: 4px; margin: 2px 0; padding: 0; padding-inline-start: 20px; list-style: none; line-height: 1.9; }
.sop-sheet-items li { display: flex; gap: 8px; }
.sop-sheet-item-no { flex: 0 0 auto; }
.sop-sheet-end { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; text-align: center; line-height: 1.9; }
.sop-sheet-end p { margin: 0; }
.sop-sheet-end .is-signed { font-weight: 800; }
.sop-file-picture { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.sop-file-pdf iframe { display: block; width: 100%; height: 80vh; border: 0; }
@media (max-width: 760px) {
    .sop-sheet { padding: 16px; gap: 16px; }
    .sop-sheet-logo { width: 44px; }
    .sop-sheet-title { font-size: 1.14rem; }
    .sop-sheet-flow li { grid-template-columns: 38px minmax(0, 1fr); }
    .sop-sheet-items { padding-inline-start: 8px; }
}
@media print {
    .sop-sheet { max-width: none; margin: 0; }
    .sop-sheet-part h3 { break-after: avoid; }
    .sop-sheet-flow li { break-inside: avoid; }
}

/* round 109: «در نسخه موبایل وقتی فایل در گفت و گو میخوام اضافه کنم فیلد نوشتن پیام و ارسال و عکس ها از صفحه نمایش گوشی
   خارج میشه» — on a phone an open conversation is the screen's height, as a project's already was: what was picked takes
   its room from the thread, in one row that slides, and the box to write in and «ارسال» stay on the screen */
@media (max-width: 760px) {
    .chat-main.is-open { height: calc(100vh - 96px); min-height: 340px; scroll-margin-top: 84px; }
    @supports (height: 100dvh) { .chat-main.is-open { height: calc(100dvh - 96px); } }
    .chat-main.project-talk { min-height: 340px; }
    .chat-main.is-open .chat-thread { flex: 1 1 0; min-height: 0; max-height: none; }
    .chat-tray { flex-wrap: nowrap; max-height: none; padding-block: 0.6rem; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
    .chat-chip { flex: 0 0 auto; width: 104px; }
    .chat-chip img, .chat-chip video { width: 90px; height: 62px; }
    .chat-chip.is-file { align-self: stretch; max-width: 170px; }
    .chat-tray-warn { order: -1; flex: 0 0 100%; }
    .chat-tray:has(.chat-tray-warn) { flex-wrap: wrap; }
    .chat-compose > .compose-picked { max-height: 34vh; overflow-y: auto; }
}
/* a phone on its side and a small tablet (761–900): the same pane beside its list; the page scrolls, so the box can never
   be cut off under the window's edge */
@media (max-width: 900px) {
    body.section-chat .content { height: auto; overflow: visible; }
}
/* a channel's picked files, or a voice note's player, stand on their own line: the box and «ارسال» keep theirs. A row that
   cannot hold them wraps — nothing is ever pushed out of the pane (round 110) */
.chat-compose { flex-wrap: wrap; }
.chat-compose textarea { min-width: 96px; }
.chat-compose .btn { flex: none; }
.chat-compose .voice-inline { flex: 0 1 auto; min-width: 0; max-width: 100%; }

/* «وقتی نوتیفیکیشن ارسال میاد فیلد پیام جمع میشه»: what is said over a conversation takes no room in it. The sending bar
   stands under the top bar, not over the box; a saved note floats there too (form-helpers.js, upload-progress.js) */
.upload-progress.is-top { top: calc(var(--topbar-h, 64px) + 8px); bottom: auto; }
.saved-note.is-toast { position: fixed; z-index: 2900; top: calc(var(--topbar-h, 64px) + 8px); inset-inline: 0; width: fit-content; max-width: calc(100vw - 32px);
    margin: 0 auto; box-shadow: 0 10px 30px rgba(20, 20, 40, 0.18); }

/* round 109: the paying day a list is on, under its delay */
.fin-delay-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.fin-pay-chip { white-space: nowrap; }
.fin-sheet-head-acts .fin-pay-chip { align-self: center; }

/* round 110: «هنوز فایل ارسالی خارج از صفحه گوشی هست» — what is about to go and the box to write in are one block, and on a
   phone it stands at the foot of the screen wherever the page has been left: the picker of an iPhone can give the page back
   higher up than it took it */
.chat-dock { flex-shrink: 0; }
@media (max-width: 900px) {
    .chat-main.is-open, .chat-main.project-talk { overflow: visible; }
    .chat-dock { position: sticky; bottom: 0; z-index: 5; overflow: hidden; background: var(--surface);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}
/* round 110: «وقتی روی ضبط کلیک میکنم و متوقف میکنم دکمه ارسال محو میشه و نمیشه فرستاد» — a voice note's player, with its
   «حذف», on a line of its own above the box and «ارسال»; a word about the microphone the same */
.chat-compose .voice-inline.has-take, .chat-compose .voice-inline.has-note { order: -1; flex: 1 1 100%; }
.chat-compose .voice-inline.has-take { flex-wrap: nowrap; }
.chat-compose .voice-inline.has-take .voice-btn { display: none; }
.chat-compose .voice-inline.has-take .voice-preview { flex: 1 1 0; flex-wrap: nowrap; min-width: 0; }
.chat-compose .voice-inline.has-take .voice-audio { flex: 1 1 auto; width: 100%; min-width: 0; max-width: none; }
.chat-compose .voice-inline.has-take .voice-drop { flex: none; min-height: 38px; padding-inline: 10px; }

/* round 111: «تیک خوندن مثل تلگرام» — one tick sent, two read (in the house colour when everyone it went to has read
   it); pressed, the window of who read it and when (templates/_letter_reads.html) */
.letter-ticks { display: inline-flex; align-items: center; margin-inline-start: 6px; padding: 2px 6px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 0.92rem; font-weight: 700; line-height: 1; letter-spacing: -0.18em;
    cursor: pointer; vertical-align: middle; }
.letter-ticks:hover { background: var(--accent-soft); }
.letter-ticks.is-all { color: var(--accent); }
.reads-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-soft); border-radius: 14px;
    background: var(--surface); color: var(--text); }
.reads-dialog::backdrop { background: rgba(20, 20, 40, 0.35); }
.reads-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft); }
.reads-dialog-head h2 { margin: 0; font-size: 1.05rem; }
.reads-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
.reads-sent, .reads-head { margin: 0; }
.reads-sent { color: var(--muted); font-size: 0.9rem; }
.reads-head { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.reads-mark { color: var(--accent); letter-spacing: -0.18em; }
.reads-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.reads-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reads-who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.reads-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.reads-avatar-none { display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink);
    font-size: 0.84rem; font-weight: 700; }
.reads-when { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.reads-list .is-unread .reads-who { color: var(--muted); }

/* round 111: «لینکی … قابل کلیک کردن باشه» — an address in a message, as it was sent, left to right */
.talk-link { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere;
    unicode-bidi: isolate; }
.bubble-row.mine .talk-link { color: var(--on-accent); }

/* round 111: «لیست پرداخت شده یک چک باکس کنار هر لیست» — this person's own mark of a paid list seen */
.fin-seen-cell { width: 1%; white-space: nowrap; text-align: center; }
.fin-seen-form { display: inline-flex; margin: 0; }
.fin-seen { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; cursor: pointer; }
.fin-seen input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* round 112: «در نسخه موبایل لیست … نصفه نمایش داده میشه و هنگ میکنه» (the technical unit's «ثبت سند پرداختی» on an
   iPhone). The foot of «ثبت ردیف تازه» never wrapped: three buttons and the long note beside them shared one line, so on a
   phone the note was squeezed into a column 55px wide and 525px tall — a blank strip, clipped by the card — and
   «افزودن به لیست» ran out past the card's left edge, half of it cut off and out of reach. The buttons now wrap and the
   note takes a line of its own. On a phone the card no longer clips what it holds (the long form of cards is drawn as
   one ordinary page block, nothing hidden by the card's rounded corners); its head keeps the corners itself. */
#finForm > .form-actions, .form-actions:has(> span.muted) { flex-wrap: wrap; row-gap: 12px; }
.fin-draft-said, .form-actions > span.muted { flex: 1 1 16rem; min-width: 0; }
@media screen and (max-width: 700px) {
    .form-actions { flex-wrap: wrap; row-gap: 12px; }
    .fin-draft-said, .form-actions > span.muted { flex-basis: 100%; }
    #finForm > .form-actions > .btn { flex: 1 1 auto; }
    .panel.fin-new-row { overflow: visible; }
    .panel.fin-new-row > .panel-head { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* round 112: «با انتخابشون در تقویم جانشینش قرار بگیره با یک علامت یا رنگ دیگه که مشخص و متفاوت باشه» — a task done for
   a colleague on leave: orange, framed dashed, «به‌جای …» under its title (the blue and green of the other tasks stay
   theirs) */
.cover-tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 8px; border-radius: 999px;
    background: #fdf0e3; color: #8a4a06; border: 1px dashed #d9730d; font-size: 0.78rem; font-weight: 600; line-height: 1.6;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.cover-tag > span { overflow: hidden; text-overflow: ellipsis; }
.cover-tag .icn { flex: none; }
html[data-theme="dark"] .cover-tag { background: #3f2b18; color: #e7a055; border-color: #b8681f; }
.calendar-task.is-cover:not(#k-none) { --cal-edge: #d9730d; --cal-tint: #fdf0e3; outline: 1.5px dashed #d9730d;
    outline-offset: -1.5px; }
html[data-theme="dark"] .calendar-task.is-cover:not(#k-none) { --cal-edge: #e7a055; --cal-tint: #3f2b18;
    outline-color: #b8681f; }
.calendar-task-cover { display: block; margin-top: 2px; }
.calendar-task-cover .cover-tag { font-size: 0.74rem; padding: 0 6px; border: 0; background: transparent; white-space: normal;
    align-items: flex-start; }
.calendar-task-cover .cover-tag .icn { margin-top: 3px; }
.trow.is-cover { box-shadow: inset -3px 0 0 #d9730d; }
.peek-cover { margin-top: 8px; }

/* round 112: the window of a leave just approved, and its page */
.lc-dialog { width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border-soft);
    border-radius: 16px; background: var(--surface); color: var(--text); overflow: hidden; }
.lc-dialog[open] { display: flex; flex-direction: column; }
.lc-dialog::backdrop { background: rgba(15, 15, 25, 0.45); }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft); }
.lc-head h2 { margin: 0; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 8px; }
.lc-close { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px;
    background: transparent; color: var(--muted); cursor: pointer; }
.lc-close:hover { background: var(--bg); color: var(--text); }
.lc-body { padding: 16px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.lc-body p, .lc-page p { margin: 0; line-height: 1.9; }
.lc-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.lc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lc-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 12px;
    border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.lc-pick { display: inline-flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 14rem; margin: 0; cursor: pointer; }
.lc-pick input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.lc-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lc-where { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.86rem; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 12px; }
/* in the window the two buttons stay at its foot while the list scrolls */
.lc-dialog .lc-actions { position: sticky; bottom: -20px; z-index: 1; margin: 0 -20px -20px; padding: 12px 20px 20px;
    background: var(--surface); border-top: 1px solid var(--border-soft); }
.lc-said { font-size: 0.86rem; }
.lc-page .panel-body { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 700px) {
    .lc-actions .btn { flex: 1 1 100%; }
}

/* round 112: «وظایف حذف‌شده» and «گزارش تأخیرات وظایف به تفکیک افراد» */
.page-head-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tdel-table tr.is-restored td { color: var(--muted); }
.tdel-project { font-size: 0.86rem; }
.delay-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px;
    margin: 0 0 20px; }
.delay-month { display: inline-flex; align-items: center; gap: 12px; }
.delay-month b { min-width: 7rem; text-align: center; }
.delay-month .is-off { opacity: 0.35; pointer-events: none; }
.delay-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0; }
.delay-filter label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 0.86rem; min-width: 11rem; }
.delay-filter label + label { margin: 0; }
.delay-export { display: flex; flex-wrap: wrap; gap: 12px; }
.delay-note { margin: 12px 0 0; font-size: 0.86rem; line-height: 1.9; }
.delay-link { margin: 0 0 12px; }
@media (max-width: 700px) {
    .delay-filter, .delay-filter label { flex: 1 1 100%; min-width: 0; }
    .delay-export .btn { flex: 1 1 auto; }
}

/* round 113: «وقتی منو ساید بار در گوشی باز میشه صفحه زیرینش بلر باشه و همین طور وقتی پاپ آپ باز میشه در دو نسخه» —
   the page behind the phone's open menu and behind every window (a <dialog>, the task history's veil) is blurred, on
   a desk and on a phone; each veil keeps its own tint */
dialog::backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.thist { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (max-width: 900px) {
    body.sidebar-open::before { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
}

/* round 113: the eye in the password box — at the box's far end (left, in Persian), the box's words clear of it */
.pw-field { position: relative; }
.pw-field input { width: 100%; margin: 0; padding-inline-end: 48px; }
.pw-eye { position: absolute; inset-inline-end: 6px; top: 0; bottom: 0; margin: auto 0; transform: none !important; display: inline-grid;
    place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: transparent;
    color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--text); background: var(--bg); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-eye [hidden] { display: none; }
html[data-theme="dark"] .pw-eye:hover { background: rgba(255, 255, 255, 0.06); }

/* round 113: a list's petty-cash rows folded under one row of their own — the row reads as a button; a click opens them */
.fin-sheet.petty-folded tr[data-petty-row] { display: none; }
.fin-sheet tr.fin-petty-sum { cursor: pointer; background: var(--accent-soft); }
.fin-sheet tr.fin-petty-sum:hover td { background: #e4e1fc; }
html[data-theme="dark"] .fin-sheet tr.fin-petty-sum:hover td { background: rgba(124, 116, 240, 0.2); }
.fin-sheet tr.fin-petty-sum:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fin-sheet tr[data-petty-row] td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
.fin-petty-caret { display: inline-grid; place-items: center; transition: transform 0.15s ease; transform: rotate(90deg); }
.fin-sheet:not(.petty-folded) .fin-petty-caret { transform: rotate(-90deg); }
.fin-petty-open { display: block; margin-top: 4px; color: var(--accent-ink); font-size: 0.86rem; font-weight: 600; }
.fin-sheet.petty-folded .fin-petty-word-close, .fin-sheet:not(.petty-folded) .fin-petty-word-open { display: none; }
.fin-petty-state { text-align: center; }
html[data-theme="dark"] .fin-sheet tr.fin-petty-sum { background: rgba(124, 116, 240, 0.12); }
html[data-theme="dark"] .fin-petty-open { color: #b8b2ff; }
@media print {
    .fin-sheet.petty-folded tr[data-petty-row] { display: table-row; }
    .fin-sheet tr.fin-petty-sum { display: none; }
}

/* round 114: the petty cash's own «پرداخت کل تنخواه», beside its count of paid rows */
.fin-petty-state { white-space: normal; }
.fin-petty-pay { display: inline-flex; justify-content: center; margin-top: 6px; }
.fin-petty-sum .fin-petty-label { display: table; margin: 6px 0 0; white-space: normal; line-height: 1.6; }

/* round 116: «حساب واریز تنخواه» — the holder's card and sheba above what waits to be sent, a block of its own */
.panel-body > .fin-petty-account { margin: 0 0 20px; padding: 0 0 20px; border-bottom: 1px solid var(--border-soft); }
.fin-petty-account-head { margin: 0 0 12px; line-height: 1.8; }
.fin-petty-account .crm-two { margin: 0; }

/* round 117: a petty list sent again after correction carries «حساب واریز تنخواه» — the form takes the bar's whole width */
.fin-resend-bar form.fin-resend-petty { flex: 1 1 100%; }
.fin-resend-account { margin: 0 0 12px; }

/* round 118: «در لیست مالی وقتی اعتباری انتخاب میشه … دو چک باکس … واریز و چک … الان صادر شود و بعدا صادر شود» — a
   credit list's way of payment beside «نوع ثبت»: two boxes a pair, the cheque's pair under them while «چک» is ticked */
.fin-pay-method { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0; padding: 0; min-width: 0; }
.fin-pay-method[hidden], .fin-cheque-when[hidden] { display: none; }
.fin-pay-part { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fin-pay-cap { font-weight: 600; }
/* a field of the row: as tall as «نوع ثبت» beside it, its border and ground */
.fin-pay-box { box-sizing: border-box; min-height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg); }
.fin-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.fin-check { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 500; white-space: nowrap; cursor: pointer; }
.fin-check input[type="checkbox"], .fin-entry-sheet .fin-check input[type="checkbox"] {
    width: 18px; height: 18px; min-width: 18px; min-height: 0; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--accent); }
.fin-more.is-edit .fin-pay-method { flex: 1 1 260px; }

/* round 118: the site supervisor's «قرارداد / بدون قرارداد» and «مبلغ قرارداد», before «بانک»; under the sum, what is
   left of the contract before this row and after it (red when the row goes past it) */
.fin-checks-cell { flex-direction: column; align-items: flex-start; gap: 6px; font-size: 0.82rem; }
.fin-entry-sheet td.fin-e-camount-cell textarea:disabled { background: var(--surface-2, transparent); opacity: 0.55; cursor: not-allowed; }
.fin-contract-left { display: block; margin-top: 6px; font-size: 0.74rem; line-height: 1.6; color: var(--muted); }
.fin-contract-left-line { display: block; }
.fin-contract-left-line bdi { display: block; white-space: nowrap; }
.fin-contract-left.is-over, .fin-contract-rest.is-over { color: #b8392a; }
html[data-theme="dark"] .fin-contract-left.is-over, html[data-theme="dark"] .fin-contract-rest.is-over { color: #f08a7c; }
/* under the contractor on a list: the contract on one line, what is left of it on the next */
.fin-contract-rest { display: block; }
.fin-contract-line { display: block; margin-top: 4px; font-size: 0.78rem; line-height: 1.6; color: var(--muted); font-weight: 400; }
.fin-contract-line.is-none { font-style: normal; }
/* the sheet of a supervisor: fourteen columns in the same 1000px as the others' twelve — the two new ones taken from the
   others' share («نوع پیوست» keeps its 8%: «قرارداد» must show whole in it, round 74); a box's word wraps under it when
   the column is narrow */
.fin-entry-sheet.has-contract col.fin-e-n { width: 3%; } .fin-entry-sheet.has-contract col.fin-e-who { width: 7.8%; }
.fin-entry-sheet.has-contract col.fin-e-date { width: 8.2%; } .fin-entry-sheet.has-contract col.fin-e-contract { width: 7.2%; }
.fin-entry-sheet.has-contract col.fin-e-camount { width: 8.6%; } .fin-entry-sheet.has-contract col.fin-e-bank { width: 4.8%; }
.fin-entry-sheet.has-contract col.fin-e-card { width: 8.4%; } .fin-entry-sheet.has-contract col.fin-e-sheba { width: 10.2%; }
.fin-entry-sheet.has-contract col.fin-e-amount { width: 8.6%; } .fin-entry-sheet.has-contract col.fin-e-proj { width: 6.8%; }
.fin-entry-sheet.has-contract col.fin-e-topic { width: 6.4%; } .fin-entry-sheet.has-contract col.fin-e-note { width: 5.8%; }
.fin-entry-sheet.has-contract col.fin-e-akind { width: 8%; } .fin-entry-sheet.has-contract col.fin-e-files { width: 6.2%; }
/* fourteen columns: the cells' side padding 4px instead of 6px, so every box keeps its room */
@media screen and (min-width: 701px) {
    .fin-entry-sheet.has-contract > thead > tr > th, .fin-entry-sheet.has-contract > tbody > tr > td { padding-inline: 4px; }
}
.fin-entry-sheet .fin-checks-cell .fin-check { align-items: flex-start; white-space: normal; line-height: 1.35; }
.fin-entry-sheet .fin-checks-cell .fin-check input[type="checkbox"] { margin-top: 1px; }
.fin-draft-edit .fin-entry-sheet.has-contract { min-width: 0; }

/* round 118: the director's three cards of «لیست‌های باز», and the card opened under them */
.fin-pay-cards { margin: 0 0 20px; }
.fin-pay-card-paid { display: block; margin-top: 2px; font-size: 0.78rem; color: var(--muted); }
.fin-pay-detail-head { margin: 0 0 12px; font-size: 1.05rem; }
.fin-pay-method-chip { vertical-align: middle; }
.fin-draft-group-head .fin-pay-method-chip { margin-inline-start: 6px; font-size: 0.78rem; }

@media screen and (max-width: 700px) {
    .fin-sheet-top .fin-pay-method { flex: 1 1 100%; }
    .fin-pay-part { flex: 1 1 100%; }
    /* the supervisor's card: date and «قرارداد», then «مبلغ قرارداد» and «بانک» two by two; the account boxes across;
       amount and project, «سرفصل» and «نوع پیوست» as before — the old pairs counted two columns on */
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(5), .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(6),
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(10), .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(13) {
        flex: 0 0 calc(50% - 6px); width: calc(50% - 6px); max-width: calc(50% - 6px); }
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(7), .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(8) {
        flex: 0 0 100%; width: 100%; max-width: 100%; }
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(10), .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(11) { order: 0; }
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(13) { order: 10; }
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(12) { order: 11; }
    .fin-entry-sheet.has-contract tr.fin-entry > td:nth-child(14) { order: 12; }
    .fin-entry-sheet.has-contract { min-width: 0; }
    .fin-entry-sheet .fin-checks-cell { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; font-size: 0.92rem; }
    .fin-entry-sheet .fin-checks-cell .fin-check { align-items: center; white-space: nowrap; }
    .fin-entry-sheet .fin-checks-cell .fin-check { min-height: 44px; }
    .fin-entry-sheet .fin-check input[type="checkbox"] { width: 20px; height: 20px; min-width: 20px; min-height: 0; }
}
/* the sheet's top row and the edit line write their labels as columns — a box's label stays one line beside its box */
.fin-sheet-top .fin-pay-method .fin-check, .fin-more .fin-pay-method .fin-check {
    display: inline-flex; flex-direction: row; align-items: center; gap: 7px; min-width: 0; font-weight: 500; }
.fin-more.is-edit .fin-pay-method { grid-column: span 2; }
@media screen and (max-width: 700px) {
    .fin-sheet-top .fin-pay-method .fin-check { flex: 0 0 auto; }
    .fin-more.is-edit .fin-pay-method { grid-column: auto; }
}
/* the contract's figures break only between their groups of three (finance tabs' grouped), never inside a group */
.fin-contract-line bdi, .fin-sheet td .fin-contract-line bdi { overflow-wrap: normal; word-break: normal; }

/* round 119: «تهیه صورت وضعیت» — the employer's statement and the base sheet, made from the finance lists */
.stmt-entry-body { display: flex; flex-wrap: wrap; gap: 8px; }
.stmt-pick { margin-bottom: 12px; }
.stmt-tiles { margin: 0 0 20px; }
.stmt-views { margin: 0 0 12px; }
.stmt-alert { margin: 0 0 12px; padding: 10px 14px; border: 1px solid #f0c36d; border-radius: 9px; background: #fff7e0;
    color: #6b4a00; line-height: 1.9; }
html[data-theme="dark"] .stmt-alert { background: #2b2410; border-color: #6b5320; color: #f3d38a; }
.stmt-alert .act-btn { margin-inline-start: 8px; }
.stmt-bill-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.stmt-bill-title { display: flex; flex-direction: column; gap: 4px; }
.stmt-bill-title h2 { margin: 0; font-size: 1.25rem; color: var(--accent); }
.stmt-bill-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.stmt-bill { width: 100%; border-collapse: collapse; }
.stmt-bill th, .stmt-bill td, .stmt-base th, .stmt-base td, .stmt-inner th, .stmt-inner td, .stmt-assign td, .stmt-inputs td {
    border: 1px solid var(--border-soft); padding: 6px 10px; text-align: center; vertical-align: middle; }
.stmt-bill td.stmt-group { background: var(--bg); font-weight: 700; color: var(--accent); width: 11%; }
.stmt-bill td.stmt-part { background: var(--bg); font-size: 0.86rem; width: 7%; }
.stmt-bill td.stmt-n { width: 5%; color: var(--muted); }
.stmt-bill td.stmt-label, .stmt-base td.stmt-label, .stmt-inner th.stmt-label, .stmt-assign td.stmt-label { text-align: right; }
.stmt-bill td.stmt-amt, .stmt-base td.stmt-amt, .stmt-inner td.stmt-amt, .stmt-assign td.stmt-amt { white-space: nowrap; }
.stmt-bill td.stmt-note, .stmt-inner td.stmt-note { text-align: right; font-size: 0.86rem; color: var(--muted); }
.stmt-bill tr.stmt-sum td { background: var(--bg); font-weight: 700; }
.stmt-bill tr.stmt-sum.is-strong td { border-bottom: 2px solid var(--accent); }
.stmt-bill tr.stmt-discount td { background: #e6f4ea; color: #1b5e20; }
html[data-theme="dark"] .stmt-bill tr.stmt-discount td { background: #13281a; color: #9fd8ab; }
.stmt-bill tr.stmt-waiting td { background: #fff7e0; color: #6b4a00; }
html[data-theme="dark"] .stmt-bill tr.stmt-waiting td { background: #2b2410; color: #f3d38a; }
.stmt-summary { margin-top: 20px; }
.stmt-summary tr.stmt-pay td { background: var(--accent); color: #fff; font-weight: 700; }
.stmt-signs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.stmt-signs > div { display: flex; flex-direction: column; gap: 32px; padding: 10px 12px; border: 1px solid var(--border-soft);
    border-radius: 9px; text-align: center; }
.stmt-signs span { color: var(--muted); font-size: 0.82rem; }
.stmt-foot { margin: 12px 0 0; }
.stmt-base { min-width: 1500px; font-size: 0.86rem; }
.stmt-base tr.is-empty td { color: var(--muted); }
.stmt-base .is-neg, .stmt-inner .is-neg { color: #b8392a; }
.stmt-base tfoot td { background: var(--bg); font-weight: 700; }
.stmt-inner { max-width: 980px; }
.stmt-inner th.stmt-label { width: 32%; background: var(--bg); }
.stmt-inner td.stmt-amt { width: 22%; font-weight: 700; }
.stmt-inputs { min-width: 1200px; }
.stmt-inputs input, .stmt-inputs select { width: 100%; min-width: 0; }
.stmt-inputs input.stmt-pct { max-width: 70px; text-align: center; }
.stmt-assign select { min-width: 220px; }
@media screen and (max-width: 700px) {
    .stmt-bill-head { flex-direction: column; align-items: flex-start; }
    .stmt-signs { grid-template-columns: 1fr; }
    .stmt-bill { min-width: 640px; }
}
@media print {
    body * { visibility: hidden; }
    .stmt-print, .stmt-print * { visibility: visible; }
    .stmt-print { position: absolute; inset: 0 0 auto 0; border: 0; box-shadow: none; }
    .stmt-print .table-wrap { overflow: visible; }
    .stmt-bill { min-width: 0; font-size: 10.5pt; }
    .stmt-bill td, .stmt-bill th { padding: 3px 6px; }
}

/* ── round 120: «گزارش جامع مدیریتی» (management_report.html) and its entry in the assistant ── */
.asst-report-link { margin-inline-start: auto; flex: 0 0 auto; white-space: nowrap; }
.mg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mg-sub { margin: 4px 0 0; }
.mg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-tabs { margin: 0 0 20px; }
.mg-tiles { margin: 0 0 20px; }
.mg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; }
.mg-grid > .panel { margin: 0; }
.mg-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mg-unit { font-size: 0.82rem; font-weight: 400; margin-inline-start: 6px; }
.mg-links { margin-top: 12px; }
.mg-neg { color: var(--red-deep); }
.mg-strong { font-weight: 800; }
.mg-table { width: 100%; }
.mg-table th, .mg-table td { padding: 10px 12px; white-space: nowrap; text-align: center; vertical-align: middle; }
.mg-table td.mg-name { text-align: right; white-space: normal; min-width: 150px; }
.mg-table td.mg-name small { display: block; margin-top: 2px; }
.mg-table td.mg-projects { white-space: normal; text-align: right; min-width: 160px; font-size: 0.88rem; }
.mg-table td.mg-left { text-align: right; font-size: 0.86rem; }
.mg-table tfoot td { background: var(--bg); font-weight: 700; }
.mg-table tr.mg-sum.is-strong td { border-top: 2px solid var(--accent); }
.mg-flag { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: #fdf5ec; color: #9a5a12; font-size: 0.78rem; }
.mg-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.mg-count { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; border-radius: 10px;
    border: 1px solid var(--border-soft); color: var(--text); text-decoration: none; font-size: 0.88rem; }
.mg-count b { font-size: 1.4rem; }
.mg-count.mg-c-green b { color: var(--green); }
.mg-count.mg-c-orange b { color: #c26a12; }
.mg-count.mg-c-red b { color: var(--red-deep); }
.mg-note { margin: 12px 0 0; }
.mg-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mg-fact { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 10px; }
.mg-fact span { font-size: 0.86rem; color: var(--muted); }
.mg-fact b { font-size: 1.3rem; }
.mg-fact small { color: var(--muted); font-size: 0.8rem; }
.mg-fact.is-warn b { color: var(--red-deep); }
.mg-steps .panel-head .badge { margin-inline-start: 6px; }
.mg-steps.mg-s-green .panel-head { border-top: 3px solid var(--green); }
.mg-steps.mg-s-orange .panel-head { border-top: 3px solid #e08a2b; }
.mg-steps.mg-s-red .panel-head { border-top: 3px solid var(--red-deep); }
.mg-step { flex-direction: column; align-items: flex-start; gap: 4px; }
.mg-step .muted { white-space: normal; font-size: 0.86rem; }
.mg-find { margin: 0 0 20px; align-items: flex-end; }
.mg-find input[type="search"] { min-width: 260px; }
.mg-how summary { cursor: pointer; list-style: none; }
.mg-rules { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.9; }
@media (max-width: 900px) {
    .mg-grid, .mg-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .mg-counts { grid-template-columns: minmax(0, 1fr); }
    .mg-facts { grid-template-columns: minmax(0, 1fr); }
    .mg-find input[type="search"] { min-width: 0; width: 100%; }
    .asst-report-link .asst-report-word { display: none; }
}
@media print {
    .mg-tabs, .mg-actions, .mg-find, .back-link { display: none !important; }
}
/* a negative figure on a tile: the figure keeps the tile's size, the word «منفی» before it is the small one */
.stat-tile-num .mg-neg { display: inline-flex; align-items: baseline; gap: 6px; font-size: inherit; }
.stat-tile-num .mg-neg bdi { font-size: 1em; }
.mg-neg-word { font-size: 0.62em; font-weight: 600; }

/* ── round 120, second pass: the management report's charts (_mg_charts.html) ──
   Roles, not hex, in the marks: the reference categorical order (blue, orange, aqua, yellow, magenta, green — validated
   adjacent-pair CVD ≥ 8 in both modes), each mode its own steps; status colours kept apart from the series. */
.mg-viz { --mg-s1: #2a78d6; --mg-s2: #eb6834; --mg-s3: #1baf7a; --mg-s4: #eda100; --mg-s5: #e87ba4; --mg-s6: #008300;
    --mg-good: #1d7a4c; --mg-open: #9fb6d6; --mg-bad: #b8392a; --mg-grid: #e6e5ee; --mg-ink2: #6b6a78; --mg-track: #f1f0f6;
    --mg-surface: #fff; margin: 0; }
html[data-theme="dark"] .mg-viz { --mg-s1: #3987e5; --mg-s2: #d95926; --mg-s3: #199e70; --mg-s4: #c98500; --mg-s5: #d55181;
    --mg-s6: #0ca30c; --mg-good: #2e9a63; --mg-open: #4d6383; --mg-bad: #d0564a; --mg-grid: #2e2e3a; --mg-ink2: #a3a2b4;
    --mg-track: #262632; --mg-surface: #1c1c25; }
.mg-c1 { --c: var(--mg-s1); } .mg-c2 { --c: var(--mg-s2); } .mg-c3 { --c: var(--mg-s3); }
.mg-c4 { --c: var(--mg-s4); } .mg-c5 { --c: var(--mg-s5); } .mg-c6 { --c: var(--mg-s6); }
.mg-s-in, .mg-s-cost { --c: var(--mg-s1); } .mg-s-out, .mg-s-owed { --c: var(--mg-s2); } .mg-s-profit { --c: var(--mg-s3); }
.mg-st-good { --c: var(--mg-good); } .mg-st-open { --c: var(--mg-open); } .mg-st-bad { --c: var(--mg-bad); }
.mg-band-green { --c: var(--mg-good); } .mg-band-blue { --c: var(--mg-s1); } .mg-band-teal { --c: #1f8a8a; }
.mg-band-orange { --c: #d9822b; } .mg-band-red { --c: var(--mg-bad); } .mg-band-grey { --c: #9a99a8; }
.mg-viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.mg-viz path.mg-s-in, .mg-viz path.mg-s-out, .mg-viz rect.mg-s-in, .mg-viz rect.mg-s-out { fill: var(--c); }
.mg-grid-line { stroke: var(--mg-grid); stroke-width: 1; }
.mg-base-line { stroke: var(--mg-ink2); stroke-width: 1; opacity: 0.5; }
.mg-axis { fill: var(--mg-ink2); font-size: 11px; font-family: inherit; }
.mg-hit-area { fill: transparent; }
.mg-hit:hover .mg-hit-area { fill: var(--mg-track); }
.mg-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 0.84rem; color: var(--mg-ink2); }
.mg-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mg-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: 0 0 auto; }
.mg-key-tick { width: 3px; height: 14px; border-radius: 2px; background: var(--text, #1d1d27); }
/* the ring */
.mg-ring { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: center; }
.mg-ring svg { width: 170px; }
.mg-ring-track { fill: none; stroke: var(--mg-track); stroke-width: 16; }
.mg-ring-seg { fill: none; stroke: var(--c); stroke-width: 16; transition: stroke-width .15s; }
.mg-ring-seg:hover { stroke-width: 19; }
.mg-ring-num { font-size: 17px; font-weight: 800; fill: var(--text, #1d1d27); font-family: inherit; }
html[data-theme="dark"] .mg-ring-num { fill: #ecebf5; }
.mg-ring-cap { font-size: 9px; fill: var(--mg-ink2); font-family: inherit; }
.mg-ring-legend { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mg-ring-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 42px; align-items: center; gap: 8px; font-size: 0.88rem; }
.mg-ring-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-ring-row b { font-weight: 700; white-space: nowrap; }
.mg-ring-row small { color: var(--mg-ink2); text-align: left; }
/* project / contractor bars */
.mg-proj { display: flex; flex-direction: column; gap: 12px; }
.mg-proj-row { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) 96px; align-items: center; gap: 12px;
    color: inherit; text-decoration: none; padding: 2px 0; border-radius: 8px; }
.mg-proj-row:hover .mg-proj-track { box-shadow: 0 0 0 2px var(--mg-grid); }
.mg-proj-name { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-proj-track { position: relative; display: flex; gap: 2px; height: 16px; background: var(--mg-track); border-radius: 5px; }
.mg-proj-seg { height: 100%; background: var(--c); }
.mg-proj-seg:first-child { border-start-start-radius: 5px; border-end-start-radius: 5px; }
.mg-proj-seg:last-of-type { border-start-end-radius: 5px; border-end-end-radius: 5px; }
.mg-proj-tick { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-inline-start: -1px; border-radius: 2px;
    background: var(--text, #1d1d27); box-shadow: 0 0 0 2px var(--mg-surface); }
html[data-theme="dark"] .mg-proj-tick, html[data-theme="dark"] .mg-key-tick { background: #ecebf5; }
.mg-proj-val { font-size: 0.86rem; font-weight: 700; text-align: left; white-space: nowrap; }
/* funnel */
.mg-funnel { display: flex; flex-direction: column; gap: 10px; }
.mg-funnel-row { display: grid; grid-template-columns: minmax(90px, 170px) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.mg-funnel-label { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-funnel-track { display: flex; justify-content: center; height: 22px; }
.mg-funnel-bar { height: 100%; border-radius: 6px; background: var(--c); }
.mg-funnel-val { font-size: 0.84rem; color: var(--mg-ink2); white-space: nowrap; }
.mg-funnel-val b { color: var(--text, inherit); font-size: 0.95rem; }
/* units and scores */
.mg-units, .mg-scores { display: flex; flex-direction: column; gap: 10px; }
.mg-unit-row { display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) 48px; align-items: center; gap: 12px;
    color: inherit; text-decoration: none; }
.mg-unit-name { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-unit-track { display: flex; gap: 2px; height: 14px; border-radius: 5px; overflow: hidden; background: var(--mg-track); }
.mg-unit-seg { background: var(--c); height: 100%; }
.mg-unit-val { font-size: 0.86rem; font-weight: 700; text-align: left; }
/* hero tiles with an icon and an accent */
.mg-hero { position: relative; overflow: hidden; }
.mg-hero::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 4px; border-radius: 0 4px 4px 0;
    background: var(--hero, var(--accent)); }
.mg-hero.is-good { --hero: #1d7a4c; } .mg-hero.is-bad { --hero: #b8392a; } .mg-hero.is-warn2 { --hero: #d9822b; }
.mg-hero .stat-tile-num { font-size: 1.55rem; }
.mg-hero-unit { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.mg-panel-sub { margin: -4px 0 14px; font-size: 0.84rem; }
.mg-wide { grid-column: 1 / -1; }
@media (max-width: 560px) {
    .mg-ring { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .mg-ring-legend { width: 100%; }
    .mg-proj-row { grid-template-columns: minmax(0, 1fr) 84px; }
    .mg-proj-name { grid-column: 1 / -1; }
    .mg-funnel-row { grid-template-columns: minmax(0, 1fr) auto; }
    .mg-funnel-label { grid-column: 1 / -1; }
    .mg-unit-row { grid-template-columns: minmax(0, 1fr) 44px; }
    .mg-unit-name { grid-column: 1 / -1; }
}
.mg-facts-wide { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.asst-viz { margin: 0 0 8px; }
.mg-viz svg { direction: ltr; } .mg-flow svg { max-height: 300px; }
/* the money-flow columns (HTML) */
.mg-flow-plot { position: relative; margin: 26px 0 0; padding-inline-end: 0; }
.mg-flow-grid { position: absolute; inset: 0; pointer-events: none; }
.mg-flow-grid > span { position: absolute; inset-inline: 0; border-top: 1px dashed var(--mg-grid); }
.mg-flow-grid > span.is-base { border-top: 1px solid var(--mg-ink2); opacity: 0.5; }
.mg-flow-grid em { position: absolute; inset-inline-start: 0; top: -20px; font-style: normal; font-size: 0.78rem; color: var(--mg-ink2);
    background: var(--mg-surface); padding-inline-end: 6px; }
.mg-flow-cols { position: absolute; inset: 0; display: flex; direction: ltr; }
.mg-flow-month { position: relative; flex: 1 1 0; display: flex; justify-content: center; align-items: flex-end; border-radius: 8px; outline: none; }
.mg-flow-month:hover, .mg-flow-month:focus-visible { background: var(--mg-track); }
.mg-flow-bars { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.mg-flow-bar { display: block; width: clamp(10px, 2.4vw, 26px); background: var(--c); border-radius: 4px 4px 0 0; min-height: 0; }
.mg-flow-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3;
    flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: 10px; background: var(--mg-surface); white-space: nowrap;
    box-shadow: 0 6px 20px rgba(20, 20, 40, .16); border: 1px solid var(--mg-grid); font-size: 0.82rem; direction: rtl; }
.mg-flow-tip > span { display: inline-flex; align-items: center; gap: 6px; }
.mg-flow-month:hover .mg-flow-tip, .mg-flow-month:focus-visible .mg-flow-tip { display: flex; }
.mg-flow-labels { display: flex; direction: ltr; margin-top: 8px; }
.mg-flow-labels span { flex: 1 1 0; text-align: center; font-size: 0.82rem; color: var(--mg-ink2); }
/* round 120, third pass: the assistant's answers — a summary on top, charts side by side */
.mg-gauge { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mg-gauge svg { width: 130px; }
.mg-gauge-cap { font-size: 0.86rem; color: var(--mg-ink2); text-align: center; }
.asst-viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; margin: 8px 0 12px; }
.asst-viz-cell { min-width: 0; padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface, #fff); }
.asst-viz-cell.is-wide { grid-column: 1 / -1; }
.asst-viz-cell .asst-subhead { margin-top: 0; }
.asst-viz-cell .mg-ring { grid-template-columns: 130px minmax(0, 1fr); gap: 14px; }
.asst-viz-cell .mg-ring svg { width: 130px; }
.asst-brief { margin: 0 0 16px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border-soft); background: var(--surface, #fff); }
.asst-brief-head { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 0 0 10px; }
.asst-brief-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 12px; }
.asst-brief-tile { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.asst-brief-tile span { font-size: 0.8rem; color: var(--muted); }
.asst-brief-tile b { font-size: 1.2rem; }
.asst-brief-tile.is-warn b { color: var(--red-deep); }
.asst-brief-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.asst-brief-list li { display: flex; gap: 8px; align-items: baseline; line-height: 1.8; }
.asst-brief-list li::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--dot, #9a99a8); transform: translateY(-1px); }
.asst-brief-list li.tone-good { --dot: #1d7a4c; } .asst-brief-list li.tone-bad { --dot: #b8392a; }
.asst-brief-list li.tone-warn { --dot: #d9822b; } .asst-brief-list li.tone-info { --dot: #2a78d6; }
html[data-theme="dark"] .asst-viz-cell, html[data-theme="dark"] .asst-brief { background: #1c1c25; }
@media (max-width: 560px) {
    .asst-viz-grid { grid-template-columns: minmax(0, 1fr); }
    .asst-viz-cell .mg-ring { grid-template-columns: minmax(0, 1fr); }
}
.asst-card-points { margin: 4px 0 14px; }
@media (max-width: 560px) { .asst-brief-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .asst-brief { padding: 14px; } }
/* round 120, fourth pass: the exact answer's tables */
.asst-table-wrap { margin: 4px 0 16px; max-height: 460px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 12px; }
.asst-table { width: 100%; font-size: 0.88rem; }
.asst-table th { position: sticky; top: 0; background: var(--bg); z-index: 1; white-space: nowrap; }
.asst-table th, .asst-table td { padding: 8px 10px; text-align: right; vertical-align: middle; }
.asst-table td { white-space: nowrap; }
.asst-table td:has(> a) { white-space: normal; min-width: 140px; }
.asst-table tfoot td { background: var(--bg); font-weight: 700; position: sticky; bottom: 0; }
.asst-answer .asst-said { font-size: 1.02rem; line-height: 2; }
.mg-scores .mg-unit-row { grid-template-columns: minmax(80px, 160px) minmax(0, 1fr) auto; }
.mg-scores .mg-unit-val { white-space: nowrap; min-width: 48px; }
@media (max-width: 560px) { .mg-scores .mg-unit-row { grid-template-columns: minmax(0, 1fr) auto; } }
/* round 120, fifth pass: «سلامت داده», the next questions, a click that asks */
.mg-health-brief { margin: 0 0 20px; }
.mg-health-row { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.mg-health-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 10px; text-decoration: none;
    color: var(--text); border: 1px solid var(--border-soft); border-inline-start: 4px solid var(--tone, #9a99a8); background: var(--surface, #fff); }
.mg-health-chip small { color: var(--muted); }
.mg-health-chip.tone-bad, .mg-health.tone-bad { --tone: #b8392a; }
.mg-health-chip.tone-warn, .mg-health.tone-warn { --tone: #d9822b; }
.mg-health-chip.tone-info, .mg-health.tone-info { --tone: #2a78d6; }
.mg-health .panel-head { border-top: 3px solid var(--tone, #9a99a8); }
.mg-health .panel-head .badge { margin-inline-start: 8px; }
.mg-health-why { margin: 0 0 12px; line-height: 1.9; }
html[data-theme="dark"] .mg-health-chip { background: #1c1c25; }
.asst-next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.asst-next-cap { font-size: 0.84rem; color: var(--muted); }
.asst-cell-ask { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.asst-cell-ask:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button.mg-ask { all: unset; box-sizing: border-box; display: grid; width: 100%; cursor: pointer; border-radius: 8px; }
.mg-scores button.mg-ask { grid-template-columns: minmax(80px, 160px) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
button.mg-ask:hover .mg-unit-track, button.mg-ask:focus-visible .mg-unit-track { box-shadow: 0 0 0 2px var(--mg-grid); }
button.mg-ask:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 560px) { .mg-scores button.mg-ask { grid-template-columns: minmax(0, 1fr) auto; } }
