/* ==========================================================================
   FingerPrint HRM — application design system (single stylesheet)
   Every page shares these components: the app shell (sidebar, top bar),
   panels, cards, tables, forms, buttons, badges, tabs, alerts. Class names are
   stable API for the pages. Redesigned 22 Sep 2026: a grouped sidebar instead
   of a crowded top bar, a quieter palette, softer surfaces, clearer type.
   ========================================================================== */

* { box-sizing: border-box; }

:root {
  /* palette */
  --bg: #f4f6fa;
  --panel: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e5e9f0;
  --line-strong: #d4dae4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2459e0;
  --primary-dark: #1b46b5;
  --primary-soft: #edf2ff;
  --primary-ring: rgba(36, 89, 224, .18);
  --navy: #0f1d3a;
  --navy-2: #172a52;
  --accent: #5b8cff;
  --green: #0f7a3f; --green-bg: #e7f6ed;
  --red: #c02a1f;   --red-bg: #fdeceb;
  --amber: #925c00; --amber-bg: #fdf3dc;
  --gray-bg: #eef1f6;
  /* shape + depth */
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 6px 20px -6px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .28);
  --focus-ring: 0 0 0 3px var(--primary-ring);
  /* type + layout */
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
}

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font: 14px/1.55 var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  /* No double-tap zoom and no 300ms tap delay — an installed-app feel. */
  touch-action: manipulation;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 12.5px; }
h1 { font-family: var(--font-display); font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; margin: 6px 0; }
h2 { font-family: var(--font-display); font-size: 16px; line-height: 1.35; font-weight: 650; letter-spacing: -.01em; margin: 18px 0 10px; }
h3 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small-title { font-size: 12px; font-weight: 400; }
.ico { display: inline-block; flex: none; vertical-align: middle; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 6px; background: var(--panel); color: var(--muted); font: 600 11px/1.5 var(--font); text-align: center;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 500; padding: 8px 14px; border-radius: var(--radius); background: var(--primary); color: #fff; }
.skip-link:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   App shell: sidebar + top bar
   -------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line);
  z-index: 60; transition: width .2s ease, flex-basis .2s ease, transform .22s ease;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: var(--topbar-h); padding: 0 14px 0 16px; border-bottom: 1px solid var(--line); flex: none;
}
.sidebar-home { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); font-weight: 700; }
.sidebar-home:hover { text-decoration: none; }
.sidebar-logo { display: block; height: 34px; width: auto; max-width: 150px; object-fit: contain; }
.sidebar-mark {
  display: none; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: linear-gradient(140deg, var(--primary), #7a95ff); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
}
.sidebar-home:not(:has(.sidebar-logo)) .sidebar-mark { display: grid; }
.sidebar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; letter-spacing: -.01em; }
.icon-btn.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 10px 18px; scrollbar-width: thin; }
.nav-group { margin-bottom: 12px; }
.nav-group-label {
  padding: 2px 11px 6px; font-size: 11px; font-weight: 650; color: var(--faint);
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 36px; padding: 0 11px; margin: 1px 0;
  border: 0; border-radius: var(--radius); background: none; color: var(--text-2);
  font: inherit; font-weight: 550; white-space: nowrap; cursor: pointer; text-align: left;
  transition: background .12s ease, color .12s ease;
}
.nav-item .ico { color: var(--faint); transition: color .12s ease; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item:hover .ico { color: var(--text-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-item.active .ico { color: var(--primary); }
.nav-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
details.nav-more > summary { list-style: none; }
details.nav-more > summary::-webkit-details-marker { display: none; }
.nav-caret { display: inline-flex; color: var(--faint); transition: transform .16s ease; }
details.nav-more[open] .nav-caret { transform: rotate(180deg); }
.nav-sub { margin: 2px 0 8px 21px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav-sub a { display: block; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-sub a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-sub a.active { color: var(--primary-dark); font-weight: 600; background: var(--primary-soft); }
.sidebar-foot { flex: none; padding: 8px 10px; border-top: 1px solid var(--line); }
.sidebar-foot .nav-item { color: var(--muted); font-weight: 500; }

/* Collapsed to icons (remembered per browser). */
html.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .nav-label, html.sidebar-collapsed .nav-group-label, html.sidebar-collapsed .sidebar-name,
html.sidebar-collapsed .nav-caret { display: none; }
/* Collapsed, the logo keeps its symbol (its left end); letters only stand in when there is no logo. */
html.sidebar-collapsed .sidebar-logo { width: 38px; height: 34px; max-width: none; object-fit: cover; object-position: left center; }
html.sidebar-collapsed .sidebar-home:not(:has(.sidebar-logo)) .sidebar-mark { display: grid; }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
html.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
html.sidebar-collapsed .nav-group { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
html.sidebar-collapsed .nav-group:last-child { border-bottom: 0; }
html.sidebar-collapsed .sidebar-collapse .ico { transform: rotate(180deg); }
html.sidebar-collapsed details.nav-more { position: relative; }
html.sidebar-collapsed .nav-sub {
  position: fixed; left: calc(var(--sidebar-w-collapsed) + 6px); margin: -40px 0 0; padding: 6px; min-width: 230px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-lg); z-index: 90;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 28px; background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.topbar-menu, .topbar-company { display: none; }
.topbar-company { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--text-2); cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.cmdk-trigger {
  display: flex; align-items: center; gap: 10px; flex: 0 1 440px; min-width: 0; height: 38px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 13.5px; cursor: pointer; transition: border-color .12s ease, background .12s ease;
}
.cmdk-trigger:hover { border-color: var(--line-strong); background: var(--panel); }
.cmdk-trigger-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-trigger kbd { margin-left: auto; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.notice-count {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--panel);
}
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px; z-index: 80;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.menu-panel[hidden] { display: none; }
.menu-panel a, .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-panel a:hover, .menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel a .ico, .menu-item .ico { color: var(--muted); }
.menu-panel form { margin: 0; }
.menu-item[hidden] { display: none; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head .muted { font-size: 12.5px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 3px 8px 3px 3px; border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--line); }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; white-space: nowrap; }
.user-chip-role { font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.user-chip-caret { color: var(--faint); display: inline-flex; }
.avatar-initials {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: linear-gradient(140deg, #e0e8ff, #c9d7ff); color: var(--primary-dark); font-weight: 700; font-size: 12.5px;
}
.notices-panel { width: min(380px, 92vw); }
.notice-item { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-sm); }
.notice-item + .notice-item { border-top: 1px solid var(--line); }
.notice-item p { margin: 0 0 4px; font-size: 13px; color: var(--text-2); }
.notice-item a { font-size: 12.5px; font-weight: 600; }
.notice-item .ico { margin-top: 2px; }
.notice-warn .ico { color: var(--amber); }
.notice-error .ico { color: var(--red); }
.notice-info .ico { color: var(--primary); }
.sidebar-scrim { display: none; }

.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 28px 64px; flex: 1; }
.container:focus { outline: none; }
.footer { text-align: center; color: var(--faint); padding: 16px 18px 22px; font-size: 12.5px; }

/* Search from anywhere (Ctrl+K). */
.cmdk {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; background: rgba(15, 23, 42, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.cmdk[hidden] { display: none; }
.cmdk-box { width: min(640px, 100%); overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-input { flex: 1; min-width: 0; height: 56px; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; }
.cmdk-list { max-height: min(60vh, 460px); overflow-y: auto; margin: 0; padding: 6px; list-style: none; }
.cmdk-section { padding: 10px 10px 4px; font-size: 11px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.cmdk-item.active { background: var(--primary-soft); }
.cmdk-label { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item small { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-badge { min-width: 38px; padding: 1px 7px; border-radius: 7px; background: var(--gray-bg); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.cmdk-item.active .cmdk-badge { background: #fff; color: var(--primary-dark); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.cmdk-foot kbd { margin-right: 3px; }
html.cmdk-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0 22px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
/* A wide table inside a column scrolls there, instead of pushing the column off the page. */
.grid-2 > * { min-width: 0; }
.grid-2 > .panel { overflow-x: auto; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.panel > h2:first-child { margin-top: 0; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th {
  color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .02em;
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--radius-sm); }
.table thead th:last-child { border-top-right-radius: var(--radius-sm); }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: #f8faff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.kv th { width: 35%; color: var(--muted); font-weight: 500; background: transparent; font-size: 13px; letter-spacing: 0; }
.table tr.flash-new { animation: rowflash 2s ease-out; }
@keyframes rowflash { 0% { background: #fff4c2; } 100% { background: transparent; } }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; border: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .avatar { width: 34px; height: 34px; margin: 0; flex: none; }
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person-text a { font-weight: 600; }
.person-text .muted { font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px;
  font-size: 12px; font-weight: 600; line-height: 1.5; vertical-align: middle; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-in { background: var(--green-bg); color: var(--green); }
.badge-out { background: var(--primary-soft); color: var(--primary-dark); }
.badge-off { background: var(--gray-bg); color: var(--muted); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-bad { background: var(--red-bg); color: var(--red); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
label { display: block; margin: 8px 0; font-weight: 550; font-size: 13.5px; color: var(--text-2); }
label input, label select, label textarea, .filter-bar input, .filter-bar select {
  display: block; width: 100%; margin-top: 5px; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; font-size: 14px; font-weight: 400; background: var(--panel); color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
label select, .filter-bar select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
label select[multiple], label select[size] { background-image: none; padding-right: 12px; }
label input:hover, label select:hover, label textarea:hover,
.filter-bar input:hover, .filter-bar select:hover { border-color: #b8c2d2; }
label input:focus, label select:focus, label textarea:focus,
.filter-bar input:focus, .filter-bar select:focus,
input.cell:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--focus-ring);
}
label input:disabled, label select:disabled, label textarea:disabled {
  background: var(--gray-bg); color: var(--muted); cursor: not-allowed;
}
label input[type="file"] { padding: 6px 8px; min-height: 0; }
label input[type="checkbox"], label input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; min-height: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
label textarea { resize: vertical; min-height: 72px; }
::placeholder { color: var(--faint); }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 450; }
label.check input { width: auto; display: inline; margin: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; align-items: start; }
.form-grid .form-actions, .form-grid fieldset, .form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { margin-top: 14px; }

fieldset.check-row {
  border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 10px 14px; margin: 8px 0;
}
fieldset.check-row legend { font-weight: 600; padding: 0 6px; font-size: 13px; }
fieldset.check-row label.check { margin: 2px 0; }

/* grouped form sections inside a form-grid */
fieldset.form-section {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 6px 18px 16px; margin: 10px 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; align-items: start; background: var(--surface-2);
}
fieldset.form-section legend {
  font-weight: 650; padding: 2px 10px; color: var(--primary-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
fieldset.form-section fieldset, fieldset.form-section .span-2, fieldset.form-section .form-actions { grid-column: 1 / -1; }
@media (max-width: 700px) { fieldset.form-section { grid-template-columns: 1fr; } }

input.cell {
  width: 90px; padding: 6px 8px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); text-align: right; font: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input.cell-wide { width: 150px; text-align: left; }
.user-row-actions { white-space: nowrap; }
.user-row-actions form { margin: 2px 0; display: inline-flex; align-items: center; gap: 6px; }

/* Grouped action buttons kept on one aligned row (form footers, table action
   cells). Buttons and single-button forms become flex items with an even gap,
   so different-sized/multi-form button groups line up instead of drifting. */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.cell-actions > form.inline { margin: 0; }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 20px; }
.tabs button {
  border: none; background: none; font: inherit; font-weight: 550; padding: 10px 14px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: color .12s ease, background .12s ease;
}
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 650; }
.tabs button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* A segmented control of links (Reports: Attendance · In-Out · Payroll …). */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--gray-bg); border-radius: 12px; }
.seg .btn { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.seg .btn:hover { background: rgba(255, 255, 255, .7); }
.seg .btn.btn-primary { background: var(--panel); color: var(--primary-dark); border-color: var(--line); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------------------
   Filter bars and button rows
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: end; margin-bottom: 16px;
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.panel .filter-bar, .tab-panel .panel .filter-bar { padding: 0; border: 0; box-shadow: none; background: none; }
.filter-bar input, .filter-bar select { width: auto; display: inline-block; margin-top: 0; }
/* Labeled filter fields: the caption sits ABOVE its field (never glued
   beside it), every field aligns on the same baseline row. */
.filter-bar label {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 160px;
}
.filter-bar label.check { flex-direction: row; align-items: center; gap: 8px; min-width: 0; font-weight: 450; font-size: 13.5px; color: var(--text-2); }
.filter-bar label input, .filter-bar label select { width: 100%; font-weight: 400; }
.filter-bar .btn, .filter-bar button { align-self: end; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 7px 15px; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600;
  line-height: 1.4; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #b8c2d2; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(36, 89, 224, .25); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--red); border-color: #f1c7c2; background: var(--panel); }
.btn-danger:hover { background: var(--red-bg); border-color: #e7a8a0; }
.btn-sm { min-height: 30px; padding: 4px 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-block { display: flex; width: 100%; text-align: center; }

/* Inline forms (inside tables and button rows): align inputs with buttons. */
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; vertical-align: middle; }
form.inline input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), form.inline select {
  width: auto; min-height: 30px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; background: var(--panel); color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
form.inline input:focus, form.inline select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
form.inline label.check { margin: 0; font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Alerts and flash messages
   -------------------------------------------------------------------------- */
.alert {
  display: block; border-radius: var(--radius-lg); padding: 11px 14px; margin: 0 0 12px; line-height: 1.55;
  border: 1px solid transparent; font-size: 13.5px;
}
/* Only an alert built as icon + text is laid out in a row; any other alert
   (text with bold words, links, lists) flows as ordinary text, so its words
   are never spread apart as separate boxes. */
.alert:has(> .ico) { display: flex; align-items: flex-start; gap: 10px; }
.alert > .ico { margin-top: 1px; }
.alert > span { flex: 1; min-width: 0; }
.alert a { font-weight: 650; white-space: nowrap; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #c5ead3; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #f5c9c4; }
.alert-warn { background: var(--amber-bg); color: var(--amber); border-color: #f3dfae; }

/* License expiry banner + activation card */
.license-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.license-banner > .ico { margin-top: 0; }
.license-banner-actions { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.license-banner-x { background: none; border: 0; cursor: pointer; font-size: 20px; line-height: 1; color: inherit; opacity: 0.7; padding: 0 2px; }
.license-banner-x:hover { opacity: 1; }
.lic-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lic-head h2 { margin: 0; }
.lic-table { max-width: 560px; }
.lic-table td:first-child { color: var(--muted); width: 42%; }
.lic-key-input { width: 100%; box-sizing: border-box; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; word-break: break-all; }
/* Edition / plan comparison matrix */
/* The edition matrix stays a readable grid and scrolls sideways inside .scroll-x
   on narrow screens rather than crushing its columns (same pattern as the
   report grid and portal calendar). */
.plan-matrix { min-width: 620px; }
.plan-matrix th, .plan-matrix td.plan-cell { text-align: center; vertical-align: middle; }
.plan-matrix th:first-child, .plan-matrix td:first-child { text-align: left; }
.plan-matrix .plan-col-current { background: var(--primary-soft); }
.plan-matrix thead .plan-col-current { color: var(--primary-dark); }
.plan-yes { color: var(--green); font-weight: 700; font-size: 15px; }
.plan-no { color: var(--muted); }
/* Full-page salary-PIN gate + the compact unlock/disable forms */
.pin-gate { max-width: 460px; margin: 4vh auto; text-align: center; }
.pin-gate-icon { font-size: 42px; line-height: 1; }
.pin-gate h2 { margin: 8px 0 4px; }
.pin-gate .pin-gate-form { margin-top: 18px; text-align: left; }
.pin-unlock-form, .pin-disable-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.pin-unlock-form .pw-field, .pin-disable-form .pw-field { flex: 0 1 200px; }
.pin-disable-form { margin-top: 10px; }
.soft-sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
/* Permission groups whose module is outside the current edition (role matrix) */
.perm-group-gated { opacity: 0.72; }
.perm-group-gated .perm-pages .badge { vertical-align: middle; }

/* --------------------------------------------------------------------------
   Page head
   -------------------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel .page-head, .tab-panel .page-head { margin-bottom: 8px; }
.panel .page-head h2 { margin: 0; }

/* live indicator */
.live-dot { color: #1fb85a; font-size: .6em; vertical-align: middle; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.live-state { margin-left: 8px; font-size: 12px; }

/* --------------------------------------------------------------------------
   Report grid (monthly attendance matrix)
   -------------------------------------------------------------------------- */
/* Wide tables scroll horizontally only; long lists use pagination instead of
   nested vertical scrollbars. */
.scroll-x { overflow-x: auto; }
/* The monthly matrix scrolls beside a sticky employee column. Collapsed
   borders do NOT travel with sticky cells (gridlines shear while scrolling),
   so this table uses the separate border model with per-cell borders. */
.report-grid { border-collapse: separate; border-spacing: 0; }
.report-grid th, .report-grid td {
  padding: 4px 6px; font-size: 12.5px; white-space: nowrap;
  border-bottom: 1px solid var(--line); border-right: 1px solid #eef1f5;
}
.report-grid thead th { border-right-color: var(--line); }
.report-grid .sticky {
  position: sticky; left: 0; background: var(--panel); min-width: 170px; z-index: 1;
  border-right: 1px solid var(--line-strong); box-shadow: 3px 0 4px -2px rgba(23, 33, 46, .10);
}
.report-grid thead th.sticky { background: #f8fafc; z-index: 2; }

/* Phone presentation of the monthly matrix: employee cards with stat chips
   and a wrapping day strip. Hidden on desktop; the matrix hides on phones. */
.report-cards { display: none; }
.report-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff;
  padding: 11px 13px; margin: 0 0 10px; box-shadow: var(--shadow-sm);
}
.report-card-head { font-weight: 650; margin-bottom: 7px; }
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.chip {
  background: var(--gray-bg); border-radius: 14px; padding: 3px 10px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--text); font-variant-numeric: tabular-nums; margin-left: 2px; }
.day-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.day-cell {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; color: var(--muted); background: #fff;
  font-variant-numeric: tabular-nums;
}
.day-cell.cell-present { background: var(--green-bg); color: var(--green); border-color: transparent; }
.day-cell.cell-late { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.day-cell.cell-absent { background: var(--red-bg); color: var(--red); border-color: transparent; }
.day-cell.cell-weekend { background: var(--gray-bg); border-color: transparent; }

/* pagination */
.pager { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 12px 0 4px; }
.pager-link, .pager-current, .pager-off {
  display: inline-block; min-width: 30px; text-align: center; padding: 4.5px 9px;
  border-radius: 6px; font-size: 12.5px; font-weight: 500;
}
.pager-link { border: 1px solid var(--line-strong); background: #fff; color: var(--text); }
.pager-link:hover { background: var(--gray-bg); text-decoration: none; }
.pager-current { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.pager-off { color: var(--muted); }
.pager-note { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.cell-present { background: var(--green-bg); color: var(--green); text-align: center; }
.cell-late { background: var(--amber-bg); color: var(--amber); text-align: center; }
.cell-absent { background: var(--red-bg); color: var(--red); text-align: center; }
.cell-weekend { background: var(--gray-bg); }

/* collapsible line-item breakdowns (payroll) */
details.line-details > summary {
  cursor: pointer; color: var(--primary); font-weight: 500; font-size: 12.5px;
  padding: 4px 0; list-style-position: inside; user-select: none;
}
details.line-details > summary:hover { color: var(--primary-dark); }
details.line-details[open] > summary { margin-bottom: 6px; }

/* floating back-to-top */
.to-top {
  position: fixed; right: 20px; bottom: 20px; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--text); box-shadow: var(--shadow-md); cursor: pointer; font-size: 17px; line-height: 1;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, background .12s ease; z-index: 40;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--gray-bg); }
@media print { .to-top { display: none !important; } }

/* deduction policy summary */
.policy-summary { margin: 6px 0 14px; padding-left: 20px; }
.policy-summary li { margin: 3px 0; color: var(--muted); }
.policy-summary li strong { color: var(--text); }

/* audit log JSON details */
.audit-json {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; line-height: 1.5;
  background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; max-width: 560px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
details > summary { cursor: pointer; color: var(--primary); font-weight: 500; }

/* --------------------------------------------------------------------------
   Punch-location map
   -------------------------------------------------------------------------- */
.fpmap { margin: 12px 0; }
.fpmap-view {
  position: relative; overflow: hidden; height: 460px; max-height: 70vh;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #e8eef4; cursor: grab; touch-action: none;
}
.fpmap-view:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fpmap-grabbing { cursor: grabbing; }
.fpmap-layer { position: absolute; inset: 0; }
.fpmap-tile { position: absolute; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; }
.fpmap-nogrid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .5;
}
.fpmap-accuracy {
  position: absolute; border-radius: 50%;
  background: rgba(37, 99, 235, .14); border: 1px solid rgba(37, 99, 235, .35);
  pointer-events: none;
}
.fpmap-pin {
  position: absolute; transform: translate(-50%, -100%);
  min-width: 24px; height: 24px; padding: 0 5px;
  border: 2px solid #fff; border-radius: 12px 12px 12px 2px;
  background: var(--primary); color: #fff;
  font: 600 11px/20px Segoe UI, Arial, sans-serif; text-align: center;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.fpmap-pin-out { background: #b91c1c; }
.fpmap-pin:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fpmap-popup {
  position: absolute; transform: translate(-50%, calc(-100% - 30px));
  min-width: 190px; max-width: 280px; padding: 10px 26px 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22); font-size: 13px; z-index: 5;
}
.fpmap-popup-addr { margin-top: 4px; color: var(--muted); }
.fpmap-popup-coords { margin-top: 4px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.fpmap-popup-x {
  position: absolute; top: 4px; right: 6px; width: 20px; height: 20px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px;
}
.fpmap-controls { display: flex; gap: 8px; align-items: center; margin: 8px 0 0; flex-wrap: wrap; }
.fpmap-attribution { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.fpmap-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.fpmap-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
@media (max-width: 640px) { .fpmap-view { height: 320px; } }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(900px 520px at 85% -10%, #e4ecff 0%, rgba(228, 236, 255, 0) 60%), var(--bg);
}
.login-body > .login-card { margin: 32px 16px; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 34px 36px 30px;
  width: 420px; max-width: 100%; box-shadow: var(--shadow-md);
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card .btn-primary { margin-top: 16px; min-height: 44px; font-size: 14.5px; }
.login-logo { display: block; width: auto; height: auto; max-width: 200px; max-height: 64px; object-fit: contain; margin: 0 0 22px; }
/* The sign-in page: the company on the left, the form on the right. */
.auth-split { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; width: 100%; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 56px; color: #fff;
  background: radial-gradient(820px 520px at 0% 0%, #4d7cf5 0%, rgba(77, 124, 245, 0) 70%), linear-gradient(160deg, #1d4ed8 0%, #173a9e 45%, #0f1d3a 100%);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px); background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to top, transparent 10%, #000 75%); mask-image: linear-gradient(to top, transparent 10%, #000 75%);
}
.auth-aside-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-mark {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); font-weight: 800; letter-spacing: .03em;
}
.auth-logo { display: inline-flex; align-items: center; padding: 12px 18px; border-radius: 16px; background: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }
.auth-logo img { display: block; height: 44px; width: auto; max-width: 240px; object-fit: contain; }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
/* Beside the aside the logo is shown once, there; on a phone the aside is hidden and the card shows it. */
@media (min-width: 901px) { .auth-main .login-logo { display: none; } }
.auth-aside h2 { margin: 22px 0 18px; color: #fff; font-size: 32px; line-height: 1.18; letter-spacing: -.025em; font-weight: 700; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; color: rgba(255, 255, 255, .86); font-size: 15px; }
.auth-points li { display: flex; gap: 10px; align-items: baseline; }
.auth-points li::before { content: "\2713"; font-weight: 800; color: #9fe3b8; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-main .login-card { box-shadow: none; border: 0; background: transparent; padding: 0; width: 400px; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main .login-card { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-md); padding: 30px 26px 26px; }
}

/* First-time setup / system update card. Its own class so the sign-in and
   password-reset cards keep their width. One field per row: labels of different
   lengths can never push the inputs out of line. */
.setup-card { width: min(460px, calc(100vw - 32px)); max-width: none; padding: 34px 38px 30px; margin: 24px 0; }
.setup-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.setup-mark {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: var(--radius-lg);
  background: var(--primary-soft); color: var(--primary); font-size: 22px; line-height: 1;
}
.setup-product { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.login-card.setup-card h1 { margin: 2px 0 0; font-size: 22px; }
.setup-lead { margin: 0 0 16px; color: var(--text); line-height: 1.55; }
.setup-note { margin: -8px 0 16px; font-size: 13px; }
.setup-form label { margin: 0 0 14px; font-weight: 600; }
.setup-form label input { margin-top: 6px; padding: 10px 12px; }
.setup-form .pw-field > input { padding: 10px 12px; padding-right: 2.6em; }
.setup-form label .pw-toggle { top: 6px; }
.field-hint { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 400; color: var(--muted); line-height: 1.4; }
.setup-form .password-match { margin: -6px 0 12px; font-size: 13px; font-weight: 600; }
.login-card.setup-card .btn-primary { margin-top: 6px; padding: 11px 14px; font-weight: 600; }
.setup-done-list { list-style: none; margin: 0 0 20px; padding: 0; border-top: 1px solid var(--line); }
.setup-done-list li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setup-done-list li::before { content: "\2713"; flex: none; color: var(--green); font-weight: 700; }
@media (max-width: 480px) { .setup-card { padding: 26px 20px 22px; } }

/* Secondary link under the sign-in / reset forms ("Forgot your password?"). */
.login-alt { margin: 16px 0 0; text-align: center; font-size: 14px; }
.login-alt a { color: var(--primary); font-weight: 600; text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }
.login-alt a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

/* Password-reset helper text. .password-match is filled in by the page script;
   its colour is set inline there so the state survives without extra classes. */
.login-card .password-policy { margin: 10px 0 0; font-size: 13px; line-height: 1.45; }
.login-card .password-match { margin: 6px 0 0; font-size: 13px; font-weight: 600; }
.login-card .btn { margin-top: 14px; }

/* company logo preview + payslip branding */
.company-logo-preview {
  display: block; width: auto; height: auto; max-width: 260px; max-height: 110px; object-fit: contain;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin: 6px 0;
}
.slip-brand { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 12px; }
.slip-logo { width: auto; height: auto; max-width: 160px; max-height: 72px; object-fit: contain; }
.permission-matrix input[type="checkbox"] { width: auto; }

/* Payslip customization live preview: a miniature slip that mirrors the
   options. Scales with its column; stacks under the form on small screens
   via the surrounding grid-2. */
.slip-preview-wrap { position: sticky; top: 68px; }
.slip-preview {
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  padding: 16px 18px; box-shadow: var(--shadow-md); font-size: 12.5px;
}
.slip-preview-brand { display: flex; gap: 10px; align-items: flex-start; }
.slip-preview-logo { width: auto; height: 34px; max-width: 90px; object-fit: contain; }
.slip-preview-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #17212e; padding-bottom: 8px; margin-bottom: 8px; }
.slip-preview-title { text-align: right; font-weight: 700; letter-spacing: .05em; }
.slip-preview-kv th, .slip-preview-kv td { padding: 4px 8px; font-size: 12px; }
.slip-preview-net { background: var(--primary-soft); border: 1px solid #c7d6f8; border-radius: 8px; padding: 8px 12px; margin: 8px 0; display: flex; justify-content: space-between; }
.slip-preview-signatures { display: flex; gap: 14px; margin-top: 16px; }
.slip-preview-signatures span { flex: 1; border-top: 1px solid #9aa7b8; padding-top: 4px; text-align: center; color: var(--muted); font-size: 11px; }

/* Role permission editor: one clear block per page/area + sticky save bar. */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 13px; margin: 0 0 8px; background: #fcfdfe; }
.perm-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 4px; }
.perm-group-head .check { margin: 0; font-size: 13.5px; }
.perm-pages { color: var(--muted); font-size: 12px; }
.perm-group-caps { border: 0; padding: 0 0 0 26px; margin: 0; }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #fff; border-top: 1px solid var(--line); margin-top: 10px; padding: 10px 0 4px;
}

/* --------------------------------------------------------------------------
   Payroll roster & detail view
   -------------------------------------------------------------------------- */
.period-nav { display: flex; gap: 6px; align-items: center; }
.table-wrap { max-height: 72vh; overflow: auto; padding: 0; }
.table-wrap .table thead th { position: sticky; top: 0; z-index: 2; }
.table-wrap .table tfoot th {
  position: sticky; bottom: 0; background: #f4f7fb; border-top: 2px solid var(--line-strong);
  font-variant-numeric: tabular-nums;
}
.table.roster td { padding-top: 9px; padding-bottom: 9px; }
.table.roster .row-actions { white-space: nowrap; text-align: right; }
.readiness-list { margin: 6px 0 0 18px; padding: 0; }
.readiness-list li { margin: 3px 0; }
.detail-head h2 { margin: 4px 0 0; }
.detail-head .muted { font-size: 13.5px; font-weight: 400; }

/* --------------------------------------------------------------------------
   Dashboard charts (inline SVG, no libraries)
   -------------------------------------------------------------------------- */
.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: inherit; }
.chart .chart-tick { font-size: 10.5px; fill: #898781; font-variant-numeric: tabular-nums; }
.chart .chart-label { font-size: 11.5px; fill: #52514e; }
.chart .chart-value { font-size: 11px; font-weight: 600; fill: #52514e; font-variant-numeric: tabular-nums; }
.chart path { transition: opacity .1s ease; }
.chart path:hover { opacity: .82; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
@media (max-width: 980px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-note { margin: 8px 0 0; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { width: 180px; height: 180px; flex: 0 0 auto; }
.donut .donut-total { font-size: 30px; font-weight: 700; fill: var(--text); letter-spacing: -.02em; }
.donut .donut-caption { font-size: 11px; fill: #898781; text-transform: uppercase; letter-spacing: .05em; }
.donut-legend { list-style: none; margin: 0; padding: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13.5px; }
.donut-legend strong { font-variant-numeric: tabular-nums; }
.donut-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   Employee portal calendar
   -------------------------------------------------------------------------- */
.portal-cal { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 560px; }
.portal-cal th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 4px; text-align: center; }
.portal-cal td { border: 1px solid var(--line); height: 74px; vertical-align: top; padding: 5px 6px; }
.portal-cal .cal-num { font-weight: 650; font-size: 13px; display: block; }
.portal-cal .cal-label { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.3; word-break: break-word; }
.portal-cal .cal-empty { background: #fafbfc; border-color: #eef1f5; }
.portal-cal .cal-weekend { background: var(--gray-bg); }
.portal-cal .cal-holiday { background: var(--primary-soft); }
.portal-cal .cal-holiday .cal-label { color: var(--primary-dark); }
.portal-cal .cal-leave { background: var(--amber-bg); }
.portal-cal .cal-leave .cal-label { color: var(--amber); font-weight: 600; }
.portal-cal .cal-present { background: var(--green-bg); }
.portal-cal .cal-present .cal-label { color: var(--green); }
.portal-cal .cal-absent { background: var(--red-bg); }
.portal-cal .cal-absent .cal-label { color: var(--red); font-weight: 600; }
.portal-cal .cal-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-legend .badge { margin-right: 4px; }
.cal-absent-badge { background: var(--red-bg); color: var(--red); }

/* --------------------------------------------------------------------------
   Responsive layer — tablets and phones.
   -------------------------------------------------------------------------- */

/* Notched phones / installed PWA: keep the bar below the status bar. */
@supports (padding: env(safe-area-inset-top)) {
  .app-topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .container { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
}

/* Tablets: the sidebar keeps to its icons unless opened. */
@media (max-width: 1180px) and (min-width: 861px) {
  html:not(.sidebar-wide) .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
  html:not(.sidebar-wide) .nav-label, html:not(.sidebar-wide) .nav-group-label, html:not(.sidebar-wide) .sidebar-name,
  html:not(.sidebar-wide) .nav-caret, html:not(.sidebar-wide) .sidebar-foot { display: none; }
  html:not(.sidebar-wide) .sidebar-logo { width: 38px; height: 34px; max-width: none; object-fit: cover; object-position: left center; }
  html:not(.sidebar-wide) .sidebar-home:not(:has(.sidebar-logo)) .sidebar-mark { display: grid; }
  html:not(.sidebar-wide) .sidebar-brand { justify-content: center; padding: 0; }
  html:not(.sidebar-wide) .nav-item { justify-content: center; padding: 0; }
  html:not(.sidebar-wide) .nav-sub {
    position: fixed; left: calc(var(--sidebar-w-collapsed) + 6px); margin: -40px 0 0; padding: 6px; min-width: 230px; border: 1px solid var(--line);
    border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-lg); z-index: 90;
  }
  .container { padding: 20px 22px 56px; }
  .app-topbar { padding: 0 22px; }
}

@media (max-width: 860px) {
  /* Safety net: a stray wide element must never make the whole page pan
     sideways — wide content scrolls inside its own container instead. */
  html, body { overflow-x: hidden; max-width: 100%; }

  /* The sidebar becomes a drawer. */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(300px, 86vw) !important; flex: none;
    transform: translateX(-104%); box-shadow: var(--shadow-lg); z-index: 200;
  }
  html.sidebar-open .sidebar { transform: none; }
  html.sidebar-collapsed .sidebar .nav-label, html.sidebar-collapsed .sidebar .nav-group-label,
  html.sidebar-collapsed .sidebar .nav-caret { display: revert; }
  html.sidebar-collapsed .sidebar .sidebar-logo { width: auto; height: 34px; max-width: 150px; object-fit: contain; }
  html.sidebar-collapsed .sidebar .nav-item { justify-content: flex-start; padding: 0 11px; }
  html.sidebar-collapsed .sidebar .sidebar-brand { justify-content: space-between; padding: 0 14px 0 16px; }
  html.sidebar-collapsed .sidebar .nav-sub { position: static; margin: 2px 0 8px 21px; padding: 0 0 0 12px; min-width: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  html.sidebar-collapsed .sidebar .nav-group { border-bottom: 0; padding-bottom: 0; }
  .sidebar-foot { display: none; }
  .icon-btn.sidebar-close { display: inline-grid; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .4); }
  .sidebar-scrim[hidden] { display: none; }
  html.sidebar-open { overflow: hidden; }

  .app-topbar { gap: 8px; padding: 0 12px; }
  .icon-btn.topbar-menu { display: inline-grid; }
  .topbar-company { display: block; flex: 1; font-size: 15px; }
  .cmdk-trigger { flex: none; width: 38px; padding: 0; justify-content: center; background: none; border-color: transparent; }
  .cmdk-trigger-text, .cmdk-trigger kbd { display: none; }
  .topbar-actions { margin-left: 0; }
  .user-chip-text, .user-chip-caret { display: none; }
  .user-chip { padding: 2px; }
  .cmdk { padding-top: 8vh; }
  .cmdk-foot { display: none; }

  .container { padding: 16px 14px 56px; }
  h1 { font-size: 20px; margin: 6px 0; }
  .page-head { row-gap: 8px; }
  code { word-break: break-all; }

  /* Every list table in the app is a table-stack card deck on phones, so no
     forced widths remain. The monthly report matrix (31 day columns) is the
     one deliberate exception: it scrolls inside its own panel. Containers
     keep overflow-x as a safety net for anything unexpected. */
  .panel, .scroll-x, .table-wrap, .slip { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel { padding: 13px 14px; }
  .report-grid { min-width: 900px; }
  .table-wrap { max-height: none; }
  /* Monthly matrix: swap the 38-column grid for per-employee cards. */
  .report-grid-wrap { display: none; }
  .report-cards { display: block; }

  /* Tabs become a wrapping pill grid: every tab fully visible and evenly
     sized — no sideways scrolling, no half-cut labels. */
  .tabs { flex-wrap: wrap; overflow: visible; border-bottom: 0; gap: 6px; }
  .tabs button {
    flex: 1 1 auto; min-width: 31%; margin-bottom: 0; padding: 10px 8px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: #fff; color: var(--text); text-align: center;
  }
  .tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 650; }
  .tabs button:hover { background: var(--gray-bg); }
  .tabs button.active:hover { background: var(--primary-dark); color: #fff; }

  /* Filters stack into tidy full-width rows; the buttons form their own
     even row instead of dangling behind the last field. */
  .filter-bar label { flex: 1 1 150px; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .filter-bar .btn, .filter-bar button {
    flex: 1 1 auto; min-width: 104px; text-align: center;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .chart-grid { gap: 12px; }
  .to-top { right: 14px; bottom: 14px; }
}

@media (max-width: 700px) {
  /* A list of cards needs no frame around it. */
  .panel:has(> table.table-stack), .panel:has(> .table-wrap > table.table-stack) { background: none; border: 0; box-shadow: none; padding: 0; }
  /* Touch targets and iOS: 16px inputs stop Safari auto-zoom; 42px+ controls
     are comfortably tappable. */
  label input, label select, label textarea,
  .filter-bar input, .filter-bar select { font-size: 16px; padding: 9px 11px; }
  form.inline input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  form.inline select { font-size: 15px; padding: 7px 10px; }
  .btn { padding: 10px 15px; min-height: 42px; }
  .btn-sm { padding: 7px 12px; font-size: 13px; min-height: 36px; }
  .pager-link, .pager-current, .pager-off { padding: 8px 12px; min-width: 38px; font-size: 13.5px; }
  .tabs button { padding: 11px 14px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 10px; }
  .card { padding: 12px 14px; }
  .card-num { font-size: 22px; }
  .table th, .table td { padding: 8px 8px; }
  .grid-2 { gap: 12px; }
}

@media (max-width: 420px) {
  .login-card { padding: 26px 20px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .topbar-company { max-width: 55vw; }
}

/* --------------------------------------------------------------------------
   Stacked-card tables on phones: rows become cards, each cell shows its own
   column label (from data-th), so nothing needs sideways scrolling. Tables
   opt in with class "table-stack"; cells without a data-th (action buttons)
   span the full card width.
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  .table.table-stack { min-width: 0 !important; }
  .table-stack thead, .table-stack tfoot { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr {
    border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff;
    margin: 0 0 10px; padding: 8px 13px 10px; box-shadow: var(--shadow-sm);
  }
  /* Side-by-side label | value rows. CSS table layout on purpose: the
     ::before label is a fixed left cell and ALL remaining inline content
     (badge + text, two badges, link + code, inline forms) is grouped by the
     browser into ONE anonymous right cell — natural badge sizes, no
     stretching, no column-jumping. (A real grid promotes every child to its
     own stretched item — the old "skewed badge" bug.) */
  .table-stack td { display: table; table-layout: fixed; border-bottom: 0; padding: 4px 0; text-align: left; }
  .table-stack td.num { text-align: left; }
  .table-stack td::before {
    content: attr(data-th); display: table-cell; width: 96px; padding-right: 10px;
    color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase;
    letter-spacing: .05em; vertical-align: top; padding-top: 2px;
  }
  .table-stack td:not([data-th])::before, .table-stack td[data-th=""]::before { content: none; }
  .table-stack td[data-th=""]:empty { display: none; }
  .table-stack td .badge { vertical-align: baseline; margin: 1px 6px 1px 0; }
  .table-stack td { line-height: 1.55; }

  /* Action area of a card: an even, full-tap-target button row separated
     from the data fields — no more ragged inline buttons. */
  .table-stack td[data-th=""] {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch;
    margin-top: 7px; padding-top: 9px; border-top: 1px dashed var(--line);
  }
  .table-stack td[data-th=""] form.inline { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 6px; margin: 0; }
  .table-stack td[data-th=""] .btn {
    flex: 1 1 auto; min-width: 104px; min-height: 38px; text-align: center;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .table-stack td[data-th=""] form.inline input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  .table-stack td[data-th=""] form.inline select { flex: 1 1 150px; width: auto; min-height: 38px; }
  .table-stack td[data-th=""] .muted { align-self: center; }
  /* Row-header tables (e.g. permission matrix): the th becomes the card's
     section label and the td content flows full-width beneath it. */
  .table-stack tbody th {
    display: block; width: 100%; padding: 8px 0 2px; background: none; border-bottom: 0;
    color: var(--primary-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  }
  .table-stack td:not([data-th]) { display: block; }
  /* Long identifiers (serials, capability codes, URLs) wrap instead of
     widening the card. */
  .table-stack .mono, .table-stack code { word-break: break-all; }
  .table-stack td br { display: none; } /* name/code pairs flow inline inside a card */
  .table-stack td br + span, .table-stack td br + a { margin-left: 6px; }
  .table-stack tr:hover { background: #fff; }

  /* Calendars (admin company calendar + employee portal) fit the phone:
     no sideways swipe. Day colors carry the status (see legend); the text
     labels return on wider screens. */
  .portal-cal { min-width: 0; }
  .portal-cal th { font-size: 8.5px; padding: 4px 1px; letter-spacing: 0; text-align: center; }
  .portal-cal td { height: auto; min-height: 40px; padding: 3px 2px; }
  .portal-cal .cal-num { font-size: 11px; text-align: center; }
  .portal-cal .cal-label { display: none; }
  .portal-cal .cal-today { outline-width: 2px; }
}

/* --------------------------------------------------------------------------
   Print — every page becomes a clean document (browser "Save as PDF")
   -------------------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .sidebar-scrim, .app-topbar, .cmdk, .seg, .footer, .filter-bar, .btn, .btn-row, .tabs, .no-print,
  form.inline, .form-actions, .user-row-actions, noscript { display: none !important; }
  .app-shell, .app-main { display: block; }
  .container { max-width: 100%; padding: 0; }
  .panel, .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  .scroll-x { overflow: visible; }
  .tab-panel { display: block !important; }
  a { color: #000; text-decoration: none; }
  .table thead th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cell-present, .cell-late, .cell-absent, .cell-weekend, .badge {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* --------------------------------------------------------------------------
   Password visibility toggle (applied by app.js to every password input).
   The wrapper stays layout-neutral: block inside form labels (fills the
   label like the bare input did), shrink-to-fit as a flex item in inline
   row-action forms, so alignment is identical everywhere.
   -------------------------------------------------------------------------- */
.pw-field { position: relative; display: block; flex: 1 1 150px; min-width: 0; }
/* Full field appearance so a password input looks identical whether or not it
   sits inside a <label>. The base input rule only targets `label input` /
   `.filter-bar input`, so bare inputs (the salary-PIN unlock and disable forms)
   would otherwise render as unstyled browser defaults. `padding-right` keeps
   room for the eye toggle; the values match `label input` exactly, so wrapped
   fields inside labels are visually unchanged. */
.pw-field > input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; padding-right: 2.6em;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; font-weight: 400; background: #fff; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.pw-field > input:hover { border-color: #a9b6c9; }
.pw-field > input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.pw-toggle {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2.4em;
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0; background: none; border: none;
  color: var(--muted); cursor: pointer; border-radius: var(--radius);
}
/* The input keeps its 4px gap below the label text; hug the toggle to it. */
label .pw-toggle { top: 4px; }
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pw-toggle svg { width: 1.15em; height: 1.15em; display: block; pointer-events: none; }
.pw-toggle .pw-eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye-off { display: block; }
@media (pointer: coarse) { .pw-toggle { width: 2.9em; } .pw-field > input { padding-right: 3em; } }
@media print { .pw-toggle { display: none !important; } }
/* The mobile stacked users table sets inline-form inputs to width:auto with a
   higher-specificity rule; keep the wrapped reset-password input full-width. */
.table-stack td[data-th=""] form.inline .pw-field > input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
}

/* --------------------------------------------------------------------------
   PWA install instructions sheet (shown on iOS, where there is no install API
   and the user must Share > Add to Home Screen). Built by app.js.
   -------------------------------------------------------------------------- */
.pwa-sheet {
  position: fixed; inset: 0; z-index: 1000; display: flex;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 15, 25, .55); animation: pwa-fade .12s ease;
}
.pwa-sheet-card {
  background: #fff; color: var(--text); width: 100%; max-width: 390px;
  border-radius: 12px; padding: 20px 22px; box-shadow: 0 14px 44px rgba(0, 0, 0, .35);
}
.pwa-sheet-card h2 { margin: 0 0 8px; font-size: 18px; }
.pwa-sheet-card p { margin: 8px 0; }
.pwa-sheet-card ol { margin: 12px 0; padding-left: 22px; line-height: 1.75; }
.pwa-sheet-card .pwa-share-ico { vertical-align: -4px; color: var(--primary); margin: 0 2px; }
.pwa-sheet-close { margin-top: 14px; width: 100%; }
@keyframes pwa-fade { from { opacity: 0; } to { opacity: 1; } }
@media print { .pwa-sheet { display: none !important; } }

/* iOS Safari auto-zooms toward any focused field whose font is under 16px.
   The viewport meta already blocks zoom, but rendering text-entry controls at
   16px on small screens guarantees no focus-zoom even where a browser ignores
   user-scalable. (The tiny numeric .cell inputs are left as-is — the viewport
   lock covers them, and 16px would break their fixed width.) */
@media (max-width: 767px) {
  label input, label select, label textarea,
  .filter-bar input, .filter-bar select, .pw-field > input { font-size: 16px; }
}

/* Attendance: geolocation button/dialog + edit/void actions and modal dialogs. */
.loc-btn { margin-top: 4px; white-space: nowrap; }
.loc-address { line-height: 1.55; font-size: 14px; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin: 0 3px 3px 0; }

/* Reusable modal dialog (edit / void punch, and future confirmations). */
.fp-dialog {
  border: none; border-radius: 12px; padding: 0; color: var(--text);
  width: min(420px, calc(100vw - 32px)); box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
}
.fp-dialog::backdrop { background: rgba(10, 15, 25, .55); }
.fp-dialog-form { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; }
.fp-dialog-form h3 { margin: 0 0 8px; font-size: 17px; }
.fp-dialog-form label { margin: 4px 0; font-weight: 500; }
.fp-dialog-form p { margin: 2px 0 4px; }
.fp-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Confirmation variant (replaces native confirm/alert/prompt) */
.fp-confirm-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--text); }
.fp-confirm-msg { margin: 0; color: var(--text); line-height: 1.5; white-space: pre-line; }
.fp-confirm-msg[hidden] { display: none; }
.fp-confirm-match { display: block; margin: 14px 0 0; font-weight: 500; }
/* Only shown for "type the code to confirm" modals. Without this an author
   display rule overrides the [hidden] attribute, leaking a stray input onto
   every other confirmation (archive, delete, disable, …). */
.fp-confirm-match[hidden] { display: none; }
.fp-confirm-match > span { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.fp-confirm-match > input {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; font-weight: 400; background: #fff; color: var(--text);
}
.fp-confirm-match > input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.fp-confirm .fp-dialog-actions .btn { min-width: 92px; text-align: center; }

/* --------------------------------------------------------------------------
   Empty states
   A list with nothing in it used to render as a full column header above one
   grey line, which reads as broken rather than new. These give the blank case
   the same care as the populated one: what this screen is for, and the one
   action that fills it. Two shapes -- nothing exists yet (offer the action),
   and nothing matched a filter (offer to clear it).
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 44px 24px; gap: 4px;
}
.empty-state .es-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 24px; line-height: 1; margin-bottom: 10px;
}
.empty-state .es-title { font-size: 15.5px; font-weight: 650; color: var(--text); }
.empty-state .es-body {
  color: var(--muted); font-size: 13px; max-width: 46ch; line-height: 1.6; margin-top: 2px;
}
.empty-state .es-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
/* Inside a table the state has to live in a cell, so drop the cell's own
   padding and borders and let the block centre itself across the full width. */
td.empty-state-cell { padding: 0 !important; border-bottom: 0 !important; }
td.empty-state-cell .empty-state { padding: 38px 20px; }
.table-stack tr.empty-state-row { border: 0; box-shadow: none; background: none; padding: 0; }
.table-stack td.empty-state-cell::before { content: none; }
/* Filtered-empty is a lighter weight than never-populated: no icon, less space. */
.empty-state.is-filtered { padding: 30px 20px; }
.empty-state.is-filtered .es-icon { display: none; }

/* First-run guidance. Shown on the dashboard until the company has employees,
   because a wall of zeroes gives a new administrator nothing to act on. */
.setup-guide { border-left: 3px solid var(--primary); }
.setup-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.setup-steps li { display: flex; align-items: flex-start; gap: 11px; }
.setup-steps .step-n {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.setup-steps .step-done { background: var(--green-bg); color: var(--green); }
.setup-steps .step-body { flex: 1 1 auto; }
.setup-steps .step-body b { font-weight: 600; }
.setup-steps .step-body .muted { display: block; font-size: 12.5px; margin-top: 1px; }
.setup-steps li.is-done .step-body b { color: var(--muted); font-weight: 500; }

@media (max-width: 720px) {
  .empty-state { padding: 32px 16px; }
  .empty-state .es-icon { width: 46px; height: 46px; font-size: 21px; }
  .empty-state .es-actions { width: 100%; }
  .empty-state .es-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.setup-steps li > .btn { flex: 0 0 auto; align-self: center; margin-left: auto; }
@media (max-width: 560px) {
  .setup-steps li { flex-wrap: wrap; }
  .setup-steps li > .btn { margin-left: 33px; width: calc(100% - 33px); justify-content: center; }
}

/* --------------------------------------------------------------------------
   Mobile app setup (inc/appsetup.php): QR code, company code and two steps.
   The code stays black on white whatever surrounds it, because scanners need
   the contrast; its quiet zone is part of the drawing (assets/qr.js).
   -------------------------------------------------------------------------- */
.app-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.app-setup-qr {
  flex: 0 0 auto; width: 180px; max-width: 100%; aspect-ratio: 1 / 1;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.app-setup-qr svg { display: block; width: 100%; height: 100%; }
.app-setup-info { flex: 1 1 220px; min-width: 0; }
.app-setup-code { margin-bottom: 12px; }
.app-setup-code-label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
/* Monospace so 0/O and 1/I cannot be confused when typed on a phone. */
.app-setup-code-value {
  display: block; margin-top: 2px; font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 30px; font-weight: 700; letter-spacing: .08em; line-height: 1.15; overflow-wrap: anywhere;
}
.app-setup-steps { margin-top: 0; }
/* No button in these steps, so keep each number beside its text on phones. */
.app-setup-steps li { flex-wrap: nowrap; }
.app-setup-steps .step-body { min-width: 0; }

/* Enrol page: the same block, stacked and centred in the sign-in style card. */
.enrol-card { margin: 24px 0; text-align: center; }
.enrol-card .app-setup { flex-direction: column; gap: 14px; margin: 18px 0 4px; }
.enrol-card .app-setup-info { flex: none; width: 100%; }
.enrol-card .app-setup-steps { max-width: 290px; margin: 0 auto; text-align: left; }
.enrol-card .alert { text-align: left; }
.enrol-address { margin: 16px 0 0; font-size: 13px; }
.enrol-address .mono { display: block; margin-top: 2px; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 420px) { .app-setup-qr { width: 164px; } .app-setup-code-value { font-size: 26px; } }

/* A form on its way (app.js): one send per click, and it shows. */
form.is-submitting { cursor: progress; }
form.is-submitting button:not([type="button"]), form.is-submitting input[type="submit"] { opacity: .6; pointer-events: none; }

/* --------------------------------------------------------------------------
   Employee picker (app.js): type any part of a name or code to find someone.
   -------------------------------------------------------------------------- */
.picker { position: relative; display: block; min-width: 250px; }
.picker-native {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: 0 !important; overflow: hidden; clip: rect(0 0 0 0); border: 0 !important; opacity: 0; pointer-events: none;
}
.picker .picker-input { width: 100%; padding-right: 30px; }
.picker-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: none; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.picker-clear:hover { background: var(--gray-bg); color: var(--text); }
.picker.has-value .picker-clear { display: block; }
.picker-list {
  position: absolute; z-index: 60; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(420px, 92vw);
  max-height: 320px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.picker-list li {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer;
  text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 400; color: var(--text); white-space: nowrap;
}
.picker-list li.active { background: var(--primary-soft); }
.picker-list li[aria-selected="true"] .picker-name { font-weight: 600; }
.picker-code { min-width: 34px; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.picker-list li.picker-none { color: var(--muted); cursor: default; }

/* Live filters (app.js): the Apply button is only for browsers without it. */
html.live-filters .live-submit {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html.is-filtering [data-live-region] { opacity: .55; transition: opacity .12s ease; }

/* --------------------------------------------------------------------------
   Monthly In-Out report: one sheet per employee, one page each when printed.
   -------------------------------------------------------------------------- */
.inout-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 14px; font-size: 12.5px; }
.inout-legend b { color: var(--text); }
.inout-sheet { padding-top: 16px; }
.inout-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.inout-head h2 { margin: 0 0 2px; }
.inout-head p { margin: 0; }
.inout-printed { font-size: 12px; }
.inout-meta {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 18px;
  margin: 14px 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.inout-meta div { min-width: 0; }
.inout-meta-wide { grid-column: span 2; }
.inout-meta dt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.inout-meta dd { margin: 1px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.inout-table { font-variant-numeric: tabular-nums; }
.inout-table th, .inout-table td { padding: 6px 9px; white-space: nowrap; }
.inout-table td:first-child { font-weight: 500; }
.inout-time { font-variant-numeric: tabular-nums; }
.inout-table tfoot td { border-top: 2px solid var(--line-strong); font-weight: 500; padding-top: 10px; white-space: normal; }
.inout-row-wo td, .inout-row-h td { background: #f6f8fb; color: var(--muted); }
.inout-row-a td { background: #fff8f7; }
.inout-row-none td { color: var(--muted); }
.inout-code {
  display: inline-block; min-width: 38px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; background: var(--gray-bg); color: var(--muted);
}
.inout-code-p { background: var(--green-bg); color: var(--green); }
.inout-code-p-lt { background: var(--amber-bg); color: var(--amber); }
.inout-code-a { background: var(--red-bg); color: var(--red); }
.inout-code-pl, .inout-code-ul, .inout-code-h { background: var(--primary-soft); color: var(--primary-dark); }
.inout-missing-mark { color: var(--red); font-weight: 700; }
.inout-print-legend { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .inout-legend { font-size: 10px; }
  /* A sheet longer than a page must break across pages: the general print
     rule keeps a .panel on one page, which would clip a 93-day sheet. */
  .inout-sheet { break-inside: auto; page-break-inside: auto; break-after: page; page-break-after: always; border: 0 !important; box-shadow: none; padding: 0; margin: 0; }
  .inout-table thead { display: table-header-group; }
  .inout-table tr { break-inside: avoid; page-break-inside: avoid; }
  .inout-sheet:last-of-type { break-after: auto; page-break-after: auto; }
  /* A month on one A4 landscape page per employee, as on the old report. */
  main:has(.inout-sheet) > .page-head, .inout-legend { display: none !important; }
  .inout-head h2 { font-size: 14px; }
  .inout-head p, .inout-printed { font-size: 9.5px; }
  .inout-meta { grid-template-columns: repeat(4, 1fr); gap: 2px 12px; margin: 6px 0; padding: 5px 8px; background: none; border: 1px solid #999; }
  .inout-meta-wide { grid-column: span 1; }
  .inout-meta dt { font-size: 7.5px; }
  .inout-meta dd { font-size: 10px; }
  .inout-table { font-size: 9.5px; }
  .inout-table th, .inout-table td { padding: 1px 5px; line-height: 1.3; border: 1px solid #bbb; }
  .inout-table tfoot td { padding-top: 3px; }
  .inout-code { min-width: 30px; padding: 0 5px; font-size: 8.5px; }
  .inout-print-legend { display: block !important; margin: 3px 0 0; font-size: 8px; }
  .inout-row-wo td, .inout-row-h td, .inout-row-a td, .inout-code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --------------------------------------------------------------------------
   Filter toolbar extras: quick date ranges, an Export menu, count chips.
   -------------------------------------------------------------------------- */
.filter-actions { display: flex; gap: 8px; align-items: end; margin-left: auto; }
.quick-ranges { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; padding-top: 2px; }
.chip-link {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.chip-link:hover { background: var(--panel); border-color: var(--line-strong); text-decoration: none; }
.chip-link.active { background: var(--primary-soft); border-color: #c9d6fb; color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }

details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); opacity: .55;
}
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 220px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; white-space: nowrap;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }

.count-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 0 0 16px; }
.count-chip {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.count-chip:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.count-chip.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.count-chip.zero { opacity: .55; }
.count-num { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.count-present .count-num { color: var(--green); }
.count-late .count-num, .count-missing .count-num { color: var(--amber); }
.count-absent .count-num { color: var(--red); }
.count-leave .count-num { color: var(--primary-dark); }

/* Column headings stay in view while a long table scrolls. */
.sticky-head thead th { position: sticky; top: var(--topbar-h); z-index: 2; }
.scroll-x:has(> .sticky-head) { overflow-x: clip; }
@media (max-width: 860px) {
  .filter-actions { margin-left: 0; flex: 1 1 100%; }
  .filter-actions .btn, .filter-actions details.dropdown { flex: 1 1 auto; }
  .filter-actions details.dropdown > summary { width: 100%; }
  .dropdown-menu { left: 0; right: auto; }
}
@media print { .quick-ranges, .filter-actions, .count-strip { display: none !important; } }
/* Times and short figures never break across lines. */
.table td[data-th="Date"], .table td[data-th="In"], .table td[data-th="Out"], .table td[data-th="Worked"],
.table td[data-th="Late"], .table td[data-th="OT"], .table td[data-th="Time"] { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Page titles with a line of context, and the Settings section menu.
   -------------------------------------------------------------------------- */
.page-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-title h1 { margin: 0; }
.page-sub { margin: 0; color: var(--muted); font-size: 13.5px; }

.settings-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-body { min-width: 0; }
.settings-body > .tab-panel > .panel:first-child { margin-top: 0; }
.tabs.tabs-vertical {
  position: sticky; top: calc(var(--topbar-h) + 16px); flex-direction: column; flex-wrap: nowrap; gap: 1px; margin: 0; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.tabs.tabs-vertical button {
  width: 100%; margin: 0; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); text-align: left; white-space: normal;
}
.tabs.tabs-vertical button.active { background: var(--primary-soft); color: var(--primary-dark); }
.tabs-group-label { padding: 10px 12px 4px; font-size: 11px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.tabs-group-label:first-child { padding-top: 4px; }
@media (max-width: 1100px) {
  .settings-layout { grid-template-columns: 1fr; gap: 14px; }
  .tabs.tabs-vertical { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .tabs.tabs-vertical button { width: auto; }
  .tabs-group-label { display: none; }
}
@media print { .tabs.tabs-vertical { display: none !important; } .settings-layout { display: block; } }

/* --------------------------------------------------------------------------
   Stat cards with icons, the employee profile header, the sticky save bar.
   -------------------------------------------------------------------------- */
.card-link { display: flex; align-items: center; gap: 14px; color: var(--text); }
.card-link:hover { text-decoration: none; border-color: var(--line-strong); transform: translateY(-1px); }
.card-link .card-num, .card-link .card-label { display: block; }
.card-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; }
.tone-blue { background: #e8efff; color: #2459e0; }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-violet { background: #f1ebff; color: #6d3fd6; }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-slate { background: var(--gray-bg); color: var(--text-2); }

.profile-head { display: flex; align-items: center; gap: 18px; min-width: 0; }
.profile-photo { width: 64px; height: 64px; flex: none; border-radius: 18px; object-fit: cover; border: 1px solid var(--line); }
.profile-initials {
  display: inline-grid; place-items: center; background: linear-gradient(140deg, #e0e8ff, #c3d3ff);
  color: var(--primary-dark); font-weight: 800; font-size: 22px; letter-spacing: .01em;
}
.profile-text { min-width: 0; }
.profile-text h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 6px; }
.profile-text h1 .badge { font-family: var(--font); font-size: 12px; letter-spacing: 0; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--muted); font-size: 13.5px; }
.profile-meta span { display: inline-flex; align-items: center; }
.profile-meta span + span::before { content: ""; width: 4px; height: 4px; margin: 0 10px; border-radius: 50%; background: var(--line-strong); }
.profile-meta b { color: var(--text); }

.form-actions.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 14px -20px -18px; padding: 12px 20px; background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.form-actions.sticky-actions .muted { font-size: 12.5px; }
@media (max-width: 700px) {
  .profile-photo { width: 52px; height: 52px; border-radius: 14px; }
  .profile-initials { font-size: 18px; }
  .form-actions.sticky-actions { margin: 14px -14px -13px; padding: 10px 14px; }
}
@media print { .card-icon { display: none; } .form-actions.sticky-actions { position: static; } }
/* A page title stacks its line of context under it (beats .page-head > div). */
.page-head > .page-title { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.page-head > .profile-head { display: flex; flex-wrap: nowrap; }
/* Phones and tablets: the settings menu is one row of pills that scrolls. */
@media (max-width: 1100px) {
  .tabs.tabs-vertical { flex-wrap: nowrap; overflow-x: auto; padding: 6px; gap: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs.tabs-vertical::-webkit-scrollbar { display: none; }
  .tabs.tabs-vertical button {
    flex: none; width: auto; min-width: 0; margin: 0; padding: 7px 14px; white-space: nowrap; text-align: center;
    border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text-2);
  }
  .tabs.tabs-vertical button.active { background: var(--primary-soft); border-color: #c9d6fb; color: var(--primary-dark); }
}
/* A tick box in a filter or form row keeps its own size, never the field width. */
.filter-bar input[type="checkbox"], .filter-bar input[type="radio"],
label.check input[type="checkbox"], label.check input[type="radio"] { width: 16px !important; height: 16px; min-height: 0; flex: none; margin: 0; }
@media (max-width: 700px) {
  .profile-head { align-items: flex-start; gap: 14px; }
  .profile-meta { gap: 4px 12px; }
  .profile-meta span + span::before { display: none; }
}

/* --------------------------------------------------------------------------
   In-Out report, the company's old layout: plain ruled boxes, one employee per
   printed page, In1..Out9 whether or not a day uses them.
   -------------------------------------------------------------------------- */
.inout-classic {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px 22px; margin-bottom: 18px; overflow-x: auto; box-shadow: var(--shadow-sm);
  font-family: Arial, Helvetica, sans-serif; color: #000;
}
.ic-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.ic-title { font-size: 13px; font-weight: 700; }
.ic-stamp { font-size: 11px; text-align: left; white-space: nowrap; }
.ic-table { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 11px; table-layout: fixed; }
.ic-table col { width: 3.9%; }
.ic-table col.ic-date { width: 7.5%; }
.ic-table col.ic-status { width: 5.5%; }
.ic-table col.ic-hours { width: 5.5%; }
.ic-table th, .ic-table td { border: 1px solid #000; padding: 2px 4px; height: 19px; text-align: left; vertical-align: middle; white-space: nowrap; overflow: hidden; }
.ic-table .ic-cols th { font-weight: 700; text-align: center; background: none; }
.ic-table tbody.ic-head td { border: 1px solid #000; font-size: 11px; }
.ic-head .ic-company { border-bottom: 0; }
.ic-head .ic-v { font-weight: 700; }
.ic-head tr.ic-gap td { height: 8px; border: 0; }
.ic-table tbody tr:hover { background: none; }
@media print {
  .inout-classic {
    border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0; overflow: visible;
    break-after: page; page-break-after: always; break-inside: auto; page-break-inside: auto;
  }
  .inout-classic:last-of-type { break-after: auto; page-break-after: auto; }
  .ic-table { min-width: 0; font-size: 8.5px; }
  .ic-table th, .ic-table td { height: 15px; padding: 1px 3px; }
  main:has(.inout-classic) > .page-head { display: none !important; }
  .ic-table tr { break-inside: avoid; page-break-inside: avoid; }
}
/* --------------------------------------------------------------------------
   Sidebar, second pass: everything fits without scrolling, the page you are on
   is unmistakable, and the collapse control sits with the logo.
   -------------------------------------------------------------------------- */
.sidebar-brand { gap: 6px; }
.sidebar-brand .icon-btn { width: 32px; height: 32px; color: var(--faint); }
.sidebar-brand .icon-btn:hover { color: var(--text); }
.sidebar-home { flex: 1; }
.sidebar-nav { padding: 8px 10px 14px; }
.nav-group { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.nav-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.nav-group-label { padding: 0 11px 3px; font-size: 10.5px; }
.nav-item { position: relative; min-height: 32px; font-size: 13.5px; gap: 10px; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
html.sidebar-collapsed .nav-item.active::before { left: 0; }
.nav-sub a { padding: 5px 10px; }
html.sidebar-collapsed .sidebar-collapse .ico { transform: rotate(180deg); }
/* Collapsed the rail shows the toggle where the logo was, so it can be opened again. */html.sidebar-collapsed .sidebar-home { display: none; }
html.sidebar-collapsed .sidebar-brand .sidebar-collapse { display: inline-grid; }

@media (max-width: 860px) {
  .sidebar-brand .sidebar-collapse { display: none !important; }
}
