/* ==========================================================================
   Falcon Workspace (Prototype 3): Next-generation minimal enterprise workspace
   Tokens · base · shell · components · views · responsive · RTL · print
   ========================================================================== */

:root {
  color-scheme: light;
  /* Brand palette (fixed) */
  --charcoal: #202938;
  --charcoal-2: #2c3647;
  --indigo: #6366F1;          /* accents, fills, focus, charts */
  --indigo-600: #4F46E5;      /* text + primary buttons (AA 6.3:1 on white) */
  --emerald: #10B981;         /* fills and charts only */
  --offwhite: #FAFBFC;
  --white: #FFFFFF;
  --amber: #F59E0B; --rose: #F43F5E;

  /* Theme-dependent tints (light) */
  --indigo-700: #4338CA; --indigo-50: #EEF0FE; --indigo-100: #E0E3FC;
  --emerald-700: #047857; --emerald-50: #ECFDF5; --emerald-100: #D1FAE5;
  --amber-700: #B45309; --amber-50: #FFF8EB;
  --rose-700: #BE123C;  --rose-50: #FFF1F3; --rose-100: #FBD0D9;
  --sky-700: #0369A1;   --sky-50: #EFF8FF;
  --violet-700: #6D28D9; --violet-50: #F5F3FF; --violet-100: #DDD6FE;
  --pink-700: #9D174D; --pink-50: #FCE7F3;

  /* Neutrals (light) */
  --ink: #202938;
  --ink-2: #475467;           /* 7.6:1 on white */
  --ink-3: #5F6B7D;           /* 5.4:1 on white */
  --ink-4: #8A94A6;           /* decorative only */
  --line: #E8EAEE;
  --line-2: #DADEE5;
  --hover: #F3F4F7;
  --press: #ECEEF2;

  /* Semantic surfaces */
  --bg: var(--offwhite);
  --surface: var(--white);
  --surface-2: #FBFBFC;       /* table heads, footers */
  --surface-3: #F2F3F6;       /* wells: segmented track, board columns */
  --surface-dis: #F6F7F9;
  --row-hover: #F8F9FB;
  --grey-tint: #F1F2F5;
  --unread: #F7F7FF;
  --skel-a: #EEF0F3; --skel-b: #F6F7F9;
  --topbar-bg: rgba(250, 251, 252, .86);
  --text: var(--ink);
  --muted: var(--ink-3);
  --accent: var(--indigo-600);
  --primary-bg: var(--indigo-600); --primary-bg-hover: var(--indigo-700);
  --success-bg: #047857; --danger-bg: #BE123C;
  --inverse-bg: var(--charcoal); --inverse-fg: #fff; --inverse-bg-hover: var(--charcoal-2);
  --float-dark: var(--charcoal);
  --focus: 0 0 0 3px rgba(99, 102, 241, .35);
  --scrim: rgba(32, 41, 56, .32);

  /* Charts (validated with dataviz/validate_palette.js against #FFFFFF) */
  --chart-1: #5E62EC; --chart-2: #E0703F; --chart-3: #14A37A; --chart-4: #D29500; --chart-5: #D9649A; --chart-6: #2F9CC4;
  --chart-grid: #EEF0F3; --chart-axis: #5F6B7D;

  /* Type scale 12/13/14/16/20/24/30 */
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 24px; --fs-2xl: 30px;
  /* Spacing 4/8 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  --radius: 12px;
  --radius-md: 9px;
  --radius-sm: 7px;
  --shadow-float: 0 16px 40px -12px rgba(32, 41, 56, .22), 0 2px 8px rgba(32, 41, 56, .06);
  --shadow-lift: 0 6px 18px -8px rgba(32, 41, 56, .18);
  --shadow-xs: 0 1px 2px rgba(32, 41, 56, .06);

  --rail-w: 64px;
  --rail-w-open: 232px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: .18s;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Noto Sans Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Dark theme (charcoal-based; every text pair checked for AA) ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --indigo-700: #C7CCFD;      /* text on indigo tint: 9.3:1 */
  --indigo-50: rgba(99, 102, 241, .16); --indigo-100: rgba(129, 140, 248, .30);
  --emerald-700: #4ADE9F;     /* 8.1:1 on its tint */
  --emerald-50: rgba(16, 185, 129, .14); --emerald-100: rgba(16, 185, 129, .30);
  --amber-700: #FBBF4A; --amber-50: rgba(245, 158, 11, .14);
  --rose-700: #FDA4B4; --rose-50: rgba(244, 63, 94, .15); --rose-100: rgba(244, 63, 94, .35);
  --sky-700: #8BD3F7; --sky-50: rgba(56, 189, 248, .13);
  --violet-700: #C9B8FD; --violet-50: rgba(139, 92, 246, .16); --violet-100: rgba(139, 92, 246, .4);
  --pink-700: #F9A8D4; --pink-50: rgba(236, 72, 153, .16);

  --ink: #E9ECF2;             /* 14.6:1 on #161B26 */
  --ink-2: #BEC5D1;           /* 9.9:1 */
  --ink-3: #9AA4B4;           /* 6.9:1 */
  --ink-4: #6C7687;
  --line: #262D3B;
  --line-2: #343C4D;
  --hover: #212837;
  --press: #283041;

  --bg: #0E121A;
  --surface: #161B26;
  --surface-2: #1A2030;
  --surface-3: #121722;
  --surface-dis: #1B2130;
  --row-hover: #1B2130;
  --grey-tint: #232A39;
  --unread: #1A1F33;
  --skel-a: #1C2230; --skel-b: #252C3C;
  --topbar-bg: rgba(14, 18, 26, .82);
  --accent: #A5B0FC;          /* links 8.4:1 */
  --primary-bg: #5458E8; --primary-bg-hover: #6366F1;
  --success-bg: #047857; --danger-bg: #BE123C;
  --inverse-bg: #E9ECF2; --inverse-fg: #161B26; --inverse-bg-hover: #FFFFFF;
  --float-dark: #262E3F;
  --focus: 0 0 0 3px rgba(129, 140, 248, .55);
  --scrim: rgba(4, 6, 10, .6);
  --shadow-float: 0 18px 48px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  --shadow-lift: 0 8px 20px -8px rgba(0, 0, 0, .55);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);

  /* Charts (validated against #161B26) */
  --chart-1: #7A7FF4; --chart-2: #D9703E; --chart-3: #1CA47B; --chart-4: #B98A12; --chart-5: #D3679A; --chart-6: #3497BF;
  --chart-grid: #232A38; --chart-axis: #9AA4B4;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
html[lang="ar"] body { font-family: var(--font-ar), var(--font); }
.ar { font-family: var(--font-ar), var(--font); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.018em; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; letter-spacing: -0.025em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: var(--indigo-100); }
.skip-link { position: absolute; inset-inline-start: 12px; top: -48px; background: var(--float-dark); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: end; }
.center { text-align: center; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.ic { width: 16px; height: 16px; flex: none; stroke-width: 1.75; vertical-align: -3px; }
svg.ic.sm { width: 14px; height: 14px; }
svg.ic.lg { width: 20px; height: 20px; }
html[dir="rtl"] svg.ic.flip { transform: scaleX(-1); }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.main-col { margin-inline-start: var(--rail-w); min-width: 0; transition: margin var(--dur) var(--ease); }
body.rail-pinned .main-col { margin-inline-start: var(--rail-w-open); }

.rail {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; width: var(--rail-w);
  background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 10px 10px 12px; gap: 2px;
  transition: width .2s var(--ease), box-shadow .2s var(--ease); overflow: hidden;
}
.rail.expanded, body.rail-pinned .rail { width: var(--rail-w-open); }
.rail.expanded:not(.pinned) { box-shadow: var(--shadow-float); }
.rail-brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 4px; margin-bottom: 8px; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--charcoal); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { line-height: 1.15; white-space: nowrap; }
.brand-text b { display: block; font-size: 14px; letter-spacing: -0.02em; }
.brand-text span { font-size: 11.5px; color: var(--muted); }
.rail-label, .brand-text { opacity: 0; transition: opacity .12s; pointer-events: none; }
.rail.expanded .rail-label, .rail.expanded .brand-text, body.rail-pinned .rail .rail-label, body.rail-pinned .rail .brand-text { opacity: 1; transition-delay: .06s; pointer-events: auto; }
.rail-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none !important; white-space: nowrap; border: 0; background: none; cursor: pointer; width: 100%; text-align: start;
}
.rail-item svg.ic { width: 18px; height: 18px; }
.rail-item:hover { background: var(--hover); color: var(--ink); }
.rail-item.active { background: var(--indigo-50); color: var(--indigo-700); }
.rail-item.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--indigo); }
html[dir="rtl"] .rail-item.active::before { border-radius: 3px 0 0 3px; }
.rail-item .rail-badge { margin-inline-start: auto; font-size: 11px; background: var(--indigo-50); color: var(--indigo-700); padding: 0 6px; border-radius: 99px; }
.rail-item .dot-badge { position: absolute; top: 8px; inset-inline-start: 28px; width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); box-shadow: 0 0 0 2px var(--surface); }
.rail.expanded .dot-badge, body.rail-pinned .dot-badge { display: none; }
.rail-divider { height: 1px; background: var(--line); margin: 8px 6px; flex: none; }
.rail-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 0 12px; height: 0; overflow: hidden; opacity: 0; transition: opacity .12s, height .2s; white-space: nowrap; }
.rail.expanded .rail-group-label, body.rail-pinned .rail-group-label { height: 18px; opacity: 1; }
.rail-spacer { flex: 1; }
.rail-tip {
  position: fixed; z-index: 90; background: var(--float-dark); color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 7px;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-float);
}
.rail-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 39; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 24px; background: var(--topbar-bg); backdrop-filter: saturate(1.6) blur(10px); -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); flex: 1 1 auto; overflow: hidden; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--ink); text-decoration: none; }
.crumbs .sep { color: var(--ink-4); flex: none; }
.crumbs .here { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; min-width: 220px; border: 1px solid var(--line-2);
  border-radius: 9px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px;
}
.search-trigger:hover { border-color: var(--ink-4); color: var(--ink-2); }
.search-trigger .kbd { margin-inline-start: auto; }
.kbd { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 17px; background: var(--surface); white-space: nowrap; }
.tb-sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.ctx-select { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.ctx-select:hover { background: var(--hover); }
.ctx-select.on { background: var(--indigo-50); color: var(--indigo-700); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--charcoal); flex: none; letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
html[dir="rtl"] .avatar-btn { padding: 3px 3px 3px 8px; }
.avatar-btn:hover { border-color: var(--ink-4); }
.avatar-btn .role-code { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.bell { position: relative; }
.bell .count { position: absolute; top: 3px; inset-inline-end: 2px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--primary-bg); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--bg); }

.view { padding: 28px 32px 64px; max-width: 1480px; margin: 0 auto; outline: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: background var(--dur), border-color var(--dur), transform var(--dur), box-shadow var(--dur); text-decoration: none !important;
}
.btn:hover { background: var(--hover); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: auto; }
.btn[disabled]:hover { background: var(--surface); border-color: var(--line-2); }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: #fff; }
.btn-primary:hover { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); }
.btn-primary[disabled]:hover { background: var(--primary-bg); }
.btn-dark { background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-fg); }
.btn-dark:hover { background: var(--inverse-bg-hover); border-color: var(--inverse-bg-hover); }
.btn-success { background: var(--success-bg); border-color: var(--success-bg); color: #fff; }
.btn-success:hover { background: #065F46; border-color: #065F46; color: #fff; }
.btn-danger { color: var(--rose-700); }
.btn-danger:hover { background: var(--rose-50); border-color: var(--rose-100); }
.btn-danger-solid { background: var(--danger-bg); border-color: var(--danger-bg); color: #fff; }
.btn-danger-solid:hover { background: #9F1239; border-color: #9F1239; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 24px; padding: 0 7px; font-size: 12px; border-radius: 7px; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.bordered { border-color: var(--line-2); background: var(--surface); }
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Page header & segmented tabs ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 7px; border: 0; background: none; color: var(--ink-2);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.seg .cnt { font-size: 11px; color: var(--ink-3); background: var(--grey-tint); border-radius: 99px; padding: 0 6px; }
.seg.sm a, .seg.sm button { height: 24px; padding: 0 9px; font-size: 12.5px; }
.module-tabs { margin-bottom: 22px; }

/* ---------- Cards / widgets ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 14px; }
.card-body { padding: 16px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.hover-lift { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.clickable { cursor: pointer; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.g-auto-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split-l { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }

/* Workspace */
.greet { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.greet h1 { font-size: 26px; letter-spacing: -0.03em; }
.greet .date { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.filters-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 20px; }
.focus-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  text-decoration: none !important; color: var(--ink); cursor: pointer; text-align: start; width: 100%;
}
.focus-item .fi-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--indigo-50); color: var(--indigo-700); flex: none; }
.focus-item .fi-n { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.focus-item .fi-l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.focus-item .fi-go { margin-inline-start: auto; color: var(--ink-4); }
.focus-item.done .fi-ic { background: var(--emerald-50); color: var(--emerald-700); }
.section-label { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  position: relative; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  cursor: pointer; text-align: start; width: 100%; display: block; color: var(--ink); text-decoration: none !important; overflow: hidden;
}
.tile .t-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .t-val { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile .t-val small { font-size: 14px; color: var(--muted); font-weight: 500; margin-inline-start: 2px; }
.tile .t-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 24px; }
.tile .t-note { font-size: 12px; color: var(--muted); }
.tile .t-note.warn { color: var(--amber-700); }
.tile .t-note.bad { color: var(--rose-700); }
.tile .t-note.good { color: var(--emerald-700); }
.tile .t-go { position: absolute; top: 12px; inset-inline-end: 12px; color: var(--ink-4); opacity: 0; transition: opacity var(--dur); }
.tile:hover .t-go, .tile:focus-visible .t-go { opacity: 1; }
.spark { display: block; }

.widgets { columns: 3 340px; column-gap: 16px; }
.widget { break-inside: avoid; margin-bottom: 16px; display: inline-block; width: 100%; }
.widget .card-head { padding: 12px 14px 12px 18px; }
.widget.collapsed .w-body { display: none; }
.widget.collapsed .card-head { border-bottom: 0; }
.w-body { padding: 14px 18px 16px; }
.w-body.flush { padding: 0; }
.chart-box { position: relative; height: 220px; }
.chart-box.sm { height: 180px; }
.chart-box.lg { height: 280px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 6px; vertical-align: 0; }

.inbox-item { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item .ii-main { flex: 1; min-width: 0; }
.inbox-item .ii-title { font-weight: 500; font-size: 13px; }
.inbox-item .ii-meta { font-size: 12px; color: var(--muted); }
.inbox-item .ii-acts { display: flex; gap: 4px; flex: none; }
.kind-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--hover); color: var(--ink-2); }
.kind-ic.indigo { background: var(--indigo-50); color: var(--indigo-700); }
.kind-ic.emerald { background: var(--emerald-50); color: var(--emerald-700); }
.kind-ic.amber { background: var(--amber-50); color: var(--amber-700); }
.kind-ic.rose { background: var(--rose-50); color: var(--rose-700); }
.kind-ic.sky { background: var(--sky-50); color: var(--sky-700); }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qa-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; text-align: start; color: var(--ink); }
.qa-btn:hover { border-color: var(--line-2); background: var(--hover); }
.qa-btn svg.ic { color: var(--indigo-600); }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--hover); color: var(--ink-2); line-height: 1; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.no-dot::before { display: none; }
.pill.t-indigo { background: var(--indigo-50); color: var(--indigo-700); }
.pill.t-emerald { background: var(--emerald-50); color: var(--emerald-700); }
.pill.t-amber { background: var(--amber-50); color: var(--amber-700); }
.pill.t-rose { background: var(--rose-50); color: var(--rose-700); }
.pill.t-sky { background: var(--sky-50); color: var(--sky-700); }
.pill.t-violet { background: var(--violet-50); color: var(--violet-700); }
.pill.t-grey { background: var(--grey-tint); color: var(--ink-3); }
.pill.t-dark { background: var(--inverse-bg); color: var(--inverse-fg); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 11.5px; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.sim-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--violet-700); background: var(--violet-50); border: 1px dashed var(--violet-100); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

/* ---------- Inputs ---------- */
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink);
  transition: border-color var(--dur), box-shadow var(--dur); font-size: 13.5px;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select.input { padding-inline-end: 30px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235F6B7D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
html[dir="rtl"] select.input { background-position: left 9px center; }
.input:hover { border-color: var(--ink-4); }
.input:focus { outline: none; border-color: var(--indigo); box-shadow: var(--focus); }
.input.invalid { border-color: var(--rose-700); }
.input.invalid:focus { box-shadow: 0 0 0 3px rgba(190, 18, 60, .18); }
.input[disabled], .input[readonly] { background: var(--surface-dis); color: var(--ink-3); }
.input.sm { height: 30px; font-size: 13px; border-radius: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .flabel { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.field .req { color: var(--rose-700); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--rose-700); display: flex; align-items: center; gap: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { font-size: 14px; margin-bottom: 4px; }
.form-section > .desc { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.input-icon { position: relative; }
.input-icon > svg.ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon > .input { padding-inline-start: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--indigo-600); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 32px; height: 18px; border-radius: 99px; background: var(--line-2); position: relative; transition: background var(--dur); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform var(--dur) var(--ease); }
.switch input:checked + .track { background: var(--primary-bg); }
.switch input:checked + .track::after { transform: translateX(14px); }
html[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.radio-card { position: relative; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:hover { border-color: var(--ink-4); }
.radio-card.on { border-color: var(--indigo); background: var(--indigo-50); box-shadow: 0 0 0 1px var(--indigo); }
.radio-card:focus-within { box-shadow: var(--focus); }
.radio-card .rc-t { font-weight: 600; font-size: 13px; }
.radio-card .rc-d { font-size: 12px; color: var(--muted); }

/* Smart search */
.smart-search { position: relative; flex: 1 1 320px; min-width: 220px; max-width: 520px; }
.smart-search .input { padding-inline-start: 34px; padding-inline-end: 34px; }
.smart-search > svg.ic { position: absolute; inset-inline-start: 11px; top: 10px; color: var(--ink-3); }
.smart-search .clear { position: absolute; inset-inline-end: 4px; top: 4px; }
.token-hint { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.token-hint code { font-family: var(--mono); font-size: 11.5px; background: var(--hover); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--ink-2); cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px dashed var(--line-2); background: var(--surface);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-weight: 500;
}
.chip:hover { border-color: var(--ink-4); color: var(--ink); }
.chip.on { border-style: solid; border-color: var(--indigo-100); background: var(--indigo-50); color: var(--indigo-700); }
.chip .x { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-inline-end: -4px; }
.chip .x:hover { background: rgba(67, 56, 202, .12); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap.flush { border: 0; border-radius: 0; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: start; font-weight: 500; color: var(--ink-3); font-size: 12px;
  padding: 0 12px; height: 38px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .sort-ic { opacity: .35; margin-inline-start: 2px; }
.tbl th.sorted .sort-ic { opacity: 1; color: var(--indigo-600); }
.tbl td { padding: 0 12px; height: 46px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl tbody tr.selected { background: var(--indigo-50); }
.tbl tbody tr.row-click { cursor: pointer; }
.tbl tbody tr.row-click:focus-visible { box-shadow: inset 0 0 0 2px var(--indigo); border-radius: 0; }
.tbl tbody tr.dim td { color: var(--ink-3); }
.tbl td.cb, .tbl th.cb { width: 40px; padding-inline-end: 0; }
.tbl .cell-main { font-weight: 500; color: var(--ink); }
.tbl .cell-sub { font-size: 12px; color: var(--muted); }
.tbl td.actions-cell { text-align: end; white-space: nowrap; width: 1%; }
.tbl.compact td { height: 38px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager .row { gap: 6px; }
.pager select.input { width: auto; height: 28px; font-size: 12.5px; padding-inline-start: 8px; }
.bulkbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: 11px; background: var(--float-dark); color: #fff; margin-bottom: 12px; flex-wrap: wrap;
  animation: rise .18s var(--ease);
}
.bulkbar .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.bulkbar .btn:hover { background: rgba(255, 255, 255, .16); }
.bulkbar .count { font-weight: 600; margin-inline-end: 6px; }

/* Empty / skeleton */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .e-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--hover); color: var(--ink-3); margin-bottom: 4px; }
.empty .e-t { color: var(--ink); font-weight: 600; font-size: 14px; }
.empty.sm { padding: 24px 12px; }
.skel { background: linear-gradient(90deg, var(--skel-a) 0%, var(--skel-b) 40%, var(--skel-a) 80%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; border-radius: 8px; }
.skel-page .skel { margin-bottom: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.view > .page-enter { animation: rise .22s var(--ease); }

/* ---------- Kanban board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.bcol { background: var(--surface-3); border-radius: 12px; padding: 8px; min-height: 140px; border: 1px solid transparent; transition: background var(--dur), border-color var(--dur); }
.bcol.drop-ok { background: var(--indigo-50); border-color: var(--indigo-100); border-style: dashed; }
.bcol.drop-no { background: var(--rose-50); }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.bcol-head .n { font-weight: 500; color: var(--ink-3); background: var(--surface); border-radius: 99px; padding: 0 7px; font-size: 11.5px; border: 1px solid var(--line); }
.bcol-list { display: flex; flex-direction: column; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; position: relative; transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur); }
.kcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.kcard.dragging { opacity: .5; }
.kcard .k-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kcard .k-title { font-weight: 600; font-size: 13px; margin: 6px 0 4px; }
.kcard .k-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kcard .k-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.bcol .more { font-size: 12px; color: var(--muted); text-align: center; padding: 6px; }

/* Falcon cards */
.fcard { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.fcard .f-top { display: flex; gap: 12px; align-items: center; }
.falcon-ava { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; overflow: hidden; }
.falcon-ava svg { width: 100%; height: 100%; }
.falcon-ava.sm { width: 30px; height: 30px; border-radius: 8px; }
.falcon-ava.lg { width: 64px; height: 64px; border-radius: 16px; }
.fcard .f-name { font-weight: 600; font-size: 14px; }
.fcard .f-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12px; }
.fcard .f-meta dt { color: var(--muted); }
.fcard .f-meta dd { margin: 0; color: var(--ink); font-weight: 500; }
.fname-cell { display: flex; gap: 10px; align-items: center; }

/* ---------- Detail / profile ---------- */
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: start; margin-bottom: 18px; }
.profile-head h1 { font-size: 26px; letter-spacing: -0.03em; }
.profile-head .ar-name { font-size: 18px; color: var(--ink-2); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.facts span { display: inline-flex; gap: 6px; align-items: center; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 720px; }
.photo-ph { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-3); position: relative; aspect-ratio: 4 / 3; }
.photo-ph svg { width: 100%; height: 100%; display: block; }
.photo-ph .cap { position: absolute; inset-inline-start: 8px; bottom: 8px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, .9); padding: 2px 7px; border-radius: 6px; color: var(--ink-2); }
.photo-ph.missing svg.ic { width: 22px; height: 22px; }
.photo-ph.missing { flex-direction: column; gap: 6px; border-style: dashed; cursor: pointer; width: 100%; font: inherit; background: repeating-linear-gradient(45deg, #FAFBFC, #FAFBFC 8px, var(--surface-3) 8px, var(--surface-3) 16px); display: grid; place-items: center; color: var(--ink-3); font-size: 12px; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.inline-edit { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 0 4px; margin-inline-start: -4px; cursor: text; border: 1px dashed transparent; }
.inline-edit:hover { border-color: var(--line-2); background: var(--hover); }
.inline-edit .pen { opacity: 0; color: var(--ink-3); }
.inline-edit:hover .pen { opacity: 1; }
.disclosure { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 12px; }
.disclosure > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .chev { margin-inline-start: auto; transition: transform var(--dur); color: var(--ink-3); }
.disclosure[open] > summary .chev { transform: rotate(180deg); }
.disclosure > .d-body { padding: 0 18px 18px; }
.lineage { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.lin-node { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.lin-node .k { font-size: 11.5px; color: var(--muted); }

/* Timeline */
.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; inset-inline-start: -22px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.tl-dot.indigo { border-color: var(--indigo); }
.tl-dot.emerald { border-color: var(--emerald); background: var(--emerald-50); }
.tl-dot.rose { border-color: var(--rose); }
.tl-dot.amber { border-color: var(--amber); }
.tl-dot.sky { border-color: #38BDF8; }
.tl-dot.violet { border-color: #8B5CF6; }
.tl-title { font-weight: 500; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-body { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.tl-day { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin: 6px 0 10px -22px; }

/* Stepper (horizontal status) */
.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 0; }
.st { flex: 1 1 0; min-width: 96px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: 6px; font-size: 12px; color: var(--muted); }
.st::before { content: ""; position: absolute; top: 11px; inset-inline-start: -50%; width: 100%; height: 2px; background: var(--line-2); z-index: 0; }
.st:first-child::before { display: none; }
.st .b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-2); z-index: 1; font-size: 11px; font-weight: 600; }
.st.done { color: var(--ink-2); }
.st.done .b { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.st.done::before, .st.cur::before { background: var(--emerald); }
.st.cur { color: var(--indigo-700); font-weight: 600; }
.st.cur .b { border-color: var(--indigo); background: var(--indigo-50); color: var(--indigo-700); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.st.bad .b { border-color: var(--rose-700); background: var(--rose-50); color: var(--rose-700); }
.st.bad { color: var(--rose-700); }

/* Vertical progress list (forms) */
.form-layout { display: grid; grid-template-columns: 240px minmax(0, 680px); gap: 40px; align-items: start; }
.vsteps { position: sticky; top: calc(var(--topbar-h) + 24px); list-style: none; margin: 0; padding: 0; }
.vsteps li { position: relative; padding-inline-start: 36px; padding-bottom: 22px; }
.vsteps li:last-child { padding-bottom: 0; }
.vsteps li::before { content: ""; position: absolute; inset-inline-start: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--line); border-radius: 2px; }
.vsteps li:last-child::before { display: none; }
.vsteps li.done::before { background: var(--emerald); }
.vsteps button { background: none; border: 0; padding: 0; text-align: start; cursor: pointer; display: block; width: 100%; }
.vsteps .vb { position: absolute; inset-inline-start: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.vsteps li.cur .vb { border-color: var(--indigo); color: var(--indigo-700); background: var(--indigo-50); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.vsteps li.done .vb { border-color: var(--emerald); background: var(--emerald); color: #fff; }
.vsteps li.has-err .vb { border-color: var(--rose-700); color: var(--rose-700); background: var(--rose-50); }
.vsteps .vt { font-weight: 600; font-size: 13.5px; color: var(--ink); line-height: 24px; }
.vsteps li:not(.cur):not(.done) .vt { color: var(--ink-2); font-weight: 500; }
.vsteps .vd { font-size: 12px; color: var(--muted); }
.form-card { padding: 26px 28px; }
.form-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Picker list (multi-falcon) */
.picker { border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.picker.invalid { border-color: var(--rose-700); }
.picker-head { padding: 8px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.picker-list { max-height: 260px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
.picker-item:hover { background: var(--hover); }
.picker-item.on { background: var(--indigo-50); }
.picker-item input { accent-color: var(--indigo-600); }
.picker-sel { padding: 8px; display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); background: var(--surface-2); min-height: 42px; align-items: center; }
.sel-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 99px; padding: 2px 4px 2px 9px; font-size: 12px; }
.sel-chip button { border: 0; background: none; cursor: pointer; padding: 0; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-3); }
.sel-chip button:hover { background: var(--hover); color: var(--ink); }

/* ---------- Floating layers ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.modal-scrim { z-index: 65 !important; animation: fadein .15s; }
.modal {
  position: fixed; z-index: 66; left: 50%; top: 10vh; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); max-height: 80vh;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-float); display: flex; flex-direction: column; animation: pop .18s var(--ease);
  border: 1px solid var(--line);
}
.modal.lg { width: min(760px, calc(100vw - 32px)); }
.modal.sm { width: min(440px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px) scale(.985); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15.5px; flex: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.slideover {
  position: fixed; z-index: 61; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100vw); background: var(--surface);
  box-shadow: var(--shadow-float); display: flex; flex-direction: column; border-inline-start: 1px solid var(--line);
  transform: translateX(0); transition: transform .24s var(--ease);
}
.slideover.wide { width: min(640px, 100vw); }
.slideover.enter { transform: translateX(100%); }
html[dir="rtl"] .slideover.enter { transform: translateX(-100%); }
.so-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 22px; border-bottom: 1px solid var(--line); }
.so-head .so-title { flex: 1; min-width: 0; }
.so-head h2 { font-size: 16px; }
.so-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.so-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; justify-content: flex-end; }
.so-section { padding: 16px 0; border-top: 1px solid var(--line); }
.so-section:first-child { border-top: 0; padding-top: 0; }
.so-section > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 10px; }

.popover {
  position: fixed; z-index: 70; min-width: 220px; max-width: min(380px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-float); padding: 6px; animation: rise .14s var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  text-align: start; font-size: 13px; color: var(--ink); text-decoration: none !important;
}
.menu-item:hover, .menu-item:focus-visible, .menu-item.kb { background: var(--hover); box-shadow: none; }
.menu-item svg.ic { color: var(--ink-3); }
.menu-item .mi-sub { font-size: 12px; color: var(--muted); }
.menu-item .mi-r { margin-inline-start: auto; }
.menu-item.on { background: var(--indigo-50); }
.menu-item.on svg.ic { color: var(--indigo-600); }
.menu-item.danger { color: var(--rose-700); }
.menu-item.danger svg.ic { color: var(--rose-700); }
.menu-item[disabled] { opacity: .5; cursor: not-allowed; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 8px 10px 4px; font-weight: 600; }

.notif-panel { width: 380px; padding: 0; }
.notif-panel .np-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; text-align: start; background: none; border-inline: 0; border-top: 0; width: 100%; }
.notif:hover { background: var(--hover); }
.notif.unread { background: var(--unread); }
.notif.unread::after { content: ""; position: absolute; top: 16px; inset-inline-end: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); }
.notif .n-t { font-weight: 500; font-size: 13px; padding-inline-end: 14px; }
.notif .n-b { font-size: 12.5px; color: var(--ink-2); }
.notif .n-m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Command palette */
.palette {
  position: fixed; z-index: 80; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--surface);
  border-radius: 14px; box-shadow: var(--shadow-float); border: 1px solid var(--line); overflow: hidden; animation: pop .16s var(--ease);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input input { flex: 1; height: 54px; border: 0; outline: none; font-size: 15.5px; background: none; }
.palette-input input:focus { box-shadow: none; }
.palette-list { max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.pal-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 10px 10px 4px; font-weight: 600; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.pal-item .pi-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex: none; }
.pal-item .pi-sub { font-size: 12px; color: var(--muted); }
.pal-item .pi-r { margin-inline-start: auto; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pal-item.kb { background: var(--indigo-50); }
.pal-item.kb .pi-ic { background: var(--surface); color: var(--indigo-700); }
.pal-item mark { background: none; color: var(--indigo-700); font-weight: 600; }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface-2); flex-wrap: wrap; }

/* Toasts */
.toasts { position: fixed; z-index: 95; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100vw - 24px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 11px; background: var(--float-dark); color: #fff;
  box-shadow: var(--shadow-float); font-size: 13px; animation: rise .2s var(--ease); max-width: 100%;
}
.toast .t-ic { flex: none; }
.toast.success .t-ic { color: #6EE7B7; }
.toast.error .t-ic { color: #FDA4AF; }
.toast.info .t-ic { color: #A5B4FC; }
.toast.warn .t-ic { color: #FCD34D; }
.toast .t-msg { flex: 1; min-width: 0; }
.toast button { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 7px; height: 26px; padding: 0 10px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.toast button:hover { background: rgba(255, 255, 255, .2); }
.toast button.t-x { width: 26px; padding: 0; display: grid; place-items: center; background: none; }
.toast.out { animation: fadeout .2s forwards; }
@keyframes fadeout { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Misc view parts ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini-stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.mini-stat .k { font-size: 12px; color: var(--muted); }
.mini-stat .v { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--indigo); transition: width .4s var(--ease); }
.bar.emerald > i { background: var(--emerald); }
.bar.amber > i { background: var(--amber); }
.bar.rose > i { background: var(--rose); }
.loc-col .lc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.loc-col .lc-n { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.falcon-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--ink); text-decoration: none !important; }
.falcon-chip:hover { border-color: var(--indigo-100); background: var(--indigo-50); }
.falcon-chip .g { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.g-f { background: var(--pink-50); color: var(--pink-700); }
.g-m { background: var(--sky-50); color: var(--sky-700); }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.inc-card .cap-bar { display: grid; grid-template-columns: repeat(var(--cap), 1fr); gap: 3px; margin: 10px 0 6px; }
.inc-card .cap-bar i { height: 14px; border-radius: 4px; background: var(--hover); border: 1px solid var(--line); }
.inc-card .cap-bar i.on { background: var(--indigo); border-color: var(--indigo); }
.inc-card .cap-bar i.near { background: var(--emerald); border-color: var(--emerald); }
.gauge-row { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.gauge-row b { font-size: 16px; color: var(--ink); font-weight: 600; }
.egg-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.cal-h { padding: 8px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-d { min-height: 104px; padding: 6px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .dn { color: var(--ink-4); }
.cal-d .dn { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; }
.cal-d.today .dn { background: var(--primary-bg); color: #fff; }
.cal-ev { display: block; width: 100%; text-align: start; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; border: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--indigo-50); color: var(--indigo-700); }
.cal-ev.Completed { background: var(--emerald-50); color: var(--emerald-700); }
.cal-ev.Overdue { background: var(--rose-50); color: var(--rose-700); }
.cal-ev.Cancelled { background: var(--grey-tint); color: var(--ink-3); text-decoration: line-through; }
.cal.week .cal-d { min-height: 240px; }

/* Permission matrix */
.perm td.pc { text-align: center; font-family: var(--mono); font-size: 12px; }
.perm td.pc.none { color: var(--ink-4); }
.perm td.pc.has { color: var(--indigo-700); font-weight: 600; }
.list-editor { display: flex; flex-wrap: wrap; gap: 6px; }
.le-item { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: 8px; padding: 3px 3px 3px 9px; background: var(--surface); font-size: 12.5px; }
.le-item button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); }
.le-item button:hover { background: var(--hover); color: var(--ink); }

.report-card { padding: 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.report-card .rc-t { font-weight: 600; }
.report-card .rc-d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--indigo-50); color: var(--indigo-700); font-size: 13px; align-items: flex-start; }
.callout.amber { background: var(--amber-50); color: var(--amber-700); }
.callout.rose { background: var(--rose-50); color: var(--rose-700); }
.callout.emerald { background: var(--emerald-50); color: var(--emerald-700); }
.callout.grey { background: var(--hover); color: var(--ink-2); }
.file-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.file-row .fr-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--hover); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.drop-zone { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; background: var(--surface-2); width: 100%; }
.drop-zone:hover { border-color: var(--indigo); color: var(--indigo-700); background: var(--indigo-50); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 34px; gap: 8px; align-items: start; margin-bottom: 8px; }
.notfound { max-width: 440px; margin: 10vh auto; text-align: center; }
.notfound .big { font-size: 64px; font-weight: 700; letter-spacing: -0.05em; color: var(--indigo-100); line-height: 1; }
.gate { max-width: 460px; margin: 8vh auto; text-align: center; }
.erp-head { display: flex; gap: 8px; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr) 320px; }
  .search-trigger { min-width: 180px; }
}
@media (max-width: 1100px) {
  .view { padding: 22px 22px 56px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-l { grid-template-columns: minmax(0, 1fr); }
  .form-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-trigger { min-width: 0; }
  .search-trigger .st-label { display: none; }
  .ctx-select .ctx-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 860px) {
  .main-col, body.rail-pinned .main-col { margin-inline-start: 0; }
  .rail { transform: translateX(-100%); width: var(--rail-w-open); transition: transform .22s var(--ease); box-shadow: none; }
  html[dir="rtl"] .rail { transform: translateX(100%); }
  .rail .rail-label, .rail .brand-text { opacity: 1; pointer-events: auto; }
  .rail .rail-group-label { height: 18px; opacity: 1; }
  .rail .dot-badge { display: none; }
  body.drawer-open .rail, html[dir="rtl"] body.drawer-open .rail { transform: none; box-shadow: var(--shadow-float); }
  .rail .pin-btn { display: none; }
  .topbar { padding: 0 14px; gap: 6px; }
  .topbar .menu-btn { display: inline-grid; }
  .avatar-btn .role-code { display: none; }
  .avatar-btn { padding: 3px; }
  .view { padding: 18px 16px 48px; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .vsteps { position: static; display: flex; gap: 6px; overflow-x: auto; }
  .vsteps li { padding: 0 0 0 30px; flex: 1 0 auto; }
  html[dir="rtl"] .vsteps li { padding: 0 30px 0 0; }
  .vsteps li::before { display: none; }
  .vsteps .vd { display: none; }
  .profile-head { grid-template-columns: auto minmax(0, 1fr); }
  .profile-head .ph-actions { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .widgets { columns: 2 300px; }
  .crumbs .crumb-mid { display: none; }
  .ctx-select .ctx-label { display: none; }
  .modal { top: 6vh; max-height: 88vh; }
  .notif-panel { width: min(380px, calc(100vw - 16px)); }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .photos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .widgets { columns: 1; }
  .qa-grid { grid-template-columns: 1fr; }
}

/* ---------- RTL tweaks ---------- */
html[dir="rtl"] .chev-flip, html[dir="rtl"] .crumbs .sep svg { transform: scaleX(-1); }
html[dir="rtl"] .num-ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .hover-lift:hover, .kcard:hover { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .rail, .topbar, .toasts, #overlay-root, .no-print, .module-tabs, .pager, .bulkbar { display: none !important; }
  .main-col, body.rail-pinned .main-col { margin: 0 !important; }
  .view { padding: 0; max-width: none; }
  .card, .table-wrap { border-color: #ccc; break-inside: avoid; }
  .tbl th { position: static; background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl td { height: auto; padding: 5px 8px; }
  .print-only { display: block !important; }
  a { color: inherit; }
}
.print-only { display: none; }
.tbl td .mono, .tbl td.num { white-space: nowrap; }
.main-col { overflow-x: clip; }
.tbl-host { max-width: 100%; min-width: 0; }

/* ==========================================================================
   Design refinement v2: type, shell, photography, sign-in, workspace,
   registry filter bar, profile hero, lightbox, kanban, charts, dark mode
   ========================================================================== */

/* ---------- Typography & numerics ---------- */
h1, h2, h3 { text-wrap: balance; }
.page-head h1 { font-size: var(--fs-xl); letter-spacing: -0.025em; }
.page-head .sub { max-width: 72ch; text-wrap: pretty; }
.tbl td.num, .tbl th.num { text-align: end; font-variant-numeric: tabular-nums; }
.tbl th.num .sort-ic { margin-inline-start: 2px; }
.tbl td { font-variant-numeric: tabular-nums; }
.kv dd, .dl dd, .mini-stat .v, .lc-n, .fi-n, .t-val { font-variant-numeric: tabular-nums; }
body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.modal-body, .so-body, .palette-list, .notif-list, .popover { overscroll-behavior: contain; }
select.input { background-color: var(--surface); color: var(--ink); }
html[data-theme="dark"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239AA4B4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
:focus-visible { box-shadow: var(--focus); }
.input::placeholder { color: var(--ink-3); opacity: .85; }

/* ---------- Brand ---------- */
.brand-mark { --brand-bg: var(--charcoal); --logo-cut: var(--brand-bg); background: var(--brand-bg); border-radius: 10px; }
html[data-theme="dark"] .brand-mark { --brand-bg: #232B3B; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.brand-mark svg { width: 28px; height: 28px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark.lg svg { width: 34px; height: 34px; }

/* ---------- Avatars ---------- */
.avatar { background: var(--avatar-bg, var(--charcoal)); }
html[data-theme="dark"] .avatar { --avatar-bg: #3A4458; }
.avatar.user { background: linear-gradient(135deg, #6366F1 0%, #4338CA 100%); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-btn { padding: 2px; border: 1px solid transparent; background: none; border-radius: 50%; }
html[dir="rtl"] .avatar-btn { padding: 2px; }
.avatar-btn:hover { border-color: var(--line-2); background: var(--hover); }
.avatar-btn .avatar { width: 30px; height: 30px; font-size: 11.5px; }

/* Language: labelled two-option segmented control */
.lang-seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line); flex: none; }
.lang-seg button { height: 26px; min-width: 38px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--ink-3); font-size: 12px; font-weight: 600; cursor: pointer; }
.lang-seg button[lang="ar"] { font-family: var(--font-ar), var(--font); font-weight: 600; }
.lang-seg button:hover { color: var(--ink); }
.lang-seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }

/* Account menu */
.acct-menu { width: 300px; padding: 6px; }
.acct-card { display: flex; gap: 12px; align-items: center; padding: 10px; }
.theme-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; margin: 0 6px 6px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.theme-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.theme-seg button[lang="ar"] { font-family: var(--font-ar), var(--font); }
.theme-seg button:hover { color: var(--ink); }
.theme-seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.demo-sec > summary { list-style: none; }
.demo-sec > summary::-webkit-details-marker { display: none; }
.demo-sec > summary .chev { transition: transform var(--dur) var(--ease); color: var(--ink-3); }
.demo-sec[open] > summary .chev { transform: rotate(180deg); }
.demo-roles { max-height: 240px; overflow-y: auto; padding: 2px 0 4px; }
.demo-roles .menu-item { padding: 6px 10px; }

/* ---------- Photography ---------- */
.falcon-ava { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.falcon-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.falcon-ava::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .08); pointer-events: none; }
html[data-theme="dark"] .falcon-ava::after { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.falcon-ava.xs { width: 20px; height: 20px; border-radius: 50%; }
.falcon-ava.sm { width: 30px; height: 30px; border-radius: 8px; }
.falcon-ava.lg { width: 64px; height: 64px; border-radius: 14px; }
.falcon-ava.xl { width: 96px; height: 96px; border-radius: 16px; }
.falcon-ava.inactive img { filter: grayscale(1) contrast(.9); opacity: .7; }
.falcon-chip .falcon-ava { margin-inline-end: 0; }
.falcon-chip { padding: 2px 10px 2px 2px; gap: 7px; }
html[dir="rtl"] .falcon-chip { padding: 2px 2px 2px 10px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 15, .92); display: grid; grid-template-rows: auto 1fr auto; color: #fff; animation: fadein .18s var(--ease); }
.lightbox.out { opacity: 0; transition: opacity .12s; }
.lb-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 24px; }
.lb-title { flex: 1; min-width: 0; font-size: 14px; color: rgba(255,255,255,.72); }
.lb-title b { color: #fff; font-weight: 600; margin-inline-end: 6px; }
.lb-count { font-size: 12.5px; color: rgba(255,255,255,.72); }
.lb-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.14); }
.lb-stage { margin: 0; display: grid; place-items: center; min-height: 0; padding: 0 72px; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 190px); border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); animation: rise .2s var(--ease); object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; }
.lb-nav.prev { inset-inline-start: 16px; }
.lb-nav.next { inset-inline-end: 16px; }
.lb-thumbs { display: flex; justify-content: center; gap: 8px; padding: 14px 16px 20px; }
.lb-th { padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: none; cursor: pointer; opacity: .6; }
.lb-th img { display: block; width: 56px; height: 42px; object-fit: cover; }
.lb-th.on, .lb-th:hover { opacity: 1; border-color: #fff; }

/* Photo credits */
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.credits li { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; border: 1px solid var(--line); }
.credits img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }

/* ---------- Sign-in ---------- */
body.auth .rail, body.auth .topbar, body.auth .rail-scrim { display: none !important; }
body.auth .main-col { margin: 0 !important; }
body.auth .view { padding: 0; max-width: none; }
.login { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); min-height: 100dvh; background: var(--bg); }
.login-hero { position: relative; overflow: hidden; background: #0B0F17; }
.login-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.login-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,18,26,.15) 0%, rgba(14,18,26,.35) 45%, rgba(14,18,26,.92) 100%), linear-gradient(90deg, rgba(14,18,26,.35), transparent 60%); }
.login-hero-copy { position: absolute; inset-inline: 48px; bottom: 48px; color: #fff; max-width: 520px; }
.login-hero-copy .lh-brand { font-weight: 600; letter-spacing: -0.01em; font-size: 16px; }
.login-hero-copy h2 { font-size: var(--fs-2xl); line-height: 1.15; letter-spacing: -0.03em; margin-top: 28px; font-weight: 600; }
.login-hero-copy p { color: rgba(255,255,255,.8); margin-top: 12px; font-size: 15px; max-width: 44ch; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(420px, 100%); }
.login-card h1 { font-size: var(--fs-xl); letter-spacing: -0.025em; }
.login-card > p { margin-top: 6px; }
.login-mobile-brand { display: none; margin-bottom: 28px; }
.btn-sso { width: 100%; height: 44px; margin-top: 24px; gap: 10px; font-size: 14px; background: var(--inverse-bg); border-color: var(--inverse-bg); color: var(--inverse-fg); border-radius: 10px; }
.btn-sso:hover { background: var(--inverse-bg-hover); border-color: var(--inverse-bg-hover); }
.btn-sso.loading { cursor: progress; opacity: .85; }
.btn-sso.loading .ms-logo { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ms-logo { display: grid; grid-template-columns: 8px 8px; gap: 2px; }
.ms-logo i { width: 8px; height: 8px; display: block; }
.ms-logo i:nth-child(1) { background: #F25022; } .ms-logo i:nth-child(2) { background: #7FBA00; } .ms-logo i:nth-child(3) { background: #00A4EF; } .ms-logo i:nth-child(4) { background: #FFB900; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 24px 0 12px; color: var(--ink-3); font-size: 12.5px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.persona { display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: start; cursor: pointer; transition: border-color var(--dur), background-color var(--dur), transform var(--dur) var(--ease); }
.persona:hover { border-color: var(--line-2); background: var(--hover); }
.persona:active { transform: scale(.985); }
.persona .p-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.persona .p-role { display: block; font-size: 12px; color: var(--ink-3); }
.login-foot { margin-top: 20px; display: flex; gap: 6px; align-items: center; }
@media (max-width: 960px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-hero { min-height: 220px; }
  .login-hero-copy { inset-inline: 24px; bottom: 24px; }
  .login-hero-copy h2 { font-size: 22px; margin-top: 16px; }
  .login-hero-copy p { display: none; }
}

/* ---------- Top bar ---------- */
.topbar { gap: 8px; }
.search-trigger { height: 32px; border-radius: 8px; background: var(--surface); }
.ctx-select { height: 32px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.btn-dark.btn-sm { height: 30px; }

/* ---------- Workspace (home) ---------- */
.ws-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 34%); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; margin-bottom: 28px; box-shadow: var(--shadow-xs); }
.ws-hero-main { padding: 24px 28px 22px; min-width: 0; display: flex; flex-direction: column; }
.ws-date { font-size: 13px; color: var(--ink-3); }
.ws-hero h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; margin-top: 4px; line-height: 1.15; }
.ws-summary { color: var(--ink-2); margin-top: 6px; font-size: 14.5px; text-wrap: pretty; }
.ws-summary b { color: var(--ink); font-weight: 600; }
.ws-hero-photo { position: relative; margin: 0; min-height: 220px; background: var(--surface-3); }
.ws-hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.ws-hero-photo::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, var(--surface) 0%, rgba(255,255,255,0) 28%); pointer-events: none; }
html[data-theme="dark"] .ws-hero-photo::before { background: linear-gradient(90deg, var(--surface) 0%, rgba(22,27,38,0) 30%); }
html[data-theme="dark"] .ws-hero-photo img { filter: brightness(.86) saturate(.95); }
html[dir="rtl"] .ws-hero-photo::before { transform: scaleX(-1); }
.ws-hero-photo figcaption { position: absolute; z-index: 2; inset-inline-end: 12px; bottom: 10px; font-size: 11px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.today-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: auto; padding-top: 22px; }
.today-strip .focus-item { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; border: 0; border-radius: 12px; background: none; position: relative; min-height: 124px; }
.today-strip .focus-item + .focus-item::before { content: ""; position: absolute; inset-inline-start: 0; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.today-strip .focus-item:hover { background: var(--hover); transform: none; box-shadow: none; }
.today-strip .focus-item:hover::before, .today-strip .focus-item:hover + .focus-item::before { opacity: 0; }
.today-strip .fi-ic { width: 32px; height: 32px; border-radius: 9px; }
.today-strip .fi-n { font-size: 30px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.today-strip .fi-l { font-size: 13px; color: var(--ink-2); margin-top: 6px; line-height: 1.35; }
.today-strip .fi-go { position: absolute; top: 16px; inset-inline-end: 14px; opacity: 0; transition: opacity var(--dur); }
.today-strip .focus-item:hover .fi-go, .today-strip .focus-item:focus-visible .fi-go { opacity: 1; }
.today-strip .focus-item.lead .fi-ic { background: var(--primary-bg); color: #fff; }
.today-strip .focus-item.done .fi-n { color: var(--ink-3); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.sec-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.sec-head h2 .pill { font-weight: 500; }
.tiles { gap: 12px; margin-bottom: 28px; }
.tile { padding: 14px 16px 12px; border-radius: 12px; box-shadow: var(--shadow-xs); }
.tile .t-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.tile .t-label svg.ic { color: var(--ink-4); }
.tile .t-val { font-size: 28px; margin-top: 6px; letter-spacing: -0.035em; }
.tile .t-foot { align-items: center; margin-top: 4px; }
.tile .t-note { font-size: 12px; line-height: 1.35; }
.tile .spark { color: var(--chart-1); flex: none; opacity: .9; }
.tile:hover .spark { opacity: 1; }
.widget .card-head { padding: 0 8px 0 16px; height: 46px; }
.widget .card-head h2 { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.widget .card-head .muted svg.ic { color: var(--ink-4); width: 15px; height: 15px; }
.widget .w-body { padding: 14px 16px 16px; }
.widget .w-body.flush { padding: 0; }
.widgets { column-gap: 16px; }
.inbox-item { padding: 10px 16px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank a { display: grid; grid-template-columns: minmax(0, 132px) minmax(0, 1fr) 36px; align-items: center; gap: 12px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none !important; font-size: 13px; }
.rank a:hover { background: var(--hover); }
.rank .rk-bar { height: 8px; border-radius: 4px; background: none; position: relative; }
.rank .rk-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-1); min-width: 3px; }
html[dir="rtl"] .rank .rk-bar i { border-radius: 4px 0 0 4px; }
.rank b { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { gap: 16px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }

/* Charts: HTML tooltip */
.chart-box { position: relative; }
.chart-tip { position: absolute; top: 0; left: 0; z-index: 3; pointer-events: none; min-width: 140px; max-width: 240px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-float); font-size: 12px; color: var(--ink); opacity: 0; transition: opacity .12s, transform .08s linear; }
.chart-tip.on { opacity: 1; }
.chart-tip .ct-t { font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.chart-tip .ct-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.chart-tip .ct-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .ct-k { flex: 1; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-tip b { font-weight: 600; }

/* ---------- Registry filter bar (shadcn data-table faceted filters) ---------- */
.filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.filterbar .smart-search { flex: 1 1 280px; max-width: 360px; }
.filterbar .smart-search .input { height: 32px; font-size: 13px; }
.filterbar .smart-search > svg.ic { top: 8px; }
.filterbar .smart-search .clear { top: 2px; }
.facet { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px dashed var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--dur), border-color var(--dur), color var(--dur); }
.facet:hover { background: var(--hover); color: var(--ink); border-color: var(--ink-4); }
.facet .plus { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1.25px solid currentColor; opacity: .75; }
.facet .plus svg.ic { width: 10px; height: 10px; stroke-width: 2.5; }
.facet .fsep { width: 1px; height: 16px; background: var(--line-2); margin: 0 2px; }
.facet .fval { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--indigo-50); color: var(--indigo-700); font-size: 12px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.facet.on { border-style: solid; border-color: var(--line-2); color: var(--ink); }
.facet.ctx .fval { background: var(--sky-50); color: var(--sky-700); }
.filterbar .reset { height: 32px; }
.hints { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-bottom: 12px; min-height: 24px; }
.hints .tok { font-family: var(--mono); font-size: 11.5px; height: 22px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; }
.hints .tok:hover { border-color: var(--indigo-100); background: var(--indigo-50); color: var(--indigo-700); }
.hints .count { margin-inline-start: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hints .count b { color: var(--ink); font-weight: 600; }
.fname-cell { gap: 12px; }
.fname-cell .falcon-ava.sm { width: 34px; height: 34px; border-radius: 9px; }
.tbl td { height: 52px; }
.tbl th { height: 36px; font-size: 12px; letter-spacing: .01em; }

/* ---------- Profile hero ---------- */
.p-hero { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow-xs); }
.p-media { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border-inline-end: 1px solid var(--line); }
.p-photo { position: relative; display: block; padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-3); cursor: zoom-in; width: 100%; }
.p-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.p-photo:hover img { transform: scale(1.02); }
.p-photo .zoom { position: absolute; inset-inline-end: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(14,18,26,.55); color: #fff; opacity: 0; transition: opacity var(--dur); }
.p-photo:hover .zoom, .p-photo:focus-visible .zoom { opacity: 1; }
.p-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.p-th { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; text-align: start; color: var(--ink-2); font-size: 11.5px; font-weight: 500; min-width: 0; }
.p-th .ph { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); }
.p-th .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-th.on .ph { box-shadow: 0 0 0 2px var(--indigo); }
.p-th.missing .ph { display: grid; place-items: center; align-content: center; gap: 2px; border: 1px dashed var(--line-2); box-shadow: none; background: var(--surface); color: var(--ink-3); font-size: 11px; text-align: center; padding: 4px; }
.p-th.missing .ph svg.ic { width: 15px; height: 15px; }
.p-th.missing:not([disabled]):hover .ph { border-color: var(--indigo); color: var(--indigo-700); background: var(--indigo-50); }
.p-th[disabled] { cursor: default; }
.p-info { padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.p-top { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.p-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.p-meta i { font-style: italic; }
.p-name { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.p-name h1 { font-size: var(--fs-2xl); letter-spacing: -0.035em; line-height: 1.1; }
.p-name .ar { font-size: 22px; color: var(--ink-2); font-weight: 500; }
.p-status { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.p-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; margin-top: auto; }
.stat-chips > div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.stat-chips dt { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.stat-chips dt svg.ic { width: 13px; height: 13px; color: var(--ink-4); }
.stat-chips dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat-chips dd .mono { font-size: 12px; font-weight: 500; }
.p-tabs { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.disclosure > summary { padding: 14px 18px; font-size: 14px; }
.disclosure > summary svg.ic:first-child { color: var(--ink-3); }

/* Form photo slots (register / edit) */
.photo-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 132px)); gap: 10px; }
.photo-slot { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: start; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.photo-slot .ph { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; display: grid; place-items: center; align-content: center; gap: 2px; border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--ink-3); font-size: 11.5px; }
.photo-slot .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot.on .ph { border: 0; box-shadow: inset 0 0 0 1px var(--line); }
.photo-slot:hover .ph { border-color: var(--indigo); color: var(--indigo-700); }

/* ---------- Kanban ---------- */
.board-wrap { position: relative; }
.board-wrap::before, .board-wrap::after { content: ""; position: absolute; top: 0; bottom: 8px; width: 40px; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .2s; }
.board-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.board-wrap::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }
.board-wrap.fade-s:not(.rtl)::before, .board-wrap.fade-e:not(.rtl)::after { opacity: 1; }
.board-wrap.rtl.fade-s::after, .board-wrap.rtl.fade-e::before { opacity: 1; }
.board { scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; gap: 12px; }
.bcol { scroll-snap-align: start; background: var(--surface-3); border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.bcol-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.bcol-head svg.ic { display: none; }
.bcol-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--col-dot, var(--ink-4)); flex: none; }
.bcol-head .n { font-weight: 500; color: var(--ink-3); background: none; border: 0; padding: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bcol[data-col="Submitted"], .bcol[data-col="L1"], .bcol[data-col="Collected"] { --col-dot: var(--indigo); }
.bcol[data-col="In Progress"], .bcol[data-col="L2"], .bcol[data-col="Incubating"] { --col-dot: #38BDF8; }
.bcol[data-col="Completed"], .bcol[data-col="Approved"], .bcol[data-col="Fulfilled"], .bcol[data-col="Hatched"], .bcol[data-col="Fertile"] { --col-dot: var(--emerald); }
.bcol[data-col="Rejected"], .bcol[data-col="Failed"] { --col-dot: var(--rose); }
.bcol[data-col="Draft"], .bcol[data-col="Infertile"] { --col-dot: var(--ink-4); }
.bcol[data-col="Sent"], .bcol[data-col="ERP"], .bcol[data-col="Sent to ERP"] { --col-dot: #8B5CF6; }
.bcol-list { gap: 6px; min-height: 48px; }
.kcard { padding: 10px 12px 10px; border-radius: 10px; box-shadow: var(--shadow-xs); }
.kcard:hover { box-shadow: var(--shadow-lift); }
.kcard:focus-visible { box-shadow: var(--focus); }
.kcard:active { cursor: grabbing; }
.kcard .k-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kcard .k-title { font-weight: 600; font-size: 13.5px; margin: 0; line-height: 1.35; color: var(--ink); min-width: 0; }
.kcard .k-meta { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.kcard .k-meta b { font-weight: 600; color: var(--ink); }
.kcard .k-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.kcard .k-id { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.kcard .k-foot .icon-btn.sm { width: 26px; height: 26px; }
.kcard .k-pics { display: inline-flex; }
.kcard .k-pics .falcon-ava { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.kcard .k-pics .falcon-ava + .falcon-ava { margin-inline-start: -6px; }
.kcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.bcol.drop-ok { background: var(--indigo-50); border-color: var(--indigo); border-style: dashed; }
.bcol.drop-ok .bcol-list::after { content: "Release to move here"; display: grid; place-items: center; height: 52px; border-radius: 10px; border: 1.5px dashed var(--indigo); color: var(--indigo-700); font-size: 12.5px; font-weight: 500; background: var(--surface); }
.bcol.drop-no { background: var(--rose-50); border-color: var(--rose-100); }
.bcol.drop-no .bcol-list::after { content: "Not allowed for this request"; display: grid; place-items: center; height: 40px; color: var(--rose-700); font-size: 12px; }
.bcol .more { color: var(--ink-3); }
.bcol.loc-col > .card { border-radius: 10px; }
.bcol.loc-col::before { display: none; }

/* ---------- Misc dark-mode corrections ---------- */
html[data-theme="dark"] .notif.unread { background: var(--unread); }
html[data-theme="dark"] .tbl tbody tr.selected { background: var(--indigo-50); }
html[data-theme="dark"] .toast, html[data-theme="dark"] .bulkbar, html[data-theme="dark"] .rail-tip { border: 1px solid #364056; }
html[data-theme="dark"] .photo-ph .cap { background: rgba(22, 27, 38, .9); color: var(--ink); }
html[data-theme="dark"] .sim-badge { border-color: var(--violet-100); }
html[data-theme="dark"] .kbd { background: var(--surface-2); }
html[data-theme="dark"] .switch .track { background: var(--line-2); }
html[data-theme="dark"] .rail { background: var(--surface); }
html[data-theme="dark"] img { color-scheme: normal; }

@media (max-width: 1100px) {
  .ws-hero { grid-template-columns: minmax(0, 1fr); }
  .ws-hero-photo { display: none; }
  .p-hero { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .today-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-strip .focus-item:nth-child(3)::before { display: none; }
  .today-strip .focus-item { min-height: 108px; }
  .ws-hero-main { padding: 20px; }
  .ws-hero h1 { font-size: var(--fs-xl); }
  .p-hero { grid-template-columns: minmax(0, 1fr); }
  .p-media { border-inline-end: 0; border-bottom: 1px solid var(--line); flex-direction: row; }
  .p-photo { flex: 1 1 60%; }
  .p-thumbs { flex: 1 1 40%; grid-template-columns: minmax(0, 1fr); align-content: start; }
  .lang-seg button { min-width: 34px; padding: 0 6px; }
  .lb-stage { padding: 0 12px; }
  .lb-nav { top: auto; bottom: 84px; transform: none; }
}
@media (max-width: 560px) {
  .p-media { flex-direction: column; }
  .p-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .persona-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .p-photo:hover img { transform: none; }
  .btn-sso.loading .ms-logo { animation: none; }
}
.p-glance { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.p-glance li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink); min-width: 0; }
.p-glance li > svg.ic { margin-top: 2px; color: var(--ink-3); }
.p-glance .g-k { display: block; font-size: 12px; color: var(--ink-3); }
@media (max-width: 1100px) { .p-glance { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.p-info { justify-content: space-between; }
.stat-chips { margin-top: 0; }
.p-hero { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
.lightbox { background: rgba(8, 10, 15, .965); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* Mixed-direction strings (English copy inside the Arabic layout) keep their own reading order. */
html[dir="rtl"] .ws-summary, html[dir="rtl"] .t-note, html[dir="rtl"] .fi-l, html[dir="rtl"] .ii-meta, html[dir="rtl"] .ii-title, html[dir="rtl"] .k-meta { unicode-bidi: plaintext; text-align: right; }
@media (max-width: 860px) {
  .p-media { flex-direction: column; }
  .p-photo { flex: none; aspect-ratio: 16 / 9; }
  .p-photo img { object-position: 50% 30%; }
  .p-thumbs { flex: none; grid-template-columns: repeat(3, minmax(0, 120px)); }
}
/* Touch: primary actions reach 44 px, other controls 36 px on coarse pointers (tablet). */
@media (pointer: coarse) {
  .btn-primary, .btn-success, .btn-sso, .btn-dark { min-height: 44px; }
  .btn, .icon-btn, .facet, .lang-seg button, .seg a, .seg button { min-height: 36px; }
  .icon-btn { min-width: 36px; }
}
.kcard, .falcon-chip[draggable="true"] { -webkit-user-select: none; user-select: none; }
.toast.out { animation-duration: .14s; }
@media (prefers-reduced-motion: reduce) { .lightbox, .lb-stage img, .chart-tip { animation: none !important; transition: none !important; } }
.stat-chips { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
