:root {
  /* Brand — Propsathi gradient #0049CA -> #5492FF */
  --primary: #0049ca;
  --primary-mid: #2d6ee0;
  --primary-soft: #5492ff;
  --primary-hover: #003ba6;
  --primary-light: #eaf2ff;
  --primary-faint: #f4f8ff;
  --primary-tint: #dbe7ff;
  --primary-text: #ffffff;

  --success: #18a957;
  --success-light: #e7f7ee;
  --warning: #f59f00;
  --warning-light: #fff5e0;
  --error: #e63946;
  --error-light: #fdecee;
  --info: #1ab8ee;
  --info-light: #e6f7fd;

  --background: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e6eaf0;
  --border-strong: #d5dbe5;
  --text-main: #1f2a44;
  --text-muted: #4f5b76;
  --text-light: #8893a8;

  /* Brand-gradient sidebar */
  --sidebar-bg: none;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(255, 255, 255, 0.18);
  --sidebar-text: rgba(255, 255, 255, 0.82);
  --sidebar-text-active: #ffffff;
  --sidebar-section-text: rgba(255, 255, 255, 0.55);
  --sidebar-icon: rgba(255, 255, 255, 0.72);

  --header-bg: #ffffff;
  --header-border: #ebeef3;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius: var(--radius-md);

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md:
    0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg:
    0 8px 24px -8px rgba(15, 23, 42, 0.12),
    0 4px 8px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl:
    0 24px 48px -12px rgba(15, 23, 42, 0.18),
    0 8px 16px -8px rgba(15, 23, 42, 0.08);
  --shadow-ring: 0 0 0 4px rgba(0, 73, 202, 0.12);

  --grad-primary: linear-gradient(135deg, #0049ca 0%, #5492ff 100%);
  --grad-primary-soft: linear-gradient(135deg,
      rgba(0, 73, 202, 0.08) 0%,
      rgba(84, 146, 255, 0.08) 100%);
  --grad-blue: linear-gradient(135deg, #1ab8ee 0%, #5492ff 100%);
  --grad-success: linear-gradient(135deg, #18a957 0%, #4cd47a 100%);
  --grad-warning: linear-gradient(135deg, #f59f00 0%, #ffc34a 100%);
  --grad-error: linear-gradient(135deg, #e63946 0%, #ff6b78 100%);
  --grad-purple: linear-gradient(135deg, #6f42d4 0%, #a472f0 100%);
  --grad-orange: linear-gradient(135deg, #f37224 0%, #ffb056 100%);
  --grad-green: linear-gradient(135deg, #18a957 0%, #4cd47a 100%);

  /* chart accent strokes */
  --accent-purple: #7c5cff;
  --accent-teal: #1ab8ee;
  --accent-orange: #f59f00;
  --accent-pink: #ec4899;

  --sidebar-width: clamp(240px, 22vw, 320px);
  --sidebar-collapsed-width: 76px;
}

[data-theme="dark"] {
  --background: #0b1220;
  --surface: #131b2c;
  --surface-alt: #18223a;
  --border: #1f2a44;
  --border-strong: #2a3650;
  --text-main: #f3f6fc;
  --text-muted: #b3becf;
  --text-light: #7c8aa3;

  --sidebar-bg: #131b2c;
  --sidebar-border: #1f2a44;
  --sidebar-hover: rgba(84, 146, 255, 0.08);
  --sidebar-active: rgba(0, 73, 202, 0.18);
  --sidebar-text: #b3becf;
  --sidebar-text-active: #ffffff;
  --sidebar-section-text: #7c8aa3;

  --primary-light: rgba(84, 146, 255, 0.14);
  --primary-faint: rgba(84, 146, 255, 0.08);
  --primary-tint: rgba(84, 146, 255, 0.22);
  --header-bg: #131b2c;
  --header-border: #1f2a44;
}

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

html,
body {
  overflow-x: hidden;
  /* height: 100%; */
}

body {
  background-color: var(--background);
  color: var(--text-main);
  font-family: "Plus Jakarta Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
  font-size: 14.9px;
  overflow: hidden;
  margin: 0;
  letter-spacing: 0.01em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  color: var(--text-main);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

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

/* --- Form Elements --- */
input,
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14.3px;
  color: var(--text-main);
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-light);
  opacity: 0.85;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--primary-soft);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

input[readonly],
textarea[readonly] {
  background-color: var(--surface-alt);
  cursor: default;
}

/* Native select chevron — uses --text-muted via SVG */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234f5b76' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

/* Number inputs — kill the ugly spinners */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Checkboxes & radios — restore native widget (the generic `input` rule
 * above sets `appearance: none`, which makes the box / dot invisible).
 * Without the explicit `auto` here, clicks fire and state flips but the
 * user sees nothing change. */
input[type="checkbox"],
input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* File inputs — restore native chrome */
input[type="file"] {
  padding: 7px 10px;
  font-weight: 500;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ----- Legacy Bootstrap input look-and-feel refresh -----
 * Pages using <input className="border-0 bg-light"/> get the new
 * polished surface-alt look automatically — no JSX migration needed.
 */
input.bg-light,
select.bg-light,
textarea.bg-light {
  background-color: var(--surface-alt) !important;
  border: 1px solid var(--border) !important;
}

input.bg-light:hover,
select.bg-light:hover,
textarea.bg-light:hover {
  border-color: var(--primary-soft) !important;
}

input.bg-light:focus,
select.bg-light:focus,
textarea.bg-light:focus {
  background-color: var(--surface) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-light) !important;
}

/* The 'border-0' utility combined with 'bg-light' was used to fake a
 * borderless look — restore a hairline for definition while keeping
 * the soft surface fill. */
input.border-0.bg-light,
select.border-0.bg-light,
textarea.border-0.bg-light {
  border: 1px solid var(--border) !important;
}

/* The classic uppercase form label ('small fw-bold text-muted') —
 * give it consistent tracking and the new muted color. */
label.fw-bold.text-muted.small,
label.small.fw-bold.text-muted {
  font-size: 11.6px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 6px;
}

button {
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary {
  background-image: var(--grad-primary);
  background-color: var(--primary);
  color: var(--primary-text);
  border: none;
  padding: 9px 18px;
  font-size: 14.3px;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px -4px rgba(0, 73, 202, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -6px rgba(0, 73, 202, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

/* --- Modal & Dialog System --- */
.cross {
  background: transparent;
  border: none;
  padding: 6px;
  line-height: 1;
  color: var(--text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
}

.cross:hover {
  background-color: var(--error-light);
  color: var(--error);
}

.cross i {
  font-size: 17.6px;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  padding: 20px;
}

#overlay>* {
  pointer-events: all;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(8, 14, 30, 0.45);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: all;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.15),
    0 15px 30px -10px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: slideUp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 2002;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad-primary);
  z-index: 10;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  background-color: var(--surface-alt);
  border: 1px solid var(--border-strong);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  background-color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* --- Table Styles --- */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: var(--surface-alt);
  padding: 13px 18px;
  text-align: left;
  font-size: 11.6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

th:first-child {
  padding-left: 22px;
}

th:last-child {
  padding-right: 22px;
}

td {
  padding: 14px 18px;
  font-size: 14.3px;
  font-weight: 500;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
  vertical-align: middle;
}

td:first-child {
  padding-left: 22px;
}

td:last-child {
  padding-right: 22px;
}

tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.018);
}

/* Sharp, non-bold cell text. Bootstrap utility classes (fw-bold, fw-700,
 * fw-800, fw-semibold) and <strong>/<b> emphasis inside data cells get
 * flattened to the same medium weight so rows scan cleanly. Status
 * badges, buttons, and other class-styled chips keep their own weights. */
td strong,
td b,
td .fw-bold,
td .fw-bolder,
td .fw-800,
td .fw-700,
td .fw-semibold {
  font-weight: 500 !important;
}

tr:hover td {
  background: var(--primary-faint);
}

tr:last-child td {
  border-bottom: none;
}

.btn-light-primary {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  transition: all 0.2s ease;
}

.btn-light-primary:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-1px);
}

.btn-light-success {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-light);
  transition: all 0.2s ease;
}

.btn-light-success:hover {
  background-color: var(--success);
  color: white;
  transform: translateY(-1px);
}

.hover-up {
  transition: all 0.2s ease;
}

.hover-up:hover {
  transform: translateY(-2px);
}

/* --- Theme Aware Utilities --- */
[data-theme="dark"] .bg-white {
  background-color: var(--surface) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .border-light {
  border-color: var(--border) !important;
}

[data-theme="dark"] .text-main {
  color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--background) !important;
  color: var(--text-main) !important;
}

.card-premium {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.card-premium:hover {
  box-shadow: var(--shadow-md);
}

/* SmartHR-style surface card */
.card-soft {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.1px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.pill-success {
  background: var(--success-light);
  color: var(--success);
}

.pill-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.pill-error {
  background: var(--error-light);
  color: var(--error);
}

.pill-info {
  background: var(--info-light);
  color: var(--info);
}

.pill-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.pill-muted {
  background: var(--surface-alt);
  color: var(--text-muted);
}

/* Gradient text utility (brand) */
.text-gradient {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Icon bubble (left side of stat cards) */
.icon-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
  flex-shrink: 0;
}

.icon-bubble-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.icon-bubble-success {
  background: var(--success-light);
  color: var(--success);
}

.icon-bubble-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.icon-bubble-error {
  background: var(--error-light);
  color: var(--error);
}

.icon-bubble-info {
  background: var(--info-light);
  color: var(--info);
}

/* Subtle gradient halo behind stat cards (SmartHR signature) */
.halo-primary {
  background: var(--grad-primary-soft);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Allow row dropdowns (action menus) to escape the table viewport.
   react-data-table-component clips its inner containers by default; we
   need them visible so the absolutely-positioned action menu doesn't
   get cut off when the table has only a few rows. */
.rdt_Table,
.rdt_TableBody,
.rdt_TableRow,
.rdt_TableCell {
  overflow: visible !important;
}

.rdt_TableRow {
  /* sane stacking context so the open menu's z-index resolves correctly */
  position: relative;
}

.rdt_TableRow:hover {
  z-index: 1;
}