/* ==========================================================================
   همراه ترخیص — سیستم طراحی
   رنگ اصلی: لاجوردی (آبی کاشی ایرانی). سبز/زرد/قرمز فقط برای سطح تریاژ.
   قلم متن: وزیرمتن با ارقام فارسی. قلم تیتر: مرکزی (نسخ) با احساس «سند رسمی».
   عنصر امضا: «دستبند» — نسخه دیجیتال دستبند شناسایی بیمار.
   ========================================================================== */

@font-face { font-family: "Vazirmatn FD"; font-weight: 400; font-display: swap; src: url("../vendor/vazirmatn/Vazirmatn-FD-Regular.e0e713cd90d9.woff2") format("woff2"); }
@font-face { font-family: "Vazirmatn FD"; font-weight: 500; font-display: swap; src: url("../vendor/vazirmatn/Vazirmatn-FD-Medium.746006b64c8e.woff2") format("woff2"); }
@font-face { font-family: "Vazirmatn FD"; font-weight: 600; font-display: swap; src: url("../vendor/vazirmatn/Vazirmatn-FD-SemiBold.3c59bb69635a.woff2") format("woff2"); }
@font-face { font-family: "Vazirmatn FD"; font-weight: 700; font-display: swap; src: url("../vendor/vazirmatn/Vazirmatn-FD-Bold.49790e8b277d.woff2") format("woff2"); }
@font-face { font-family: "Vazirmatn FD"; font-weight: 800; font-display: swap; src: url("../vendor/vazirmatn/Vazirmatn-FD-ExtraBold.46cceb844b23.woff2") format("woff2"); }
@font-face { font-family: "Markazi"; font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; src: url("../vendor/markazi/markazi-text-arabic-600-normal.63caf4c1f1e4.woff2") format("woff2"); }
@font-face { font-family: "Markazi"; font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; src: url("../vendor/markazi/markazi-text-arabic-700-normal.0109a93a5bbd.woff2") format("woff2"); }
@font-face { font-family: "Markazi"; font-weight: 600; font-display: swap; unicode-range: U+0000-00FF; src: url("../vendor/markazi/markazi-text-latin-600-normal.25b171f7daa5.woff2") format("woff2"); }
@font-face { font-family: "Markazi"; font-weight: 700; font-display: swap; unicode-range: U+0000-00FF; src: url("../vendor/markazi/markazi-text-latin-700-normal.7a98599d1fd9.woff2") format("woff2"); }

:root {
  --lj-950: #111A47;
  --lj-900: #17245E;
  --lj-800: #1E2F7A;
  --lj-700: #26409B;
  --lj-600: #3453B8;
  --lj-300: #9DAEE6;
  --lj-100: #E4E9FA;
  --lj-50: #F1F4FD;

  --paper: #F4F5F9;
  --surface: #FFFFFF;
  --ink: #161A2B;
  --ink-2: #3D4459;
  --muted: #687089;
  --line: #E2E5EE;
  --line-strong: #C9CEDD;

  --green-700: #146C45;
  --green-500: #1F9D63;
  --green-100: #DBF2E5;
  --amber-700: #7D5200;
  --amber-500: #E5A00F;
  --amber-100: #FFEFC7;
  --red-700: #A11F1B;
  --red-500: #D8382F;
  --red-100: #FCE1DE;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(22, 26, 43, .06), 0 1px 1px rgba(22, 26, 43, .03);
  --shadow-2: 0 10px 30px -12px rgba(23, 36, 94, .25);
  --font-body: "Vazirmatn FD", Tahoma, sans-serif;
  --font-display: "Markazi", "Vazirmatn FD", serif;
  --font-code: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bs-body-font-family: var(--font-body);
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-primary: #26409B;
  --bs-primary-rgb: 38, 64, 155;
  --bs-success: #1F9D63;
  --bs-success-rgb: 31, 157, 99;
  --bs-warning: #E5A00F;
  --bs-warning-rgb: 229, 160, 15;
  --bs-danger: #D8382F;
  --bs-danger-rgb: 216, 56, 47;
  --bs-link-color: #26409B;
  --bs-link-color-rgb: 38, 64, 155;
  --bs-link-hover-color: #17245E;
  --bs-link-hover-color-rgb: 23, 36, 94;
  --bs-focus-ring-color: rgba(38, 64, 155, .25);
}

html { -webkit-text-size-adjust: 100%; }
body { font-size: 15px; line-height: 1.75; font-feature-settings: "ss01"; }
body.portal { font-size: 17px; }
body.portal.big { font-size: 20px; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--ink); line-height: 1.4; }
.display, .page-title { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }
.page-title { font-size: 1.9rem; margin: 0; line-height: 1.25; }
.eyebrow { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.text-muted, .muted { color: var(--muted) !important; }
.code, code.code { font-family: var(--font-code); direction: ltr; unicode-bidi: isolate; letter-spacing: .04em; color: var(--ink-2); font-size: .92em; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.tabular { font-variant-numeric: tabular-nums; }
a { text-underline-offset: 3px; }
::selection { background: var(--lj-100); }

:focus-visible { outline: 3px solid var(--lj-300); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--lj-600); box-shadow: 0 0 0 .22rem rgba(38, 64, 155, .18); outline: none;
}
.form-check-input:checked { background-color: var(--lj-700); border-color: var(--lj-700); }
.form-control, .form-select { border-color: var(--line-strong); border-radius: var(--radius-sm); }
.form-label { font-weight: 600; color: var(--ink-2); font-size: .92rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); }

/* ---------- دکمه‌ها ---------- */
.btn { font-weight: 600; border-radius: 11px; padding: .5rem 1rem; }
.btn-primary {
  --bs-btn-bg: var(--lj-700); --bs-btn-border-color: var(--lj-700);
  --bs-btn-hover-bg: var(--lj-800); --bs-btn-hover-border-color: var(--lj-800);
  --bs-btn-active-bg: var(--lj-900); --bs-btn-active-border-color: var(--lj-900);
  --bs-btn-disabled-bg: #8C99C9; --bs-btn-disabled-border-color: #8C99C9;
}
.btn-outline-primary {
  --bs-btn-color: var(--lj-700); --bs-btn-border-color: var(--lj-300);
  --bs-btn-hover-bg: var(--lj-50); --bs-btn-hover-color: var(--lj-800); --bs-btn-hover-border-color: var(--lj-600);
  --bs-btn-active-bg: var(--lj-100); --bs-btn-active-color: var(--lj-900); --bs-btn-active-border-color: var(--lj-600);
}
.btn-soft { background: var(--lj-50); color: var(--lj-800); border: 1px solid var(--lj-100); }
.btn-soft:hover { background: var(--lj-100); color: var(--lj-900); }
.btn-ghost { background: transparent; border: 0; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(22, 26, 43, .05); }
.btn-danger { --bs-btn-bg: var(--red-500); --bs-btn-border-color: var(--red-500); --bs-btn-hover-bg: var(--red-700); --bs-btn-hover-border-color: var(--red-700); }
.btn-success { --bs-btn-bg: var(--green-500); --bs-btn-border-color: var(--green-500); --bs-btn-hover-bg: var(--green-700); --bs-btn-hover-border-color: var(--green-700); }
.btn-xl { padding: .85rem 1.2rem; font-size: 1.05em; border-radius: 14px; min-height: 52px; }
.btn-block { width: 100%; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }

/* ---------- کارت‌ها ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; padding: .85rem 1.1rem; }
.card-body { padding: 1.1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 .7rem; }
.section-head h2, .section-head h3 { font-size: 1.05rem; margin: 0; }
.section-head .aside { color: var(--muted); font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.empty .bi { font-size: 1.8rem; display: block; margin-bottom: .4rem; color: var(--line-strong); }

/* ---------- سطح تریاژ ---------- */
.lv-green { --lv: var(--green-500); --lv-ink: var(--green-700); --lv-bg: var(--green-100); }
.lv-yellow { --lv: var(--amber-500); --lv-ink: var(--amber-700); --lv-bg: var(--amber-100); }
.lv-red { --lv: var(--red-500); --lv-ink: var(--red-700); --lv-bg: var(--red-100); }
.lv-none { --lv: var(--line-strong); --lv-ink: var(--muted); --lv-bg: #EEF0F5; }
.lv-badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .55rem .08rem .6rem;
  border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--lv-ink); background: var(--lv-bg); white-space: nowrap;
}
.lv-badge .bi { font-size: .85em; }
.lv-dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--lv); display: inline-block; flex: none; }
.lv-strip { border-inline-start: 5px solid var(--lv) !important; }
.lv-text { color: var(--lv-ink); }
.lv-panel { background: var(--lv-bg); color: var(--lv-ink); border-radius: var(--radius); padding: 1rem 1.1rem; }
.lv-panel h3, .lv-panel h4 { color: inherit; }

/* نتیجه تریاژ بعد از ثبت */
.triage-result { border-radius: var(--radius-lg); padding: 1.3rem 1.2rem; background: var(--lv-bg); color: var(--lv-ink); border: 1px solid color-mix(in srgb, var(--lv) 35%, transparent); }
.triage-result .tr-icon { font-size: 2.3rem; line-height: 1; }
.triage-result h2 { color: inherit; font-size: 1.35rem; margin: .4rem 0 .3rem; }
.triage-result ul { margin: .5rem 0 0; padding-inline-start: 1.1rem; }

/* ---------- دستبند (عنصر امضا) ---------- */
.wristband {
  --wb-bg: var(--lj-800);
  position: relative; display: flex; align-items: center; gap: .9rem;
  background: var(--wb-bg); color: #fff; border-radius: 999px; padding: .55rem 1.1rem .55rem .7rem;
  box-shadow: var(--shadow-2); isolation: isolate; overflow: hidden;
}
.wristband::before { /* لبه دوخت‌خورده دستبند */
  content: ""; position: absolute; inset: 4px; border-radius: inherit; border: 1px dashed rgba(255, 255, 255, .22); pointer-events: none;
}
.wristband::after { /* بافت ریز پلاستیک */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .07;
  background: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 7px);
}
.wb-clasp { width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--lj-950); box-shadow: inset 0 0 0 5px var(--lj-600), 0 0 0 2px rgba(255, 255, 255, .15); }
.wb-main { min-width: 0; flex: 1; }
.wb-name { font-weight: 700; font-size: 1.02rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-meta { font-size: .76rem; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-code { font-family: var(--font-code); direction: ltr; font-size: .74rem; letter-spacing: .08em; background: rgba(255, 255, 255, .1); padding: .2rem .5rem; border-radius: 6px; flex: none; }
.wb-day { text-align: center; line-height: 1.1; flex: none; padding-inline-start: .6rem; border-inline-start: 1px solid rgba(255, 255, 255, .18); }
.wb-day strong { display: block; font-size: 1.25rem; font-weight: 800; }
.wb-day small { font-size: .66rem; color: rgba(255, 255, 255, .7); }
.wristband.wb-red { --wb-bg: #7E1B17; }
.wristband.wb-yellow { --wb-bg: #6B4A06; }
@media (max-width: 420px) { .wb-code { display: none; } }

/* ---------- پرتال بیمار (موبایل) ---------- */
.portal-top { position: sticky; top: 0; z-index: 20; background: rgba(244, 245, 249, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.portal-top .inner { max-width: 640px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .6rem; }
.org-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--lj-700); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; flex: none; }
.org-name { font-weight: 700; font-size: .92rem; line-height: 1.2; }
.org-sub { font-size: .72rem; color: var(--muted); }
.sos { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .35rem; color: var(--red-700); background: var(--red-100); border-radius: 999px; padding: .3rem .8rem; font-weight: 800; text-decoration: none; font-size: .9rem; }
.sos:hover { background: #F9CFCB; color: var(--red-700); }
.portal-main { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 7rem; }
.p-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.p-nav ul { max-width: 640px; margin: 0 auto; padding: 0 .4rem; list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); }
.p-nav a { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .45rem; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.p-nav a .bi { font-size: 1.35rem; }
.p-nav a.active { color: var(--lj-700); }
.p-nav .p-nav-add a { margin-top: -1.3rem; }
.p-nav .p-nav-add .bi { width: 56px; height: 56px; border-radius: 18px; background: var(--lj-700); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-2); font-size: 1.6rem; }

/* «اکنون»: کار بعدی بزرگ */
.now-card { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); padding: 1.1rem; }
.now-card .now-time { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--lj-800); }
.now-card .now-title { font-weight: 700; font-size: 1.1rem; }

/* خط زمانی امروز به سبک کاردکس */
.kardex { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kardex li { display: grid; grid-template-columns: 4.2rem 1fr auto; align-items: center; gap: .75rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.kardex li:last-child { border-bottom: 0; }
.kardex .k-time { font-weight: 800; color: var(--ink-2); font-size: 1.02rem; border-inline-end: 2px solid var(--line); padding-inline-end: .5rem; }
.kardex .k-title { font-weight: 600; line-height: 1.4; }
.kardex .k-detail { font-size: .82rem; color: var(--muted); }
.kardex li.is-done .k-title { color: var(--muted); }
.kardex li.is-done .k-time { color: var(--green-500); border-color: var(--green-100); }
.kardex li.is-due { background: var(--lj-50); }
.kardex li.is-missed .k-time { color: var(--red-500); border-color: var(--red-100); }
.tick { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; }
.tick-done { background: var(--green-100); color: var(--green-700); }
.tick-missed { background: var(--red-100); color: var(--red-700); }
.tick-skip { background: #EEF0F5; color: var(--muted); }
.k-act { display: flex; gap: .35rem; }
.tick-btn, .tick-more { border: 0; cursor: pointer; transition: background .15s, transform .1s; }
.tick-btn { width: 44px; height: 44px; background: var(--surface); color: var(--green-700); box-shadow: inset 0 0 0 2px var(--green-500); font-size: 1.3rem; }
.tick-btn:hover { background: var(--green-100); }
.tick-btn:active, .tick-more:active { transform: scale(.94); }
.tick-more { width: 44px; height: 44px; background: transparent; color: var(--muted); }
.tick-more:hover { background: #EEF0F5; }
.tick-wait { color: var(--line-strong); }
.kardex li.k-form { grid-template-columns: 4.2rem 1fr; }
.kardex li.k-form > span:last-child { display: none; }
.day-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; margin: 1.4rem 0 .6rem; line-height: 1.4; }
.now-card.is-now { border-color: var(--lj-300); background: var(--lj-50); }
.sound-prompt { display: flex; align-items: center; gap: .8rem; background: var(--lj-800); color: #fff; border-radius: var(--radius); padding: .75rem .9rem; }
.sound-prompt[hidden] { display: none; }
.sound-prompt > .bi { font-size: 1.5rem; }
.sound-prompt .btn { white-space: nowrap; flex: none; }
.sound-prompt .btn-primary { --bs-btn-bg: #fff; --bs-btn-color: var(--lj-800); --bs-btn-border-color: #fff; --bs-btn-hover-bg: var(--lj-100); --bs-btn-hover-color: var(--lj-900); }
.reason-list { display: grid; gap: .4rem; }
.reason { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line-strong); border-radius: 12px; padding: .55rem .8rem; cursor: pointer; font-weight: 600; background: var(--surface); }
.reason:has(input:checked) { border-color: var(--lj-600); background: var(--lj-50); box-shadow: inset 0 0 0 1px var(--lj-600); }
.reason input { accent-color: var(--lj-700); width: 1.1rem; height: 1.1rem; }

/* کارت ماژول‌ها در داشبورد */
.mod-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.mod-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem .9rem .75rem; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); transition: border-color .15s, transform .15s; }
.mod-card:hover { border-color: var(--lj-300); color: inherit; }
.mod-card .mod-name { font-size: .82rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.mod-card .mod-value { font-size: 1.35rem; font-weight: 800; line-height: 1.3; margin-top: .15rem; }
.mod-card .mod-value small { font-size: .7rem; font-weight: 600; color: var(--muted); }
.mod-card .mod-foot { font-size: .74rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-top: .2rem; }
.mod-card svg.spark { width: 100%; height: 34px; display: block; margin-top: .25rem; }

/* ---------- پنل کادر درمان (دسکتاپ) ---------- */
.staff-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.s-side { background: var(--lj-900); color: #fff; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.s-brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem 1.2rem; }
.s-brand .org-mark { background: #fff; color: var(--lj-900); }
.s-brand .b-name { font-family: var(--font-display); font-size: 1.35rem; line-height: 1; }
.s-brand .b-org { font-size: .72rem; color: rgba(255, 255, 255, .6); }
.s-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.s-nav .s-label { font-size: .7rem; color: rgba(255, 255, 255, .45); padding: .9rem .75rem .3rem; font-weight: 600; }
.s-nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: 10px; color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 500; font-size: .93rem; }
.s-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.s-nav a.active { background: #fff; color: var(--lj-900); font-weight: 700; }
.s-nav a .bi { font-size: 1.1rem; }
.s-nav .count { margin-inline-start: auto; background: var(--red-500); color: #fff; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.s-nav .count.cy { background: var(--amber-500); color: var(--ink); }
.s-user { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .8rem .5rem 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--lj-100); color: var(--lj-800); flex: none; }
.s-user .u-name { font-size: .88rem; font-weight: 700; line-height: 1.3; }
.s-user .u-role { font-size: .72rem; color: rgba(255, 255, 255, .6); }
.s-main { min-width: 0; }
.s-top { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 2rem .4rem; }
.s-content { padding: .6rem 2rem 4rem; }
.s-toggle { display: none; }
@media (max-width: 991px) {
  .staff-shell { grid-template-columns: 1fr; }
  .s-side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 50; transform: translateX(100%); transition: transform .2s; }
  .s-side.open { transform: none; }
  .s-toggle { display: inline-flex; }
  .s-top, .s-content { padding-inline: 1rem; }
}

/* کارتابل ریسک‌محور */
.risk-filter { display: flex; flex-wrap: wrap; gap: .5rem; }
.risk-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; color: var(--ink-2); text-decoration: none; font-size: .88rem; }
.risk-chip .n { font-size: 1.05rem; }
.risk-chip.active { border-color: var(--lj-700); box-shadow: inset 0 0 0 1px var(--lj-700); color: var(--lj-800); }
.wl { display: flex; flex-direction: column; gap: .6rem; }
.wl-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) minmax(0, 1.2fr) auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow-1); color: inherit; text-decoration: none; }
.wl-row:hover { border-color: var(--lj-300); color: inherit; }
.wl-name { font-weight: 700; font-size: 1rem; }
.wl-sub { font-size: .8rem; color: var(--muted); }
.wl-flags { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; background: #EEF0F5; color: var(--ink-2); padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; }
.chip.lv-green, .chip.lv-yellow, .chip.lv-red { background: var(--lv-bg); color: var(--lv-ink); }
@media (max-width: 767px) { .wl-row { grid-template-columns: 1fr; gap: .4rem; } }

/* ---------- جدول ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; border-color: var(--line); }
.table thead th { font-size: .78rem; color: var(--muted); font-weight: 700; background: #F8F9FC; }
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* ---------- تب‌های SMART ---------- */
.smart-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-bottom: 1rem; }
.smart-tabs a { display: flex; flex-direction: column; align-items: center; gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .2rem; text-decoration: none; color: var(--ink-2); font-size: .74rem; font-weight: 600; text-align: center; }
.smart-tabs a .ltr-letter { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; color: var(--lj-700); }
.smart-tabs a.active { background: var(--lj-800); border-color: var(--lj-800); color: #fff; }
.smart-tabs a.active .ltr-letter { color: #fff; }

/* ---------- داروها: کارت مدت درمان ---------- */
.med-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1rem; box-shadow: var(--shadow-1); }
.med-card + .med-card { margin-top: .7rem; }
.med-name { font-weight: 800; font-size: 1.05rem; }
.med-dose { color: var(--ink-2); font-size: .9rem; }
.pill-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--lj-50); color: var(--lj-700); font-size: 1.3rem; flex: none; }
.course { margin-top: .7rem; }
.course-bar { height: 10px; border-radius: 999px; background: #EDEFF5; overflow: hidden; }
.course-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--lj-600); }
.course.short > .course-bar > span { background: var(--amber-500); }
.course.done > .course-bar > span { background: var(--green-500); }
.course-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.dose-times { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.dose-times .t { font-size: .8rem; font-weight: 700; background: var(--lj-50); color: var(--lj-800); border-radius: 8px; padding: .1rem .5rem; }

/* جدول پایبندی ۷ روزه */
.adh-grid { display: grid; gap: 4px; }
.adh-cell { width: 100%; aspect-ratio: 1; border-radius: 6px; background: #EEF0F5; display: grid; place-items: center; font-size: .7rem; }
.adh-cell.done { background: var(--green-500); color: #fff; }
.adh-cell.missed { background: var(--red-500); color: #fff; }
.adh-cell.skipped { background: var(--amber-500); color: #fff; }
.adh-cell.future { background: #F4F5F9; border: 1px dashed var(--line-strong); }
.adh-cell.open { background: var(--lj-100); color: var(--lj-800); }
.adh-cell.none { background: transparent; border: 1px solid var(--line); }
.adh-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; }
.adh-day { text-align: center; }
.adh-day .adh-cell { font-size: .78rem; font-weight: 700; border-radius: 10px; }
.adh-day small { display: block; font-size: .7rem; color: var(--muted); margin-top: .2rem; }
.adh-day.today small { color: var(--lj-700); font-weight: 800; }
.dose-times .t-done { background: var(--green-100); color: var(--green-700); }
.dose-times .t-missed { background: var(--red-100); color: var(--red-700); }
.dose-times .t-skip { background: #EEF0F5; color: var(--muted); text-decoration: line-through; }
.pill-ico.critical { background: var(--red-100); color: var(--red-700); }
.med-more summary { font-size: .85rem; font-weight: 700; color: var(--lj-700); cursor: pointer; }
.effects { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .85rem; }
.effects li { display: flex; gap: .5rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.effects li:last-child { border-bottom: 0; }
.appt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; box-shadow: var(--shadow-1); }
.appt-card.next { border-color: var(--lj-300); box-shadow: inset 4px 0 0 var(--lj-600), var(--shadow-1); }
.appt-card .date-chip span { display: block; }

/* ---------- نمودار ---------- */
.chart { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem .9rem .5rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.chart-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-inline-end: .25rem; }

/* ---------- آلارم ---------- */
.alarm-overlay { position: fixed; inset: 0; z-index: 1080; background: rgba(17, 26, 71, .72); display: grid; place-items: center; padding: 1rem; }
.alarm-box { width: min(440px, 100%); background: var(--surface); border-radius: 24px; padding: 1.5rem 1.3rem 1.2rem; text-align: center; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.alarm-bell { width: 74px; height: 74px; margin: -3.2rem auto .6rem; border-radius: 50%; background: var(--lj-700); color: #fff; display: grid; place-items: center; font-size: 2rem; box-shadow: 0 0 0 8px var(--surface); }
.alarm-bell .bi { display: inline-block; animation: ring 1.2s ease-in-out infinite; transform-origin: 50% 10%; }
.alarm-time { font-size: 2.4rem; font-weight: 800; color: var(--lj-800); line-height: 1.1; }
.alarm-title { font-size: 1.25rem; font-weight: 800; margin: .3rem 0; }
.alarm-bell.critical { background: var(--red-500); }
.alarm-box .btn-xl { font-size: 1.15em; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } 50% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .alarm-bell .bi { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- نوار ابزار دمو ---------- */
.demo-bar { position: fixed; bottom: 5.2rem; inset-inline-end: 1rem; z-index: 1070; display: flex; align-items: center; gap: .25rem; background: #1b1d29; color: #fff; border-radius: 999px; padding: .3rem .35rem .3rem .8rem; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .45); font-size: .8rem; }
body:not(.portal) .demo-bar { bottom: 1rem; }
.demo-bar .clock { font-weight: 700; padding-inline: .4rem; white-space: nowrap; }
.demo-bar .clock .shift { color: #FFC857; }
.demo-bar button, .demo-bar a { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 999px; padding: .22rem .6rem; font-size: .76rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.demo-bar button:hover, .demo-bar a:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.demo-bar .tag { background: #FFC857; color: #1b1d29; border-radius: 999px; padding: 0 .5rem; font-weight: 800; font-size: .7rem; }
@media (max-width: 560px) { .demo-bar .hide-sm { display: none; } }

/* ---------- عمومی ---------- */
.stack > * + * { margin-top: .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.toast-slot { position: fixed; top: 1rem; inset-inline-start: 50%; transform: translateX(50%); z-index: 1090; display: flex; flex-direction: column; gap: .5rem; }
.flash { background: var(--ink); color: #fff; border-radius: 12px; padding: .6rem 1rem; box-shadow: var(--shadow-2); font-weight: 600; font-size: .9rem; }
.flash.success { background: var(--green-700); }
.flash.error { background: var(--red-700); }
.flash.warning { background: var(--amber-700); }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.skeleton { background: linear-gradient(90deg, #eceef4 25%, #f6f7fa 50%, #eceef4 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

@media print {
  .no-print, .p-nav, .portal-top, .demo-bar, .s-side, .s-top { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .staff-shell { display: block; }
  .portal-main, .s-content { padding: 0; max-width: none; }
  .card, .med-card { box-shadow: none; }
}

/* ---------- ویزارد ترخیص ---------- */
.stepper { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: thin; }
.stepper .st { display: flex; align-items: center; gap: .45rem; padding: .4rem .75rem .4rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); text-decoration: none; white-space: nowrap; font-size: .84rem; font-weight: 600; }
.stepper .st-n { min-width: 1.6rem; height: 1.6rem; border-radius: 999px; display: grid; place-items: center; background: #EEF0F5; color: var(--ink-2); font-size: .78rem; font-weight: 800; padding: 0 .35rem; font-family: var(--font-display); }
.stepper .st.done { color: var(--ink-2); }
.stepper .st.done .st-n { background: var(--green-100); color: var(--green-700); }
.stepper .st.current { background: var(--lj-800); border-color: var(--lj-800); color: #fff; }
.stepper .st.current .st-n { background: #fff; color: var(--lj-800); }
.smart-letter { font-family: var(--font-display); font-size: 1.35em; color: var(--lj-700); margin-inline-end: .2rem; line-height: 1; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.opt-card { display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: .9rem; cursor: pointer; position: relative; }
.opt-card input { position: absolute; opacity: 0; pointer-events: none; }
.opt-card:has(input:checked) { border-color: var(--lj-700); box-shadow: 0 0 0 3px var(--lj-100); }
.opt-card:has(input:focus-visible) { outline: 3px solid var(--lj-300); }
.opt-card.suggested { background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box, linear-gradient(90deg, var(--green-100), var(--lj-100)) border-box; }
.opt-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--lj-50); color: var(--lj-700); font-size: 1.3rem; flex: none; }
.opt-title { font-weight: 800; display: block; }
.opt-desc { font-size: .82rem; color: var(--muted); display: block; }
.sign-row { display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.sign-add { display: flex; align-items: center; gap: .6rem; width: 100%; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 12px; padding: .55rem .8rem; font-size: .9rem; color: var(--ink-2); }
.sign-add:hover { border-color: var(--lj-600); background: var(--lj-50); }
.drug-results { display: flex; flex-direction: column; gap: .25rem; margin-top: .35rem; max-height: 260px; overflow-y: auto; }
.drug-results:empty { display: none; }
.drug-hit { text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; }
.drug-hit:hover { border-color: var(--lj-600); background: var(--lj-50); }
.picked { margin-top: .5rem; background: var(--green-100); color: var(--green-700); border-radius: 10px; padding: .45rem .7rem; }
.drug-info-box { background: #F8F9FC; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; }
.drug-info-box .lv-dot.lv-red { background: var(--red-500); } .drug-info-box .lv-dot.lv-yellow { background: var(--amber-500); }
.item-row { display: flex; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; }
.date-chip { min-width: 4.6rem; text-align: center; background: var(--lj-50); border-radius: 10px; padding: .3rem .4rem; line-height: 1.3; flex: none; }
.date-chip strong { display: block; color: var(--lj-800); font-size: .88rem; }
.date-chip span { font-size: .72rem; color: var(--muted); }
.mod-toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: .8rem; align-items: start; }
.mod-toggle { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.mod-toggle.on { border-color: var(--lj-300); box-shadow: inset 0 3px 0 var(--lj-600); }
.mod-settings { margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.min-w-0 { min-width: 0; }
.switch { width: 46px; height: 26px; border-radius: 999px; border: 0; background: #D5D9E4; position: relative; flex: none; padding: 0; transition: background .15s; }
.switch span { position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-end .15s; }
.switch.on { background: var(--green-500); }
.switch.on span { inset-inline-end: 23px; }
.pill-radio { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; cursor: pointer; background: var(--surface); }
.pill-radio input { accent-color: var(--lj-700); }
.pill-radio:has(input:checked) { border-color: var(--lj-700); background: var(--lj-50); color: var(--lj-900); font-weight: 700; }
.sched .grp { display: none; }
.sched:has(input[value="daily"]:checked) .grp-daily,
.sched:has(input[value="interval_hours"]:checked) .grp-interval_hours,
.sched:has(input[value="interval_days"]:checked) .grp-interval_days,
.sched:has(input[value="interval_days"]:checked) .grp-time,
.sched:has(input[value="weekly"]:checked) .grp-weekly,
.sched:has(input[value="weekly"]:checked) .grp-time { display: block; }
.sched:has(input[value="interval_hours"]:checked) .grp-interval_hours { display: flex; }
.band-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.band-head, .band-row { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: .4rem; align-items: center; padding: .4rem .6rem; }
.band-head { background: #F8F9FC; font-size: .72rem; font-weight: 700; }
.band-row + .band-row { border-top: 1px solid var(--line); }
.band-row input { padding: .25rem .4rem; font-size: .88rem; }
.content-pick { display: flex; gap: .6rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; cursor: pointer; }
.content-pick:has(input:checked) { border-color: var(--lj-600); background: var(--lj-50); }
.done-wrap { max-width: 900px; margin: 1rem auto; }
.done-ico { width: 84px; height: 84px; border-radius: 50%; background: var(--green-500); color: #fff; display: grid; place-items: center; margin: 0 auto; font-size: 2.6rem; box-shadow: 0 0 0 10px var(--green-100); }
.tracking { display: inline-block; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 14px; padding: .5rem 1.4rem; }
.bubble-preview { background: #EEF0F6; border-radius: 16px 16px 16px 4px; padding: .7rem .9rem; white-space: pre-line; word-break: break-all; max-width: 26rem; }
.pre-line { white-space: pre-line; }
.prose { line-height: 2; }
.prose h3 { font-size: 1.05rem; margin-top: 1.2rem; }
.prose ul, .prose ol { padding-inline-start: 1.2rem; }

/* ---------- فرم‌های ثبت بیمار (M4) ---------- */
.page-title.h-sm { font-size: 1.45rem; }
.fld .form-label { font-size: .98rem; }
.choice-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: .5rem; }
.choice-grid.cols-1 { --cols: 1; } .choice-grid.cols-3 { --cols: 3; } .choice-grid.cols-4 { --cols: 4; } .choice-grid.cols-5 { --cols: 5; }
@media (max-width: 420px) { .choice-grid.cols-4, .choice-grid.cols-5 { --cols: 2; } }
.choice-list { display: grid; gap: .5rem; }
.choice { display: flex; align-items: center; gap: .55rem; min-height: 52px; padding: .6rem .8rem; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 14px; cursor: pointer; font-weight: 600; line-height: 1.45; position: relative; }
.choice input { width: 1.2rem; height: 1.2rem; accent-color: var(--lj-700); flex: none; margin: 0; }
.choice-grid .choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid .choice { justify-content: center; text-align: center; }
.choice:has(input:checked) { border-color: var(--lj-700); background: var(--lj-50); box-shadow: inset 0 0 0 1px var(--lj-700); }
.choice:has(input:focus-visible) { outline: 3px solid var(--lj-300); outline-offset: 2px; }
.choice.toned:has(input:checked) { border-color: var(--lv); background: var(--lv-bg); color: var(--lv-ink); box-shadow: inset 0 0 0 1px var(--lv); }
.choice.check.lv-red { border-inline-start: 5px solid var(--red-500); }
.choice.check.lv-yellow { border-inline-start: 5px solid var(--amber-500); }
.choice .lv-badge { font-size: .7rem; }
.input-unit { display: flex; align-items: stretch; max-width: 16rem; }
.input-unit .form-control { border-start-end-radius: 0; border-end-end-radius: 0; font-size: 1.25rem; font-weight: 700; }
.input-unit span { display: grid; place-items: center; padding: 0 .8rem; background: #EEF0F5; border: 1px solid var(--line-strong); border-inline-start: 0; border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; direction: ltr; }
.scale-dot { position: relative; cursor: pointer; }
.scale-dot input { position: absolute; opacity: 0; }
.scale-dot span { display: grid; place-items: center; height: 46px; border-radius: 10px; font-weight: 800; background: var(--green-100); color: var(--green-700); border: 2px solid transparent; }
.scale-dot.s4 span, .scale-dot.s5 span, .scale-dot.s6 span { background: var(--amber-100); color: var(--amber-700); }
.scale-dot.s7 span, .scale-dot.s8 span, .scale-dot.s9 span, .scale-dot.s10 span { background: var(--red-100); color: var(--red-700); }
.scale-dot:has(input:checked) span { border-color: var(--ink); transform: scale(1.06); box-shadow: var(--shadow-1); }
.scale-dot:has(input:focus-visible) span { outline: 3px solid var(--lj-300); }
.scale-legend { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: .25rem; direction: ltr; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; background: #E9ECF3; border-radius: 12px; padding: .25rem; }
.seg a { padding: .35rem .8rem; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .88rem; }
.seg a.active { background: var(--surface); color: var(--lj-800); box-shadow: var(--shadow-1); }
.seg a .n { font-size: .78rem; color: var(--muted); }
.sticky-submit { position: sticky; bottom: 4.9rem; z-index: 5; padding-top: .4rem; background: linear-gradient(to top, var(--paper) 70%, transparent); }
.symptom-cta { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius-lg); background: var(--red-700); color: #fff; text-decoration: none; box-shadow: var(--shadow-2); }
.symptom-cta:hover { color: #fff; background: #8F1F19; }
.symptom-cta > .bi:first-child { font-size: 2rem; }
.symptom-cta[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.mod-card.due { border-color: var(--amber-500); box-shadow: inset 0 0 0 1px var(--amber-500), var(--shadow-1); }
.tr-note { background: rgba(255, 255, 255, .55); border-radius: 12px; padding: .6rem .8rem; }
.alert-banner { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: var(--radius); background: var(--lv-bg); color: var(--lv-ink); border: 1px solid var(--lv); }
.alert-banner > .bi { font-size: 1.6rem; }

/* ---------- صندوق هشدار کادر درمان ---------- */
.nav-count { margin-inline-start: auto; min-width: 1.5rem; text-align: center; font-size: .75rem; font-weight: 800; border-radius: 999px; padding: 0 .4rem; background: rgba(255, 255, 255, .18); }
.nav-count:empty { display: none; }
.nav-count.red { background: var(--red-500); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(216, 56, 47, .25); } }
@media (prefers-reduced-motion: reduce) { .nav-count.red { animation: none; } }
.alert-row { position: relative; }
.alert-row .stretched { color: inherit; text-decoration: none; }
.alert-row .stretched::after { content: ""; position: absolute; inset: 0; }
.alert-row .btn { position: relative; z-index: 1; }
.wl-row.is-closed { opacity: .65; }
.triage-result.staff h2 { font-size: 1.2rem; }
.quote { border-inline-start: 3px solid var(--line-strong); padding: .3rem .8rem; margin: 0; color: var(--ink-2); background: #F7F8FB; border-radius: 0 8px 8px 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 3.6rem 1fr; gap: .7rem; padding: .45rem 0; position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 3.9rem; top: .9rem; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); transform: translateX(50%); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 4.05rem; top: 1.4rem; bottom: -.5rem; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li > div:last-child { padding-inline-start: .8rem; }
.timeline .tl-time { font-weight: 800; font-size: .85rem; line-height: 1.2; }
.timeline .tl-time small { display: block; font-weight: 500; color: var(--muted); font-size: .7rem; }
.timeline .ev-created::before { background: var(--red-500); }
.timeline .ev-escalated::before { background: var(--amber-500); }
.timeline .ev-acknowledged::before { background: var(--lj-600); }
.timeline .ev-resolved::before { background: var(--green-500); }

/* ---------- نمودارهای SVG (M5) ---------- */
.chart .band-g { fill: #E3F4EA; } .chart .band-y { fill: #FFF3D6; } .chart .band-r { fill: #FDE5E2; }
.spark .band-g { fill: #E3F4EA; }
.chart .grid { stroke: rgba(22, 26, 43, .08); stroke-width: 1; }
.chart .grid.v { stroke-dasharray: 2 4; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .line, .spark .line { fill: none; stroke: var(--lj-700); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s2 { stroke: var(--lj-300); stroke-dasharray: 5 4; }
.chart .pt, .spark .pt { stroke: #fff; stroke-width: 1.5; }
.chart .pt.pt-g, .spark .pt.pt-g { fill: var(--green-500); }
.chart .pt.pt-y, .spark .pt.pt-y { fill: var(--amber-500); }
.chart .pt.pt-r, .spark .pt.pt-r { fill: var(--red-500); }
.chart .pt.pt-n, .spark .pt.pt-n { fill: var(--lj-700); }
.chart .pt.s2 { opacity: .85; }
.chart .ring { fill: none; stroke: var(--red-500); stroke-width: 1.5; opacity: .5; }
.chart .ref { stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 6 4; }
.chart .ref-label { fill: var(--ink-2); font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.chart .bar-in { fill: var(--lj-600); } .chart .bar-out { fill: var(--lj-300); }
.chart .bar-in.lv-yellow { fill: var(--amber-500); } .chart .bar-in.lv-red { fill: var(--red-500); }
.chart-legend .sw.band-g { background: #CFEBDB; } .chart-legend .sw.band-y { background: #FBE3A8; } .chart-legend .sw.band-r { background: #F8C9C3; }
.chart-legend .sw.line-s1 { background: var(--lj-700); height: 3px; vertical-align: 3px; }
.chart-legend .sw.line-s2 { background: repeating-linear-gradient(90deg, var(--lj-300) 0 5px, transparent 5px 8px); height: 3px; vertical-align: 3px; }
.chart-legend .sw.bar-in { background: var(--lj-600); } .chart-legend .sw.bar-out { background: var(--lj-300); }
.chart-table summary { font-size: .8rem; color: var(--lj-700); font-weight: 700; cursor: pointer; }
.chart-table table { font-size: .82rem; }
.mod-card .spark { width: 100%; height: 34px; display: block; margin-top: .25rem; }

/* ---------- عکس زخم (M6) ---------- */
.photo-strip { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x proximity; }
.photo-strip .ph { flex: 0 0 8.2rem; margin: 0; scroll-snap-align: start; }
.photo-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #EEF0F5; display: block; }
.photo-strip figcaption { font-size: .74rem; line-height: 1.5; color: var(--muted); margin-top: .25rem; }
.photo-strip figcaption strong { color: var(--ink); font-size: .8rem; }
.thumb.lg { width: 140px; height: 140px; }

/* ---- M7: تب‌های پرونده، پیام‌رسان، نسخه‌ها ---- */
.tabs { display: flex; flex-wrap: nowrap; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .6rem .9rem; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--lj-800); }
.tabs a.active { color: var(--lj-800); border-bottom-color: var(--lj-700); font-weight: 800; }
.tabs .nav-count { background: var(--red-500); color: #fff; margin-inline-start: .15rem; }

.chat { display: flex; flex-direction: column; gap: .55rem; }
.bubble-row { display: flex; }
.bubble-row.from-me { justify-content: flex-start; }
.bubble-row.from-team { justify-content: flex-end; }
.bubble { max-width: 82%; padding: .6rem .85rem; border-radius: 16px; line-height: 1.7; word-break: break-word; font-size: .95rem; }
.from-me .bubble { background: var(--lj-800); color: #fff; border-end-start-radius: 4px; }
.from-team .bubble { background: #EEF0F6; color: var(--ink); border-end-end-radius: 4px; }
.bubble-who { font-size: .76rem; font-weight: 700; opacity: .8; margin-bottom: .1rem; }
.bubble-time { font-size: .72rem; opacity: .65; margin-top: .25rem; }
.from-me .bubble .chip { background: rgba(255, 255, 255, .18); color: #fff; }

.ver-list { display: flex; flex-direction: column; gap: .6rem; }
.ver-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.ver-changes { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .88rem; }
.ver-changes li { display: flex; gap: .45rem; align-items: baseline; }
.ver-added .bi { color: var(--green-700); }
.ver-removed .bi { color: var(--red-700); }
.ver-changed .bi { color: var(--amber-700); }

.audit-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; display: grid; gap: .35rem; }
.audit-list li { padding: .4rem .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- ویزیت آنلاین (M8) */
.tv-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 1100px) { .tv-layout { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; } }
.tv-stage { position: relative; background: #0d1233; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; max-height: 62vh; width: 100%; box-shadow: var(--shadow-2); }
.tv-remote { width: 100%; height: 100%; object-fit: cover; background: #0d1233; }
.tv-local { position: absolute; inset-inline-start: .75rem; bottom: .75rem; width: 26%; min-width: 96px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .85); background: #1b2255; transform: scaleX(-1); }
.tv-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .6rem; text-align: center; padding: 1.5rem; color: #fff; background: rgba(13, 18, 51, .78); }
.tv-overlay[hidden] { display: none; }
.tv-overlay i { font-size: 2.6rem; opacity: .9; }
.tv-overlay div { font-size: 1.05rem; max-width: 28ch; line-height: 1.7; }
.tv-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.tv-controls .btn.is-off, #tv-live-controls .btn.is-off { background: var(--red-100); color: var(--red-700); }
.tv-side .card-header { font-weight: 700; }
.tv-med { padding: .6rem 0; border-top: 1px dashed var(--line); }
.tv-med:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 575px) { .tv-stage { aspect-ratio: 3 / 4; max-height: 56vh; } }

/* --- M10: PWA، حالت آفلاین، فونت درشت -------------------------------------- */
.offline-bar { position: sticky; top: 3.4rem; z-index: 19; max-width: 640px; margin: 0 auto .5rem; padding: .5rem .9rem; background: var(--amber-100); color: var(--amber-700); font-size: .85rem; font-weight: 700; border-radius: 0 0 12px 12px; display: flex; gap: .5rem; align-items: center; }
.offline-bar[hidden] { display: none; }
.wb-switch { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; font-size: .8rem; font-weight: 700; color: var(--lj-700); text-decoration: none; background: rgba(255,255,255,.7); border-radius: 999px; padding: .15rem .6rem; }
body.portal.big .btn { font-size: 1.05rem; padding-block: .65rem; }
body.portal.big .p-nav a { font-size: .85rem; }
body.portal.big .small, body.portal.big small { font-size: .95rem !important; }
body.portal.big .chip { font-size: .9rem; }

/* --- M11: داشبورد شاخص‌ها، گزارش اعتباربخشی، نظرسنجی ------------------------ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.kpi-mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; }
.kpi-mini .k-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi-mini strong { font-size: 1.5rem; font-family: var(--font-display); line-height: 1.2; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--lv); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-1); }
.kpi-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .92rem; color: var(--ink-2); }
.kpi-head .bi { color: var(--lv-ink); font-size: 1.1rem; }
.kpi-value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; line-height: 1.3; margin: .25rem 0 .1rem; }
.kpi-bar { height: .55rem; background: #E6E9F1; border-radius: 999px; overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; background: var(--lv, var(--lj-600)); border-radius: 999px; }
.kpi-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.kpi-hint { color: var(--muted); margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--line); line-height: 1.7; }
.smart-row { display: flex; align-items: center; gap: .8rem; }
.smart-code { width: 2.2rem; height: 2.2rem; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--lj-800); color: #fff; font-weight: 800; font-family: var(--font-display); }
.smart-row .kpi-bar > span { background: var(--lj-600); }
.week-bars { display: flex; align-items: flex-end; gap: .35rem; height: 150px; }
.week-bars .week { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.week-bars .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.week-bars .bars span { width: 40%; max-width: 14px; background: var(--lj-600); border-radius: 3px 3px 0 0; min-height: 2px; }
.week-bars .bars span.red { background: var(--red-500); }
.week-bars small { font-size: .6rem; color: var(--muted); margin-top: .25rem; white-space: nowrap; transform: rotate(-35deg); transform-origin: top right; height: 1.6rem; }
.legend-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 3px; background: var(--lj-600); margin-inline: .2rem; }
.legend-dot.red { background: var(--red-500); }
.stars { color: var(--amber-500); letter-spacing: .1rem; }
.report-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.8rem; box-shadow: var(--shadow-1); max-width: 980px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; border-bottom: 2px solid var(--lj-800); padding-bottom: .9rem; }
.report-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.5rem; text-align: center; font-size: .85rem; font-weight: 700; }
.report-sign span { display: block; height: 3rem; border-bottom: 1px solid var(--ink-2); margin-top: .4rem; }
@media print {
  .report-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .report-sheet table { page-break-inside: avoid; }
}
.score-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-top: .6rem; }
.score-pick.is-wide { grid-template-columns: repeat(2, 1fr); }
.score-pick label { cursor: pointer; }
.score-pick input { position: absolute; opacity: 0; pointer-events: none; }
.score-pick label > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 4.2rem; padding: .4rem .2rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-size: .78rem; text-align: center; }
.score-pick label > span .bi { font-size: 1.5rem; color: var(--muted); }
.score-pick.is-small label > span { min-height: 2.8rem; }
.score-pick input:checked + span { border-color: var(--lj-600); background: var(--lj-50); box-shadow: inset 0 0 0 1px var(--lj-600); color: var(--lj-900); }
.score-pick input:checked + span .bi { color: var(--lj-700); }
.score-pick input:focus-visible + span { outline: 3px solid var(--lj-600); outline-offset: 2px; }
