:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #66737b;
  --line: #dfe6e8;
  --accent: #00796b;
  --accent-strong: #005f56;
  --warn: #f2b84b;
}

* {
  box-sizing: border-box;
}

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

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

a:hover {
  text-decoration: underline;
}

.app-topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--text);
  font-size: 18px;
}

.app-topbar nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

.app-topbar form {
  margin: 0;
}

.topbar-button {
  background: transparent;
  border: 0;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
}

.app-main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 28px;
}

.app-toast-container {
  margin-top: 72px;
  z-index: 1100;
}

.toast {
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 32, 38, 0.14);
  min-width: min(360px, calc(100vw - 32px));
}

.toast-header {
  border-bottom: 0;
}

.toast-body {
  font-size: 14px;
  line-height: 1.45;
}

.page-header {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

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

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: 17px;
  margin: 0;
}

.search-bar {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(260px, 420px) auto;
}

.search-bar input[type="search"] {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  min-height: 42px;
  padding: 0 12px;
}

.search-bar input[type="submit"],
.secondary-action,
.pagination a {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

.secondary-action,
.pagination a {
  background: #e3eeee;
  color: var(--accent-strong);
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
}

.metric-card span,
.metric-card small,
.panel-header span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  margin: 14px 0 4px;
}

.content-grid,
.detail-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  margin-bottom: 18px;
}

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

.current-summary {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 1.4fr) repeat(4, minmax(150px, 0.65fr));
  margin-bottom: 18px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 112px;
  padding: 16px;
}

.summary-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.summary-card small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 10px;
}

.summary-card-wide strong {
  font-size: 22px;
}

.panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 16px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  background: #f9fbfb;
  color: #4b5960;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfdfd;
}

.status {
  background: #eef6f5;
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  min-height: 24px;
  padding: 4px 10px;
}

.event-list {
  display: grid;
}

.event-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 13px 16px;
}

.event-row:last-child {
  border-bottom: 0;
}

.event-row span,
.event-row small {
  color: var(--muted);
}

.history-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  overflow: hidden;
}

.history-panel > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  min-height: 64px;
  padding: 0 18px;
}

.history-panel > summary::-webkit-details-marker {
  display: none;
}

.history-panel > summary::after {
  color: var(--accent);
  content: "+";
  font-size: 26px;
  font-weight: 700;
}

.history-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.history-panel[open] > summary::after {
  content: "-";
}

.history-panel summary strong {
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
}

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

.history-panel > .panel,
.history-panel > .content-grid {
  border: 0;
  margin: 0;
}

.history-panel > .content-grid {
  padding: 0 18px 18px;
}

.timeline {
  display: grid;
  padding: 18px 18px 8px;
}

.timeline-item {
  display: grid;
  gap: 14px;
  grid-template-columns: 18px minmax(0, 1fr);
  position: relative;
}

.timeline-item::before {
  background: var(--line);
  bottom: 0;
  content: "";
  left: 8px;
  position: absolute;
  top: 18px;
  width: 2px;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-marker {
  background: #ffffff;
  border: 3px solid var(--muted);
  border-radius: 50%;
  height: 18px;
  margin-top: 10px;
  position: relative;
  width: 18px;
  z-index: 1;
}

.timeline-item.is-current .timeline-marker {
  border-color: var(--accent);
}

.timeline-card {
  background: #fbfdfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 14px;
}

.timeline-heading {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.timeline-heading strong {
  color: var(--accent-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.timeline-heading h3 {
  font-size: 16px;
  margin: 5px 0 0;
}

.timeline-heading span {
  background: #eef6f5;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.timeline-period,
.timeline-note {
  color: var(--muted);
  font-size: 14px;
  margin: 10px 0 0;
}

.change-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.change-list li {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 0.6fr) minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 10px;
}

.change-list span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.change-list strong {
  font-size: 13px;
}

.change-list em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 6px 16px 16px;
}

.facts div {
  border-bottom: 1px solid var(--line);
  min-height: 70px;
  padding: 14px 8px;
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.facts dd {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.pagination {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 16px;
}

.auth-shell {
  align-items: center;
  display: flex;
  min-height: calc(100vh - 120px);
  justify-content: center;
}

.auth-shell-split {
  align-items: stretch;
  background: #ffffff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100vh - 120px);
}

.auth-visual {
  background-position: center;
  background-size: cover;
  display: grid;
  min-height: 620px;
  overflow: hidden;
  padding: 44px;
  position: relative;
}

.auth-visual::before {
  background: linear-gradient(180deg, rgba(7, 18, 22, 0.20), rgba(7, 18, 22, 0.72));
  content: "";
  inset: 0;
  position: absolute;
}

.auth-visual-content {
  align-self: end;
  color: #ffffff;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.auth-visual-content .eyebrow {
  color: #8be3d8;
}

.auth-visual-content h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.auth-visual-content p:last-child {
  color: rgba(255, 255, 255, 0.80);
  font-size: 18px;
  line-height: 1.6;
  margin: 18px 0 0;
}

.auth-form-side {
  align-items: center;
  background: var(--bg);
  display: flex;
  justify-content: center;
  padding: 44px;
}

.auth-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

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

.auth-hint {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 14px 0 0;
}

.auth-form label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  text-transform: uppercase;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
  min-height: 44px;
  padding: 0 12px;
}

.auth-form input[type="submit"] {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}

.auth-links {
  font-size: 14px;
  margin-top: 18px;
}

.auth-links-inline {
  margin-top: -6px;
}

.form-panel {
  padding: 18px;
}

.record-form {
  display: grid;
  gap: 16px;
  max-width: 720px;
}

.record-form label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  text-transform: uppercase;
}

.record-form input[type="text"],
.record-form input[type="email"],
.record-form input[type="password"],
.record-form select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  min-height: 42px;
  padding: 0 12px;
}

.record-form input[type="submit"] {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  width: fit-content;
  padding: 0 18px;
}

.check-field {
  align-items: center;
  display: flex !important;
  flex-direction: row;
}

.form-errors {
  background: #fff7e3;
  border: 1px solid #ead39b;
  border-radius: 6px;
  color: #6c4b00;
  padding: 12px;
}

.form-errors ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

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

.action-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.action-list a,
.empty-state {
  padding: 16px;
}

.empty-state p {
  color: var(--muted);
  margin: 8px 0 0;
}

@media (max-width: 980px) {
  .page-header,
  .app-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .app-topbar {
    gap: 10px;
    padding: 14px 20px;
    position: static;
  }

  .app-main {
    padding: 20px;
  }

  .search-bar,
  .content-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .current-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card-wide {
    grid-column: 1 / -1;
  }

  .change-list li {
    align-items: start;
    grid-template-columns: 1fr;
  }

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

  .auth-visual {
    min-height: 360px;
  }

  .auth-form-side {
    padding: 28px 20px;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 28px;
  }

  .metric-grid,
  .current-summary,
  .facts {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 280px;
    padding: 28px;
  }

  .auth-visual-content h1 {
    font-size: 30px;
  }
}
