:root {
  --bg-white: #ffffff;
  --bg-muted: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --border-strong: #94a3b8;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-sub: #64748b;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-rose: #dc2626;
  --accent-amber: #d97706;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --rge-navy: #1C305C;
  --rge-navy-deep: #132242;
  --rge-blue: #2573BA;
  --rge-blue-bright: #3389D6;
  --rge-slate: #636569;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(226, 232, 240, 0.8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background-color: var(--bg-white);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  text-wrap: balance;
}

img, svg {
  max-width: 100%;
}

button, a {
  touch-action: manipulation;
}

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.glass-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   RGE CORPORATE LETTERHEAD HEADER & COMMAND BAR (Matching RGE Project Tracker)
   ========================================================================== */
.corporate-header {
  width: 100%;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 40;
}

.rge-lh-header {
  position: relative;
  background: #FFFFFF;
  overflow: hidden;
  width: 100%;
}

.rge-lh-bg-slashes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 54%, rgba(226, 232, 240, 0.45) 54%, rgba(226, 232, 240, 0.25) 68%, rgba(203, 213, 225, 0.35) 68%, rgba(241, 245, 249, 0.55) 84%, rgba(203, 213, 225, 0.32) 84%);
}

.rge-lh-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  padding: clamp(0.8rem, 1.8vw, 1.25rem) clamp(1rem, 3.5vw, 3rem) clamp(1rem, 2.2vw, 1.45rem);
}

.rge-lh-brand {
  display: flex;
  align-items: center;
  gap: clamp(0.65rem, 1.4vw, 1rem);
  min-width: 0;
}

.rge-lh-logo {
  width: clamp(50px, 5.2vw, 72px);
  height: clamp(50px, 5.2vw, 72px);
  object-fit: contain;
  flex-shrink: 0;
}

.rge-lh-wordmark {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.95rem, 0.7rem + 1vw, 1.42rem);
  line-height: 1.15;
  letter-spacing: 0.015em;
  color: #0A0E17;
}

.rge-lh-address {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #111827;
}

.rge-lh-pin {
  width: clamp(20px, 2vw, 26px);
  height: clamp(20px, 2vw, 26px);
  color: #0A0E17;
  flex-shrink: 0;
}

.rge-lh-address-lines {
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: clamp(0.78rem, 0.7rem + 0.35vw, 0.98rem);
  font-weight: 500;
  line-height: 1.32;
  color: #111827;
}

.rge-lh-bottom-bar {
  position: relative;
  height: 22px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: transparent;
  z-index: 2;
}

.rge-bar-gray {
  height: 7px;
  width: 55%;
  background: #636569;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}

.rge-bar-slash {
  position: absolute;
  left: calc(55% + 2px);
  bottom: 0;
  width: 28px;
  height: 22px;
  background: #2573BA;
  clip-path: polygon(16px 0, 28px 0, 12px 100%, 0 100%);
}

.rge-bar-navy {
  position: absolute;
  left: calc(55% + 26px);
  right: 0;
  bottom: 0;
  height: 22px;
  background: #142A54;
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%);
}

.app-command-bar {
  background: linear-gradient(90deg, var(--rge-navy-deep) 0%, var(--rge-navy) 62%, #234E88 100%);
  color: #FFFFFF;
}

.command-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem clamp(1rem, 2.5vw, 2rem);
}

.command-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rge-signal-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sig-dot {
  border-radius: 50%;
  display: inline-block;
}
.sig-dot.lg { width: 10px; height: 10px; background: #E8FCFC; }
.sig-dot.md { width: 7px; height: 7px; background: #60A5FA; }
.sig-dot.sm { width: 5px; height: 5px; background: var(--rge-blue-bright); }

.app-title {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #FFFFFF;
}

.app-subtitle {
  display: block;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.78);
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cmd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.42rem 0.82rem;
  min-height: 36px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.cmd-btn:active { transform: scale(0.97); }

.cmd-btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}
.cmd-btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

.cmd-btn-accent {
  background: #FFFFFF;
  color: var(--rge-navy);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
.cmd-btn-accent:hover {
  background: #E8FCFC;
  transform: translateY(-1px);
}

/* RGE CORPORATE LETTERHEAD FOOTER */
.corporate-footer {
  margin-top: auto;
  width: 100%;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
}

.rge-lh-footer {
  background: #FFFFFF;
  border-top: none;
  overflow: hidden;
}

.rge-lh-footer-top-bar {
  position: relative;
  height: 22px;
  width: 100%;
  background: #FFFFFF;
}

.rge-fbar-navy {
  position: absolute;
  left: 0;
  top: 0;
  width: 47%;
  height: 22px;
  background: #142A54;
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
}

.rge-fbar-slash {
  position: absolute;
  left: calc(47% - 10px);
  top: 0;
  width: 28px;
  height: 22px;
  background: #2573BA;
  clip-path: polygon(16px 0, 28px 0, 12px 100%, 0 100%);
}

.rge-fbar-gray {
  position: absolute;
  left: calc(47% + 16px);
  right: 0;
  top: 0;
  height: 7px;
  background: #636569;
  clip-path: polygon(7px 0, 100% 0, 100% 100%, 0 100%);
}

.rge-lh-footer-body {
  position: relative;
  background: #FFFFFF;
  padding: clamp(0.85rem, 1.8vw, 1.25rem) clamp(1rem, 3.5vw, 3rem);
}

.rge-lh-footer-slashes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(226, 232, 240, 0.5) 0%, rgba(226, 232, 240, 0.28) 18%, rgba(203, 213, 225, 0.35) 18%, rgba(241, 245, 249, 0.45) 34%, transparent 34%);
}

.rge-lh-footer-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem 1.5rem;
  align-items: center;
}

@media (min-width: 840px) {
  .rge-lh-footer-inner {
    grid-template-columns: 1.1fr 1.1fr 1fr;
  }
}

.rge-foot-col {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.rge-foot-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}
.rge-foot-social-link:hover .rge-foot-company {
  color: var(--rge-blue);
  text-decoration: underline;
}
.rge-foot-social-link:hover .rge-foot-fb-icon {
  color: var(--rge-blue);
}

.rge-foot-fb-icon {
  width: 28px;
  height: 28px;
  color: #0A0E17;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rge-foot-fb-icon svg { width: 24px; height: 24px; }

.rge-foot-company {
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: clamp(0.84rem, 0.78rem + 0.25vw, 0.96rem);
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
}

.rge-foot-web {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.38rem;
}

.rge-foot-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
  font-weight: 500;
  color: #111827;
  text-decoration: none;
}
.rge-foot-link svg { width: 18px; height: 18px; color: #0A0E17; flex-shrink: 0; }
.rge-foot-link:hover { color: var(--rge-blue); text-decoration: underline; }

.rge-foot-phones {
  justify-content: flex-start;
  flex-wrap: wrap;
}
@media (min-width: 840px) {
  .rge-foot-phones { justify-content: flex-end; }
}

.rge-foot-phone-ico { width: 20px; height: 20px; color: #0A0E17; flex-shrink: 0; }

.rge-foot-phone-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.rge-foot-phone-list a {
  font-family: var(--font-sans);
  font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.94rem);
  font-weight: 500;
  color: #111827;
  text-decoration: none;
  white-space: nowrap;
}
.rge-foot-phone-list a:hover { color: var(--rge-blue); text-decoration: underline; }

@media (max-width: 640px) {
  .rge-lh-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding-bottom: 0.85rem;
  }
  .rge-lh-bottom-bar { height: 14px; }
  .rge-bar-gray { width: 42%; height: 5px; }
  .rge-bar-slash { left: calc(42% + 2px); width: 20px; height: 14px; clip-path: polygon(10px 0, 20px 0, 10px 100%, 0 100%); }
  .rge-bar-navy { left: calc(42% + 18px); height: 14px; clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); }
  .rge-lh-footer-top-bar { height: 14px; }
  .rge-fbar-navy { width: 42%; height: 14px; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
  .rge-fbar-slash { left: calc(42% - 6px); width: 20px; height: 14px; clip-path: polygon(10px 0, 20px 0, 10px 100%, 0 100%); }
  .rge-fbar-gray { left: calc(42% + 12px); height: 5px; }
}

/* Clean Top Header (Legacy Fallback) */
header.top-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-title h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-title p {
  font-size: 0.75rem;
  color: var(--text-sub);
}

/* Flat Tabs Navigation */
.tabs-bar {
  display: flex;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  background: var(--bg-muted);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Modern Clean Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-dark {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-dark:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border-dark);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

/* App Shell: Left Sidebar + Main Viewport */
.app-shell {
  display: flex;
  flex: 1;
  width: 100%;
}

.left-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--bg-muted);
  border-right: 1px solid var(--border);
  padding: 1.15rem 0.75rem;
}

.left-sidebar .sidebar-nav {
  position: sticky;
  top: 1rem;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-sub);
  padding: 0 0.65rem 0.55rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.left-sidebar .tab-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 0.58rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  border: 1px solid transparent;
  color: var(--text-muted);
  background: transparent;
}

.left-sidebar .tab-btn:hover {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border);
}

.left-sidebar .tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.left-sidebar .tab-btn svg {
  flex-shrink: 0;
}

.sidebar-mobile-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.sidebar-mobile-trigger:hover {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 110;
}

.sidebar-backdrop.is-open {
  display: block;
}

.sidebar-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.45rem 0.25rem;
}

/* ==========================================================================
   SETTINGS SPLIT SHELL & CLOUDFLARE R2 BACKUP UI (Matches RGE Project Tracker)
   ========================================================================== */
.settings-shell-card {
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-split {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 520px;
}

@media (min-width: 820px) {
  .settings-split {
    grid-template-columns: 220px 1fr;
  }
}

.settings-subnav {
  background: #F6F8FC;
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (min-width: 820px) {
  .settings-subnav {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
}

.settings-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  padding-inline: 0.55rem;
}

.settings-sublist {
  display: flex;
  flex-direction: row;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-sublist::-webkit-scrollbar { display: none; }

@media (min-width: 820px) {
  .settings-sublist {
    flex-direction: column;
  }
}

.settings-subbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  min-height: 38px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.settings-subbtn svg { width: 16px; height: 16px; flex-shrink: 0; }
.settings-subbtn:hover { background: #E9EFF8; color: var(--rge-navy); }
.settings-subbtn.is-active {
  background: #1D6AE5;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(29, 106, 229, 0.25);
}

.settings-content {
  padding: clamp(1.1rem, 2.2vw, 1.75rem);
  display: flex;
  flex-direction: column;
}

.settings-pane[hidden] { display: none !important; }

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.settings-form-grid .full-span {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .settings-form-grid { grid-template-columns: 1fr; }
}

.cb-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.cb-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.cb-desc {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 0.2rem;
  max-width: 640px;
  line-height: 1.5;
}

.cb-action-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: #F4F7FB;
  border: 1px solid #E5ECF5;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.7rem;
}

.cb-card-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.cb-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #E5F0FF;
  color: #1D6AE5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cb-icon-circle svg { width: 19px; height: 19px; }

.cb-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cb-card-text strong,
.cb-endpoint {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-phone-copy {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
}

.cb-subtext {
  display: block;
  font-size: 0.74rem;
  color: var(--text-sub);
  margin-top: 0.1rem;
}

.cb-pill-btn {
  background: #FFFFFF;
  border: 1px solid #D4DFEE;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  min-height: 36px;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.cb-pill-btn:hover { background: #EFF6FF; border-color: #1D6AE5; color: #1D6AE5; }

.cb-config-drawer {
  background: #F8FAFD;
  border: 1px solid #CBD5E1;
  border-left: 4px solid #2573BA;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
}
.cb-config-drawer[hidden] { display: none; }
.cb-config-drawer h4 {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--rge-navy);
  margin-bottom: 0.75rem;
}

.cb-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.2rem;
  border-top: 1px solid #EEF2F7;
  margin-top: 0.25rem;
}
.cb-toggle-row strong { display: block; font-size: 0.85rem; color: var(--text-main); }

.ios-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.ios-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}
.ios-switch input:checked + .ios-slider { background: #1D6AE5; }
.ios-switch input:checked + .ios-slider::before { transform: translateX(20px); }

.cb-history-section {
  margin-top: 0.55rem;
  padding-top: 0.8rem;
  border-top: 1px solid #EEF2F7;
}
.cb-history-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 0.5rem;
}
.cb-history-list { display: flex; flex-direction: column; gap: 0.2rem; }
.cb-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
}
.cb-history-row:hover { background: #F4F7FB; }
.cb-history-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.7rem; }
.cb-history-date { font-size: 0.83rem; font-weight: 600; color: var(--text-main); }
.cb-history-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-sub); }
.cb-restore-btn {
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1D6AE5;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}
.cb-restore-btn:hover { background: #E5F0FF; }
.cb-empty { font-size: 0.8rem; color: var(--text-sub); padding: 0.75rem 0.25rem; }

.settings-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}
.settings-tool-box {
  background: #F8FAFD;
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}
.settings-tool-box h4 { font-size: 0.9rem; font-weight: 700; color: var(--text-main); }
.settings-tool-box p { font-size: 0.78rem; color: var(--text-sub); line-height: 1.45; }

/* Pair Phone Modal */
.pair-modal-sm { max-width: 440px; }
.pair-modal-body { padding: 1.25rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pair-qr-stage {
  width: 204px; height: 204px; border-radius: 12px;
  border: 1px solid var(--border); background: #FFFFFF;
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
.pair-qr-fallback { font-size: 0.78rem; text-align: center; color: var(--text-sub); padding: 0.75rem; }
.pair-link-row { width: 100%; display: flex; gap: 0.45rem; }
.pair-link-row input {
  flex: 1; border: 1px solid var(--border-dark); border-radius: 5px;
  padding: 0.42rem 0.65rem; font-family: var(--font-mono); font-size: 0.74rem; background: #F8FAFD;
}

/* Main Content Area */
main.content-area {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
  max-width: 1550px;
  margin: 0 auto;
  width: 100%;
}

.tab-view {
  display: none;
  animation: fadeIn 0.18s ease-in-out forwards;
}
.tab-view.active-view {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Streamlined Metrics Bar (Soft Light Colors + 2x2 Mini-Square on Mobile) */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  background: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.metric-cell {
  padding: 1rem 1.2rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.metric-cell:last-child {
  border-right: none;
}

/* Soft Light Pastel Cell Tints */
.metric-cell:nth-child(1) {
  background: #F0F7FF;
}
.metric-cell:nth-child(1) .metric-title {
  color: #1E40AF;
}

.metric-cell:nth-child(2) {
  background: #F0FDF4;
}
.metric-cell:nth-child(2) .metric-title {
  color: #047857;
}

.metric-cell:nth-child(3) {
  background: #FFFBEB;
}
.metric-cell:nth-child(3) .metric-title {
  color: #B45309;
}

.metric-cell:nth-child(4) {
  background: #F5F3FF;
}
.metric-cell:nth-child(4) .metric-title {
  color: #5B21B6;
}

.metric-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  line-height: 1.25;
}

.metric-val {
  font-size: 1.38rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.22rem;
  line-height: 1.3;
}

/* Section Header Bar */
.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.section-title h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}
.section-title p {
  font-size: 0.78rem;
  color: var(--text-sub);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Input States & Styling */
.input-text, .select-input {
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
  outline: none;
  transition: all 0.15s ease;
}

.input-text:hover, .select-input:hover {
  border-color: var(--border-strong);
}

.input-text:focus, .select-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
}

.input-text:disabled, .select-input:disabled {
  background: #f1f5f9;
  color: var(--text-sub);
  cursor: not-allowed;
  border-color: var(--border);
}

/* Crisp Minimal Data Tables */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  background: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

table.data-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

table.data-grid th {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-dark);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
table.data-grid th:last-child {
  border-right: none;
}

table.data-grid td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}
table.data-grid td:last-child {
  border-right: none;
}

table.data-grid tr:last-child td {
  border-bottom: none;
}

table.data-grid tr:hover td {
  background: #fbfcfe;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Status Badges */
.badge-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border-dark);
  background: var(--bg-muted);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.badge-amber {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.badge-blue {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.badge-teal {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #99f6e4;
}

.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.badge-orange {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.badge-muted {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.badge-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* Header Notification Bell & Dropdown */
.notif-wrapper {
  position: relative;
}

.notif-btn {
  position: relative;
  padding: 0.35rem 0.55rem;
}

.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--accent-rose);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  max-width: 92vw;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  overflow: hidden;
  text-align: left;
}

.notif-dropdown.open {
  display: block;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.notif-quota {
  display: inline-block;
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-sub);
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.notif-list {
  max-height: 300px;
  overflow-y: auto;
}

.notif-empty {
  padding: 1.25rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.notif-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--border-dark);
  font-size: 0.76rem;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item.type-success { border-left-color: var(--accent-emerald); }
.notif-item.type-error { border-left-color: var(--accent-rose); background: #fffafa; }
.notif-item.type-warning { border-left-color: var(--accent-amber); }
.notif-item.type-info { border-left-color: var(--accent-blue); }

.notif-item-title {
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.notif-item-time {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
}

.notif-item-detail {
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

/* Batch Dispatch Progress Banner */
.batch-progress-bar {
  display: none;
  margin-bottom: 0.9rem;
  padding: 0.75rem 1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
}

.batch-progress-bar.active {
  display: block;
}

.batch-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.batch-progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.batch-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.batch-progress-fill.has-errors {
  background: var(--accent-amber);
}

.batch-progress-fill.is-done {
  background: var(--accent-emerald);
}

/* GAS Settings Connection Status */
.gas-status-box {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 5px;
  font-size: 0.76rem;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-muted);
  display: none;
}

.gas-status-box.show { display: block; }
.gas-status-box.status-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.gas-status-box.status-err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-main);
  cursor: pointer;
  margin-top: 0.45rem;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Stackable Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border-left: 4px solid #38bdf8;
  font-size: 0.78rem;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  animation: fadeIn 0.18s ease-out;
}

.toast-item.toast-success { border-left-color: #34d399; }
.toast-item.toast-error { border-left-color: #f87171; }
.toast-item.toast-warning { border-left-color: #fbbf24; }
.toast-item.toast-info { border-left-color: #38bdf8; }

.toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}

.toast-close:hover { color: #ffffff; }

.day-other-tag {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
  padding: 0 4px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #64748b;
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.show-modal {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  animation: modalPop 0.18s ease-out forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bg-muted);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-sub);
  line-height: 1;
}
.close-btn:hover {
  color: var(--text-main);
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group-full {
  grid-column: 1 / -1;
}

/* ==============================================
   CATEGORIZED EMPLOYEE RECORD MODAL (LIGHT PALETTE)
   ============================================== */
.modal-box-employee {
  max-width: 900px;
}

.emp-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
}

/* Top Profile Image Uploader */
.emp-photo-uploader {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
}

.emp-avatar-preview {
  width: 112px;
  height: 112px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #ffffff;
  border: 2px solid #bfdbfe;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(30, 64, 175, 0.1);
}

.emp-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.emp-avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  color: #1e40af;
  letter-spacing: 0.03em;
}

.emp-photo-meta {
  flex: 1;
  min-width: 0;
}

.emp-photo-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.emp-photo-hint {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-bottom: 0.55rem;
  line-height: 1.35;
}

.emp-photo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* Light-Color Categorized Cards */
.emp-cat-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.emp-cat-card .input-text,
.emp-cat-card .select-input {
  background-color: #ffffff;
}

.emp-cat-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.emp-cat-icon {
  font-size: 1.15rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.emp-cat-header h4 {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  margin-bottom: 0.1rem;
}

.emp-cat-header p {
  font-size: 0.73rem;
  color: var(--text-sub);
  line-height: 1.3;
}

/* Soft Light Tints per Category */
.emp-cat-card.cat-personal {
  background: #f0f7ff;
  border-color: #bfdbfe;
}
.emp-cat-card.cat-personal .emp-cat-header h4 { color: #1d4ed8; }

.emp-cat-card.cat-emergency {
  background: #fff5f5;
  border-color: #fecaca;
}
.emp-cat-card.cat-emergency .emp-cat-header h4 { color: #b91c1c; }

.emp-cat-card.cat-deployment {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.emp-cat-card.cat-deployment .emp-cat-header h4 { color: #5b21b6; }

.emp-cat-card.cat-payroll {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.emp-cat-card.cat-payroll .emp-cat-header h4 { color: #047857; }

.emp-cat-card.cat-statutory {
  background: #fffbeb;
  border-color: #fde68a;
}
.emp-cat-card.cat-statutory .emp-cat-header h4 { color: #b45309; }

.emp-cat-card.cat-contract {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.emp-cat-card.cat-contract .emp-cat-header h4 { color: #0369a1; }

/* Contract File Uploader inside Add/Edit Modal */
.emp-contract-uploader {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: #ffffff;
  border: 1.5px dashed #7dd3fc;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.emp-contract-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
}

.emp-contract-empty {
  font-size: 0.78rem;
  color: var(--text-sub);
}

.emp-contract-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 1.35rem;
}

.emp-contract-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.emp-contract-meta {
  min-width: 0;
  flex: 1;
}

.emp-contract-filename {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.emp-contract-sub {
  font-size: 0.72rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.emp-contract-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* Mini 2x2 Square Employee Avatars inside Roster Tables */
.emp-name-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.emp-mini-avatar {
  width: 38px;
  height: 38px;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.emp-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==============================================
   VIEW EMPLOYEE PROFILE MODAL (2x2 PHOTO VIEW)
   ============================================== */
.modal-box-profile {
  max-width: 880px;
}

.profile-hero-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-left: 4px solid var(--rge-navy);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* Authentic 2x2 ID Photo Frame */
.profile-photo-2x2 {
  width: 152px;
  height: 152px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  padding: 4px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.profile-photo-2x2 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.profile-photo-2x2 .profile-photo-fallback {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: #1e40af;
}

.profile-photo-2x2 .profile-photo-fallback strong {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}

.profile-photo-2x2 .profile-photo-fallback span {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3b82f6;
}

.profile-hero-info {
  flex: 1;
  min-width: 0;
}

.profile-hero-id {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 0.2rem;
}

.profile-hero-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--rge-navy);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.profile-hero-role {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.profile-hero-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.profile-hero-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 1rem;
}

.profile-kv-item {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 7px;
  padding: 0.55rem 0.75rem;
}

.profile-kv-item.kv-full {
  grid-column: 1 / -1;
}

.profile-kv-label {
  display: block;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-sub);
  margin-bottom: 0.16rem;
}

.profile-kv-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.profile-contract-box {
  background: #ffffff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.profile-contract-preview-img {
  margin-top: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  max-height: 280px;
  display: flex;
  justify-content: center;
}

.profile-contract-preview-img img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

/* ==============================================
   EMPLOYEE HEADCOUNT DASHBOARD (TOTAL ACTIVE + 8 MINI SQUARES)
   ============================================== */
.emp-headcount-dash {
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  align-items: stretch;
}

.emp-hc-hero {
  background: linear-gradient(135deg, #f0f7ff 0%, #e0eeff 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--rge-navy);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.emp-hc-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 44, 92, 0.1);
}

.emp-hc-hero-label {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rge-navy);
}

.emp-hc-hero-val {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--rge-navy);
  margin: 0.15rem 0 0.2rem;
}

.emp-hc-hero-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.3;
}

.emp-hc-mini-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.5rem;
}

.emp-hc-mini {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.55rem 0.35rem;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: center;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.emp-hc-mini:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.emp-hc-mini.is-selected {
  box-shadow: 0 0 0 2px var(--rge-navy);
  transform: translateY(-1px);
}

.hc-mini-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.hc-mini-lbl {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.15;
  word-break: break-word;
}

/* Soft Light Pastel Tints for the 8 Mini Squares */
.emp-hc-mini.hc-active       { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.emp-hc-mini.hc-regular      { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.emp-hc-mini.hc-probationary { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.emp-hc-mini.hc-contractual  { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.emp-hc-mini.hc-endo         { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.emp-hc-mini.hc-resigned     { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.emp-hc-mini.hc-suspended    { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.emp-hc-mini.hc-terminated   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* Profile Progress % Completion Column */
.emp-progress-cell {
  min-width: 112px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.emp-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.emp-progress-track {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.emp-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.emp-progress-fill.prog-low  { background: #ef4444; }
.emp-progress-fill.prog-mid  { background: #f59e0b; }
.emp-progress-fill.prog-good { background: #2563eb; }
.emp-progress-fill.prog-high { background: #10b981; }

.emp-progress-sub {
  font-size: 0.65rem;
  color: var(--text-sub);
  line-height: 1.15;
}

/* ==============================================
   USER ACCOUNTS & ROLE-BASED ACCESS UI
   ============================================== */
.role-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  white-space: nowrap;
}

.role-pill-badge.role-hr {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(110, 231, 183, 0.45);
}

.role-pill-badge.role-ops {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(253, 224, 71, 0.45);
}

.badge-ceo {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #93c5fd;
}

.badge-hr {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
}

.badge-ops {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}

.salary-masked {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  user-select: none;
}

.readonly-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.ua-role-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.ua-role-card {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.ua-role-card strong {
  font-size: 0.78rem;
  font-weight: 800;
}

.ua-role-card span {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ua-role-card.ua-role-ceo { background: #f0f7ff; border-color: #bfdbfe; }
.ua-role-card.ua-role-ceo strong { color: #1d4ed8; }

.ua-role-card.ua-role-hr { background: #f0fdf4; border-color: #bbf7d0; }
.ua-role-card.ua-role-hr strong { color: #047857; }

.ua-role-card.ua-role-ops { background: #fffbeb; border-color: #fde68a; }
.ua-role-card.ua-role-ops strong { color: #b45309; }

.ua-perm-box {
  border-radius: 8px;
  padding: 0.72rem 0.85rem;
  font-size: 0.76rem;
  line-height: 1.45;
  border: 1px solid #bfdbfe;
  background: #f0f7ff;
  color: #1e3a8a;
}

.ua-perm-box.perm-hr {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #065f46;
}

.ua-perm-box.perm-ops {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

/* Official Voucher Layout (Match Sample Print Format) */
.voucher-card {
  background: #ffffff;
  color: #000000;
  padding: 1.5rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11.5px;
  line-height: 1.35;
  max-width: 800px;
  margin: 0 auto;
}

.v-header {
  border-bottom: 2px solid #000;
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.v-grid-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2rem;
  row-gap: 2px;
  margin-bottom: 0.75rem;
  font-size: 11.5px;
}

.v-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted #e5e7eb;
  padding: 1.5px 0;
}

.v-rates-bar {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  padding: 4px 10px;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  font-size: 11px;
}

.v-table-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #000;
  margin-bottom: 0.75rem;
}

.v-col-header {
  background: #000;
  color: #fff;
  padding: 4px 8px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.v-line-item {
  display: flex;
  justify-content: space-between;
  padding: 2.5px 8px;
  font-size: 11px;
  border-bottom: 1px solid #f1f5f9;
}

.v-total-row {
  background: #f1f5f9;
  font-weight: 800;
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #000;
  margin-top: auto;
}

.v-net-banner {
  border: 2px solid #000;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 800;
}

.v-net-banner .val {
  font-size: 16px;
  font-family: var(--font-mono);
}

.v-leave-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  margin-bottom: 0.75rem;
  font-size: 11px;
  background: #fafafa;
}

.v-reminders {
  border-top: 1px dashed #9ca3af;
  padding-top: 0.5rem;
  font-size: 9.5px;
  color: #4b5563;
  line-height: 1.35;
}

/* Minimal Toast */
.toast-box {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1.15rem;
  border-radius: 6px;
  font-size: 0.8rem;
  display: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.2s ease-in-out;
}

/* DTR Sub-Tabs & Category Tables (Option A) */
.dtr-subtabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.dtr-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
}

.dtr-subtab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.42rem 0.78rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dtr-subtab-btn:hover {
  color: var(--text-main);
  background: #ffffff;
}

.dtr-subtab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.dtr-subtab-btn.is-earnings.active {
  background: #065f46;
  border-color: #065f46;
}

.dtr-subtab-btn.is-deductions.active {
  background: #991b1b;
  border-color: #991b1b;
}

.subtab-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
}

.pill-emerald {
  background: #ecfdf5;
  color: #065f46;
}

.pill-rose {
  background: #fef2f2;
  color: #b91c1c;
}

.dtr-subtab-btn.active .subtab-pill {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.dtr-bulk-dates {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dtr-subpanel {
  display: none;
  animation: fadeIn 0.15s ease-out;
}

.dtr-subpanel.active {
  display: block;
}

table.dtr-table-earnings th {
  background: #ecfdf5;
  color: #065f46;
  border-bottom-color: #a7f3d0;
}

table.dtr-table-deductions th {
  background: #fef2f2;
  color: #991b1b;
  border-bottom-color: #fecaca;
}

tr.row-net-warning td {
  background: #fff1f2 !important;
}

/* DTR & Attendance Calendar Day Picker */
.dtr-date-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dtr-present-btn:hover {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.dtr-absent-active {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}

.dtr-half-active {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #b45309 !important;
}

.att-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
  min-height: 48px;
}

.day-tile:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.day-tile .day-name {
  font-size: 0.62rem;
  color: var(--text-sub);
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 3px;
}

.day-tile .day-num {
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1;
}

.day-tile input[type="checkbox"] {
  display: none;
}

/* Category-specific checked styles */
.mode-present .day-tile.is-checked {
  background: #ecfdf5;
  border-color: #34d399;
  color: #065f46;
  box-shadow: inset 0 0 0 1px #059669;
}
.mode-present .day-tile.is-checked .day-name,
.mode-present .day-tile.is-checked .day-num {
  color: #065f46;
}

.mode-absent .day-tile.is-checked {
  background: #fef2f2;
  border-color: #f87171;
  color: #991b1b;
  box-shadow: inset 0 0 0 1px #dc2626;
}
.mode-absent .day-tile.is-checked .day-name,
.mode-absent .day-tile.is-checked .day-num {
  color: #991b1b;
}

.mode-halfDay .day-tile.is-checked {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
  box-shadow: inset 0 0 0 1px #d97706;
}
.mode-halfDay .day-tile.is-checked .day-name,
.mode-halfDay .day-tile.is-checked .day-num {
  color: #92400e;
}

.day-tile.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #f1f5f9;
}

/* Mobile PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  max-width: 460px;
  margin-inline: auto;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-left: 4px solid var(--rge-navy);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: fadeIn 0.2s ease-out;
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.pwa-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
  background: #ffffff;
  flex-shrink: 0;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pwa-banner-text strong {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.pwa-banner-text span {
  font-size: 0.73rem;
  color: var(--text-sub);
  line-height: 1.3;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* ==============================================
   RESPONSIVE LAYOUT BREAKPOINTS (MOBILE-TUNED)
   ============================================== */
@media (max-width: 1024px) {
  header.top-header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }
  .metrics-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .emp-headcount-dash {
    grid-template-columns: 1fr;
  }
  .emp-hc-mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .metric-cell:nth-child(2) {
    border-right: none;
  }
  .metric-cell:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  main.content-area {
    padding: 1rem 1rem 2.25rem;
  }
}

@media (max-width: 900px) {
  .sidebar-mobile-trigger {
    display: inline-flex;
  }

  .app-shell {
    flex-direction: column;
  }

  /* Slide-out left navigation drawer on mobile & tablet */
  .left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 275px;
    max-width: 82vw;
    height: 100dvh;
    z-index: 120;
    background: #ffffff;
    border-right: 1px solid var(--border-dark);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.28);
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.85rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    transform: translateX(-108%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .left-sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-mobile-head {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-label {
    display: block;
    padding-bottom: 0;
    font-size: 0.74rem;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .left-sidebar .sidebar-nav {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .left-sidebar .tab-btn {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }

  .sidebar-divider {
    display: block;
    margin: 0.5rem 0.2rem;
  }
}

@media (max-width: 768px) {
  /* Prevent iOS Safari input auto-zoom & ensure comfortable touch ergonomics */
  input, select, textarea,
  .input-text, .select-input {
    font-size: 16px;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }

  .btn, .cmd-btn, .dtr-subtab-btn, .cb-pill-btn {
    min-height: 44px;
    font-size: 0.84rem;
    padding: 0.5rem 0.88rem;
  }

  .btn-sm {
    min-height: 38px;
    font-size: 0.78rem;
    padding: 0.42rem 0.72rem;
  }

  .command-inner {
    flex-wrap: nowrap;
    padding: 0.6rem 0.85rem;
    gap: 0.55rem;
  }

  .command-title-group {
    flex: 1;
    min-width: 0;
    gap: 0.6rem;
  }

  .rge-signal-dots {
    display: none;
  }

  .command-actions {
    width: auto;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 0.4rem;
  }

  .command-actions .cmd-btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0.42rem 0.68rem;
    font-size: 0.76rem;
  }

  .command-actions .notif-wrapper {
    flex: 0 0 auto;
  }

  .command-actions .notif-btn {
    min-width: 42px;
    padding: 0.42rem 0.6rem;
  }

  main.content-area {
    padding: 0.95rem 0.9rem 2.5rem;
  }

  .section-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    margin-bottom: 0.95rem;
  }

  .section-title h2 {
    font-size: clamp(1rem, 0.9rem + 0.8vw, 1.15rem);
  }

  .section-title p {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .controls-row {
    width: 100%;
    gap: 0.5rem;
  }

  .controls-row .btn {
    flex: 1 1 auto;
  }

  .metric-cell {
    padding: 0.9rem 1rem;
  }

  .metric-val {
    font-size: clamp(1.15rem, 1rem + 1.2vw, 1.38rem);
  }

  .dtr-subtabs-bar {
    gap: 0.6rem;
    margin-bottom: 0.9rem;
  }

  .dtr-subtabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .dtr-subtab-btn {
    flex-shrink: 0;
  }

  table.data-grid th,
  table.data-grid td {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Compact inline inputs inside tables stay readable without bloating rows */
  table.data-grid .input-text {
    min-height: 38px;
    padding: 0.35rem 0.5rem;
  }

  .tabs-bar {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs-bar::-webkit-scrollbar {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .v-grid-info, .v-table-split, .v-leave-grid {
    grid-template-columns: 1fr;
  }
  .v-table-split div:last-child {
    border-left: none !important;
    border-top: 1px solid #000;
  }
  .v-rates-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .att-days-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal-backdrop {
    padding: 0.65rem;
  }

  .modal-box {
    max-height: 92dvh;
    border-radius: 8px;
  }

  .modal-header {
    padding: 0.85rem 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1 1 120px;
  }

  .toast-container {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

@media (max-width: 640px) {
  /* 2x2 Mini-Square Grid (One Square containing 4 Mini Squares) */
  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 12px;
    margin-bottom: 1.15rem;
  }

  .metric-cell {
    min-height: 108px;
    padding: 0.78rem 0.72rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .metric-cell:nth-child(2n) {
    border-right: none;
  }

  .metric-cell:nth-child(n+3) {
    border-bottom: none;
  }

  .metric-title {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.22rem;
  }

  .metric-val {
    font-size: clamp(0.95rem, 0.72rem + 2.1vw, 1.22rem) !important;
    line-height: 1.2;
  }

  .metric-sub {
    font-size: 0.67rem;
    margin-top: 0.2rem;
  }

  .controls-row .input-text,
  .controls-row .select-input {
    width: 100% !important;
    flex: 1 1 100%;
  }

  .cb-action-card {
    flex-direction: column;
    align-items: stretch;
  }

  .cb-pill-btn {
    width: 100%;
    text-align: center;
  }

  .emp-photo-uploader {
    flex-direction: column;
    text-align: center;
    padding: 0.9rem;
  }

  .emp-photo-actions {
    justify-content: center;
  }

  .emp-cat-card {
    padding: 0.85rem 0.9rem 1rem;
  }

  .profile-hero-card {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .profile-hero-badges,
  .profile-hero-contacts {
    justify-content: center;
  }

  .profile-kv-grid {
    grid-template-columns: 1fr;
  }

  .emp-headcount-dash {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .emp-hc-hero {
    padding: 0.75rem 0.9rem;
  }

  .emp-hc-hero-val {
    font-size: 1.55rem;
  }

  .emp-hc-mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.42rem;
  }

  .emp-hc-mini {
    min-height: 62px;
    padding: 0.45rem 0.2rem;
  }

  .hc-mini-val {
    font-size: 1.05rem;
  }

  .hc-mini-lbl {
    font-size: 0.56rem;
  }

  .ua-role-guide {
    grid-template-columns: 1fr;
  }

  .role-pill-badge {
    font-size: 0.66rem;
    padding: 0.24rem 0.52rem;
  }
}

@media (max-width: 480px) {
  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-cell {
    min-height: 102px;
    padding: 0.72rem 0.65rem;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .notif-dropdown {
    position: fixed;
    top: 72px;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
  }
  .pwa-install-banner {
    flex-wrap: wrap;
  }
  .pwa-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .pwa-banner-actions .btn {
    flex: 1;
  }
}

/* ==============================================
   MOBILE BOTTOM NAVIGATION (6 MINI ICON SQUARES)
   ============================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.25rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-dark);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.1);
    padding: 0.42rem 0.35rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }

  .mob-nav-item {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.15rem 0.1rem;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    cursor: pointer;
    color: var(--text-sub);
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, transform 0.12s ease;
  }

  .mob-nav-item:active {
    transform: scale(0.94);
  }

  .mob-nav-square {
    width: 34px;
    height: 34px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  }

  .mob-nav-label {
    font-size: 0.59rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mob-nav-item.active {
    color: var(--rge-navy);
  }

  .mob-nav-item.active .mob-nav-square {
    background: var(--rge-navy);
    border-color: var(--rge-navy);
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(20, 42, 84, 0.28);
  }

  /* Leave breathing room above fixed mobile bottom nav */
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }

  .pwa-install-banner {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .toast-container {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
}

/* ==============================================
   CLEAN OFFICIAL PRINT STYLES (NO UI BUTTONS)
   ============================================== */
@media print {
  /* Hide all interactive elements, browser chrome, headers, and modals */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  body * {
    visibility: hidden !important;
  }

  .no-print, header.top-header, .corporate-header, .corporate-footer, .left-sidebar, .sidebar-backdrop, .mobile-bottom-nav, .tabs-bar, .header-actions,
  .section-bar, .modal-backdrop, .modal-header, .modal-footer,
  .toast-box, .toast-container, .notif-dropdown, .batch-progress-bar, .pwa-install-banner,
  .btn, .controls-row {
    display: none !important;
    visibility: hidden !important;
  }

  /* Make printable payslip area 100% visible and centered */
  .printable-area, 
  .printable-area * {
    visibility: visible !important;
  }

  .printable-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0.5in !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .voucher-card {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    page-break-inside: avoid !important;
  }

  @page {
    size: letter portrait;
    margin: 0.4in;
  }
}
