:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657085;
  --line: #d7deea;
  --panel: #ffffff;
  --page: #f5f7fb;
  --blue: #2456a6;
  --blue-dark: #183d78;
  --green: #28785c;
  --red: #b42318;
  --amber: #a85f00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button,
.import-button {
  min-height: 32px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 0 10px;
  color: #ffffff;
  background: var(--blue);
  cursor: pointer;
  white-space: nowrap;
}

.logout-button {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  padding: 0 10px;
  color: #ffffff;
  background: var(--amber);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.logout-button:hover {
  background: #874c00;
}

button:hover,
.import-button:hover {
  background: var(--blue-dark);
}

button.subtle {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
}

button.subtle:hover {
  background: #eef3fb;
}

button.danger {
  border-color: var(--red);
  background: var(--red);
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.toolbar p {
  margin-top: 4px;
  color: var(--muted);
}

.toolbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
}

.toolbar-actions button,
.toolbar-actions .import-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

#addEmployeeButton {
  border-color: var(--green);
  background: var(--green);
}

#addEmployeeButton:hover {
  background: #1f6049;
}

.search-field,
.font-size-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.search-field {
  min-width: min(420px, 100%);
}

.font-size-field {
  min-width: 118px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(36, 86, 166, 0.16);
  border-color: var(--blue);
}

.import-button {
  display: inline-grid;
  place-items: center;
  position: relative;
}

.import-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  opacity: 0;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.1;
}

.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 250px);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: #1f4e78;
  font-size: 13px;
}

td {
  font-size: var(--table-font-size, 12px);
}

body.font-compact {
  --table-font-size: 12px;
}

body.font-normal {
  --table-font-size: 14px;
}

body.font-large {
  --table-font-size: 16px;
}

tr:hover td {
  background: #f8fbff;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-height: 26px;
  border-radius: 999px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.actions svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.actions button.subtle-action {
  color: #ffffff;
  border-color: var(--blue);
  background: var(--blue);
}

.actions button.subtle-action:hover {
  background: var(--blue-dark);
}

.actions button.view-action {
  color: #ffffff;
  border-color: #7c3aed;
  background: #7c3aed;
}

.actions button.view-action:hover {
  background: #5b21b6;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  color: #ffffff;
  background: var(--green);
  font-size: 12px;
}

.badge.ended {
  background: var(--amber);
}

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

dialog {
  width: min(780px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.24);
}

dialog::backdrop {
  background: rgba(23, 32, 51, 0.42);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(36, 86, 166, 0.12), rgba(40, 120, 92, 0.10)),
    #f5f7fb;
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  border: 1px solid rgba(215, 222, 234, 0.9);
  border-radius: 8px;
  padding: 30px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.16);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex: 0 0 auto;
}

.login-brand h1 {
  font-size: 24px;
  line-height: 1.15;
}

.login-brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.login-intro {
  margin-top: 22px;
}

.login-intro h2 {
  font-size: 20px;
}

.login-intro p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  min-height: 44px;
}

.login-form button {
  min-height: 44px;
  margin-top: 2px;
  font-weight: 700;
}

.login-error {
  margin-top: 14px;
  border: 1px solid #f2b8b5;
  border-radius: 6px;
  padding: 10px;
  color: var(--red);
  background: #fff4f2;
  font-size: 13px;
}

form header,
form footer,
.profile-panel header,
.profile-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

form footer,
.profile-panel footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

form footer div {
  display: flex;
  gap: 10px;
}

form footer button,
.profile-panel footer button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

#closeDialogButton,
#closeProfileButton {
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
  font-size: 24px;
}

.profile-panel {
  background: #ffffff;
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 18px;
  background: var(--line);
}

.profile-details div {
  min-height: 58px;
  padding: 10px;
  background: #ffffff;
}

.profile-details dt {
  color: var(--muted);
  font-size: 12px;
}

.profile-details dd {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.form-sections {
  display: grid;
  gap: 14px;
  max-height: min(72vh, 720px);
  overflow: auto;
  padding: 18px;
}

.form-sections fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 16px;
  background: #ffffff;
}

.form-sections legend {
  padding: 0 6px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
}

.net-salary-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #b7dbc9;
  border-radius: 8px;
  padding: 14px 16px;
  background: #f3fbf7;
}

.net-salary-panel span {
  color: var(--muted);
  font-size: 13px;
}

.net-salary-panel strong {
  color: var(--green);
  font-size: 22px;
}

@media (max-width: 860px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    align-items: center;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions > *,
  .search-field {
    flex: 1 1 100%;
  }

  .font-size-field {
    flex: 1 1 140px;
  }

  .button-row {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .summary-grid,
  .form-grid,
  .profile-details {
    grid-template-columns: 1fr;
  }
}
