:root {
  color-scheme: light;
  --page: #f5f7fb;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #647084;
  --line: #d9e0ec;
  --accent: #166f63;
  --accent-hover: #10574d;
  --error: #b3261e;
  --error-bg: #fff0ef;
  --success: #17643a;
  --success-bg: #eaf8ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--page);
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.header-inner,
.menu-inner {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 96px;
  padding: 20px 0;
}

.header-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.main-menu {
  width: min(100% - 32px, 1180px);
  margin: 16px auto 0;
  overflow: hidden;
  background: #1f6feb;
  border-radius: 8px;
}

.menu-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  overflow-x: auto;
}

.menu-inner a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.menu-inner a:hover,
.menu-inner a.active {
  background: #1557c0;
}

.page-shell {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: 40px 0;
}

.page-shell-wide {
  width: min(100% - 32px, 1180px);
}

.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(24, 32, 47, 0.08);
}

.panel-heading {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 26px;
}

.message {
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
}

.message.success {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid #bfe8cc;
}

.message.error {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid #ffc9c5;
}

.employee-form {
  margin: 0;
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label.wide {
  grid-column: 1 / -1;
}

label span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(22, 111, 99, 0.16);
}

input[readonly] {
  color: var(--muted);
  background: #f7f9fc;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.field-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

button,
.secondary {
  min-width: 104px;
  min-height: 44px;
  border-radius: 6px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.logout-button {
  min-width: 88px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.logout-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-hover);
}

.secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.secondary:hover {
  border-color: #aab5c5;
}

.danger-button {
  min-width: 92px;
  border: 1px solid #d4372f;
  color: #ffffff;
  background: #d4372f;
}

.danger-button:hover {
  background: #b92d26;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(24, 32, 47, 0.08);
}

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

.login-form .actions {
  margin-top: 6px;
}

.login-form .primary {
  width: 100%;
}

.list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

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

.upload-form {
  margin: 0;
}

.inline-action-form {
  margin: 0;
}

button:disabled {
  color: #8c98aa;
  background: #f1f4f8;
  cursor: not-allowed;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}

.search-actions {
  display: flex;
  gap: 10px;
}

.payroll-search-form {
  grid-template-columns: minmax(220px, 1fr) 150px 150px auto;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: #fff;
}

.user-table {
  min-width: 760px;
}

.employee-table th,
.employee-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  vertical-align: top;
}

.employee-table th {
  color: var(--muted);
  background: #f7f9fc;
  font-weight: 700;
}

.employee-table tr:last-child td {
  border-bottom: 0;
}

.employee-table a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.employee-table a:hover {
  text-decoration: underline;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.details-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.details-list div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #fff;
}

.details-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.details-list dd {
  margin: 0;
  font-size: 15px;
}

.details-list a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.details-list a:hover {
  text-decoration: underline;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: -8px 0 18px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 13px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.print-icon,
.email-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.print-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 12px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
}

.print-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 7px;
  width: 16px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 0 -4px 0 -2px currentColor;
}

.email-icon {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.email-icon::before,
.email-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 10px;
  height: 2px;
  background: currentColor;
}

.email-icon::before {
  left: 1px;
  transform: rotate(35deg);
}

.email-icon::after {
  right: 1px;
  transform: rotate(-35deg);
}

@media (max-width: 700px) {
  .header-inner,
  .menu-inner {
    width: min(100% - 20px, 1180px);
  }

  .main-menu {
    width: min(100% - 20px, 980px);
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .page-shell {
    width: min(100% - 20px, 980px);
    padding: 20px 0;
  }

  .form-panel {
    padding: 20px;
  }

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

  label.wide {
    grid-column: auto;
  }

  .actions {
    flex-direction: column;
  }

  .field-with-button {
    grid-template-columns: 1fr;
  }

  .list-heading {
    flex-direction: column;
  }

  .search-form,
  .payroll-search-form,
  .search-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .details-list {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    justify-content: stretch;
    flex-direction: column;
  }
}
