/* ============================================================================
   Sight Solutions Group — HR Suite
   Design system. Same bones as the CRM (Inter, navy, teal) but pushed further:
   the real SSG brand gradient (#1FE39A → #12C7BD → #1AA6EA) is the signature
   accent, surfaces are layered rings rather than hard borders, and display type
   runs at weight 300 with tight tracking — the SSG brand's actual voice.
   ========================================================================== */

:root {
  --brand-1: #1FE39A;
  --brand-2: #12C7BD;
  --brand-3: #1AA6EA;
  --brand: linear-gradient(135deg, var(--brand-1), var(--brand-2) 52%, var(--brand-3));
  --brand-soft: linear-gradient(135deg, rgba(31,227,154,.14), rgba(26,166,234,.10));

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e6ecf4;
  --line-strong: #d5dfec;
  --ink: #0f1b2d;
  --ink-2: #475569;
  --ink-3: #8494a8;

  --shadow-sm: 0 1px 2px rgba(15,27,45,.05), 0 1px 3px rgba(15,27,45,.04);
  --shadow-md: 0 4px 14px rgba(15,27,45,.07), 0 2px 4px rgba(15,27,45,.04);
  --shadow-lg: 0 18px 48px rgba(15,27,45,.14), 0 4px 12px rgba(15,27,45,.06);
  --ring: 0 0 0 3px rgba(18,199,189,.20);
  --r: 14px;
}

.dark {
  --bg: #080d15;
  --surface: #101826;
  --surface-2: #16203112;
  --line: #1c2738;
  --line-strong: #26344a;
  --ink: #eaf1f8;
  --ink-2: #a3b2c4;
  --ink-3: #6c7d92;
  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --ring: 0 0 0 3px rgba(34,211,238,.22);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-feature-settings: 'cv02','cv03','cv04','ss01';
}
.dark body { background: var(--bg); }

/* Ambient brand wash behind the app — barely there, but it stops the page
   reading as a flat grey admin panel. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(31,227,154,.10), transparent 62%),
    radial-gradient(760px 420px at 92% 4%, rgba(26,166,234,.09), transparent 60%);
}
.dark body::before {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(31,227,154,.09), transparent 62%),
    radial-gradient(760px 420px at 92% 4%, rgba(26,166,234,.10), transparent 60%);
}

/* ---------------------------------------------------------------- typography */
.display { font-weight: 300; letter-spacing: -.03em; }
.grad-text {
  background: var(--brand); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.eyebrow {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .16em; color: var(--ink-3);
}

/* --------------------------------------------------------------- Arabic / RTL */
html[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', ui-sans-serif, system-ui, sans-serif; }
html[dir="rtl"] .num { direction: ltr; unicode-bidi: embed; display: inline-block; }
html[dir="rtl"] table { text-align: right; }
html[dir="rtl"] .sidebar-item { text-align: right; }
html[dir="rtl"] .flip { transform: scaleX(-1); }

/* ------------------------------------------------------------------ scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c8d4e3; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #a7b8cd; background-clip: content-box; }
.dark *::-webkit-scrollbar-thumb { background: #24324a; background-clip: content-box; }
.dark *::-webkit-scrollbar-thumb:hover { background: #33445f; background-clip: content-box; }

/* ---------------------------------------------------------------- app chrome */
.app-sidebar {
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
}
.dark .app-sidebar { background: linear-gradient(180deg, #0d1522, #0a111c); border-color: var(--line); }

.app-topbar {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

/* ---------------------------------------------------------------------- cards */
.card {
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--line-strong); }

/* KPI tile: a hairline of brand gradient across the top, revealed on hover */
.kpi { position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px;
  background: var(--brand); opacity: .5; transform: scaleX(.28);
  transform-origin: left center; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
}
html[dir="rtl"] .kpi::after { transform-origin: right center; }
.kpi:hover::after { transform: scaleX(1); opacity: 1; }
.kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }

.panel-title { font-size: .95rem; font-weight: 800; letter-spacing: -.015em; }

/* --------------------------------------------------------------------- tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8125rem; }
.tbl thead th {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(8px);
  color: var(--ink-3); font-weight: 700; font-size: .6875rem;
  letter-spacing: .07em; text-transform: uppercase;
  padding: .7rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.dark .tbl thead th { background: #0e1725; color: var(--ink-3); }
.tbl tbody td { padding: .68rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .15s ease; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand-2) 5%, transparent); }
.dark .tbl tbody tr:hover { background: rgba(18,199,189,.07); }
.tbl tfoot td { padding: .7rem .8rem; border-top: 1px solid var(--line-strong); }

/* ---------------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .17rem .55rem; border-radius: 999px;
  font-size: .6875rem; font-weight: 700; line-height: 1.45; white-space: nowrap;
  border: 1px solid transparent;
}
.pill-green { background: #e7f8ee; color: #10794a; border-color: #c9eeda; }
.pill-red   { background: #fdeaea; color: #b4232a; border-color: #f7cdcd; }
.pill-amber { background: #fdf3e0; color: #a25c07; border-color: #f6e0b8; }
.pill-blue  { background: #e8f0fe; color: #1a4fc4; border-color: #cddffb; }
.pill-teal  { background: #e2f8f7; color: #0b7a76; border-color: #c2eeeb; }
.pill-slate { background: #f0f4f9; color: #4a5b70; border-color: #e0e8f2; }
.pill-purple{ background: #f4ebfe; color: #6d28d9; border-color: #e5d5fb; }
.dark .pill-green { background: rgba(34,197,94,.13); color: #5ee39d; border-color: rgba(34,197,94,.22); }
.dark .pill-red   { background: rgba(239,68,68,.13); color: #fb8a8a; border-color: rgba(239,68,68,.22); }
.dark .pill-amber { background: rgba(245,158,11,.13); color: #fbbf24; border-color: rgba(245,158,11,.22); }
.dark .pill-blue  { background: rgba(59,130,246,.14); color: #7db1fb; border-color: rgba(59,130,246,.24); }
.dark .pill-teal  { background: rgba(18,199,189,.14); color: #3fdcd4; border-color: rgba(18,199,189,.24); }
.dark .pill-slate { background: rgba(148,163,184,.13); color: #b7c4d4; border-color: rgba(148,163,184,.2); }
.dark .pill-purple{ background: rgba(168,85,247,.14); color: #c99cfb; border-color: rgba(168,85,247,.24); }

/* --------------------------------------------------------------------- inputs */
.inp, .sel, .ta {
  width: 100%; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface);
  padding: .55rem .75rem; font-size: .8125rem; color: var(--ink);
  outline: none; transition: box-shadow .16s, border-color .16s, background .16s;
}
.dark .inp, .dark .sel, .dark .ta { background: #0e1725; border-color: var(--line-strong); }
.inp::placeholder, .ta::placeholder { color: var(--ink-3); }
.inp:focus, .sel:focus, .ta:focus { border-color: var(--brand-2); box-shadow: var(--ring); }
.inp:disabled, .ta:disabled { opacity: .55; }
.lbl {
  display: block; font-size: .6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3); margin-bottom: .32rem;
}

/* -------------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .42rem;
  border-radius: 11px; padding: .52rem .9rem;
  font-size: .8125rem; font-weight: 700; white-space: nowrap;
  transition: transform .12s ease, filter .18s ease, background .18s ease, box-shadow .18s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: var(--brand); color: #04241f;
  box-shadow: 0 6px 18px rgba(18,199,189,.30);
}
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); box-shadow: 0 10px 26px rgba(18,199,189,.38); }
.dark .btn-primary { color: #03181d; }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef3f9; color: var(--ink); }
.dark .btn-ghost { background: #16213200; border-color: var(--line-strong); color: var(--ink-2); }
.dark .btn-ghost:hover { background: #16213a; color: #fff; }
.btn-outline { border: 1px solid var(--line-strong); color: var(--ink-2); background: transparent; }
.btn-outline:hover { border-color: var(--brand-2); color: var(--ink); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* -------------------------------------------------------------------- sidebar */
.sidebar-item {
  position: relative; display: flex; align-items: center; gap: .68rem;
  padding: .52rem .7rem; border-radius: 11px;
  font-size: .8125rem; font-weight: 600; color: var(--ink-2);
  width: 100%; transition: background .16s, color .16s;
}
.sidebar-item:hover { background: var(--surface-2); color: var(--ink); }
.dark .sidebar-item:hover { background: #15203180; color: #fff; }
.sidebar-item.active { background: var(--brand-soft); color: #0b6f74; }
.dark .sidebar-item.active { color: #52e5da; background: rgba(18,199,189,.12); }
.sidebar-item.active::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%;
  width: 3px; border-radius: 999px; background: var(--brand);
}

/* ---------------------------------------------------------------------- misc */
.avatar {
  display: grid; place-items: center; border-radius: 999px;
  font-weight: 800; color: #fff; flex: none; letter-spacing: -.02em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px rgba(18,199,189,.35); }

.tab {
  padding: .44rem .8rem; border-radius: 10px;
  font-size: .8125rem; font-weight: 700; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.dark .tab:hover { background: #16213a; color: #fff; }
.tab.active { background: var(--ink); color: var(--surface); }
.dark .tab.active { background: var(--brand); color: #04241f; }

.bar { height: 6px; border-radius: 999px; background: #e8eef6; overflow: hidden; }
.dark .bar { background: #1b2740; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .6s cubic-bezier(.2,.8,.2,1); }

.divider { height: 1px; background: var(--line); }

/* --------------------------------------------------------------- hierarchy map */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { display: flex; justify-content: center; gap: 1.1rem; }
.tree-scroll { overflow: auto; padding: 1.25rem .5rem 2rem; }
.tree-zoom { transform-origin: top center; transition: transform .25s ease; display: inline-block; min-width: 100%; }
.tree ul { display: flex; gap: 1.1rem; justify-content: center; padding-top: 1.6rem; position: relative; }
.tree li { position: relative; display: flex; flex-direction: column; align-items: center; }
/* connector from a child up to the parent's horizontal rail */
.tree ul > li::before {
  content: ""; position: absolute; top: -1.6rem; left: 50%;
  width: 2px; height: 1.6rem; background: var(--line-strong);
}
/* horizontal rail across siblings */
.tree ul::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--line-strong);
}
.tree ul > li:first-child::after,
.tree ul > li:last-child::after { content: ""; position: absolute; top: -1.6rem; height: 2px; background: var(--surface); }
.tree ul > li:first-child::after { left: 0; right: 50%; }
.tree ul > li:last-child::after { left: 50%; right: 0; }
.tree ul > li:only-child::after { display: none; }
.tree ul > li:only-child::before { left: 50%; }
/* stem from a parent down to its children rail */
.tree .has-kids > .node-wrap::after {
  content: ""; position: absolute; bottom: -1.6rem; left: 50%;
  width: 2px; height: 1.6rem; background: var(--line-strong);
}
.node-wrap { position: relative; }

.node {
  width: 194px; border-radius: 13px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: .6rem .7rem; text-align: center;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.node:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-2); }
.node.is-me { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(18,199,189,.16); }
.node.is-hit { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.22); }
.node.dim { opacity: .34; }
.node-accent { height: 3px; border-radius: 999px; width: 34px; margin: 0 auto .45rem; }
.node-name { font-size: .78rem; font-weight: 800; letter-spacing: -.01em; }
.node-role { font-size: .66rem; color: var(--ink-3); line-height: 1.35; }
.node-count {
  position: absolute; top: -8px; inset-inline-end: -8px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font-size: .62rem; font-weight: 800;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-sm);
}
.dark .node-count { background: var(--brand); color: #04241f; }

/* ------------------------------------------------------------- command palette */
.palette {
  width: min(640px, 94vw); border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) saturate(180%);
}
.palette-row { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; cursor: pointer; }
.palette-row.sel { background: var(--brand-soft); }
.kbd {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink-3);
}

/* ------------------------------------------------------------------ animation */
.fade-in { animation: rise .32s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sheet { animation: pop .2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .34s cubic-bezier(.2,.8,.2,1) both; }
.stagger > *:nth-child(1){animation-delay:.02s}.stagger > *:nth-child(2){animation-delay:.05s}
.stagger > *:nth-child(3){animation-delay:.08s}.stagger > *:nth-child(4){animation-delay:.11s}
.stagger > *:nth-child(5){animation-delay:.14s}.stagger > *:nth-child(6){animation-delay:.17s}
.stagger > *:nth-child(7){animation-delay:.20s}.stagger > *:nth-child(8){animation-delay:.23s}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------- kanban */
.kanban-col { min-height: 150px; transition: background .18s, outline-color .18s; }
.drag-over { outline: 2px dashed var(--brand-2); outline-offset: -5px; background: rgba(18,199,189,.05); }
.dragging { opacity: .4; }

/* --------------------------------------------------------------------- print */
.print-only { display: none; }
@media print {
  .no-print, .app-sidebar, .app-topbar { display: none !important; }
  body::before { display: none; }
  .print-only { display: block; }
  body { background: #fff !important; }
  .card { box-shadow: none; border-color: #cbd5e1; }
}