/* =====================================================================
   OmniPeople HR Insights Platform — Environmental Protection Agency, Ghana
   ===================================================================== */

:root {
  /* EPA Ghana palette, sampled from the Agency emblem. Legacy token names are
     retained so every module inherits the new theme without page-level overrides. */
  --epa-green-900: #004b13;
  --epa-green-700: #006b15;
  --epa-green-600: #138a2a;
  --epa-gold:      #f0a302;
  --epa-aqua:      #2f9db8;
  --teal-900: var(--epa-green-900);
  --teal-700: var(--epa-green-700);
  --teal-600: var(--epa-green-600);
  --mint:     #ffd777;
  --teal-100: #cfe7d3;
  --teal-50:  #f0f8f1;
  --navy-900: #123b20;
  --navy-800: #174b29;
  --navy-700: #2e6640;
  --ink:      #213028;
  --muted:    #6b7280;
  --line:     #dce5da;
  --bg:       #f5f8f3;
  --card:     #ffffff;
  --amber:    var(--epa-gold);
  --red:      #dc2626;
  --green:    var(--epa-green-600);
  --blue:     var(--epa-aqua);
  --radius:   12px;
  --shadow:   0 1px 3px rgba(18, 59, 32, .09), 0 1px 2px rgba(18, 59, 32, .05);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 15px; overflow-x: hidden; }
body { min-width: 320px; font-family: var(--font); background: var(--bg); color: var(--ink); overflow-x: clip; }
img, svg { max-width: 100%; }
button, input, select, textarea { touch-action: manipulation; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------ Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background-color: var(--navy-900);
  background-image: linear-gradient(180deg, rgba(0,75,19,.97) 0%, rgba(18,59,32,.99) 100%), url('../img/brand-pattern.svg');
  background-size: auto, 320px 320px;
  background-position: center, right top;
  background-attachment: fixed, scroll;
  color: #cbd5e1; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 8px; align-items: flex-start; flex-direction: column; padding: 18px 16px 14px; }
.brand-logo { width: 68px; height: 68px; object-fit: contain; flex-shrink: 0; display: block; }
.brand-name { font-weight: 750; color: #fff; font-size: 1.08rem; letter-spacing: -.25px; }
.brand-name span { color: var(--mint); }
.brand-sub  { font-size: .72rem; color: #b6ccb9; }
.sidebar-close, .sidebar-backdrop { display: none; }

.nav { flex: 1; padding: 4px 10px 10px; }
.nav-section {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
  color: #9fbea4; margin: 16px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: #d4e2d6;
  font-size: .9rem; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(240,163,2,.18); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--epa-gold); }
.nav-icon { width: 20px; text-align: center; opacity: .85; }
.nav-count {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 99px;
  font-size: .68rem; font-weight: 700; padding: 1px 7px;
}

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.userchip { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--epa-gold); color: var(--navy-900); font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.userchip-name { font-size: .85rem; color: #fff; font-weight: 600; }
.userchip-role { font-size: .7rem; color: #b6ccb9; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(18,59,32,.04);
  padding: 14px 26px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.page-title { min-width: 0; font-size: 1.15rem; font-weight: 700; color: var(--navy-900); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.18); display: inline-block; }
.hamburger { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--navy-900); }

.content { padding: 24px 26px 40px; flex: 1; }
.app-foot {
  padding: 12px 26px; font-size: .72rem; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--card);
}

/* ------------------------------------------------------------- Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 20px;
}
.card-title {
  font-size: .95rem; font-weight: 700; color: var(--navy-900);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px;
}
.card-sub { font-size: .78rem; color: var(--muted); margin-bottom: 12px; }

/* Surface levels. .card carries the page's data; .panel is a flat secondary
   group (forms, lists of records); .aside is quiet reference text. Spending
   border, fill and shadow by role keeps one thing per view in front. */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.aside { border-left: 3px solid var(--teal-600); padding: 4px 0 4px 16px; margin-bottom: 20px; color: var(--ink); }
.aside .card-title { font-size: .88rem; margin-bottom: 2px; }
.aside .card-sub { margin-bottom: 8px; }
.aside ul { margin: 0; padding-left: 18px; font-size: .84rem; line-height: 1.65; color: var(--ink-2, #3e5366); }
.aside li + li { margin-top: 4px; }
.list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head .card-title, .list-head .card-sub { margin-bottom: 2px; }
.list-head .inline-actions { flex-wrap: wrap; }
.record-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.record-row:first-of-type { border-top: 0; }
.record-row .emp-sub { margin-top: 2px; }
.nowrap-cell { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
/* Inline statistics for a tab or list: one quiet row instead of a second band of KPI tiles */
.stat-strip { display: flex; flex-wrap: wrap; gap: 6px 28px; padding: 10px 0 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.stat-strip .stat { display: grid; gap: 1px; }
.stat-strip .stat-label { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-strip .stat-value { font-size: 1.05rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-strip .stat-value .badge { font-weight: 600; }
.stat-strip .stat-note { font-size: .74rem; color: var(--muted); }
/* Appraisal templates: competencies as a flat grid under the template line, not nested cards */
.competency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; margin: 8px 0 4px; }
.competency-grid > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.competency-grid strong { font-weight: 600; color: var(--navy-900); }
.competency-grid small { grid-column: 1 / -1; color: var(--muted); font-size: .76rem; }
.competency-grid .weight { font-variant-numeric: tabular-nums; color: var(--teal-700); font-weight: 700; }
.template-row { padding: 14px 0; border-top: 1px solid var(--line); }
.template-row:first-of-type { border-top: 0; padding-top: 4px; }
.template-row .list-head { margin-bottom: 0; }
/* Payroll periods list: the period being viewed is tinted */
table.periods-table tr.is-selected td { background: var(--teal-50, #f0f8f1); }
/* Reports: catalogue rows and the rendered report as one document-like card */
table.report-catalogue td:first-child a { color: var(--navy-900); }
.report-body .report-kpis { padding-top: 4px; }
.report-section { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.report-section:first-of-type { border-top: 0; padding-top: 6px; }
.report-body .report-kpis + .report-section { border-top: 0; }
.report-section h3 { margin: 0 0 8px; font-size: .95rem; color: var(--navy-900); }
.report-notes { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.report-filters { padding-top: 12px; border-top: 1px solid var(--line); }
/* Data-feed catalogue */
table.import-catalogue .feed-columns { font-family: var(--mono, ui-monospace, monospace); font-size: .7rem; letter-spacing: 0; line-height: 1.5; max-width: 520px; }
table.import-catalogue td:first-child:not(.td-select),
table.import-catalogue td.td-select + td { min-width: 260px; }
table.data.table-dense th, table.data.table-dense td { padding: 7px 10px; }
table.data.table-dense td { font-variant-numeric: tabular-nums; }
table.data tr.row-group td { background: var(--cloud, #f3f6f8); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.form-modal { width: min(720px, 100%); padding: 24px; }
.form-modal .modal-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.form-modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.form-modal .form-row:last-of-type { margin-bottom: 0; }
@media (max-width: 600px) { .form-modal { padding: 16px; } }

/* Strategy cascade rendered as an outline rather than nested boxes */
.cascade-pillar { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 0 6px; margin-top: 8px; border-top: 1px solid var(--line); }
.cascade-pillar:first-of-type { border-top: 0; margin-top: 0; }
.cascade-pillar h3 { margin: 0; font-size: 1rem; color: var(--navy-900); }
.cascade-pillar .cascade-score { margin-left: auto; }
.cascade-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 8px 0 8px 6px; }
.cascade-row + .cascade-row { border-top: 1px dashed var(--line); }
.cascade-row .cascade-level { align-self: center; justify-self: start; }
.cascade-row .cascade-title { font-weight: 600; color: var(--navy-900); }
.cascade-row .cascade-meta { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.cascade-row .cascade-score { justify-self: end; align-self: center; white-space: nowrap; }
/* Split-button style menu (Download → CSV / Excel / PDF): a <details> so it needs no script. */
details.btn-menu { position: relative; display: inline-block; }
details.btn-menu > summary { list-style: none; cursor: pointer; white-space: nowrap; }
details.btn-menu > summary::-webkit-details-marker { display: none; }
details.btn-menu > summary::after { content: ' ▾'; font-size: .7em; opacity: .75; }
details.btn-menu > summary.btn-icon { width: auto; padding: 0 6px 0 7px; gap: 1px; }
details.btn-menu > summary.btn-icon::after { font-size: .55em; }
details.btn-menu > .btn-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 140px; display: flex; flex-direction: column; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 36, 56, .14); }
details.btn-menu > .btn-menu-list a { display: block; padding: 7px 10px; border-radius: 6px; font-size: .78rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
details.btn-menu > .btn-menu-list a:hover, details.btn-menu > .btn-menu-list a:focus { background: var(--teal-50); color: var(--teal-700); }
details.cascade-branch { margin: 0 0 0 24px; }
details.cascade-branch > summary { cursor: pointer; list-style: none; font-size: .8rem; color: var(--teal-700); font-weight: 600; padding: 6px 0; }
details.cascade-branch > summary::-webkit-details-marker { display: none; }
details.cascade-branch > summary::before { content: '▸ '; color: var(--muted); }
details.cascade-branch[open] > summary::before { content: '▾ '; }
details.cascade-branch .cascade-row { grid-template-columns: 140px minmax(0, 1fr) auto; }
.cascade-kpi-row { margin: 4px 0 8px 12px; padding: 8px 12px; border-left: 2px solid var(--line); font-size: .82rem; }
.cascade-kpi-row .emp-sub { margin-top: 2px; }
.cascade-gap { font-size: .78rem; color: var(--gold, #b45309); padding: 4px 0 4px 6px; }
@media (max-width: 640px) {
  .cascade-row, details.cascade-branch .cascade-row { grid-template-columns: 1fr auto; }
  .cascade-row .cascade-level { grid-column: 1 / -1; }
}

.grid { display: grid; gap: 18px; margin-bottom: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid .card { margin-bottom: 0; min-width: 0; }
.span-2 { grid-column: span 2; }

/* ---------------------------------------------------------- KPI tiles */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--navy-900); line-height: 1.2; }
.kpi-delta { font-size: .78rem; font-weight: 600; }
.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.flat { color: var(--muted); }

/* -------------------------------------------------------------- Badges */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 700;
}
.badge-low      { background: #dcfce7; color: #166534; }
.badge-moderate { background: #fef9c3; color: #854d0e; }
.badge-high     { background: #ffedd5; color: #c2410c; }
.badge-critical { background: #fee2e2; color: #b91c1c; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-warning  { background: #fef3c7; color: #b45309; }
.badge-neutral  { background: #f1f5f9; color: #475569; }
.badge-positive { background: #dcfce7; color: #166534; }
.badge-negative { background: #fee2e2; color: #b91c1c; }

/* -------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th {
  text-align: left; padding: 9px 12px; color: var(--muted);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--teal-50); }
.emp-cell { display: flex; align-items: center; gap: 10px; }
.emp-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--navy-700); color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.emp-name { font-weight: 600; color: var(--navy-900); }
.emp-sub { font-size: .74rem; color: var(--muted); }

.sort-button {
  appearance: none; border: 0; background: transparent; color: inherit;
  display: inline-flex; align-items: center; gap: 5px; padding: 0;
  font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer;
}
.sort-button:hover { color: var(--teal-700); }
.sort-mark { font-size: .78rem; opacity: .65; }
.server-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.server-sort:hover { color: var(--teal-700); text-decoration: none; }
.data-toolbar, .data-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 520px;
}
.data-toolbar { margin-bottom: 10px; }
.data-footer { margin-top: 12px; }
.data-search { flex: 1; max-width: 360px; }
.data-search input[type=search] {
  width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: .84rem; color: var(--ink); background: #fff;
}
.data-search input[type=search]:focus {
  outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(19,138,42,.16);
}
.data-page-size { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; }
.data-page-size select { width: auto; min-width: 66px; padding: 7px 26px 7px 9px; }
.data-count, .data-pager { font-size: .78rem; color: var(--muted); }
.data-pager { display: flex; align-items: center; gap: 8px; }
.data-pager .btn:disabled { cursor: not-allowed; opacity: .45; filter: none; }
.data-footer.single-page .data-pager { display: none; }

/* --------------------------------------------------------------- Tabs */
.tabs { margin-bottom: 20px; }
.tab-list {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px;
  margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #e8eef1; scrollbar-width: thin;
}
.tab-button {
  flex: 0 0 auto; border: 0; border-radius: 7px; padding: 9px 14px;
  background: transparent; color: var(--muted); font: inherit; font-size: .84rem;
  font-weight: 650; cursor: pointer;
}
.tab-button:hover { color: var(--navy-900); background: rgba(255,255,255,.55); }
.tab-button.active { color: var(--teal-900); background: #fff; box-shadow: var(--shadow); }
.tab-button:focus-visible { outline: 3px solid rgba(19,138,42,.25); outline-offset: 1px; }
.tab-panel[hidden] { display: none !important; }
.tab-panel > :last-child { margin-bottom: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------- Forms */
.form-row { margin-bottom: 14px; }
label.form-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 5px; color: var(--navy-800); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=time], input[type=tel], input[type=url],
input[type=search], input[type=month], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-family: var(--font); font-size: .9rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(19,138,42,.16);
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .form-row { margin-bottom: 0; min-width: 160px; }
.directory-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.directory-head .card-title { margin-bottom: 3px; }

/* -------------------------------------------------------- Modal wizard */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(10, 28, 45, .62); backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none !important; }
.modal-panel {
  width: min(780px, 100%); max-height: calc(100vh - 44px); overflow-y: auto;
  background: var(--card); border-radius: 16px; box-shadow: 0 24px 80px rgba(8, 27, 45, .28);
}
.onboarding-modal { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.modal-head h2 { margin: 0; color: var(--navy-900); font-size: 1.25rem; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.modal-close {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--muted); font-size: 1.35rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.payroll-modal {
  width: min(1060px, 100%); padding: 24px;
}
.payroll-modal .modal-head {
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.payroll-modal-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: start;
}
.payroll-modal .card {
  margin-bottom: 0; box-shadow: none; background: #f8fafc; border: 1px solid var(--line);
}
@media (max-width: 900px) {
  .payroll-modal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .payroll-modal { padding: 16px; }
}
.wizard-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none;
  margin: 22px 0; padding: 0;
}
.wizard-steps li {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px;
  background: #f1f5f9; color: var(--muted); font-size: .78rem; font-weight: 700;
}
.wizard-steps li span {
  width: 23px; height: 23px; flex: 0 0 auto; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 50%; background: #cbd5e1; color: #fff;
}
.wizard-steps li.active { background: var(--teal-50); color: var(--teal-900); }
.wizard-steps li.active span { background: var(--teal-700); }
.wizard-steps li.complete { color: #047857; background: #ecfdf5; }
.wizard-steps li.complete span { background: #10b981; }
.wizard-section-title { color: var(--navy-900); font-weight: 750; margin-bottom: 12px; }
.onboarding-grid { gap: 0 18px; }
.form-hint { margin-top: 4px; color: var(--muted); font-size: .69rem; }
input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
input.is-invalid + .form-hint[data-limit-hint] { color: var(--red); }
.field-error { margin-top: 4px; color: var(--red); font-size: .72rem; font-weight: 650; }
input.input-invalid, select.input-invalid { border-color: #ef4444; background: #fff7f7; }
.onboarding-review { margin-top: 6px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.onboarding-review dl { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 22px; }
.onboarding-review dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #e8edf1; }
.onboarding-review dt { color: var(--muted); font-size: .74rem; }
.onboarding-review dd { margin: 0; color: var(--navy-900); font-size: .77rem; font-weight: 650; text-align: right; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.wizard-actions-right { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.wizard-actions [hidden] { display: none !important; }

/* -------------------------------------------------- Employee lifecycle */
.employment-timeline { margin-top: 18px; }
.employment-event { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding-bottom: 18px; }
.employment-event:not(:last-child)::before {
  content: ''; position: absolute; left: 7px; top: 15px; bottom: 0; width: 2px; background: #dbe4e8;
}
.employment-event-marker {
  position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 2px; border: 3px solid var(--teal-100);
  border-radius: 50%; background: var(--teal-700);
}
.employment-event-body { min-width: 0; }
.employment-event-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.employment-event-head strong { color: var(--navy-900); font-size: .9rem; }
.employment-event-body p { margin: 6px 0; color: var(--ink); font-size: .82rem; }
.lifecycle-form-grid { gap: 0 18px; margin-bottom: 0; }
.lifecycle-action-tabs { margin-top: 16px; margin-bottom: 0; }
.inline-actions { display: inline-flex; gap: 5px; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: .87rem; font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-primary { background: var(--teal-700); color: #fff; box-shadow: 0 2px 5px rgba(0,107,21,.22); }
.btn-secondary { background: var(--navy-800); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #cbd5e1; }
/* Ghost buttons are designed for the dark sidebar; on light content surfaces they need ink. */
.content .btn-ghost, .modal-panel .btn-ghost { color: var(--navy-800); border-color: transparent; }
.content .btn-ghost:hover, .modal-panel .btn-ghost:hover { background: var(--cloud, #f3f6f8); border-color: var(--line); filter: none; }
.btn-outline { background: #fff; border-color: #d1d5db; color: var(--navy-800); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .78rem; }

/* Submit-in-progress state (set by app.js on the button that sent the form) */
.btn { --spinner: #fff; }
.btn-outline { --spinner: var(--teal-700); }
.btn-ghost { --spinner: #cbd5e1; }
.btn.is-loading, button.is-loading {
  position: relative; color: transparent !important; pointer-events: none; cursor: progress;
}
.btn.is-loading::after, button.is-loading::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid transparent; border-top-color: var(--spinner); border-left-color: var(--spinner);
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}
.btn-sm.is-loading::after { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- Icon actions
   Row/record actions are icon-only buttons: icon_btn() / icon_link() in helpers.php.
   The label is the tooltip (title) and the accessible name (aria-label). */
.icon { width: 1em; height: 1em; vertical-align: -0.15em; flex: 0 0 auto; }
.btn .icon { width: 1.05em; height: 1.05em; margin-right: 6px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--navy-800);
  cursor: pointer; vertical-align: middle; font-family: var(--font); line-height: 1; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s; --spinner: var(--teal-700);
}
.btn-icon .icon { width: 17px; height: 17px; pointer-events: none; }
.btn-icon:hover, .btn-icon:focus-visible { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); text-decoration: none; outline: none; }
.btn-icon:focus-visible { box-shadow: 0 0 0 3px rgba(19, 138, 42, .26); }
.btn-icon-primary { color: var(--teal-700); }
.btn-icon-success { color: var(--green); }
.btn-icon-success:hover, .btn-icon-success:focus-visible { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.btn-icon-danger { color: #b91c1c; }
.btn-icon-danger:hover, .btn-icon-danger:focus-visible { background: #fee2e2; color: var(--red); border-color: #fecaca; }
.btn-icon-warning { color: #b45309; }
.btn-icon-warning:hover, .btn-icon-warning:focus-visible { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-icon:disabled, .btn-icon[aria-disabled="true"] { opacity: .35; cursor: not-allowed; background: transparent; color: var(--navy-800); border-color: transparent; }
.btn-icon.is-loading::after { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.btn-icon.is-loading .icon { visibility: hidden; }
.row-actions { display: inline-flex; align-items: center; gap: 2px; flex-wrap: nowrap; vertical-align: middle; }
.row-actions > form { display: inline; margin: 0; }
td.row-actions-cell { white-space: nowrap; }
/* Popover: <details class="row-popover"><summary class="btn-icon">…</summary><div class="row-popover-panel">form</div></details> */
details.row-popover { position: relative; display: inline-block; }
/* A popover open near the bottom of a table must not be clipped by the scrolling wrapper. */
.table-wrap:has(details.row-popover[open]) { overflow: visible; }
details.row-popover > summary { list-style: none; }
details.row-popover > summary::-webkit-details-marker { display: none; }
details.row-popover[open] > summary { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
details.row-popover > .row-popover-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 260px; padding: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 36, 56, .14);
  white-space: normal; font-weight: 400;
}
details.row-popover > .row-popover-panel .row-popover-title { font-size: .8rem; font-weight: 700; color: var(--navy-900); margin-bottom: 8px; }
details.row-popover > .row-popover-panel form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
details.row-popover > .row-popover-panel form > input:not([type=hidden]), details.row-popover > .row-popover-panel form > select { flex: 1 1 150px; min-width: 0; }
.data th.th-actions, th[data-no-sort].th-actions { text-align: right; }
td.row-actions-cell { text-align: right; }

/* -------------------------------------------------------------- Flash */
.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: .87rem; font-weight: 500; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* -------------------------------------------------------------- Login */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background-color: var(--navy-900);
  background-image: linear-gradient(135deg, rgba(0,75,19,.98), rgba(0,107,21,.93)), url('../img/brand-pattern.svg');
  background-size: auto, 420px 420px;
  background-position: center, right center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 70px rgba(8,27,45,.30); overflow: hidden;
}
.login-form { padding: 38px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 34px; text-align: center; }
.login-brand-logo { width: 104px; height: 104px; object-fit: contain; display: block; }
.login-brand .brand-name { color: var(--navy-900); font-size: 1.18rem; }
.login-brand .brand-name span { color: var(--teal-700); }
.login-brand .brand-sub { color: var(--muted); font-size: .72rem; }
.login-form h1 { font-size: 1.45rem; color: var(--navy-900); margin-bottom: 5px; }
.login-intro { margin-bottom: 24px; color: var(--muted); font-size: .86rem; }

/* ------------------------------------------------------------- Charts */
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: .76rem; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------------------------------------------------- Assistant */
.chat-shell { max-width: 900px; margin: 0 auto; }
.assistant-intro-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.agent-status {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 7px; padding: 4px 9px;
  border-radius: 99px; font-size: .7rem; font-weight: 700; background: #f8fafc; color: var(--muted);
  border: 1px solid var(--line);
}
.agent-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.agent-status.is-online { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.agent-status.is-online span { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.chat-log { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.msg { display: flex; gap: 12px; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
}
.msg-user .msg-avatar { background: var(--navy-800); color: #fff; }
.msg-ai .msg-avatar { background: linear-gradient(135deg, var(--teal-600), var(--teal-900)); color: #fff; }
.msg-body { flex: 1; min-width: 0; }
.msg-bubble {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; font-size: .9rem; line-height: 1.55;
}
.msg-user .msg-bubble { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.msg-bubble strong { color: var(--teal-900); }
.msg-bubble .assistant-heading { display: block; font-size: 1rem; margin: 4px 0; }
.msg-user .msg-bubble strong { color: #fff; }
.msg-meta { font-size: .7rem; color: var(--muted); margin-top: 4px; }
.agent-trace { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; font-size: .7rem; color: var(--muted); }
.agent-trace code { background: var(--teal-50); color: var(--teal-900); border: 1px solid var(--teal-100); border-radius: 99px; padding: 2px 7px; font-family: var(--font); }
.agent-action {
  margin-top: 10px; padding: 13px 14px; border: 1px solid #f3d28c; border-left: 4px solid var(--amber);
  border-radius: 10px; background: #fffbeb;
}
.agent-action-confirmed { border-color: #a7f3d0; border-left-color: #10b981; background: #ecfdf5; }
.agent-action-discarded { border-color: var(--line); border-left-color: #94a3b8; background: #f8fafc; opacity: .78; }
.agent-action-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; color: var(--navy-900); }
.agent-action-detail { margin-top: 4px; color: var(--muted); font-size: .74rem; text-transform: capitalize; }
.agent-action p { margin: 9px 0; font-size: .8rem; line-height: 1.5; color: #334155; }
.agent-action-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-action-error { margin-top: 7px; color: var(--red); font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  background: var(--teal-50); border: 1px solid var(--teal-100); color: var(--teal-900);
  font-size: .78rem; padding: 5px 12px; border-radius: 99px; cursor: pointer; font-family: var(--font);
}
.chip:hover { background: var(--teal-100); }
.chat-input { display: flex; gap: 10px; position: sticky; bottom: 16px; }
.chat-input input { flex: 1; padding: 13px 16px; border-radius: 12px; box-shadow: var(--shadow); }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-600); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }

@media (max-width: 620px) {
  .assistant-intro-head { align-items: stretch; flex-direction: column; }
  .assistant-intro-head .btn { align-self: flex-start; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal-panel { max-height: 100vh; border-radius: 0; }
  .onboarding-modal { padding: 18px; }
  .wizard-steps li { justify-content: center; font-size: 0; }
  .wizard-steps li span { font-size: .78rem; }
  .onboarding-review dl { grid-template-columns: 1fr; }
  .wizard-actions { flex-direction: column-reverse; }
  .wizard-actions > .btn, .wizard-actions-right .btn { flex: 1; text-align: center; }
  .directory-head { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------------------------------ Alerts */
.alert-row { display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.alert-row:last-child { border-bottom: none; }
.alert-icon { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.alert-critical .alert-icon { background: #fee2e2; color: var(--red); }
.alert-warning .alert-icon { background: #fef3c7; color: var(--amber); }
.alert-info .alert-icon { background: #dbeafe; color: var(--blue); }
.alert-title { font-weight: 700; font-size: .9rem; color: var(--navy-900); }
.alert-msg { font-size: .82rem; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.alert-meta { font-size: .72rem; color: var(--muted); margin-top: 5px; }

/* ------------------------------------------------------------ Widgets */
.progress { height: 8px; background: #eef2f5; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--teal-600); }
.factor-list { list-style: none; }
.factor-list li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: .82rem; padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.factor-list li:last-child { border-bottom: none; }
.factor-pts { font-weight: 700; color: var(--red); white-space: nowrap; }

.muted { color: var(--muted); font-size: .85rem; }
.small { font-size: .78rem; }
.mt { margin-top: 14px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: .8rem; background: #fff;
}
.pagination .cur { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.pagination a[rel] { font-weight: 650; }

/* --------------------------------------------------------------- PWA */
.network-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.network-status.is-offline { color: #b45309; }
.network-status.is-offline .live-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,119,6,.16); }
.pwa-install { white-space: nowrap; }
.login-install { width: 100%; margin-top: 10px; }
.pwa-update {
  position: fixed; right: 18px; bottom: 18px; z-index: 1100;
  display: flex; align-items: center; gap: 14px; max-width: min(390px, calc(100vw - 30px));
  padding: 12px 14px; border: 1px solid var(--teal-100); border-radius: 12px;
  background: var(--teal-50); color: var(--navy-900); box-shadow: 0 16px 40px rgba(18,59,32,.22);
  font-size: .82rem; font-weight: 650;
}

/* ---------------------------------------------- Employee self-service */
.employee-bottom-nav { display: none; }
.employee-quick-actions {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin: -4px 0 20px;
}
.employee-quick-actions a {
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto;
  column-gap: 10px; align-items: center; padding: 12px 14px; color: var(--navy-900);
  border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow);
}
.employee-quick-actions a:hover { text-decoration: none; border-color: var(--teal-100); }
.employee-quick-actions a > span { grid-row: 1 / span 2; font-size: 1.25rem; color: var(--teal-700); text-align: center; }
.employee-quick-actions strong { font-size: .83rem; }
.employee-quick-actions small { color: var(--muted); font-size: .69rem; margin-top: 2px; }

/* Pulse survey (My HR) */
.survey-nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; border-left: 4px solid var(--teal-600); }
.survey-nudge .btn { flex: 0 0 auto; }
.rating-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating-scale label { cursor: pointer; position: relative; }
.rating-scale input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.rating-scale span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px;
  border: 1px solid #d1d5db; border-radius: 9px; background: #fff; text-align: center; transition: border-color .15s, background .15s;
}
.rating-scale strong { font-size: 1.05rem; color: var(--navy-900); }
.rating-scale small { font-size: .64rem; color: var(--muted); line-height: 1.2; }
.rating-scale label:hover span { border-color: var(--teal-100); }
.rating-scale input:checked + span { border-color: var(--teal-600); background: var(--teal-50); box-shadow: 0 0 0 3px rgba(19,138,42,.16); }
.rating-scale input:focus-visible + span { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.survey-notes { padding-left: 18px; margin: 0; display: grid; gap: 7px; }

/* User preferences (Settings → Preferences), applied as body classes */
.pref-compact .card { padding: 12px 14px; }
.pref-compact table.data th, .pref-compact table.data td { padding: 6px 9px; }
.pref-compact .content { padding-top: 16px; }
.pref-compact .grid { gap: 12px; }
.pref-reduce-motion *, .pref-reduce-motion *::before, .pref-reduce-motion *::after {
  scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}
.pref-reduce-motion .btn.is-loading::after, .pref-reduce-motion button.is-loading::after { animation: none; border-color: var(--spinner) transparent var(--spinner) transparent; }

/* Settings page */
.settings-readonly { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: .9rem; }
.settings-readonly dt { color: var(--muted); }
.settings-readonly dd { margin: 0; font-weight: 600; }
.setting-help { font-size: .76rem; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.setting-meta { font-size: .72rem; color: var(--teal-700); margin-top: 3px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal-700); flex: 0 0 auto; }
.check-row strong { display: block; font-size: .9rem; }
.check-row small { color: var(--muted); font-size: .78rem; }

/* --------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .sidebar {
    width: min(86vw, 320px); position: fixed; z-index: 60; inset: 0 auto 0 0;
    height: 100dvh; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    transform: translateX(-101%); transition: transform .22s ease; box-shadow: 18px 0 50px rgba(8,27,45,.24);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; z-index: 55; inset: 0; width: 100%; height: 100%; border: 0;
    background: rgba(8,27,45,.52); opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .sidebar-close {
    display: inline-flex; width: 44px; height: 44px; margin-left: auto; flex: 0 0 auto;
    align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.16);
    border-radius: 10px; background: rgba(255,255,255,.06); color: #fff; font-size: 1.55rem;
    line-height: 1; cursor: pointer;
  }
  .hamburger {
    display: inline-flex; width: 44px; height: 44px; flex: 0 0 auto; align-items: center;
    justify-content: center; border-radius: 9px; margin: -7px 0; font-size: 1.35rem;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .login-card { flex-direction: column; }
  .main { width: 100%; }
  .content { padding: 16px 14px 32px; }
  .topbar {
    min-height: calc(58px + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  }
  .page-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right > .muted { display: none; }
  .app-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .data-toolbar, .data-footer { min-width: 0; flex-wrap: wrap; }
  .data-search { max-width: none; min-width: min(240px, 100%); }
  .data-footer .data-count { width: 100%; }
  .data-pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; width: 100%; }
  .tab-list { margin-left: -2px; margin-right: -2px; }
  input:not([type=checkbox]):not([type=radio]), select, textarea, .btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .btn-sm { padding: 8px 12px; }
  .modal-panel { padding-bottom: env(safe-area-inset-bottom); }

  .employee-app .sidebar { display: none; }
  .employee-app .hamburger { display: none; }
  .employee-app .topbar {
    min-height: calc(54px + env(safe-area-inset-top));
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .employee-app .page-title { font-size: 1.05rem; }
  .employee-app .topbar-right > .muted, .employee-app .network-label { display: none; }
  .employee-app .topbar-right { gap: 10px; }
  .employee-app .content {
    padding: 14px 12px calc(88px + env(safe-area-inset-bottom));
  }
  .employee-app .app-foot { display: none; }
  .employee-app .content > .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px;
  }
  .employee-app .content > .grid-4 .card { padding: 13px 12px; min-width: 0; }
  .employee-app .content > .grid-4 .kpi-value { font-size: 1.35rem; overflow-wrap: anywhere; }
  .employee-app .content > .grid-4 .kpi-label { font-size: .65rem; }
  .employee-app .content > .grid-4 .kpi-delta { font-size: .69rem; }
  .employee-app .tab-list[aria-label="My HR sections"] { display: none; }
  .employee-app .card { padding: 15px 14px; margin-bottom: 14px; }
  .employee-app .grid { gap: 12px; margin-bottom: 14px; }
  .employee-app .employee-quick-actions {
    display: flex; overflow-x: auto; scroll-snap-type: x proximity; gap: 9px; margin: 0 -12px 14px;
    padding: 0 12px 4px; scrollbar-width: none;
  }
  .employee-app .employee-quick-actions::-webkit-scrollbar { display: none; }
  .employee-app .employee-quick-actions a { flex: 0 0 185px; scroll-snap-align: start; padding: 11px 12px; }
  .employee-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: rgba(255,255,255,.96);
    box-shadow: 0 -8px 24px rgba(18,59,32,.09); backdrop-filter: blur(12px);
  }
  .employee-bottom-nav a {
    display: flex; min-width: 0; min-height: 48px; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; border-radius: 9px; color: #64748b; font-size: .67rem; font-weight: 650;
  }
  .employee-bottom-nav a:hover { text-decoration: none; }
  .employee-bottom-nav a.active { color: var(--teal-700); background: var(--teal-50); }
  .employee-bottom-nav .employee-mobile-logout { color: #b91c1c; }
  .employee-bottom-icon { font-size: 1.18rem; line-height: 1; }
  .employee-app .pwa-update { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  .content { padding: 12px 10px 28px; }
  .card { padding: 15px 14px; margin-bottom: 14px; }
  .grid { gap: 12px; margin-bottom: 14px; }
  .kpi-value { font-size: 1.45rem; overflow-wrap: anywhere; }
  .topbar { padding-right: 10px; padding-left: 10px; gap: 8px; }
  .topbar-right { gap: 6px; }
  .network-label { display: none; }
  .pwa-install:not(.login-install) { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .filters { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: stretch; }
  .filters .form-row { width: 100%; min-width: 0 !important; }
  .filters > .btn { width: 100%; text-align: center; }
  .inline-actions { display: flex; width: 100%; flex-wrap: wrap; }
  .inline-actions > input:not([type=hidden]), .inline-actions > select { width: auto !important; min-width: 110px; flex: 1 1 120px; }
  .inline-actions > .btn { flex: 1 1 auto; text-align: center; }
  .table-wrap { overflow: visible; }
  table.mobile-cards, table.mobile-cards tbody { display: block; width: 100%; }
  table.mobile-cards thead { display: none; }
  table.mobile-cards tbody { display: grid; gap: 10px; }
  table.mobile-cards tr {
    display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  }
  table.mobile-cards tr:hover td { background: transparent; }
  table.mobile-cards td {
    display: grid; grid-template-columns: minmax(86px, 38%) 1fr; gap: 10px; align-items: start;
    width: 100%; padding: 9px 11px; border-bottom: 1px solid #edf1f3; overflow-wrap: anywhere;
  }
  table.mobile-cards td::before {
    content: attr(data-label); color: var(--muted); font-size: .65rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
  }
  table.mobile-cards td:last-child { border-bottom: 0; }
  table.mobile-cards td[colspan] { display: block; text-align: center; }
  table.mobile-cards td[colspan]::before { content: none; }
  table.mobile-cards details, table.mobile-cards details form { min-width: 0 !important; width: 100%; }
  table.mobile-cards td > .btn, table.mobile-cards details > .btn { width: 100%; text-align: center; }
  .btn-icon { width: 40px; height: 40px; }
  td.row-actions-cell { text-align: left; }
  .row-actions { gap: 4px; flex-wrap: wrap; }
  table.mobile-cards details.row-popover, .alert-row details.row-popover { width: auto; }
  details.row-popover[open] { flex: 1 1 100%; }
  details.row-popover > .row-popover-panel { position: static; margin-top: 6px; min-width: 0; width: 100%; box-shadow: none; }
  table.mobile-cards .emp-cell { align-items: flex-start; }
  .data-toolbar { align-items: stretch; }
  .data-toolbar .data-search { flex-basis: 100%; }
  .data-page-size { width: 100%; justify-content: space-between; }
  .data-pager .btn { flex: 1; }
  .alert-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px 12px; }
  .alert-row > form, .alert-row > details { grid-column: 2; width: 100%; min-width: 0 !important; }
  .alert-row > form .btn, .alert-row > details > .btn { width: 100%; text-align: center; }
  .agent-action-head { flex-direction: column; gap: 5px; }
  .chat-input { gap: 7px; bottom: calc(8px + env(safe-area-inset-bottom)); }
  .chat-input input { min-width: 0; padding-left: 12px; padding-right: 12px; }
  .chat-input .btn { padding-left: 14px; padding-right: 14px; }
  .pwa-update { left: 12px; right: 12px; bottom: 12px; justify-content: space-between; }
  .login-page { align-items: flex-start; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .login-card { max-width: 420px; border: 0; border-radius: 0; box-shadow: none; }
  .login-form { padding: 24px 12px; }
  .login-brand { margin-bottom: 30px; }
}

@media (max-width: 380px) {
  .page-title { font-size: 1rem; }
  .network-status { display: none; }
  .card { padding-right: 12px; padding-left: 12px; }
  table.mobile-cards td { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* Still signal "working" without motion: a static broken ring instead of a spinner. */
  .btn.is-loading::after, button.is-loading::after { animation: none; border-color: var(--spinner) transparent var(--spinner) transparent; }
}

@media print {
  .sidebar, .topbar, .chat-input, .btn, .employee-bottom-nav, .pwa-update { display: none !important; }
  .content { padding: 0; }
}

/* Payroll: highlight the record whose details are open */
table.data tr.is-selected > td { background: var(--teal-50, #f0f8f1); box-shadow: inset 3px 0 0 var(--teal-600, #138a2a); }
.payroll-modal { width: min(1100px, 100%); padding: 22px; }
.payroll-modal-grid { margin-top: 14px; }
.payroll-modal .card { box-shadow: none; border: 1px solid var(--line); }

/* Learning management ------------------------------------------------- */
.learning-ai-box { border: 1px dashed var(--teal-600, #138a2a); border-radius: 10px; padding: 12px; background: var(--teal-50, #f0f8f1); margin-top: 10px; }
.learning-ai-box .agent-status { margin-bottom: 8px; }
.learning-draft-lesson { border: 1px solid #e5e9ee; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; background: #fff; }
.learning-draft-lesson > summary { cursor: pointer; }
.learning-lesson-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #eef2f5; }
.learning-lesson-row:last-of-type { border-bottom: 0; }
.learning-lesson-order { flex: 0 0 28px; height: 28px; border-radius: 50%; background: #eef2f5; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.learning-lesson-main { flex: 1; min-width: 0; }
.learning-lesson-main details > summary { cursor: pointer; color: var(--teal-700, #006b15); }
.learning-player { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.learning-outline { position: sticky; top: 12px; }
.learning-lesson-list { list-style: none; margin: 0; padding: 0; }
.learning-lesson-list li a { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 8px; color: inherit; text-decoration: none; }
.learning-lesson-list li a:hover { background: #f4f7f9; }
.learning-lesson-list li.active a { background: var(--teal-50, #f0f8f1); font-weight: 600; }
.learning-lesson-list li a span small { display: block; font-weight: 400; color: var(--muted); font-size: .69rem; }
.learning-lesson-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; background: #eef2f5; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; }
.learning-lesson-list li.done .learning-lesson-mark { background: var(--green, #16a34a); color: #fff; }
.learning-text { line-height: 1.7; max-width: 76ch; }
.learning-text h3, .learning-text h4, .learning-text h5 { margin: 18px 0 6px; }
.learning-text h3 { font-size: 1.15rem; }
.learning-text h4 { font-size: 1rem; }
.learning-text h5 { font-size: .9rem; }
.learning-text p { margin: 0 0 12px; }
.learning-text ul, .learning-text ol { margin: 0 0 12px 22px; }
.learning-media { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
img.learning-media { background: transparent; max-height: none; }
.learning-embed { position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; background: #000; }
.learning-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.learning-pdf { width: 100%; height: 70vh; border: 1px solid #e5e9ee; border-radius: 10px; }
.learning-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.learning-actions form { display: inline; }
.learning-module-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eef2f5; }
.learning-module-card:last-child { border-bottom: 0; }
@media (max-width: 900px) {
  .learning-player { grid-template-columns: 1fr; }
  .learning-outline { position: static; }
  .learning-lesson-row { flex-wrap: wrap; }
}

/* ---- Staff announcements: banner + sign-in popup ---- */
.announcement-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 15px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--line); background: #fff; }
.announcement-banner.is-important { background: #fffbeb; border-color: #fde68a; }
.announcement-banner.is-urgent { background: #fef2f2; border-color: #fecaca; }
.announcement-banner-icon { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: #fde68a; color: #78350f; }
.announcement-banner.is-urgent .announcement-banner-icon { background: #fecaca; color: #991b1b; }
.announcement-banner strong { display: block; font-size: .9rem; color: var(--navy-900); }
.announcement-banner p { margin: 3px 0 0; font-size: .82rem; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.announcement-banner form { margin-left: auto; flex: 0 0 auto; }
.announcement-modal { width: min(640px, 100%); padding: 24px; }
.announcement-modal .modal-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.announcement-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.announcement-item:last-child { border-bottom: none; }
.announcement-item strong { color: var(--navy-900); }
.announcement-item p { margin: 4px 0 0; font-size: .85rem; line-height: 1.55; color: var(--muted); white-space: pre-line; }
.birthday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.birthday-list li { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; background: #fdf2f8; }
.birthday-list li.is-today { background: #fef3c7; }
.birthday-list .birthday-cake { font-size: 1.25rem; }
.birthday-list strong { font-size: .88rem; color: var(--navy-900); }
.birthday-list small { display: block; color: var(--muted); font-size: .74rem; }
.announcement-modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 600px) { .announcement-modal { padding: 16px; } .announcement-banner { flex-wrap: wrap; } }

/* ---- Sidebar accordion groups ---- */
.nav-group { margin-top: 4px; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin: 0;
  border: 0; border-radius: 8px; background: transparent; color: #9fb3c6; font: inherit;
  font-size: .8rem; font-weight: 650; cursor: pointer; text-align: left;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group-toggle:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.nav-group.has-active > .nav-group-toggle { color: #fff; }
.nav-group-count { margin-left: auto; font-size: .66rem; color: #64809a; font-weight: 700; }
.nav-chevron { font-size: 1.05rem; line-height: 1; opacity: .75; transition: transform .18s ease; }
.nav-group.open > .nav-group-toggle .nav-chevron { transform: rotate(90deg); }
.nav-group-items { display: none; margin: 2px 0 4px 14px; padding-left: 6px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-group.open > .nav-group-items { display: block; }
.nav-group-items .nav-item { font-size: .86rem; padding: 7px 10px; }
.pref-reduce-motion .nav-chevron { transition: none; }

/* ---- Approvals inbox & workflow editor ---- */
.approval-card { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
/* Approval queue as a dense list: one row per request, decision controls inline */
/* The request column, whether or not a bulk-select column precedes it. */
table.approval-queue td:first-child:not(.td-select),
table.approval-queue td.td-select + td { min-width: 320px; }
table.approval-queue .approval-summary { font-size: .92rem; }
table.approval-queue .approval-steps { margin-top: 6px; }
.decision-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.decision-cell form { flex-wrap: nowrap; }
.decision-cell input[type=text] { width: 150px; }
@media (max-width: 800px) { .decision-cell input[type=text] { width: 100%; } .decision-cell form { flex-wrap: wrap; } }
.approval-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.approval-summary { font-weight: 700; color: var(--navy-900); font-size: .98rem; }
.approval-actions { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.approval-actions textarea { width: 100%; resize: vertical; }
.approval-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .82rem; }
.approval-steps li { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.approval-steps li small { color: var(--muted); }
.approval-step-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: 0 0 auto; background: #cbd5e1; }
.approval-steps li.is-approved .approval-step-dot { background: #10b981; }
.approval-steps li.is-rejected .approval-step-dot { background: #ef4444; }
.approval-steps li.is-pending .approval-step-dot { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.approval-steps li.is-pending { color: var(--navy-900); font-weight: 600; }
.workflow-chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.workflow-chain li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; flex-wrap: wrap; }
.workflow-step-no { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-700); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.workflow-step-body { flex: 1; min-width: 180px; }
.workflow-step-actions { margin-left: auto; }
/* Approval workflows: process list beside the selected chain */
.workflow-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.workflow-list { display: grid; gap: 2px; padding: 12px; }
.workflow-list .card-sub { margin: 4px 6px 6px; }
.workflow-list a { display: grid; gap: 4px; padding: 10px 10px; border-radius: 9px; color: var(--navy-900); text-decoration: none; border: 1px solid transparent; }
.workflow-list a:hover { background: var(--cloud, #f3f6f8); }
.workflow-list a.is-selected { background: var(--teal-50, #f0f8f1); border-color: var(--teal-100, #cfe7d3); }
.workflow-list-name { font-weight: 600; font-size: .9rem; }
.workflow-list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .74rem; }
@media (max-width: 900px) { .workflow-layout { grid-template-columns: 1fr; } .workflow-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } .workflow-list .card-sub { grid-column: 1 / -1; } }
@media (max-width: 900px) { .approval-card { grid-template-columns: 1fr; } }

/* ---- Guided page tours ---- */
.tour-button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--teal-700); font-weight: 800; font-size: .95rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tour-button:hover { background: var(--teal-50); border-color: var(--teal-600); }
.tour-overlay { position: fixed; inset: 0; z-index: 1200; }
.tour-spotlight { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 28, 45, .62), 0 0 0 3px rgba(255,255,255,.9); pointer-events: none; transition: all .22s ease; }
.tour-spotlight[hidden] { display: block !important; left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; }
.tour-card { position: fixed; z-index: 1201; background: var(--card); border-radius: 14px; padding: 16px 18px; box-shadow: 0 24px 80px rgba(8, 27, 45, .35); transition: top .22s ease, left .22s ease; }
.tour-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tour-progress { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-700); }
.tour-close { border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.tour-card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--navy-900); }
.tour-card p { margin: 0; font-size: .86rem; line-height: 1.55; color: var(--muted); }
.tour-dots { display: flex; gap: 5px; margin: 12px 0 10px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.tour-dots span.is-on { background: var(--teal-600); }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.pref-reduce-motion .tour-spotlight, .pref-reduce-motion .tour-card { transition: none; }
@media (max-width: 600px) { .tour-card { padding: 14px; } }

/* ---- Tour help menu & notes ---- */
.tour-menu { position: fixed; z-index: 1150; width: min(340px, calc(100vw - 16px)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 60px rgba(8, 27, 45, .22); padding: 8px; }
.tour-menu-title { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.tour-menu-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font: inherit; color: var(--navy-900); }
.tour-menu-item:hover, .tour-menu-item:focus-visible { background: var(--teal-50); outline: none; }
.tour-menu-item strong { display: block; font-size: .86rem; }
.tour-menu-item small { display: block; color: var(--muted); font-size: .74rem; }
.tour-menu-icon { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px; background: var(--teal-700); color: #fff; font-size: .7rem; display: inline-flex; align-items: center; justify-content: center; }
.tour-note { margin-top: 8px !important; font-size: .76rem !important; color: #92400e !important; background: #fffbeb; border-radius: 8px; padding: 6px 8px; }

/* ---- Help centre & top-bar search ---- */
.help-search-bar { position: relative; display: flex; align-items: center; }
.help-search-bar input { width: 200px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; background: #fff; transition: width .18s ease; }
.help-search-bar input:focus { width: 300px; outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(19,138,42,.14); }
.help-search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(420px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 60px rgba(8,27,45,.22); padding: 6px; z-index: 1150; max-height: 70vh; overflow-y: auto; }
.help-search-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; color: var(--navy-900); text-decoration: none; }
.help-search-item:hover, .help-search-item:focus { background: var(--teal-50); outline: none; text-decoration: none; }
.help-search-item strong { display: block; font-size: .84rem; }
.help-search-item small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.help-search-item.is-more { justify-content: center; font-size: .8rem; color: var(--teal-700); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; }
.help-hero { background: linear-gradient(135deg, var(--teal-50), #fff); }
.help-search { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.help-search input { flex: 1; min-width: 240px; font-size: 1rem; padding: 12px 14px; }
.help-hero kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-family: inherit; background: #fff; }
.help-answer { border-left: 4px solid var(--teal-600); }
.help-answer-text { font-size: .95rem; line-height: 1.65; color: var(--navy-900); }
.help-sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.help-source { font-size: .78rem; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--teal-700); text-decoration: none; background: #fff; }
.help-source small { color: var(--muted); }
.help-result { padding: 12px 0; border-bottom: 1px solid var(--line); }
.help-result:last-child { border-bottom: none; }
.help-result-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.help-result p { margin: 0 0 8px; font-size: .86rem; color: var(--muted); line-height: 1.55; }
.help-guides { display: grid; gap: 6px; }
.help-guide { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 9px; color: var(--navy-900); text-decoration: none; border: 1px solid transparent; }
.help-guide:hover { background: var(--teal-50); border-color: var(--line); text-decoration: none; }
.help-guide strong { display: block; font-size: .86rem; }
.help-guide small { display: block; color: var(--muted); font-size: .74rem; }
.help-faq { border-bottom: 1px solid var(--line); padding: 8px 0; }
.help-faq summary { cursor: pointer; font-weight: 600; color: var(--navy-900); font-size: .88rem; }
.help-faq p { margin: 8px 0 0; font-size: .85rem; color: var(--muted); line-height: 1.55; }
@media (max-width: 800px) { .help-search-bar input, .help-search-bar input:focus { width: 140px; } }

/* ---- Strategy cascade & KPI plan ---- */
.cascade-root { font-size: 1.02rem; padding: 10px 12px; border-radius: 10px; background: var(--teal-50); margin-bottom: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cascade-node { margin: 6px 0 6px 18px; border-left: 2px solid var(--line); padding-left: 12px; }
.cascade-node > summary { cursor: pointer; list-style: none; padding: 6px 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cascade-node > summary::-webkit-details-marker { display: none; }
.cascade-node > summary::before { content: '▸'; color: var(--muted); font-size: .8rem; }
.cascade-node[open] > summary::before { content: '▾'; }
.cascade-level { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal-700); font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.cascade-kpi { margin: 4px 0 4px 26px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.cascade-empty { margin: 4px 0 6px 26px !important; }
.plan-kpi { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; margin-top: 8px; }
.plan-objective summary .emp-sub { margin-top: 2px; }

/* ------------------------------------------------------------ Bulk actions */
.bulk-bar {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--teal-200, #b8d9be); border-radius: 10px;
  background: var(--teal-50, #f0f8f1); box-shadow: 0 6px 18px rgba(18, 59, 32, .12);
}
.bulk-bar[hidden] { display: none; }
.bulk-count { font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.bulk-bar > input:not([type=hidden]), .bulk-bar > select { flex: 1 1 200px; min-width: 140px; }
.bulk-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
/* Shrink-to-fit: width:1% collapses the column to its content in an auto-layout table. */
table.data th.th-select, table.data td.td-select {
  width: 1%; white-space: nowrap; padding-left: 10px; padding-right: 0; vertical-align: middle;
}
.bulk-check, [data-bulk-all] { width: 16px; height: 16px; accent-color: var(--teal-600, #138a2a); cursor: pointer; }
table.data tr.is-selected td { background: var(--teal-50, #f0f8f1); }
.modal-panel .bulk-count { display: block; margin-bottom: 8px; }
@media (max-width: 760px) {
  table.mobile-cards td.td-select { grid-template-columns: 1fr; width: auto; padding-bottom: 0; border-bottom: 0; }
  table.mobile-cards td.td-select::before { content: none; }
  .bulk-bar { bottom: 8px; }
  .bulk-actions { margin-left: 0; width: 100%; }
  .bulk-actions .btn { flex: 1 1 auto; text-align: center; }
}
[data-bulk-row].is-selected { background: var(--teal-50, #f0f8f1); }
.bulk-all-label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
