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

/* Hide number input spinners for all browsers */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}
/* Locked (system calculated) fields */
.locked-field {
  background: #f2f3f7 !important;
  color: #a0a7b8 !important;
  border: 1px solid #e0e3ea !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
  box-shadow: none !important;
}
:root {
  --bg: #f7fafc;
  --bg-2: #eef3f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f1f6ff;
  --text: #0f1c34;
  --muted: #60728d;
  --line: #d7e2f0;
  --line-strong: #b6c7dc;
  --focus: #1d4ed8;
  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --danger: #b42332;
  --salary: #0f67c6;
  --increment: #d97706;
  --gross: #157347;
  --advance: #8b6b10;
  --deduction: #b91c2d;
  --absent: #9a4f07;
  --net: #0f7a55;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 10px 24px rgba(16, 24, 40, 0.08);
  --font-sans: "Inter", "Segoe UI Variable", "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  background:
    radial-gradient(950px 280px at 16% -6%, #ffffff, transparent 58%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1700px, 97vw);
  margin: 16px auto 26px;
}

.auth-view {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 0.95fr);
}

.brand,
.auth-card,
.topbar,
.metrics article,
.table-wrap,
#payslipDialog .dialog-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.brand {
  padding: 36px 32px;
  border-top: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background:
    radial-gradient(circle at top center, rgba(59, 130, 246, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 253, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 18px 36px rgba(148, 163, 184, 0.14);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.73rem;
  font-weight: 700;
  color: #5c6d84;
}

.brand h1,
.topbar h1 {
  margin: 8px 0 6px;
  line-height: 1.1;
  font-size: clamp(1.7rem, 1.9vw, 2.2rem);
  font-weight: 800;
}

.brand h1 {
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  letter-spacing: -0.05em;
  color: #142542;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 34rem;
  line-height: 1.6;
}

.brand-logo {
  display: block;
  width: min(360px, 90%);
  height: auto;
  margin: 10px auto 8px;
}

.auth-card {
  padding: 26px 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 36px rgba(148, 163, 184, 0.14);
}

.panel h2 {
  margin: 4px 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-switch button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(37, 86, 214, 0.16);
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2f3f56;
}

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

input,
select,
textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input {
  height: 42px;
  padding: 0 12px;
}

.password-field {
  position: relative;
  margin-top: 4px;
}

.password-field input {
  margin-top: 0;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 30px;
  min-height: 30px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #2f4766;
  font-size: 1rem;
  line-height: 1;
}

.password-toggle:hover {
  background: #f2f6fb;
}

.password-toggle[aria-pressed="true"] {
  background: #e8f0ff;
  border-color: #8eb2ea;
}

select {
  height: 42px;
  padding: 0 12px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7c93 50%), linear-gradient(135deg, #6b7c93 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

textarea {
  min-height: 70px;
  resize: vertical;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

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

button:active {
  transform: translateY(1px);
}

.ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: #20324c;
}

.ghost:hover {
  background: #f2f6fb;
}

#addEmployeeBtn {
  background: #4a24f5;
  border-color: #3d1fe0;
}

#addEmployeeBtn:hover {
  background: #3d1fe0;
}

.danger {
  background: var(--danger);
  border-color: #9b1e2a;
}

.danger:hover {
  background: #9b1e2a;
}

.status-msg {
  min-height: 24px;
  margin: 10px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #466083;
}

#saveStatus {
  font-size: 0.88rem;
  font-style: italic;
  color: #059669;
}

.status-info {
  color: #1d4e89;
}

.status-success {
  color: #176942;
}

.status-error {
  color: #b91c2d;
}

.recover-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f9fbff 0%, #f3f8fe 100%);
}

.recover-box > summary {
  cursor: pointer;
  font-weight: 700;
  color: #1f3d66;
  margin-bottom: 8px;
}

.recover-box > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.recover-form label {
  margin-bottom: 8px;
}

.recover-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  margin-bottom: 0;
  box-shadow: var(--shadow-1);
}

.recover-section h3 {
  margin: 2px 0 10px;
  font-size: 1rem;
  color: #1f3d66;
}

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

.recover-section label {
  margin-bottom: 10px;
}

.recover-form button {
  margin-top: 4px;
  width: auto;
  min-width: 220px;
}

@media (min-width: 1100px) {
  .recover-form {
    grid-template-columns: 1fr 1fr;
  }

  .recover-form .recover-section:nth-child(3) {
    grid-column: 1 / -1;
  }
}

.app-view {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 0;
  min-height: calc(100vh - 40px);
}

.side-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 18px 16px;
  border-radius: 0;
  border: none;
  background: #06164a;
  box-shadow: none;
}

.side-rail::before {
  content: "Routes Payroll";
  color: #f2f7ff;
  font-size: 2rem;
  font-weight: 800;
  margin: 6px 12px 18px;
}

.rail-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #c7d4ef;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 0;
  font-weight: 700;
}

.rail-btn::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid currentColor;
}

.rail-btn::after {
  content: attr(aria-label);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
}

.rail-btn:hover,
.rail-btn.active {
  background: #202f64;
  border-color: #2a3a73;
  color: #ffffff;
}

.app-main {
  min-width: 0;
  padding: 18px 26px;
  background: linear-gradient(180deg, #edf2f9, #e6ecf6);
}

.topbar {
  padding: 0 0 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  background: transparent;
  box-shadow: none;
  border: none;
}

.topbar h1 {
  letter-spacing: 0.02em;
  font-weight: 400;
  text-transform: uppercase;
  margin-top: 4px;
  font-size: 2.6rem;
}

.topbar .subtitle {
  display: none;
}

.topbar .eyebrow {
  display: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.verification-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

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

.verification-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin: 16px 0;
}

.verification-card,
.verification-schema-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
  padding: 16px;
}

.verification-schema-card {
  margin-top: 14px;
}

.verification-schema-card summary {
  cursor: pointer;
  font-weight: 800;
  color: #1f3d66;
}

.verification-schema-card pre {
  overflow-x: auto;
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.78rem;
}

.verification-card.span-2,
.verification-form-actions.span-2 {
  grid-column: 1 / -1;
}

.verification-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.verification-card h3 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.verification-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.verification-fields .span-2 {
  grid-column: span 2;
}

.camera-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.camera-shell video,
.camera-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-shell img.empty {
  background:
    linear-gradient(135deg, #f8fafc 25%, #eef3f9 25%, #eef3f9 50%, #f8fafc 50%, #f8fafc 75%, #eef3f9 75%);
  background-size: 22px 22px;
}

.camera-shell img.empty::after {
  content: "No photo";
}

.verification-actions,
.verification-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.phone-camera-access {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.phone-camera-access strong,
.phone-camera-access span {
  display: block;
}

.phone-camera-access strong {
  color: #1f3d66;
  font-size: 0.86rem;
}

.phone-camera-access span {
  color: var(--muted);
  font-size: 0.78rem;
  word-break: break-all;
}

.phone-camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.link-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 12px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.settings-file-label.compact {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin: 0;
}

.id-proof-list {
  display: grid;
  gap: 10px;
}

.id-proof-row {
  display: grid;
  grid-template-columns: 0.85fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.switch-row,
.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 10px;
  font-weight: 700;
}

.switch-row input,
.check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.internal-only-card {
  border-color: #fed7aa;
  background: #fffaf3;
}

.sensitive-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.76rem;
  font-weight: 800;
}

.verification-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .verification-grid,
  .verification-fields,
  .id-proof-row {
    grid-template-columns: 1fr;
  }

  .phone-camera-access {
    align-items: stretch;
    flex-direction: column;
  }

  .phone-camera-actions {
    justify-content: flex-start;
  }

  .verification-fields .span-2 {
    grid-column: auto;
  }
}

@media print {
  .side-rail,
  .topbar,
  .toolbar,
  .verification-schema-card,
  .internal-only-card,
  [data-sensitive="internal_only"],
  .verification-form-actions,
  #verificationRecordsBody,
  #appMessage,
  #saveStatus {
    display: none !important;
  }
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f7fb;
}

.inline-field span {
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 700;
  color: #2f4766;
}

.inline-field input,
.inline-field select {
  margin-top: 0;
  min-width: 170px;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  list-style: none;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #20324c;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu summary::after {
  content: " ▾";
}

.menu-sheet {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 26px rgba(17, 26, 39, 0.18);
  z-index: 30;
}

.menu-sheet .ghost {
  width: 100%;
  justify-content: flex-start;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.upload-label input {
  display: none;
}

.metrics {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.metrics article {
  position: relative;
  overflow: hidden;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid #d7deea;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(17, 29, 45, 0.06);
}

.metrics article::before {
  content: none;
}

.metrics p {
  margin: 0;
  color: #9aabc4;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  color: #1b2a47;
  font-size: clamp(1.7rem, 2.2vw, 2.1rem);
  font-weight: 800;
}

.metrics article:nth-child(3) strong { color: #16b579; }
.metrics article:nth-child(4) strong { color: #f2a73d; }

.dashboard-insights {
  width: min(1280px, calc(100% - 48px));
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 16px;
}

.dashboard-panel {
  border: 1px solid #d8e3ef;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 253, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 32px rgba(148, 163, 184, 0.12);
  padding: 19px 19px 17px;
}

.dashboard-panel-hero {
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 34%),
    radial-gradient(circle at left bottom, rgba(14, 165, 233, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(248, 252, 255, 0.98), #ffffff 70%);
}

.dashboard-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7c90ac;
}

.dashboard-panel-head h3 {
  margin: 0;
  font-size: 1.24rem;
  color: #22314d;
}

.dashboard-panel-note {
  margin: 0;
  max-width: 280px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #64748b;
  text-align: right;
}

.dashboard-summary-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-stat-card {
  border: 1px solid #dce6f2;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px 14px 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(148, 163, 184, 0.08);
}

.dashboard-stat-card.compact {
  min-height: 120px;
}

.dashboard-stat-card p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a8da8;
}

.dashboard-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: #1f2e49;
}

.dashboard-stat-card span {
  display: block;
  margin-top: 7px;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #64748b;
}

.dashboard-stat-card.tone-blue strong { color: #2158d4; }
.dashboard-stat-card.tone-green strong { color: #0f7a55; }
.dashboard-stat-card.tone-violet strong { color: #5b4bc4; }
.dashboard-stat-card.tone-amber strong { color: #a16207; }

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-list-item {
  border: 1px solid #e3ebf5;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  padding: 12px 14px;
}

.dashboard-list-item strong {
  display: block;
  margin: 0;
  font-size: 0.96rem;
  color: #273854;
}

.dashboard-list-item span {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #64748b;
}

.empty-dashboard-item {
  background: #f8fbff;
}

.employee-mgmt {
  margin-top: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #d6deea;
  box-shadow: 0 8px 20px rgba(17, 29, 45, 0.06);
}

.employee-form {
  padding: 14px 18px 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
}

.employee-status-fields {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  padding: 10px 12px;
  border: 1px dashed #cbd7e6;
  border-radius: 10px;
  background: #f8fbff;
}

.employee-status-fields .subtitle {
  grid-column: 1 / -1;
  margin: 0;
  font-weight: 700;
  color: #3f5778;
}

.employee-form-actions {
  grid-column: span 5;
  display: flex;
  gap: 8px;
}

.employee-list-wrap {
  padding: 0 0 8px;
}

.employee-list-wrap table {
  min-width: 980px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.status-pill.working {
  color: #0a6a44;
  background: #e9f8f0;
  border: 1px solid #b7e3cc;
}

.status-pill.leave {
  color: #8b5a04;
  background: #fff5df;
  border: 1px solid #f4deb0;
}

.status-pill.terminated {
  color: #a01f2d;
  background: #fdeef0;
  border: 1px solid #f5c6cd;
}

.tenure-cell,
.tenure-money {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.tenure-cell strong {
  color: #1f2f46;
  font-size: 0.92rem;
}

.tenure-cell span,
.tenure-money span {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.tenure-highlight {
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: #fffbeb;
  padding: 8px 10px;
}

.tenure-highlight strong {
  color: #92400e;
}

.emp-name-cell {
  display: grid;
  gap: 4px;
}

.emp-name-cell small {
  color: #5e7087;
  font-size: 0.75rem;
}

.table-wrap {
  margin-top: 12px;
  padding: 0;
  background: #fff;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #d6deea;
  box-shadow: 0 8px 20px rgba(17, 29, 45, 0.06);
}

#payrollSection table {
  min-width: 2350px;
}

.payroll-cards {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.payroll-entry-card {
  border: 1px solid #d6deea;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.payroll-modern {
  border-radius: 18px;
  border-color: #bcd1ec;
  background: #ffffff;
  box-shadow:
    0 18px 36px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

.payroll-modern-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
}

.payroll-modern-main {
  border-right: 1px solid #e4ebf5;
}

.payroll-modern-side {
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.payroll-stack-section {
  position: relative;
  padding: 16px 18px;
  border-bottom: 1px solid #e4ebf5;
  background: #fff;
}

.payroll-stack-section::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: #d7e3ef;
}

.payroll-stack-section:last-child {
  border-bottom: none;
}

.payroll-stack-section h3 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #eef3f9;
  padding-bottom: 8px;
}

.payroll-section-profile {
  background: linear-gradient(90deg, #f8fbff 0%, #ffffff 44%);
}

.payroll-section-profile::before {
  background: #64748b;
}

.payroll-section-profile h3 {
  color: #475569;
}

.payroll-section-salary {
  background: linear-gradient(90deg, #eff6ff 0%, #ffffff 46%);
}

.payroll-section-salary::before {
  background: #1e40af;
}

.payroll-section-salary h3,
.payroll-section-salary .field-tag {
  color: #1e40af;
}

.payroll-section-advance {
  background: linear-gradient(90deg, #fff8e7 0%, #ffffff 46%);
}

.payroll-section-advance::before {
  background: #d97706;
}

.payroll-section-advance h3 {
  color: #9a4f07;
}

.payroll-section-deduction {
  background: linear-gradient(90deg, #fff1f2 0%, #ffffff 46%);
}

.payroll-section-deduction::before {
  background: #b91c2d;
}

.payroll-section-deduction h3 {
  color: #9f1d2c;
}

.payroll-section-summary {
  background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 46%);
}

.payroll-section-summary::before {
  background: #0f7a55;
}

.payroll-section-summary h3 {
  color: #0f7a55;
}

.status-box {
  margin-top: 4px;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid #c6d4e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.status-box.active {
  color: #047857;
  background: #e9f8f0;
  border-color: #a5dfc5;
}

.status-box.leave {
  color: #9a5b08;
  background: #fff5df;
  border-color: #f4deb0;
}

.status-box.terminated {
  color: #a61b29;
  background: #fdeef1;
  border-color: #f2c8cf;
}

.status-note {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: #627792;
}

.field-tag {
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #2563eb;
}

.advance-remained-alert {
  color: #c81e1e !important;
  font-weight: 800;
}

.advance-remained-input {
  color: #c81e1e !important;
}

.strong-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.strong-line span {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.strong-line b {
  font-size: 1.8rem;
  letter-spacing: -0.01em;
}

.payroll-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px 12px;
  align-items: start;
}

.payroll-fields .read {
  border: 1px solid #dbe6f5;
  border-radius: 8px;
  padding: 11px 12px;
  background: #f8fbff;
  font-weight: 700;
}

.payroll-section-salary input:not(.locked-field),
.payroll-section-salary select {
  border-color: #9fbaf0;
  background: #f7fbff;
}

.payroll-section-advance input:not(.locked-field) {
  border-color: #e5bd78;
  background: #fffaf0;
}

.payroll-section-deduction input:not(.locked-field) {
  border-color: #ebb6bf;
  background: #fff7f8;
}

.payroll-section-summary input,
.payroll-section-summary .locked-field {
  border-color: #a9dbc3 !important;
  background: #f4fbf7 !important;
}

.payroll-fields .row-actions {
  flex-direction: row;
}

.emp-picker.working {
  border-left: 4px solid #0a6a44;
  background: #eefbf4;
  color: #0a6a44;
  font-weight: 800;
}

.emp-picker.leave {
  border-left: 4px solid #b17807;
  background: #fff6e6;
  color: #8b5a04;
  font-weight: 800;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 24px 24px;
  border-bottom: 1px solid #dfe7f1;
  background: #ffffff;
}

.table-head h2 {
  margin: 0;
  font-size: clamp(1.95rem, 2.1vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.table-head p {
  margin: 0;
  color: #627792;
  font-size: 0.92rem;
  font-weight: 600;
}

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

th,
td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e1e8f2;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #d9dee6;
  color: #1a2435;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-top: 1px solid #dee6f1;
}

.group-row th {
  top: 0;
  z-index: 4;
  background: #e4e8ef;
  color: #36475f;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-align: center;
  padding-top: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid #cdd8e5;
}

.detail-row th {
  top: 36px;
  z-index: 3;
  white-space: nowrap;
  line-height: 1.2;
}

#payrollSection td {
  white-space: nowrap;
}

#payrollSection td:nth-child(2),
#payrollSection td:nth-child(17),
#payrollSection td:nth-child(3) {
  white-space: normal;
}

#payrollSection .detail-row th:nth-child(1),
#payrollSection td:nth-child(1) { min-width: 130px; }
#payrollSection .detail-row th:nth-child(2),
#payrollSection td:nth-child(2) { min-width: 230px; }
#payrollSection .detail-row th:nth-child(3),
#payrollSection td:nth-child(3) { min-width: 170px; }
#payrollSection .detail-row th:nth-child(4),
#payrollSection td:nth-child(4),
#payrollSection .detail-row th:nth-child(5),
#payrollSection td:nth-child(5),
#payrollSection .detail-row th:nth-child(6),
#payrollSection td:nth-child(6) { min-width: 135px; }
#payrollSection .detail-row th:nth-child(7),
#payrollSection td:nth-child(7),
#payrollSection .detail-row th:nth-child(8),
#payrollSection td:nth-child(8),
#payrollSection .detail-row th:nth-child(9),
#payrollSection td:nth-child(9) { min-width: 140px; }
#payrollSection .detail-row th:nth-child(10),
#payrollSection td:nth-child(10),
#payrollSection .detail-row th:nth-child(11),
#payrollSection td:nth-child(11),
#payrollSection .detail-row th:nth-child(12),
#payrollSection td:nth-child(12),
#payrollSection .detail-row th:nth-child(13),
#payrollSection td:nth-child(13) { min-width: 150px; }
#payrollSection .detail-row th:nth-child(14),
#payrollSection td:nth-child(14),
#payrollSection .detail-row th:nth-child(15),
#payrollSection td:nth-child(15) { min-width: 150px; }
#payrollSection .detail-row th:nth-child(16),
#payrollSection td:nth-child(16) { min-width: 210px; }
#payrollSection .detail-row th:nth-child(17),
#payrollSection td:nth-child(17) { min-width: 190px; }

#payrollSection .row-actions {
  flex-direction: row;
  gap: 8px;
}

#payrollSection .mini {
  min-width: 86px;
  min-height: 36px;
  font-size: 0.85rem;
}

#payrollSection .table-head {
  border-bottom: 1px solid #e3ebf4;
}

tbody tr {
  background: #fff;
}

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

td.read {
  background: #f1f5fb;
  font-weight: 800;
  white-space: nowrap;
}

.th-salary {
  color: var(--salary);
}

.th-increment {
  color: var(--increment);
}

.th-gross {
  color: var(--gross);
}

.th-advance {
  color: var(--advance);
}

.th-deduction {
  color: var(--deduction);
}

.th-absent {
  color: var(--absent);
}

.th-net {
  color: var(--net);
}

.money-gross {
  color: var(--gross);
}

.money-advance {
  color: var(--advance);
}

.money-deduction {
  color: var(--deduction);
}

.money-net {
  color: var(--net);
}

.field-salary {
  border-left: 3px solid var(--salary);
}

.field-increment {
  border-left: 3px solid var(--increment);
}

.field-advance {
  border-left: 3px solid var(--advance);
}

.field-deduction {
  border-left: 3px solid var(--deduction);
}

.field-absent {
  border-left: 3px solid var(--absent);
}

.empty {
  padding: 30px;
  text-align: center;
  font-size: 1rem;
  color: #5f728d;
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.active-report-row {
  background: rgba(47, 78, 196, 0.08);
}

.mini {
  min-height: 40px;
  font-size: 0.9rem;
  min-width: 132px;
  padding: 0 16px;
  border-radius: 10px;
}

.icon-mini {
  min-width: 44px;
  width: 44px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.kpi-card {
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #dce6f4;
  background: #fff;
}

.kpi-card p {
  margin: 0;
  color: #556b88;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
  color: #0f1c34;
}

.kpi-card.net {
  background: linear-gradient(180deg, #0f8f58, #0a7348);
  border-color: #0f8f58;
  color: #fff;
}

.kpi-card.net p {
  color: #dcfce7;
}

.kpi-card.net strong {
  color: #fff;
}

.net-sub {
  margin-top: 10px;
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #dcfce7;
  font-weight: 700;
}

.kpi-card.soft h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.kpi-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #334155;
  padding: 5px 0;
}

.kpi-line.total {
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 800;
}

.kpi-card.amber {
  background: #fff7e6;
  border-color: #f1d39a;
}

.kpi-card.amber p {
  color: #9a6708;
}

.kpi-card.amber strong {
  color: #7c5408;
}

.payroll-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 18px;
  border-top: 1px solid #e4ebf5;
  background: #fff;
}

.payroll-footer label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.payroll-footer textarea {
  margin-top: 8px;
  min-height: 90px;
}

.payroll-footer .row-actions {
  flex-direction: row;
  align-items: flex-end;
}

.payroll-footer .mini {
  background: #162239;
  border-color: #162239;
  min-width: 200px;
}

.payroll-footer .mini:hover {
  background: #0f1a2f;
}

.payroll-footer .mini.danger {
  background: #ffffff;
  border-color: #fecaca;
  color: #dc2626;
}

.payroll-footer .mini.danger:hover {
  background: #fff1f2;
}

.payroll-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 1.7rem;
}

.payroll-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  color: #4d6482;
}

.payroll-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.payroll-legend .dot.salary { background: #1e40af; }
.payroll-legend .dot.increment { background: #d97706; }
.payroll-legend .dot.gross { background: #0f8f58; }
.payroll-legend .dot.deduction { background: #b91c2d; }

.table-wrap {
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: #9fb0c4 transparent;
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #9fb0c4;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #829ab5;
  background-clip: padding-box;
}

#payslipDialog {
  width: min(920px, 95vw);
  border: none;
  padding: 0;
  background: transparent;
}

#payslipDialog::backdrop {
  background: rgba(14, 22, 37, 0.5);
}

#payslipDialog .dialog-content {
  padding: 18px;
  color: var(--text);
  box-shadow: var(--shadow-2);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-head h2 {
  margin: 0;
}

.payslip-preview {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.payslip-sheet {
  width: min(148mm, 100%);
  min-height: 210mm;
  padding: 9mm;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
}

.payslip-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e7edf3;
}

.payslip-sheet-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.payslip-sheet-brand h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.2vw, 2.3rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #17223b;
  text-transform: uppercase;
}

.payslip-sheet-brand p {
  margin: 6px 0 0;
  font-size: 0.94rem;
  font-weight: 600;
  color: #64748b;
}

.payslip-sheet-logo {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #d8e0ea;
  flex-shrink: 0;
}

.payslip-sheet-period {
  text-align: right;
  flex-shrink: 0;
}

.payslip-sheet-period strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  font-weight: 800;
  color: #111827;
}

.payslip-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.payslip-identity {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

.payslip-identity strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.25;
  font-weight: 700;
  color: #111827;
}

.payslip-financials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-bottom: 26px;
}

.payslip-panel h3 {
  margin: 0 0 12px;
  padding-bottom: 4px;
  font-size: 1.02rem;
  line-height: 1.2;
  font-weight: 800;
  border-bottom: 2px solid #111827;
}

.payslip-panel-addition h3 {
  color: #047857;
  border-color: #0f9f78;
}

.payslip-panel-deduction h3 {
  color: #b91c1c;
  border-color: #ef4444;
}

.payslip-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payslip-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid #eef2f7;
}

.payslip-line span {
  font-size: 0.98rem;
  line-height: 1.35;
  color: #64748b;
}

.payslip-line strong {
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 700;
  color: #111827;
  text-align: right;
}

.payslip-line-total {
  border-bottom: none;
  padding-top: 14px;
}

.payslip-line-total span {
  font-weight: 700;
  color: #1f2937;
}

.payslip-line-total strong {
  font-size: 1.6rem;
  font-weight: 800;
}

.payslip-line-highlight {
  background: #f8fafc;
  padding-left: 8px;
  padding-right: 8px;
}

.payslip-line-highlight span,
.amount-red {
  color: #ef2b24;
  font-weight: 700;
}

.amount-green {
  color: #06a168;
}

.amount-underline {
  padding-bottom: 2px;
  border-bottom: 2px solid #111827;
}

.advance-remained-line,
.payslip-line-total:has(.amount-red-large) {
  background: #fff1f2;
  border-radius: 8px;
  padding-left: 10px;
  padding-right: 10px;
}

.amount-red-large {
  color: #7f1d1d;
  font-size: 1.8rem;
  font-weight: 800;
}

.payslip-note-strip {
  margin-top: auto;
  padding-top: 16px;
  border-top: 4px double #dce5ef;
}

.payslip-note-strip p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #5b708c;
}

.payslip-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-top: 28px;
}

.payslip-comment {
  flex: 1;
  min-width: 0;
}

.payslip-comment p {
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid #d8e0ea;
  font-size: 0.96rem;
  line-height: 1.5;
  color: #64748b;
  font-style: italic;
}

.payslip-net {
  width: 220px;
  text-align: right;
  flex-shrink: 0;
}

.payslip-net-box {
  display: inline-block;
  margin-top: 6px;
  min-width: 170px;
  padding: 14px 18px;
  border: 2px solid #17223b;
  border-radius: 8px;
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #202226;
  text-align: center;
  background: #ffffff;
}

.payslip-signoff {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 48px;
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 700;
  color: #8ca0bf;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.payslip-signature {
  width: 190px;
  padding-top: 8px;
  border-top: 1px solid #cbd5e1;
  text-align: center;
}

.dialog-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#companyDialog {
  width: min(520px, 95vw);
  border: none;
  padding: 0;
  background: transparent;
}

#companyDialog::backdrop {
  background: rgba(14, 22, 37, 0.5);
}

.company-dialog-content {
  padding: 18px;
}

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

  .side-rail {
    flex-direction: row;
    justify-content: center;
    padding: 8px;
  }

  .rail-btn {
    width: auto;
    min-height: 44px;
    padding: 0 12px;
    flex-direction: row;
    font-size: 0;
  }

  .rail-btn::after {
    font-size: 0.8rem;
  }

  .side-rail::before {
    display: none;
  }
}

@media (max-width: 1080px) {
  .auth-view {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

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

  .employee-form {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .employee-status-fields {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .employee-form-actions {
    grid-column: span 2;
  }

  #installBtn,
  #addEmployeeBtn,
  .danger {
    width: 100%;
  }

  .payslip-sheet {
    min-height: auto;
    padding: 22px;
  }

  .payslip-sheet-header,
  .payslip-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .payslip-sheet-period,
  .payslip-net {
    text-align: left;
    width: 100%;
  }

  .payslip-identity,
  .payslip-financials {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .payslip-net-box {
    min-width: 0;
    width: 100%;
    font-size: 2.3rem;
  }

  .payslip-signoff {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  #reportsSection .table-head p {
    text-align: left;
    max-width: none;
  }

  .dashboard-insights {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-head {
    flex-direction: column;
  }

  .dashboard-panel-note {
    text-align: left;
    max-width: none;
  }

  .dashboard-summary-cards,
  #reportsSection .reports-summary-cards {
    grid-template-columns: 1fr;
  }

  #reportsSection .employee-list-wrap td .row-actions {
    flex-wrap: wrap;
  }

  .payroll-fields {
    grid-template-columns: 1fr;
  }

  .payroll-modern-grid {
    grid-template-columns: 1fr;
  }

  .payroll-modern-main {
    border-right: none;
    border-bottom: 1px solid #e4ebf5;
  }

  .payroll-footer {
    grid-template-columns: 1fr;
  }

  .payroll-footer .row-actions {
    justify-content: flex-start;
  }

  .payroll-footer .mini {
    min-width: 170px;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(96vw, 680px);
    margin-top: 10px;
  }

  .brand,
  .auth-card,
  .topbar {
    padding: 14px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .employee-form {
    grid-template-columns: 1fr;
  }

  .employee-status-fields {
    grid-template-columns: 1fr;
  }

  .employee-form-actions {
    grid-column: span 1;
    flex-direction: column;
  }

  .inline-field {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-field input,
  .toolbar > button,
  .action-menu,
  .action-menu summary {
    width: 100%;
  }

  .menu-sheet {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .table-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .dialog-actions button {
    width: 100%;
  }
}

/* ===== 2026 Professional Theme Override ===== */
body {
  background:
    radial-gradient(1200px 420px at 18% -12%, rgba(255, 255, 255, 0.98), transparent 54%),
    radial-gradient(900px 340px at 100% 0%, rgba(226, 239, 255, 0.75), transparent 46%),
    linear-gradient(180deg, #f7fbff 0%, #edf4fb 100%);
  color: #1e293b;
}

.app-view {
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.side-rail {
  background:
    linear-gradient(180deg, #08214a 0%, #0d2d61 58%, #153871 100%);
  padding: 20px 18px;
}

.side-rail::before {
  content: "ROUTES PAYROLL";
  font-size: 2.2rem;
  line-height: 1;
  margin: 8px 10px 24px;
  color: #ffffff;
}

.rail-btn {
  min-height: 48px;
  border-radius: 10px;
  color: #cdd8ea;
}

.rail-btn:hover,
.rail-btn.active {
  background: #2c62d5;
  border-color: #2c62d5;
  color: #ffffff;
}

.app-main {
  background:
    linear-gradient(180deg, #eef5fb 0%, #e6eef7 100%);
  padding: 0 0 26px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #dbe7f4;
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.10);
  padding: 16px 24px;
}

.topbar h1 {
  display: none;
}

.toolbar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(220px, 1fr) auto auto auto;
  align-items: end;
  gap: 14px;
}

.inline-field {
  background: linear-gradient(180deg, #fcfdff 0%, #f5f9fd 100%);
  border-color: #d6e3f0;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 10px 12px 8px;
  margin: 0;
}

.inline-field span {
  color: #7f91aa;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}

.inline-field input,
.inline-field select {
  margin-top: 0;
  height: 54px;
  border-radius: 14px;
  border-color: #cad8e8;
  font-size: 0.98rem;
  font-weight: 600;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

#addEmployeeBtn {
  background: #2456d6;
  border-color: #2456d6;
  box-shadow: 0 12px 24px rgba(37, 86, 214, 0.18);
  min-height: 54px;
  padding: 0 22px;
  border-radius: 14px;
}

#addCompanyBtn,
.action-menu {
  display: none !important;
}

#addEmployeeBtn:hover {
  background: #1d47b8;
}

.danger {
  background: #dc2626;
  border-color: #dc2626;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 14px;
}

.danger:hover {
  background: #b91c1c;
}

button,
.action-menu summary {
  font-size: 0.95rem;
  font-weight: 700;
}

#installBtn {
  min-height: 54px;
  padding: 0 18px;
  border-radius: 14px;
  border-color: #c9d8e8;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: 0 10px 18px rgba(148, 163, 184, 0.08);
}

input,
select,
textarea {
  font-size: 0.96rem;
}

.panel p,
.subtitle,
.table-head p,
.settings-card p {
  font-size: 0.96rem;
}

.metrics {
  display: none !important;
}

#employeesSection,
#payrollSection,
#settingsSection,
#reportsSection,
.dashboard-insights,
#saveStatus {
  width: min(1280px, calc(100% - 68px));
  margin: 22px auto 0;
}

#employeesSection,
#payrollSection,
#settingsSection {
  border-radius: 18px;
  border: 1px solid #d7e3ef;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 38px rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(8px);
}

#settingsSection .table-head h2 {
  font-size: 2.3rem;
}

#settingsSection {
  overflow: hidden;
}

#settingsSection .table-head {
  background:
    radial-gradient(circle at right top, rgba(37, 99, 235, 0.10), transparent 28%),
    linear-gradient(180deg, #fdfefe 0%, #f5f9fd 100%);
}

#settingsSection .table-head p {
  color: #667b96;
  font-size: 0.98rem;
}

.settings-grid {
  padding: 24px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.settings-card {
  border: 1px solid #dce8f4;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 254, 0.98));
  padding: 18px 18px 17px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 12px 28px rgba(148, 163, 184, 0.10);
}

.settings-card h3 {
  margin: 0;
  font-size: 1.18rem;
  color: #20334f;
  letter-spacing: -0.02em;
}

.settings-card p {
  margin: 7px 0 15px;
  color: #657c97;
  font-weight: 600;
  line-height: 1.5;
}

#reportsSection .reports-summary-card {
  padding-top: 20px;
  padding-bottom: 18px;
}

#reportsSection .reports-summary-head {
  margin-bottom: 16px;
}

#reportsSection .reports-summary-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#reportsSection {
  border-radius: 18px;
  border: 1px solid #d6deea;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

#reportsSection .table-head {
  padding: 26px 32px;
}

#reportsSection .table-head h2 {
  font-size: clamp(2.2rem, 2.6vw, 3rem);
  color: #22314d;
}

#reportsSection .table-head p {
  max-width: 760px;
  text-align: right;
  font-size: 0.94rem;
}

#reportsSection .settings-card {
  margin: 0 34px;
  border: 1px solid #d8e5f4;
  border-radius: 18px;
  padding: 18px 22px 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 24px rgba(15, 23, 42, 0.04);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 1) 56%),
    #ffffff;
}

#reportsSection .settings-card + .settings-card {
  margin-top: 24px;
}

#reportsSection .settings-card h3 {
  font-size: 1.12rem;
  color: #24344f;
}

#reportsSection .settings-card p {
  color: #607691;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

#reportsSection .reports-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: -4px 0 16px;
}

#reportsSection .reports-check-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1f3658;
  font-size: 0.94rem;
  font-weight: 700;
}

#reportsSection .reports-check-all input {
  width: 18px;
  height: 18px;
  accent-color: #255ed8;
}

#reportsSection .reports-selection-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#reportsSection .reports-selection-count {
  color: #607691;
  font-size: 0.92rem;
  font-weight: 700;
}

#reportsSection .employee-list-wrap {
  border: 1px solid #e3ebf5;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}

#reportsSection .employee-list-wrap th {
  background: linear-gradient(180deg, #f7f9fc 0%, #f1f5f9 100%);
  color: #64748b;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  padding-top: 14px;
  padding-bottom: 14px;
}

#reportsSection .employee-list-wrap td {
  padding: 14px 12px;
  border-bottom: 1px solid #e7edf4;
}

#reportsSection .employee-list-wrap tbody tr {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

#reportsSection .employee-list-wrap tbody tr:hover {
  background: #f8fbff;
}

#reportsSection .active-report-row {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
}

#reportsSection .active-report-row td:first-child {
  box-shadow: inset 3px 0 0 #2563eb;
}

#reportsSection .row-actions {
  gap: 8px;
  align-items: center;
}

#reportsSection .employee-list-wrap td .row-actions {
  justify-content: flex-start;
}

#reportsSection .employee-list-wrap .mini {
  min-height: 34px;
  min-width: auto;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 800;
}

#reportsSection .employee-list-wrap .mini[data-report-action="open"],
#reportsSection .employee-list-wrap .mini[data-report-action="excel"] {
  color: #255ed8;
}

#reportsSection .employee-list-wrap .mini[data-report-action="open"][aria-pressed="true"] {
  background: #eaf2ff;
  border-color: #c7dafd;
  color: #1d4fd7;
}

#reportsSection .employee-list-wrap .icon-mini {
  min-width: 36px;
  width: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid #d8e3f0;
  background: #ffffff;
  color: #315fc6;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

#reportsSection .employee-list-wrap .icon-mini:hover {
  background: #f8fbff;
  border-color: #bfd4f5;
}

#reportsSection .employee-list-wrap .icon-mini[data-action="print"] {
  color: #1f2937;
}

#reportsSection .report-select-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#reportsSection .report-select-cell input {
  width: 18px;
  height: 18px;
  accent-color: #255ed8;
}

.error-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.error-log-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.error-log-count {
  color: #61748f;
  font-size: 0.92rem;
  font-weight: 700;
}

.error-log-source {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #234f92;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.error-log-time {
  font-weight: 700;
  color: #21324b;
}

.error-log-repeat {
  margin-top: 4px;
  color: #8b5e0a;
  font-size: 0.82rem;
  font-weight: 700;
}

.error-log-message {
  color: #b42318;
  font-weight: 700;
}

.error-log-detail {
  color: #61748f;
  line-height: 1.45;
  word-break: break-word;
}

.report-month-title {
  font-size: 1rem;
  font-weight: 700;
  color: #31425e;
}

.report-month-sub {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #8ba0bb;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.report-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2456d6;
  font-weight: 800;
}

.report-net-salary {
  font-weight: 800;
  color: #24466f;
}

.settings-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.settings-inline button {
  min-width: 110px;
}

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

.settings-password-form label {
  margin-bottom: 0;
}

.settings-password-form .password-field {
  margin-top: 6px;
}

#changePasswordBtn {
  min-width: 180px;
}

#importLegacyBtn {
  min-width: 190px;
}

.settings-inline-summary {
  margin: 10px 0 0;
  min-height: 22px;
  color: #4a6384;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: pre-line;
}

#verifyEmailBtn {
  margin-top: 14px;
  min-width: 160px;
}

.designation-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.designation-item {
  border: 1px solid #dce5f2;
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.designation-item span {
  color: #1f3554;
  font-weight: 700;
}

.designation-item .mini {
  min-height: 32px;
  min-width: 74px;
}

.designation-item .mini.danger.ghost {
  border: 1px solid #fecaca;
  color: #dc2626;
  background: #fff;
}

.designation-item .mini.danger.ghost:hover {
  background: #fff1f2;
}

.settings-upload {
  margin-bottom: 10px;
}

.settings-file-label {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #253a57;
  text-transform: none;
  letter-spacing: 0;
}

.settings-file-input {
  width: 100%;
  height: auto;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #c9d6e8;
  border-radius: 10px;
  background: #ffffff;
  color: #1f3554;
}

.logo-preview-wrap {
  min-height: 120px;
  border: 1px dashed #c6d4e6;
  border-radius: 10px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.settings-logo-preview {
  max-width: min(240px, 100%);
  max-height: 100px;
  object-fit: contain;
  border-radius: 8px;
}

#saveLogoBtn {
  min-width: 150px;
}

#employeesSection .table-head h2 {
  font-size: 2.15rem;
}

#employeesSection .table-head p {
  margin-top: 2px;
}

#employeesSection .table-head,
#payrollSection .table-head,
#settingsSection .table-head,
#reportsSection .table-head {
  padding: 28px 34px 30px !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 24px !important;
  border-bottom: 1px solid #e5edf6 !important;
}

#employeesSection .table-head h2,
#payrollSection .table-head h2,
#settingsSection .table-head h2,
#reportsSection .table-head h2 {
  margin: 0 !important;
  line-height: 1.08 !important;
}

#employeesSection .table-head p,
#payrollSection .table-head p,
#settingsSection .table-head p,
#reportsSection .table-head p {
  margin: 0 !important;
  max-width: 760px !important;
  line-height: 1.45 !important;
}

#payrollSection .payroll-legend {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 12px 18px !important;
}

#settingsSection .settings-grid {
  padding-left: 34px !important;
  padding-right: 34px !important;
}

#employeesSection .employee-form {
  padding-left: 34px !important;
  padding-right: 34px !important;
}

#payrollSection .payroll-cards {
  padding: 22px 34px 34px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

#employeesSection .employee-list-wrap {
  margin-left: 34px !important;
  margin-right: 34px !important;
  margin-bottom: 30px !important;
}

#reportsSection .settings-card:last-of-type {
  margin-bottom: 34px;
}

.dashboard-command-center {
  width: min(1280px, calc(100% - 68px));
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: 1.1fr 0.95fr 1.2fr;
  gap: 16px;
}

.dashboard-status-panel .dashboard-panel-note {
  max-width: none;
  text-align: left;
  font-weight: 700;
}

.dashboard-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-action-grid button {
  min-height: 44px;
}

.payroll-control-panel {
  padding: 20px 34px 18px;
  border-bottom: 1px solid #d9e4f1;
  background:
    linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
}

.payroll-search-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 320px);
  gap: 16px;
}

.payroll-bulk-panel {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.payroll-bulk-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payroll-control-panel input,
.payroll-control-panel select {
  background-color: #ffffff;
}

.payroll-bulk-actions .ghost {
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.payroll-bulk-actions .ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

#applyBulkIncrementBtn {
  background: #1e40af;
}

#applyBulkAdvanceBtn {
  background: #d97706;
}

#applyBulkDeductionBtn {
  background: #b91c2d;
}

#applyBulkAbsentBtn {
  background: #475569;
}

.payroll-totals-bar {
  position: sticky;
  top: 92px;
  z-index: 20;
  margin: 0;
  padding: 10px 34px;
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  border-bottom: 1px solid #dbe7f4;
  background: rgba(248, 251, 255, 0.96);
  backdrop-filter: blur(12px);
}

.payroll-totals-bar div {
  border: 1px solid #dce7f4;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.payroll-totals-bar div:nth-child(1) {
  background: #f8fafc;
  border-color: #dbe3ee;
}

.payroll-totals-bar div:nth-child(2) {
  background: #eff6ff;
  border-color: #cfe0f8;
}

.payroll-totals-bar div:nth-child(3) {
  background: #fff1f2;
  border-color: #f2c7cf;
}

.payroll-totals-bar div:nth-child(4) {
  background: #ecfdf5;
  border-color: #c9ead8;
}

.payroll-totals-bar div:nth-child(5) {
  background: #fff7e8;
  border-color: #f1dcad;
}

.payroll-review-grid div {
  border-left: 1px solid #d9e4f1;
  min-width: 0;
  padding: 0 14px;
}

.payroll-review-grid div:first-child {
  border-left: 0;
  padding-left: 0;
}

.payroll-totals-bar span,
.payroll-review-grid span {
  display: block;
  color: #64748b;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.payroll-totals-bar strong,
.payroll-review-grid strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 1rem;
}

.payroll-review-panel {
  margin: 22px 34px 0;
  border: 1px solid #bfd3ee;
  border-top: 4px solid #1e40af;
  border-radius: 12px;
  background:
    linear-gradient(135deg, #ffffff 0%, #f5f9ff 62%, #ecfdf5 100%);
  box-shadow: 0 16px 34px rgba(30, 64, 175, 0.08);
  padding: 18px 20px;
}

.payroll-review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.payroll-review-head h3 {
  margin: 2px 0 0;
  font-size: 1.3rem;
  line-height: 1.15;
}

.payroll-review-meta {
  display: block;
  margin-top: 2px;
  color: #667892;
  font-size: 0.82rem;
  font-weight: 700;
}

.payroll-review-body {
  display: block;
}

.payroll-review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid #dce7f4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.payroll-warning-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  max-height: 148px;
  min-width: 0;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid #f2d6a5;
  border-radius: 8px;
  background: #fffaf0;
}

.payroll-warning-list.is-clear {
  display: block;
  border-color: #cfe7d9;
  background: #f5fbf7;
}

.payroll-warning-list p,
.payroll-inline-warning p {
  margin: 0;
  color: #8a4b0b;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.payroll-warning-list.is-clear p {
  color: #247044;
}

.payroll-inline-warning {
  margin-bottom: 14px;
  display: grid;
  gap: 8px;
  border: 1px solid #f7d8a8;
  border-radius: 12px;
  background: #fffbeb;
  padding: 12px 14px;
}

.payroll-entry-dirty {
  box-shadow:
    inset 4px 0 0 #2563eb,
    0 10px 25px -5px rgba(0, 0, 0, 0.03),
    0 8px 10px -6px rgba(0, 0, 0, 0.01) !important;
}

@media (max-width: 1180px) {
  .payroll-warning-list {
    max-height: 190px;
  }
}

.kpi-metrics-row {
  width: min(1280px, calc(100% - 68px));
  margin: 18px auto 0 !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

.kpi-metric-card {
  position: relative;
  min-height: 126px;
  align-items: flex-start !important;
  gap: 14px !important;
  padding: 18px !important;
  border: 1px solid #dbe5f1 !important;
  border-top: 1px solid #dbe5f1 !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06) !important;
  overflow: hidden;
}

.kpi-metric-card.primary {
  background:
    linear-gradient(135deg, #ffffff 0%, #eef5ff 100%) !important;
}

.kpi-metric-card.success {
  background:
    linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%) !important;
}

.kpi-metric-card.warning {
  background:
    linear-gradient(135deg, #ffffff 0%, #fff7ed 100%) !important;
}

.kpi-metric-card.alert {
  background:
    linear-gradient(135deg, #ffffff 0%, #fff1f2 100%) !important;
}

.kpi-metric-card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: #2b62d9;
}

.kpi-metric-card.primary::after { background: #2b62d9; }
.kpi-metric-card.success::after { background: #129766; }
.kpi-metric-card.warning::after { background: #d97706; }
.kpi-metric-card.alert::after { background: #b42332; }

.kpi-metric-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08) !important;
}

.kpi-icon {
  width: 42px !important;
  height: 42px !important;
  border-radius: 10px !important;
  font-size: 0.72rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.04em !important;
  color: #1f3c70 !important;
  background: #eef5ff !important;
  border: 1px solid #d9e7fb !important;
}

.kpi-metric-card.success .kpi-icon {
  color: #106344 !important;
  background: #eefbf5 !important;
  border-color: #d7f1e4 !important;
}

.kpi-metric-card.warning .kpi-icon {
  color: #8a4b0b !important;
  background: #fff7e8 !important;
  border-color: #f5dfba !important;
}

.kpi-metric-card.alert .kpi-icon {
  color: #9f1d2c !important;
  background: #fff1f2 !important;
  border-color: #f5d4d9 !important;
}

.kpi-data {
  min-width: 0;
}

.kpi-data p {
  color: #60718a !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.08em !important;
}

.kpi-data strong {
  margin: 5px 0 3px !important;
  color: #101a2d !important;
  font-size: clamp(1.45rem, 1.8vw, 2rem) !important;
  letter-spacing: -0.03em !important;
}

.kpi-data span {
  color: #75869d !important;
  font-size: 0.8rem !important;
  font-weight: 650 !important;
}

.dashboard-command-center,
.dashboard-insights {
  width: min(1280px, calc(100% - 68px));
}

.dashboard-command-center {
  margin: 16px auto 0;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.dashboard-insights {
  margin: 14px auto 0;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.85fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.dashboard-panel {
  border-radius: 12px;
  border: 1px solid #dbe5f1;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
  padding: 18px;
}

.dashboard-status-panel,
.dashboard-panel-hero {
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.98) 0%, #ffffff 48%, rgba(236, 253, 245, 0.74) 100%);
}

.dashboard-actions-panel {
  background:
    linear-gradient(135deg, #ffffff 0%, #f8fafc 52%, #fff7ed 100%);
}

.dashboard-attention-panel {
  background:
    linear-gradient(135deg, #ffffff 0%, #fff8ed 100%);
}

.dashboard-panel-head {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-kicker {
  margin-bottom: 4px;
  color: #6a7d97;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
}

.dashboard-panel-head h3 {
  color: #111b2e;
  font-size: 1.12rem;
  line-height: 1.2;
}

.dashboard-panel-note {
  max-width: 340px;
  color: #5f7088;
  font-size: 0.88rem;
  font-weight: 650;
}

.dashboard-status-panel .dashboard-panel-note {
  color: #2a3b56;
  line-height: 1.5;
}

.dashboard-action-grid {
  gap: 8px;
}

.dashboard-action-grid button {
  min-height: 42px;
  border-radius: 8px;
  box-shadow: none;
}

.dashboard-action-grid button:nth-child(1) {
  background: #1e40af;
  border-color: #1e40af;
}

.dashboard-action-grid button:nth-child(2) {
  background: #0f7a55;
  border-color: #0f7a55;
}

.dashboard-action-grid button:nth-child(3) {
  background: #8a4b0b;
  border-color: #8a4b0b;
}

.dashboard-action-grid button.ghost {
  background: #ffffff;
  border-color: #c8d5e5;
  color: #24344f;
}

.dashboard-summary-cards {
  gap: 10px;
}

.dashboard-stat-card {
  border-radius: 10px;
  border-color: #dfe8f4;
  box-shadow: none;
  padding: 13px;
  background: #fbfdff;
}

.dashboard-stat-card.tone-blue {
  background: #f2f7ff;
  border-color: #cfe0f8;
}

.dashboard-stat-card.tone-green {
  background: #f1fbf6;
  border-color: #cfeadb;
}

.dashboard-stat-card.tone-violet {
  background: #f6f4ff;
  border-color: #ded8fb;
}

.dashboard-stat-card.tone-amber {
  background: #fff7e8;
  border-color: #f2dfbb;
}

.dashboard-stat-card strong {
  margin-top: 6px;
  font-size: clamp(1.18rem, 1.5vw, 1.62rem);
  letter-spacing: -0.03em;
}

.dashboard-stat-card span {
  margin-top: 5px;
  font-size: 0.8rem;
}

.dashboard-list {
  gap: 8px;
}

.dashboard-list-item {
  position: relative;
  border-radius: 10px;
  border-color: #e1e9f4;
  background: #fbfdff;
  padding: 10px 12px;
  overflow: hidden;
}

.dashboard-list-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #d7e3ef;
}

.dashboard-attention-panel .dashboard-list-item::before {
  background: #d97706;
}

.dashboard-panel-hero .dashboard-list-item::before {
  background: #1e40af;
}

.dashboard-panel:not(.dashboard-panel-hero):not(.dashboard-attention-panel) .dashboard-list-item::before {
  background: #0f7a55;
}

.dashboard-list-item strong {
  color: #18253b;
  font-size: 0.92rem;
}

.dashboard-list-item span {
  color: #64748b;
  font-size: 0.82rem;
}

.dashboard-attention-panel .dashboard-list,
.dashboard-panel:not(.dashboard-panel-hero) .dashboard-list {
  max-height: 286px;
  overflow: auto;
  padding-right: 2px;
}

.employee-form {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 14px;
  padding: 18px 22px;
}

.employee-form label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 800;
}

.employee-form input,
.employee-form select {
  margin-top: 8px;
}

.employee-optional {
  display: none !important;
}

.employee-form-actions {
  grid-column: 1 / -1;
  margin-top: 2px;
}

#employeeSaveBtn {
  min-width: 180px;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

.employee-list-wrap {
  padding: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.employee-list-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.employee-list-tools label {
  display: grid;
  gap: 8px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.employee-list-tools select {
  min-width: 220px;
  margin: 0;
  background: #ffffff;
}

.employee-filter-count {
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .employee-list-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-list-tools select {
    min-width: 0;
    width: 100%;
  }
}

.employee-list-wrap table {
  width: 100%;
  min-width: 1180px;
  table-layout: auto;
}

.employee-list-wrap th {
  position: static;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  border-top: none;
  white-space: nowrap;
}

.employee-list-wrap td {
  background: #ffffff;
  color: #334155;
  vertical-align: middle;
}

.employee-list-wrap th,
.employee-list-wrap td {
  padding-left: 18px;
  padding-right: 18px;
}

.employee-list-wrap tbody tr:nth-child(even) {
  background: #ffffff;
}

#employeesSection .employee-list-wrap table {
  min-width: 1420px;
}

#employeesSection .employee-list-wrap th:nth-child(1),
#employeesSection .employee-list-wrap td:nth-child(1) {
  min-width: 130px;
}

#employeesSection .employee-list-wrap th:nth-child(2),
#employeesSection .employee-list-wrap td:nth-child(2) {
  min-width: 190px;
}

#employeesSection .employee-list-wrap th:nth-child(3),
#employeesSection .employee-list-wrap td:nth-child(3),
#employeesSection .employee-list-wrap th:nth-child(4),
#employeesSection .employee-list-wrap td:nth-child(4) {
  min-width: 175px;
  white-space: nowrap;
}

#employeesSection .employee-list-wrap th:nth-child(5),
#employeesSection .employee-list-wrap td:nth-child(5) {
  min-width: 150px;
}

#employeesSection .employee-list-wrap th:nth-child(6),
#employeesSection .employee-list-wrap td:nth-child(6),
#employeesSection .employee-list-wrap th:nth-child(7),
#employeesSection .employee-list-wrap td:nth-child(7) {
  min-width: 145px;
  white-space: nowrap;
}

#employeesSection .employee-list-wrap th:nth-child(8),
#employeesSection .employee-list-wrap td:nth-child(8) {
  min-width: 210px;
}

#employeesSection .employee-list-wrap th:nth-child(9),
#employeesSection .employee-list-wrap td:nth-child(9) {
  min-width: 170px;
}

#reportsSection .employee-list-wrap table {
  min-width: 1120px;
}

#reportsSection [data-report-panel="leave"] .employee-list-wrap table {
  min-width: 1580px;
}

#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(4),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(4),
#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(5),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(5),
#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(6),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(6) {
  min-width: 145px;
  white-space: nowrap;
}

#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(7),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(7) {
  min-width: 230px;
}

#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(8),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(8),
#reportsSection [data-report-panel="leave"] .employee-list-wrap th:nth-child(9),
#reportsSection [data-report-panel="leave"] .employee-list-wrap td:nth-child(9) {
  min-width: 210px;
}

.emp-list-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.emp-list-sub {
  margin-top: 2px;
  color: #64748b;
  font-weight: 600;
}

.employee-list-wrap td .row-actions {
  flex-direction: row;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: max-content;
}

.employee-list-wrap .mini {
  min-height: 30px;
  min-width: 72px;
  border-radius: 8px;
  padding: 0 10px;
  border: 1px solid #d2dbe8;
  background: #ffffff;
  color: #2563eb;
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.employee-list-wrap .mini.danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: #ef4444;
}

#saveStatus {
  width: min(1280px, calc(100% - 68px));
  margin: 16px auto 0;
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #c7ecd6;
  background: #ecfdf3;
  color: #059669;
  font-size: 1rem;
  font-weight: 700;
}

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

  .side-rail {
    position: static;
  }

  .app-main {
    padding-top: 0;
  }

  .topbar {
    position: static;
  }

  #employeesSection,
  #payrollSection,
  #settingsSection,
  #reportsSection,
  .kpi-metrics-row,
  .dashboard-insights,
  .dashboard-command-center,
  #saveStatus {
    width: calc(100% - 40px);
    margin-left: 20px;
    margin-right: 20px;
  }

  .employee-form {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .kpi-metrics-row,
  .dashboard-command-center,
  .dashboard-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .dashboard-panel-hero,
  .dashboard-attention-panel {
    grid-column: 1 / -1;
  }

  .employee-form-actions {
    grid-column: 1 / -1;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}

@media (max-width: 760px) {
  #employeesSection,
  #payrollSection,
  #settingsSection,
  #reportsSection,
  .kpi-metrics-row,
  .dashboard-insights,
  .dashboard-command-center,
  #saveStatus {
    width: calc(100% - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .dashboard-command-center,
  .kpi-metrics-row,
  .dashboard-insights,
  .payroll-search-row,
  .payroll-bulk-panel,
  .payroll-review-grid,
  .payroll-totals-bar {
    grid-template-columns: 1fr !important;
  }

  .dashboard-panel-hero,
  .dashboard-attention-panel {
    grid-column: auto;
  }

  .dashboard-action-grid {
    grid-template-columns: 1fr !important;
  }

  #employeesSection .table-head,
  #payrollSection .table-head,
  #settingsSection .table-head,
  #reportsSection .table-head {
    padding: 22px 20px 24px !important;
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  #employeesSection .table-head p,
  #payrollSection .table-head p,
  #settingsSection .table-head p,
  #reportsSection .table-head p {
    max-width: none !important;
    text-align: left !important;
  }

  #payrollSection .payroll-legend {
    justify-content: flex-start !important;
  }

  #settingsSection .settings-grid {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  #employeesSection .employee-form {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  #payrollSection .payroll-cards {
    padding: 0 20px 24px !important;
  }

  .payroll-control-panel {
    padding: 20px !important;
  }

  .payroll-totals-bar {
    position: static;
    padding: 14px 20px !important;
  }

  .payroll-review-panel {
    margin: 20px 20px 0 !important;
  }

  .payroll-review-head {
    flex-direction: column;
    align-items: stretch;
  }

  .payroll-review-body {
    grid-template-columns: 1fr;
  }

  .payroll-review-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .payroll-review-grid div {
    border-left: 0;
    padding: 0;
  }

  .payroll-warning-list {
    grid-template-columns: 1fr;
    max-height: none;
  }

  #payrollSection.table-wrap {
    border-left: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-right: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 18px !important;
  }

  #reportsSection .settings-card {
    margin-left: 20px !important;
    margin-right: 20px !important;
  }

  #reportsSection .settings-card:last-of-type {
    margin-bottom: 20px !important;
  }

  #employeesSection .employee-list-wrap,
  #reportsSection .employee-list-wrap {
    width: auto !important;
    max-width: none !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
    border-left: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-right: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 14px !important;
  }

  #reportsSection .employee-list-wrap {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Keep wide employee/payroll tables contained inside their panels. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.shell,
.app-view,
.app-main,
#employeesSection,
#payrollSection,
#settingsSection,
#reportsSection {
  min-width: 0;
  max-width: 100%;
}

#employeesSection,
#payrollSection,
#settingsSection,
#reportsSection,
.dashboard-insights,
#saveStatus {
  width: min(1280px, calc(100% - 40px));
}

.employee-list-wrap,
.table-wrap {
  width: auto;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
}

#employeesSection .employee-list-wrap,
#reportsSection .employee-list-wrap {
  margin-left: 20px;
  margin-right: 20px;
  max-width: calc(100% - 40px);
}

#employeesSection .employee-list-wrap table {
  min-width: 1180px;
}

@media (max-width: 850px) {
  .shell {
    width: 100% !important;
  }

  .app-main {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  #employeesSection,
  #payrollSection,
  #settingsSection,
  #reportsSection,
  .dashboard-insights,
  #saveStatus {
    width: calc(100% - 24px) !important;
  }

  #employeesSection .employee-list-wrap,
  #reportsSection .employee-list-wrap,
  .employee-list-wrap,
  .table-wrap {
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    border-left: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-right: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 14px !important;
  }
}
