:root {
  --navy: #072f63;
  --navy-dark: #041f45;
  --navy-soft: #eaf0f8;
  --green: #4f9f2f;
  --green-dark: #3d8124;
  --green-soft: #edf7e9;
  --ink: #102b4d;
  --muted: #617289;
  --line: #d5deea;
  --panel: #ffffff;
  --surface: #f4f7fb;
  --accent: var(--green);
  --accent-strong: var(--green-dark);
  --danger: #b33a3a;
  --shadow: 0 12px 30px rgba(7, 47, 99, 0.09);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f7f9fc 0%, #f1f6ee 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a.primary-button {
  display: block;
  text-align: center;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(79, 159, 47, 0.13), transparent 30%),
    radial-gradient(circle at 85% 85%, rgba(7, 47, 99, 0.14), transparent 34%),
    #f7f9fc;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 31, 69, 0.62);
}

.auth-card,
.metric-card,
.filter-bar,
.entry-form,
.settings-grid,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: 100%;
  max-width: 500px;
  min-width: 0;
  display: grid;
  gap: 16px;
  padding: 28px;
  border-top: 5px solid var(--green);
}

.trial-card {
  max-width: 620px;
}

.trial-intro {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #cfe5c5;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--navy);
}

.trial-intro span {
  color: var(--muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.trial-button {
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
}

.trial-button:hover {
  background: var(--green);
  color: #fff;
}

.text-button,
.platform-link {
  border: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.text-button:hover,
.platform-link:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

.bot-field {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.subdomain-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.subdomain-input input {
  min-width: 0;
  border-radius: 7px 0 0 7px;
}

.subdomain-input strong {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.85rem;
}

.password-dialog {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.password-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.password-dialog-heading h2,
.password-dialog-heading p {
  margin: 0;
}

.login-company-panel {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--navy-soft);
}

.login-company-panel span,
.login-company-panel small {
  color: var(--muted);
}

.trial-status {
  padding: 8px 11px;
  border: 1px solid #b9dca9;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.billing-summary-grid,
.billing-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.billing-summary-grid article {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--navy-soft);
}

.billing-summary-grid span,
.billing-plan-card span,
.billing-plan-card small {
  color: var(--muted);
}

.billing-summary-grid strong {
  color: var(--navy);
  font-size: 1.12rem;
}

.billing-plan-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.billing-plan-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.billing-plan-card.featured {
  border: 2px solid var(--green);
}

.billing-plan-card h3,
.billing-plan-card p {
  margin: 0;
}

.billing-plan-card > strong {
  color: var(--navy);
  font-size: 2rem;
}

.billing-plan-card .popular-label {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}

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

.brand-logo {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 12px;
}

.brand h1,
.brand p,
.toolbar h2,
.toolbar p {
  margin: 0;
}

.brand h1 {
  font-size: 1.2rem;
}

.brand p,
.fine-print {
  color: var(--muted);
}

.auth-card .brand {
  flex-direction: column;
  text-align: center;
}

.auth-card .brand-logo {
  width: 280px;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}

@media (max-width: 640px) {
  .auth-screen {
    padding: 16px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .auth-card .brand-logo {
    width: 220px;
  }
}

#authForm .brand h1 {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 72%, #0a3c76 100%);
  color: #fff;
  box-shadow: 8px 0 26px rgba(4, 31, 69, 0.15);
}

.sidebar .brand p {
  color: #c6d7eb;
}

.sidebar .brand {
  flex-direction: column;
  justify-content: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar .brand-logo {
  width: 150px;
  height: 150px;
  background: #fff;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.sidebar .brand > div {
  display: none;
}

.nav-tabs {
  display: grid;
  gap: 5px;
}

.nav-tab {
  border: 0;
  border-radius: 8px;
  padding: 10px 13px;
  background: transparent;
  color: #d8e5f4;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.16);
}

.company-panel {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #c6d7eb;
}

.workspace {
  min-width: 0;
  padding: 28px 32px;
}

.platform-workspace {
  width: min(1500px, 100%);
  margin: 0 auto;
}

.toolbar,
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar {
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.toolbar h2 {
  font-size: 2rem;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  outline: 3px solid rgba(79, 159, 47, 0.14);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.address-field {
  grid-column: span 2;
}

.primary-button,
.ghost-button,
.row-actions button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--green-dark);
  background: linear-gradient(180deg, #5aaa38 0%, var(--green) 100%);
  color: #fff;
  box-shadow: 0 5px 12px rgba(79, 159, 47, 0.2);
}

.ghost-button,
.row-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}

.primary-button:hover {
  background: var(--green-dark);
}

.ghost-button:hover,
.row-actions button:hover {
  border-color: #9db2cc;
  background: var(--navy-soft);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button:last-child {
  color: var(--danger);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
  border-top: 4px solid var(--green);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: 2rem;
  color: var(--navy);
}

.filter-bar,
.entry-form,
.settings-grid {
  display: grid;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.filter-bar {
  grid-template-columns: repeat(4, minmax(160px, max-content));
}

.employee-single-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 20px;
  border-top: 4px solid var(--navy);
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group-heading {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.form-actions .primary-button {
  min-width: 200px;
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--navy-soft);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h3 {
  margin: 0;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.compact-settings {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  box-shadow: none;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.settings-currency-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, var(--navy-soft), #fff);
}

.settings-currency-bar label {
  min-width: 180px;
}

.settings-currency-bar span {
  color: var(--muted);
  font-size: 13px;
}

.setting-currency-code {
  color: var(--accent-strong);
  font-weight: 800;
}

.employee-benefits-table {
  min-width: 1180px;
  table-layout: fixed;
}

.employee-benefits-table th:nth-child(1),
.employee-benefits-table th:nth-child(2) {
  width: 92px;
}

.employee-benefits-table th:nth-child(3) {
  width: 170px;
}

.employee-benefits-table th:nth-child(4) {
  width: 125px;
}

.employee-benefits-table th:nth-child(5),
.employee-benefits-table th:nth-child(6) {
  width: 110px;
}

.employee-benefits-table th:nth-child(7) {
  width: 145px;
}

.employee-benefits-table th:nth-child(8),
.employee-benefits-table th:nth-child(9) {
  width: 140px;
}

.employee-benefits-table input,
.employee-benefits-table select {
  width: 100%;
  min-width: 0;
}

.termination-adjustments-table {
  max-width: 900px;
  table-layout: fixed;
}

.termination-adjustments-table th:first-child { width: 230px; }
.termination-adjustments-table th:nth-child(2),
.termination-adjustments-table th:nth-child(3) { width: 150px; }
.termination-adjustments-table input,
.termination-adjustments-table select { width: 100%; min-width: 0; }

.settings-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.settings-tab:hover {
  background: var(--navy-soft);
  color: var(--ink);
}

.settings-tab.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.settings-panel-actions {
  display: flex;
  justify-content: flex-start;
}

.tax-settings-content {
  display: grid;
  gap: 16px;
  width: 100%;
}

.tax-window-heading,
.tax-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tax-window-heading h2 {
  margin: 0;
}

.tax-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.tax-tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.tax-tab.active {
  background: var(--navy);
  border-color: var(--navy-dark);
  color: #fff;
}

.tax-panel {
  display: none;
  gap: 14px;
}

.tax-panel.active {
  display: grid;
}

.tax-band-table {
  min-width: 720px;
}

.leave-policy-table {
  min-width: 980px;
}

.leave-liability-table {
  min-width: 620px;
}

.leave-request-card {
  gap: 18px;
}

.leave-reason-row {
  grid-template-columns: minmax(260px, 1fr);
}

.leave-register-table {
  min-width: 980px;
}

.leave-register-table td {
  line-height: 1.35;
}

.leave-register-table th:nth-child(8),
.leave-register-table td:nth-child(8) {
  min-width: 220px;
}

.attendance-view {
  gap: 16px;
}

.attendance-entry-panel,
.attendance-register-panel {
  padding: 18px;
}

.attendance-entry-form {
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(130px, 1fr)) minmax(110px, 0.7fr) minmax(170px, max-content);
  box-shadow: none;
  padding: 0;
  border: 0;
}

.bulk-attendance-form {
  grid-template-columns: minmax(220px, 1.4fr) repeat(7, minmax(120px, 1fr)) minmax(130px, max-content);
  box-shadow: none;
  padding: 0;
  border: 0;
}

.attendance-filter {
  grid-template-columns: minmax(190px, max-content);
  box-shadow: none;
  padding: 0;
  border: 0;
}

.attendance-table-wrap {
  box-shadow: none;
  border-radius: 8px;
}

.attendance-table {
  min-width: 860px;
}

.attendance-table th,
.attendance-table td {
  padding: 11px 12px;
  white-space: nowrap;
}

.attendance-table th:nth-child(4),
.attendance-table th:nth-child(5),
.attendance-table th:nth-child(6),
.attendance-table td:nth-child(4),
.attendance-table td:nth-child(5),
.attendance-table td:nth-child(6) {
  text-align: right;
}

.attendance-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.attendance-table tbody tr:hover {
  background: var(--green-soft);
}

.attendance-table .row-actions {
  justify-content: flex-end;
}

.attendance-table .row-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.payroll-run-panel {
  gap: 14px;
}

.payroll-run-actions {
  grid-template-columns: minmax(190px, max-content) repeat(5, minmax(120px, max-content));
  box-shadow: none;
  padding: 0;
  border: 0;
}

.muted-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.medium-table {
  min-width: 780px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.82rem;
  text-transform: uppercase;
  border-bottom: 2px solid #bdcbe0;
}

tbody tr:hover {
  background: #f3f8ef;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 0.78rem;
}

.danger-chip {
  background: #fff1f1;
  color: var(--danger);
}

.leave-chip {
  background: #fff7e8;
  color: #93620f;
}

.sick-chip {
  background: var(--navy-soft);
  color: var(--navy);
}

.muted-chip {
  background: #eef1f2;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--navy-dark);
  color: #fff;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--green);
}

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

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .sidebar .brand {
    flex-direction: row;
    justify-content: flex-start;
  }

  .sidebar .brand-logo {
    width: 96px;
    height: 96px;
  }

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

  .billing-summary-grid,
  .billing-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-form,
  .settings-grid,
  .filter-bar,
  .split-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .toolbar,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs,
  .metrics-grid,
  .entry-form,
  .settings-grid,
  .filter-bar,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .billing-summary-grid,
  .billing-plan-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}
@media print {
  .sidebar,
  .toolbar,
  .filter-bar,
  .entry-form,
  .settings-grid,
  .row-actions {
    display: none;
  }

  .app-shell,
  .workspace,
  .view.active {
    display: block;
    padding: 0;
  }
}

/* Clearly distinguish terminated employees on the dashboard. */
.terminated-row { background: #fff1f2; }
.terminated-row td:first-child { border-left: 4px solid #dc2626; font-weight: 700; }
