:root {
  --bg: #dcecf8;
  --surface: #ffffff;
  --surface-alt: #eef6fd;
  --sidebar: #0b3d66;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --line: #bfd7ea;
  --text: #0b2740;
  --muted: #5a7893;
  --accent: #1d78c1;
  --accent-deep: #0e5a98;
  --accent-soft: #d6ebfb;
  --success-soft: #e4f2ff;
  --warning-soft: #e7f4ff;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --shadow: 0 18px 40px rgba(16, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(29, 120, 193, 0.14), rgba(11, 61, 102, 0.06)),
    var(--bg);
}

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

a {
  color: var(--accent-deep);
  text-decoration: none;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 24px;
}

.auth-card,
.panel,
.metric,
.site-header,
.site-footer,
.classic-slip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 460px);
  justify-self: center;
  padding: 28px;
}

.auth-brand {
  margin-bottom: 18px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 2rem;
}

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

.auth-form label,
.form-grid label,
.filter-grid label,
.employee-live > div,
.summary-strip > div,
.signature-row > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-help {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.auth-switch {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.admin-page {
  min-height: 100vh;
}

.portal-page {
  min-height: 100vh;
}

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

.admin-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 20px;
  background: var(--sidebar);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.25;
}

.sidebar-brand p:not(.eyebrow) {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.96rem;
}

.admin-sidebar .eyebrow,
.sidebar-footer span {
  color: rgba(255, 255, 255, 0.62);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sidebar-line);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-line);
}

.logout-link {
  margin-top: 6px;
  color: #fff;
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, #0c4f86, #0a3f6b);
  box-shadow: 0 18px 40px rgba(12, 79, 134, 0.22);
}

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

.brand-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  box-shadow: 0 12px 24px rgba(14, 90, 152, 0.24);
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  color: #ffffff;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.98rem;
}

.site-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-header-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.site-header .eyebrow {
  color: rgba(255, 255, 255, 0.74);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.notice.success {
  background: var(--success-soft);
  border-color: rgba(29, 120, 193, 0.18);
}

.notice.error {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.18);
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0;
}

.metric {
  padding: 18px;
}

.metric span,
.metric small,
.form-grid span,
.filter-grid span,
.employee-live span,
.preview-block dt,
.preview-summary span,
.summary-strip span,
.stack-item span,
.formula-list span {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 1.6rem;
}

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

.panel {
  padding: 22px;
  min-width: 0;
}

.compact-panel {
  align-self: start;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.form-grid,
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.full-span {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.action-link,
.status-pill,
.slip-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
}

.ghost-button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 600;
}

.table-action-button {
  min-width: 88px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid #9fc8e8;
  background: #eef6fd;
  color: var(--accent-deep);
  font-weight: 600;
  text-align: center;
  justify-content: center;
}

.table-action-delete {
  border-color: #e1a7a2;
  background: #fff1ef;
  color: var(--danger);
}

.danger-text {
  color: var(--danger);
}

.form-actions,
.filter-actions {
  display: flex;
  align-items: end;
}

.employee-live,
.payroll-preview,
.summary-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.employee-live {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.payroll-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.preview-block h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.preview-block dl {
  margin: 0;
}

.preview-block dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(216, 226, 232, 0.8);
}

.preview-block dd,
.preview-block dt {
  margin: 0;
}

.preview-summary {
  display: grid;
  gap: 14px;
  padding: 6px 0;
}

.preview-summary strong {
  font-size: 1.3rem;
}

.net-highlight {
  padding: 16px;
  border-radius: 8px;
  background: #102a43;
  color: #fff;
}

.net-highlight span {
  color: rgba(255, 255, 255, 0.76);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

td strong {
  display: block;
}

.subcell {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.actions-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 108px;
}

.inline-form {
  margin: 0;
}

.inline-form .table-action-button {
  width: 100%;
}

.status-pill {
  min-height: 32px;
  font-size: 0.86rem;
}

.status-active,
.status-paid {
  background: var(--accent-soft);
  border-color: rgba(29, 120, 193, 0.18);
}

.status-on-leave,
.status-processed {
  background: #e8f3fe;
  border-color: rgba(29, 120, 193, 0.16);
}

.status-resigned {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.18);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  margin: 16px 0;
}

.summary-strip strong {
  font-size: 1.05rem;
}

.stack-list,
.formula-list {
  display: grid;
  gap: 12px;
}

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

.shortcut-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
}

.shortcut-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.metric.compact {
  padding: 16px;
}

.metric.compact strong {
  font-size: 1.2rem;
}

.stack-item,
.formula-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.stack-item:last-child,
.formula-list div:last-child {
  border-bottom: 0;
}

.empty-state,
.empty-copy {
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
}

.site-footer {
  margin-top: 20px;
  padding: 18px 22px;
  background: #0f4f84;
  color: #fff;
}

.site-footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.site-footer strong {
  display: block;
  margin-bottom: 6px;
}

.site-footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.slip-page {
  background: #dcecf8;
}

.portal-shell {
  max-width: 1240px;
}

.portal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.portal-toolbar-copy {
  display: grid;
  gap: 4px;
}

.portal-toolbar-copy span {
  color: var(--muted);
}

.portal-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 16px;
}

.payslip-shell {
  max-width: 1000px;
}

.slip-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.employee-slip {
  padding: 14px;
  background: #fff;
  border: 1px solid #7e99b5;
}

.employee-slip,
.employee-slip * {
  font-family: Arial, sans-serif;
}

.employee-slip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #8aa7cb;
}

.employee-slip-confidential {
  font-size: 11px;
  color: #1b3470;
  text-transform: uppercase;
}

.employee-slip-head h1 {
  margin: 2px 0 2px;
  font-size: 20px;
  color: #1b3470;
}

.employee-slip-head p {
  margin: 0;
  font-size: 12px;
  color: #557293;
  text-transform: uppercase;
}

.employee-slip-status {
  text-align: right;
}

.employee-slip-status strong {
  display: block;
  font-size: 15px;
  color: #1b3470;
}

.employee-slip-status span {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border: 1px solid #a9c9e5;
  border-radius: 999px;
  background: #eef6fd;
  color: #1b3470;
  font-size: 11px;
}

.employee-slip-meta,
.employee-slip-amounts,
.employee-slip-pay {
  width: 100%;
  border-collapse: collapse;
}

.employee-slip-meta td,
.employee-slip-amounts td,
.employee-slip-pay th,
.employee-slip-pay td {
  border: 1px solid #a9c9e5;
  padding: 5px 7px;
  font-size: 12px;
  vertical-align: top;
}

.employee-slip-meta span,
.employee-slip-amounts span,
.employee-slip-summary span,
.employee-slip-note {
  color: #557293;
  font-size: 11px;
}

.employee-slip-meta strong,
.employee-slip-amounts strong {
  display: block;
  margin-top: 2px;
  color: #0b2740;
  font-size: 12px;
}

.employee-slip-amounts {
  margin-top: 8px;
}

.employee-slip-pay {
  margin-top: 8px;
}

.employee-slip-pay th {
  background: #eef6fd;
  color: #1b3470;
  font-weight: 700;
}

.employee-slip-pay td:nth-child(2),
.employee-slip-pay td:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.employee-slip-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #8aa7cb;
  background: #f5fbff;
}

.employee-slip-summary strong {
  display: block;
  margin-top: 2px;
  color: #0b2740;
  font-size: 13px;
}

.employee-slip-note {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .stats-grid,
  .page-grid,
  .dashboard-grid,
  .content-grid,
  .payroll-preview {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

}

@media (max-width: 780px) {
  .app-shell,
  .admin-main,
  .auth-shell {
    padding: 16px;
  }

  .section-heading,
  .site-header,
  .slip-toolbar,
  .portal-toolbar,
  .auth-switch {
    flex-direction: column;
  }

  .form-grid,
  .filter-grid,
  .employee-live,
  .shortcut-grid,
  .report-grid,
  .summary-strip,
  .site-footer-grid {
    grid-template-columns: 1fr;
  }

  .actions-cell {
    flex-direction: column;
    align-items: flex-start;
  }

  .employee-slip-head {
    flex-direction: column;
  }

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

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {
  body,
  .slip-page {
    background: #fff;
  }

  .app-shell {
    max-width: none;
    padding: 0;
  }

  .slip-toolbar {
    display: none;
  }

  .employee-slip {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}
