:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --surface-strong: #e9eef3;
  --text: #17212b;
  --muted: #657386;
  --line: #d9e1e8;
  --primary: #116149;
  --primary-dark: #0b4636;
  --accent: #4f6f9f;
  --danger: #b42318;
  --success: #067647;
  --warning: #a15c07;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.16;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.25;
}

h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
  z-index: 10;
}

.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  min-height: 54px;
  padding: 8px;
  color: var(--text);
  border-radius: 8px;
}

.brand:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.brand img,
.login-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand small,
.login-brand p,
.muted {
  color: var(--muted);
}

.brand small {
  display: block;
  color: var(--muted);
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.nav-menu a,
.nav-parent,
.topbar-user a,
.nav-user {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
}

.nav-group {
  position: relative;
}

.nav-group.active > .nav-parent,
.nav-menu a.active {
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.nav-parent::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.subnav {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 230px;
  display: none;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.subnav::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 0;
  right: 0;
  height: 9px;
}

.subnav a {
  justify-content: flex-start;
  width: 100%;
}

.nav-group:hover .subnav,
.nav-group:focus-within .subnav {
  display: grid;
  gap: 4px;
}

.nav-menu a:hover,
.nav-parent:hover,
.topbar-user a:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user {
  color: var(--primary-dark);
  background: var(--surface-soft);
}

.logout-link {
  border-left: 1px solid var(--line);
}

.main-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

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

.page-heading p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.heading-actions,
.form-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.status-card,
.panel,
.action-list form,
.login-box,
.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-card {
  position: relative;
  min-height: 148px;
  padding: 18px;
  overflow: hidden;
}

.status-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.status-card.ok::before {
  background: var(--success);
}

.status-card.pending::before {
  background: var(--warning);
}

.card-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 21px;
  line-height: 1.2;
}

.status-card small {
  color: var(--muted);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

thead th {
  background: var(--surface-soft);
}

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

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfcfd;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-table th {
  width: 280px;
  background: var(--surface-soft);
}

.settings-table {
  table-layout: fixed;
}

.settings-table td {
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pill.success {
  background: #e7f6ee;
  color: var(--success);
}

.pill.error {
  background: #fdeceb;
  color: var(--danger);
}

.banner {
  padding: 13px 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.banner.success {
  border-color: #a6d9c2;
  color: var(--success);
}

.banner.warning {
  border-color: #f7c56d;
  color: var(--warning);
}

.banner.danger {
  border-color: #f3aaa4;
  color: var(--danger);
}

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

.action-list form {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 106px;
  padding: 16px;
}

.action-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 700;
}

.action-list span:not(.action-step) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.action-list strong {
  display: block;
  font-size: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

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

.login-box {
  padding: 30px;
}

.login-brand {
  margin-bottom: 26px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-submit {
  width: 100%;
}

.turnstile-box {
  min-height: 65px;
  display: flex;
  align-items: center;
}

label {
  display: block;
  margin-bottom: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(17, 97, 73, 0.14);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.settings-panel {
  padding: 0;
  overflow: hidden;
}

.settings-panel > .panel-title {
  padding: 20px 20px 0;
}

.settings-form {
  display: grid;
  gap: 0;
}

.settings-section {
  padding: 20px;
  border-top: 1px solid var(--line);
}

.settings-section:first-of-type {
  border-top: 0;
}

.settings-section h3 {
  margin-bottom: 6px;
}

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

.schedule-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-note {
  margin: 0;
  color: var(--muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 4px;
}

.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.checkbox-row label span {
  margin: 0;
  color: var(--text);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

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

.details-grid div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.details-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.details-grid strong {
  overflow-wrap: anywhere;
  font-weight: 700;
}

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

pre {
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.mini-card {
  padding: 14px;
  box-shadow: none;
}

.mini-card div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.mini-card div:last-child {
  border-bottom: 0;
}

.mini-card strong {
  color: var(--muted);
}

.error-panel {
  max-width: 720px;
}

@media (max-width: 1080px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .nav-menu {
    justify-content: flex-start;
  }

  .nav-group {
    width: 100%;
  }

  .subnav {
    position: static;
    display: none;
    gap: 4px;
    width: 100%;
    margin-top: 4px;
    box-shadow: none;
  }

  .subnav::before {
    display: none;
  }

  .topbar-user {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .main-shell {
    width: min(1240px, calc(100% - 28px));
    padding-top: 24px;
  }

  .status-grid,
  .action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  h1 {
    font-size: 25px;
  }

  .page-heading,
  .action-list form {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions .button {
    flex: 1;
  }

  .status-grid,
  .action-list,
  .form-grid,
  .schedule-grid,
  .details-grid,
  .mini-card div {
    grid-template-columns: 1fr;
  }

  .action-list form {
    display: grid;
  }

  .action-step {
    width: 32px;
    height: 32px;
  }

  .action-list button {
    width: 100%;
  }

  .settings-table th,
  .settings-table td {
    display: block;
    width: 100%;
  }

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

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