/* Hermes Career Platform — Design System
 * Premium European SaaS, light-first. Own palette; token STRUCTURE inspired by
 * HireTrack (MIT, see THIRD-PARTY-NOTICES.md) — colors/typography are our own.
 * No framework, no CDN, no webfont downloads. Vazirmatn is local (../assets/).
 */
@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}

:root {
  /* ——— Semantic color tokens (light-first) ——— */
  --bg: #f6f7f9;
  --bg-subtle: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-hover: #e9edf2;
  --text: #101f38;          /* deep navy typography */
  --text-2: #2c3d5a;
  --muted: #5d6d84;
  --muted-2: #8494a9;
  --line: #e2e7ee;
  --line-strong: #cbd4e0;
  --accent: #1d56c8;        /* sophisticated blue (not HireTrack blue-500) */
  --accent-hover: #1748ab;
  --accent-active: #123d8f;
  --accent-soft: #e8eefc;
  --accent-ink: #173f8a;
  --success: #177245;
  --success-soft: #e3f3e9;
  --warning: #96690a;
  --warning-soft: #fdf3dd;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --info: #175cd3;
  --info-soft: #e7effd;
  --violet: #5b4bc4;
  --violet-soft: #efecfd;
  --shadow-sm: 0 1px 2px rgba(16, 31, 56, .06);
  --shadow-md: 0 4px 16px rgba(16, 31, 56, .08);
  --shadow-lg: 0 12px 32px rgba(16, 31, 56, .12);
  /* ——— Spacing scale ——— */
  --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px;
  --space-xl: 24px; --space-2xl: 32px; --space-3xl: 48px;
  /* ——— Radius ——— */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  /* ——— Button / input heights ——— */
  --h-xs: 32px; --h-sm: 36px; --h-md: 40px; --h-lg: 48px;
  --sidebar-w: 248px; --sidebar-w-collapsed: 64px; --topbar-h: 56px;
  --font-latin: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-fa: "Vazirmatn", -apple-system, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0c1424;
  --bg-subtle: #111c31;
  --surface: #131f36;
  --surface-2: #1a2947;
  --surface-hover: #223354;
  --text: #e9eef7;
  --text-2: #c3cede;
  --muted: #93a3bb;
  --muted-2: #6d7f9c;
  --line: #223350;
  --line-strong: #31456a;
  --accent: #6ea8fe;
  --accent-hover: #8db9fe;
  --accent-active: #a9c6fe;
  --accent-soft: #1b2f55;
  --accent-ink: #bcd4fe;
  --success: #4cc38a; --success-soft: #122e21;
  --warning: #f0b429; --warning-soft: #33270d;
  --danger: #f28b82; --danger-soft: #3a1b18;
  --info: #7aa7f8; --info-soft: #16294d;
  --violet: #a99df0; --violet-soft: #241f4d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-latin);
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body, [lang="fa"] body { font-family: var(--font-fa); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* ——— App shell ——— */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40;
  transition: width .18s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-lg); height: var(--topbar-h); border-bottom: 1px solid var(--line); }
.brand-mark { width: 30px; height: 30px; border-radius: var(--r-md); background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: 0 0 auto; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: var(--space-sm); }
.nav-section { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); padding: var(--space-md) var(--space-sm) var(--space-xs); white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: var(--space-md); width: 100%;
  padding: 9px var(--space-md); border-radius: var(--r-md); color: var(--text-2);
  font-weight: 500; text-align: start; white-space: nowrap; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-hover); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.nav-item .ico { font-size: 17px; width: 22px; text-align: center; flex: 0 0 auto; }
.nav-item .lbl { overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { margin-inline-start: auto; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 1px 7px; font-size: 11.5px; font-weight: 650; }
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-name, .sidebar.collapsed .brand-sub, .sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-item .lbl, .sidebar.collapsed .nav-item .count { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar-foot { border-top: 1px solid var(--line); padding: var(--space-sm); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-lg);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .crumbs b { color: var(--text); font-weight: 650; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md); display: inline-grid; place-items: center;
  color: var(--text-2); border: 1px solid transparent; position: relative; font-size: 17px;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.chip-select, .select {
  height: var(--h-sm); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); padding: 0 var(--space-sm); font-size: 13px; font-weight: 550;
}
.user-chip { display: flex; align-items: center; gap: var(--space-sm); padding: 4px 6px; border-radius: var(--r-md); }
.user-chip:hover { background: var(--surface-hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.content { padding: var(--space-xl); max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: var(--space-md); margin-bottom: var(--space-lg); flex-wrap: wrap; }
.page-head h1 { margin-bottom: 2px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: var(--space-sm); flex-wrap: wrap; }

/* ——— Buttons ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-md); padding: 0 16px; border-radius: var(--r-md); font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-xs { height: var(--h-xs); padding: 0 10px; font-size: 12.5px; }
.btn-sm { height: var(--h-sm); padding: 0 12px; }
.btn-lg { height: var(--h-lg); padding: 0 22px; font-size: 14.5px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ——— Cards, grids ——— */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--space-lg); }
.card-head { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-lg); border-bottom: 1px solid var(--line); }
.card-head h3 { flex: 1; }
.card-body { padding: var(--space-lg); }
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .delta { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* ——— Badges / pills / chips ——— */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  padding: 2px 9px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); }
.badge.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge.clickable { cursor: pointer; }
.badge.clickable:hover { border-color: var(--accent); color: var(--accent-ink); }
.pill-green { background: var(--success-soft); color: var(--success); }
.pill-amber { background: var(--warning-soft); color: var(--warning); }
.pill-red { background: var(--danger-soft); color: var(--danger); }
.pill-blue { background: var(--info-soft); color: var(--info); }
.pill-violet { background: var(--violet-soft); color: var(--violet); }
.pill-grey { background: var(--surface-2); color: var(--muted); }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 8px; font-size: 12px; font-weight: 550; margin: 2px 4px 2px 0; }
.score { font-size: 20px; font-weight: 700; }
.score-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.score-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .row-title { font-weight: 600; }
.pager { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.toolbar { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-lg); }
.search { height: var(--h-md); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: 0 12px; min-width: 220px; }

/* ——— Tabs ——— */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--space-lg); overflow-x: auto; }
.tab { padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ——— Kanban ——— */
.board { display: flex; gap: var(--space-md); overflow-x: auto; padding-bottom: var(--space-sm); align-items: flex-start; }
.lane { flex: 0 0 264px; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--space-sm); min-height: 120px; }
.lane.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lane-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 10px; font-weight: 650; font-size: 13px; }
.lane-head .n { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; font-size: 11.5px; color: var(--muted); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: var(--space-sm); box-shadow: var(--shadow-sm); cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard .k-title { font-weight: 650; font-size: 13.5px; }
.kcard .k-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kcard .k-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.kcard .k-foot .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { padding: 5px 12px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ——— Dialog / sheet ——— */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 40, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dialog { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 88vh; display: flex; flex-direction: column; border: 1px solid var(--line); }
.dialog.wide { width: min(760px, 100%); }
.dialog-head { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-lg); border-bottom: 1px solid var(--line); }
.dialog-head h3 { flex: 1; }
.dialog-body { padding: var(--space-lg); overflow-y: auto; }
.dialog-foot { padding: var(--space-lg); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--space-sm); }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .dialog { width: 100%; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
}

/* ——— Forms ——— */
.field { margin-bottom: var(--space-md); }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.input, textarea.input { width: 100%; height: var(--h-md); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: 0 12px; }
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; font-size: 13.5px; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--accent); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.wizard-steps { display: flex; gap: 6px; margin: 12px 0 4px; }
.wizard-steps i { flex: 1; height: 4px; border-radius: 99px; background: var(--line-strong); }
.wizard-steps i.done, .wizard-steps i.now { background: var(--accent); }

/* ——— Timeline / remarks / AI panel ——— */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-inline-start: 2px solid var(--line); margin-inline-start: 6px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
[dir="rtl"] .timeline li { padding: 0 22px 16px 0; }
.remark { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: 10px; }
.stars { color: #d9930d; letter-spacing: 1px; }
.evidence { font-size: 12.5px; color: var(--muted); }
.evidence a { font-weight: 600; }
.callout { border: 1px solid var(--line); border-inline-start: 3px solid var(--accent); background: var(--accent-soft); border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; }
.callout.warn { border-inline-start-color: var(--warning); background: var(--warning-soft); }
.callout.danger { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.demo-note { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* ——— Skeletons ——— */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); color: transparent !important; }
.skel * { visibility: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.2s infinite; }
[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
[dir="rtl"] .skel::after { animation-name: shimmer-rtl; }
@keyframes shimmer-rtl { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* ——— Toasts ——— */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 11px 14px; font-size: 13.5px; max-width: 340px; }

/* ——— Responsive shell ——— */
.menu-btn { display: none; }
.sidebar-scrim { display: none; }
.sidebar-close { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; inset-inline-start: 0; transform: translateX(0); box-shadow: var(--shadow-lg); }
  [dir="ltr"] .sidebar.hidden-m { transform: translateX(-105%); }
  [dir="rtl"] .sidebar.hidden-m { transform: translateX(105%); }
  .sidebar { transition: transform .2s ease; }
  .menu-btn { display: inline-grid; }
  .sidebar { z-index: 110; }
  .sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 100; }
  .sidebar:not(.hidden-m) + .sidebar-scrim { display: block; }
  .sidebar-close { display: inline-grid; margin-inline-start: auto; flex: 0 0 auto; }
  .content { padding: var(--space-lg); }
  .topbar .crumbs .crumb-mid { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 var(--space-sm); }
  .topbar .crumbs { display: none; }
  #roleSelect { display: none; }
  .user-chip .who { display: none; }
  .content { padding: 12px; }
}
