/* =====================================================
   ZenoHR Design System - shared.css
   Based on docs/design/design-tokens.md
   Nixtio-inspired aesthetic, ZenoHR brand
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===================================================
   Design Tokens - Light Mode
   =================================================== */
:root {
  /* Brand */
  --brand-primary: #2e1d16;
  --brand-primary-hover: #241611;
  --brand-primary-active: #1b100c;
  --brand-primary-subtle: #efe7e1;
  --brand-accent: #D4AF37;
  --brand-accent-hover: #C49B28;
  --brand-accent-subtle: #fdf7e3;
  --brand-gold: #D4AF37;
  --brand-gold-hover: #C49B28;
  --brand-gold-subtle: rgba(212, 175, 55, 0.1);

  /* Semantic */
  --success: #16a34a;
  --success-subtle: #dcfce7;
  --danger: #dc2626;
  --danger-subtle: #fef2f2;
  --warning: #d97706;
  --warning-subtle: #fffbeb;
  --info: #2563eb;
  --info-subtle: #eff6ff;
  --maternity: #9b59b6;
  --maternity-subtle: rgba(155, 89, 182, 0.12);

  /* Surfaces */
  --bg-page: #faf7f4;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f6f0eb;
  --bg-sidebar: #2e1d16;
  --bg-sidebar-hover: #3b2820;
  --bg-sidebar-active: #5d473e;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-input-disabled: #f1eae4;
  --bg-table-header: #f5eee8;
  --bg-table-stripe: #fcf8f5;

  /* Borders */
  --border-default: #ddd3cb;
  --border-subtle: #eee6e0;
  --border-strong: #baa798;
  --border-focus: #5d473e;
  --border-error: #dc2626;

  /* Text */
  --text-primary: #2e1d16;
  --text-secondary: #5d473e;
  --text-muted: #8a684f;
  --text-on-primary: #ffffff;
  --text-on-accent: #ffffff;
  --text-on-sidebar: #d8cbc2;
  --text-on-sidebar-active: #ffffff;
  --text-link: #5d473e;
  --text-link-hover: #2e1d16;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(93, 71, 62, 0.22);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --header-height: 64px;
  --content-padding: 28px;
  --card-gap: 20px;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Motion */
  --transition-fast: 100ms ease;
  --transition-default: 150ms ease;
  --transition-slow: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================
   Dark Mode Overrides
   =================================================== */
[data-theme="dark"] {
  --bg-page: #18100c;
  --bg-surface: #221712;
  --bg-surface-hover: #2a1d17;
  --bg-sidebar: #120b08;
  --bg-sidebar-hover: #221712;
  --bg-sidebar-active: #5d473e;
  --bg-elevated: #271b15;
  --bg-input: #2a1d17;
  --bg-input-disabled: #1a110d;
  --bg-table-header: #2a1d17;
  --bg-table-stripe: #1d140f;

  --border-default: #3a2a22;
  --border-subtle: #2d201a;
  --border-strong: #5d473e;

  --text-primary: #f7f3ef;
  --text-secondary: #cfbfb4;
  --text-muted: #9d877a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 10px 15px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);

  --brand-primary-subtle: #3a2a22;
  --success-subtle: #052e16;
  --danger-subtle: #450a0a;
  --warning-subtle: #422006;
  --info-subtle: #152838;
  --maternity: #a87cc4;
  --maternity-subtle: rgba(168, 124, 196, 0.12);
}

/* ===================================================
   Reset
   =================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.5;
  transition: background var(--transition-slow), color var(--transition-slow);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font-primary);
}

img {
  max-width: 100%;
  display: block;
}

/* ===================================================
   App Shell
   =================================================== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===================================================
   App Layout (page-level aliases)
   =================================================== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Main content area - offset by sidebar width */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
  min-width: 0;
}

/* Sidebar collapsed: shrink content offset */
.sidebar.collapsed+.main-content,
.sidebar.collapsed+.main-wrapper {
  margin-left: var(--sidebar-collapsed);
}

/* Floating pill topbar */
.topbar {
  margin: 12px 20px 0;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: var(--space-5);
  flex-shrink: 0;
}

[data-theme="dark"] .topbar {
  background: rgba(17, 24, 39, 0.88);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Page identity inside pill: compact scale-down */
.topbar .page-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0;
  line-height: 1.25;
  color: var(--text-primary);
}

.topbar .page-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.2;
}

/* Left slot: hamburger + title block */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Right slot: actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Search pill inside topbar */
.topbar .header-search {
  flex: 1;
  max-width: 340px;
  margin: 0;
}

.topbar .header-search input {
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  padding: 0 16px 0 38px;
  font-size: 13px;
  width: 100%;
  transition: all var(--transition-default);
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
}

.topbar .header-search input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.topbar .header-search input::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .topbar .header-search input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .topbar .header-search input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand-primary);
}

/* Scrollable page body below topbar */
.content-body {
  padding: 16px var(--content-padding) var(--content-padding);
  flex: 1;
}

/* Sidebar header row (logo + collapse btn) */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 16px;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .sidebar-logo {
  /* Keep icon visible - logo image scales via height constraint */
  opacity: 1;
}

/* Collapse toggle button (inside sidebar header) */
.sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: all var(--transition-default);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

/* Drawer overlay for mobile */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
}

.drawer-overlay.visible {
  display: block;
}

/* ===================================================
   Sidebar
   =================================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow);
  z-index: 200;
  overflow: hidden;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* NavMenu wrapper - must fill the sidebar and be a flex column so
   .sidebar-nav (flex:1, overflow-y:auto) can scroll independently. */
.sidebar-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Logo area */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar-logo-text em {
  color: var(--brand-accent);
  font-style: normal;
}

.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  pointer-events: none;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-full);
}

.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
}

.nav-section {
  margin-bottom: var(--space-2);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.45);
  padding: var(--space-3) var(--space-3) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--text-on-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-default);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 1px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: white;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand-accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  opacity: 1;
}

.nav-label {
  flex: 1;
  transition: opacity var(--transition-slow), width var(--transition-slow);
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.nav-badge {
  background: var(--brand-accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .nav-badge {
  opacity: 0;
}

/* Sidebar footer - profile card */
.sidebar-footer {
  padding: 10px 12px 14px;
  flex-shrink: 0;
}

.sidebar-profile-card {
  border-radius: 18px;
  overflow: hidden;
  transition: transform var(--transition-default), box-shadow var(--transition-default);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sidebar-profile-label {
  padding: 9px 13px 11px;
  background: #d8cbc2;
}

.sidebar-profile-card-generic {
  cursor: default;
}

.sidebar-profile-label-generic {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-profile-card-admin {
  background: var(--brand-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-profile-label-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: transparent;
}

.sidebar-admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.sidebar-profile-meta {
  min-width: 0;
}

.sidebar-profile-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-role {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  white-space: nowrap;
}

.sidebar-profile-card-admin .sidebar-profile-name {
  color: #f1f5f9;
  font-size: 13px;
}

.sidebar-profile-card-admin .sidebar-profile-role {
  color: #94a3b8;
}

.sidebar.collapsed .sidebar-profile-card {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sidebar.collapsed .sidebar-profile-label-generic,
.sidebar.collapsed .sidebar-profile-label-admin {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.sidebar.collapsed .sidebar-profile-meta {
  display: none;
}

.sidebar.collapsed .sidebar-admin-avatar {
  width: 40px;
  height: 40px;
}

.sidebar-signout-btn {
  width: 100%;
  margin-top: var(--space-2);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-primary);
  color: var(--text-on-sidebar);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-default);
}

.sidebar-signout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-on-sidebar-active);
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.user-role {
  font-size: 11px;
  color: var(--text-on-sidebar);
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Legacy fixed-position toggle - removed in favour of in-header toggle */

/* ===================================================
   Main Wrapper / Content
   =================================================== */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

/* ===================================================
   Top Header
   =================================================== */
.top-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 var(--content-padding);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.header-sep {
  width: 1px;
  height: 20px;
  background: var(--border-default);
}

.header-crumb {
  font-size: 13px;
  color: var(--text-secondary);
}

.header-search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 36px;
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 0 var(--space-4) 0 36px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  outline: none;
  transition: all var(--transition-default);
}

.header-search input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-focus);
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-default);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--brand-accent);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--bg-surface);
}

/* ===================================================
   Page Content
   =================================================== */
.page-content {
  padding: var(--content-padding);
  flex: 1;
}

.page-header {
  margin-bottom: var(--space-6);
}

.page-greeting {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  line-height: 1.15;
}

.page-greeting span {
  color: var(--brand-primary);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===================================================
   Cards
   =================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

.card-sm {
  padding: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.card-action {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-primary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-action:hover {
  background: var(--brand-primary-subtle);
}

/* Dark card variant */
.card-dark {
  background: var(--bg-sidebar);
  border-color: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .card-dark {
  background: #120b08;
  border-color: rgba(255, 255, 255, 0.06);
}

/* Accent glass card */
.card-glass {
  background: rgba(212, 175, 55, 0.05);
  border-color: rgba(212, 175, 55, 0.15);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .card-glass {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.18);
}

/* ===================================================
   KPI Card
   =================================================== */
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1.5px;
}

.kpi-value.xl {
  font-size: 36px;
}

.kpi-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-secondary);
}

.trend-up {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--success);
  font-weight: 600;
  font-size: 12px;
}

.trend-down {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--danger);
  font-weight: 600;
  font-size: 12px;
}

/* ===================================================
   Badges
   =================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.8;
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-subtle);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge-info {
  background: var(--info-subtle);
  color: var(--info);
}

.badge-accent {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
}

.badge-primary {
  background: var(--brand-primary-subtle);
  color: var(--brand-primary);
}

.badge-muted {
  background: var(--bg-page);
  color: var(--text-secondary);
}

.badge-dark {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

/* No dot variant */
.badge-nodot::before {
  display: none;
}

/* ===================================================
   Chips (filter)
   =================================================== */
.chip-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-default);
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.chip.active {
  background: var(--brand-primary-subtle);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 600;
}

/* ===================================================
   Buttons
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-default);
  font-family: var(--font-primary);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.1px;
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(46, 29, 22, 0.2);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 4px 12px rgba(46, 29, 22, 0.28);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--brand-accent);
  color: white;
  box-shadow: 0 1px 3px rgba(212, 137, 14, 0.2);
}

.btn-accent:hover {
  background: var(--brand-accent-hover);
  box-shadow: 0 4px 12px rgba(212, 137, 14, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border-default);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-lg {
  padding: 11px 24px;
  font-size: 14px;
  border-radius: var(--radius-lg);
}

/* ===================================================
   Tables
   =================================================== */
.table-wrapper {
  overflow-x: auto;
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrapper thead th {
  background: var(--bg-table-header);
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.table-wrapper tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.table-wrapper tbody tr:hover {
  background: var(--bg-surface-hover);
}

.table-wrapper tbody tr.selected {
  background: var(--brand-primary-subtle);
}

.table-wrapper tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.td-muted {
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* ===================================================
   Avatar
   =================================================== */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.avatar-lg {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

/*
  Avatar colour palette - 8 solid colours, always white text.
  Assignment is deterministic: based on the first letter of the initials.
  A-C → av-1  D-F → av-2  G-I → av-3  J-L → av-4
  M-O → av-5  P-R → av-6  S-U → av-7  V-Z → av-8

  JS utility (use in Blazor components):
    function avatarClass(name) {
      const letter = (name || '?')[0].toUpperCase();
      const idx = Math.min(Math.floor((letter.charCodeAt(0) - 65) / 3), 7);
      return 'av-' + (idx + 1);
    }
*/
.av-1 {
  background: var(--brand-primary);
  color: #fff;
}

/* A B C - ZenoHR blue   */
.av-2 {
  background: #0e7c3a;
  color: #fff;
}

/* D E F - forest green  */
.av-3 {
  background: #b45309;
  color: #fff;
}

/* G H I - burnt amber   */
.av-4 {
  background: #6d28d9;
  color: #fff;
}

/* J K L - violet        */
.av-5 {
  background: #b91c1c;
  color: #fff;
}

/* M N O - crimson       */
.av-6 {
  background: #0369a1;
  color: #fff;
}

/* P Q R - sky blue      */
.av-7 {
  background: #be185d;
  color: #fff;
}

/* S T U - rose          */
.av-8 {
  background: #0f766e;
  color: #fff;
}

/* V W X Y Z - teal      */

/* Dark mode: slightly lighter so they still pop against dark surfaces */
[data-theme="dark"] .av-1 {
  background: #2a6baa;
}

[data-theme="dark"] .av-2 {
  background: #15a050;
}

[data-theme="dark"] .av-3 {
  background: #d97706;
}

[data-theme="dark"] .av-4 {
  background: #7c3aed;
}

[data-theme="dark"] .av-5 {
  background: #dc2626;
}

[data-theme="dark"] .av-6 {
  background: #0284c7;
}

[data-theme="dark"] .av-7 {
  background: #db2777;
}

[data-theme="dark"] .av-8 {
  background: #0d9488;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-surface);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ===================================================
   Form inputs
   =================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  height: 40px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  outline: none;
  transition: all var(--transition-default);
  width: 100%;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  height: 40px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  padding-right: 30px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  outline: none;
  transition: all var(--transition-default);
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

/* ===================================================
   Progress Bar
   =================================================== */
.progress {
  height: 5px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-md {
  height: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-accent);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.primary {
  background: var(--brand-primary);
}

.progress-fill.success {
  background: var(--success);
}

.progress-fill.danger {
  background: var(--danger);
}

.progress-fill.dual {
  background: linear-gradient(90deg, var(--brand-accent) 0%, var(--brand-primary) 100%);
}

/* ===================================================
   Ring Progress (SVG)
   =================================================== */
.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ring-wrap svg {
  transform: rotate(-90deg);
}

.ring-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ring-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.ring-sub {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===================================================
   Deadline / timeline items
   =================================================== */
.deadline-list {
  display: flex;
  flex-direction: column;
}

.deadline-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.deadline-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

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

.deadline-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

.deadline-date {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ===================================================
   Activity row
   =================================================== */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 2px;
}

/* ===================================================
   Section divider
   =================================================== */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-6) 0;
}

/* ===================================================
   Grid & Flex utilities
   =================================================== */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-60-40 {
  grid-template-columns: 3fr 2fr;
}

.grid-cols-40-60 {
  grid-template-columns: 2fr 3fr;
}

.gap-4 {
  gap: var(--card-gap);
}

.gap-5 {
  gap: var(--space-5);
}

.gap-6 {
  gap: var(--space-6);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.min-w-0 {
  min-width: 0;
}

/* ===================================================
   Spacing utilities
   =================================================== */
.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.ml-auto {
  margin-left: auto;
}

/* ===================================================
   Text utilities
   =================================================== */
.text-xs {
  font-size: 11px;
}

.text-sm {
  font-size: 12px;
}

.text-base {
  font-size: 14px;
}

.text-lg {
  font-size: 16px;
}

.text-xl {
  font-size: 18px;
}

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

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-primary {
  color: var(--text-primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-accent {
  color: var(--brand-accent) !important;
}

.text-brand {
  color: var(--brand-primary) !important;
}

.text-white {
  color: white !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================================================
   Theme toggle button
   =================================================== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1.5px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-default);
}

.theme-toggle:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

/* ===================================================
   Employee row / person item
   =================================================== */
.person-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.person-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 1280px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .nav-label,
  .sidebar .sidebar-logo-text,
  .sidebar .user-info,
  .sidebar .nav-section-label {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar .nav-item.active::before {
    left: -1px;
  }

  /* Both .main-wrapper (shared.css shell) and .main-content (page alias) */
  .main-wrapper,
  .main-content {
    margin-left: var(--sidebar-collapsed);
  }

  /* Collapsed sidebar + main-content still uses collapsed width */
  .sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed);
  }

  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    transition: transform var(--transition-slow);
  }

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

  .main-wrapper,
  .main-content {
    margin-left: 0;
  }

  /* Override collapsed sibling rule on mobile */
  .sidebar.collapsed+.main-content {
    margin-left: 0;
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-60-40,
  .grid-cols-40-60 {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle {
    display: none;
  }
}

@media (max-width: 768px) {

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: var(--space-4);
  }

  .top-header {
    padding: 0 var(--space-4);
  }

  .header-search {
    display: none;
  }
}

/* ===================================================
   Mobile ≤ 640px - Touch-first, phone layout
   =================================================== */
@media (max-width: 640px) {

  /* Touch target enforcement */
  .btn,
  .icon-btn,
  .chip,
  .nav-item {
    min-height: 44px;
  }

  .btn {
    padding: 10px 16px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  /* Prevent iOS auto-zoom on focus */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Typography scaling */
  .page-greeting {
    font-size: clamp(22px, 5vw, 30px);
  }

  .page-title {
    font-size: 18px;
  }

  .page-subtitle {
    font-size: 12.5px;
  }

  .kpi-value {
    font-size: clamp(22px, 5vw, 30px);
  }

  .kpi-value.xl {
    font-size: clamp(24px, 6vw, 36px);
  }

  /* Compact spacing - 80px bottom clears the 64px bottom-nav + safe-area */
  .content-body {
    padding: 12px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .page-content {
    padding: 16px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .card-header {
    margin-bottom: var(--space-3);
  }

  /* Topbar - compact on mobile */
  .topbar {
    margin: 8px 12px 0;
    padding: 0 14px;
    height: 52px;
    border-radius: 12px;
  }

  .topbar .page-title {
    font-size: 13px;
  }

  .topbar .page-subtitle {
    display: none;
  }

  /* Sidebar - completely hidden on mobile (replaced by bottom nav) */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    transition: transform var(--transition-slow);
  }

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

  .main-wrapper,
  .main-content {
    margin-left: 0;
  }

  .sidebar.collapsed+.main-content {
    margin-left: 0;
  }

  /* KPI cards compact */
  .kpi-icon {
    width: 24px;
    height: 24px;
  }

  .kpi-label {
    font-size: 10.5px;
  }

  /* Badge compact */
  .badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  /* REQ-OPS-003: .btn-sm touch target enforcement - 44px minimum */
  .btn-sm {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }

  /* ── truth-table mobile card transformation (M1/M2) ─────────── */
  .truth-table thead { display: none; }
  .truth-table tbody tr {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg, 14px);
    margin-bottom: 8px;
    background: var(--surface-card, var(--bg-card));
  }
  .truth-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    border-bottom: none;
    font-size: 13px;
  }
  .truth-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-right: 12px;
  }
  .truth-table td:not([data-label])::before { display: none; }
  .truth-table td .btn,
  .truth-table td .icon-btn {
    min-height: 44px;
  }

  /* ── truth-table form grid responsive ───────────────────────── */
  .truth-form-grid {
    grid-template-columns: 1fr;
  }

  /* ── table-clean mobile stacking (Profile page) ─────────────── */
  .table-clean tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
  }
  .table-clean td:first-child {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
  }
}

/* Table → Card responsive: canonical system is .responsive-table in responsive-tables.css */

/* ===================================================
   Mobile Bottom-Sheet Modal (≤ 640px)
   =================================================== */
@media (max-width: 640px) {

  .modal-overlay .modal-box,
  .bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .modal-overlay .modal-box::before,
  .bottom-sheet::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-strong);
    border-radius: var(--radius-full);
    margin: 0 auto 16px;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  /* Prevent body scroll when modal is open */
  body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}

/* ===================================================
   Scrollbar styling
   =================================================== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===================================================
   Bottom Navigation Bar (shared - visible ≤ 640px)
   =================================================== */
.bottom-nav {
  display: none;
  /* hidden by default - shown at ≤640px */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  z-index: 300;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .bottom-nav {
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.28);
}

@media (max-width: 640px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-default);
  text-decoration: none;
  padding: 6px 4px;
  border: none;
  background: none;
  font-family: var(--font-primary);
  position: relative;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover {
  color: var(--brand-primary);
}

.bottom-nav-item.active {
  color: var(--brand-primary);
  font-weight: 700;
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--brand-accent);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.bottom-nav-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.bottom-nav-label {
  font-size: 10px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  max-width: 4.5rem;
}

/* Clock-In accent item (employee nav) */
.clock-in-nav {
  color: var(--bg-surface);
  background: var(--brand-primary);
  border-radius: 18px;
  margin: 8px 6px;
  flex: 1.2;
  padding: 6px 4px;
  box-shadow: 0 2px 8px rgba(46, 29, 22, 0.28);
}

.clock-in-nav:hover {
  background: var(--brand-primary-hover);
  color: white;
}

.clock-in-nav.active {
  background: var(--brand-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.35);
}

.clock-in-nav .bottom-nav-icon,
.clock-in-nav.active .bottom-nav-icon {
  width: 24px;
  height: 24px;
  color: white;
}

.bottom-nav-signout-form {
  margin: 0;
  padding: 0;
}

/* Mobile sign-out button in bottom nav */
.bottom-nav-logout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font-primary);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  width: 100%;
  height: 100%;
}

.bottom-nav-logout-btn:hover {
  color: var(--danger);
}

/* ===================================================
   Admin "More" Bottom Sheet
   =================================================== */
.admin-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 350;
}

.admin-more-overlay.visible {
  display: block;
}

.admin-more-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: 351;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-more-sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

.admin-more-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.admin-more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-default);
  transition: all var(--transition-default);
}

.admin-more-item:hover {
  background: var(--brand-primary-subtle);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.admin-more-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

[data-theme="dark"] .admin-more-sheet {
  background: var(--bg-elevated);
}

/* ===================================================
   Toast Notifications
   =================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: none;
  animation: toast-slide-in 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .toast-item {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--info); }

.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-text {
  flex: 1;
  line-height: 1.4;
}

.toast-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
  pointer-events: auto;
}

.toast-dismiss:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(20px) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

@media (max-width: 480px) {
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 80px;
    max-width: none;
  }
}
