/* NHRC HRIS application styles. Mobile-first; tokens only (see tokens.css). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-strong); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }

/* ------------------------------------------------ signature fillet */
.fillet { display: flex; gap: 2px; height: 3px; background: var(--canvas); }
.fillet i { flex: 1; }
.fillet i:nth-child(1) { background: var(--flag-red); }
.fillet i:nth-child(2) { background: var(--flag-blue); }
.fillet i:nth-child(3) { background: var(--flag-green); }
.fillet.page-top { position: fixed; top: 0; left: 0; right: 0; z-index: 60; }

/* ------------------------------------------------ shell */
.shell { min-height: 100dvh; }
.sidebar {
  display: none; position: fixed; top: 3px; bottom: 0; left: 0; width: 248px;
  background: var(--panel); border-right: 1px solid var(--line);
  flex-direction: column; z-index: 40;
}
.content { padding: calc(56px + 3px + 18px) 16px 90px; }
.topbar {
  position: fixed; top: 3px; left: 0; right: 0; height: 56px; z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .topbar { left: 248px; padding: 0 24px; }
  .content { margin-left: 248px; padding: calc(56px + 3px + 26px) 28px 60px; max-width: 1240px; }
  .menu-btn { display: none; }
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .mark { flex: none; }
.brand .t1 { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.brand .t2 { font-size: 10.5px; color: var(--ink-3); letter-spacing: .14em; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav .grp { margin: 14px 6px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: 14px;
  min-height: 40px; transition: background .15s ease, color .15s ease;
}
.nav a svg { flex: none; opacity: .85; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--brass-soft); color: var(--brass); }
.nav a .cnt {
  margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0 7px; color: var(--ink-2);
}
.userbox { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.userbox .nm { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.userbox .rl { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.userbox form { margin-left: auto; }

.menu-btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; /* the topbar is a flex row: never let a touch target be squeezed below 44px */
  width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover, .menu-btn:hover { background: var(--panel-2); color: var(--ink); }
.topbar .crumb { font-family: var(--serif); font-size: 16.5px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.bell { position: relative; }
.bell .dot {
  position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--brass); color: var(--canvas);
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}

/* demo controls: role switcher + walkthrough launcher (DEMO_MODE only) */
.topbar-demo { display: none; align-items: center; gap: 8px; }
@media (min-width: 1024px) { .topbar-demo { display: flex; } }
.role-switch { display: flex; align-items: center; gap: 7px; }
.role-switch .lb { margin: 0; white-space: nowrap; }
.role-switch select {
  width: auto; min-width: 168px; min-height: 36px; padding: 4px 10px;
  font-size: 13.5px; font-weight: 600; background: var(--panel-2);
  border-color: var(--line-2); color: var(--ink);
}
.tour-launch { white-space: nowrap; background: var(--brass-soft); border-color: color-mix(in srgb, var(--brass) 40%, var(--canvas)); color: var(--brass); }
.tour-launch:hover { background: var(--brass); border-color: var(--brass); color: var(--canvas); }
.drawer-demo {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--canvas-2);
}
.drawer-demo .role-switch { flex-direction: column; align-items: stretch; gap: 5px; }
.drawer-demo .role-switch select { width: 100%; min-height: 44px; font-size: 16px; }
.drawer-demo .tour-launch { justify-content: center; min-height: 44px; }
@media (min-width: 1024px) { .drawer-demo { display: none; } }

/* drawer (mobile nav, full parity) */
.drawer { position: fixed; inset: 0; z-index: 70; display: none; }
.drawer.open { display: block; }
.drawer .scrim { position: absolute; inset: 0; background: rgba(3, 8, 20, .6); }
.drawer .panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(320px, 88vw);
  background: var(--panel); border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
  animation: slide-in .22s ease-out;
}
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: none; } }

/* ------------------------------------------------ page furniture */
.page-h { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 4px 0 18px; }
.page-h h1 { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.page-h .sub { width: 100%; margin-top: 2px; font-size: 14px; }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 1024px) { .page-h h1 { font-size: 30px; } .page-h .sub { width: auto; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.card > h3, .card > h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .hint { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.g2 { grid-template-columns: 1fr 1fr; } .grid.g3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid.g4 { grid-template-columns: repeat(4, 1fr); } }
.grid > .card + .card { margin-top: 0; }
/* Grid items default to min-width:auto, which lets a wide child (a min-width table)
   push the track past the viewport. Allow them to shrink so .tbl-wrap scrolls instead. */
.grid > * { min-width: 0; }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats.s5 { grid-template-columns: repeat(5, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font-family: var(--serif); font-size: 26px; font-weight: 700; margin-top: 3px; }
.stat .v .num { font-family: var(--mono); font-size: 24px; }
.stat .d { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.stat.tone-ok .v { color: var(--ok); } .stat.tone-warn .v { color: var(--warn); }
.stat.tone-danger .v { color: var(--danger); } .stat.tone-brass .v { color: var(--brass); }
a.stat { display: block; color: inherit; transition: border-color .15s ease; }
a.stat:hover { border-color: var(--line-2); color: inherit; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--ink-2); white-space: nowrap; text-transform: none;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--canvas)); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--canvas)); }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--canvas)); }
.chip.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, var(--canvas)); }
.chip.brass { background: var(--brass-soft); color: var(--brass); border-color: color-mix(in srgb, var(--brass) 35%, var(--canvas)); }
.chip.muted { }

/* seal (initials badge) */
.seal {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--panel-2);
  color: var(--ink-2); font-family: var(--mono); font-weight: 700;
}
.seal.brass { border-color: color-mix(in srgb, var(--brass) 45%, var(--canvas)); color: var(--brass); background: var(--brass-soft); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  font: 600 14px var(--sans); cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--line); color: var(--ink); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--canvas); }
.btn.primary:hover { background: var(--brass-strong); border-color: var(--brass-strong); color: var(--canvas); }
.btn.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--canvas)); color: var(--danger); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
/* Dense inline buttons stay compact on desktop but meet the touch target on phones/tablets. */
@media (max-width: 1023px) { .btn.sm { min-height: 40px; padding: 8px 12px; } }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* forms */
label.fld { display: block; margin-bottom: 12px; }
label.fld .lb, .lb { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"],
input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--canvas-2); color: var(--ink);
  font: 400 16px var(--sans); transition: border-color .15s ease;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); outline: none; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brass); }
.form-row { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-row.r2 { grid-template-columns: 1fr 1fr; } .form-row.r3 { grid-template-columns: repeat(3, 1fr); } }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }

/* tables (ledger) */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow); }
.card .tbl-wrap { border: none; box-shadow: none; border-radius: 0; background: none; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.tbl th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td b, .tbl td strong, .tbl td a { color: var(--ink); font-weight: 600; }
.tbl td a:hover { color: var(--brass); }
.tbl td.n, .tbl th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: var(--canvas-2); }
.tbl .rowlink { cursor: pointer; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 130px; flex: 1 1 140px; min-height: 40px; font-size: 14px; }
.filters .btn { flex: none; }
@media (min-width: 900px) { .filters input[type="search"] { max-width: 280px; } }

/* flash + callouts */
.flash-stack { position: fixed; top: calc(56px + 10px); right: 12px; left: 12px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 700px) { .flash-stack { left: auto; width: 380px; } }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); box-shadow: var(--shadow); font-size: 14px; }
.flash.success { border-color: color-mix(in srgb, var(--ok) 40%, var(--canvas)); background: var(--ok-soft); color: var(--ok); }
.flash.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--canvas)); background: var(--danger-soft); color: var(--danger); }
.flash.warning { border-color: color-mix(in srgb, var(--warn) 40%, var(--canvas)); background: var(--warn-soft); color: var(--warn); }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--canvas-2); font-size: 13.5px; color: var(--ink-2); }

/* empty state */
.empty { text-align: center; padding: 34px 16px; color: var(--ink-2); }
.empty svg { opacity: .5; margin-bottom: 8px; }
.empty .t { font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--ink); }
.empty .h { font-size: 13.5px; margin: 4px 0 14px; }

/* simulated badge */
.sim { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); border: 1px dashed color-mix(in srgb, var(--warn) 45%, var(--canvas)); border-radius: 999px; padding: 3px 10px; }
.sim .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* charts */
.chart-wrap { overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
/* The bar keeps a floor so it stays readable inside narrow two-column cards. */
.hbar-row { display: grid; grid-template-columns: minmax(80px, 170px) minmax(60px, 1fr) 46px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar-row .lab { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .val { font-family: var(--mono); text-align: right; color: var(--ink); }
/* Both must be blocks: percentage width and height do not apply to inline boxes. */
.hbar-track { display: block; height: 14px; border-radius: 4px; background: var(--canvas-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { flex: none; padding: 9px 13px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--brass); border-bottom-color: var(--brass); }

/* detail lists */
.dl { display: grid; grid-template-columns: 1fr; gap: 0; }
.dl .row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.dl .row:last-child { border-bottom: none; }
.dl .k { color: var(--ink-3); } .dl .v { color: var(--ink); overflow-wrap: anywhere; }

/* login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.login-card .body { padding: 26px 24px 24px; }
.login-card h1 { font-family: var(--serif); font-size: 24px; }
.demo-grid { display: grid; grid-template-columns: 1fr; gap: 7px; }
.demo-grid button { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 52px; }
.demo-grid button .d { font-weight: 400; font-size: 12px; color: inherit; opacity: .75; }

/* print (reports) */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .drawer, .flash-stack, .no-print, .fillet.page-top { display: none !important; }
  .content { margin: 0; padding: 0; max-width: none; }
  .card, .tbl-wrap { box-shadow: none; border-color: #bbb; background: #fff; }
  .tbl th { color: #333; background: #fff; }
  .tbl td { color: #222; border-color: #ddd; }
  a { color: #111; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
