/* =========================================================================
   APEX HRM SUITE — Stylesheet
   Aesthetic: industrial / textile. Deep slate canvas, warm "thread" amber
   accent, crisp dense data surfaces. Light + dark themes.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Public+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

/* ----------------------------- TOKENS ----------------------------------- */
:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Public Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Brand */
  --thread: #d98324;          /* warm spool amber  */
  --thread-deep: #b96a14;
  --indigo: #4f46e5;
  --teal: #0d9488;
  --amber: #d97706;
  --rose: #e11d48;

  /* Light theme */
  --bg: #f4f1ec;              /* warm paper */
  --bg-grain: #efe9e0;
  --surface: #ffffff;
  --surface-2: #faf7f2;
  --sidebar-bg: #20242c;
  --sidebar-fg: #c9cdd6;
  --sidebar-muted: #7c828f;
  --sidebar-active: #2b303a;
  --text: #1c1f26;
  --text-soft: #565b66;
  --text-faint: #8b909b;
  --border: #e4ddd2;
  --border-strong: #d4cabb;
  --topbar-bg: #ffffff;
  --tabstrip-bg: #ebe5db;
  --tab-bg: #ddd5c8;
  --tab-active-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(28,31,38,.06), 0 1px 3px rgba(28,31,38,.04);
  --shadow-md: 0 4px 16px rgba(28,31,38,.08);
  --shadow-lg: 0 12px 40px rgba(28,31,38,.16);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 68px;
}

[data-theme="dark"] {
  --bg: #14161b;
  --bg-grain: #181b21;
  --surface: #1d2027;
  --surface-2: #23272f;
  --sidebar-bg: #16181d;
  --sidebar-fg: #c2c7d0;
  --sidebar-muted: #6b717c;
  --sidebar-active: #262a32;
  --text: #e7e9ee;
  --text-soft: #a7adb8;
  --text-faint: #6f757f;
  --border: #2c313a;
  --border-strong: #383e48;
  --topbar-bg: #1d2027;
  --tabstrip-bg: #16181d;
  --tab-bg: #23272f;
  --tab-active-bg: #1d2027;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ----------------------------- BUTTONS ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: 14px;
  transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--thread); color: #1c1206; box-shadow: 0 2px 0 var(--thread-deep); }
.btn--primary:hover { background: #e08f30; }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* ============================= AUTH ===================================== */
.auth-body { background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 100% at 0% 0%, #2b303a 0%, #20242c 45%, #181b21 100%);
  color: #e9eaee;
}
.auth-aside::before {
  /* woven thread texture */
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(217,131,36,.07) 0 2px, transparent 2px 22px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 22px);
  opacity: .8;
}
.auth-aside__inner { position: relative; padding: 64px 56px; max-width: 560px; display: flex; flex-direction: column; height: 100%; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }
.auth-brand__mark {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--thread); color: #1c1206;
}
.auth-brand__mark .ico { width: 26px; height: 26px; }
.auth-brand__name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.auth-aside__title { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -.01em; }
.auth-aside__sub { color: #b4b9c4; font-size: 16px; line-height: 1.6; margin: 0 0 36px; max-width: 440px; }
.auth-aside__features { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 16px; }
.auth-aside__features li { display: flex; align-items: center; gap: 14px; color: #d4d8e0; font-size: 15px; }
.auth-aside__features .ico { color: var(--thread); width: 22px; height: 22px; }
.auth-aside__foot { margin-top: 40px; font-size: 13px; color: #7c828f; letter-spacing: .02em; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-family: var(--font-display); font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-card__sub { color: var(--text-soft); margin: 0 0 28px; }
.auth-form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field__input { position: relative; display: flex; align-items: center; }
.field__input .ico { position: absolute; left: 14px; color: var(--text-faint); }
.field__input input {
  width: 100%; padding: 13px 14px 13px 44px; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: border .15s, box-shadow .15s;
}
.field__input input:focus { outline: none; border-color: var(--thread); box-shadow: 0 0 0 3px rgba(217,131,36,.18); }
.field__toggle { position: absolute; right: 12px; background: none; border: none; color: var(--text-faint); font-size: 13px; font-weight: 600; }
.auth-form .btn { margin-top: 6px; padding: 13px; }
.auth-hint { margin-top: 26px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 8px; }
.auth-hint strong { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.auth-hint code { font-family: var(--font-mono); font-size: 13px; color: var(--text); background: var(--surface); padding: 4px 8px; border-radius: 5px; width: fit-content; border: 1px solid var(--border); }
.auth-copyright { margin-top: 40px; color: var(--text-faint); font-size: 12px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert--error { background: #fdeaea; color: #9b1c1c; border: 1px solid #f5c2c2; }
.alert--success { background: #e8f6ee; color: #1a6b3c; border: 1px solid #b9e2c9; }
[data-theme="dark"] .alert--error { background: #3a1f1f; color: #f3b4b4; border-color: #5a2a2a; }
[data-theme="dark"] .alert--success { background: #16321f; color: #a8e0bf; border-color: #234a30; }

/* ============================= SHELL ==================================== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; transition: width .2s ease;
}
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px; height: 60px; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--thread); color: #1c1206; display: grid; place-items: center; flex: none; }
.brand-mark .ico { width: 22px; height: 22px; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; }
.sidebar.is-collapsed .brand-text { display: none; }
.sidebar__collapse { margin-left: auto; background: none; border: none; color: var(--sidebar-muted); display: grid; place-items: center; padding: 6px; border-radius: 6px; }
.sidebar__collapse:hover { background: var(--sidebar-active); color: var(--sidebar-fg); }
.sidebar.is-collapsed .sidebar__collapse { transform: rotate(180deg); }

.sidebar__search { margin: 4px 14px 10px; position: relative; display: flex; align-items: center; }
.sidebar__search .ico { position: absolute; left: 11px; color: var(--sidebar-muted); width: 16px; height: 16px; }
.sidebar__search input {
  width: 100%; padding: 9px 10px 9px 34px; font-size: 13px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  border-radius: 7px; color: var(--sidebar-fg);
}
.sidebar__search input::placeholder { color: var(--sidebar-muted); }
.sidebar__search input:focus { outline: none; border-color: var(--thread); }
.sidebar.is-collapsed .sidebar__search { display: none; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.nav-group { margin-bottom: 14px; }
.nav-group__title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); padding: 6px 10px; }
.sidebar.is-collapsed .nav-group__title { text-align: center; font-size: 0; padding: 6px 0; }
.sidebar.is-collapsed .nav-group__title::after { content: "•"; font-size: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px;
  color: var(--sidebar-fg); font-size: 14px; font-weight: 500; position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.is-active { background: var(--sidebar-active); color: #fff; }
.nav-item.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--thread); }
.nav-item .ico { color: var(--sidebar-muted); }
.nav-item:hover .ico, .nav-item.is-active .ico { color: var(--thread); }
.nav-item__soon { margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.08); color: var(--sidebar-muted); padding: 2px 6px; border-radius: 20px; }
.nav-item.is-disabled { opacity: .55; }
.sidebar.is-collapsed .nav-item__label, .sidebar.is-collapsed .nav-item__soon { display: none; }
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 11px; }

.sidebar__foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.badge-phase { font-size: 11px; color: var(--sidebar-muted); letter-spacing: .03em; }
.sidebar.is-collapsed .sidebar__foot { display: none; }

/* ---- Main ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Topbar ---- */
.topbar { height: 60px; flex: none; background: var(--topbar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 18px; }
.topbar__menu { display: none; }
.icon-btn { background: none; border: none; color: var(--text-soft); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn--sm { width: 30px; height: 30px; }
.topbar__company { display: flex; align-items: center; gap: 9px; padding: 7px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.topbar__company .ico { color: var(--thread); }
.company-select { border: none; background: none; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.company-select:focus { outline: none; }
.company-static { font-weight: 600; font-size: 14px; }
.topbar__spacer { flex: 1; }
.topbar__bell .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); border: 2px solid var(--topbar-bg); }
.topbar__user { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 30px; cursor: pointer; position: relative; }
.topbar__user:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--indigo); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.topbar__user-info { display: flex; flex-direction: column; line-height: 1.2; }
.topbar__user-name { font-weight: 600; font-size: 13.5px; }
.topbar__user-role { font-size: 11.5px; color: var(--text-faint); }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .15s; z-index: 50; }
.user-dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown__head { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: grid; gap: 2px; }
.user-dropdown__head strong { font-size: 14px; }
.user-dropdown__head span { font-size: 12px; color: var(--text-faint); }
.user-dropdown__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 7px; font-size: 14px; background: none; border: none; color: var(--text); text-align: left; }
.user-dropdown__item:hover { background: var(--surface-2); }
.user-dropdown__item .ico { color: var(--text-faint); }
.user-dropdown__item.is-danger { color: var(--rose); }
.user-dropdown__item.is-danger .ico { color: var(--rose); }
.user-dropdown__logout { margin: 0; }

/* ---- Tab strip ---- */
.tabstrip { height: 44px; flex: none; background: var(--tabstrip-bg); display: flex; align-items: flex-end; padding: 0 8px; border-bottom: 1px solid var(--border); gap: 4px; }
.tabstrip__scroll { display: flex; gap: 4px; overflow-x: auto; flex: 1; padding-top: 6px; scrollbar-width: none; }
.tabstrip__scroll::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px;
  background: var(--tab-bg); border-radius: 9px 9px 0 0; white-space: nowrap;
  font-size: 13px; font-weight: 500; color: var(--text-soft); cursor: pointer;
  border: 1px solid transparent; border-bottom: none; max-width: 220px; position: relative; top: 1px;
  transition: background .12s, color .12s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active { background: var(--tab-active-bg); color: var(--text); border-color: var(--border); box-shadow: 0 -2px 6px rgba(0,0,0,.04); }
.tab.is-active::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--thread); border-radius: 2px 2px 0 0; }
.tab__icon .ico { width: 15px; height: 15px; color: currentColor; }
.tab.is-active .tab__icon .ico { color: var(--thread); }
.tab__title { overflow: hidden; text-overflow: ellipsis; }
.tab__close { background: none; border: none; color: var(--text-faint); display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; padding: 0; }
.tab__close .ico { width: 13px; height: 13px; }
.tab__close:hover { background: rgba(225,29,72,.14); color: var(--rose); }
.tabstrip__actions { position: relative; padding-bottom: 4px; }
.tab-actions-menu { position: absolute; top: calc(100% + 4px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-md); padding: 5px; min-width: 150px; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: .14s; z-index: 40; }
.tab-actions-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.tab-actions-menu button { display: block; width: 100%; text-align: left; padding: 8px 11px; border-radius: 6px; background: none; border: none; font-size: 13.5px; color: var(--text); }
.tab-actions-menu button:hover { background: var(--surface-2); }

/* ---- Workspace ---- */
.workspace { flex: 1; overflow: hidden; position: relative; background: var(--bg); }
.tab-panel { display: none; height: 100%; overflow-y: auto; }
.tab-panel.is-active { display: block; }
.tab-loading, .tab-error { display: flex; align-items: center; justify-content: center; gap: 10px; height: 100%; color: var(--text-faint); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--thread); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================= PAGE / COMPONENTS ======================== */
.page { padding: 28px 32px 48px; max-width: 1280px; }
.page__head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page__title { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
.page__sub { color: var(--text-soft); margin: 0; font-size: 14.5px; }
.page__date { font-size: 13px; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); padding: 8px 14px; border-radius: 30px; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; opacity: .08; }
.stat-card__icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-card__icon .ico { width: 24px; height: 24px; }
.stat-card__value { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; }
.stat-card__label { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.stat-card--indigo .stat-card__icon { background: rgba(79,70,229,.12); color: var(--indigo); } .stat-card--indigo::after { background: var(--indigo); }
.stat-card--teal .stat-card__icon { background: rgba(13,148,136,.12); color: var(--teal); } .stat-card--teal::after { background: var(--teal); }
.stat-card--amber .stat-card__icon { background: rgba(217,119,6,.12); color: var(--amber); } .stat-card--amber::after { background: var(--amber); }
.stat-card--rose .stat-card__icon { background: rgba(225,29,72,.12); color: var(--rose); } .stat-card--rose::after { background: var(--rose); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel__head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel__hint { font-size: 12px; color: var(--text-faint); }
.panel__body { padding: 8px 20px 18px; }
.empty { padding: 40px; text-align: center; color: var(--text-faint); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity__item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity__item:last-child { border-bottom: none; }
.activity__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--text-faint); }
.activity__dot--login { background: var(--teal); }
.activity__dot--logout { background: var(--text-faint); }
.activity__dot--create { background: var(--indigo); }
.activity__dot--update { background: var(--amber); }
.activity__dot--delete { background: var(--rose); }
.activity__text { font-size: 13.5px; line-height: 1.5; }
.activity__meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.roadmap { list-style: none; margin: 0; padding: 8px 0; }
.roadmap__item { display: flex; align-items: center; gap: 12px; padding: 11px 0; font-size: 13.5px; color: var(--text-soft); border-bottom: 1px solid var(--border); }
.roadmap__item:last-child { border-bottom: none; }
.roadmap__tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; flex: none; }
.roadmap__item.is-done { color: var(--text); font-weight: 500; }
.roadmap__item.is-done .roadmap__tick { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 30px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: .25s; z-index: 200; }
.toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---- Overlay ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; visibility: hidden; transition: .2s; z-index: 60; }
.overlay.is-on { opacity: 1; visibility: visible; }

/* ---- Error pages ---- */
.err-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.err-card { text-align: center; padding: 40px; }
.err-code { font-family: var(--font-display); font-size: 96px; font-weight: 600; color: var(--thread); line-height: 1; }
.err-card h1 { font-family: var(--font-display); font-size: 26px; margin: 12px 0 8px; }
.err-card p { color: var(--text-soft); margin: 0 0 24px; }

/* ============================= RESPONSIVE =============================== */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 70; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-collapsed { width: var(--sidebar-w); }
  .topbar__menu { display: grid; }
  .topbar__user-info { display: none; }
  .page { padding: 20px 18px 40px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page__head { flex-direction: column; }
}

/* ============================= PHASE 1 COMPONENTS ======================= */

/* ---- Buttons / chips shared ---- */
.chip { display:inline-block; padding:2px 9px; font-size:12px; font-weight:600; border-radius:20px; background:var(--surface-2); border:1px solid var(--border); color:var(--text-soft); }
.chip-btn { font-size:12px; font-weight:600; padding:3px 9px; border-radius:6px; border:1px dashed var(--border-strong); background:transparent; color:var(--text-soft); }
.chip-btn:hover { border-color:var(--thread); color:var(--thread); }
.mono { font-family:var(--font-mono); font-size:12.5px; }
.muted { color:var(--text-faint); }
.link-strong { font-weight:600; color:var(--text); }
.link-strong:hover { color:var(--thread); }

/* ---- Badges ---- */
.badge { display:inline-block; padding:2px 9px; font-size:11.5px; font-weight:700; border-radius:20px; letter-spacing:.02em; }
.badge--ok { background:rgba(13,148,136,.14); color:#0c7a70; }
.badge--mut { background:var(--surface-2); color:var(--text-faint); border:1px solid var(--border); }
.badge--warn { background:rgba(217,119,6,.16); color:#a85d04; }
.badge--danger { background:rgba(225,29,72,.14); color:#c01540; }
[data-theme="dark"] .badge--ok { color:#5ee0d0; } [data-theme="dark"] .badge--warn { color:#f5b860; } [data-theme="dark"] .badge--danger { color:#f7a3b8; }

/* ---- Filter bar ---- */
.filterbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.filterbar__search { position:relative; display:flex; align-items:center; flex:1; min-width:240px; }
.filterbar__search .ico { position:absolute; left:12px; color:var(--text-faint); }
.filterbar__search input { width:100%; padding:9px 12px 9px 38px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); font-size:14px; }
.filterbar select { padding:9px 12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); font-size:14px; }
.filterbar input:focus, .filterbar select:focus { outline:none; border-color:var(--thread); box-shadow:0 0 0 3px rgba(217,131,36,.15); }

/* ---- Data table ---- */
.tablewrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
.data-table { width:100%; border-collapse:collapse; font-size:13.5px; }
.data-table thead th { text-align:left; padding:12px 16px; font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-faint); background:var(--surface-2); border-bottom:1px solid var(--border); white-space:nowrap; }
.data-table tbody td { padding:12px 16px; border-bottom:1px solid var(--border); vertical-align:middle; }
.data-table tbody tr:last-child td { border-bottom:none; }
.data-table tbody tr:hover { background:var(--surface-2); }
.data-table__empty { text-align:center; color:var(--text-faint); padding:36px !important; }
.data-table__actions { text-align:right; white-space:nowrap; }
.data-table__actions { display:flex; gap:4px; justify-content:flex-end; align-items:center; }
.data-table--tight tbody td, .data-table--tight thead th { padding:9px 12px; }

/* ---- Pager ---- */
.pager { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:18px; }
.pager__info { font-size:13px; color:var(--text-soft); }

/* ---- Forms ---- */
.form { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden; }
.form-tabs { display:flex; gap:2px; padding:6px 6px 0; background:var(--surface-2); border-bottom:1px solid var(--border); }
.form-tab { padding:10px 18px; font-size:13.5px; font-weight:600; color:var(--text-soft); background:transparent; border:none; border-radius:8px 8px 0 0; }
.form-tab:hover { color:var(--text); }
.form-tab.is-active { background:var(--surface); color:var(--thread); box-shadow:0 -2px 0 var(--thread) inset; }
.form-sect { display:none; padding:22px; }
.form-sect.is-active { display:block; }
.form-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.fld { display:grid; gap:6px; }
.fld--wide { grid-column:span 2; }
.fld > span { font-size:12.5px; font-weight:600; color:var(--text-soft); }
.fld input, .fld select, .fld textarea { padding:10px 12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); font-size:14px; font-family:inherit; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline:none; border-color:var(--thread); box-shadow:0 0 0 3px rgba(217,131,36,.15); }
.fld--check { flex-direction:row; align-items:center; display:flex; gap:8px; }
.form--stack .fld { margin-bottom:14px; }
.form-note { margin:18px 22px 0; padding:12px 14px; background:var(--surface-2); border-left:3px solid var(--thread); border-radius:6px; font-size:13px; color:var(--text-soft); }
.form-foot { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 22px; border-top:1px solid var(--border); background:var(--surface-2); }
.form-foot__actions { display:flex; gap:10px; margin-left:auto; }
.form-err { color:var(--rose); font-size:13px; font-weight:500; }
.page--form { max-width:920px; }

/* ---- Key-value (profile) ---- */
.profile-head { display:flex; align-items:center; gap:18px; margin-bottom:22px; }
.profile-avatar { width:64px; height:64px; border-radius:16px; background:var(--indigo); color:#fff; display:grid; place-items:center; font-size:26px; font-weight:700; font-family:var(--font-display); flex:none; }
.profile-id { flex:1; }
.profile-meta { display:flex; align-items:center; gap:10px; margin-top:6px; flex-wrap:wrap; }
.kv { display:flex; justify-content:space-between; gap:16px; padding:9px 0; border-bottom:1px solid var(--border); font-size:13.5px; }
.kv:last-child { border-bottom:none; }
.kv__k { color:var(--text-faint); }
.kv__v { font-weight:500; text-align:right; }

/* ---- Mini table (salary) ---- */
.mini-table { width:100%; border-collapse:collapse; font-size:13.5px; }
.mini-table td { padding:8px 0; border-bottom:1px solid var(--border); }
.mini-table .num { text-align:right; font-family:var(--font-mono); font-size:13px; }
.mini-table .num--neg { color:var(--rose); }
.mini-table tfoot td { border-top:2px solid var(--border-strong); border-bottom:none; padding-top:10px; font-weight:600; }
.mini-table__total td { font-size:15px; color:var(--thread); }

/* ---- Doc list ---- */
.doc-list { list-style:none; margin:0; padding:0; }
.doc-item { display:flex; align-items:center; justify-content:space-between; padding:11px 0; border-bottom:1px solid var(--border); gap:12px; }
.doc-item:last-child { border-bottom:none; }
.doc-item__type { display:inline-block; font-size:10.5px; font-weight:700; letter-spacing:.05em; color:var(--text-faint); background:var(--surface-2); padding:2px 7px; border-radius:5px; margin-right:8px; }
.doc-item__title { font-size:13.5px; font-weight:500; }
.doc-item__exp { font-size:12.5px; color:var(--text-soft); display:flex; align-items:center; gap:8px; white-space:nowrap; }
.doc-item.is-expired .doc-item__title { color:var(--rose); }
.doc-item.is-soon .doc-item__exp { color:#a85d04; font-weight:600; }

/* ---- Org tree ---- */
.orgtree { display:grid; gap:14px; }
.org-node--factory { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:14px 16px; }
.org-node__row { display:flex; align-items:center; gap:11px; }
.org-node__icon { width:32px; height:32px; border-radius:8px; background:var(--surface-2); display:grid; place-items:center; color:var(--thread); flex:none; }
.org-node__label { font-weight:600; font-size:14.5px; }
.org-node__label .mono { margin-left:6px; color:var(--text-faint); font-weight:500; }
.org-node__count { font-size:12px; color:var(--text-faint); }
.org-node__actions { margin-left:auto; display:flex; align-items:center; gap:6px; }
.org-node--building { margin:10px 0 0 26px; padding:10px 14px; border-left:2px solid var(--border-strong); background:var(--surface-2); border-radius:0 8px 8px 0; }
.org-node--floor { margin:8px 0 0 22px; padding:8px 12px; border-left:2px dashed var(--border-strong); }
.org-node--floor .org-node__icon { width:26px; height:26px; }
.org-lines { display:flex; flex-wrap:wrap; gap:7px; margin:8px 0 2px 38px; }
.org-line { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; padding:4px 10px; background:var(--surface); border:1px solid var(--border); border-radius:20px; }
.org-line .mono { color:var(--text-faint); }
.org-line__del { background:none; border:none; color:var(--text-faint); font-size:15px; line-height:1; padding:0 0 0 2px; }
.org-line__del:hover { color:var(--rose); }

/* ---- Master switcher ---- */
.master-switch { display:flex; gap:4px; margin-bottom:16px; flex-wrap:wrap; background:var(--surface-2); padding:5px; border-radius:10px; border:1px solid var(--border); width:fit-content; }
.seg { padding:8px 16px; font-size:13.5px; font-weight:600; color:var(--text-soft); background:transparent; border:none; border-radius:7px; }
.seg:hover { color:var(--text); }
.seg.is-active { background:var(--surface); color:var(--thread); box-shadow:var(--shadow-sm); }
.grid-master { display:grid; grid-template-columns:2fr 1fr; gap:16px; align-items:start; }
.grid-2 { margin-bottom:16px; }

@media (max-width:1024px){ .form-grid{grid-template-columns:repeat(2,1fr);} .grid-master{grid-template-columns:1fr;} }
@media (max-width:560px){ .form-grid{grid-template-columns:1fr;} .fld--wide{grid-column:span 1;} }

/* ============================= PHASE 2 COMPONENTS ======================= */

/* ---- Shared button variants ---- */
.btn--sm { padding:5px 12px; font-size:12.5px; }
.btn--ok { background:var(--teal,#0d9488); color:#fff; border:1px solid transparent; }
.btn--ok:hover { filter:brightness(.95); }
.btn--danger-ghost { background:transparent; color:#c01540; border:1px solid rgba(225,29,72,.4); }
.btn--danger-ghost:hover { background:rgba(225,29,72,.08); }
.link-btn { background:none; border:none; color:var(--thread); font-size:12.5px; font-weight:600; cursor:pointer; padding:0; }
.link-btn:hover { text-decoration:underline; }
.ico--xl { width:40px; height:40px; }
.section-h { font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-faint); margin:22px 0 12px; font-weight:700; }
.page--narrow { max-width:880px; }
.panel__body--flush { padding:0; }

/* ---- Notification bell dropdown ---- */
.topbar__bell-wrap { position:relative; }
.topbar__bell { position:relative; }
.topbar__bell .dot { position:absolute; top:6px; right:6px; width:8px; height:8px; border-radius:50%; background:var(--rose,#e11d48); border:2px solid var(--surface); }
.notif-dropdown { position:absolute; top:46px; right:0; width:360px; max-width:92vw; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg,0 12px 32px rgba(0,0,0,.18)); z-index:60; overflow:hidden; }
.notif-dropdown__head { display:flex; align-items:center; justify-content:space-between; padding:13px 16px; border-bottom:1px solid var(--border); }
.notif-dropdown__head strong { font-size:14px; }
.notif-dropdown__list { max-height:380px; overflow-y:auto; }
.notif-dropdown__foot { display:block; text-align:center; padding:11px; font-size:13px; font-weight:600; color:var(--thread); border-top:1px solid var(--border); }
.notif-dropdown__foot:hover { background:var(--surface-2); }
.notif-empty { padding:28px; text-align:center; color:var(--text-faint); font-size:13px; }

.notif-item { display:flex; gap:11px; padding:12px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .12s; }
.notif-item:last-child { border-bottom:none; }
.notif-item:hover { background:var(--surface-2); }
.notif-item.is-unread { background:rgba(217,131,36,.06); }
.notif-item.is-unread .notif-item__title::after { content:''; display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--thread); margin-left:7px; vertical-align:middle; }
.notif-item__icon { width:34px; height:34px; border-radius:9px; display:grid; place-items:center; flex:none; background:var(--surface-2); color:var(--text-soft); }
.notif-item__icon--approval { background:rgba(99,102,241,.14); color:#5457d6; }
.notif-item__icon--alert { background:rgba(217,119,6,.16); color:#a85d04; }
.notif-item__icon--info { background:rgba(13,148,136,.14); color:#0c7a70; }
.notif-item__title { font-size:13.5px; font-weight:600; line-height:1.3; }
.notif-item__text { font-size:12.5px; color:var(--text-soft); margin-top:2px; line-height:1.35; }
.notif-item__time { font-size:11.5px; color:var(--text-faint); margin-top:3px; }

/* ---- Notification full page ---- */
.notif-full { list-style:none; margin:0; padding:0; }
.notif-row { display:flex; gap:13px; padding:14px 18px; border-bottom:1px solid var(--border); cursor:pointer; }
.notif-row:last-child { border-bottom:none; }
.notif-row:hover { background:var(--surface-2); }
.notif-row.is-unread { background:rgba(217,131,36,.05); }
.notif-row__icon { width:38px; height:38px; border-radius:10px; display:grid; place-items:center; flex:none; background:var(--surface-2); color:var(--text-soft); }
.notif-row__icon--approval { background:rgba(99,102,241,.14); color:#5457d6; }
.notif-row__icon--alert { background:rgba(217,119,6,.16); color:#a85d04; }
.notif-row__icon--info { background:rgba(13,148,136,.14); color:#0c7a70; }
.notif-row__title { font-size:14px; font-weight:600; color:var(--text); }
.notif-row__title:hover { color:var(--thread); }
.notif-row__text { font-size:13px; color:var(--text-soft); margin-top:3px; }
.notif-row__time { font-size:12px; color:var(--text-faint); margin-top:4px; }

/* ---- Approvals list ---- */
.approval-list { display:grid; gap:12px; }
.appr-card { display:flex; align-items:center; gap:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:15px 18px; }
.appr-card__icon { width:42px; height:42px; border-radius:11px; display:grid; place-items:center; flex:none; }
.appr-card__icon--indigo { background:rgba(99,102,241,.14); color:#5457d6; }
.appr-card__icon--amber { background:rgba(217,131,36,.16); color:var(--thread); }
.appr-card__icon--teal { background:rgba(13,148,136,.14); color:#0c7a70; }
.appr-card__icon--mut { background:var(--surface-2); color:var(--text-soft); }
.appr-card__main { flex:1; min-width:0; }
.appr-card__title { font-size:14.5px; font-weight:600; color:var(--text); }
.appr-card__title:hover { color:var(--thread); }
.appr-card__meta { display:flex; align-items:center; gap:9px; margin-top:5px; flex-wrap:wrap; font-size:12.5px; }
.appr-card__actions { display:flex; gap:8px; flex:none; }

/* ---- Approval detail / act panel ---- */
.act-panel { margin-top:16px; }
.act-panel__buttons { display:flex; gap:10px; margin-top:12px; }

/* ---- Timeline ---- */
.timeline { list-style:none; margin:0; padding:0; position:relative; }
.timeline__item { display:flex; gap:13px; padding:0 0 18px; position:relative; }
.timeline__item:not(:last-child)::before { content:''; position:absolute; left:6px; top:16px; bottom:0; width:2px; background:var(--border); }
.timeline__dot { width:14px; height:14px; border-radius:50%; background:var(--border-strong); border:2px solid var(--surface); flex:none; margin-top:2px; z-index:1; }
.timeline__dot--ok { background:var(--teal,#0d9488); }
.timeline__dot--danger { background:var(--rose,#e11d48); }
.timeline__dot--warn { background:var(--thread); }
.timeline__body { font-size:13.5px; }
.timeline__comment { font-style:italic; color:var(--text-soft); margin:4px 0; }
.timeline__time { font-size:11.5px; color:var(--text-faint); margin-top:2px; }

/* ---- Workflow admin ---- */
.wf-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:16px; }
.wf-desc { font-size:13px; color:var(--text-soft); margin:0 0 12px; }
.wf-steps { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.wf-step { display:flex; gap:12px; align-items:flex-start; }
.wf-step__order { width:24px; height:24px; border-radius:50%; background:var(--thread); color:#fff; font-size:12px; font-weight:700; display:grid; place-items:center; flex:none; }
.wf-step__body strong { font-size:13.5px; }
.wf-step__meta { font-size:12px; color:var(--text-soft); margin-top:2px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

@media (max-width:560px){ .notif-dropdown{width:300px;} .appr-card{flex-wrap:wrap;} .appr-card__actions{width:100%;} }

/* ============================= MODAL DIALOG ============================ */
.modal-root { position:fixed; inset:0; z-index:200; display:none; }
.modal-root.is-open { display:block; }
body.modal-locked { overflow:hidden; }
.modal-backdrop { position:absolute; inset:0; background:rgba(15,23,42,.55); backdrop-filter:blur(2px); animation:modalFade .15s ease; }
[data-theme="dark"] .modal-backdrop { background:rgba(0,0,0,.62); }
.modal {
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:440px; max-width:calc(100vw - 32px); max-height:calc(100vh - 48px);
  background:var(--surface); border:1px solid var(--border); border-radius:16px;
  box-shadow:0 24px 64px rgba(15,23,42,.28); overflow:hidden;
  display:flex; flex-direction:column; animation:modalPop .16s cubic-bezier(.2,.8,.3,1);
}
.modal.is-leaving { animation:modalOut .15s ease forwards; }
@keyframes modalFade { from{opacity:0} to{opacity:1} }
@keyframes modalPop { from{opacity:0; transform:translate(-50%,-46%) scale(.97)} to{opacity:1; transform:translate(-50%,-50%) scale(1)} }
@keyframes modalOut { to{opacity:0; transform:translate(-50%,-52%) scale(.98)} }

.modal__head { display:flex; align-items:flex-start; gap:13px; padding:20px 20px 14px; border-bottom:1px solid var(--border); }
.modal__icon { width:40px; height:40px; border-radius:11px; background:rgba(217,131,36,.14); color:var(--thread); display:grid; place-items:center; flex:none; }
.modal__icon .ico { width:20px; height:20px; }
.modal__title { font-size:17px; font-weight:700; font-family:var(--font-display); margin:0; line-height:1.25; }
.modal__sub { font-size:13px; color:var(--text-faint); margin:3px 0 0; }
.modal__x { margin-left:auto; background:none; border:none; color:var(--text-faint); width:30px; height:30px; border-radius:8px; display:grid; place-items:center; flex:none; cursor:pointer; }
.modal__x:hover { background:var(--surface-2); color:var(--text); }

.modal__body { padding:18px 20px; overflow-y:auto; display:grid; gap:15px; }
.modal__message { font-size:14px; color:var(--text-soft); line-height:1.5; margin:0; }
.modal-fld { display:grid; gap:6px; }
.modal-fld__label { font-size:12.5px; font-weight:600; color:var(--text-soft); }
.modal-fld__label em { color:var(--rose); font-style:normal; }
.modal-fld input, .modal-fld textarea, .modal-fld select {
  padding:10px 13px; border:1px solid var(--border-strong); border-radius:9px;
  background:var(--surface); color:var(--text); font-size:14px; font-family:inherit; width:100%;
}
.modal-fld input:focus, .modal-fld textarea:focus, .modal-fld select:focus {
  outline:none; border-color:var(--thread); box-shadow:0 0 0 3px rgba(217,131,36,.16);
}
.modal-fld__help { font-size:11.5px; color:var(--text-faint); }
.modal__err { background:rgba(225,29,72,.1); color:#c01540; font-size:13px; padding:9px 12px; border-radius:8px; border:1px solid rgba(225,29,72,.25); }

.modal__foot { display:flex; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid var(--border); background:var(--surface-2); }
.modal__primary.is-loading { opacity:.7; pointer-events:none; }
.modal__primary.is-loading::after { content:''; display:inline-block; width:12px; height:12px; margin-left:8px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; vertical-align:-2px; animation:spin .6s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

@media (max-width:520px){ .modal{width:100%;} }

/* ---- Toast notices (HRMModal.notice) ---- */
.toast-host { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:240; display:flex; flex-direction:column; gap:10px; align-items:center; pointer-events:none; }
.toast { display:flex; align-items:center; gap:10px; padding:11px 16px; border-radius:11px; background:var(--surface); border:1px solid var(--border); box-shadow:0 10px 30px rgba(15,23,42,.22); font-size:13.5px; font-weight:500; color:var(--text); opacity:0; transform:translateY(10px); transition:.22s cubic-bezier(.2,.8,.3,1); max-width:90vw; }
.toast.is-in { opacity:1; transform:translateY(0); }
.toast__icon { width:24px; height:24px; border-radius:7px; display:grid; place-items:center; flex:none; }
.toast__icon .ico { width:15px; height:15px; }
.toast--success .toast__icon { background:rgba(13,148,136,.16); color:#0c7a70; }
.toast--error .toast__icon { background:rgba(225,29,72,.14); color:#c01540; }
.toast--info .toast__icon { background:rgba(217,131,36,.16); color:var(--thread); }
[data-theme="dark"] .toast--success .toast__icon { color:#5ee0d0; }
[data-theme="dark"] .toast--error .toast__icon { color:#f7a3b8; }

/* ============================= PHASE 3 COMPONENTS ======================= */

.page__head-actions { display:flex; gap:10px; align-items:center; }
.chip--sm { font-size:11px; padding:1px 7px; }

/* ---- Stat mini row ---- */
.stat-row { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
.stat-mini { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px; box-shadow:var(--shadow-sm); }
.stat-mini__num { display:block; font-size:24px; font-weight:700; font-family:var(--font-display); color:var(--text); }
.stat-mini__label { font-size:12px; color:var(--text-faint); }

/* ---- Kanban board ---- */
.kanban { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(220px,1fr); gap:12px; overflow-x:auto; padding-bottom:8px; }
.kanban__col { background:var(--surface-2); border:1px solid var(--border); border-radius:12px; min-width:220px; display:flex; flex-direction:column; }
.kanban__head { display:flex; align-items:center; justify-content:space-between; padding:11px 14px; border-bottom:1px solid var(--border); }
.kanban__title { font-size:13px; font-weight:700; }
.kanban__count { font-size:12px; font-weight:600; color:var(--text-faint); background:var(--surface); border-radius:20px; padding:1px 9px; }
.kanban__cards { padding:10px; display:grid; gap:9px; align-content:start; min-height:60px; }
.kanban__empty { text-align:center; color:var(--text-faint); font-size:18px; padding:8px; }
.cand-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:11px 12px; box-shadow:var(--shadow-sm); }
.cand-card__name { font-size:13.5px; font-weight:600; color:var(--text); display:block; }
.cand-card__name:hover { color:var(--thread); }
.cand-card__meta { display:flex; align-items:center; gap:7px; margin-top:6px; flex-wrap:wrap; }
.cand-card__rating { font-size:12px; color:var(--thread); font-weight:600; }
.cand-card__req { font-size:11px; color:var(--text-faint); margin-top:5px; font-family:var(--font-mono); }
.cand-card__move { margin-top:9px; width:100%; padding:5px 8px; font-size:12px; border:1px solid var(--border-strong); border-radius:7px; background:var(--surface-2); color:var(--text-soft); }
.cand-card__move:focus { outline:none; border-color:var(--thread); }

.seg-select { padding:6px 10px; font-size:12.5px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); }
.seg-select:focus { outline:none; border-color:var(--thread); }
.kv--block { flex-direction:column; align-items:flex-start; gap:5px; }
.kv--block .kv__v { text-align:left; }

/* ---- Progress bar ---- */
.progress { height:7px; background:var(--surface-2); border-radius:20px; overflow:hidden; border:1px solid var(--border); }
.progress--lg { height:10px; margin-bottom:14px; }
.progress__bar { height:100%; background:linear-gradient(90deg, var(--thread), #e6a155); border-radius:20px; transition:width .3s; }

/* ---- Onboarding list ---- */
.onboard-list { display:grid; gap:10px; }
.onboard-row { display:flex; align-items:center; gap:18px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 18px; box-shadow:var(--shadow-sm); }
.onboard-row:hover { border-color:var(--thread); }
.onboard-row__id { min-width:180px; }
.onboard-row__name { display:block; font-weight:600; font-size:14px; color:var(--text); }
.onboard-row__progress { flex:1; display:flex; align-items:center; gap:12px; }
.onboard-row__progress .progress { flex:1; }
.onboard-row__pct { font-size:12.5px; color:var(--text-soft); white-space:nowrap; font-weight:600; }

/* ---- Checklist ---- */
.checklist { list-style:none; margin:0; padding:0; display:grid; gap:2px; }
.checklist__item { display:flex; align-items:flex-start; gap:12px; padding:11px 4px; border-bottom:1px solid var(--border); }
.checklist__item:last-child { border-bottom:none; }
.checklist__check { position:relative; flex:none; cursor:pointer; padding-top:1px; }
.checklist__check input { position:absolute; opacity:0; width:0; height:0; }
.checklist__box { display:grid; place-items:center; width:20px; height:20px; border:2px solid var(--border-strong); border-radius:6px; color:#fff; transition:.15s; }
.checklist__box .ico { width:13px; height:13px; opacity:0; }
.checklist__check input:checked + .checklist__box { background:var(--teal,#0d9488); border-color:var(--teal,#0d9488); }
.checklist__check input:checked + .checklist__box .ico { opacity:1; }
.checklist__check input:disabled + .checklist__box { opacity:.5; }
.checklist__body { flex:1; display:flex; flex-direction:column; gap:2px; }
.checklist__title { font-size:13.5px; font-weight:500; }
.checklist__desc { font-size:12px; color:var(--text-faint); }
.checklist__item.is-done .checklist__title { text-decoration:line-through; color:var(--text-faint); }
.checklist__meta { display:flex; align-items:center; gap:8px; flex:none; }
.checklist__due { font-size:12px; color:var(--text-soft); }
.checklist__due.is-overdue { color:#c01540; font-weight:600; }

@media (max-width:680px){ .stat-row{grid-template-columns:repeat(2,1fr);} }

/* ============================= PHASE 4 COMPONENTS ======================= */

.date-input { padding:8px 12px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); font-size:14px; font-family:inherit; }
.date-input:focus { outline:none; border-color:var(--thread); box-shadow:0 0 0 3px rgba(217,131,36,.15); }
.text-warn { color:#a85d04; font-weight:600; }
.text-ok { color:#0c7a70; font-weight:600; }
[data-theme="dark"] .text-warn { color:#f5b860; }
[data-theme="dark"] .text-ok { color:#5ee0d0; }

/* ---- 6-up stat row + colored variants ---- */
.stat-row--6 { grid-template-columns:repeat(6,1fr); }
.stat-mini--ok { border-left:3px solid var(--teal,#0d9488); }
.stat-mini--warn { border-left:3px solid var(--thread); }
.stat-mini--danger { border-left:3px solid var(--rose,#e11d48); }

/* ---- Shift cards ---- */
.shift-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; margin-bottom:8px; }
.shift-time { font-size:20px; font-weight:700; font-family:var(--font-display); color:var(--thread); margin-bottom:8px; }
.shift-meta { display:flex; gap:12px; flex-wrap:wrap; font-size:12.5px; color:var(--text-soft); margin-bottom:8px; }
.shift-off { font-size:12.5px; color:var(--text-faint); display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.shift-card__actions { display:flex; gap:8px; margin-top:12px; padding-top:12px; border-top:1px solid var(--border); }

/* ---- Device cards ---- */
.device-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:14px; }
.device-sync { font-size:13px; color:var(--text-soft); margin-bottom:12px; }
.device-card__actions { display:flex; gap:8px; flex-wrap:wrap; padding-top:12px; border-top:1px solid var(--border); }

@media (max-width:900px){ .stat-row--6{grid-template-columns:repeat(3,1fr);} }
@media (max-width:560px){ .stat-row--6{grid-template-columns:repeat(2,1fr);} }

/* ============================= PHASE 5 COMPONENTS ======================= */

/* ---- Leave balance cards ---- */
.bal-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }
.bal-big { font-size:30px; font-weight:700; font-family:var(--font-display); margin-bottom:10px; }
.bal-big__unit { font-size:13px; font-weight:400; color:var(--text-faint); }
.bal-detail { display:flex; gap:14px; flex-wrap:wrap; margin-top:12px; font-size:12.5px; color:var(--text-soft); }
.bal-detail strong { color:var(--text); }

/* ---- Balance chips (snapshot row) ---- */
.bal-row { display:flex; gap:12px; flex-wrap:wrap; }
.bal-chip { display:flex; flex-direction:column; align-items:center; padding:10px 16px; border:1px solid var(--border); border-radius:11px; background:var(--surface-2); min-width:78px; }
.bal-chip__code { font-size:12px; font-weight:700; }
.bal-chip__num { font-size:22px; font-weight:700; font-family:var(--font-display); }
.bal-chip__label { font-size:10.5px; color:var(--text-faint); }

/* ---- Leave day breakdown list ---- */
.day-list { list-style:none; margin:0; padding:0; }
.day-list__item { display:flex; align-items:center; justify-content:space-between; padding:8px 2px; border-bottom:1px solid var(--border); font-size:13.5px; }
.day-list__item:last-child { border-bottom:none; }
.day-list__item.is-skip { opacity:.5; }
.day-list__tag { font-size:12px; color:var(--text-soft); }
.day-list__item.is-skip .day-list__tag { font-style:italic; }

/* ============================= PHASE 6 — PAYROLL ======================= */
.payslip { background:var(--surface); border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow:var(--shadow-sm); }
.payslip__head { display:flex; justify-content:space-between; align-items:center; padding:22px 24px; background:var(--surface-2); border-bottom:1px solid var(--border); }
.payslip__name { font-size:19px; font-weight:700; font-family:var(--font-display); }
.payslip__meta { font-size:13px; color:var(--text-faint); margin-top:3px; }
.payslip__net { text-align:right; }
.payslip__net-label { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-faint); }
.payslip__net-num { font-size:24px; font-weight:700; font-family:var(--font-display); color:var(--teal,#0d9488); }
.payslip__stats { display:flex; flex-wrap:wrap; gap:24px; padding:16px 24px; border-bottom:1px solid var(--border); font-size:13px; }
.payslip__stats > div { display:flex; flex-direction:column; gap:2px; }
.payslip__stats strong { font-size:15px; }
.payslip__cols { display:grid; grid-template-columns:1fr 1fr; gap:0; }
.payslip__col { padding:18px 24px; }
.payslip__col:first-child { border-right:1px solid var(--border); }
.payslip__col h4 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-faint); margin:0 0 10px; }
.payslip__table { width:100%; border-collapse:collapse; font-size:13.5px; }
.payslip__table td { padding:6px 0; border-bottom:1px solid var(--border); }
.payslip__table td.num { text-align:right; font-family:var(--font-mono); }
.payslip__table .payslip__total td { font-weight:700; border-bottom:none; border-top:2px solid var(--border-strong); padding-top:9px; }
.payslip__netbar { display:flex; justify-content:space-between; align-items:center; padding:16px 24px; background:var(--thread); color:#fff; font-weight:700; font-size:17px; font-family:var(--font-display); }
@media (max-width:600px){ .payslip__cols{grid-template-columns:1fr;} .payslip__col:first-child{border-right:none;border-bottom:1px solid var(--border);} }
@media print {
  /* hide all app chrome */
  .sidebar, .topbar, .tab-bar, .tabstrip, .appbar, .app-header, .topnav,
  .page__head, .btn, .icon-btn,
  .modal-root, .toast-wrap, .notify-dropdown { display:none !important; }

  /* force light, ink-on-paper rendering regardless of theme */
  :root, [data-theme], [data-theme="dark"] {
    --surface:#fff; --surface-2:#fff; --border:#ccc; --border-strong:#999;
    --text:#000; --text-soft:#333; --text-faint:#666; --thread:#000;
    --shadow-sm:none; --shadow-lg:none;
  }
  html, body, .app, .main, .content, .tab-panel, .page {
    background:#fff !important; color:#000 !important; margin:0 !important; padding:0 !important;
  }
  .page { max-width:none !important; }

  /* the payslip itself: clean bordered card */
  .payslip { box-shadow:none !important; border:1px solid #999 !important; background:#fff !important; color:#000 !important; page-break-inside:avoid; }
  .payslip__head { background:#fff !important; color:#000 !important; border-bottom:2px solid #000; }
  .payslip__name, .payslip__net-num { color:#000 !important; }
  .payslip__net-num { font-weight:700; }
  .payslip__stats { background:#fff !important; border-bottom:1px solid #ccc; }
  .payslip__table td { border-bottom:1px solid #eee; }
  .payslip__total td { border-top:1px solid #000; font-weight:700; }
  /* net pay footer bar in solid ink, keep its colour fill for emphasis */
  .payslip__netbar { -webkit-print-color-adjust:exact; print-color-adjust:exact; }

  /* bulk batch: one payslip per printed sheet (or N per page when set) */
  .pp-sheet { page-break-after:always; }
  .pp-sheet:last-child { page-break-after:auto; }
  @page { margin:14mm; }
}

/* ---- Weekly holiday picker (Leave Setup) ---- */
.weekday-picker { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.weekday-chip { display:flex; align-items:center; gap:7px; padding:8px 14px; border:1px solid var(--border-strong); border-radius:9px; cursor:pointer; font-size:13.5px; user-select:none; transition:.15s; }
.weekday-chip input { position:absolute; opacity:0; width:0; height:0; }
.weekday-chip:hover { border-color:var(--thread); }
.weekday-chip.is-on { background:var(--thread); border-color:var(--thread); color:#fff; font-weight:600; }
.weekday-actions { margin-top:6px; }
.form-hint { font-size:13px; color:var(--text-soft); line-height:1.5; margin:0 0 4px; max-width:680px; }

/* ============================= PHASE 7 — REPORTS ======================= */
/* Report hub cards */
.report-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
.report-card { display:flex; align-items:center; gap:16px; padding:20px; background:var(--surface); border:1px solid var(--border); border-radius:14px; text-decoration:none; color:inherit; box-shadow:var(--shadow-sm); transition:.15s; }
.report-card:hover { border-color:var(--thread); transform:translateY(-2px); box-shadow:var(--shadow-lg); }
.report-card__icon { display:grid; place-items:center; width:48px; height:48px; border-radius:12px; background:var(--surface-2); color:var(--thread); flex-shrink:0; }
.report-card__icon .ico { width:24px; height:24px; }
.report-card__body { flex:1; display:flex; flex-direction:column; gap:3px; }
.report-card__title { font-size:16px; font-weight:700; font-family:var(--font-display); }
.report-card__desc { font-size:12.5px; color:var(--text-soft); line-height:1.45; }
.report-card__arrow { color:var(--text-faint); transform:rotate(180deg); }
.report-card__arrow .ico { width:18px; height:18px; }

/* Two-column report layout */
.report-cols { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
@media (max-width:860px){ .report-cols{grid-template-columns:1fr;} }

/* Donut chart */
.chart-row { display:flex; align-items:center; gap:22px; flex-wrap:wrap; }
.chart-donut-wrap { flex-shrink:0; }
.chart-donut { width:160px; height:160px; }
.chart-donut__num { font-size:30px; font-weight:700; font-family:var(--font-display); fill:var(--text); }
.chart-donut__cap { font-size:11px; fill:var(--text-faint); text-transform:uppercase; letter-spacing:.05em; }
.chart-legend { list-style:none; margin:0; padding:0; flex:1; min-width:160px; }
.chart-legend__item { display:flex; align-items:center; gap:8px; padding:5px 0; font-size:13px; }
.chart-legend__dot { width:11px; height:11px; border-radius:3px; flex-shrink:0; }
.chart-legend__label { flex:1; }
.chart-legend__val { color:var(--text-soft); font-size:12px; }

/* Horizontal bars */
.hbars { display:flex; flex-direction:column; gap:11px; }
.hbar { display:grid; grid-template-columns:120px 1fr auto; align-items:center; gap:12px; font-size:13px; }
.hbar__label { color:var(--text-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hbar__track { background:var(--surface-2); border-radius:6px; height:14px; overflow:hidden; }
.hbar__fill { display:block; height:100%; border-radius:6px; transition:width .4s ease; }
.hbar__val { font-family:var(--font-mono); font-size:12px; min-width:40px; text-align:right; }

/* Vertical columns */
.vcols { display:flex; align-items:flex-end; gap:14px; height:calc(var(--vcol-h) + 44px); padding-top:8px; }
.vcol { flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end; }
.vcol__val { font-size:11px; font-family:var(--font-mono); color:var(--text-soft); }
.vcol__bar-wrap { width:100%; max-width:46px; height:var(--vcol-h); display:flex; align-items:flex-end; }
.vcol__bar { width:100%; border-radius:6px 6px 0 0; transition:height .4s ease; min-height:2px; }
.vcol__label { font-size:11px; color:var(--text-faint); white-space:nowrap; }

/* Leave utilisation rows */
.util-row { display:grid; grid-template-columns:140px 1fr auto; align-items:center; gap:12px; padding:7px 0; font-size:13px; }
.util-row__label { color:var(--text-soft); }
.util-row__track { background:var(--surface-2); border-radius:6px; height:12px; overflow:hidden; }
.util-row__fill { display:block; height:100%; background:var(--teal,#0d9488); border-radius:6px; transition:width .4s ease; }
.util-row__val { font-family:var(--font-mono); font-size:12px; }

/* ---- Employee photo (profile avatar) ---- */
.profile-avatar { position:relative; overflow:visible; }
.profile-avatar--photo { background:transparent; }
.profile-avatar img { width:64px; height:64px; border-radius:16px; object-fit:cover; display:block; }
.profile-avatar__edit { position:absolute; right:-6px; bottom:-6px; width:26px; height:26px; border-radius:50%; border:2px solid var(--surface); background:var(--thread); color:#fff; display:grid; place-items:center; cursor:pointer; padding:0; box-shadow:var(--shadow-sm); }
.profile-avatar__edit .ico { width:13px; height:13px; }
.profile-avatar__edit:hover { filter:brightness(1.05); }
.profile-avatar__edit.is-loading { opacity:.5; pointer-events:none; }
/* employee list thumbnail */
.emp-thumb { width:32px; height:32px; border-radius:8px; object-fit:cover; vertical-align:middle; }
.emp-thumb--initial { display:inline-grid; place-items:center; background:var(--indigo); color:#fff; font-size:13px; font-weight:700; }

/* ---- Phase 10: admin (roles matrix, audit filters) ---- */
.perm-module { border:1px solid var(--border); border-radius:10px; margin-bottom:12px; overflow:hidden; }
.perm-module__head { display:flex; align-items:center; justify-content:space-between; padding:9px 14px; background:var(--surface-2); }
.perm-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:6px 16px; padding:12px 14px; }
.perm-chk { display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.perm-chk code { font-size:11px; }
.filter-bar { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.text-input { padding:7px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:13.5px; min-width:240px; background:var(--surface); color:var(--text); }
.pager { display:flex; align-items:center; gap:14px; justify-content:center; margin-top:14px; }
.pager__info { font-size:13px; color:var(--text-soft); }
.modal-chkgroup { display:flex; flex-wrap:wrap; gap:6px 14px; padding:4px 0; }
.modal-chk { display:flex; align-items:center; gap:6px; font-size:13.5px; cursor:pointer; }

/* ---- Bulk payslip picker ---- */
.batch-per { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-soft); }
.batch-toolbar { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; margin-bottom:14px; }
.batch-chk { display:flex; align-items:center; gap:8px; cursor:pointer; }
.batch-chk h3 { margin:0; }
.batch-group { margin-bottom:14px; }
.batch-dept { border:1px solid var(--border); border-radius:8px; margin-bottom:10px; overflow:hidden; }
.batch-dept__head { padding:8px 12px; background:var(--surface-2); font-weight:600; font-size:13.5px; }
.batch-emps { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:2px 14px; padding:8px 12px; }
.batch-emp { display:flex; align-items:center; gap:8px; font-size:13px; padding:4px 0; cursor:pointer; }
.batch-emp__name { flex:1; }
.batch-emp__net { font-family:var(--font-mono); font-size:12px; color:var(--text-soft); }

/* ---- Employee master photo thumbnail (inline upload) ---- */
.emp-thumb-btn { padding:0; border:none; background:none; cursor:pointer; display:inline-flex; border-radius:8px; position:relative; }
.emp-thumb-btn:hover .emp-thumb { outline:2px solid var(--thread); outline-offset:1px; }
.emp-thumb-btn:hover::after { content:''; position:absolute; inset:0; border-radius:8px; background:rgba(0,0,0,.18); }

/* ---- Employee Self-Service ---- */
.ess-hero { display:flex; align-items:center; gap:18px; padding:20px 22px; background:linear-gradient(120deg, var(--thread), #b86a18); color:#fff; border-radius:16px; -webkit-print-color-adjust:exact; }
.ess-hero__avatar { width:64px; height:64px; border-radius:50%; overflow:hidden; flex:none; background:rgba(255,255,255,.2); display:grid; place-items:center; font-size:26px; font-weight:700; }
.ess-hero__avatar img { width:64px; height:64px; object-fit:cover; }
.ess-hero__info h1 { margin:0; font-size:22px; }
.ess-hero__info p { margin:4px 0 0; opacity:.92; font-size:13px; }
.ess-hero__info code { background:rgba(255,255,255,.18); color:#fff; padding:1px 6px; border-radius:5px; }
.ess-links { display:flex; flex-direction:column; gap:8px; }
.ess-link { display:flex; align-items:center; gap:10px; padding:11px 14px; border:1px solid var(--border); border-radius:10px; text-decoration:none; color:inherit; font-size:14px; transition:.15s; }
.ess-link:hover { border-color:var(--thread); background:var(--surface-2); }
.ess-link .ico { width:18px; height:18px; color:var(--thread); }
.bal-card__chips { display:flex; gap:5px; flex-wrap:wrap; margin-top:6px; justify-content:center; }

/* ---- Device setup guide ---- */
.guide-flow { display:flex; align-items:stretch; gap:8px; flex-wrap:wrap; }
.guide-flow__step { display:flex; gap:10px; align-items:flex-start; flex:1; min-width:180px; padding:12px; background:var(--surface-2); border-radius:10px; }
.guide-flow__n { flex:none; width:24px; height:24px; border-radius:50%; background:var(--thread); color:#fff; display:grid; place-items:center; font-size:13px; font-weight:700; }
.guide-flow__step p { margin:3px 0 0; font-size:12px; color:var(--text-soft); line-height:1.45; }
.guide-flow__step strong { font-size:13.5px; }
.guide-flow__arrow { display:flex; align-items:center; color:var(--text-faint); font-size:18px; }
.guide-p { font-size:13.5px; line-height:1.6; color:var(--text-soft); margin:0 0 12px; }
.guide-h { font-size:13px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); margin:16px 0 6px; }
.guide-ol, .guide-ul { font-size:13.5px; line-height:1.7; color:var(--text-soft); margin:0 0 12px; padding-left:20px; }
.guide-ol li, .guide-ul li { margin-bottom:5px; }
.guide-code { background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:12px 14px; font-family:var(--font-mono); font-size:12.5px; line-height:1.5; overflow-x:auto; color:var(--text); white-space:pre; margin:0 0 8px; }
@media (max-width:760px){ .guide-flow__arrow { display:none; } }

/* ---- Formula builder (salary components) ---- */
.formula-builder { border:1px solid var(--border); border-radius:10px; padding:12px; background:var(--surface-2); }
.formula-builder__pad { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:10px; }
.formula-builder__group { display:inline-flex; gap:5px; flex-wrap:wrap; }
.fb-tok { padding:5px 11px; border:1px solid var(--border-strong); border-radius:7px; background:var(--surface); color:var(--text); font-family:var(--font-mono); font-size:12.5px; cursor:pointer; font-weight:600; }
.fb-tok:hover { border-color:var(--thread); color:var(--thread); }
.fb-op { min-width:34px; text-align:center; font-size:14px; }
#formulaInput { width:100%; padding:9px 12px; border:1px solid var(--border-strong); border-radius:8px; font-family:var(--font-mono); font-size:14px; background:var(--surface); color:var(--text); }
.formula-builder__preview { margin-top:8px; font-size:13px; min-height:18px; font-family:var(--font-mono); }
.formula-builder__preview.is-ok { color:var(--ok, #198754); }
.formula-builder__preview.is-err { color:var(--danger, #dc3545); }
.formula-builder__help { margin-top:10px; line-height:1.6; }
.formula-builder__help code { background:var(--surface); padding:1px 5px; border-radius:4px; font-size:12px; }

/* ---- Salary template add-list ---- */
.tpl-add-list { display:flex; flex-direction:column; gap:6px; }
.tpl-add-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 12px; border:1px solid var(--border); border-radius:8px; background:var(--surface); cursor:pointer; text-align:left; font-size:13.5px; color:var(--text); }
.tpl-add-item:hover { border-color:var(--thread); background:var(--surface-2); }

/* ---- Vehicle capacity bar ---- */
.cap-bar { width:90px; height:6px; background:var(--surface-2); border:1px solid var(--border); border-radius:4px; overflow:hidden; display:inline-block; vertical-align:middle; margin-right:6px; }
.cap-bar__fill { height:100%; background:var(--thread); }
.cap-bar__fill.is-full { background:var(--danger, #dc3545); }

/* ---- Settings grid ---- */
.settings-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }

/* ---- Manual attendance grid ---- */
.grid-att select.g-status, .grid-att input { padding:5px 7px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--text); font-size:13px; }
.grid-att input[type=time] { width:110px; }
.grid-att input.g-rem { width:100%; min-width:120px; }
.grid-att tr.is-manual-row td:first-child { border-left:2px solid var(--indigo, #6366f1); }

/* ---- Redesigned dashboard ---- */
.dash-hero { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:22px 24px; background:linear-gradient(120deg,var(--thread),#b86a18); color:#fff; border-radius:16px; margin-bottom:18px; flex-wrap:wrap; -webkit-print-color-adjust:exact; }
.dash-hero__title { margin:0; font-size:24px; }
.dash-hero__sub { margin:4px 0 0; opacity:.9; font-size:13px; }
.dash-hero__big { text-align:right; }
.dash-hero__num { display:block; font-size:38px; font-weight:800; line-height:1; }
.dash-hero__lbl { font-size:12.5px; opacity:.92; }
.dash-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:16px; }
.dash-kpi { display:flex; align-items:center; gap:14px; padding:16px 18px; background:var(--surface); border:1px solid var(--border); border-radius:14px; text-decoration:none; color:inherit; transition:.15s; }
.dash-kpi:hover { border-color:var(--thread); transform:translateY(-1px); }
.dash-kpi__icon { width:44px; height:44px; border-radius:11px; display:grid; place-items:center; flex:none; }
.dash-kpi__icon .ico { width:22px; height:22px; }
.dash-kpi__icon--ok { background:color-mix(in srgb,var(--ok) 16%,transparent); color:var(--ok); }
.dash-kpi__icon--warn { background:color-mix(in srgb,var(--warn) 16%,transparent); color:var(--warn); }
.dash-kpi__icon--indigo { background:color-mix(in srgb,var(--indigo) 16%,transparent); color:var(--indigo); }
.dash-kpi__icon--danger { background:color-mix(in srgb,var(--danger) 16%,transparent); color:var(--danger); }
.dash-kpi__num { font-size:26px; font-weight:700; line-height:1; }
.dash-kpi__of { font-size:15px; font-weight:500; color:var(--text-soft); }
.dash-kpi__lbl { font-size:12.5px; color:var(--text-soft); margin-top:3px; }
.dash-bar, .dash-gender__bar { display:flex; height:14px; border-radius:7px; overflow:hidden; background:var(--surface-2); margin-bottom:12px; }
.dash-bar__seg { height:100%; }
.dash-legend { display:flex; flex-wrap:wrap; gap:14px; font-size:12.5px; color:var(--text-soft); }
.dash-legend b { color:var(--text); font-size:14px; }
.dash-dept { margin-top:16px; display:flex; flex-direction:column; gap:8px; }
.dash-dept__row { display:flex; align-items:center; gap:10px; font-size:13px; }
.dash-dept__name { width:110px; flex:none; color:var(--text-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-dept__track { flex:1; height:8px; background:var(--surface-2); border-radius:5px; overflow:hidden; }
.dash-dept__fill { display:block; height:100%; background:var(--thread); border-radius:5px; }
.dash-dept__num { width:40px; text-align:right; font-weight:600; }
.dash-feed { list-style:none; margin:0; padding:0; }
.dash-feed__item { display:flex; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.dash-feed__item:last-child { border-bottom:0; }
.dash-feed__dot { width:8px; height:8px; border-radius:50%; background:var(--thread); margin-top:6px; flex:none; }
.dash-feed__desc { font-size:13.5px; }
.dash-feed__meta { font-size:11.5px; color:var(--text-faint); margin-top:2px; }

/* ---- Typeahead (searchable picker) ---- */
.typeahead { display:flex; flex-direction:column; }
.typeahead .text-input { width:100%; }
.typeahead__results { position:absolute; top:100%; left:0; right:0; z-index:30; background:var(--surface); border:1px solid var(--border-strong); border-radius:9px; margin-top:4px; max-height:280px; overflow-y:auto; box-shadow:0 8px 24px rgba(0,0,0,.18); }
.typeahead__item { display:block; width:100%; text-align:left; padding:9px 12px; background:none; border:0; border-bottom:1px solid var(--border); color:var(--text); font-size:13.5px; cursor:pointer; font-family:var(--font-mono); }
.typeahead__item:last-child { border-bottom:0; }
.typeahead__item:hover { background:var(--surface-2); color:var(--thread); }
.typeahead__empty { padding:10px 12px; color:var(--text-faint); font-size:13px; }

/* ---- Star rating control ---- */
.star-rate{display:inline-flex;gap:2px}
.star-rate .star{background:none;border:0;cursor:pointer;font-size:20px;line-height:1;color:var(--border-strong);padding:0 1px;transition:color .1s}
.star-rate .star.is-on{color:#f5a623}
.star-rate .star:hover{color:#f5a623}

/* ---- Employee CSV import ---- */
.import-drop{border:2px dashed var(--border-strong);border-radius:12px;padding:32px;text-align:center;cursor:pointer;transition:.15s;margin-top:14px;}
.import-drop.is-over{border-color:var(--thread);background:var(--surface-2);}
.import-drop__ico{width:34px;height:34px;color:var(--text-faint);margin-bottom:8px;}
.import-drop p{margin:6px 0 12px;color:var(--text-soft);font-size:13.5px;}
.import-ok{background:color-mix(in srgb,var(--ok) 12%,transparent);color:var(--ok);padding:10px 14px;border-radius:8px;font-size:14px;margin-bottom:8px;}
.import-err{background:color-mix(in srgb,var(--danger) 12%,transparent);color:var(--danger);padding:10px 14px;border-radius:8px;font-size:14px;}
.import-errs{margin:8px 0 0;padding-left:18px;font-size:12.5px;color:var(--warn);max-height:200px;overflow-y:auto;}
.import-errs li{margin:3px 0;}

/* ---- Workflow step editor ---- */
.wf-step{position:relative;}
.wf-step__actions{position:absolute;right:0;top:0;display:flex;gap:2px;opacity:0;transition:.12s;}
.wf-step:hover .wf-step__actions{opacity:1;}
.js-step-add{margin-top:8px;}

/* ---- NID scan: highlight auto-filled fields ---- */
.field-filled{background:color-mix(in srgb,var(--thread,#d98324) 9%,#fff);border-color:color-mix(in srgb,var(--thread,#d98324) 45%,#fff)!important}
[data-theme="dark"] .field-filled{background:color-mix(in srgb,#d98324 18%,transparent)}

/* ---- Payslip print header/footer (screen-hidden, print-shown) ---- */
.payslip__brand, .payslip__foot, .payslip__genline { display:none; }
.payslip__brand{ align-items:center; gap:16px; padding:16px 20px; border-bottom:2px solid #000; }
.payslip__logo{ max-height:54px; max-width:150px; }
.payslip__brandtext{ flex:1; }
.payslip__company{ font-size:18px; font-weight:800; }
.payslip__addr{ font-size:11px; color:#444; }
.payslip__doctitle{ text-align:right; font-size:15px; font-weight:800; letter-spacing:.05em; }
.payslip__period{ font-size:11px; font-weight:600; color:#444; letter-spacing:0; }
.payslip__foot{ justify-content:space-between; gap:24px; padding:34px 24px 12px; }
.payslip__sign{ flex:1; text-align:center; }
.payslip__sign span{ display:block; border-top:1px solid #000; padding-top:5px; font-size:11px; }
.payslip__genline{ text-align:center; font-size:10px; color:#777; padding:6px 0 14px; }

@media print {
  .no-print{ display:none !important; }
  .payslip__brand{ display:flex !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .payslip__foot{ display:flex !important; }
  .payslip__genline{ display:block !important; }
  /* a little breathing room and a clean single-card layout */
  .payslip{ margin:0 !important; }
  @page { margin:14mm; }
}

/* ---- Employee academic rows ---- */
.form-sect__hint{color:var(--text-faint);font-size:13px;margin:0 0 12px}
.acad-rows{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}
.acad-row{display:grid;grid-template-columns:1fr 1.3fr 1.3fr 1fr 0.8fr 0.6fr auto;gap:6px;align-items:center}
.acad-row .acad-sm{min-width:0}
.acad-row .text-input{padding:7px 9px;font-size:13px}
@media(max-width:900px){.acad-row{grid-template-columns:1fr 1fr;}}

/* ---- Document view link on profile ---- */
.doc-item__view{margin-left:10px;font-size:12px;font-weight:600;color:var(--thread,#d98324)}
