/* BizPlatform workspace system. Loaded last so legacy pages share one UI contract. */
:root {
  --sidebar-width: 248px;
  --app-topbar-height: 68px;
  --bg-page: #f3f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #fbfbfc;
  --bg-sidebar-active: #edf3ff;
  --bg-sidebar-hover: #f0f2f5;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-table-header: #f2f4f6;
  --bg-table-stripe: #fafbfc;
  --bg-modal: #ffffff;
  --text-primary: #191b20;
  --text-secondary: #545b66;
  --text-muted: #737b87;
  --text-sidebar: #4e5662;
  --text-sidebar-hover: #191b20;
  --text-sidebar-brand: #17191d;
  --text-on-accent: #ffffff;
  --border-color: #dce1e6;
  --border-input: #cfd4da;
  --border-sidebar: #e3e6ea;
  --border-card: #dbe0e5;
  --accent: #2457d6;
  --accent-hover: #1c47b7;
  --accent-soft: #edf3ff;
  --accent-glow: rgba(36, 87, 214, .16);
  --success: #13795b;
  --warning: #a86108;
  --danger: #b42336;
  --info: #176b87;
  --kpi-positive: #13795b;
  --kpi-positive-bg: #eaf7f2;
  --kpi-negative: #b42336;
  --kpi-negative-bg: #fff0f2;
  --kpi-neutral: #2457d6;
  --kpi-neutral-bg: #edf3ff;
  --kpi-warn: #a86108;
  --kpi-warn-bg: #fff6e7;
  --card-bg: var(--bg-card);
  --radius-card: 8px;
  --radius-input: 6px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-card-hover: 0 4px 12px rgba(16, 24, 40, .07);
  --shadow-modal: 0 24px 60px rgba(16, 24, 40, .2);
  --shadow-sidebar: none;
  --shadow-soft: var(--shadow-card);
  --transition: .16s ease;
}

[data-theme="dark"] {
  --bg-page: #111318;
  --bg-card: #181b21;
  --bg-sidebar: #14171c;
  --bg-sidebar-active: #202d49;
  --bg-sidebar-hover: #20242b;
  --bg-input: #1d2128;
  --bg-input-focus: #20252d;
  --bg-table-header: #1d2128;
  --bg-table-stripe: #1a1e24;
  --bg-modal: #181b21;
  --text-primary: #f3f4f6;
  --text-secondary: #c0c6cf;
  --text-muted: #929aa6;
  --text-sidebar: #a9b0bb;
  --text-sidebar-hover: #ffffff;
  --text-sidebar-brand: #ffffff;
  --border-color: #2c313a;
  --border-input: #3a414c;
  --border-sidebar: #2a2f37;
  --border-card: #2d323b;
  --accent: #7aa2ff;
  --accent-hover: #92b3ff;
  --accent-soft: #202d49;
  --accent-glow: rgba(122, 162, 255, .16);
  --success: #62c7a0;
  --warning: #e7b05d;
  --danger: #ef8190;
  --info: #7bc3dc;
  --kpi-positive: #62c7a0;
  --kpi-positive-bg: #17352c;
  --kpi-negative: #ef8190;
  --kpi-negative-bg: #3a2028;
  --kpi-neutral: #8aafff;
  --kpi-neutral-bg: #202d49;
  --kpi-warn: #e7b05d;
  --kpi-warn-bg: #392d1d;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .24);
  --shadow-card-hover: 0 5px 16px rgba(0, 0, 0, .28);
}

html {
  background: var(--bg-page);
  scroll-padding-top: calc(var(--app-topbar-height) + 16px);
}

body {
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: .9375rem;
  line-height: 1.5;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

/* Application shell */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  box-shadow: none;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar .brand {
  min-height: var(--app-topbar-height);
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-sidebar);
  color: var(--text-sidebar-brand);
  font-size: 1.06rem;
}

.sidebar .brand .brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #17191d;
  color: #ffffff;
  box-shadow: none;
}

[data-theme="dark"] .sidebar .brand .brand-icon {
  background: #f3f4f6;
  color: #17191d;
}

.sidebar .brand .v-tag {
  color: var(--text-muted);
  font-size: .66rem;
}

.sidebar .theme-row {
  display: none;
}

.sidebar-search {
  width: calc(100% - 24px);
  min-height: 44px;
  margin: 12px 12px 6px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border-sidebar);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: .78rem;
  text-align: left;
}

.sidebar-search:hover {
  border-color: var(--border-input);
  color: var(--text-primary);
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-table-header);
  color: var(--text-muted);
  box-shadow: none;
  font-family: inherit;
  font-size: .65rem;
  font-weight: 600;
}

.sidebar .nav-group {
  margin: 9px 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.sidebar .nav-group + .nav-group {
  margin-top: 7px;
}

.sidebar .nav-group[open] {
  border: 0;
  box-shadow: none;
}

.sidebar .nav-group-toggle,
.sidebar .nav-group[open] .nav-group-toggle {
  min-height: 30px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar .nav-group-toggle:hover,
.sidebar .nav-group[open] .nav-group-toggle:hover,
[data-theme="dark"] .sidebar .nav-group-toggle:hover,
[data-theme="dark"] .sidebar .nav-group[open] .nav-group-toggle {
  background: transparent;
  color: var(--text-primary);
}

.sidebar .nav-group-chevron {
  font-size: .68rem;
}

.sidebar .nav-group-links,
[data-theme="dark"] .sidebar .nav-group-links {
  padding: 2px 0;
  background: transparent;
}

.sidebar a.nav-link,
.sidebar .nav-group .nav-link,
[data-theme="dark"] .sidebar a.nav-link {
  min-height: 44px;
  margin: 1px 0;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  color: var(--text-sidebar);
  font-size: .84rem;
  line-height: 1.25;
}

.sidebar > a.nav-link,
.sidebar > form .nav-link {
  margin-inline: 8px;
}
.sidebar > form .nav-link {
  min-height: 44px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sidebar);
  font-size: .84rem;
  line-height: 1.25;
}

.sidebar > a[href="/install"] {
  margin-top: auto;
  border-top: 1px solid var(--border-sidebar);
  border-radius: 0;
}

.sidebar a.nav-link:hover,
[data-theme="dark"] .sidebar a.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-hover);
}

.sidebar a.nav-link.active,
[data-theme="dark"] .sidebar a.nav-link.active {
  background: var(--bg-sidebar-active);
  color: var(--accent);
  box-shadow: none;
  font-weight: 650;
}

.sidebar a.nav-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar .network {
  margin-top: 0 !important;
  border-top: 1px solid var(--border-sidebar);
  color: var(--text-muted);
}

.app-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 140;
  height: var(--app-topbar-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb, var(--bg-card) 96%, transparent);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-search {
  width: min(430px, 42vw);
  height: 42px;
  padding: 0 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-page);
  color: var(--text-muted);
  font: inherit;
  font-size: .84rem;
  text-align: left;
}

.topbar-search:hover,
.topbar-search:focus-visible {
  border-color: var(--border-input);
  background: var(--bg-card);
  color: var(--text-primary);
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-create {
  min-height: 40px;
  padding-inline: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.topbar-create-menu .dropdown-item,
.topbar-user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar-create-menu .dropdown-item i,
.topbar-user-menu .dropdown-item i {
  width: 17px;
  text-align: center;
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
}

.topbar-icon-btn:hover {
  border-color: var(--border-input);
  background: var(--bg-table-header);
  color: var(--text-primary);
}

.topbar-user {
  min-height: 40px;
  padding: 3px 7px 3px 4px;
  display: grid;
  grid-template-columns: 32px minmax(0, auto) 14px;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.topbar-user:hover,
.topbar-user[aria-expanded="true"] {
  border-color: var(--border-color);
  background: var(--bg-table-header);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #25282e;
  color: #ffffff;
  font-size: .78rem;
  font-weight: 700;
}

.topbar-user-copy {
  min-width: 0;
  display: grid;
  line-height: 1.15;
}

.topbar-user-copy strong {
  max-width: 140px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-copy small {
  color: var(--text-muted) !important;
  font-size: .66rem;
}

.main,
body.employee-app .main {
  width: auto;
  max-width: none;
  margin-left: var(--sidebar-width);
  padding: calc(var(--app-topbar-height) + 30px) clamp(24px, 2.6vw, 44px) 56px;
  background: var(--bg-page);
}

.main.instant-loading {
  opacity: .58;
  pointer-events: none;
}

/* Command palette */
.command-palette[hidden] {
  display: none;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: start center;
  padding: min(14vh, 120px) 16px 16px;
}

.command-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 24, 31, .48);
}

.command-dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: min(620px, 76vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-modal);
}

.command-input-row {
  min-height: 58px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
}

.command-input-row input {
  width: 100%;
  height: 56px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: .96rem;
}

.command-results {
  padding: 7px;
  overflow-y: auto;
}

.command-item {
  min-height: 52px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
}

.command-item:hover,
.command-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.command-item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
}

.command-item-copy {
  min-width: 0;
  display: grid;
}

.command-item-copy strong {
  overflow: hidden;
  font-size: .84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item-copy small {
  color: var(--text-muted) !important;
  font-size: .7rem;
}

.command-item-arrow {
  color: var(--text-muted);
}

.command-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-align: center;
}

.command-empty i {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.command-empty strong {
  color: var(--text-primary);
}

.command-footer {
  min-height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: .68rem;
}

.command-footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.command-open {
  overflow: hidden;
}

/* Shared page hierarchy */
.page-title,
.expense-heading .page-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-title i,
.expense-heading .page-title i {
  color: var(--text-secondary) !important;
}

.page-subtitle,
.expense-heading-copy .page-subtitle {
  margin: 5px 0 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.45;
}

.main > .d-flex.justify-content-between.align-items-center.mb-4,
.main > .d-flex.justify-content-between.align-items-center.mb-3,
.expense-heading,
.employee-profile-hero,
.hr-hero {
  min-height: 48px;
  margin-bottom: 18px !important;
  align-items: center;
}

.card,
.kpi-card,
.summary-card,
.filter-bar,
.dashboard-panel,
.expense-kpi,
.expense-filters,
.expense-table-shell,
.hr-kpi,
.hr-section,
.hr-chart-card,
.profile-section,
.profile-kpi,
.profile-fact,
.profile-pay-slot {
  border: 1px solid var(--border-card);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.card:hover,
.kpi-card:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.card-header,
.card-footer {
  background: var(--bg-card);
}

.card-header {
  min-height: 50px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  border-bottom-color: var(--border-color);
  font-size: .94rem;
  font-weight: 650;
}

.card-body {
  padding: 18px;
}

.kpi-card[style*="border-left"] {
  border-left: 1px solid var(--border-card) !important;
}

.kpi-card {
  min-height: 116px;
  padding: 18px;
}

.kpi-value {
  color: var(--text-primary);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.kpi-label,
.summary-card-label,
.expense-kpi-label,
.hr-kpi-label,
.profile-kpi-label {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  top: 14px;
  right: 14px;
  border-radius: 6px;
}

.summary-grid {
  gap: 10px;
}

.summary-card {
  min-height: 96px;
  padding: 14px 15px;
}

.summary-card-value {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.filter-bar {
  gap: 10px;
  padding: 12px;
  box-shadow: none;
}

.table-meta {
  min-height: 42px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.empty-state,
.profile-empty,
.hr-empty,
.expense-empty {
  border: 0;
  background: transparent;
}

/* Controls */
.btn,
.btn-sm,
.btn-xs,
.form-control,
.form-select,
.input-group-text,
.nav-tabs .nav-link {
  border-radius: 6px;
}

.btn {
  min-height: 40px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.2;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 10px;
  font-size: .8rem;
}

.btn-xs {
  min-height: 30px;
  padding: 4px 7px;
  font-size: .72rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: none;
}

.btn-secondary {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
}

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

.btn-outline-primary {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color));
}

.btn-outline-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.form-control,
.form-select {
  min-height: 42px;
  padding: 8px 11px;
  border-color: var(--border-input);
  background-color: var(--bg-input);
  font-size: .86rem;
}

.form-control-sm,
.form-select-sm {
  min-height: 36px;
  padding-block: 5px;
}

.form-label {
  margin-bottom: 5px;
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
}

.field-help {
  font-size: .7rem;
}

.dropdown-menu {
  min-width: 210px;
  padding: 6px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}

.dropdown-item {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 5px;
}

.nav-tabs {
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.badge,
.badge-status,
.expense-status,
.hr-pill,
.hr-status-badge {
  border-radius: 999px;
  font-size: .69rem;
  font-weight: 650;
  letter-spacing: 0;
}

.modal-content {
  border-radius: 8px;
}

.modal-header,
.modal-footer {
  padding: 13px 16px;
}

.modal-body {
  padding: 16px;
}

.alert {
  border-radius: 7px;
  box-shadow: var(--shadow-card);
}

/* Ledgers and data tables */
.table-responsive,
.expense-table-scroll,
.project-table-wrap,
.salary-history-wrap,
.hr-shift-grid-wrap {
  border-radius: 0;
  scrollbar-color: var(--border-input) transparent;
}

.table {
  margin-bottom: 0;
  color: var(--text-primary);
  font-size: .84rem !important;
  font-variant-numeric: tabular-nums;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-table-header);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.table td {
  height: 52px;
  padding: 10px 12px;
  border-color: var(--border-color);
  font-size: .84rem;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table-hover tbody tr:hover td {
  background: var(--bg-table-stripe);
}

.table a {
  font-weight: 600;
  text-decoration: none;
}

.table .btn:not(.mobile-card-toggle) {
  min-height: 30px;
}

.mobile-filter-toggle {
  display: none;
}

/* Dashboard */
.dashboard-panel {
  overflow: hidden;
  box-shadow: none;
}

.dashboard-panel-header {
  min-height: 46px;
  padding: 12px 14px !important;
}

.dashboard-chart-body {
  min-height: 240px;
}

.dashboard-list-row {
  min-height: 48px;
}

/* Finance */
.expense-workspace {
  gap: 14px;
}

.expense-heading {
  margin-bottom: 0 !important;
}

.expense-kpis {
  gap: 10px;
}

.expense-kpi {
  min-height: 96px;
  padding: 14px 15px;
  box-shadow: none;
}

.expense-kpi-value {
  margin-top: 4px;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.expense-filters {
  padding: 14px;
  box-shadow: none;
}

.expense-filter-grid {
  gap: 10px;
}

.expense-table-shell {
  box-shadow: none;
}

.expense-table-toolbar,
.expense-pagination {
  min-height: 42px;
  padding: 9px 12px;
}

.expense-status {
  min-height: 23px;
}

.expense-row-actions .btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.ledger-kpi-grid,
.bank-kpi-grid {
  gap: 10px;
}

/* HR workspace */
.hr-shell,
.employee-profile-shell {
  width: 100%;
  max-width: none;
  margin: 0;
}

.hr-hero {
  gap: 16px;
}

.hr-title {
  gap: 11px;
}

.hr-mark {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: #25282e;
  box-shadow: none;
}

.hr-title h1,
.employee-profile-title h1 {
  font-size: 1.62rem;
  font-weight: 700;
}

.hr-subtitle,
.employee-profile-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .88rem;
}

.hr-actions,
.profile-actions {
  gap: 6px;
}

.hr-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.hr-kpi {
  min-height: 112px;
  padding: 16px;
  box-shadow: none;
}

.hr-kpi::before {
  display: none;
}

.hr-kpi-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  border-radius: 6px;
}

.hr-kpi-value,
.profile-kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hr-tabs {
  top: calc(var(--app-topbar-height) + 8px);
  gap: 2px;
  padding: 5px;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.hr-tab {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
}

.hr-tab.active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.hr-section,
.hr-chart-card {
  box-shadow: none;
}

.hr-section-head {
  min-height: 54px;
  padding: 13px 18px;
}

.hr-section-head h2,
.hr-chart-title {
  font-size: .98rem;
  font-weight: 650;
}

.hr-section-body {
  padding: 18px;
}

.hr-chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.hr-chart-card {
  padding: 18px;
}

.hr-donut-ring,
.hr-donut {
  width: 132px;
  height: 132px;
}

.hr-donut::after,
.hr-donut-hole {
  inset: 37px;
}

.hr-person,
.hr-company,
.hr-status-line,
.hr-quick,
.hr-announcement,
.hr-chat-msg,
.timeline-item {
  border-radius: 7px;
  box-shadow: none;
}

.hr-person {
  padding: 12px;
}

.hr-meter span,
.hr-bar-track span {
  background: var(--accent);
}

.hr-people-toolbar {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-table-header);
}

.hr-filter-pill {
  border-radius: 6px;
}

/* Employee record and employee app */
.employee-profile-hero {
  gap: 14px;
}

.employee-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #25282e;
}

.profile-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
}

.profile-kpis {
  gap: 12px;
}

.profile-kpi {
  min-height: 100px;
  padding: 16px;
  box-shadow: none;
}

.profile-section {
  box-shadow: none;
}

.profile-section-header {
  min-height: 54px;
  padding: 13px 18px;
}

.profile-facts,
.profile-pay-slots {
  gap: 10px;
}

.profile-fact,
.profile-pay-slot {
  padding: 12px;
  box-shadow: none;
}

body.employee-app .emp-app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

body.employee-app .emp-app-hero,
body.employee-app .emp-focus-card,
body.employee-app .emp-card,
body.employee-app .emp-request-panel,
body.employee-app .emp-now-card,
body.employee-app .emp-time-grid > div,
body.employee-app .emp-shift-pick label {
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

body.employee-app .emp-app-hero {
  background: #25282e;
}

body.employee-app .emp-focus-icon,
body.employee-app .emp-photo-fallback {
  background: var(--accent);
}
body.employee-app .emp-photo-btn {
  width: 44px;
  height: 44px;
  right: -8px;
  bottom: -8px;
}

body.employee-app .emp-segment button {
  min-height: 40px;
}

.chat-compose-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-compose-tools .btn,
.chat-send-btn {
  width: 40px;
  min-width: 40px;
  padding-inline: 0;
}

/* Audited chat editing */
[data-chat-message] {
  min-width: 0;
}

[data-chat-body] {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: .72rem;
}

.chat-message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.chat-message-edit {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
}

.chat-message-edit:hover,
.chat-message-edit:focus-visible {
  border-color: var(--border-color);
  background: var(--bg-table-header);
  color: var(--text-primary);
}

.chat-inline-editor {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.chat-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
/* Master data and operational pages */
.master-lists-page .nav-tabs {
  margin-bottom: 14px !important;
}

.master-lists-page .tab-pane > .row {
  align-items: start;
}

.master-lists-page .tab-pane > .row > [class^="col"]:first-child > .card,
.master-lists-page .tab-pane > .row > [class*=" col"]:first-child > .card {
  position: sticky;
  top: calc(var(--app-topbar-height) + 18px);
}

.project-ledger-table {
  min-width: 1320px;
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1120px) {
  :root {
    --sidebar-width: 220px;
  }

  .app-topbar {
    padding-inline: 18px;
  }

  .topbar-search {
    width: min(360px, 38vw);
  }

  .topbar-user-copy {
    display: none;
  }

  .topbar-user {
    grid-template-columns: 32px 14px;
  }

  .main,
  body.employee-app .main {
    padding-inline: 22px;
  }

  .hr-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Phone workspace */
@media (max-width: 768px) {
  :root {
    --app-topbar-height: 58px;
  }

  body {
    font-size: .9375rem;
  }

  .app-topbar {
    display: none;
  }

  .mobile-topbar {
    height: var(--app-topbar-height);
    padding: 0 8px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-card) 96%, transparent);
    box-shadow: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-brand {
    padding-left: 4px;
    color: var(--text-primary);
    font-size: .94rem;
  }

  .mobile-menu-btn,
  .mobile-search-btn,
  .mobile-theme-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
  }

  .mobile-menu-btn:hover,
  .mobile-search-btn:hover,
  .mobile-theme-btn:hover {
    border-color: var(--border-color);
    background: var(--bg-table-header);
    color: var(--text-primary);
  }

  .sidebar {
    width: min(86vw, 300px);
    background: var(--bg-sidebar);
    box-shadow: 12px 0 36px rgba(16, 24, 40, .16);
  }

  .sidebar-overlay {
    background: rgba(20, 24, 31, .42);
  }

  .main,
  body.employee-app .main {
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    padding: calc(var(--app-topbar-height) + 16px) 12px calc(72px + env(safe-area-inset-bottom));
  }

  .page-title,
  .expense-heading .page-title,
  .hr-title h1,
  .employee-profile-title h1 {
    font-size: 1.35rem;
  }

  .page-subtitle,
  .hr-subtitle,
  .employee-profile-subtitle {
    font-size: .84rem;
  }

  .main > .d-flex.justify-content-between.align-items-center.mb-4,
  .main > .d-flex.justify-content-between.align-items-center.mb-3,
  .expense-heading,
  .employee-profile-hero,
  .hr-hero {
    min-height: 0;
    margin-bottom: 14px !important;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .main > .d-flex.justify-content-between.align-items-center.mb-4 > .btn,
  .main > .d-flex.justify-content-between.align-items-center.mb-3 > .btn,
  .expense-heading > .btn {
    width: 100%;
  }

  .btn,
  .btn-sm,
  .btn-xs {
    min-height: 44px;
  }

  .btn-xs {
    min-width: 44px;
    padding-inline: 8px;
  }

  .chat-message-edit {
    width: 44px;
    height: 44px;

  body.employee-app .emp-segment button {
    min-height: 44px;
  }

  .chat-compose-tools .btn,
  .chat-send-btn {
    width: 44px;
    min-width: 44px;
  }
  }

  .form-control,
  .form-select,
  .form-control-sm,
  .form-select-sm {
    min-height: 44px;
    font-size: .875rem;
  }

  .mobile-dock {
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 5px 6px env(safe-area-inset-bottom);
    display: grid;
    gap: 2px;
    border: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-card) 97%, transparent);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-dock-item {
    min-height: 52px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: .63rem;
    font-weight: 600;
  }

  .mobile-dock-item i {
    font-size: 1rem;
  }

  .mobile-dock-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: none;
  }

  .command-palette {
    padding: 8px;
    place-items: start center;
  }

  .command-dialog {
    width: 100%;
    max-height: calc(100dvh - 16px);
  }

  .command-input-row {
    min-height: 56px;
  }

  .command-footer {
    display: none;
  }

  .card,
  .kpi-card,
  .summary-card,
  .filter-bar,
  .dashboard-panel,
  .expense-kpi,
  .expense-filters,
  .expense-table-shell,
  .hr-kpi,
  .hr-section,
  .hr-chart-card,
  .profile-section,
  .profile-kpi,
  .profile-fact,
  .profile-pay-slot,
  body.employee-app .emp-app-hero,
  body.employee-app .emp-focus-card,
  body.employee-app .emp-card,
  body.employee-app .emp-request-panel {
    border-radius: 8px;
    box-shadow: var(--shadow-card);
  }

  .main > .row:has(.kpi-card),
  .summary-grid,
  .expense-kpis,
  .hr-kpi-grid,
  .profile-kpis {
    margin-inline: -10px;
    padding-inline: 10px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .main > .row:has(.kpi-card)::-webkit-scrollbar,
  .summary-grid::-webkit-scrollbar,
  .expense-kpis::-webkit-scrollbar,
  .hr-kpi-grid::-webkit-scrollbar,
  .profile-kpis::-webkit-scrollbar {
    display: none;
  }

  .main > .row:has(.kpi-card) > [class^="col"],
  .main > .row:has(.kpi-card) > [class*=" col"] {
    width: 174px;
    min-width: 174px;
    flex: 0 0 174px;
    display: block;
    scroll-snap-align: start;
  }

  .kpi-card,
  .summary-card,
  .expense-kpi,
  .hr-kpi,
  .profile-kpi {
    width: 168px;
    min-width: 168px;
    min-height: 92px;
    padding: 12px;
    flex: 0 0 168px;
    scroll-snap-align: start;
  }

  .kpi-card::after,
  .mobile-card-table tr::before {
    display: none;
  }

  .kpi-value,
  .summary-card-value,
  .expense-kpi-value,
  .hr-kpi-value,
  .profile-kpi-value {
    font-size: 1.15rem;
  }

  .mobile-filter-toggle {
    width: 100%;
    min-height: 44px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
  }

  .mobile-filter-toggle > span,
  .mobile-filter-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }

  .mobile-filter-meta {
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 500;
  }

  .mobile-filter-toggle.active .mobile-filter-meta i {
    transform: rotate(180deg);
  }

  .mobile-filter-panel:not(.mobile-filter-panel-open) {
    display: none !important;
  }

  .filter-bar.mobile-filter-panel,
  .expense-filters.mobile-filter-panel {
    margin-top: 0;
    padding: 10px;
  }

  .filter-bar .filter-field,
  .filter-bar .filter-grow,
  .filter-bar .col-auto {
    min-width: 100%;
    flex-basis: 100%;
  }

  .expense-filter-grid {
    grid-template-columns: 1fr;
  }

  .expense-filter-wide,
  .expense-filter-actions {
    grid-column: auto;
  }

  .expense-filter-actions .btn {
    flex: 1 1 0;
  }

  .table-meta {
    align-items: flex-start;
    font-size: .72rem;
  }

  .mobile-card-table tbody {
    gap: 8px;
  }

  .mobile-card-table tr {
    gap: 7px 10px;
    padding: 11px;
    border-radius: 7px;
    background: var(--bg-card);
    box-shadow: none;
  }

  .mobile-card-table td,
  .mobile-card-table td:first-child:not(.mobile-card-title-cell) {
    font-size: .78rem;
  }

  .mobile-card-table td::before {
    color: var(--text-muted);
    font-size: .63rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .mobile-card-table td.mobile-card-title-cell {
    padding-bottom: 7px;
    font-size: .88rem;
  }

  .mobile-card-table td.mobile-card-action-cell {
    padding-top: 7px;
  }

  .mobile-card-table .mobile-card-toggle {
    min-height: 34px;
  }

  .expense-table-scroll {
    padding: 8px;
  }

  .expense-table tbody {
    display: grid;
    gap: 8px;
  }

  .expense-table tr {
    margin: 0;
    padding: 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-card);
  }

  .expense-table td {
    display: none;
    min-height: 0;
    padding: 0;
    border: 0;
  }

  .expense-table td::before {
    display: none;
  }

  .expense-table td[data-label="Expense"] {
    grid-column: 1;
    grid-row: 1;
    display: block;
  }

  .expense-table td[data-label="Base USD"] {
    grid-column: 2;
    grid-row: 1;
    display: block;
    color: var(--text-primary);
    font-size: .9rem;
    text-align: right !important;
  }

  .expense-table td[data-label="Date"] {
    grid-column: 1;
    grid-row: 2;
    display: block;
    color: var(--text-muted);
    font-size: .72rem;
  }

  .expense-table td[data-label="Payment"] {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: flex-end;
  }

  .expense-table td[data-label="Payment"] .expense-cell-meta {
    display: none;
  }

  .expense-table td[data-label="Actions"] {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    justify-content: flex-end;
    padding-top: 7px;
    border-top: 1px solid var(--border-color);
  }

  .expense-cell-title,
  .expense-cell-meta {
    max-width: none;
  }

  .expense-cell-title {
    font-size: .86rem;
  }

  .expense-table-toolbar,
  .expense-pagination {
    align-items: center;
    flex-direction: row;
  }

  .expense-table-toolbar span:last-child {
    display: none;
  }

  .expense-page-links {
    width: auto;
  }

  .hr-hero,
  .employee-profile-hero {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hr-title,
  .employee-profile-title {
    align-items: flex-start;
  }

  .hr-mark {
    width: 38px;
    height: 38px;
  }

  .hr-actions,
  .profile-actions {
    margin-inline: -10px;
    padding: 0 10px 2px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .hr-actions::-webkit-scrollbar,
  .profile-actions::-webkit-scrollbar {
    display: none;
  }

  .hr-actions .btn,
  .profile-actions .btn {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .hr-actions .btn-primary {
    order: -1;
  }

  .hr-tabs {
    top: calc(var(--app-topbar-height) + 4px);
    margin-inline: -10px;
    padding: 5px 10px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    scrollbar-width: none;
  }

  .hr-tabs::-webkit-scrollbar {
    display: none;
  }

  .hr-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .hr-layout,
  .hr-company-grid,
  .hr-quick-grid,
  .hr-workflow-grid,
  .hr-staff-chat-layout,
  .hr-donut-layout,
  .profile-grid,
  .profile-facts,
  .profile-pay-slots,
  .salary-history-toolbar {
    grid-template-columns: 1fr;
  }

  .hr-chart-grid {
    grid-template-columns: 1fr;
  }

  .hr-chart-card {
    padding: 12px;
  }

  .hr-donut-layout {
    gap: 12px;
  }

  .hr-person,
  .hr-person--row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .hr-person > *:not(.hr-person-avatar):not(:nth-child(2)):not(:last-child) {
    grid-column: 2;
  }

  .hr-person > :last-child {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .profile-section-header,
  .hr-section-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .master-lists-page .tab-pane > .row > [class^="col"]:first-child > .card,
  .master-lists-page .tab-pane > .row > [class*=" col"]:first-child > .card {
    position: static;
  }

  .modal-dialog {
    min-height: 100%;
    margin: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-height: calc(100dvh - 12px);
    border-radius: 8px 8px 0 0;
  }

  .modal-footer {
    flex-wrap: wrap;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .modal-footer .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 420px) {
  .mobile-topbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
  }

  .mobile-dock-item {
    font-size: .59rem;
  }

  .expense-table-toolbar,
  .expense-pagination {
    align-items: flex-start;
    flex-direction: column;
  }
}

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