:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #162018;
  --muted: #657066;
  --line: #d9dfd8;
  --accent: #1f6f4a;
  --accent-dark: #174f38;
  --warn: #b46318;
  --danger: #a33a32;
  --good: #17633f;
  --ink-soft: #edf2ed;
  --shadow: 0 14px 38px rgba(22, 32, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(31, 111, 74, 0.08), rgba(180, 99, 24, 0.04)),
    var(--bg);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 244, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav a,
.link-button {
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

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

.page-heading h1,
.login-panel h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.actions,
.row-actions,
.inline-form,
.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  color: var(--accent-dark);
  background: #dfe9df;
}

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

.print-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.print-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.print-only {
  display: none;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: white;
  font: inherit;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkline input {
  width: 18px;
  height: 18px;
}

.plain-panel,
.login-panel,
.metric,
.status-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.plain-panel {
  padding: 22px;
  margin-bottom: 22px;
}

.login-panel {
  width: min(440px, 100%);
  margin: 10vh auto 0;
  padding: 30px;
}

.stack {
  display: grid;
  gap: 16px;
}

.notice {
  margin-bottom: 18px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}

.notice.success {
  color: var(--good);
  background: #e5f2eb;
}

.notice.error {
  color: var(--danger);
  background: #f7e7e5;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 22px;
}

.status-strip div {
  display: grid;
  gap: 6px;
  padding: 18px;
  background: white;
}

.label,
.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.metric {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.metric strong {
  font-size: 32px;
}

.two-column,
.settings-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  align-items: start;
}

.settings-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 22px;
}

.settings-grid.wide {
  grid-template-columns: 1.15fr 0.85fr;
}

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

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

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline article,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: white;
}

.timeline span,
.muted {
  color: var(--muted);
}

.timeline p,
.muted {
  margin: 6px 0 0;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-row,
.filter-grid {
  display: grid;
  gap: 10px;
}

.compact-row {
  grid-template-columns: 1fr auto auto auto;
  align-items: end;
}

.filter-grid {
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  align-items: end;
}

.good-text {
  color: var(--good);
}

.danger-text {
  color: var(--danger);
}

@media (max-width: 820px) {
  .topbar,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading h1,
  .login-panel h1 {
    font-size: 34px;
  }

  .status-strip,
  .metric-grid,
  .two-column,
  .settings-grid,
  .settings-grid.wide,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .compact-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 0.45in;
  }

  body {
    min-height: auto;
    color: #111;
    background: white;
    font-family: "Aptos", "Segoe UI", sans-serif;
    print-color-adjust: exact;
  }

  .topbar,
  .notice,
  .history-controls,
  .print-button {
    display: none !important;
  }

  .shell {
    width: auto;
    margin: 0;
    padding: 0;
  }

  .page-heading {
    margin: 0 0 10px;
  }

  .page-heading h1 {
    font-size: 24pt;
  }

  .eyebrow {
    margin-bottom: 4px;
    color: #333;
  }

  .print-only {
    display: block;
  }

  .print-report-meta {
    margin-bottom: 12px;
    border-top: 1px solid #777;
    border-bottom: 1px solid #777;
    padding: 8px 0;
    font-size: 9pt;
  }

  .print-report-meta p {
    margin: 3px 0 0;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .history-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 8.5pt;
  }

  .history-table thead {
    display: table-header-group;
  }

  .history-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .history-table th,
  .history-table td {
    border-color: #aaa;
    padding: 6px;
    overflow-wrap: anywhere;
  }

  .history-table th:nth-child(1),
  .history-table th:nth-child(2) {
    width: 14%;
  }

  .history-table th:nth-child(3) {
    width: 10%;
  }

  .history-table th:nth-child(4) {
    width: 34%;
  }

  .history-table th:nth-child(5) {
    width: 14%;
  }

  .history-table th:nth-child(6) {
    width: 14%;
  }

  .history-table .muted,
  .history-table .danger-text {
    color: #222;
  }

  .history-table a[href]::after {
    display: block;
    content: attr(href);
    margin-top: 3px;
    color: #333;
    font-size: 7pt;
    font-weight: 400;
    overflow-wrap: anywhere;
  }

  .pill {
    min-height: 0;
    border: 1px solid #777;
    padding: 2px 6px;
    color: #111;
    background: white;
  }
}
