/* KeshtTeam 4 — design system. RTL first, logical properties, light + dark themes, no external assets. */

@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-Variable.f6d31671339d.woff2") format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f2f4f1;
  --surface-3: #e7eae5;
  --hover: rgba(20, 40, 30, 0.05);
  --border: #e2e6e0;
  --border-strong: #cdd3ca;
  --text: #15201a;
  --text-2: #4a5650;
  --text-3: #85908a;
  --primary: #0e7c66;
  --primary-hover: #0b6654;
  --primary-soft: #e3f3ee;
  --primary-text: #ffffff;
  --danger: #c93a32;
  --danger-soft: #fcebea;
  --warning: #b8690b;
  --warning-soft: #fff3df;
  --success: #1f8a4c;
  --success-soft: #e4f5ea;
  --info: #2563eb;
  --info-soft: #e8efff;
  --focus: 0 0 0 3px rgba(14, 124, 102, 0.28);
  --shadow-sm: 0 1px 2px rgba(16, 32, 24, 0.06);
  --shadow: 0 1px 3px rgba(16, 32, 24, 0.08), 0 4px 12px rgba(16, 32, 24, 0.05);
  --shadow-lg: 0 12px 40px rgba(16, 32, 24, 0.18), 0 2px 8px rgba(16, 32, 24, 0.08);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar: 248px;
  --topbar: 56px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d110f; --surface: #141a17; --surface-2: #1a211d; --surface-3: #232c27; --hover: rgba(255, 255, 255, 0.05);
    --border: #26302b; --border-strong: #36423b; --text: #e6ece8; --text-2: #a9b4ae; --text-3: #6f7b74;
    --primary: #3fc8a5; --primary-hover: #6ad8bb; --primary-soft: rgba(63, 200, 165, 0.13); --primary-text: #0b1210;
    --danger: #f17b73; --danger-soft: rgba(241, 123, 115, 0.13); --warning: #f2b84b; --warning-soft: rgba(242, 184, 75, 0.12);
    --success: #4fd08a; --success-soft: rgba(79, 208, 138, 0.12); --info: #7ea6ff; --info-soft: rgba(126, 166, 255, 0.13);
    --focus: 0 0 0 3px rgba(63, 200, 165, 0.35); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d110f; --surface: #141a17; --surface-2: #1a211d; --surface-3: #232c27; --hover: rgba(255, 255, 255, 0.05);
  --border: #26302b; --border-strong: #36423b; --text: #e6ece8; --text-2: #a9b4ae; --text-3: #6f7b74;
  --primary: #3fc8a5; --primary-hover: #6ad8bb; --primary-soft: rgba(63, 200, 165, 0.13); --primary-text: #0b1210;
  --danger: #f17b73; --danger-soft: rgba(241, 123, 115, 0.13); --warning: #f2b84b; --warning-soft: rgba(242, 184, 75, 0.12);
  --success: #4fd08a; --success-soft: rgba(79, 208, 138, 0.12); --info: #7ea6ff; --info-soft: rgba(126, 166, 255, 0.13);
  --focus: 0 0 0 3px rgba(63, 200, 165, 0.35); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.65; color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 var(--s3); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code, pre { font-family: var(--mono); font-size: 13px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.icon { flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: var(--s4); } .mb { margin-bottom: var(--s4); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; padding: var(--s3); gap: var(--s1); }
.brand { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s2) var(--s3); font-weight: 800; font-size: 15px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--primary); color: var(--primary-text);
  display: grid; place-items: center; }
.nav-group { margin-top: var(--s3); }
.nav-title { font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: var(--s1) var(--s2); display: flex; justify-content: space-between; align-items: center; }
.nav-link { display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s2); border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-link .count { margin-inline-start: auto; font-size: 11.5px; color: var(--text-3); }
.dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--text-3)); flex: none; }
.sidebar-foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s5); }
.search { position: relative; flex: 1; max-width: 460px; }
.search input[type="search"] { padding-inline-start: 34px; background: var(--surface); }
.search .icon { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text-3); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s2); }
.bell { position: relative; }
.bell .badge-count { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.menu-toggle { display: none; }
.content { padding: var(--s6) var(--s6) var(--s8); width: 100%; max-width: 1400px; margin: 0 auto; }
.content.wide { max-width: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--text-2); }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; }
.tab { padding: 8px 12px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { width: 36px; padding: 0; }
.icon-btn.btn-sm { width: 30px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ---------- forms ---------- */
.input, input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[type="color"] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--s4); }
.field > label, .field-label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 12.5px; }
.form-errors { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: var(--s3); margin-bottom: var(--s4); }
.form-errors .errorlist { color: inherit; }
.checks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.checks label, label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); cursor: pointer; }
.checks ul, .checks div { list-style: none; margin: 0; padding: 0; display: contents; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--s2); align-items: center; padding-top: var(--s2); flex-wrap: wrap; }
.form-narrow { max-width: 640px; }

/* ---------- panels, tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.panel-pad { padding: var(--s5); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 14px; }
.panel-body { padding: var(--s4); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12px; font-weight: 700; color: var(--text-3); padding: 9px var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.table .actions { text-align: end; white-space: nowrap; }
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--text-2); }
.empty .icon { color: var(--text-3); margin-bottom: var(--s2); }
.empty h3 { margin-bottom: 4px; }

/* ---------- chips, avatars ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--text-3)) 13%, transparent); color: color-mix(in srgb, var(--c, var(--text-2)) 82%, var(--text)); white-space: nowrap; }
.chip.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.chip .icon { width: 13px; height: 13px; }
.key { font-family: var(--mono); font-size: 12px; color: var(--text-3); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.avatar { width: var(--size, 26px); height: var(--size, 26px); border-radius: 50%; background: var(--av); color: #fff; display: inline-grid; place-items: center;
  font-size: calc(var(--size, 26px) * 0.42); font-weight: 700; flex: none; line-height: 1; }
.avatars { display: inline-flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-inline-start: -6px; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.prio-urgent { color: var(--danger); } .prio-high { color: var(--warning); } .prio-medium { color: var(--info); } .prio-low { color: var(--text-3); }
.due-overdue { color: var(--danger); font-weight: 600; } .due-soon { color: var(--warning); font-weight: 600; }

/* ---------- messages ---------- */
.messages { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.alert { padding: 10px 14px; border-radius: var(--radius); background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
  display: flex; gap: var(--s2); align-items: flex-start; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.toast-zone { position: fixed; inset-block-end: var(--s5); inset-inline-start: 50%; transform: translateX(50%); z-index: 90; display: flex; flex-direction: column; gap: var(--s2); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 600; }

/* ---------- menus, dialogs ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 40; inset-inline-end: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.menu-pop.start { inset-inline-end: auto; inset-inline-start: 0; }
.menu-item { display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); background: none;
  border: 0; font: inherit; text-align: start; cursor: pointer; }
.menu-item:hover { background: var(--hover); text-decoration: none; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10, 16, 12, 0.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.dialog-body { padding: var(--s5); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { justify-content: center; font-size: 18px; margin-bottom: var(--s4); }
.auth-card .panel { padding: var(--s6); }
.auth-card h1 { font-size: 17px; margin-bottom: var(--s4); text-align: center; }

/* ---------- stats & dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s4); color: var(--text); display: block; }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 800; margin-top: 2px; }
.stat-value.danger { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c, var(--primary)); border-radius: 3px; }

/* ---------- task rows & cards ---------- */
.task-row { display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s4); border-bottom: 1px solid var(--border); color: var(--text); }
.task-row:hover { background: var(--hover); text-decoration: none; }
.task-row:last-child { border-bottom: 0; }
.task-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.task-row .meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: nowrap; }
.type-icon { color: var(--c); display: inline-flex; }
.group-head { display: flex; align-items: center; gap: var(--s2); padding: 8px var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13px; position: sticky; top: var(--topbar); z-index: 2; }
.group-head .faint { font-weight: 500; }

.board { display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3); align-items: flex-start; min-height: calc(100vh - 210px); }
.column { flex: 0 0 290px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column;
  max-height: calc(100vh - 200px); }
.column-head { display: flex; align-items: center; gap: var(--s2); padding: 10px var(--s3); font-weight: 700; font-size: 13px; }
.column-head .count { color: var(--text-3); font-weight: 600; }
.column-head .wip-over { color: var(--danger); }
.column-body { padding: 0 var(--s2) var(--s2); overflow-y: auto; min-height: 60px; display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px var(--s3); box-shadow: var(--shadow-sm);
  cursor: grab; color: var(--text); display: block; }
.card:hover { border-color: var(--border-strong); text-decoration: none; }
.card-top { display: flex; align-items: center; gap: 6px; }
.card-title { font-weight: 600; margin: 2px 0 8px; line-height: 1.55; word-break: break-word; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.card-meta .avatars { margin-inline-start: auto; }
.card.sortable-ghost { opacity: .4; }
.card.sortable-chosen { box-shadow: var(--shadow-lg); }
.quick-add { margin: 0 var(--s2) var(--s2); }
.quick-add input { background: var(--surface); }

/* ---------- task detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s6); align-items: start; }
.detail-main { min-width: 0; }
.detail-side { position: sticky; top: calc(var(--topbar) + var(--s4)); }
.props { display: flex; flex-direction: column; gap: 2px; }
.prop { display: grid; grid-template-columns: 100px 1fr; gap: var(--s2); align-items: center; min-height: 34px; padding: 3px 0; }
.prop-label { color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.prose { line-height: 1.85; word-break: break-word; }
.prose p:last-child { margin-bottom: 0; }
.prose ol { list-style-type: persian; }
.prose pre { background: var(--surface-2); padding: var(--s3); border-radius: var(--radius); overflow-x: auto; direction: ltr; text-align: left; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0; padding-inline-start: var(--s3); border-inline-start: 3px solid var(--border-strong); color: var(--text-2); }
.prose table { border-collapse: collapse; } .prose td, .prose th { border: 1px solid var(--border); padding: 4px 8px; }
.section { margin-top: var(--s6); }
.section-title { display: flex; align-items: center; gap: var(--s2); font-size: 14px; font-weight: 700; margin-bottom: var(--s3); }
.timeline { display: flex; flex-direction: column; }
.event { display: flex; gap: var(--s3); padding: var(--s2) 0; font-size: 13px; color: var(--text-2); }
.comment { display: flex; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.comment-body { flex: 1; min-width: 0; }
.mention { background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0 4px; font-weight: 600; }

/* ---------- filters ---------- */
.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.toolbar select, .toolbar input:not([type="checkbox"]):not([type="radio"]) { width: auto; min-width: 130px; height: 34px; min-height: 34px; }
.filter-toggle { display: none; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg a, .seg button { padding: 6px 12px; color: var(--text-2); font-weight: 600; background: var(--surface); border: 0; font: inherit; display: inline-flex; gap: 6px; align-items: center; }
.seg a + a { border-inline-start: 1px solid var(--border-strong); }
.seg a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.seg a:hover { text-decoration: none; background: var(--hover); }

/* ---------- permission matrix ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.yes { color: var(--success); } .no { color: var(--text-3); }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--border); gap: 1px; }
.cal-head { background: var(--surface-2); padding: 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-2); }
.cal-day { background: var(--surface); min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-day.other { background: var(--surface-2); }
.cal-day.today .cal-num { background: var(--primary); color: var(--primary-text); }
.cal-num { font-size: 12px; font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-task { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ---------- jalali picker ---------- */
.jp { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: var(--s2); width: 264px; }
.jp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 700; }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jp-grid span { font-size: 11px; color: var(--text-3); padding: 4px 0; }
.jp-grid button { border: 0; background: none; font: inherit; padding: 5px 0; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.jp-grid button:hover { background: var(--hover); }
.jp-grid button.sel { background: var(--primary); color: var(--primary-text); }
.jp-grid button.today { outline: 1px solid var(--primary); }
.jp-foot { display: flex; justify-content: space-between; margin-top: 6px; }
.date-wrap { position: relative; }

/* ---------- htmx ---------- */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; inset-block: 0; inset-inline-start: 0; width: min(290px, 85vw); transform: translateX(100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 16, 12, .4); z-index: 45; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 var(--s3); gap: var(--s2); }
  .content { padding: var(--s4) var(--s3) var(--s8); }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .search .kbd { display: none; }
  .hide-sm { display: none !important; }
  .task-row { flex-wrap: wrap; }
  .task-row .title { flex-basis: 100%; white-space: normal; }
  .prop { grid-template-columns: 90px 1fr; }
  .page-head { flex-direction: column; align-items: stretch; gap: var(--s3); }
  .page-head > .grow { flex: none; }
  .filter-toggle { display: inline-flex; }
  .toolbar:not(.open) .filter-extra { display: none; }
  .toolbar input[type="search"] { flex: 1; min-width: 0 !important; }
  .toolbar.open select { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- roadmap ---------- */
.roadmap { overflow-x: auto; }
.rm-head, .rm-body { min-width: 720px; }
.rm-head { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.rm-head > div { padding: 8px 10px; font-size: 12.5px; font-weight: 700; color: var(--text-2); border-inline-start: 1px solid var(--border); }
.rm-head > div:first-child { border-inline-start: 0; }
.rm-body { position: relative; padding: 12px 0 16px; min-height: 120px; }
.rm-row { position: relative; height: 38px; }
.rm-bar { position: absolute; top: 4px; height: 30px; border-radius: 8px; background: color-mix(in srgb, var(--c) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); overflow: hidden; display: flex; align-items: center; color: var(--text); }
.rm-bar:hover { text-decoration: none; border-color: var(--c); }
.rm-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--c) 30%, transparent); }
.rm-label { position: relative; padding: 0 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.rm-today { position: absolute; inset-block: 0; width: 2px; background: var(--danger); opacity: .6; z-index: 1; }
.rm-release { position: absolute; top: -6px; transform: translateX(50%); color: var(--warning); z-index: 2; }

/* ---------- reports ---------- */
.throughput { display: flex; align-items: flex-end; gap: 8px; height: 170px; }
.tp-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.tp-bar { width: 100%; max-width: 36px; min-height: 2px; background: var(--primary); border-radius: 4px 4px 0 0; }
.tp-n { font-size: 12px; font-weight: 700; }
.tp-label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
