/* =====================================================================
   DTS — Department Tasks System  ·  UI stylesheet (RTL / LTR aware)
   ===================================================================== */
:root {
  --bg: #f2f5f9; --surface: #fff; --surface-2: #f7f9fc; --border: #e2e8f0; --border-2: #cfd8e3;
  --text: #0f1b2d; --text-2: #334155; --muted: #6b7a90;
  --primary: #0e5f8f; --primary-2: #0a4a71; --primary-soft: #e6f1f8;
  --accent: #c39a2b; --accent-soft: #fbf3dc;
  --side: #0a2240; --side-2: #12345c; --side-text: #c8d6e8;
  --ok: #16a34a; --ok-soft: #e7f6ec; --warning: #d4a106; --warning-soft: #fdf6d8;
  --critical: #ea580c; --critical-soft: #fdece2; --overdue: #dc2626; --overdue-soft: #fde8e8;
  --review: #2563eb; --review-soft: #e6eefe; --done: #64748b; --done-soft: #eef1f5;
  --violet: #7c3aed; --violet-soft: #f1eafe;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 4px 16px rgba(15, 27, 45, .05);
  --shadow-lg: 0 20px 50px rgba(15, 27, 45, .22);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#0b1220; --surface:#111a2b; --surface-2:#0f1726; --border:#1f2c42; --border-2:#2a3a55; --text:#e6edf7; --text-2:#c3cee0; --muted:#8696ae; --primary:#3d9ad6; --primary-2:#2f86c0; --primary-soft:#13283f; --accent-soft:#2b2513; --ok-soft:#10291b; --warning-soft:#2b2610; --critical-soft:#2e1a10; --overdue-soft:#2f1416; --review-soft:#132143; --done-soft:#1a2232; --violet-soft:#221a3a; --side:#070e1b; --side-2:#0f1c33; --shadow:0 1px 2px rgba(0,0,0,.3); color-scheme: dark; } }
:root[data-theme="dark"] { --bg:#0b1220; --surface:#111a2b; --surface-2:#0f1726; --border:#1f2c42; --border-2:#2a3a55; --text:#e6edf7; --text-2:#c3cee0; --muted:#8696ae; --primary:#3d9ad6; --primary-2:#2f86c0; --primary-soft:#13283f; --accent-soft:#2b2513; --ok-soft:#10291b; --warning-soft:#2b2610; --critical-soft:#2e1a10; --overdue-soft:#2f1416; --review-soft:#132143; --done-soft:#1a2232; --violet-soft:#221a3a; --side:#070e1b; --side-2:#0f1c33; --shadow:0 1px 2px rgba(0,0,0,.3); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.65 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 600; }
h4 { font-size: 14px; margin: 14px 0 8px; display: flex; align-items: center; gap: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code, .code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
pre.code { padding: 10px 12px; overflow: auto; white-space: pre-wrap; direction: ltr; text-align: left; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .d-block { display: block; } .nowrap { white-space: nowrap; }
.text-danger { color: var(--overdue); } .center { text-align: center; } .mt { margin-top: 12px; } .mt-xs { margin-top: 4px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; }
.ic.ok { color: var(--ok); }

/* ---------- Layout ---------- */
body.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--side), var(--side-2)); color: var(--side-text); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #e7c45e); color: #0a2240; flex: none; box-shadow: 0 6px 18px rgba(195,154,43,.35); }
.brand-mark .ic { width: 22px; height: 22px; }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; }
.brand-mark.lg .ic { width: 28px; height: 28px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-txt b { font-size: 14.5px; }
.brand-txt small { font-size: 11px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--side-text); font-weight: 500; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.1); color: #fff; }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--accent); }
.nav a span { flex: 1; }
.nbadge { font-style: normal; background: var(--overdue); color: #fff; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .5; padding: 16px 12px 6px; }
.side-foot { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,.07); font-size: 11px; opacity: .8; }
.lvl-chip { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 20px; background: rgba(195,154,43,.18); color: var(--accent); font-weight: 600; white-space: nowrap; }
.content .lvl-chip, .card .lvl-chip { background: var(--accent-soft); color: #8a6a12; }
.lvl-chip.l1 { background: #fde8e8; color: #9b1c1c; } .lvl-chip.l2 { background: #f1eafe; color: #5b21b6; } .lvl-chip.l3 { background: #e6eefe; color: #1e40af; } .lvl-chip.l4 { background: #e7f6ec; color: #166534; } .lvl-chip.l5 { background: var(--done-soft); color: var(--done); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 26px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.page-title { font-size: 19px; flex: none; }
.top-search { flex: 1; max-width: 420px; margin-inline-start: auto; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 0 12px; color: var(--muted); }
.top-search input { border: 0; background: none; outline: none; padding: 9px 0; width: 100%; font: inherit; color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface); border-color: var(--border); text-decoration: none; }
.icon-btn.xs { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.xs .ic { width: 14px; height: 14px; }
.icon-btn.bell em { position: absolute; top: 3px; inset-inline-end: 2px; background: var(--overdue); color: #fff; font-size: 10px; font-style: normal; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.lang-tag { font-weight: 700; font-size: 13px; }
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); background: var(--surface); border-radius: 30px; padding: 3px 4px; padding-inline-end: 14px; cursor: pointer; font: inherit; color: var(--text); }
.uc-txt { display: flex; flex-direction: column; line-height: 1.25; text-align: start; max-width: 180px; }
.uc-txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.user-menu.open .dropdown { display: block; }
.dropdown a { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown a.danger { color: var(--overdue); }
.content { padding: 24px 26px 40px; flex: 1; width: 100%; max-width: 1500px; }
.foot { padding: 14px 26px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.only-mobile { display: none; }
.scrim { display: none; }

/* ---------- Avatars ---------- */
.avatar { --h: 200; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; color: hsl(var(--h) 60% 28%); background: hsl(var(--h) 70% 88%); }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; } .avatar.sm { width: 30px; height: 30px; font-size: 11px; } .avatar.xl { width: 72px; height: 72px; font-size: 24px; }
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 40% 25%); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-h .count { font-style: normal; background: var(--primary-soft); color: var(--primary); font-weight: 700; border-radius: 20px; padding: 0 10px; font-size: 12.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col.wide-left { grid-template-columns: 1.6fr 1fr; }
.two-col > .card { margin-bottom: 0; } .two-col { margin-bottom: 18px; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .ic { width: 38px; height: 38px; opacity: .45; }
.empty.sm { padding: 16px 10px; } .empty.sm .ic { width: 26px; height: 26px; }
.empty p { margin: 8px 0 0; }
.info-box { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s; line-height: 1.4; }
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn.primary:hover { background: var(--primary-2); color: #fff; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.success:hover { filter: brightness(.93); color: #fff; }
.btn.danger { background: var(--overdue); border-color: var(--overdue); color: #fff; }
.btn.danger.ghost { background: none; color: var(--overdue); border-color: color-mix(in srgb, var(--overdue) 40%, transparent); }
.btn.danger.ghost:hover { background: var(--overdue-soft); }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; } .btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn.lg { padding: 11px 24px; font-size: 15px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link { color: var(--primary); } .link.small { font-size: 12.5px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-2); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; }
label.check { flex-direction: row; align-items: center; gap: 9px; cursor: pointer; font-weight: 400; }
label.check.pad { padding-top: 26px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: span 2; }
.req { color: var(--overdue); }
.inline { display: flex; gap: 8px; } .inline input { flex: 1; } .inline select { width: auto; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 160px; width: auto; }
.form-sec { font-size: 14px; color: var(--primary); margin-top: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding-top: 24px; z-index: 5; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-direction: row; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 24px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(20px); }
[dir=rtl] .switch input:checked + span::before { transform: translateX(-20px); }
details.more summary { cursor: pointer; color: var(--primary); font-size: 13px; margin-bottom: 8px; }
details.more { display: flex; flex-direction: column; gap: 10px; }
details.more[open] label { margin-top: 10px; }
.drop { border: 2px dashed var(--border-2); border-radius: 12px; padding: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); position: relative; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.file-list li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 9px; font-size: 12px; }
.file-btn { position: relative; overflow: hidden; } .file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; border: 1px solid transparent; font-size: 13.5px; }
.alert .x { margin-inline-start: auto; background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }
.alert-success { background: var(--ok-soft); color: #14532d; border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-danger { background: var(--overdue-soft); color: #7f1d1d; border-color: color-mix(in srgb, var(--overdue) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: #713f12; border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-info { background: var(--review-soft); color: #1e3a8a; border-color: color-mix(in srgb, var(--review) 25%, transparent); }
:root[data-theme="dark"] .alert { color: var(--text); }

/* ---------- Badges & stages ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--done-soft); color: var(--done); white-space: nowrap; }
.prio-low { background: var(--done-soft); color: var(--done); }
.prio-medium { background: var(--review-soft); color: var(--review); }
.prio-high { background: var(--warning-soft); color: #9a6b00; }
.prio-urgent { background: var(--overdue-soft); color: var(--overdue); }
.st-open { background: var(--primary-soft); color: var(--primary); } .st-in_progress { background: var(--review-soft); color: var(--review); }
.st-forwarded { background: var(--violet-soft); color: var(--violet); } .st-completion_requested { background: var(--warning-soft); color: #9a6b00; }
.st-closed { background: var(--ok-soft); color: var(--ok); } .st-cancelled { background: var(--done-soft); color: var(--done); }
.badge.admin { background: var(--accent-soft); color: #8a6a12; }
.inc-st-pending, .rq-pending, .inv-active, .ob-pending { background: var(--warning-soft); color: #9a6b00; }
.inc-st-approved, .rq-approved, .inv-used, .ob-sent { background: var(--ok-soft); color: var(--ok); }
.inc-st-rejected, .rq-rejected, .ob-failed { background: var(--overdue-soft); color: var(--overdue); }
.inc-st-escalated { background: var(--violet-soft); color: var(--violet); } .inv-expired { background: var(--done-soft); color: var(--done); }
.ut-gm { background: #fde8e8; color: #9b1c1c; } .ut-gadmin { background: var(--violet-soft); color: var(--violet); } .ut-admin { background: var(--review-soft); color: var(--review); } .ut-section { background: var(--ok-soft); color: var(--ok); }
.stage { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.stage i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.stage-ok { color: var(--ok); } .stage-warning { color: var(--warning); } .stage-critical { color: var(--critical); }
.stage-overdue { color: var(--overdue); } .stage-review { color: var(--review); } .stage-done { color: var(--done); }
.stage-overdue i { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--overdue) 0%, transparent); } }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; } .dot.red { background: var(--overdue); } .dot.pulse { animation: pulse2 1.6s infinite; }
@keyframes pulse2 { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 70% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.chip.sm { padding: 1px 8px; font-size: 11.5px; margin: 1px; } .chip.temp { border-style: dashed; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ref { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 0 6px; border-radius: 6px; direction: ltr; display: inline-block; }

/* progress */
.prog { height: 5px; background: var(--surface-2); border-radius: 5px; overflow: hidden; margin: 4px 0; min-width: 70px; border: 1px solid var(--border); }
.prog i { display: block; height: 100%; border-radius: 5px; background: var(--ok); }
.prog-warning i { background: var(--warning); } .prog-critical i { background: var(--critical); } .prog-overdue i { background: var(--overdue); } .prog-review i { background: var(--review); } .prog-done i { background: var(--done); }
.prog.sm { display: inline-block; width: 60px; vertical-align: middle; margin-inline-end: 6px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring span { font-weight: 700; font-size: 15px; }
.ring.big { width: 86px; height: 86px; } .ring.big span { font-size: 19px; }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.dash-head h2 { font-size: 24px; }
.dash-head p { margin: 2px 0 0; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.dash-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dash-filters select { width: auto; max-width: 300px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 5px 11px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 500; }
.seg a.on { background: var(--primary); color: #fff; } .seg a:hover { text-decoration: none; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.q-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); transition: .15s; }
.q-item:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.q-item span { display: flex; flex-direction: column; font-size: 12.5px; }
.q-item b { font-size: 20px; color: var(--text); line-height: 1.1; }
.q-item .ic { width: 22px; height: 22px; color: var(--primary); }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); color: inherit; min-width: 0; }
a.kpi:hover { text-decoration: none; border-color: var(--primary); }
.kpi > div { display: flex; flex-direction: column; min-width: 0; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi b { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.5px; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.k-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.k-ic .ic { width: 22px; height: 22px; }
.k-ic.blue { background: var(--review-soft); color: var(--review); } .k-ic.amber { background: var(--warning-soft); color: #b48900; } .k-ic.green { background: var(--ok-soft); color: var(--ok); }
.k-ic.red { background: var(--overdue-soft); color: var(--overdue); } .k-ic.violet { background: var(--violet-soft); color: var(--violet); }
.charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.charts > .card { margin: 0; }
.chart-card.wide { grid-column: span 2; } .chart-card.full { grid-column: 1 / -1; }
.chart-box { position: relative; height: 260px; } .chart-box.sm { height: 240px; } .chart-box.tall { height: 300px; }
.unit-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 16px; }
.unit-pill { border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; color: var(--text); background: var(--surface-2); transition: .15s; }
.unit-pill:hover { border-color: var(--primary); text-decoration: none; }
.unit-pill b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-pill small { color: var(--muted); font-size: 11.5px; }
.unit-pill .bar { display: flex; height: 7px; border-radius: 7px; overflow: hidden; background: var(--border); }
.unit-pill .bar i { display: block; height: 100%; }
.bar .c { background: var(--ok); } .bar .r { background: var(--review); } .bar .o { background: var(--warning); } .bar .x { background: var(--overdue); }
.leader { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.leader li { display: flex; align-items: center; gap: 10px; }
.rank { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); flex: none; }
.rank.r1 { background: #f8e7a6; color: #7a5b00; } .rank.r2 { background: #e5e7eb; color: #4b5563; } .rank.r3 { background: #f3d1b5; color: #7c3d12; }
.ln { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.ln b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln .bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; } .ln .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 6px; }
.lv { text-align: end; font-weight: 700; font-size: 15px; display: flex; flex-direction: column; line-height: 1.2; } .lv small { font-weight: 400; color: var(--muted); font-size: 11px; }
.deadlines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.deadlines a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); border: 1px solid var(--border); }
.deadlines a:hover { background: var(--surface-2); text-decoration: none; }
.deadlines i { width: 4px; align-self: stretch; border-radius: 4px; background: var(--ok); }
.deadlines span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.deadlines b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .deadlines small { color: var(--muted); font-size: 11.5px; }
.dl-warning i { background: var(--warning); } .dl-critical i { background: var(--critical); } .dl-overdue i { background: var(--overdue); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: start; font-weight: 600; font-size: 12px; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table th:first-child { border-start-start-radius: 9px; } .table th:last-child { border-start-end-radius: 9px; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.clickable tbody tr { cursor: pointer; transition: background .12s; }
.table.clickable tbody tr:hover { background: var(--surface-2); }
.table tr.off td { opacity: .55; }
.table td.ttl { min-width: 220px; }
.table td.ttl b { font-weight: 600; }
.table .meta { display: flex; gap: 10px; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.table .meta span { display: inline-flex; gap: 3px; align-items: center; } .table .meta .ic { width: 12px; height: 12px; }
.tasks-table tr td:first-child { border-inline-start: 4px solid transparent; }
tr.row-overdue td:first-child { border-inline-start: 4px solid var(--overdue) !important; } tr.row-overdue { background: color-mix(in srgb, var(--overdue-soft) 55%, transparent); }
tr.row-critical td:first-child { border-inline-start: 4px solid var(--critical) !important; }
tr.row-warning td:first-child { border-inline-start: 4px solid var(--warning) !important; }
tr.row-ok td:first-child { border-inline-start: 4px solid var(--ok) !important; }
tr.row-review td:first-child { border-inline-start: 4px solid var(--review) !important; }
tr.row-done td:first-child { border-inline-start: 4px solid var(--done) !important; }
.table.mini { font-size: 12.5px; } .table.mini td, .table.mini th { padding: 6px 8px; }
.table.mini input, .table.mini select { padding: 5px 8px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 10px; }
.pager { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager .gap { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; padding: 0 8px; }
.pager a.on { background: var(--primary); color: #fff; border-color: var(--primary); } .pager .gap { border: 0; }

/* ---------- Tasks list ---------- */
.page-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bar-actions { display: flex; gap: 8px; align-items: center; }
.bar-actions select { width: auto; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; flex-wrap: wrap; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--primary-soft); color: var(--primary); }
.tabs em { font-style: normal; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 7px; border-radius: 10px; }
.stage-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-chips .chip { font-weight: 600; cursor: pointer; }
.stage-chips .chip i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.stage-chips .chip b { background: var(--surface-2); color: var(--text); padding: 0 7px; border-radius: 10px; font-size: 11.5px; }
.stage-chips .chip:hover { text-decoration: none; border-color: currentColor; }
.stage-chips .chip.on { background: currentColor; } .stage-chips .chip.on, .stage-chips .chip.on * { color: #fff; } .stage-chips .chip.on b { background: rgba(255,255,255,.25); } .stage-chips .chip.on i { background: #fff; }
.filters { padding: 12px 14px; }
.f-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.f-row > select, .f-row > input { width: auto; }
.f-row label.grow, .filters-inline label.grow { flex: 1; min-width: 200px; flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 9px; padding: 0 10px; background: var(--surface); color: var(--muted); }
.f-row label.grow input, .filters-inline label.grow input { border: 0; box-shadow: none; padding: 8px 0; }
.f-row.more { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.f-row.more.open { display: flex; }
.f-row.more label { min-width: 150px; }
.filters-inline { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.filters-inline select { width: auto; }

/* ---------- New task ---------- */
.nt-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.nt-grid .card { margin: 0; }
.nt-grid .span-rows { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 80px; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-size: 13px; }
.prio-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.pp { flex-direction: row; cursor: pointer; }
.pp input { display: none; }
.pp span { padding: 6px 13px; border-radius: 20px; border: 1px solid var(--border-2); font-weight: 600; font-size: 13px; transition: .15s; }
.pp.prio-low input:checked + span { background: var(--done); color: #fff; border-color: var(--done); }
.pp.prio-medium input:checked + span { background: var(--review); color: #fff; border-color: var(--review); }
.pp.prio-high input:checked + span { background: #d39b06; color: #fff; border-color: #d39b06; }
.pp.prio-urgent input:checked + span { background: var(--overdue); color: #fff; border-color: var(--overdue); }
.sub-sec { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.chips-check { display: flex; gap: 8px; flex-wrap: wrap; }
.cc { flex-direction: row; cursor: pointer; } .cc input { display: none; }
.cc span { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-2); font-size: 13px; }
.cc input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.picker { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.picker-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.picker-search input { border: 0; background: none; box-shadow: none !important; padding: 10px 0; }
.picker-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.pg-title { font-size: 11.5px; font-weight: 700; color: var(--accent); padding: 8px 8px 4px; text-transform: uppercase; letter-spacing: .03em; }
.pick { flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-weight: 400; border: 1px solid transparent; }
.pick:hover { background: var(--surface-2); }
.pick:has(input:checked) { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.pick-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.pick:has(input:checked) .pick-ic { background: var(--primary); color: #fff; }
.pick-txt { display: flex; flex-direction: column; min-width: 0; }
.pick-txt b { font-size: 13.5px; color: var(--text); } .pick-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.picked span { background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 12px; }

/* ---------- Task page ---------- */
.task-head { display: flex; gap: 20px; justify-content: space-between; align-items: center; border-inline-start: 6px solid var(--ok); }
.stage-edge-warning { border-inline-start-color: var(--warning); } .stage-edge-critical { border-inline-start-color: var(--critical); } .stage-edge-overdue { border-inline-start-color: var(--overdue); } .stage-edge-review { border-inline-start-color: var(--review); } .stage-edge-done { border-inline-start-color: var(--done); }
.th-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.task-head h2 { font-size: 22px; }
.th-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.th-meta span { display: inline-flex; align-items: center; gap: 5px; }
.th-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.task-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.task-side { position: sticky; top: 80px; }
.prose { color: var(--text-2); line-height: 1.9; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13px; max-width: 100%; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file small { color: var(--muted); font-size: 11px; }
.file:hover { border-color: var(--primary); text-decoration: none; }
.f-pdf .ic { color: #dc2626; } .f-doc .ic { color: #2563eb; } .f-xls .ic { color: #16a34a; } .f-img .ic { color: #9333ea; }
.files.sm .file { padding: 4px 9px; font-size: 12px; }
/* chain */
.chain, .chain ul { list-style: none; margin: 0; padding: 0; }
.chain ul { padding-inline-start: 26px; position: relative; }
.chain ul::before { content: ""; position: absolute; inset-inline-start: 11px; top: 0; bottom: 18px; border-inline-start: 2px dashed var(--border-2); }
.chain li { position: relative; padding-top: 10px; }
.chain ul > li::before { content: ""; position: absolute; inset-inline-start: -15px; top: 34px; width: 14px; border-top: 2px dashed var(--border-2); }
.hop-card { border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; background: var(--surface); border-inline-start: 4px solid var(--ok); }
.hop-warning > .hop-card { border-inline-start-color: var(--warning); } .hop-critical > .hop-card { border-inline-start-color: var(--critical); }
.hop-overdue > .hop-card { border-inline-start-color: var(--overdue); background: color-mix(in srgb, var(--overdue-soft) 45%, var(--surface)); }
.hop-review > .hop-card { border-inline-start-color: var(--review); } .hop-done > .hop-card { border-inline-start-color: var(--done); }
.hop.cancelled > .hop-card { opacity: .5; }
.hop.mine > .hop-card { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.hop-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.5px; }
.hop-from { color: var(--muted); }
.hop-arrow { color: var(--muted); display: inline-flex; } [dir=rtl] .hop-arrow .ic { transform: scaleX(-1); }
.hop-unit { display: inline-flex; gap: 5px; align-items: center; font-weight: 600; background: var(--surface-2); padding: 1px 9px; border-radius: 8px; border: 1px solid var(--border); }
.hop-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 7px; font-size: 12px; }
.hop-meta .muted { display: inline-flex; gap: 4px; align-items: center; }
.hop-note { margin-top: 8px; font-size: 12.5px; background: var(--surface-2); border-radius: 8px; padding: 6px 10px; color: var(--text-2); }
.hop-note.ok { background: var(--ok-soft); }
/* thread */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-height: 640px; overflow-y: auto; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 9px 13px; max-width: 82%; }
.msg.me .bubble { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }
.b-h { display: flex; gap: 12px; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.b-h time, .sys time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.b-body { font-size: 13.5px; white-space: normal; word-break: break-word; }
.msg.system { justify-content: center; }
.sys { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 20px; padding: 4px 14px; max-width: 92%; }
.composer { margin-top: 14px; border: 1px solid var(--border-2); border-radius: 14px; overflow: hidden; }
.composer textarea { border: 0; border-radius: 0; box-shadow: none !important; padding: 12px 14px; }
.composer-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--surface-2); border-top: 1px solid var(--border); }
.composer-bar .btn.primary { margin-inline-start: auto; }
/* side action cards */
.act-card { border-top: 4px solid var(--accent); }
.act-card.issued { border-top-color: var(--primary); }
.act-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.act { display: flex; gap: 11px; align-items: center; text-align: start; width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); transition: .15s; }
.act:hover { border-color: var(--primary); transform: translateY(-1px); }
.act > .ic { width: 34px; height: 34px; padding: 7px; border-radius: 9px; background: var(--surface-2); color: var(--primary); }
.act span { display: flex; flex-direction: column; } .act b { font-size: 13.5px; } .act small { font-size: 11.5px; color: var(--muted); }
.act.green > .ic { background: var(--ok-soft); color: var(--ok); } .act.blue > .ic { background: var(--review-soft); color: var(--review); }
.act.amber > .ic { background: var(--warning-soft); color: #b48900; } .act.gold > .ic { background: var(--accent-soft); color: var(--accent); }
.act.red > .ic { background: var(--overdue-soft); color: var(--overdue); }
.rem-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.rem-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; background: var(--surface-2); padding: 4px 8px; border-radius: 8px; }
.rem-list li span { flex: 1; } .rem-list li.sent { opacity: .55; text-decoration: line-through; }
.rem-form { display: flex; flex-wrap: wrap; gap: 6px; }
.rem-form input[type=datetime-local] { flex: 1 1 100%; }
.rem-form input[name=note] { flex: 1; }
.req-box { border: 1px dashed var(--warning); background: var(--warning-soft); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; }
.req-box p { margin: 0 0 6px; font-size: 13px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.people li { display: flex; gap: 10px; align-items: center; } .people span { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; } .people small { color: var(--muted); font-size: 11.5px; }
.inc { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; border-inline-start: 4px solid var(--warning); }
.inc-approved { border-inline-start-color: var(--ok); } .inc-rejected { border-inline-start-color: var(--overdue); } .inc-escalated { border-inline-start-color: var(--violet); }
.inc-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; } .inc-h time { margin-inline-start: auto; font-size: 11.5px; }
.inc p { font-size: 13px; margin: 8px 0; }

/* ---------- Dialogs ---------- */
dialog.dlg { border: 0; border-radius: 18px; padding: 0; width: min(520px, 94vw); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.dlg.wide { width: min(780px, 96vw); }
dialog.dlg::backdrop { background: rgba(8, 18, 35, .55); backdrop-filter: blur(3px); }
dialog.dlg form { padding: 22px 24px; display: flex; flex-direction: column; gap: 13px; max-height: 88vh; overflow-y: auto; }
dialog.dlg h3 { font-size: 17px; display: flex; gap: 8px; align-items: center; }
dialog.dlg h4 { margin: 4px 0 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.dlg-actions .danger.ghost:first-child { margin-inline-end: auto; }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* ---------- Approvals ---------- */
.appr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.appr-grid > .card:first-child { grid-column: 1 / -1; }
.appr-grid .card { margin: 0; }
.appr-item { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.appr-item:last-child { border-bottom: 0; }
.ai-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ai-main a { color: var(--text); } .ai-main p { margin: 4px 0 0; color: var(--text-2); }
.ai-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .ai-act input { width: 200px; padding: 5px 9px; }

/* ---------- Notifications ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list a { display: flex; gap: 14px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--border); color: var(--text); border-radius: 10px; }
.notif-list a:hover { background: var(--surface-2); text-decoration: none; }
.notif-list li.unread a { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.notif-list li.unread .n-txt b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-inline-start: 8px; }
.n-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--review-soft); color: var(--review); flex: none; }
.nt-danger .n-ic { background: var(--overdue-soft); color: var(--overdue); } .nt-warning .n-ic { background: var(--warning-soft); color: #b48900; } .nt-success .n-ic { background: var(--ok-soft); color: var(--ok); }
.n-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; }
.n-txt small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-list time { font-size: 12px; color: var(--muted); text-align: end; display: flex; flex-direction: column; white-space: nowrap; } .notif-list time small { font-size: 11px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 20px; } .profile-head p { margin: 2px 0; }
.ph-actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.totp-setup { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--border); line-height: 0; }
.qr img, .qr svg { width: 168px; height: 168px; }
.secret { display: block; margin: 4px 0 12px; font-size: 14px; letter-spacing: 1px; padding: 6px 10px; }
.otp { font-size: 28px; letter-spacing: 10px; text-align: center; font-family: ui-monospace, monospace; padding: 12px; }
.otp.sm { font-size: 18px; letter-spacing: 6px; padding: 7px; }
.mem-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mem-list li { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.mem-list li > div { flex: 1; min-width: 0; font-size: 13.5px; } .mem-list li.off { opacity: .5; }
.copy-box { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.copy-box input { flex: 1; min-width: 240px; font-size: 12.5px; }
.simple-list { list-style: none; margin: 0; padding: 0; } .simple-list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ---------- Units admin tree ---------- */
.unit-tree, .unit-tree ul { list-style: none; margin: 0; padding: 0; }
.unit-tree ul { padding-inline-start: 28px; border-inline-start: 2px solid var(--border); margin-inline-start: 14px; }
.unit-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; margin: 5px 0; border: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.unit-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.unit-row.off { opacity: .5; }
.unit-row b { font-size: 14px; }
.row-actions { margin-inline-start: auto; display: flex; gap: 4px; align-items: center; }

/* ---------- Org chart ---------- */
.org-scroll { overflow-x: auto; padding-bottom: 10px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.org-tree ul { padding-top: 22px; position: relative; }
.org-tree li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 22px 8px 0; }
.org-tree > li { padding-top: 0; }
.org-tree li::before, .org-tree li::after { content: ""; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--border-2); }
.org-tree li::before { right: 50%; } .org-tree li::after { left: 50%; border-left: 2px solid var(--border-2); }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 22px; }
.org-tree > li:only-child { padding-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0; }
.org-tree li:last-child::before { border-right: 2px solid var(--border-2); border-radius: 0 8px 0 0; }
.org-tree li:first-child::after { border-radius: 8px 0 0 0; }
.org-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--border-2); }
.org-node { border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: 12px; padding: 10px 12px; background: var(--surface); min-width: 190px; max-width: 240px; box-shadow: var(--shadow); text-align: start; }
.org-node.t-gm { border-top-color: #b91c1c; } .org-node.t-gadmin { border-top-color: var(--violet); } .org-node.t-admin { border-top-color: var(--review); } .org-node.t-section { border-top-color: var(--ok); }
.org-node.off { opacity: .5; }
.on-h { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.on-stat { background: var(--surface-2); border-radius: 10px; padding: 0 7px; } .on-stat b { color: var(--overdue); }
.on-name { display: block; font-size: 13.5px; margin: 2px 0 6px; }
.on-head { display: flex; gap: 7px; align-items: center; font-size: 12.5px; margin-top: 4px; }
.on-head span { display: flex; flex-direction: column; line-height: 1.25; } .on-head small { color: var(--muted); font-size: 11px; }
.on-members { margin-top: 6px; font-size: 12px; } .on-members summary { cursor: pointer; color: var(--primary); }
.on-members ul { display: block !important; padding: 4px 0 0 !important; } .on-members ul::before { display: none; }
.on-members li { display: flex !important; flex-direction: row !important; gap: 6px; padding: 2px 0 !important; align-items: center; }
.on-members li::before, .on-members li::after { display: none; }

/* ---------- Auth ---------- */
body.bare { background: radial-gradient(1000px 600px at 10% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent), var(--bg); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; flex-direction: column; }
.auth-wrap > .alert { width: min(460px, 100%); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px; width: min(440px, 100%); }
.auth-card.narrow { width: min(400px, 100%); } .auth-card.wide { width: min(720px, 100%); }
.auth-head { text-align: center; margin-bottom: 22px; position: relative; }
.auth-head h1 { font-size: 22px; } .auth-head p { margin: 4px 0 0; }
.lang-switch { position: absolute; top: -12px; inset-inline-end: -12px; font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; color: var(--muted); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; width: min(960px, 100%); background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-split .auth-card { box-shadow: none; border: 0; border-radius: 0; width: 100%; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-hero { background: linear-gradient(150deg, var(--side), #0e3f6e 60%, #155d8f); color: #fff; padding: 44px 40px; display: flex; align-items: center; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); inset-inline-end: -140px; bottom: -140px; }
.hero-inner { position: relative; z-index: 1; }
.auth-hero .brand-mark { margin: 0 0 18px; }
.auth-hero h2 { font-size: 26px; margin-bottom: 6px; } .auth-hero p { opacity: .75; margin: 0 0 26px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.hero-points li { display: flex; gap: 12px; align-items: center; font-size: 14px; opacity: .92; }
.hero-points .ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.1); color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1300px) { .kpis { grid-template-columns: repeat(3, 1fr); } .charts { grid-template-columns: 1fr 1fr; } .chart-card.wide { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .task-grid { grid-template-columns: 1fr; } .task-side { position: static; } .nt-grid { grid-template-columns: 1fr; } .nt-grid .span-rows { grid-column: auto; grid-row: auto; position: static; } }
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 272px; transform: translateX(-100%); transition: transform .25s; }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  body.side-open .sidebar { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .only-mobile { display: grid; }
  .top-search { display: none; } .uc-txt { display: none; } .user-chip { padding-inline-end: 4px; }
  .content { padding: 16px; } .topbar { padding: 10px 16px; }
  .two-col, .two-col.wide-left, .appr-grid, .charts { grid-template-columns: 1fr; } .chart-card.wide { grid-column: auto; }
  .kpis { grid-template-columns: 1fr 1fr; } .quick { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .task-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } .page-title { font-size: 16px; } .dash-head h2 { font-size: 20px; } }
@media print { .sidebar, .topbar, .task-side, .composer, .form-actions, .foot { display: none !important; } body.app { display: block; } .card { box-shadow: none; break-inside: avoid; } }
