:root {
  --bg: #F4F8F5;
  --surface: #FFFFFF;
  --surface-subtle: #F8FBF9;
  --ink: #01442D;
  --ink-soft: #23543A;
  --ink-muted: #537D68;
  --line: #D9E8DE;
  --line-strong: #BDD6C6;
  --accent: #14A841;
  --accent-light: #EDFAF1;
  --accent-hover: #0E8F35;
  --accent-ink: #FFFFFF;
  --primary-blue: #4F52B2; /* Teams signature purple/blue */
  --primary-blue-light: #EEF0FB;
  --danger: #D83B01;
  --danger-light: #FDE7E9;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #0078D4;
  --info-light: #EFF6FC;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px -2px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 28px -4px rgba(0,0,0,0.12);
  --font-sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

[data-theme="dark"] {
  --bg: #03140C;
  --surface: #072215;
  --surface-subtle: #0C2E1D;
  --ink: #F0FDF4;
  --ink-soft: #A3CFB8;
  --ink-muted: #6E9B83;
  --line: #16402A;
  --line-strong: #235A3D;
  --accent: #14A841;
  --accent-light: #072813;
  --accent-hover: #18C44E;
  --accent-ink: #FFFFFF;
  --primary-blue: #7075F4;
  --primary-blue-light: #1A1D36;
  --danger: #FF5A52;
  --danger-light: #2A1010;
  --warning: #FBBF24;
  --warning-light: #2D2305;
  --info: #2899F5;
  --info-light: #0A2239;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 14px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 28px -4px rgba(0,0,0,0.6);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* App Header & Top Navigation */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #01442D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
}

.tag-free {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.teams-m365-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.mode-switcher {
  display: flex;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: var(--radius-full);
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 400;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 160ms ease;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cross-Sell Ecosystem Banner */
.ecosystem-bar {
  background: linear-gradient(90deg, #0f2b18 0%, #143520 100%);
  color: #D1FAE5;
  font-size: 0.82rem;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ecosystem-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ecosystem-link {
  color: #FFF;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
  transition: opacity 140ms ease;
}

.ecosystem-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.ecosystem-tag {
  background: rgba(255,255,255,0.15);
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 400;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Main Workspace Layout */
.app-container {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 24px 60px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Controls Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-subtle);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 20px;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--ink);
  font-family: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* Region Selector Pills */
.region-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.region-tab {
  padding: 6px 4px;
  font-size: 0.75rem;
  font-weight: 400;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: all 140ms ease;
}

.region-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Tab Headers */
.sub-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.sub-tab {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-soft);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 400;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 140ms ease;
  border: 1px solid transparent;
  font-family: inherit;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-teams {
  background: var(--primary-blue);
  color: #FFF;
}

.btn-teams:hover {
  background: #404399;
}

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

.btn-block {
  width: 100%;
}

/* Bulk Upload Dropzone */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: all 140ms ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone-icon {
  color: var(--accent);
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink);
}

.dropzone-sub {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Employee Quick Selector in Bulk Mode */
.employee-roster {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.roster-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.8rem;
}

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

.roster-item:hover, .roster-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 400;
}

/* Live Payslip Preview Card (Right Column) */
.preview-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* THE ACTUAL PAYSLIP DOCUMENT */
.payslip-sheet {
  background: #FFFFFF;
  color: #1A1A1A;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  font-family: var(--font-sans);
}

/* Document Header */
.ps-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #111827;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.ps-company {
  display: flex;
  gap: 14px;
  align-items: center;
}

.ps-logo-wrap,
.ps-logo {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.ps-company-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.logo-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  overflow: hidden;
  flex: none;
}

.ps-company-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
}

.ps-company-info p {
  font-size: 0.78rem;
  color: #4B5563;
  line-height: 1.35;
}

.ps-title-block {
  text-align: right;
}

.ps-title-block h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.ps-period-tag {
  display: inline-block;
  background: #F3F4F6;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  color: #374151;
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* Employee Details Grid */
.ps-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .ps-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.ps-meta-item small {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6B7280;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.ps-meta-item b {
  display: block;
  font-size: 0.84rem;
  color: #111827;
  margin-top: 2px;
}

/* Pay Tables (Earnings & Deductions) */
.ps-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .ps-breakdown-grid {
    grid-template-columns: 1fr;
  }
}

.ps-table-card {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
}

.ps-table-head {
  background: #F3F4F6;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 400;
  color: #111827;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #E5E7EB;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ps-table-body {
  padding: 8px 0;
}

.ps-table-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: #374151;
}

.ps-table-row:nth-child(even) {
  background: #F9FAFB;
}

.ps-table-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 400;
  color: #111827;
}

.ps-table-total {
  padding: 10px 14px;
  background: #F3F4F6;
  border-top: 1px solid #E5E7EB;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.86rem;
  color: #111827;
}

.ps-table-total span:last-child {
  font-family: var(--font-mono);
  color: #111827;
}

/* Net Pay Highlight Block */
.ps-net-pay-banner {
  background: linear-gradient(135deg, #111827 0%, #1F2937 100%);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.ps-net-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9CA3AF;
  font-weight: 400;
}

.ps-net-amount {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #34D399;
}

.ps-net-words {
  font-size: 0.75rem;
  color: #D1D5DB;
  margin-top: 2px;
  font-style: italic;
}

/* YTD & Bank Info Row */
.ps-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px dashed #D1D5DB;
  font-size: 0.76rem;
  color: #4B5563;
}

.ps-security-note {
  font-size: 0.75rem;
  color: #9CA3AF;
  text-align: center;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #E5E7EB;
}

/* Cross-Sell Widget Inside Dashboard */
.cross-sell-box {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-subtle) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.cross-sell-content h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.cross-sell-content p {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(4px);  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 200ms ease;
}

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

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--ink);
  animation: toastIn 200ms ease;
}

@keyframes toastIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print Stylesheet for Real PDF / Printer Output */
@media print {
  body {
    background: #FFF !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .top-nav-bar, .app-sidebar, .preview-toolbar, .dash-hero, .dash-metrics-grid, .content-card-header, .editor-form-col, .toast-container, .modal-backdrop, .app-header, .ecosystem-bar, .panel, .cross-sell-box, .channels-bar, .workflow-stepper-wrap {
    display: none !important;
  }
  .app-layout, .main-viewport, .view-content, .editor-layout, .editor-preview-col {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .app-container {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .payslip-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 20px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .ps-logo-wrap {
    border: 1px solid #E5E7EB !important;
    background: #FFF !important;
  }
  .ps-company-logo {
    display: block !important;
    max-width: 100% !important;
  }
}

/* ====================================================================
   MICROSOFT SHAREPOINT ARCHITECTURE & POWER AUTOMATE WORKFLOW STYLES
   ==================================================================== */

/* Top Access Channels Bar */
.channels-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-x: auto;
}

.channels-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-label {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-right: 4px;
}

.channel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.channel-tab:hover {
  background: var(--line);
  color: var(--ink);
}

.channel-tab.active {
  background: #0078D4; /* SharePoint / M365 Blue */
  color: #FFFFFF;
  border-color: #0078D4;
  box-shadow: 0 2px 6px rgba(0,120,212,0.25);
}

.channel-tab.active.teams-chan {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  box-shadow: 0 2px 6px rgba(79,82,178,0.25);
}

/* 3-Role Mode Switcher in Header */
.role-switcher-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.role-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 140ms ease;
}

.role-btn:hover {
  color: var(--ink);
}

.role-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.role-btn.active[data-role="employee"] {
  color: #0284C7;
  border: 1px solid #BAE6FD;
}

.role-btn.active[data-role="hr_admin"] {
  color: var(--accent);
  border: 1px solid #BBF7D0;
}

.role-btn.active[data-role="system_admin"] {
  color: #7C3AED;
  border: 1px solid #DDD6FE;
}

/* 5-Step Power Automate Workflow Stepper */
.workflow-stepper-wrap {
  background: linear-gradient(135deg, #0b1511 0%, #112019 100%);
  color: #FFFFFF;
  border-bottom: 1px solid #1f362a;
  padding: 14px 24px;
}

.workflow-header {
  max-width: 1400px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.workflow-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.workflow-steps-track {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  position: relative;
}

.workflow-step {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
}

.workflow-step:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
}

.workflow-step.step-active {
  background: rgba(56,189,248,0.15);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56,189,248,0.3);
}

.workflow-step.step-completed {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 400;
  flex: none;
}

.workflow-step.step-active .step-number {
  background: #38bdf8;
  color: #0b1511;
}

.workflow-step.step-completed .step-number {
  background: #22c55e;
  color: #0b1511;
}

.step-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.step-name {
  font-size: 0.78rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f1f5f9;
}

.step-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* SharePoint Document Library & List Tables */
.sp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.sp-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-subtle);
}

.sp-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.sp-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-table-wrap {
  overflow-x: auto;
  /* Scroll affordance: a wide table (more columns than fit) gets a faint inward shadow on both
     edges, so a tablet or narrow-desktop user can tell there is more to scroll to. It shows even
     when fully scrolled to one end; that is a deliberate simplicity trade-off (see app.css notes). */
  box-shadow: inset 10px 0 8px -8px rgba(20, 30, 24, 0.28), inset -10px 0 8px -8px rgba(20, 30, 24, 0.28);
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.sp-table th {
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sp-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.sp-table tr:hover td {
  background: var(--surface-subtle);
}

.sp-doc-icon {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  font-size: 0.75rem;
  color: #FFF;
  flex: none;
}

.sp-doc-icon.pdf { background: #DC2626; }
.sp-doc-icon.list { background: #0078D4; }

.purview-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 400;
  background: rgba(14,165,233,0.1);
  color: #0284C7;
  border: 1px solid rgba(14,165,233,0.25);
}

.purview-badge.confidential {
  background: rgba(220,38,38,0.1);
  color: #DC2626;
  border-color: rgba(220,38,38,0.25);
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink-soft);
}

/* Power BI Analytics KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 4px;
  font-weight: 400;
}

/* Sub Navigation Tabs for HR & Admin Views */
.admin-subnav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  background: var(--surface);
  overflow-x: auto;
}

.admin-subnav-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 140ms ease;
}

.admin-subnav-btn:hover {
  color: var(--ink);
}

.admin-subnav-btn.active {
  color: #0078D4;
  border-bottom-color: #0078D4;
  font-weight: 400;
}

/* Channel Frame Viewport Mode Simulators */
.channel-frame-wrap {
  transition: all 250ms ease;
}

.channel-frame-wrap.frame-sharepoint {
  border-top: 3px solid #0078D4;
}

.channel-frame-wrap.frame-teams {
  border-top: 3px solid var(--primary-blue);
}

.channel-frame-wrap.frame-mobile {
  max-width: 480px;
  margin: 20px auto;
  border: 10px solid #1f2937;
  border-radius: 36px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  overflow: hidden;
}

/* Responsive adjustments for 5-step track */
@media (max-width: 992px) {
  .workflow-steps-track {
    grid-template-columns: 1fr;
  }
  .channels-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ====================================================================
   LIGHTWEIGHT & USER-FRIENDLY DASHBOARD LAYOUT
   Fluent 2 & Modern SaaS Clean Styling
   ==================================================================== */

/* Top Navigation Bar (72px) */
.top-nav-bar {
  height: 72px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 4px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #01442D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
}

.free-badge {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(20, 168, 65, 0.25);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.nav-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 28px;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-muted);
  pointer-events: none;
}

.nav-search-input {
  height: 34px;
  width: 240px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 12px 0 32px;
  font-size: 0.8rem;
  color: var(--ink);
  transition: all 150ms ease;
}

.nav-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(35, 148, 58, 0.1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* User Profile Chip (Top Right) */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: all 140ms ease;
}

.user-chip:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.user-chip-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 400;
  flex: none;
}

.user-chip-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.user-chip-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-chip-name {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink);
}

.user-chip-role {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
}

.user-chip-role.emp {
  background: #EFF6FC;
  color: #0078D4;
}

.user-chip-role.adm {
  background: #F5F3FF;
  color: #7C3AED;
}

.user-chip-sub {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* User Dropdown */
.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  z-index: 100;
  display: none;
}

.user-dropdown-menu.show {
  display: block;
  animation: dropIn 150ms ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 6px 10px 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 120ms ease;
}

.dropdown-item:hover {
  background: var(--surface-subtle);
}

.avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 400;
  flex: none;
}

.avatar-mini.hr { background: var(--accent-light); color: var(--accent); }
.avatar-mini.emp { background: #EFF6FC; color: #0078D4; }
.avatar-mini.adm { background: #F5F3FF; color: #7C3AED; }

.dropdown-item-title { font-size: 0.78rem; font-weight: 700; color: var(--ink); }
.dropdown-item-sub { font-size: 0.75rem; color: var(--ink-soft); }

/* App Layout */
.app-layout {
  display: flex;
  min-height: calc(100vh - 72px);
  background: var(--bg);
}

/* Sidebar (Width: 230px, Clean & Minimal) */
.app-sidebar {
  width: 230px;
  flex: 0 0 230px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  z-index: 40;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 400;
  cursor: pointer !important;
  text-align: left;
  transition: all 120ms ease;
  text-decoration: none;
  user-select: none;
}

.nav-item * {
  pointer-events: none;
}

.nav-item:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(20, 168, 65, 0.25);
  font-weight: 400;
}

.nav-item svg { flex: none; }

.nav-pill-count {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--line);
  color: var(--ink-soft);
  font-weight: 400;
}

.nav-item.active .nav-pill-count {
  background: #FFF;
}

.sidebar-bottom {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m365-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.m365-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22C55E;
}

.sidebar-suite-link {
  font-size: 0.75rem;
  color: #0284C7;
  text-decoration: none;
}

.sidebar-suite-link:hover { text-decoration: underline; }

/* Main Viewport */
.main-viewport {
  flex: 1;
  min-width: 0;
  padding: 24px;
  background: var(--bg);
}

.view-content {
  max-width: 1280px;
  margin: 0 auto;
}

/* Dashboard Hero */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.dash-subtitle {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.dash-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Metrics Grid (4 Cards) */
.dash-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 150ms ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.metric-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
  line-height: 1.1;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Content Card & Clean Table */
.content-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.content-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.content-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.content-card-sub {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

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

.clean-table th {
  padding: 10px 16px;
  background: var(--surface-subtle);
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.clean-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.clean-table tr:hover td {
  background: var(--surface-subtle);
}

.table-responsive {
  overflow-x: auto;
}

/* Editor Layout (2 Columns) */
.editor-layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 20px;
  align-items: start;
}

.editor-form-col {
  min-width: 0;
}

.editor-preview-col {
  min-width: 0;
  position: sticky;
  top: 76px;
}

.accordion-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.accordion-header {
  padding: 10px 14px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.accordion-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.accordion-body {
  padding: 12px 14px;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: block;
  }
  .app-sidebar {
    position: fixed;
    top: 72px;
    left: -230px;
    box-shadow: var(--shadow-lg);
    transition: left 200ms ease;
  }
  .app-sidebar.open {
    left: 0;
  }
  .main-viewport {
    padding: 16px;
  }
}




/* ====================================================================
   v1.1.0 fixes
   ==================================================================== */

/* Sections a role may not open are removed from the UI */
.role-hidden { display: none !important; }

/* 5-step flow: the track was styled for a dark banner but sits on a light card */
.content-card .workflow-steps-track { padding: 12px 16px 16px; }
.content-card .workflow-step { background: var(--surface-subtle); border-color: var(--line); }
.content-card .workflow-step:hover { background: var(--surface); border-color: var(--accent); }
.content-card .workflow-step.step-active { background: #EAF6FD; border-color: #0EA5E9; box-shadow: none; }
.content-card .workflow-step.step-completed { background: var(--accent-light); border-color: var(--accent); }
.content-card .step-name { color: var(--ink); }
.content-card .step-sub { color: var(--ink-soft); }
.content-card .step-number { background: var(--line); color: var(--ink); }
.content-card .workflow-step.step-active .step-number { background: #0EA5E9; color: #FFFFFF; }
.content-card .workflow-step.step-completed .step-number { background: var(--accent); color: #FFFFFF; }

/* Earnings / deductions editor rows */
.item-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.item-row .form-control { min-width: 0; width: auto; }
.btn-remove {
  flex: none;
  width: 32px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 6px;
  cursor: pointer;
}
.btn-remove:hover { color: var(--danger); border-color: var(--danger); }

/* Single / Bulk mode switch */
.mode-toggle-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.mode-toggle-btn {
  padding: 7px 6px;
  font-size: 0.78rem;
  font-weight: 400;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: all 140ms ease;
}
.mode-toggle-btn.active { background: var(--accent); color: var(--accent-ink); }

/* Mobile: nothing may push the page wider than the screen */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; } /* clip, not hidden: hidden makes body a scroll container and breaks the sticky sidebar */
@media (max-width: 900px) {
  .top-nav-bar { padding: 0 12px; gap: 8px; }
  .nav-left { min-width: 0; flex: 1; gap: 8px; }
  .nav-search-wrap { flex: 1; min-width: 0; margin-left: 0; }
  .nav-search-input { width: 100%; min-width: 0; }
  .nav-right { flex: none; gap: 8px; }
  .nav-right > a.btn, .nav-right > .btn { display: none !important; }
  .free-badge { display: none; }
}
@media (max-width: 640px) {
  .brand-logo-text { display: none; }
  .user-chip-meta, .user-chip > svg { display: none; }
  .user-chip { padding: 4px; }
  .dash-hero-actions { flex-wrap: wrap; width: 100%; }
  .dash-hero-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ====================================================================
   Sidebar: US payroll-style grouped navigation
   ==================================================================== */
.sidebar-nav { padding: 12px 10px 16px; }
.nav-section { padding-bottom: 6px; }
.nav-section + .nav-section { margin-top: 10px; }
.sidebar-label { padding: 6px 12px 6px; }

.nav-item {
  position: relative;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  font-weight: 400;
}
/* Left accent bar marks the current page */
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: transparent;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Help sits at the foot of the menu, separated like ADP / Gusto */
.nav-section-help {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.nav-item-help { color: var(--ink-soft); font-weight: 400; }
.nav-item-help:hover { color: var(--accent); }

/* ====================================================================
   Sidebar: Team view / Personal switch, expandable groups
   ==================================================================== */
.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 12px 12px 4px;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.view-switch-btn {
  padding: 7px 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 140ms ease;
}
.view-switch-btn:hover { color: var(--ink); }
.view-switch-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.view-switch-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sidebar-nav .nav-item { margin-bottom: 2px; }
.nav-group-toggle .nav-chevron {
  margin-left: auto;
  color: var(--ink-muted);
  transition: transform 160ms ease;
}
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group.has-active > .nav-group-toggle { color: var(--ink); }

.nav-sub { display: block; padding: 2px 0 4px; }
.nav-group.collapsed .nav-sub { display: none; }

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px 8px 42px;
  margin-bottom: 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.83rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.nav-subitem * { pointer-events: none; }
.nav-subitem:hover { background: var(--surface-subtle); color: var(--ink); }
.nav-subitem.active { background: var(--accent-light); color: var(--accent); font-weight: 400; }
.nav-subitem:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.nav-item-contact {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

/* ====================================================================
   Page layout shared by Reports / Company settings / Integration
   ==================================================================== */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.page-sub { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; max-width: 640px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.page-actions .form-select { width: auto; min-width: 150px; }
.form-hint { font-size: 0.75rem; color: var(--ink-soft); margin: 14px 2px 0; line-height: 1.5; }
.form-hint a { color: var(--accent); font-weight: 400; }

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.settings-card { padding: 20px; }
.settings-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 18px 0 10px;
}
.settings-actions { display: flex; gap: 8px; margin-top: 18px; }
.settings-note { font-size: 0.75rem; color: var(--ink-soft); margin-top: 10px; }

.cs-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: var(--surface-subtle);
}
.cs-preview-head { display: flex; align-items: center; gap: 12px; }
.cs-preview-name { font-weight: 400; color: var(--ink); }
.cs-preview-addr { font-size: 0.78rem; color: var(--ink-soft); }
.cs-preview-title { margin-top: 14px; font-size: 0.8rem; font-weight: 700; color: var(--ink); }
.cs-preview-from { margin-top: 6px; font-size: 0.75rem; color: var(--ink-soft); word-break: break-word; }

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.integration-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.integration-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.integration-name { font-size: 0.95rem; font-weight: 400; color: var(--ink); }
.integration-desc { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }
.integration-detail { font-size: 0.78rem; color: var(--ink); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); line-height: 1.5; }
.status-pill {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}
.status-ok { background: #E7F7EC; color: #15803D; }
.status-warn { background: #FEF3C7; color: #B45309; }
.status-off { background: #F1F5F9; color: #475569; }
.status-checking { background: #E0F2FE; color: #0369A1; }

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Embedded products (More products menu): flush with the page, no extra frame */
.product-frame-wrap { margin: -4px -6px; height: calc(100vh - 96px); min-height: 520px; background: transparent; }
.product-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; }

/* Add-ons (subscription products) */
.addon-lock { margin-left: auto; font-size: 0.75rem; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; color: #B45309; background: #FEF3C7; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.nav-subitem { display: flex; align-items: center; gap: 8px; }
.addon-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--accent-light); border: 1px solid var(--line-strong); color: var(--ink); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 10px; font-size: 0.85rem; }
.product-frame-wrap.with-banner { height: calc(100vh - 160px); }
.addon-locked { max-width: 640px; margin: 24px auto; text-align: left; }
.addon-lock-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.addon-features { margin: 14px 0; padding-left: 0; list-style: none; display: grid; gap: 6px; font-size: 0.88rem; color: var(--ink-soft); }
.addon-features li::before { content: "\2713"; color: var(--accent); font-weight: 400; margin-right: 8px; }
.addon-price { font-weight: 400; color: var(--ink); margin: 8px 0; }
.addon-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
.addon-note { display: block; font-size: 0.75rem; font-weight: 400; color: var(--ink-soft); margin-top: 6px; }
.addon-note textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.addon-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.addon-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.addon-card-head h3 { font-size: 1rem; font-weight: 700; color: var(--ink); }

/* Navigation, skip link and the people tabs */
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 1000; font-weight: 400; text-decoration: none; }
.skip-link:focus { top: 12px; }
.nav-item .addon-lock { margin-left: auto; }
.people-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.people-tabs a { padding: 9px 14px; font-weight: 400; font-size: 0.88rem; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 8px; }
.people-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.people-tabs a:hover { color: var(--ink); }

/* Product pages fill the space under the header: one scroll area (inside the product), no page scrollbar beside it */
.on-product .main-viewport { display: flex; flex-direction: column; }
.on-product #view { flex: 1; display: flex; flex-direction: column; width: 100%; }
.on-product .product-frame-wrap, .on-product .product-frame-wrap.with-banner { flex: 1; height: auto; min-height: 480px; position: relative; margin: 0; }
.on-product .product-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.on-product .nav-search-wrap { visibility: hidden; } /* the products have their own search */
.product-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-muted); font-size: 0.9rem; background: var(--bg); z-index: 1; }
.addon-price-note { font-size: 0.82rem; color: var(--ink-soft); margin: 8px 0; }

/* Legibility and touch targets */
.btn { min-height: 36px; }
.btn-sm { min-height: 32px; }
.form-control, .form-select { min-height: 38px; }

/* Headings inside cards (real h2 for the document outline, same look as before) */
.card-title { font-size: 0.98rem; font-weight: 700; color: var(--ink); margin: 0; }

/* Dashboard: next step and first-run checklist */
.setup-card { margin-bottom: 16px; }
.setup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.setup-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.setup-steps li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.86rem; font-weight: 400; color: var(--ink-soft); }
.setup-steps li a { color: inherit; text-decoration: none; }
.setup-steps li .mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.setup-steps li.done .mark { background: var(--accent); border-color: var(--accent); }
.setup-steps li.done { color: var(--ink-muted); }
.setup-steps li.next { border-color: var(--accent); background: var(--accent-light); color: var(--ink); }
.setup-steps li.next .mark { border-color: var(--accent); }
.payroll-totals { margin-top: 12px; }

/* Regular weight for inline emphasis; headings and table headers stay bold */
b, strong { font-weight: 400; }
h1, h2, h3, h4, h5, h6, th { font-weight: 700; }
