/* ==========================================================================
   Fakhri HRMS — design system
   A dense, calm "business software" look: neutral greys, one maroon accent
   (#870808, from fakhriitservices.com), hairline borders instead of shadows,
   compact controls and tabular figures. Inter throughout.
   Mobile-first: one column by default, sidebar from 1024px, bottom tabs on
   phones, tables collapse into labelled cards under 720px.
   ========================================================================== */

:root {
  --primary: #870808;
  --primary-dark: #6f0606;
  --primary-light: #a90a0a;
  --primary-soft: #fbf3f3;
  --primary-soft-border: #efd3d3;

  --ink: #18181b;
  --ink-soft: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --surface: #f4f4f6;
  --card: #ffffff;
  --subtle: #fafaf9;
  --hover: #f4f4f3;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --navy: #0a192f;
  --navy-soft: #1c3f60;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;

  /* iOS Human Interface Guidelines Tokens */
  --ios-bg: #f2f2f7;
  --ios-card-bg: #ffffff;
  --ios-glass-bg: rgba(255, 255, 255, 0.86);
  --ios-glass-border: rgba(60, 60, 67, 0.12);
  --ios-border: rgba(60, 60, 67, 0.10);
  --ios-separator: rgba(60, 60, 67, 0.08);

  --ios-blue: #007aff;
  --ios-blue-gradient: linear-gradient(135deg, #0a84ff 0%, #007aff 100%);
  --ios-green: #34c759;
  --ios-green-gradient: linear-gradient(135deg, #30d158 0%, #34c759 100%);
  --ios-indigo: #5856d6;
  --ios-indigo-gradient: linear-gradient(135deg, #5e5ce6 0%, #5856d6 100%);
  --ios-orange: #ff9500;
  --ios-orange-gradient: linear-gradient(135deg, #ff9f0a 0%, #ff9500 100%);
  --ios-pink: #ff2d55;
  --ios-pink-gradient: linear-gradient(135deg, #ff375f 0%, #ff2d55 100%);
  --ios-purple: #af52de;
  --ios-purple-gradient: linear-gradient(135deg, #bf5af2 0%, #af52de 100%);
  --ios-red: #ff3b30;
  --ios-teal: #30b0c7;
  --ios-teal-gradient: linear-gradient(135deg, #40c8e0 0%, #30b0c7 100%);
  --ios-yellow: #ffd60a;
  --ios-yellow-gradient: linear-gradient(135deg, #ffd60a 0%, #ff9f0a 100%);
  --ios-slate-gradient: linear-gradient(135deg, #636366 0%, #48484a 100%);
  --ios-maroon-gradient: linear-gradient(135deg, #a90a0a 0%, #870808 50%, #6f0606 100%);

  --ios-radius-sheet: 24px 24px 0 0;
  --ios-radius-card: 18px;
  --ios-radius-app: 16px;
  --ios-radius-btn: 13px;
  --ios-radius-pill: 9999px;

  --ios-shadow-card: 0 2px 10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --ios-shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.15);
  --ios-shadow-float: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);

  --ios-blur: blur(20px) saturate(180%);
  --ios-spring-easing: cubic-bezier(0.16, 1, 0.3, 1);

  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(24, 24, 27, .04);
  --shadow: 0 4px 16px -4px rgba(24, 24, 27, .08);
  --shadow-lg: 0 16px 40px -16px rgba(24, 24, 27, .18);

  --sidebar-w: 224px;
  --header-h: 50px;
  --bottom-nav-h: 58px;
  --gap: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .25rem;
  letter-spacing: -.011em;
  line-height: 1.25;
}
h1 { font-size: 1.25rem; }
h2 { font-size: .95rem; }
h3 { font-size: .9rem; }
h4 { font-size: .85rem; }
p  { margin: 0 0 .6rem; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: .8rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: .86em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: .75rem; } .mt-3 { margin-top: var(--gap); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: .75rem; } .mb-3 { margin-bottom: var(--gap); }
.gap-1 { gap: .5rem; } .gap-2 { gap: .75rem; }
.hidden { display: none !important; }
.num-cell, .tabular { font-variant-numeric: tabular-nums; }

svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------------------------------------------------------------- app shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: .6rem;
  padding: env(safe-area-inset-top) .85rem 0;
  background: var(--ios-glass-bg);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border-bottom: 0.5px solid var(--ios-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
  transition: background 0.2s ease;
}
.topbar-brand { display: flex; align-items: center; gap: .55rem; min-width: 0; color: var(--ink); }
.topbar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--ios-maroon-gradient); color: #fff;
  font-weight: 700; font-size: .88rem;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(135, 8, 8, .28);
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: .88rem; font-weight: 650; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.brand-text span { font-size: .7rem; color: var(--muted); font-weight: 500; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.topbar-user { display: none; align-items: center; gap: .5rem; padding: 0 .5rem 0 .4rem; margin: 0 .2rem; border-left: 0.5px solid var(--ios-border); }
.topbar-user .who { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-user .who strong { font-size: .82rem; font-weight: 600; }
.topbar-user .who small { font-size: .66rem; color: var(--muted); letter-spacing: .02em; }
.topbar-user .avatar { width: 30px; height: 30px; font-size: .72rem; position: relative; }
.topbar-user .avatar.live::after {
  content: ''; position: absolute; bottom: -1px; right: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--ios-green); border: 2px solid #fff;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius); border: 0.5px solid var(--ios-border);
  background: var(--card); color: var(--ink-soft); display: grid; place-items: center;
  cursor: pointer; line-height: 1; padding: 0; transition: transform 0.1s ease, background 0.15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.icon-btn:active { transform: scale(0.92); }

.body-wrap { display: flex; flex: 1; min-height: 0; }

.sidebar {
  display: none;
  width: var(--sidebar-w); flex: none;
  background: var(--card); border-right: 0.5px solid var(--ios-border);
  padding: .5rem .5rem 0; position: sticky; top: var(--header-h);
  align-self: flex-start; height: calc(100vh - var(--header-h));
  overflow-y: auto; flex-direction: column;
}
.sidebar-foot { margin-top: auto; padding: .75rem .55rem; font-size: .68rem; color: var(--faint); }
.sidebar-user {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem; border-radius: var(--radius);
  background: var(--subtle); border: 1px solid var(--border);
  margin-bottom: .5rem;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: .74rem;
}
.sidebar-user div { min-width: 0; }
.sidebar-user strong { display: block; font-size: .84rem; }
.sidebar-user span { font-size: .7rem; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; margin: .8rem .55rem .25rem; }
.nav-section:first-child { margin-top: .3rem; }
.nav a {
  display: flex; align-items: center; gap: .55rem;
  padding: .36rem .55rem; border-radius: var(--radius);
  color: var(--ink-soft); font-size: .84rem; font-weight: 500; text-decoration: none;
}
.nav a svg.i { color: var(--faint); }
.nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav a:hover svg.i { color: var(--ink-soft); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a.active svg.i { color: var(--primary); }
.nav a span { flex: 1; min-width: 0; }
.badge-count {
  font-style: normal; font-size: .68rem; font-weight: 600; min-width: 18px; text-align: center;
  background: var(--primary); color: #fff; padding: 0 5px; border-radius: 999px; line-height: 17px;
}

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .16s ease; z-index: 60;
  cursor: pointer;
}
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: 84%; max-width: 320px;
  background: var(--card); z-index: 70; padding: .85rem .75rem;
  transform: translateX(-102%); transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto; display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

/* Drawer header with profile + cross button */
.drawer-header {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding-bottom: .75rem; margin-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-user-info {
  display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1;
}
.drawer-user-info .avatar {
  width: 36px; height: 36px; border-radius: 50%; font-size: .82rem; flex: none;
}
.drawer-user-meta {
  display: flex; flex-direction: column; min-width: 0;
}
.drawer-user-meta strong {
  font-size: .88rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-user-meta small {
  font-size: .7rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-close-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--subtle);
  display: grid; place-items: center; color: var(--muted);
  cursor: pointer; flex-shrink: 0;
  transition: all .15s ease;
}
.drawer-close-btn:hover {
  background: var(--hover); color: var(--ink);
  transform: scale(1.05);
}
.drawer-close-btn:active {
  transform: scale(0.95);
}
.drawer-close-btn svg.i {
  width: 18px; height: 18px;
}
.drawer .nav-section:first-child { margin-top: .15rem; }

.content {
  flex: 1; min-width: 0;
  padding: .85rem .75rem calc(var(--bottom-nav-h) + 1.25rem);
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--ios-glass-bg);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border-top: 0.5px solid var(--ios-border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.03);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: .65rem; text-decoration: none; font-weight: 500;
  transition: color 0.15s ease, transform 0.1s ease;
  position: relative;
}
.bottom-nav a svg.i { width: 22px; height: 22px; transition: transform 0.12s ease; }
.bottom-nav a:active { transform: scale(0.92); }
.bottom-nav a.active { color: var(--primary); font-weight: 650; }
.bottom-nav a.active svg.i { transform: translateY(-1px); }
.bottom-nav a.active::after {
  content: ''; position: absolute; top: 0; left: 26%; right: 26%; height: 2.5px;
  background: var(--primary); border-radius: 0 0 3px 3px;
}

@media (min-width: 640px) { .topbar-user { display: flex; } }
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .content { padding: 1.1rem 1.5rem 2rem; max-width: 1680px; }
  .bottom-nav { display: none; }
  #menuToggle { display: none; }
}

/* ------------------------------------------------------------------ layout */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-bottom: var(--gap); min-height: 34px;
}
.page-head .titles { flex: 1; min-width: 200px; }
.page-head h1 { margin-bottom: 0; }
.page-head .sub { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.grid { display: grid; gap: var(--gap); }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: minmax(0, 1fr) 320px; }
}
.grid-sidebar > div > .card:last-child, .grid-sidebar > div > .card.flush:last-child { margin-bottom: 0; }

/* Cards. A card that has a head/body/table is "sectioned" and carries no
   padding of its own — that is what kept the old layout from double-padding. */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .85rem;
}
.card.flush,
.card:has(> .card-head), .card:has(> .card-body), .card:has(> .table-wrap) { padding: 0; overflow: hidden; }
.card:has(> .card-head) > :not(.card-head):not(.card-body):not(.table-wrap):not(.card-foot):not(.pager):not(details):not(.alert) { margin: .85rem; }
.card:has(> .card-head) > details { margin: .75rem .85rem; }
.card:has(> .card-head) > form:has(> .table-wrap), .card:has(> .card-head) > form:has(> .card-body) { margin: 0; }
.card-head {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  min-height: 42px; padding: .45rem .85rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; font-size: .88rem; font-weight: 600; }
.card-head .spacer { margin-left: auto; }
.card-head .filters { padding: .2rem 0; }
.card-body { padding: .85rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot { padding: .6rem .85rem; border-top: 1px solid var(--border); background: var(--subtle); }
.card .card { border-radius: var(--radius); }

/* stat tiles */
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .65rem .8rem; position: relative; min-width: 0;
}
.stat .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.35rem; font-weight: 650; line-height: 1.2; margin-top: .1rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .foot { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.accent { border-color: var(--primary-soft-border); background: var(--primary-soft); }
.stat.accent::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); background: var(--primary); }
.stat.accent .value { color: var(--primary); }
.stat.ok .value { color: var(--success); }
.stat.warn .value { color: var(--warning); }
.stat.danger .value { color: var(--danger); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  height: 32px; padding: 0 .7rem; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--card); color: var(--ink); font-family: var(--font-body);
  font-size: .82rem; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap; box-shadow: var(--shadow-sm); vertical-align: middle;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-danger { background: var(--card); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-sm { height: 26px; padding: 0 .5rem; font-size: .76rem; }
.btn-sm svg.i { width: 14px; height: 14px; }
.btn-lg { height: 40px; padding: 0 1rem; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: .3rem; flex-wrap: wrap; }

/* -------------------------------------------------------------------- forms */
.field { margin-bottom: .65rem; transition: opacity .15s ease; }
.field.field-disabled { opacity: .42; pointer-events: none; }
.field.field-disabled input, .field.field-disabled select { background-color: var(--surface) !important; cursor: not-allowed; }
.field label, .label {
  display: block; font-size: .76rem; font-weight: 500; color: var(--ink-soft); margin-bottom: .22rem;
}
.hint, .field .hint { font-size: .72rem; color: var(--muted); margin-top: .2rem; line-height: 1.35; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=month], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; height: 32px; padding: 0 .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; font-family: var(--font-body); font-size: .84rem; color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
select { padding-right: 1.6rem; }
textarea { height: auto; min-height: 72px; padding: .45rem .6rem; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(135, 8, 8, .1);
}
input[type=file] { width: 100%; font-size: .8rem; padding: .3rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--subtle); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 15px; height: 15px; }
.form-row { display: grid; gap: 0 .65rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-row.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) { .form-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.checkline { display: flex; align-items: center; gap: .45rem; font-size: .84rem; }
.checkline input { width: auto; }
.inline-form { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .45rem; align-items: end; }
.filters .field { margin-bottom: 0; min-width: 140px; }
.filters .field label { font-size: .7rem; color: var(--muted); }
.form-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .3rem; }

/* ------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data th, table.data td { padding: .42rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  color: var(--muted); font-weight: 600; background: var(--subtle); position: sticky; top: 0; z-index: 1;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; }
table.data tbody tr:hover { background: var(--hover); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.total-row td { font-weight: 600; background: var(--subtle); }
table.data td .sub { display: block; font-size: .72rem; color: var(--muted); }
table.data td strong { font-weight: 600; }
table.data td a strong { color: var(--ink); }
table.data td a:hover strong { color: var(--primary); }
table.data td.actions-cell { text-align: right; white-space: nowrap; width: 1%; }
table.data td.actions-cell form { display: inline-flex; margin: 0; }
table.data td.actions-cell > * + * { margin-left: .25rem; }
table.data td.actions-cell details { position: relative; display: inline-block; text-align: left; }
table.data td.actions-cell details form { display: block; white-space: normal; margin-bottom: .5rem; }
table.data td.actions-cell details .card-body {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  min-width: 280px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 10px 25px -5px rgba(0,0,0,.18), 0 8px 10px -6px rgba(0,0,0,.1);
  white-space: normal;
}
table.data td.check-cell, table.data th.check-cell { width: 28px; padding-right: 0; }
table.data tr.is-selected { background: var(--primary-soft); }
table.data tr.detail-row td { background: var(--subtle); padding: .7rem .85rem; }
table.data tr.detail-row:hover { background: var(--subtle); }

@media (max-width: 720px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot { display: block; width: 100%; }
  /* Each row becomes a compact card: title across the top, values in two columns. */
  table.stack tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .75rem;
    padding: .6rem .85rem; border-bottom: 1px solid var(--border);
  }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td {
    display: block; width: auto; border: none; padding: 0; text-align: left; min-width: 0; overflow-wrap: anywhere;
  }
  table.stack td.num { text-align: left; }
  table.stack td::before {
    content: attr(data-label); display: block; margin-bottom: .05rem;
    font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  }
  /* the first cell (usually the person) reads as the card title */
  table.stack td:first-child, table.stack td.check-cell + td { grid-column: 1 / -1; font-size: .86rem; }
  table.stack td:first-child::before, table.stack td.check-cell + td::before { content: none; }
  table.stack td:not([data-label]) { grid-column: 1 / -1; }
  table.stack td:not([data-label])::before { content: none; }
  table.stack td.actions-cell { width: auto; white-space: normal; text-align: right; }
  table.stack td.actions-cell:empty { display: none; }
  table.stack td.check-cell { display: none; }
  table.stack tr.detail-row td { grid-column: 1 / -1; }
  table.stack tr.detail-row td::before { content: none; }
}

/* A person cell: avatar, then name and a secondary line. */
.person { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.person img, .person .avatar { width: 34px; height: 34px; font-size: .78rem; border-radius: 50%; object-fit: cover; flex: none; }
.person img { border: 1.5px solid var(--border); }
.person .who { min-width: 0; }
.row-actions { display: inline-flex; gap: .25rem; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline-flex; margin: 0; }
.punch { display: flex; align-items: center; gap: .35rem; }
.punch img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); display: block; }
.fix-cell { padding: 1rem 1.25rem !important; background: var(--surface); }

/* m-table stays a real table on phones: fewer columns, tight rows, no sideways
   page scroll. Secondary values move into an expandable row. */
@media (min-width: 721px) { .m-only { display: none !important; } }
@media (max-width: 720px) {
  table.m-table { font-size: .76rem; }
  table.m-table th, table.m-table td { padding: .36rem .3rem; }
  table.m-table th { font-size: .6rem; letter-spacing: .03em; }
  table.m-table th:first-child, table.m-table td:first-child { padding-left: .65rem; }
  table.m-table th:last-child, table.m-table td:last-child { padding-right: .65rem; }
  table.m-table td .sub { font-size: .66rem; line-height: 1.25; }
  table.m-table .chip { height: 18px; padding: 0 .3rem; font-size: .63rem; }
  table.m-table .btn-sm { height: 28px; padding: 0 .45rem; font-size: .72rem; }
  table.m-table td.actions-cell { width: 1%; }
  table.m-table .fix-cell, table.m-table .m-detail td { padding: .7rem !important; }
  .m-hide { display: none !important; }
  table.m-table td .m-late { color: var(--warning); white-space: nowrap; }
  .m-fill { width: 100%; max-width: 0; }
  .m-trunc { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .person { gap: .45rem; }
  .person img, .person .avatar { width: 32px; height: 32px; font-size: .72rem; }
  .person .who, .person .who a { display: block; overflow: hidden; }
  .person strong, .person .sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .75rem; margin-bottom: .6rem; }
  .m-detail-grid .k { display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
  .m-detail-grid .wide { grid-column: 1 / -1; }
  .m-detail .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .m-scroll-y { max-height: 62vh; overflow-y: auto; }

  /* The page around those tables */
  .page-head { gap: .45rem; margin-bottom: .6rem; }
  .page-head .titles { flex-basis: 100%; }
  .page-actions { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
  .page-actions::-webkit-scrollbar { display: none; }
  .page-actions > * { flex: none; }
  .page-actions .btn-primary { order: -1; }
  .grid-4 { gap: .5rem; }
  .stat { padding: .5rem .65rem; }
  .stat .value { font-size: 1.15rem; }
  .stat .foot { font-size: .68rem; }
  .filters .field { flex: 1 1 40%; min-width: 0; }
  .filters .field:first-child { flex-basis: 100%; }
}
@media (max-width: 379px) { .m-hide-xs { display: none !important; } }
@media (max-width: 640px) { .form-row.m-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------- employee home ("My day" - iOS HIG) */
.ios-me-header {
  display: flex; align-items: center; gap: .85rem; margin-bottom: .85rem; padding: .35rem .25rem;
}
.ios-avatar-wrap { position: relative; flex: none; }
.ios-avatar-wrap .avatar, .ios-avatar-wrap img {
  width: 50px; height: 50px; border-radius: 50%; object-fit: cover; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border: 2px solid #fff;
}
.ios-avatar-wrap .live-indicator {
  position: absolute; bottom: 0; right: 0; width: 14px; height: 14px;
  border-radius: 50%; background: var(--ios-green); border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}
.ios-avatar-wrap .live-indicator.is-duty { background: var(--ios-green); }
.ios-avatar-wrap .live-indicator.is-completed { background: var(--ios-blue); }
.ios-avatar-wrap .live-indicator.is-off { background: var(--faint); }
.ios-avatar-wrap .live-indicator.pulse {
  animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}
.ios-me-title { flex: 1; min-width: 0; }
.ios-me-title h1 {
  font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.025em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
}
.ios-me-title .sub { font-size: .8rem; color: var(--muted); margin-top: .1rem; font-weight: 500; }
.ios-pill-badge {
  flex: none; padding: .25rem .65rem; border-radius: var(--ios-radius-pill); font-size: .72rem;
  font-weight: 650; white-space: nowrap; background: var(--warning-soft); color: var(--warning);
  border: 1px solid var(--warning-border);
}
.ios-pill-badge.badge-on-duty {
  background: rgba(52, 199, 89, 0.12); color: #15803d; border-color: rgba(52, 199, 89, 0.3);
}

.me-face-cta-remote {
  border-color: var(--primary) !important;
  background: linear-gradient(135deg, rgba(135,8,8,0.06), rgba(135,8,8,0.02)) !important;
  margin-bottom: .85rem; border-radius: var(--ios-radius-card);
}
.me-face-cta-remote .ico {
  background: var(--ios-maroon-gradient) !important; color: #fff !important; border-radius: 12px;
}
.me-face-cta-remote strong { color: var(--primary); }
.me-face-cta-register {
  border-radius: var(--ios-radius-card); margin-bottom: .85rem;
}
.me-face-cta-register .ico {
  background: var(--ios-orange-gradient) !important; color: #fff !important; border-radius: 12px;
}
.loan-progress-bar { height: 7px; background: var(--ios-bg); border-radius: 4px; overflow: hidden; }
.loan-progress-fill { height: 100%; background: var(--ios-indigo-gradient); border-radius: 4px; transition: width .4s ease; }

/* iOS Live Activity Shift Card */
.me-live-card {
  background: var(--ios-card-bg); border-radius: var(--ios-radius-card);
  border: 0.5px solid var(--ios-border); box-shadow: var(--ios-shadow-card);
  padding: 1.15rem 1.15rem 1rem; margin-bottom: .9rem; position: relative; overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.me-live-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3.5px;
  background: var(--ios-maroon-gradient);
}
.me-live-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem;
}
.me-live-badge {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: .22rem .6rem; border-radius: var(--ios-radius-pill);
}
.me-live-badge.on-duty {
  background: rgba(52, 199, 89, 0.12); color: #15803d; border: 0.5px solid rgba(52, 199, 89, 0.25);
}
.me-live-badge.completed {
  background: rgba(0, 122, 255, 0.1); color: #007aff; border: 0.5px solid rgba(0, 122, 255, 0.2);
}
.me-live-badge.leave {
  background: rgba(175, 82, 222, 0.1); color: #af52de; border: 0.5px solid rgba(175, 82, 222, 0.2);
}
.me-live-badge.rest {
  background: rgba(113, 113, 122, 0.1); color: #71717a; border: 0.5px solid rgba(113, 113, 122, 0.2);
}
.me-live-badge.not-marked {
  background: rgba(245, 158, 11, 0.12); color: #b45309; border: 0.5px solid rgba(245, 158, 11, 0.25);
}
.me-live-badge .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none;
}
.me-live-badge.on-duty .pulse-dot {
  animation: pulse-dot 1.8s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
.me-shift-time { font-size: .75rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.me-live-status-txt {
  font-size: 1.3rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; line-height: 1.2;
}
.me-live-note { font-size: .82rem; color: var(--muted); margin-top: .2rem; }

/* Shift Progress Bar */
.me-shift-track-wrap { margin: .95rem 0 .95rem; }
.me-shift-track {
  width: 100%; height: 7px; background: var(--ios-bg); border-radius: 4px; overflow: hidden; position: relative;
}
.me-shift-fill {
  height: 100%; background: var(--ios-maroon-gradient); border-radius: 4px; transition: width 0.4s ease;
}
.me-shift-labels {
  display: flex; justify-content: space-between; font-size: .68rem; color: var(--faint); margin-top: .35rem;
  font-weight: 500; font-variant-numeric: tabular-nums;
}

/* Punches Matrix */
.me-punches-ios {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem;
  padding: .75rem; border-radius: var(--radius); background: var(--ios-bg);
}
.me-punches-ios > div { text-align: center; min-width: 0; }
.me-punches-ios > div + div { border-left: 0.5px solid var(--ios-separator); }
.me-punches-ios span { display: block; font-size: .68rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.me-punches-ios strong {
  display: block; font-size: 1.05rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; margin-top: .15rem; white-space: nowrap;
}

/* Apple Squircle Quick Actions Matrix */
.me-app-section { margin-bottom: 1.15rem; }
.me-section-title {
  font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 0 .55rem .35rem;
}
.me-app-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem .45rem;
  background: var(--ios-card-bg); border-radius: var(--ios-radius-card);
  padding: 1.05rem .6rem; border: 0.5px solid var(--ios-border);
  box-shadow: var(--ios-shadow-card);
}
.me-app-item {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-decoration: none;
  transition: transform 0.12s var(--ios-spring-easing); color: var(--ink); position: relative;
}
.me-app-item:hover { text-decoration: none; }
.me-app-item:active { transform: scale(0.92); }
.me-app-icon {
  width: 52px; height: 52px; border-radius: var(--ios-radius-app);
  display: grid; place-items: center; color: #fff; position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.15s ease;
}
.me-app-icon svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
.me-app-badge {
  position: absolute; top: -3px; right: -3px; background: var(--ios-red); color: #fff;
  font-size: .65rem; font-weight: 700; height: 18px; min-width: 18px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff;
}
.me-app-label {
  display: block;
  font-size: .72rem; font-weight: 550; text-align: center; line-height: 1.2;
  color: var(--ink-soft); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Specific iOS Gradients for Apps */
.bg-ios-attendance { background: var(--ios-blue-gradient); }
.bg-ios-leave      { background: var(--ios-orange-gradient); }
.bg-ios-payslip    { background: var(--ios-green-gradient); }
.bg-ios-loan       { background: var(--ios-indigo-gradient); }
.bg-ios-tax        { background: var(--ios-teal-gradient); }
.bg-ios-expense    { background: var(--ios-pink-gradient); }
.bg-ios-appraisal  { background: var(--ios-yellow-gradient); color: #78350f !important; }
.bg-ios-profile    { background: var(--ios-purple-gradient); }
.bg-ios-kiosk      { background: var(--ios-maroon-gradient); }

/* Employee Dashboard Score Banner */
.me-score-banner {
  background: var(--ios-card-bg, #ffffff);
  border-radius: var(--ios-radius-card, 16px);
  border: 0.5px solid var(--ios-border, #e2e8f0);
  box-shadow: var(--ios-shadow-card, 0 2px 10px rgba(0,0,0,0.04));
  padding: 0.85rem 1.15rem;
  margin-bottom: 0.9rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.me-score-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.me-score-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}
.me-score-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.me-score-icon-wrap.is-top3 {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}
.me-score-text {
  flex-grow: 1;
  min-width: 0;
}
.me-score-headline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.me-score-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink, #0f172a);
}
.me-score-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.me-score-badge.badge-live {
  background: #fee2e2;
  color: #991b1b;
  border: 0.5px solid #fecaca;
}
.me-score-badge.badge-final {
  background: #ecfdf5;
  color: #065f46;
  border: 0.5px solid #a7f3d0;
}
.me-score-standing {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.standing-highlight.gap-lead {
  font-weight: 700;
  color: #d97706;
}
.standing-highlight.top3-lead {
  font-weight: 700;
  color: #16a34a;
}
.me-score-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.me-score-pts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}
.me-score-pts .max {
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
}
.me-view-score-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}
@media (max-width: 600px) {
  .me-view-score-btn {
    display: none;
  }
}

/* Apple Wallet Pass Payslip Card */
.me-wallet-pass {
  background: var(--ios-card-bg); border-radius: var(--ios-radius-card);
  border: 0.5px solid var(--ios-border); box-shadow: var(--ios-shadow-card);
  padding: 1.15rem; margin-bottom: .9rem; position: relative; overflow: hidden;
}
.me-wallet-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem;
}
.me-wallet-tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ios-green); background: rgba(52, 199, 89, 0.1); padding: .2rem .55rem;
  border-radius: var(--ios-radius-pill);
}
.me-wallet-period { font-size: .8rem; color: var(--muted); font-weight: 600; }
.me-wallet-amount {
  font-size: 2.15rem; font-weight: 750; color: var(--ink); letter-spacing: -.03em;
  line-height: 1.1; margin: .2rem 0 .3rem; font-variant-numeric: tabular-nums;
}
.me-wallet-sub {
  font-size: .8rem; color: var(--muted); margin-bottom: .85rem; display: flex; gap: .75rem; flex-wrap: wrap;
}
.me-wallet-sub span { font-variant-numeric: tabular-nums; }
.me-wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.me-wallet-actions .btn { height: 38px; border-radius: var(--ios-radius-btn); font-size: .82rem; font-weight: 600; }

/* Multi-Segment Battery-Style Leave Balance */
.me-leave-segments {
  height: 10px; border-radius: 5px; background: var(--ios-bg); overflow: hidden;
  display: flex; gap: 2px; margin: .75rem 0 .85rem;
}
.me-seg-pl { background: var(--ios-blue); transition: width 0.3s ease; }
.me-seg-sl { background: var(--ios-orange); transition: width 0.3s ease; }
.me-seg-cl { background: var(--ios-purple); transition: width 0.3s ease; }
.me-leave-legend {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem .85rem; font-size: .78rem;
}
.me-leave-legend-item { display: flex; align-items: center; justify-content: space-between; }
.me-leave-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; flex: none;
}
.dot-pl { background: var(--ios-blue); }
.dot-sl { background: var(--ios-orange); }
.dot-cl { background: var(--ios-purple); }

/* iOS Inset Grouped Card Enhancements */
.me-grid .card {
  border-radius: var(--ios-radius-card); border: 0.5px solid var(--ios-border);
  box-shadow: var(--ios-shadow-card); background: var(--ios-card-bg);
}
.me-grid .card-head {
  padding: .95rem 1.1rem; border-bottom: 0.5px solid var(--ios-separator);
}
.me-grid .card-body { padding: 1.1rem; }
.me-grid .kv > div {
  padding: .55rem 0; border-bottom: 0.5px solid var(--ios-separator);
}
.me-grid .kv > div:last-child { border-bottom: none; }

/* Monthly Attendance Stat Tiles (/me Month Card) */
.me-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin-bottom: .9rem;
}
.me-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .7rem .4rem;
  border-radius: 12px;
  background: var(--subtle, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  text-align: center;
  gap: .18rem;
}
.me-stat strong {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink, #0f172a);
  font-variant-numeric: tabular-nums;
}
.me-stat span {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  line-height: 1.2;
}
.me-stat.ok {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.22);
}
.me-stat.ok strong { color: #059669; }
.me-stat.danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.22);
}
.me-stat.danger strong { color: #dc2626; }
.me-stat.warn {
  background: rgba(245, 158, 11, 0.09);
  border-color: rgba(245, 158, 11, 0.25);
}
.me-stat.warn strong { color: #d97706; }
@media (max-width: 360px) {
  .me-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Scorecard Breakdown List (me.html & dashboard.html) */
.sc-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}
.sc-item {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: .7rem .85rem;
}
.sc-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.sc-title {
  font-size: .86rem;
  font-weight: 700;
  color: var(--ink, #0f172a);
  line-height: 1.25;
}
.sc-meta {
  font-size: .76rem;
  color: var(--muted, #64748b);
  margin-top: .18rem;
  line-height: 1.3;
}
.sc-score {
  flex-shrink: 0;
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--subtle, #f1f5f9);
  color: var(--ink, #0f172a);
  white-space: nowrap;
}
.sc-score small {
  font-weight: 600;
  color: var(--muted, #64748b);
}
.sc-score.is-neg {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.sc-score.is-full {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.sc-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--subtle, #e2e8f0);
  overflow: hidden;
  margin-top: .5rem;
}
.sc-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b91c1c, #ea580c);
}
.sc-bar-fill.is-full {
  background: linear-gradient(90deg, #059669, #10b981);
}
.sc-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
}
.sc-total-label {
  font-size: .86rem;
  font-weight: 800;
  color: #78350f;
}
.sc-total-badge {
  font-size: .74rem;
  font-weight: 600;
  color: #92400e;
  margin-top: .12rem;
}
.sc-total-score {
  flex-shrink: 0;
  font-size: 1.08rem;
  font-weight: 900;
  color: #991b1b;
  font-variant-numeric: tabular-nums;
  background: #fff;
  padding: .3rem .7rem;
  border-radius: 999px;
  border: 1px solid #fcd34d;
  white-space: nowrap;
}

.att-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
}
.att-cta-row {
  display: contents;
}
@media (max-width: 720px) {
  .att-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    width: 100%;
  }
  .att-month-form {
    width: 100%;
  }
  .att-month-form input[type="month"] {
    width: 100% !important;
    min-height: 40px;
    border-radius: 10px;
  }
  .att-today-btn {
    min-height: 40px;
    border-radius: 10px;
    white-space: nowrap;
  }
  .att-cta-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .att-cta-row .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    border-radius: 10px;
    font-size: .82rem;
    padding: 0 .6rem;
    white-space: nowrap;
  }
}

/* Modern Desktop Responsive Adaptations */
@media (min-width: 1024px) {
  .me-app-grid { grid-template-columns: repeat(8, 1fr); gap: 1rem .6rem; padding: 1.25rem 1rem; }
  .me-live-card { display: grid; grid-template-columns: minmax(0, 1fr) 360px; column-gap: 2rem; align-items: center; }
  .me-punches-ios { margin-top: 0; }
  .me-shift-track-wrap { margin-bottom: 0; }
}
@media (max-width: 1023px) {
  .me-grid { display: flex; flex-direction: column; gap: .75rem; }
  .me-col { display: contents; }
  .me-grid .card { margin-bottom: 0; border-radius: 16px; }
  .me-order-1 { order: 1; } .me-order-2 { order: 2; } .me-order-3 { order: 3; } .me-order-4 { order: 4; } .me-order-5 { order: 5; }
}
@media (max-width: 720px) {
  .me-grid .card-head { min-height: 46px; }
  .me-grid .card-body { padding: .9rem; }
  .me-grid .kv { font-size: .84rem; }
  .me-grid .kv div { padding: .45rem 0; }
  .me-grid .list-row { padding: .65rem .9rem; }
  .me-grid .btn { height: 42px; border-radius: 10px; }
  .me-grid .card-head .btn { height: 30px; border-radius: var(--radius); }
}

/* Sorting and searching */
.th-sort {
  all: unset; display: inline-flex; align-items: center; gap: .25rem; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.th-sort:hover { color: var(--ink); text-decoration: none; }
.th-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.th-sort::after { content: "↕"; font-size: 1.05em; opacity: .6; }
th[aria-sort="ascending"] .th-sort::after { content: "↑"; opacity: 1; color: var(--primary); }
th[aria-sort="descending"] .th-sort::after { content: "↓"; opacity: 1; color: var(--primary); }
th[aria-sort] { color: var(--ink); }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .85rem; border-bottom: 1px solid var(--border); }
.table-tools .table-search { flex: 1 1 200px; max-width: 320px; }
.table-tools .table-count { white-space: nowrap; }
.table-tools .table-sort-menu { display: none; flex: 1 1 130px; width: auto; }
@media (max-width: 720px) {
  .table-tools .table-sort-menu { display: block; }
  .table-tools .table-search { max-width: none; }
  table.m-table .th-sort::after { font-size: .75em; }
}
@media (min-width: 721px) { .table-tools.phone-only { display: none; } }
.card > .table-tools { margin: 0 !important; }

/* -------------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 0 .45rem; height: 20px; border-radius: 4px;
  font-size: .7rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1;
}
.chip-ok      { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.chip-warn    { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.chip-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-border); }
.chip-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-border); }
.chip-muted   { background: var(--hover); color: var(--muted); border-color: var(--border); }
.chip-ghost   { background: transparent; color: var(--muted); border-color: var(--border-strong); border-style: dashed; }
.chip-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-border); }

.alert {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .75rem; border-radius: var(--radius); margin-bottom: var(--gap);
  font-size: .82rem; border: 1px solid transparent;
}
.alert > svg.i { margin-top: 1px; }
.alert > .ico { display: none; }
.alert > div { min-width: 0; flex: 1; }
.alert-ok    { background: var(--success-soft); border-color: var(--success-border); color: #14532d; }
.alert-err   { background: var(--danger-soft);  border-color: var(--danger-border);  color: #7f1d1d; }
.alert-warn  { background: var(--warning-soft); border-color: var(--warning-border); color: #78350f; }
.alert-info  { background: var(--info-soft);    border-color: var(--info-border);    color: #1e3a8a; }
.card .alert:last-child { margin-bottom: 0; }

/* --------------------------------------------------------- attendance board */
.trend { display: flex; align-items: stretch; gap: .5rem; height: 130px; padding-top: .25rem; }
.trend .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 0; }
.trend .bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.trend .bar { width: 100%; max-width: 30px; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; }
.trend .bar.off { background: var(--border-strong); }
.trend .bar-label { font-size: .68rem; color: var(--muted); }
.trend .bar-value { font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1em; }

.register-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
table.register { border-collapse: separate; border-spacing: 0; font-size: .76rem; }
table.register th, table.register td { padding: .3rem .28rem; text-align: center; border-bottom: 1px solid var(--border); border-right: 1px solid #f1f0ef; font-variant-numeric: tabular-nums; }
table.register thead th { position: sticky; top: 0; background: var(--subtle); z-index: 3; font-size: .68rem; color: var(--muted); }
table.register .sticky-col {
  position: sticky; left: 0; background: var(--card); z-index: 2; text-align: left;
  min-width: 160px; border-right: 1px solid var(--border);
}
table.register thead .sticky-col { z-index: 4; background: var(--subtle); }
table.register td.cell { font-weight: 600; cursor: help; }
table.register td.cell.P { background: var(--success-soft); color: var(--success); }
table.register td.cell.A { background: var(--danger-soft); color: var(--danger); }
table.register td.cell.pending { color: var(--faint); }
table.register td.cell.ne { color: var(--faint); background: repeating-linear-gradient(135deg, #fafaf9 0 4px, #f1f0ef 4px 8px); }
table.register td.cell.H, table.register td.cell.W { background: #f5f5f4; color: var(--faint); }
table.register td.cell.leave { background: var(--info-soft); color: var(--info); }
table.register td.cell.half { background: var(--warning-soft); color: var(--warning); }
table.register td.cell.has-fine { position: relative; }
table.register td.cell.has-fine::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background-color: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #fff;
}
table.register td.cell.has-fine:hover::after { transform: scale(1.3); }
table.register td.cell.missing-out {
  background: #fef9c3 !important;
  color: #854d0e !important;
  position: relative;
}
table.register td.cell.missing-out::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 6px;
  height: 6px;
  background-color: #eab308;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #fff;
  z-index: 2;
}
table.register td.cell.missing-out:hover::before { transform: scale(1.3); }
table.register td.weekend { background: #fafaf9; }
table.register td.today-col { box-shadow: inset 0 0 0 2px var(--primary-soft-border); }
table.register tfoot td { font-weight: 600; background: var(--subtle); }

.timeline { display: flex; flex-direction: column; gap: .35rem; }
.timeline-item { display: flex; gap: .55rem; align-items: center; padding: .4rem .55rem; border-radius: var(--radius); background: var(--subtle); border: 1px solid var(--border); }
.timeline-item .t { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 46px; }

/* list rows used in side panels */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .85rem; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow span { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .avatar { width: 28px; height: 28px; font-size: .68rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .85rem; border-top: 1px solid var(--border); font-size: .78rem; background: var(--subtle); }
.pager .pager-links { display: flex; gap: .35rem; align-items: center; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .3rem;
  background: var(--faint); vertical-align: 1px; }
.live-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.live-dot.off { background: var(--danger); }
.status-strip { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .76rem; color: var(--muted); margin-top: .25rem; }

/* rating stars / score pills */
.score { display: inline-flex; gap: 2px; }
.score input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.score label { margin: 0; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: .76rem; font-weight: 600; cursor: pointer; color: var(--ink-soft); background: #fff; }
.score input:checked + label { background: var(--primary); border-color: var(--primary); color: #fff; }
.score input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 1px; }
.rating-big { font-size: 1.6rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }

/* bulk-action bar */
.bulk-bar { display: none; align-items: center; gap: .5rem; padding: .45rem .85rem; background: var(--ink); color: #fff; font-size: .8rem; }
.bulk-bar.is-visible { display: flex; }
.bulk-bar .btn { height: 26px; font-size: .76rem; }

/* ------------------------------------------------------------------ steps */
.steps { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; font-size: .76rem; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: .35rem; color: var(--faint); padding-right: .9rem; }
.steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; }
.steps li.done { color: var(--ink-soft); }
.steps li.done::before { background: var(--success); border-color: var(--success); }
.steps li.current { color: var(--primary); font-weight: 600; }
.steps li.current::before { border-color: var(--primary); background: var(--primary); }
/* ------------------------------------------------------------------- kiosk */
/* Full-screen gate scanner, Fakhri-branded: maroon bar, black camera, two
   controls. Deliberately shows nothing about anybody else. */

.kiosk-body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  position: fixed;
  inset: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  background: #0b0709;
  color: #fff;
  font-family: var(--font-body);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* the overlays below set their own display, which would otherwise beat [hidden] */
.kiosk-body [hidden] { display: none !important; }

/* -- top bar ---------------------------------------------------------------- */
.kiosk-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: calc(.55rem + env(safe-area-inset-top)) .8rem .55rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, .9);
  z-index: 5;
}
.kiosk-logo {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  font-family: var(--font-heading);
  font-weight: 700; font-size: 1.02rem;
  color: #fff;
}
.kiosk-brand { min-width: 0; line-height: 1.15; }
.kiosk-brand strong {
  display: block;
  font-family: var(--font-heading);
  font-size: .92rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kiosk-brand small { display: block; font-size: .68rem; color: rgba(255, 255, 255, .78); }

.kiosk-state {
  width: 9px; height: 9px; border-radius: 50%;
  margin-left: auto; flex: none;
  background: rgba(255, 255, 255, .45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}
.kiosk-queue {
  margin-left: auto; flex: none; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap;
  background: #fbbf24; color: #3b2606; font-size: .7rem; font-weight: 600;
}
.kiosk-queue + .kiosk-state { margin-left: 0; }
.kiosk-state[data-state="ok"]  { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .22); }
.kiosk-state[data-state="bad"] { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .22); }

.kiosk-clock {
  font-family: var(--font-heading);
  font-size: 1.02rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.kiosk-quit { margin: 0; }
.kiosk-quit button,
.kiosk-exit-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 1rem; line-height: 1;
  text-decoration: none;
  transition: background .15s ease;
  flex: none;
}
.kiosk-quit button:active,
.kiosk-exit-btn:active { background: rgba(255, 255, 255, .26); }
.kiosk-register-btn {
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: inherit;
}
.kiosk-register-btn[hidden] { display: none; }

.kiosk-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem .35rem .55rem;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, transform .1s ease;
  white-space: nowrap;
  flex: none;
}
.kiosk-back-btn:hover,
.kiosk-back-btn:active {
  background: rgba(255, 255, 255, .32);
  color: #fff;
  text-decoration: none;
  transform: scale(.97);
}

/* -- camera stage ----------------------------------------------------------- */
.kiosk-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.kiosk-cam {
  position: relative;
  flex: 1; min-height: 0;
  background: #000;
  overflow: hidden;
  transition: box-shadow .18s ease;
}
.kiosk-cam video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  background: #000;
}
.kiosk-cam.mirror video { transform: scaleX(-1); }   /* selfie view feels natural */

.kiosk-cam.ok   { box-shadow: inset 0 0 0 5px var(--success); }
.kiosk-cam.warn { box-shadow: inset 0 0 0 5px #f59e0b; }
.kiosk-cam.bad  { box-shadow: inset 0 0 0 5px #ef4444; }

/* Modern PagarBook-style flexible target viewport */
.kiosk-guide {
  position: absolute; top: 44%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(72%, 290px);
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  border: 2px solid rgba(255, 255, 255, .4);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .32);
  transition: border-color .18s ease, box-shadow .18s ease;
  pointer-events: none;
}
.kiosk-guide::before,
.kiosk-guide::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border-color: #fff;
  border-style: solid;
  pointer-events: none;
  transition: border-color .18s ease;
}
.kiosk-guide::before {
  top: -2px; left: -2px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 28px;
}
.kiosk-guide::after {
  bottom: -2px; right: -2px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 28px;
}
.kiosk-guide.ok {
  border-color: #34d399;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .22), 0 0 24px rgba(52, 211, 153, .45);
}
.kiosk-guide.ok::before,
.kiosk-guide.ok::after { border-color: #34d399; }
.kiosk-guide.warn {
  border-color: #fbbf24;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .22), 0 0 20px rgba(251, 191, 36, .35);
}
.kiosk-guide.warn::before,
.kiosk-guide.warn::after { border-color: #fbbf24; }
.kiosk-guide.bad {
  border-color: #f87171;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .22), 0 0 20px rgba(248, 113, 113, .35);
}
.kiosk-guide.bad::before,
.kiosk-guide.bad::after { border-color: #f87171; }

/* -- anonymous result flash ------------------------------------------------- */
.kiosk-flash {
  position: absolute; inset: auto 0 0 0;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: 2.2rem 1rem calc(1rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(4, 4, 6, .92) 12%, rgba(4, 4, 6, .55) 60%, transparent);
  text-align: center;
  animation: kiosk-pop .16s ease-out;
}
@keyframes kiosk-pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.kiosk-flash .flash-ico {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2.5rem; font-weight: 700; line-height: 1;
  background: rgba(255, 255, 255, .14);
  border: 3px solid rgba(255, 255, 255, .3);
}
.kiosk-flash .flash-txt {
  font-family: var(--font-heading);
  font-size: 2.4rem; font-weight: 700; letter-spacing: .01em;
  margin-top: .45rem;
}
.kiosk-flash .flash-time {
  font-size: 1.05rem; font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .8);
}

.kiosk-flash.ok   .flash-ico { background: rgba(16, 185, 129, .25); border-color: #34d399; color: #6ee7b7; }
.kiosk-flash.ok   .flash-txt { color: #6ee7b7; }
.kiosk-flash.warn .flash-ico { background: rgba(245, 158, 11, .25); border-color: #fbbf24; color: #fcd34d; }
.kiosk-flash.warn .flash-txt { color: #fcd34d; }
.kiosk-flash.bad  .flash-ico { background: rgba(239, 68, 68, .25); border-color: #f87171; color: #fca5a5; }
.kiosk-flash.bad  .flash-txt { color: #fca5a5; }

/* -- confirmation card (full mode) ----------------------------------------- */
.kiosk-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 0;
  background: linear-gradient(165deg, #166534 0%, #064e3b 100%);
  text-align: center;
  z-index: 4;
  animation: kiosk-pop .18s ease-out;
  overflow: hidden;
}
.kiosk-card.out {
  background: linear-gradient(165deg, #1e3a8a 0%, #0f172a 100%);
}
.kiosk-card-top {
  flex: 1 1 48%; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .9rem; padding: 1.25rem 1rem 1rem;
}
.card-status-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .95rem; border-radius: 999px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
}
.kiosk-card .card-tick {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .9rem; font-weight: 800; line-height: 1;
  background: #22c55e; color: #fff;
}
.kiosk-card.out .card-tick { background: #3b82f6; }
.kiosk-card .card-punch {
  font-family: var(--font-heading);
  font-size: 1rem; font-weight: 700; line-height: 1.1; letter-spacing: .06em;
  color: #fff;
}
.kiosk-card .card-avatar {
  width: clamp(108px, 21vh, 148px); height: clamp(108px, 21vh, 148px);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-heading); font-size: 2.6rem; font-weight: 700;
  background: var(--primary); border: 4px solid #ffffff; color: #fff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.kiosk-card-bottom {
  flex: 1 1 52%; min-height: 0;
  background: #ffffff; color: #0f172a;
  border-radius: 26px 26px 0 0;
  padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .45rem;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, .18);
  overflow-y: auto;
}
.kiosk-card .card-name {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 3.6vw, 1.85rem); font-weight: 700; color: #0f172a;
  line-height: 1.2;
}
.kiosk-card .card-meta {
  font-size: .98rem; font-weight: 500; color: #475569;
}
.kiosk-card .card-when {
  margin-top: .5rem; padding: .4rem 1rem; border-radius: 999px;
  background: #f1f5f9; color: #0f172a;
  font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.kiosk-card .card-late {
  margin-top: .35rem;
  padding: .32rem .9rem; border-radius: 999px;
  background: #fef3c7; border: 1px solid #f59e0b; color: #92400e;
  font-size: .88rem; font-weight: 700;
}
.kiosk-card .card-late.is-ontime {
  background: #dcfce7; border-color: #22c55e; color: #166534;
}
.kiosk-fireworks {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 5;
}
.kiosk-card-top, .kiosk-card-bottom { position: relative; z-index: 2; }
.card-celebration {
  margin-top: .55rem; padding: .65rem 1.05rem; border-radius: 14px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #f59e0b; color: #78350f;
  max-width: min(92%, 380px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, .18);
  animation: kiosk-pop .28s ease-out;
}
.card-celebration strong { display: block; font-size: 1rem; font-weight: 700; color: #92400e; }
.card-celebration span { display: block; font-size: .84rem; margin-top: .15rem; color: #78350f; }

/* -- "verifying" HUD (tap mode) --------------------------------------------- */
.kiosk-hud {
  position: absolute; left: 50%; bottom: 1.2rem;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: 999px;
  background: rgba(0, 0, 0, .65);
  font-size: .95rem; white-space: nowrap;
  z-index: 3;
}
.kiosk-hud i {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff;
  animation: kiosk-spin .8s linear infinite;
}
@keyframes kiosk-spin { to { transform: rotate(360deg); } }

/* -- tap-to-start ---------------------------------------------------------- */
.kiosk-start {
  position: absolute; inset: 0;
  margin: auto;
  width: min(78%, 330px); height: fit-content;
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: 1.5rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(12, 8, 10, .72);
  backdrop-filter: blur(6px);
  color: #fff; cursor: pointer;
  font-family: var(--font-body);
}
.kiosk-start .ico { font-size: 2.2rem; }
.kiosk-start strong { font-family: var(--font-heading); font-size: 1.12rem; font-weight: 600; }
.kiosk-start small { font-size: .82rem; color: rgba(255, 255, 255, .72); }
.kiosk-start:active { transform: scale(.985); }

.kiosk-live {
  position: absolute; top: .7rem; left: .7rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .6rem; border-radius: 999px;
  background: rgba(0, 0, 0, .5);
  font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
}
.kiosk-live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399; animation: kiosk-pulse 1.6s ease-in-out infinite;
}
@keyframes kiosk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* -- bottom dock: exactly two controls ------------------------------------- */
.kiosk-dock {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.6rem;
  padding: .65rem 1rem calc(.75rem + env(safe-area-inset-bottom, 12px));
  background: #0b0709;
  border-top: 1px solid rgba(255, 255, 255, .1);
  box-sizing: border-box;
  position: relative;
  z-index: 10;
}
.dock-btn {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  width: 72px; padding: 0;
  background: none; border: 0; cursor: pointer;
  color: rgba(255, 255, 255, .85);
  font-family: var(--font-body);
}
.dock-btn .ico {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.dock-btn .lbl { font-size: .72rem; font-weight: 500; letter-spacing: .02em; color: rgba(255, 255, 255, .85); }
.dock-btn:active .ico { transform: scale(.94); }
.dock-btn.is-on .ico {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #fff;
}
.dock-btn.is-active .ico { background: rgba(255, 255, 255, .25); }

@media (min-width: 720px) {
  /* Tablet on a stand: keep the camera centred and the dock compact. */
  .kiosk-cam { max-height: none; }
  .kiosk-guide { width: min(48%, 340px); top: 40%; }
  .kiosk-flash .flash-ico { width: 88px; height: 88px; font-size: 2.9rem; }
  .kiosk-flash .flash-txt { font-size: 2.8rem; }
}

/* -------------------------------------------------------------------- login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-head { padding: 1.4rem 1.4rem .4rem; }
.auth-head .brand-mark { width: 36px; height: 36px; border-radius: 8px; font-size: 1rem; margin-bottom: .8rem; }
.auth-head h1 { font-size: 1.15rem; margin-bottom: .15rem; }
.auth-head p { color: var(--muted); font-size: .82rem; margin: 0; }
.auth-body { padding: 1rem 1.4rem 1.4rem; }
.auth-body .btn { height: 36px; }

/* --------------------------------------------------------------------- misc */
.empty-state { text-align: center; padding: 1.6rem 1rem; color: var(--muted); font-size: .82rem; }
.empty-state .ico { display: none; }
.empty-state h3 { margin-top: .2rem; }
td.empty-state { padding: 1.4rem 1rem !important; }
.kv { display: grid; grid-template-columns: 1fr; gap: 0 .9rem; font-size: .82rem; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; padding: .32rem 0; border-bottom: 1px solid var(--border); min-width: 0; }
.kv div:last-child { border-bottom: none; }
.kv dt, .kv .k { color: var(--muted); flex: none; }
.kv .v { font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) { .kv.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.section-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: .9rem 0 .4rem; }
.section-title:first-child { margin-top: 0; }
.divider { height: 1px; background: var(--border); margin: .75rem 0; border: 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: .3rem; }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: .6rem; }
details.disclosure > summary { cursor: pointer; padding: .5rem .75rem; font-weight: 500; font-size: .82rem; list-style: none; display: flex; align-items: center; gap: .4rem; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; font-size: 1rem; color: var(--muted); transition: transform .12s ease; display: inline-block; width: .6rem; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
details.disclosure .card-body { padding: .75rem; }
details.disclosure > form, details.disclosure > div:not(.card-body) { padding: .75rem; }
.progress { height: 6px; border-radius: 999px; background: #ecebea; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.camera-box { border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--border); }
.camera-box video { width: 100%; display: block; }
.face-thumb { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); background: #f1efee; }
.statement td:first-child { width: 70%; }

/* ------------------------------------------------ enterprise UX enhancements */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(24, 24, 27, .45);
  backdrop-filter: blur(2px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh;
  overflow-y: auto; transform: scale(.96); transition: transform .18s ease;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-box.modal-lg { max-width: 620px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid rgba(135, 8, 8, .2);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-xs { height: 22px; padding: 0 .45rem; font-size: .72rem; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1.1rem; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: .6rem;
  padding: .75rem 1.1rem; border-top: 1px solid var(--border); background: var(--subtle);
}

dialog.modal-dialog {
  margin: auto; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.modal-dialog::backdrop {
  background: rgba(24, 24, 27, .45); backdrop-filter: blur(2px);
}

/* Interactive register pills */
table.register td.interactive-cell {
  cursor: pointer; transition: transform .1s ease, box-shadow .1s ease;
  user-select: none; position: relative;
}
table.register td.interactive-cell:hover {
  transform: scale(1.18); z-index: 10;
  box-shadow: 0 3px 10px rgba(0,0,0,.15);
  outline: 2px solid var(--primary);
  border-radius: 3px;
}

/* Payroll 4-Stage Stepper */
.payroll-stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .9rem 1.25rem; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem;
}
.stepper-step {
  display: flex; align-items: center; gap: .55rem; font-size: .82rem;
  color: var(--muted); font-weight: 500;
}
.stepper-step.active { color: var(--primary); font-weight: 600; }
.stepper-step.completed { color: var(--success); }
.stepper-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: .74rem; font-weight: 700; background: var(--surface); border: 1px solid var(--border);
}
.stepper-step.active .stepper-num {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.stepper-step.completed .stepper-num {
  background: var(--success); color: #fff; border-color: var(--success);
}
.stepper-divider {
  flex: 1; height: 2px; background: var(--border); margin: 0 .6rem; min-width: 20px;
}
.stepper-divider.completed { background: var(--success); }

/* Dual-Column Payslip Card */
.dual-payslip-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem;
}
@media (max-width: 720px) {
  .dual-payslip-grid { grid-template-columns: 1fr; }
  .payroll-stepper { flex-direction: column; align-items: flex-start; }
  .stepper-divider { display: none; }
}

/* Quota Progress Bar */
.quota-bar-wrap { margin-bottom: .8rem; }
.quota-bar-head { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .25rem; }
.quota-bar-track { height: 7px; background: #ecebea; border-radius: 999px; overflow: hidden; }
.quota-bar-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }

/* Ask HR Floating Drawer (iOS Dynamic Island Style) */
.ask-hr-fab {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
  background: var(--ios-maroon-gradient); color: #fff; border: 0.5px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--ios-radius-pill); padding: 9px 16px; font-size: .84rem; font-weight: 650;
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(135, 8, 8, .36), 0 2px 6px rgba(0, 0, 0, .1);
  transition: transform .18s var(--ios-spring-easing), box-shadow .18s ease, background .15s ease;
  backdrop-filter: var(--ios-blur); -webkit-backdrop-filter: var(--ios-blur);
}
.ask-hr-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(135, 8, 8, .46); }
.ask-hr-fab:active { transform: scale(0.92); }
/* Phones and tablets have bottom tabs: sit above them, and keep content clear. */
@media (max-width: 1023px) {
  .ask-hr-fab {
    height: 42px; padding: 0 14px; border-radius: var(--ios-radius-pill); right: 14px;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 12px);
    box-shadow: 0 6px 20px rgba(135, 8, 8, .38);
  }
  .ask-hr-fab span { display: inline-block; font-size: .78rem; font-weight: 650; }
  .content { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 4.5rem); }
}

/* iOS Draft Autosave Toast */
.ios-draft-toast {
  position: fixed; top: calc(var(--header-h) + env(safe-area-inset-top) + 12px);
  left: 50%; transform: translateX(-50%) translateY(-24px) scale(0.94);
  background: rgba(28, 28, 32, 0.92); backdrop-filter: var(--ios-blur); -webkit-backdrop-filter: var(--ios-blur);
  color: #fff; padding: 7px 15px; border-radius: var(--ios-radius-pill);
  font-size: .78rem; font-weight: 550; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28); z-index: 1000;
  opacity: 0; pointer-events: none; transition: transform .28s var(--ios-spring-easing), opacity .25s ease;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}
.ios-draft-toast.visible {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1; pointer-events: auto;
}
.ios-draft-toast .pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ios-green); flex: none;
}
.ios-draft-toast button {
  background: none; border: none; color: rgba(255, 255, 255, 0.6);
  cursor: pointer; font-size: .82rem; padding: 0 2px; margin-left: 4px;
}
.ios-draft-toast button:hover { color: #fff; }

/* Mobile Native Bottom-Sheet Dialog */
@media (max-width: 767px) {
  dialog.modal-dialog {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: var(--ios-radius-sheet) !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: 0.5px solid var(--ios-border) !important;
    box-shadow: var(--ios-shadow-sheet) !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    animation: slideUpSheet 0.28s var(--ios-spring-easing) !important;
  }
  dialog.modal-dialog::before {
    content: '';
    display: block;
    width: 36px;
    height: 4.5px;
    border-radius: 3px;
    background: rgba(60, 60, 67, 0.25);
    margin: 8px auto 4px;
  }
  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}
.ask-hr-drawer {
  position: fixed; top: 0; bottom: 0; right: 0; width: 380px; max-width: 92vw;
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.18); z-index: 105;
  display: flex; flex-direction: column; transform: translateX(105%);
  transition: transform .24s cubic-bezier(.16, 1, .3, 1);
}
.ask-hr-drawer.open { transform: translateX(0); }
.ask-hr-head {
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
  background: var(--subtle); display: flex; align-items: center; justify-content: space-between;
}
.ask-hr-messages {
  flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem;
}
.ask-hr-msg {
  padding: .65rem .85rem; border-radius: var(--radius); font-size: .84rem; max-width: 86%;
  line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere;
}
.ask-hr-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-self: flex-start; max-width: 92%; margin-top: -.3rem; }
.ask-hr-chips {
  display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; flex: none;
  padding: .45rem .75rem; background: var(--subtle); border-top: 1px solid var(--border);
}
.ask-hr-chips::-webkit-scrollbar { display: none; }
.ask-hr-chips .chip { flex: none; height: 28px; padding: 0 .6rem; font-size: .74rem; font-family: var(--font-body); cursor: pointer; background: var(--card); color: var(--ink-soft); }
.ask-hr-chips .chip:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 720px) {
  .ask-hr-drawer { width: 100%; max-width: 100%; height: 100dvh; bottom: auto; border-left: 0; }
  .ask-hr-head { padding-top: calc(.9rem + env(safe-area-inset-top)); }
  .ask-hr-input-bar { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  .ask-hr-input-bar .btn { height: 38px; }
  #closeAskHrBtn { height: 36px; width: 36px; }
}
.ask-hr-msg.bot {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); align-self: flex-start;
}
.ask-hr-msg.user {
  background: var(--primary); color: #fff; align-self: flex-end;
}
.ask-hr-input-bar {
  padding: .75rem; border-top: 1px solid var(--border); background: var(--card);
  display: flex; gap: .5rem;
}
.ask-hr-input-bar input { flex: 1; }

/* ------------------------------------------------- every device: shared polish */
.skip-link {
  position: fixed; top: -60px; left: .75rem; z-index: 200; padding: .55rem .9rem; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-weight: 600;
}
.skip-link:focus { top: .5rem; text-decoration: none; }
main:focus { outline: none; }
a:focus-visible, button:focus-visible, summary:focus-visible, .chip:focus-visible, td.interactive-cell:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.nav-section { color: var(--muted); }
.ask-hr-fab { transition: transform .18s ease, opacity .18s ease, background .15s ease; }
.ask-hr-fab.is-away { transform: translateY(90px); opacity: 0; pointer-events: none; }
body.drawer-open, body:has(.modal-overlay.open), body:has(.ask-hr-drawer.open) { overflow: hidden; }
input[type=file]::file-selector-button {
  margin-right: .6rem; padding: .3rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}
.btn.is-busy { position: relative; opacity: .75; pointer-events: none; }
.btn.is-busy::after {
  content: ""; width: 12px; height: 12px; margin-left: .2rem; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
/* Visibility Breakpoints */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* iOS Segmented Control */
.ios-segmented-control {
  display: flex; background: rgba(118, 118, 128, 0.12); border-radius: 9px;
  padding: 2.5px; margin-bottom: 1rem; position: relative; user-select: none;
}
.ios-segmented-btn {
  flex: 1; text-align: center; padding: 6px 12px; font-size: .8rem; font-weight: 600;
  border-radius: 7px; border: none; background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: all 0.18s var(--ios-spring-easing); white-space: nowrap;
}
.ios-segmented-btn:active { transform: scale(0.96); }
a.ios-segmented-btn { text-decoration: none; }
.ios-segmented-btn.active {
  background: var(--card); color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0.5px 1px rgba(0, 0, 0, 0.08);
}
@media (min-width: 1024px) {
  .ios-segmented-control.mobile-only { display: none; }
}

/* Settings Segmented Categories */
.settings-nav-tabs {
  display: flex; gap: .4rem; overflow-x: auto; padding: .65rem .85rem;
  background: var(--subtle); border-bottom: 0.5px solid var(--ios-border);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.settings-nav-tabs::-webkit-scrollbar { display: none; }
.settings-tab-btn {
  padding: .35rem .75rem; border-radius: var(--ios-radius-pill); font-size: .74rem;
  font-weight: 600; border: 0.5px solid var(--ios-border); background: var(--card);
  color: var(--ink-soft); cursor: pointer; white-space: nowrap; flex: none;
  transition: all .15s ease;
}
.settings-tab-btn:hover { color: var(--ink); background: var(--hover); }
.settings-tab-btn:active { transform: scale(0.95); }
.settings-tab-btn.active {
  background: var(--ios-maroon-gradient); color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(135, 8, 8, .28);
}

.offline-banner {
  position: fixed; top: calc(var(--header-h) + env(safe-area-inset-top)); left: 0; right: 0; z-index: 95;
  padding: .4rem .75rem; background: var(--ink); color: #fff; font-size: .78rem; text-align: center;
}

/* The bell and its panel */
.bell-wrap { position: relative; }
#bellBtn { position: relative; }
.bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 11px; height: 15px; padding: 0 2px; border-radius: 999px;
  background: var(--primary); color: #fff; border: 1.5px solid var(--card); box-sizing: content-box;
  font-size: .6rem; font-style: normal; font-weight: 700; line-height: 15px; text-align: center;
}
.inbox-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80; width: 360px;
  display: flex; flex-direction: column; max-height: min(70vh, 560px); overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.inbox-panel.hidden { display: none !important; }
.inbox-head { padding: .65rem .85rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.inbox-list { flex: 1; min-height: 80px; overflow-y: auto; }
.inbox-item { display: block; padding: .6rem .85rem; border-bottom: 1px solid var(--border); color: var(--ink); }
.inbox-item:hover { background: var(--hover); text-decoration: none; }
.inbox-item.is-unread { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.inbox-item strong { display: block; font-size: .82rem; font-weight: 600; }
.inbox-item span { display: block; margin-top: .1rem; font-size: .77rem; line-height: 1.35; color: var(--ink-soft); }
.inbox-item time { display: block; margin-top: .15rem; font-size: .68rem; color: var(--muted); }
.inbox-push {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .55rem .85rem;
  background: var(--subtle); border-top: 1px solid var(--border);
}
.inbox-push .grow { flex: 1; min-width: 130px; }
.inbox-toast {
  position: fixed; top: calc(var(--header-h) + env(safe-area-inset-top) + 10px); right: 12px; z-index: 95;
  width: min(340px, calc(100vw - 24px)); padding: .65rem .85rem; font-size: .8rem; line-height: 1.35;
  background: var(--ink); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.inbox-toast strong { display: block; margin-bottom: .1rem; }
@media (max-width: 720px) {
  .bell-wrap { position: static; }
  .inbox-panel {
    position: fixed; left: 8px; right: 8px; top: calc(var(--header-h) + env(safe-area-inset-top) + 6px); width: auto;
    max-height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
  }
}

.dept-summary { cursor: pointer; list-style: none; }
.dept-summary::-webkit-details-marker { display: none; }
.dept-summary::before { content: "›"; font-size: 1.1rem; color: var(--muted); transition: transform .12s ease; }
details[open] > .dept-summary::before { transform: rotate(90deg); }
details:not([open]) > .dept-summary { border-bottom: 0; }

td[data-label="Source"] .chip { white-space: normal; height: auto; padding-block: .1rem; line-height: 1.25; }

/* Coming up: birthdays and anniversaries */
.celebrate-card { border-color: var(--primary-soft-border); }
.celebrate-card .card-head { background: var(--primary-soft); border-bottom-color: var(--primary-soft-border); }
.celebrate-card .card-head h2 { color: var(--primary); }
.celebrate-row { color: var(--ink); }
.celebrate-row:hover { background: var(--hover); text-decoration: none; }
.celebrate-row.is-today { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }

.celebrate-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.celebrate-pill.birthday { background: #fdf2f8; color: #db2777; border: 1px solid #fbcfe8; }
.celebrate-pill.work { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.celebrate-pill.anniversary { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-when { display: inline-block; padding: .2rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 600; }
.badge-when.today { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-when.tomorrow { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-when.week { background: #f0f9ff; color: #0369a1; }
.badge-when.future { background: var(--subtle); color: var(--muted); }
.celebrate-today-row { background: rgba(34, 197, 94, .06) !important; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #1eb956; color: #fff; }
.btn-email { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

/* Long forms keep Save in reach, above the bottom tabs. */
.card:has(> .sticky-save) { overflow: visible; }
.sticky-save {
  position: sticky; bottom: .5rem; z-index: 30; box-shadow: 0 -6px 16px -10px rgba(24, 24, 27, .35);
}
.card-foot.sticky-save { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Touch screens of any size: bigger targets, no zoom on focus, no stuck hover. */
@media (pointer: coarse), (max-width: 1023px) {
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
  input[type=time], input[type=month], input[type=tel], input[type=search], input[type=url], select, textarea {
    height: 38px; font-size: 16px;
  }
  textarea { height: auto; }
  .sticky-save { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + .5rem); }
}
@media (pointer: coarse) {
  .btn { min-height: 42px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .btn:active, .bottom-nav a:active, .chip:active { transform: scale(0.97); transition: transform 0.08s ease; }
  .btn-sm, table.m-table .btn-sm, .bulk-bar .btn { min-height: 36px; }
  .btn-xs { min-height: 32px; }
  .icon-btn { width: 42px; height: 42px; touch-action: manipulation; }
  .icon-btn:active { transform: scale(0.92); }
  .nav a { padding: .7rem .65rem; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  table.register td.cell { min-width: 32px; height: 42px; }
}
@media (hover: none) {
  table.data tbody tr:hover { background: inherit; }
  table.register td.interactive-cell:hover { transform: none; box-shadow: none; outline: none; }
  .me-action:hover { background: none; }
}

/* Popups rise from the bottom on phones, within thumb reach. */
@media (max-width: 720px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box, .modal-box.modal-lg {
    max-width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; transform: translateY(24px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-overlay.open .modal-box { transform: none; }
  .register-wrap { max-height: 64vh; }
  table.register .sticky-col { min-width: 118px; max-width: 118px; overflow: hidden; }
  table.register .sticky-col strong, table.register .sticky-col .sub {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}

/* Mobile 7-Day Attendance Strip */
.weekly-strip-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: 1rem; }
.weekly-strip-wrap::-webkit-scrollbar { display: none; }
.weekly-strip { display: flex; gap: 8px; }
.weekly-day-pill {
  flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.weekly-day-pill.today { border-color: var(--primary); background: var(--subtle); font-weight: 700; }
.weekly-day-pill .day-name { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }
.weekly-day-pill .day-num { font-size: 0.92rem; font-weight: 700; margin: 2px 0 4px; }
.weekly-day-pill .status-dot { width: 7px; height: 7px; border-radius: 50%; display: block; }
.weekly-day-pill .status-dot.present { background: #16a34a; }
.weekly-day-pill .status-dot.half_day { background: #f59e0b; }
.weekly-day-pill .status-dot.absent { background: #dc2626; }
.weekly-day-pill .status-dot.leave { background: #2563eb; }
.weekly-day-pill .status-dot.week_off, .weekly-day-pill .status-dot.holiday { background: #94a3b8; }

/* Phones held sideways: short screens need the height back. */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --bottom-nav-h: 42px; }
  .topbar { position: static; }
  .bottom-nav a { flex-direction: row; gap: .35rem; }
  .content {
    padding-left: max(.75rem, env(safe-area-inset-left));
    padding-right: max(.75rem, env(safe-area-inset-right));
  }
  .kiosk-view { flex-direction: row; }
  .kiosk-dock { flex-direction: column; gap: .5rem; padding: .4rem .6rem; border-top: 0; border-left: 1px solid rgba(255, 255, 255, .07); }
  .dock-btn .ico { width: 42px; height: 42px; }
  .dock-btn .lbl { font-size: .62rem; }
  .kiosk-guide { width: auto; height: 78%; }
  .kiosk-card { flex-flow: row wrap; align-content: center; gap: .35rem .9rem; padding: .75rem; }
  .kiosk-card .card-punch { font-size: 2rem; }
  .kiosk-card .card-avatar { width: 60px; height: 60px; font-size: 1.4rem; margin-top: 0; }
  .kiosk-flash .flash-ico { width: 48px; height: 48px; font-size: 1.6rem; }
  .kiosk-flash .flash-txt { font-size: 1.6rem; margin-top: .15rem; }
}

/* Very wide monitors: keep the page centred instead of stuck to the sidebar. */
@media (min-width: 1900px) { .content { margin-inline: auto; } }

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

/* ---------------------------------------------------- face login on /login */
.btn-face-login {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  transition: all .15s ease;
  width: 100%;
}
.btn-face-login:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-face-login svg {
  color: var(--primary);
  flex-shrink: 0;
}
.face-login-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.face-login-view[hidden] {
  display: none !important;
}
.face-scanner-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 250px;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .7);
}
.face-scanner-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.face-oval-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 180px;
  border: 2px dashed rgba(255, 255, 255, .75);
  border-radius: 50%;
  pointer-events: none;
  transition: all .25s ease;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .4);
}
.face-oval-guide.scanning {
  border: 2px solid var(--primary);
  box-shadow: 0 0 16px var(--primary), 0 0 0 9999px rgba(0, 0, 0, .45);
}
.face-oval-guide.ok {
  border: 3px solid #10b981;
  box-shadow: 0 0 24px #10b981, 0 0 0 9999px rgba(0, 0, 0, .45);
}
.face-oval-guide.warn {
  border: 3px solid #f59e0b;
  box-shadow: 0 0 18px #f59e0b, 0 0 0 9999px rgba(0, 0, 0, .45);
}
.face-oval-guide.bad {
  border: 3px solid #ef4444;
  box-shadow: 0 0 18px #ef4444, 0 0 0 9999px rgba(0, 0, 0, .45);
}
.face-status-text {
  margin-top: .75rem;
  font-size: .88rem;
  text-align: center;
  font-weight: 500;
  min-height: 1.5rem;
  color: var(--muted);
  line-height: 1.35;
  transition: color .15s ease;
}
.face-status-text.ok { color: #059669; font-weight: 600; }
.face-status-text.warn { color: #d97706; }
.face-status-text.bad { color: #dc2626; }

/* ------------------------------------------------------------------- profile tabs */
.profile-nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.profile-nav-tabs::-webkit-scrollbar { display: none; }
.profile-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  user-select: none;
  text-decoration: none;
}
.profile-tab-btn:hover {
  color: var(--ink);
  background: var(--bg-hover, #f4f4f5);
}
.profile-tab-btn.active {
  color: #fff;
  background: var(--primary, #870808);
  border-color: var(--primary, #870808);
  box-shadow: 0 2px 6px rgba(135, 8, 8, 0.25);
}
.profile-tab-btn .tab-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-weight: 600;
}
.profile-tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeInTab 0.15s ease;
}
@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.copy-pill {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-hover, #f1f3f5);
  border: 1px solid var(--border);
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  transition: background .15s;
}
.copy-pill:hover {
  background: #e9ecef;
}

/* ------------------------------------------------------------------- print */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .page-actions, .drawer, .drawer-backdrop, .skip-link, .offline-banner { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
  .payslip-print { max-width: 100%; }
  table.data th { position: static; }
}

/* ===================================================================== documents
   Payslips and F&F statements (templates/_document.html). Sizes are in mm/pt and match
   app/pdf.py exactly, so the printed page and the downloaded PDF look the same. */
@font-face { font-family: "Doc Sans"; src: url("../fonts/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Doc Sans"; src: url("../fonts/NotoSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Doc Sans"; src: url("../fonts/NotoSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

.doc-wrap { overflow-x: auto; padding-bottom: 1rem; }
.doc {
  --doc-brand: #870808; --doc-ink: #141414; --doc-muted: #6b6b6b; --doc-rule: #d8d3d0; --doc-tint: #fdf2f2;
  box-sizing: border-box; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 0 14mm 14mm;
  background: #fff; color: var(--doc-ink); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.08);
  font-family: "Doc Sans", "Noto Sans", Helvetica, Arial, sans-serif; font-size: 9.5pt; line-height: 1.3;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc * { box-sizing: border-box; }
.doc-bar { background: var(--doc-brand); color: #fff; margin: 0 -14mm; height: 24mm; padding: 4mm 14mm 0; display: flex; align-items: center; }
.doc-bar-row { display: flex; align-items: center; gap: 4mm; width: 100%; min-width: 0; }
.doc-logo { height: 14mm; width: auto; max-width: 48mm; object-fit: contain; background: #fff; border-radius: 2mm; padding: 1.2mm 2.5mm; flex-shrink: 0; }
.doc-bar-text { min-width: 0; flex: 1; }
.doc-org { font-size: 16pt; font-weight: 700; line-height: 7mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-subtitle { font-size: 9pt; line-height: 5mm; }
.doc-titlerow { display: flex; justify-content: space-between; gap: 4mm; margin-top: 6mm; }
.doc-title { font-size: 13pt; font-weight: 700; line-height: 8mm; }
.doc-status { font-size: 9pt; font-weight: 700; color: var(--doc-brand); line-height: 5mm; }
.doc-meta { font-size: 9pt; color: var(--doc-muted); text-align: right; line-height: 5mm; white-space: nowrap; }
.doc-section { margin: 4mm 0 2mm; font-size: 10pt; font-weight: 700; color: var(--doc-brand); text-transform: uppercase;
  line-height: 6mm; border-bottom: .2mm solid var(--doc-rule); }
.doc-cols { display: grid; grid-template-columns: 89mm 89mm; column-gap: 4mm; align-items: start; }
.doc-field { display: grid; grid-template-columns: 34mm 55mm; line-height: 6mm; }
.doc-field .k { font-size: 9pt; color: var(--doc-muted); }
.doc-field .v { font-size: 10pt; font-weight: 700; }
.doc-field .k, .doc-field .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { padding: 0; border-bottom: .2mm solid var(--doc-rule); text-align: left; background: none; position: static; }
.doc-table th { font-size: 9pt; font-weight: 700; color: var(--doc-muted); text-transform: uppercase; height: 7mm; letter-spacing: 0; }
.doc-table td { font-size: 9.5pt; height: 7mm; padding: 1.3mm 0 1mm; vertical-align: top; }
.doc-table .amt { text-align: right; width: 30mm; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table .note { display: block; font-size: 7.5pt; color: var(--doc-muted); line-height: 1.2; }
.doc-table tr.total td { font-weight: 700; background: var(--doc-tint); }
.doc-net { display: flex; justify-content: space-between; align-items: center; gap: 4mm; margin-top: 5mm;
  height: 14mm; padding: 0 3mm; background: var(--doc-brand); color: #fff; }
.doc-net-label { font-size: 11pt; font-weight: 700; color: #fff; }
.doc-net-amount { font-size: 16pt; font-weight: 700; white-space: nowrap; color: #fff; }
.doc-words { font-size: 9pt; font-style: italic; color: var(--doc-muted); line-height: 6mm; }
.doc-exp-list { margin: 1.5mm 0 2mm; padding-left: 4.5mm; font-size: 8.3pt; line-height: 1.45; color: var(--doc-ink); }
.doc-exp-list li { margin-bottom: .7mm; }
.doc-att-cal { margin: 1.5mm 0 2.5mm; border: .2mm solid var(--doc-rule); border-radius: 1.5mm; overflow: hidden; }
.doc-att-head, .doc-att-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.doc-att-head div { font-size: 7.5pt; font-weight: 700; color: var(--doc-muted); text-align: center; padding: 1mm 0; background: #faf9f8; border-bottom: .2mm solid var(--doc-rule); }
.doc-att-cell { display: flex; align-items: center; justify-content: center; gap: 1.2mm; height: 5.8mm; font-size: 7.5pt; border-right: .2mm solid var(--doc-rule); border-bottom: .2mm solid var(--doc-rule); }
.doc-att-cell:nth-child(7n) { border-right: 0; }
.doc-att-cell .d { color: var(--doc-muted); font-variant-numeric: tabular-nums; }
.doc-att-cell .c { font-weight: 700; }
.doc-att-cell.is-empty { background: #fcfbfb; }
.doc-att-cell.is-present, .doc-att-leg.is-present { background: #e8f6ec; color: #15803d; }
.doc-att-cell.is-absent, .doc-att-leg.is-absent { background: #fde8e8; color: #b91c1c; }
.doc-att-cell.is-half, .doc-att-leg.is-half { background: #fef3c7; color: #b45309; }
.doc-att-cell.is-leave, .doc-att-leg.is-leave { background: #e0f2fe; color: #0369a1; }
.doc-att-cell.is-weekoff, .doc-att-leg.is-weekoff { background: #f3f4f6; color: #6b7280; }
.doc-att-cell.is-holiday, .doc-att-leg.is-holiday { background: #ede9fe; color: #6d28d9; }
.doc-att-cell.is-fine, .doc-att-leg.is-fine { background: #ffedd5; color: #c2410c; }
.doc-att-cell.is-muted { background: #f9fafb; color: #9ca3af; }
.doc-att-legend { display: flex; flex-wrap: wrap; gap: 1.5mm; padding: 1.2mm 2mm; background: #faf9f8; font-size: 7.2pt; }
.doc-att-leg { padding: .3mm 1.5mm; border-radius: 1mm; }
.doc-notes { margin-top: 2mm; font-size: 8.5pt; color: var(--doc-muted); line-height: 4.5mm; }
.doc-verify-line { margin-top: 1.5mm; font-size: 8pt; color: var(--doc-ink); }
.doc-footer { margin-top: 2mm; font-size: 8pt; color: var(--doc-muted); line-height: 4.5mm; }
.payslip-settings-grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.letters-split-grid { display: grid; grid-template-columns: minmax(400px, 1.1fr) minmax(380px, 1fr); gap: 1.5rem; align-items: start; }
.payslip-preview-frame { width: 100%; height: 740px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.tpl-card-item { padding: .75rem .85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color .15s ease, background .15s ease; }
.tpl-card-item.is-selected { border-color: var(--primary); background: #fdf2f2; }
.tpl-logo-box { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .55rem .7rem; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); }
.tpl-logo-thumb { height: 40px; max-width: 110px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; padding: 3px; background: #fff; }
.tpl-logo-placeholder { width: 40px; height: 40px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); font-size: .78rem; }
.tpl-toggle-card { display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; cursor: pointer; background: var(--surface); transition: border-color .15s ease, background .15s ease; }
.tpl-toggle-card:hover { border-color: var(--primary); background: var(--bg); }
.tpl-create-box summary { list-style: none; cursor: pointer; }
.tpl-create-box summary::-webkit-details-marker { display: none; }
@media (max-width: 960px) {
  .payslip-settings-grid, .letters-split-grid { grid-template-columns: minmax(0, 1fr); }
  .payslip-preview-frame { height: 520px; }
}
.doc-signs { display: flex; justify-content: space-between; margin-top: 14mm; }
.doc-signs div { width: 66mm; border-top: .2mm solid var(--doc-rule); padding-top: 1mm; text-align: center; font-size: 8pt; color: var(--doc-muted); }

@media screen and (max-width: 860px) {
  .doc-wrap { overflow-x: visible; }
  .doc { width: 100%; max-width: 100%; min-height: 0; padding: 0 14px 20px; font-size: 10pt; }
  .doc-bar { margin: 0 -14px; height: auto; padding: 14px; }
  .doc-org { white-space: normal; }
  .doc-cols { grid-template-columns: minmax(0, 1fr); row-gap: 4mm; }
  .doc-cols > * { min-width: 0; }
  .doc-field { grid-template-columns: minmax(0, 42%) minmax(0, 58%); }
  .doc-field .v { white-space: normal; overflow-wrap: anywhere; }
  .doc-table { table-layout: fixed; }
  .doc-table .amt { width: 36%; }
  .doc-table td:first-child { overflow-wrap: anywhere; }
  .doc-titlerow { flex-direction: column; gap: 2mm; }
  .doc-meta { text-align: left; }
  .doc-net { height: auto; padding: 3mm; flex-wrap: wrap; }
  .doc-signs div { width: 45%; }
}
@media print {
  .doc-wrap { overflow: visible; padding: 0; }
  .doc { width: 210mm; min-height: 0; margin: 0; border: 0; box-shadow: none; }
  body.printing-doc .content > :not(.doc-wrap) { display: none !important; }
  body.printing-doc .ask-hr-fab, body.printing-doc .ask-hr-drawer { display: none !important; }
}

/* ---------------------------------------------------------- Command Palette */
.cmd-trigger {
  display: inline-flex; align-items: center; gap: .45rem;
  height: 36px; padding: 0 .65rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .12); color: inherit;
  font: inherit; font-size: .82rem; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cmd-trigger:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .38); }
.cmd-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .1rem .35rem; border-radius: 5px; font-size: .72rem; font-weight: 600;
  background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .2);
  font-family: inherit; line-height: 1.2;
}
@media (max-width: 720px) {
  .cmd-trigger-text, .cmd-trigger .cmd-kbd { display: none; }
  .cmd-trigger { width: 36px; padding: 0; justify-content: center; }
}
.cmd-dialog {
  width: min(560px, 92vw); max-width: 92vw; padding: 0; margin: 10vh auto auto;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  color: var(--ink); box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35); overflow: hidden;
}
.cmd-dialog::backdrop { background: rgba(15, 23, 42, .52); backdrop-filter: blur(3px); }
.cmd-head {
  display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem;
  border-bottom: 1px solid var(--border); color: var(--muted);
}
.cmd-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: var(--ink); font: inherit; font-size: .95rem;
}
.cmd-close {
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  border-radius: 6px; padding: .2rem .45rem; font-size: .74rem; font-weight: 600; cursor: pointer;
}
.cmd-list { max-height: min(380px, 55vh); overflow-y: auto; padding: .4rem; }
.cmd-group {
  padding: .35rem .6rem .2rem; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.cmd-item {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 0;
  background: transparent; color: var(--ink); text-decoration: none;
  font: inherit; font-size: .88rem; cursor: pointer; text-align: left;
}
.cmd-item:hover, .cmd-item.is-active { background: var(--bg); color: var(--primary); }
.cmd-item-sub { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.cmd-empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .88rem; }
.cmd-foot {
  display: flex; flex-wrap: wrap; gap: .9rem; padding: .5rem 1rem;
  border-top: 1px solid var(--border); background: var(--bg);
  font-size: .75rem; color: var(--muted);
}
.cmd-foot kbd {
  display: inline-block; padding: .05rem .3rem; margin-right: .2rem;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface);
  font-family: inherit; font-size: .7rem;
}
.salary-eye-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.salary-eye-btn:hover, .salary-eye-btn[aria-pressed="true"] {
  color: var(--primary); border-color: var(--primary); background: var(--bg);
}
.push-prompt-banner {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  flex-wrap: wrap; padding: .75rem 1rem; margin-bottom: 1rem;
  border: 1px solid var(--primary); border-radius: 12px;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  box-shadow: 0 2px 10px rgba(153, 27, 27, .06);
}
.push-prompt-text { display: flex; flex-direction: column; gap: .15rem; min-width: 200px; flex: 1; }
.push-prompt-text strong { font-size: .92rem; color: var(--ink); }
.push-prompt-text span { font-size: .82rem; color: var(--muted); }
.push-prompt-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.apk-cta-card {
  margin-top: 1rem; padding: .85rem 1rem; border-radius: 14px;
  border: 1px solid rgba(153, 27, 27, .25);
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  box-shadow: 0 4px 14px rgba(153, 27, 27, .07);
}
.apk-cta-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.apk-cta-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 10px rgba(153, 27, 27, .22);
}
.apk-cta-text { flex: 1; min-width: 170px; }
.apk-cta-text strong { display: block; font-size: .92rem; color: var(--ink); line-height: 1.25; }
.apk-cta-text span { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; line-height: 1.35; }
.apk-cta-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.apk-dl-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 600; }
@media (max-width: 480px) {
  .apk-cta-actions { width: 100%; }
  .apk-dl-btn { flex: 1; min-height: 40px; }
  .apk-cta-dismiss { min-height: 40px; }
}
