:root {
  color-scheme: light;
  --green: #154838;
  --green-2: #25664f;
  --mint: #edf6f1;
  --line: #c8dbd2;
  --ink: #14221d;
  --muted: #657a72;
  --danger: #bd332d;
  --amber: #fff2c9;
  --paper: #fbfcfa;
  --portal-sidebar-width: 190px;
  --ceo-font-family: system-ui, sans-serif;
  font-family: var(--ceo-font-family);
}

* { box-sizing: border-box; }
html,
body,
body *,
body *::before,
body *::after { font-family: var(--ceo-font-family) !important; }
[hidden] { display: none !important; }
body { margin: 0; background: #f4f2ea; color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--portal-sidebar-width);
  padding: 28px 18px 22px;
  background: #103f31;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 34px;
  z-index: 10;
}

.portal-brand { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; }
.portal-brand span { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #e8efb9; color: var(--green); font-size: 1.25rem; font-weight: 950; }
.portal-sidebar nav { display: grid; gap: 10px; }
.portal-nav-item { width: 100%; border: 1px solid transparent; border-radius: 12px; padding: 14px 12px; background: transparent; color: #c7d9d1; display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 800; }
.portal-nav-item.is-active { background: #285c4b; color: white; border-color: #4f7b6c; }
.portal-sidebar > small { margin-top: auto; color: #a9c4ba; font-weight: 700; }

.portal-header { min-height: 108px; padding: 24px clamp(20px, 5vw, 64px); background: var(--green); color: white; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.portal-header p, .eyebrow { margin: 0 0 6px; font-size: .75rem; font-weight: 800; letter-spacing: .18em; }
.portal-header h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2.15rem); }
.portal-header nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.portal-header nav button { border: 1px solid #8fb6a7; background: transparent; color: white; border-radius: 10px; padding: 10px 14px; }
.portal-header nav span { font-weight: 800; margin-right: 6px; }
body.portal-active .portal-header { margin-left: var(--portal-sidebar-width); }

main { width: min(1380px, calc(100% - 32px)); margin: 34px auto; }
body.portal-active main { width: min(1380px, calc(100% - var(--portal-sidebar-width) - 32px)); margin-left: calc(var(--portal-sidebar-width) + 16px); margin-right: 16px; }
.login-card, .salary-console { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 18px 50px #12382b14; }
.login-card { width: min(620px, 100%); margin: 8vh auto; padding: clamp(24px, 5vw, 48px); }
h2 { margin: 4px 0 8px; font-size: 1.65rem; }
.login-card > div > p:last-child, .salary-console > header p { color: var(--muted); margin: 0; }
.login-card form { display: grid; gap: 18px; margin-top: 30px; }
label { display: grid; gap: 7px; font-weight: 750; color: #405b50; }
input { width: 100%; min-height: 46px; border: 1px solid #b8cec4; border-radius: 10px; background: white; padding: 10px 12px; color: var(--ink); }
input:focus { outline: 3px solid #60a88935; border-color: var(--green-2); }
.primary { border: 0; border-radius: 11px; background: var(--green-2); color: white; font-weight: 850; padding: 14px 20px; }
.primary:disabled { cursor: wait; opacity: .55; }
.message { min-height: 1.5em; margin: 12px 0 0; color: var(--muted); }
.message.is-error { color: var(--danger); }
.message.is-success { color: #14723e; }
.salary-console { overflow: hidden; }
.salary-console > header { padding: 26px 30px; display: flex; justify-content: space-between; align-items: end; gap: 24px; background: var(--mint); border-bottom: 1px solid var(--line); }
.salary-console > header label { min-width: 180px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 1150px; }
th, td { padding: 13px 12px; border-bottom: 1px solid #d9e4df; text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: #e8f1ed; color: #516b61; font-size: .85rem; z-index: 1; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); z-index: 2; }
th:first-child { background: #e8f1ed; z-index: 3; }
td input { width: 112px; text-align: right; }
.person strong { display: block; }
.person small { color: var(--muted); }
.status { font-size: .83rem; font-weight: 800; color: #8c6415; background: var(--amber); border-radius: 99px; padding: 6px 10px; }
.status.is-saved { color: #14723e; background: #ddf2e4; }
.salary-console footer { padding: 20px 30px; display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.salary-console footer .message { margin: 0 auto 0 0; }
dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 90px #0005; }
dialog::backdrop { background: #0e271fc7; }
dialog form { display: grid; gap: 18px; padding: 26px; }
dialog header { display: flex; justify-content: space-between; align-items: center; }
dialog header h2 { margin: 0; }
dialog header button { border: 0; background: transparent; font-size: 2rem; color: var(--muted); }
dialog small { color: var(--muted); }

@media (max-width: 900px) {
  :root { --portal-sidebar-width: 116px; }
  .portal-sidebar { padding: 20px 10px; }
  .portal-brand { justify-content: center; }
  .portal-brand strong { display: none; }
  .portal-nav-item { padding: 12px 8px; flex-direction: column; justify-content: center; text-align: center; font-size: .86rem; }
  body.portal-active main { width: calc(100% - var(--portal-sidebar-width) - 20px); margin-left: calc(var(--portal-sidebar-width) + 10px); margin-right: 10px; }
}

@media (max-width: 700px) {
  .portal-header, .salary-console > header, .salary-console footer { align-items: stretch; flex-direction: column; }
  .portal-header nav { justify-content: flex-start; }
  .salary-console > header { padding: 22px 18px; }
  .salary-console footer { padding: 18px; }
  .salary-console footer .message { margin: 0; }
  .primary { width: 100%; }
}
