/* فونت یکان‌بخ (YekanBakh4 ProPlus، نسخهٔ متغیر): FaNum برای رابط و نمودارها، نسخهٔ لاتین برای کد و متن انگلیسی */
@font-face { font-family: 'YekanBakhFaNum'; src: url('fonts/YekanBakhFaNum-VF.woff2') format('woff2-variations'), url('fonts/YekanBakhFaNum-VF.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'YekanBakh'; src: url('fonts/YekanBakh-VF.woff2') format('woff2-variations'), url('fonts/YekanBakh-VF.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }

/* Ratin Process Studio — Persian RTL workspace styling.
   Layered on top of the bpmn-js / dmn-js / cmmn-js assets bundled by esbuild
   into /app.css. Dark sidebar + white surfaces, teal accent. */

:root {
  --teal-50: #eefbf7;
  --teal-100: #d3f5ec;
  --teal-200: #a8ebdb;
  --teal-300: #6fdbc5;
  --teal-400: #35c3a8;
  --teal-500: #14a68c;
  --teal-600: #0d8672;
  --teal-700: #0c6a5c;
  --teal-800: #0b544a;

  --ink-900: #0e1b1e;
  --ink-800: #16282c;
  --ink-700: #22383d;
  --ink-600: #3c5157;
  --ink-500: #5b6f75;
  --ink-400: #6c7f84;
  --ink-300: #b3c1c5;
  --ink-200: #d7e0e2;
  --ink-100: #eaeff0;
  --ink-50: #f5f8f8;

  --sidebar: #0c1a1f;
  --sidebar-2: #102329;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #cfe0e2;

  --surface: #ffffff;
  --canvas: #f7faf9;

  --ok: #118a5c;
  --ok-bg: #e8f7f0;
  --warn: #a4690b;
  --warn-bg: #fdf3e2;
  --danger: #b3352f;
  --danger-bg: #fdeceb;
  --info: #1f6c9c;
  --info-bg: #eaf3fa;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(14, 27, 30, 0.06), 0 1px 3px rgba(14, 27, 30, 0.04);
  --shadow: 0 8px 24px -12px rgba(14, 27, 30, 0.18), 0 2px 6px rgba(14, 27, 30, 0.05);
  --shadow-lg: 0 24px 60px -24px rgba(14, 27, 30, 0.35);

  --font: 'YekanBakhFaNum', 'YekanBakh', 'Segoe UI', 'Tahoma', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

  --sidebar-w: 268px;
  --topbar-h: 84px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-800);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-900); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; font-size: inherit; }
code { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--teal-500); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 200;
  background: var(--teal-600); color: #fff; padding: 8px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { inset-inline-start: 16px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ shell */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px 18px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(20, 166, 140, 0.18), transparent 60%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  border-inline-end: 1px solid rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 2px; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(20, 166, 140, 0.9), rgba(12, 106, 92, 0.85));
  color: #eafffa;
  box-shadow: 0 8px 20px -10px rgba(20, 166, 140, 0.9);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.brand-text strong { color: #f2fbf9; font-size: 15px; font-weight: 700; }
.brand-text small { color: rgba(207, 224, 226, 0.62); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(219, 234, 236, 0.92);
  text-align: start;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(20, 166, 140, 0.22), rgba(20, 166, 140, 0.06));
  border-color: rgba(111, 219, 197, 0.28);
  color: #ffffff;
  font-weight: 600;
}
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; opacity: 0.85; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-item.is-active .nav-icon { color: var(--teal-300); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-line);
}
.sidebar-note {
  font-size: 11.5px;
  line-height: 1.75;
  color: rgba(214, 232, 234, 0.78);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 9px 11px;
}
.sidebar-note strong { color: rgba(232, 249, 246, 0.9); font-weight: 600; }
.sidebar-note--warn { background: rgba(164, 105, 11, 0.16); color: rgba(255, 218, 160, 0.86); }
.sidebar-version { font-size: 11px; color: rgba(207, 224, 226, 0.4); padding-inline: 4px; }

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: var(--canvas);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: var(--topbar-h);
  padding: 18px 30px;
  background: rgba(247, 250, 249, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-100);
}
.topbar-titles h1 { font-size: 21px; }
.topbar-titles p { color: var(--ink-500); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.main { flex: 1; padding: 26px 30px 40px; min-width: 0; }
.view { display: block; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.page-foot {
  padding: 16px 30px 26px;
  border-top: 1px solid var(--ink-100);
  color: var(--ink-500);
  font-size: 11.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.page-foot-warn { color: #7a4e07; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease, box-shadow 140ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(180deg, var(--teal-500), var(--teal-600));
  color: #fff;
  box-shadow: 0 6px 16px -10px rgba(13, 134, 114, 0.9);
}
.btn-primary:hover:not([disabled]) { background: linear-gradient(180deg, var(--teal-400), var(--teal-500)); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--ink-200);
  color: var(--ink-700);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover:not([disabled]) { border-color: var(--teal-300); color: var(--teal-700); background: var(--teal-50); }

.btn-link {
  background: transparent; border-color: transparent; color: var(--teal-600);
  padding: 6px 8px; font-weight: 600;
}
.btn-link:hover:not([disabled]) { background: var(--teal-50); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff;
  border-radius: 50%; animation: spin 700ms linear infinite;
}
.btn-ghost.is-busy::after, .btn-link.is-busy::after { border-color: rgba(13, 134, 114, 0.3); border-top-color: var(--teal-600); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-600);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.icon-btn:hover { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-300); }
.icon-btn--sm { width: 28px; height: 28px; border-radius: 8px; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 15px; }
.section-head p { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.split-grid--wide-left { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card:nth-child(4n + 1)::before { background: linear-gradient(90deg, var(--teal-400), var(--teal-600)); }
.stat-card:nth-child(4n + 2)::before { background: linear-gradient(90deg, #4f9cc9, #1f6c9c); }
.stat-card:nth-child(4n + 3)::before { background: linear-gradient(90deg, #4bbd8b, var(--ok)); }
.stat-card:nth-child(4n + 4)::before { background: linear-gradient(90deg, #9d8ad6, #6a52b8); }
.stat-card::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline-start: 0;
  width: 100%; height: 3px; background: var(--ink-200);
}
.stat-card--teal::before { background: linear-gradient(90deg, var(--teal-400), var(--teal-600)); }
.stat-card--info::before { background: linear-gradient(90deg, #4f9cc9, #1f6c9c); }
.stat-card--ok::before { background: linear-gradient(90deg, #4bbd8b, var(--ok)); }
.stat-card--violet::before { background: linear-gradient(90deg, #9d8ad6, #6a52b8); }
.stat-label { font-size: 12px; color: var(--ink-500); }
.stat-value { font-size: 27px; font-weight: 700; color: var(--ink-900); line-height: 1.25; margin-top: 2px; }
.stat-hint { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

.chip[dir='ltr'] { unicode-bidi: isolate; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--ink-100);
  color: var(--ink-600);
  border: 1px solid transparent;
}
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.chip--danger { background: var(--danger-bg); color: var(--danger); }
.chip--info { background: var(--info-bg); color: var(--info); }
.chip--teal { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.chip--muted { background: var(--ink-50); color: var(--ink-500); border-color: var(--ink-100); }

.badge-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.link-chip {
  border: 1px dashed var(--teal-200);
  background: var(--teal-50);
  color: var(--teal-700);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-chip:hover { border-style: solid; background: var(--teal-100); }

/* ------------------------------------------------------------ mini lists */

.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-50);
}
.mini-row:last-child { border-bottom: 0; }
.mini-main { min-width: 0; }
.mini-title { font-size: 13px; font-weight: 600; color: var(--ink-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main { flex: 1; min-width: 0; }
.mini-sub { font-size: 12px; color: var(--ink-500); }

.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline-item { display: flex; gap: 10px; padding: 7px 0; }
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex-shrink: 0;
  background: var(--ink-300);
  box-shadow: 0 0 0 3px var(--ink-50);
}
.timeline-dot--project { background: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-50); }
.timeline-dot--task { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.timeline-dot--model { background: #6a52b8; box-shadow: 0 0 0 3px #f0ecfb; }
.timeline-title { font-size: 12.5px; font-weight: 600; }
.timeline-sub { font-size: 11.5px; color: var(--ink-400); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 30px 18px;
  border: 1px dashed var(--ink-200);
  border-radius: var(--radius);
  background: var(--ink-50);
}
.empty-state h3 { font-size: 14px; }
.empty-state p { font-size: 12.5px; color: var(--ink-500); max-width: 48ch; }
.empty-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); color: var(--teal-600); border: 1px solid var(--ink-100);
}
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

.notice {
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 12.5px;
  border: 1px solid var(--ink-200);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 2px;
}
.notice strong { font-size: 13px; }
.notice--warn { background: var(--warn-bg); border-color: #f3ddb4; color: #7a4e07; }
.notice--info { background: var(--info-bg); border-color: #cfe4f4; color: #17527a; }
.notice--inline { margin-bottom: 12px; }
.muted-text { color: var(--ink-500); font-size: 12.5px; }
.mt-4 { margin-top: 14px; }

/* --------------------------------------------------------------- toolbar */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.toolbar-search { display: flex; align-items: center; gap: 8px; color: var(--ink-300); flex: 1; min-width: 220px; }
.toolbar-meta { display: flex; gap: 8px; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--ink-100);
  border-radius: 11px;
}
.segmented-btn {
  border: 0; background: transparent; color: var(--ink-500);
  padding: 6px 14px; border-radius: 9px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.segmented-btn:hover { color: var(--ink-800); }
.segmented-btn.is-active { background: var(--surface); color: var(--teal-700); box-shadow: var(--shadow-sm); }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-800);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.input:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(53, 195, 168, 0.18);
}
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(179, 53, 47, 0.12); }
.input-area { resize: vertical; min-height: 70px; line-height: 1.7; }
.input-compact { width: auto; padding: 4px 8px; font-size: 11.5px; border-radius: 8px; }
.input-search { background: var(--surface); }
.input-title { font-size: 16px; font-weight: 700; }
.input-desc { font-size: 12px; min-height: 46px; }

/* ---------------------------------------------------------------- forms */

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink-600); display: flex; gap: 3px; }
.field-req { color: var(--danger); }
.field-hint { font-size: 11px; color: var(--ink-400); }
.field-error { font-size: 11.5px; color: var(--danger); font-weight: 600; }
.inline-field { display: flex; align-items: center; gap: 6px; }
.inline-label { font-size: 11.5px; color: var(--ink-500); }

.dep-list {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--ink-100); border-radius: 10px; padding: 10px;
  max-height: 190px; overflow-y: auto;
  background: var(--ink-50);
}
.dep-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--ink-100);
}
.dep-row span:nth-of-type(1) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkbox { width: 15px; height: 15px; accent-color: var(--teal-600); }

/* --------------------------------------------------------------- dialogs */

.dialog-host {
  position: fixed; inset: 0; z-index: 120;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(9, 22, 26, 0.46);
  backdrop-filter: blur(3px);
}
.dialog-host.is-open { display: flex; }
.dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--ink-100);
  animation: rise 180ms ease-out;
}
.dialog--wide { width: min(860px, 100%); }
.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--ink-100);
}
.dialog-head h2 { font-size: 16px; }
.dialog-head p { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.dialog-form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dialog-body { padding: 18px 20px; overflow-y: auto; }
.dialog-body p { font-size: 13px; color: var(--ink-600); }
.dialog-error {
  margin: 0 20px 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  border: 1px solid #f5cdca;
  color: var(--danger);
  font-size: 12.5px;
  display: flex; flex-direction: column; gap: 3px;
}
.dialog-error[hidden] { display: none; }
.dialog-actions {
  display: flex; justify-content: flex-start; gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--ink-100);
  background: var(--ink-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ------------------------------------------------------------ process tab */

.process-layout { display: grid; grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.5fr); gap: 18px; align-items: start; }
.process-list-card { padding-bottom: 12px; }
.process-results { display: flex; flex-direction: column; gap: 6px; max-height: 68vh; overflow-y: auto; padding-inline-end: 2px; }
.process-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: start;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.process-item:hover { border-color: var(--teal-200); background: var(--teal-50); }
.process-item.is-active {
  border-color: var(--teal-400);
  background: linear-gradient(180deg, var(--teal-50), #f8fffd);
  box-shadow: 0 0 0 2px rgba(53, 195, 168, 0.16);
}
.process-item-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.process-item-title { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.process-item-sub { font-size: 11.5px; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.process-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.process-item-count { font-size: 10.5px; color: var(--ink-400); }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-title { font-size: 18px; }
.detail-sub { font-size: 12.5px; color: var(--ink-500); margin: 4px 0 8px; overflow-wrap: anywhere; }
.detail-warning {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 9px;
  padding: 8px 11px;
}
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.detail-block { margin-top: 16px; }
.detail-block h3 { font-size: 12.5px; color: var(--ink-600); text-transform: none; margin-bottom: 8px; }
.detail-grid .detail-block { margin-top: 0; }

.step-list { display: flex; flex-direction: column; gap: 6px; }
.step-item { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; }
.step-index {
  display: grid; place-items: center; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--teal-50); color: var(--teal-700); font-size: 11px; font-weight: 700;
  border: 1px solid var(--teal-100);
}
.bullet-list { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.bullet-list li { position: relative; padding-inline-start: 14px; }
.bullet-list li::before {
  content: ''; position: absolute; inset-inline-start: 2px; top: 9px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--teal-400);
}
.bullet-list--warn li::before { background: #d99a2b; }

.evidence-list { display: flex; flex-direction: column; gap: 6px; }
.evidence-item {
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--ink-50);
}
.evidence-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.evidence-path {
  font-size: 11.5px; color: var(--ink-700); background: var(--surface);
  padding: 1px 7px; border-radius: 6px; border: 1px solid var(--ink-100);
  direction: ltr; display: inline-block; max-width: 100%;
  overflow-wrap: anywhere; unicode-bidi: isolate;
}
.evidence-symbol { font-size: 11px; color: var(--teal-700); font-family: var(--mono); direction: ltr; }
.evidence-note { font-size: 11.5px; color: var(--ink-500); margin-top: 3px; }

/* ------------------------------------------------------------- projects */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.project-grid > .empty-state { grid-column: 1 / -1; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project-head-main { min-width: 0; }
.project-title { font-size: 15px; overflow-wrap: anywhere; }
.project-sub { font-size: 12px; color: var(--ink-400); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.project-meta { font-size: 11.5px; color: var(--ink-500); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.dot-sep { color: var(--ink-300); }
.due--warn { color: var(--warn); font-weight: 600; }
.due--danger { color: var(--danger); font-weight: 600; }

.progress-block { display: flex; flex-direction: column; gap: 5px; }
.progress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-500); }
.progress-track { height: 6px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal-400), var(--teal-600)); transition: width 240ms ease; }

.task-list { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--ink-50); padding-top: 8px; }
.task-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 8px 6px;
  border-radius: 9px;
  transition: background 120ms ease;
}
.task-row:hover { background: var(--ink-50); }
.task-row.is-done .task-title { color: var(--ink-400); text-decoration: line-through; }
.task-main { min-width: 0; }
.task-title { font-size: 12.5px; font-weight: 600; color: var(--ink-800); overflow-wrap: anywhere; }
.task-sub { font-size: 11.5px; color: var(--ink-500); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.task-blocked { font-size: 10.5px; color: var(--warn); font-weight: 600; margin-top: 1px; }
.task-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.project-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--ink-50); padding-top: 10px; }
.project-created { font-size: 11px; color: var(--ink-400); margin-inline-start: auto; }

/* --------------------------------------------------------------- modeler */

.modeler-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.model-list {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: calc(var(--topbar-h) + 12px);
  max-height: calc(100vh - var(--topbar-h) - 40px);
}
.model-list-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; border-bottom: 1px solid var(--ink-50); }
.model-list-head h2 { font-size: 13px; }
.model-list-body { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.model-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 9px; border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  text-align: start; cursor: pointer;
  min-width: 0;
}
.model-item:hover { background: var(--ink-50); }
.model-item.is-active { background: var(--teal-50); border-color: var(--teal-200); }
.model-item-main { display: flex; flex-direction: column; min-width: 0; }
.model-item-title { font-size: 12px; font-weight: 600; color: var(--ink-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-item-sub { font-size: 10px; color: var(--ink-400); }

.modeler-main {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.modeler-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modeler-head-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.modeler-title-row { display: flex; align-items: center; gap: 8px; }
.modeler-title-row .input-title { max-width: 420px; }
.modeler-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.dirty-badge {
  font-size: 10.5px; font-weight: 700;
  color: var(--warn); background: var(--warn-bg);
  border-radius: 999px; padding: 2px 9px;
  animation: pulse 1.8s ease-in-out infinite;
}

.modeler-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 9px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
}
.tool-group { display: flex; align-items: center; gap: 4px; }
.tool-group--end { margin-inline-start: auto; }
.toolbar-sep { width: 1px; height: 20px; background: var(--ink-200); }
.hint-inline { font-size: 10.5px; color: var(--ink-400); }

/* The canvas is direction:ltr so diagram coordinates and menus render
   correctly, while Persian labels inside the diagram stay RTL. */
.modeler-canvas {
  position: relative;
  min-height: 480px;
  height: min(62vh, 660px);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(var(--ink-50) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--ink-50) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
  direction: ltr;
  isolation: isolate;
}
.modeler-canvas > .djs-container,
.modeler-canvas > .dmn-js-parent { position: absolute; inset: 0; }
.modeler-canvas .djs-container { direction: ltr; }
.modeler-canvas .djs-palette { direction: ltr; }
/* فقط کادر ویرایش متن راست‌به‌چپ است. روی text نمودار نگذارید: bpmn-js جای خط را از ابتدای آن حساب می‌کند و برچسب از شکل بیرون می‌زند */
.modeler-canvas .djs-direct-editing-content { direction: rtl; unicode-bidi: plaintext; }
.modeler-canvas .dmn-js-parent { height: 100%; }
.modeler-canvas.is-dmn .dmn-decision-table-container,
.modeler-canvas.is-dmn .dmn-literal-expression-container { direction: rtl; }

.canvas-note { font-size: 11px; color: var(--ink-400); }

.dmn-view-tabs { padding: 2px 0; }
.dmn-view-tabs .btn { font-size: 11.5px; padding: 5px 11px; }
.canvas-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink-500); font-size: 12.5px;
  direction: rtl;
}
.canvas-error { padding: 26px; direction: rtl; display: flex; flex-direction: column; gap: 8px; }
.canvas-error h3 { font-size: 14px; }
.canvas-error p { font-size: 12.5px; color: var(--ink-500); }
.canvas-error-detail {
  direction: ltr; text-align: left;
  background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: 8px;
  padding: 8px 10px; font-family: var(--mono); font-size: 11px; color: var(--danger);
  max-height: 120px; overflow: auto; white-space: pre-wrap;
}

.version-panel {
  border-top: 1px solid var(--ink-100);
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.version-head { display: flex; align-items: baseline; gap: 10px; }
.version-head h3 { font-size: 12.5px; }
.version-list { display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; }
.version-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--ink-100);
  border-radius: 9px;
  background: var(--surface);
}
.version-row.is-current { border-color: var(--teal-200); background: var(--teal-50); }
.version-title { font-size: 12px; font-weight: 600; }
.version-sub { font-size: 10.5px; color: var(--ink-400); }
.version-actions { display: flex; align-items: center; gap: 4px; }

.xml-preview {
  direction: ltr; text-align: left;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  background: var(--ink-900); color: #d8f3ec;
  border-radius: 10px; padding: 14px;
  max-height: 58vh; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* --------------------------------------------------------------- history */

.table-wrap { overflow-x: auto; border: 1px solid var(--ink-100); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: start; font-size: 11px; font-weight: 700; color: var(--ink-500);
  background: var(--ink-50);
  padding: 9px 12px;
  border-bottom: 1px solid var(--ink-100);
  white-space: nowrap;
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--ink-50); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--ink-50); }
.cell-muted { color: var(--ink-500); font-size: 12px; white-space: nowrap; }
.cell-detail { max-width: 34ch; white-space: normal; overflow-wrap: anywhere; }
.entity-type {
  display: inline-block; font-size: 10px; font-weight: 700; color: var(--ink-400);
  margin-inline-end: 6px;
}
.entity-name { font-weight: 600; overflow-wrap: anywhere; }

/* --------------------------------------------------------------- feedback */

.toast-host {
  position: fixed; z-index: 140;
  /* Bottom-anchored so transient messages never cover page content. */
  inset-block-end: 18px;
  inset-inline-start: 18px;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: slide-in 180ms ease-out;
  border-inline-start: 3px solid var(--info);
}
.toast--ok { border-inline-start-color: var(--ok); }
.toast--danger { border-inline-start-color: var(--danger); }
.toast--warn { border-inline-start-color: #d99a2b; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 260ms ease, transform 260ms ease; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--info); }
.toast--ok .toast-dot { background: var(--ok); }
.toast--danger .toast-dot { background: var(--danger); }
.toast--warn .toast-dot { background: var(--warn); }
.toast-body { flex: 1; min-width: 0; }
.toast-message { font-size: 12.5px; font-weight: 600; color: var(--ink-800); }
.toast-detail { font-size: 11.5px; color: var(--ink-500); margin-top: 1px; }
.toast-close {
  border: 0; background: transparent; color: var(--ink-400);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.toast-close:hover { color: var(--ink-700); }

.busy-indicator[hidden] { display: none; }

.busy-indicator {
  position: fixed; inset-block-start: 14px; inset-inline-end: 14px; z-index: 150;
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--surface); border-radius: 50%; box-shadow: var(--shadow);
}
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--ink-200); border-top-color: var(--teal-600);
  animation: spin 700ms linear infinite;
}

.noscript {
  padding: 16px; background: var(--danger-bg); color: var(--danger);
  text-align: center; font-weight: 600;
}

.skeleton-wrap { padding: 40px; color: var(--ink-400); text-align: center; }
body.is-busy { cursor: progress; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid, .split-grid--wide-left { grid-template-columns: minmax(0, 1fr); }
  .process-layout { grid-template-columns: minmax(0, 1fr); }
  .process-results { max-height: 300px; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .modeler-shell { grid-template-columns: minmax(0, 1fr); }
  .model-list { position: static; max-height: none; }
  .model-list-body { flex-direction: row; flex-wrap: wrap; }
  .model-item { min-width: 200px; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; flex-direction: column; gap: 14px;
    padding: 16px; border-inline-end: 0;
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; padding: 8px 12px; }
  .sidebar-foot { flex-direction: row; flex-wrap: wrap; }
  .sidebar-note { flex: 1 1 220px; }
  .sidebar-version { display: none; }
  .topbar { position: static; padding: 16px; flex-wrap: wrap; min-height: 0; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .main { padding: 18px 16px 30px; }
  .page-foot { padding: 14px 16px 20px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .modeler-head { flex-direction: column; }
  .modeler-head-main, .modeler-head-actions { width: 100%; min-width: 0; }
  .modeler-head-actions { justify-content: flex-start; }
  .task-row { flex-wrap: wrap; }
  .task-side { flex-wrap: wrap; }
  .model-item { min-width: 0; max-width: 100%; }
  .card, .project-card, .modeler-main { padding: 14px; }
  .modeler-canvas { height: 58vh; min-height: 380px; }
  .detail-head { flex-direction: column; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog { max-height: calc(100vh - 24px); }
  .dialog-host { padding: 12px; }
}
/* ------------------------------------------------------------- live monitor */
.mon-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.mon-card { padding: 0; overflow: hidden; }
.mon-canvas { height: 600px; direction: ltr; background: #fff; }
.mon-side { max-height: 520px; overflow: auto; }
.mon-pick { cursor: pointer; }
.mon-status { margin-top: 10px; }
.mon-badge { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; border: 2px solid #fff; font: 600 12.5px/22px var(--font, inherit); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.18); white-space: nowrap; }
.mon-badge small { font-size: 11px; font-weight: 600; }
.mon-badge--zero { background: var(--ink-100, #e4e7eb); color: var(--ink-500, #5b6675); }
.mon-badge--live { background: var(--info, #17527a); color: #fff; }
.mon-badge--stuck { background: var(--danger, #b42318); color: #fff; }
.mon-badge--err { background: var(--warn, #a4690b); color: #fff; }
.mon-row--stuck td { background: var(--danger-bg, #fdecec); }

/* متن نمودارها با یکان‌بخ (اندازه‌گیری شکستن خط در bpmn-js با textRenderer هم‌خوان شده) */
.djs-container text, .djs-container .djs-label, .dmn-drd-container text, .tjs-container, .dmn-decision-table-container, .dmn-literal-expression-container { font-family: var(--font) !important; }

/* فلوچارت و نمودارهای صفحهٔ فرایند */
.diagram-block { grid-column: 1 / -1; }
.diagram-views { margin-top: 8px; }
.diagram-canvas { height: 460px; margin-top: 10px; border: 1px solid var(--ink-100, #e4e7eb); border-radius: var(--radius, 12px); background: #fff; direction: ltr; overflow: hidden; }
.diagram-canvas .tjs-container, .diagram-canvas .dmn-decision-table-container { height: 100%; overflow: auto; }

/* نقشهٔ فرایندها */
.map-wrap { position: relative; margin-top: 12px; }
.map-lines { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.map-edge { fill: none; stroke: var(--teal-600, #1f8a7a); stroke-opacity: .16; stroke-width: 1.2; transition: stroke-opacity .15s; }
.map-wrap.is-focus .map-edge { stroke-opacity: .04; }
.map-wrap .map-edge.is-on { stroke-opacity: .9; stroke-width: 2; }
.map-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; align-items: start; }
.map-area { border: 1px solid var(--ink-100, #e4e7eb); border-radius: var(--radius, 12px); padding: 12px; background: rgba(255,255,255,.86); display: flex; flex-direction: column; gap: 8px; }
.map-area h3 { margin: 0 0 2px; font-size: 14px; }
.map-node { text-align: right; border: 1px solid var(--ink-100, #e4e7eb); border-radius: 10px; background: #fff; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, opacity .12s; font: inherit; }
.map-node:hover { border-color: var(--teal-600, #1f8a7a); }
.map-node--empty { background: var(--ink-50, #f6f7f9); }
.map-wrap.is-focus .map-node:not(.is-linked) { opacity: .35; }
.map-node.is-linked { border-color: var(--teal-600, #1f8a7a); }
.map-node-title { font-size: 13px; font-weight: 600; }
.map-node-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.map-kind { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--ink-50, #f6f7f9); color: var(--ink-500, #5b6675); }
.map-kind--BPMN { background: var(--info-bg, #e7f1f8); color: var(--info, #1f6c9c); }
.map-kind--DMN { background: var(--ok-bg, #e8f7f0); color: var(--ok, #118a5c); }
.map-kind--CMMN { background: var(--warn-bg, #fdf3e2); color: var(--warn, #a4690b); }
.map-live { font-size: 11px; color: var(--danger, #b3352f); }
.map-live.is-stuck { font-weight: 700; }

/* فهرست‌های بزرگ: انتخاب پایش و جستجوی مدل */
.mon-select { width: 100%; max-width: 560px; margin-top: 10px; }
.mon-top { margin-top: 10px; }
.model-search { margin: 0 0 8px; width: 100%; box-sizing: border-box; }
.model-item[hidden] { display: none; }

/* ---------------------------------------------------------- custom scrollbars */
* { scrollbar-gutter: auto; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--teal-200, #a7dcd2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--teal-400, #35c3a8); }
::-webkit-scrollbar-thumb:active { background-color: var(--teal-600, #0f8f7d); }
::-webkit-scrollbar-corner { background: transparent; }
.sidebar ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.22); }
.sidebar ::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.38); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--teal-200, #a7dcd2) transparent; }
}

/* ------------------------------------------------- process and document lists */
.process-list-card > .toolbar { margin-bottom: 14px; }
.process-list-card > .segmented { margin-bottom: 12px; }
.process-results { padding-inline-end: 6px; }
.doc-group { font-size: 12px; font-weight: 600; color: var(--ink-500); margin: 10px 2px 2px; }
.doc-group:first-child { margin-top: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex-shrink: 0; }

/* ----------------------------------------------------- diagram frame and tools */
/* نوار ابزار سرتیتر قاب است و نمودار زیر آن؛ فقط خود قاب حاشیه دارد */
.diagram-frame {
  display: flex; flex-direction: column;
  margin-top: 10px;
  border: 1px solid var(--ink-100, #e4e7eb);
  border-radius: var(--radius, 12px);
  background: var(--surface, #fff);
  overflow: hidden;
}
.diagram-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  justify-content: flex-start;
  padding: 8px 12px;
  background: var(--ink-50, #f5f8f8);
  border-bottom: 1px solid var(--ink-100, #e4e7eb);
}
.diagram-bar .btn { padding: 5px 12px; font-size: 12px; background: var(--surface, #fff); }
.diagram-fs-icon { display: inline-flex; }
.diagram-frame .diagram-canvas { margin-top: 0; border: 0; border-radius: 0; }
.diagram-frame .modeler-canvas { border: 0; border-radius: 0; margin: 0; }
.diagram-frame .modeler-toolbar { border-width: 0 0 1px; border-radius: 0; margin: 0; }
.mon-card > .diagram-frame { margin-top: 0; border: 0; border-radius: 0; }
.diagram-frame:fullscreen, .diagram-frame.is-window-full { margin: 0; border: 0; border-radius: 0; }
.diagram-frame.is-window-full { position: fixed; inset: 0; z-index: 115; }
.server-outdated { margin-bottom: 14px; }
.diagram-frame:fullscreen > :last-child,
.diagram-frame.is-window-full > :last-child { flex: 1 1 auto; height: auto !important; min-height: 0 !important; max-height: none !important; margin-top: 0; }

/* --------------------------------------------------------- risk register */
.risk-toolbar { margin-bottom: 14px; align-items: flex-start; }
.risk-toolbar .btn { padding: 6px 10px; font-size: 12px; }
.risk-title-cell { min-width: 280px; white-space: normal; }
.risk-table td { vertical-align: middle; }
.risk-table .btn { padding: 4px 10px; font-size: 12px; }
.risk-evidence { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.risk-evidence code { background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: 6px; padding: 1px 6px; font-size: 11.5px; }

/* --------------------------------------------- documents and knowledge base */
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 12px; }
.doc-actions .btn { padding: 6px 10px; font-size: 12px; }
.doc-page { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.85; }
.doc-page > p { margin: 0; }
.doc-section h3 { font-size: 14px; margin: 6px 0 6px; color: var(--ink-800); }
.doc-section ul, .doc-section ol { margin: 0; padding-inline-start: 22px; }
.doc-section ul { list-style: disc; }
.doc-section ol { list-style: persian; }
.doc-section li::marker { color: var(--teal-600); }
.doc-section li { margin-bottom: 3px; }
.doc-section code { direction: ltr; unicode-bidi: embed; font-size: 12px; }
.doc-section .btn-link { padding: 0; text-align: start; white-space: normal; height: auto; min-height: 0; }
.doc-notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 7px 12px; font-size: 12.5px; }
.doc-body-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------ Jalali date picker */
.jdate { display: flex; flex-direction: column; gap: 4px; }
.jdate-row { position: relative; display: flex; }
.jdate-text { width: 100%; text-align: right; padding-left: 38px; font-family: inherit; }
.jdate-btn {
  position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-500); cursor: pointer;
}
.jdate-btn:hover { background: var(--teal-50); color: var(--teal-700); }
.jdate-pop {
  position: fixed; z-index: 130; width: 286px; padding: 12px;
  background: var(--surface, #fff); border: 1px solid var(--ink-100); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(10, 40, 40, 0.24);
  font-family: inherit;
}
.jdate-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.jdate-pick { display: flex; gap: 4px; flex: 1; justify-content: center; }
.jdate-select { border: 1px solid var(--ink-100); border-radius: 8px; background: var(--surface, #fff); padding: 4px 6px; font: inherit; font-size: 12.5px; color: var(--ink-800); }
.jdate-nav { width: 28px; height: 28px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: var(--ink-50); color: var(--ink-700); cursor: pointer; }
.jdate-nav:hover { background: var(--teal-50); color: var(--teal-700); }
.jdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdate-dow { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--ink-400); padding: 2px 0 6px; }
.jdate-day { height: 34px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13px; color: var(--ink-800); cursor: pointer; }
.jdate-day:hover { background: var(--teal-50); }
.jdate-day.is-friday { color: var(--danger); }
.jdate-day.is-today { box-shadow: inset 0 0 0 1.5px var(--teal-400); }
.jdate-day.is-selected { background: var(--teal-600); color: #fff; font-weight: 600; }
.jdate-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ink-100); }
.jdate-link { border: 0; background: transparent; color: var(--teal-700); cursor: pointer; font: inherit; font-size: 12.5px; padding: 2px 6px; border-radius: 6px; }
.jdate-link:hover { background: var(--teal-50); }

/* ------------------------------------------------- technical documentation */
.tech-tabs { flex-wrap: wrap; }
.tech-code { direction: ltr; unicode-bidi: embed; font-family: Consolas, 'Courier New', monospace; font-size: 12px; color: var(--ink-700); overflow-wrap: anywhere; }
.tech-link { border: 0; background: transparent; padding: 0; cursor: pointer; color: var(--teal-700); font: inherit; font-family: Consolas, 'Courier New', monospace; font-size: 12.5px; text-align: left; overflow-wrap: anywhere; }
.tech-link:hover { text-decoration: underline; }
.tech-meta { margin-bottom: 10px; }
.tech-more { display: flex; justify-content: center; margin-top: 12px; }
.tech-process { font-size: 12.5px; color: var(--ink-600); min-width: 150px; }
.tech-row--bad td { background: var(--danger-bg); }
.tech-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-600); white-space: nowrap; }
.tech-details { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.tech-detail { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: start; }
.tech-detail dt { font-size: 12.5px; font-weight: 600; color: var(--ink-500); }
.tech-detail dd { margin: 0; font-size: 13px; min-width: 0; }
.tech-places { display: flex; flex-direction: column; gap: 2px; }
.tech-checks { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.tech-check-item { border: 1px solid var(--ink-100); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.tech-check-item--fail { border-color: var(--danger); }
.tech-check-item summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; list-style-position: inside; }
.tech-check-item > p { margin: 8px 0 0; font-size: 13px; color: var(--ink-600); }
.tech-check-list { margin: 8px 0 0; padding: 0; list-style: none; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.tech-check-list li { direction: ltr; text-align: left; }
.doc-section .data-table td .chip { margin-inline-start: 6px; }
@media (max-width: 760px) { .tech-detail { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.process-detail-card { min-width: 0; }
.tech-columns .tech-col-name { white-space: nowrap; }
.tech-columns .tech-col-name .chip { margin-inline-start: 6px; }
.tech-columns .tech-col-type { max-width: 26ch; white-space: normal; overflow-wrap: anywhere; font-family: Consolas, 'Courier New', monospace; font-size: 12px; }
.notice--danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* ------------------------------------------------------- risk to project */
.risk-task-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--ink-100); border-radius: 10px; background: var(--ink-50); font-size: 13px; }
.field[hidden] { display: none; }

/* --------------------------------------------------------- login and users */
.auth-screen { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--ink-50, #f5f8f8); }
.auth-card { width: min(400px, 100%); padding: 28px; background: var(--surface, #fff); border: 1px solid var(--ink-100); border-radius: 16px; box-shadow: 0 18px 44px rgba(10, 40, 40, 0.12); }
.auth-card h1 { font-size: 19px; margin: 0 0 18px; }
.auth-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }
.auth-note { font-size: 13px; color: var(--ink-600); margin: 0; }
.auth-temp { display: block; padding: 12px; border: 1px dashed var(--ink-200); border-radius: 10px; background: var(--ink-50); font-size: 15px; text-align: center; overflow-wrap: anywhere; user-select: all; }
.user-box { display: flex; align-items: center; gap: 8px; padding-inline-end: 8px; border-inline-end: 1px solid var(--ink-100); }
.user-name { font-size: 13px; font-weight: 600; color: var(--ink-800); white-space: nowrap; }
.user-box .btn-link { padding: 4px 6px; font-size: 12px; }
.users-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.users-actions .btn { padding: 4px 10px; font-size: 12px; }
.nav-item[hidden], #export-backup-btn[hidden] { display: none; }
/* مشاهده‌گر چیزی را تغییر نمی‌دهد؛ سرور هم اجازه نمی‌دهد، این فقط دکمهٔ بی‌فایده را برمی‌دارد */
body.role-viewer .view .btn-primary,
body.role-viewer [data-testid="add-task"],
body.role-viewer [data-testid="task-status"],
body.role-viewer [data-testid="new-article"],
body.role-viewer [data-testid="doc-new-article"],
body.role-viewer [data-testid="process-diagram-edit"],
body.role-viewer [data-testid="create-model-from-process"] { display: none; }
