:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #17211b;
  --muted: #637066;
  --line: #d9e0d8;
  --primary: #176c56;
  --primary-strong: #0f503f;
  --accent: #bd7b12;
  --danger: #b3261e;
  --warning: #9a6700;
  --shadow: 0 18px 45px rgba(23, 33, 27, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

a:hover {
  color: var(--primary-strong);
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 20px;
  font-weight: 800;
  gap: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand__logo {
  display: block;
  height: auto;
  max-height: 52px;
  max-width: min(240px, 38vw);
  object-fit: contain;
  width: auto;
}

.nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
}

.nav a {
  align-items: center;
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex;
  gap: 7px;
  font-weight: 700;
  padding: 9px 12px;
}

.nav a.is-active,
.nav a:hover {
  background: #e8f1ed;
  color: var(--primary-strong);
}

.nav-badge {
  align-items: center;
  background: var(--warning);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  min-width: 22px;
  padding: 0 7px;
}

.userbar {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.userbar small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.shell {
  margin: 0 auto;
  max-width: 1220px;
  padding: 28px clamp(16px, 4vw, 42px) 52px;
}

.footer {
  color: var(--muted);
  font-size: 13px;
  padding: 0 clamp(16px, 4vw, 42px) 26px;
  text-align: center;
}

.auth-panel {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 440px;
  padding: 28px;
  width: 100%;
}

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

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  margin-bottom: 0;
}

h2 {
  font-size: 20px;
  margin-bottom: 18px;
}

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

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

.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  text-align: center;
}

.button:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--primary);
}

.button--ghost:hover {
  background: #e8f1ed;
  border-color: #c7d8d0;
  color: var(--primary-strong);
}

.panel,
.stat-card,
.admin-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(23, 33, 27, 0.05);
}

.panel {
  padding: 22px;
}

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

.panel__head h2 {
  margin-bottom: 0;
}

.panel--wide {
  min-width: 0;
}

.link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.stat-grid,
.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

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

.stat-card,
.admin-tile {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 20px;
}

.stat-card span,
.admin-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong,
.admin-tile strong {
  color: var(--text);
  font-size: 32px;
  letter-spacing: 0;
}

.layout-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.form {
  display: grid;
  gap: 14px;
}

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

.form label,
.filter-bar label,
.inline-form label {
  display: grid;
  gap: 7px;
}

.form span,
.filter-bar span,
.inline-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #cdd7cf;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

input[type="date"],
input[type="month"],
input[type="number"],
input[type="time"],
input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
  font-size: 16px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(23, 108, 86, 0.14);
}

.field--wide,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.filter-bar,
.inline-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.filter-bar--compact {
  grid-template-columns: minmax(180px, 260px) auto;
  justify-content: start;
}

.filter-bar--actions {
  grid-template-columns: minmax(180px, 260px) repeat(3, auto);
  justify-content: start;
}

.inline-form {
  grid-template-columns: minmax(240px, 440px) auto;
  justify-content: start;
}

.summary-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-weight: 800;
  gap: 12px;
  justify-content: space-between;
  margin: 0 -22px 16px;
  padding: 0 22px 16px;
}

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

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

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

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

td small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

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

.empty {
  color: var(--muted);
  margin-bottom: 14px;
}

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

.notice {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 16px 18px;
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.notice p {
  color: var(--muted);
  margin-bottom: 0;
}

.notice--warning {
  background: #fff7df;
  border-color: #f0d48b;
}

.alert,
.flash {
  border-radius: 8px;
  font-weight: 700;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.alert,
.flash--danger {
  background: #fff0ee;
  color: var(--danger);
}

.flash--success {
  background: #e8f5ee;
  color: #145d38;
}

.flash--warning {
  background: #fff7df;
  color: var(--warning);
}

.alert p {
  margin-bottom: 6px;
}

.alert p:last-child {
  margin-bottom: 0;
}

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

.assignment-summary {
  align-items: center;
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px 14px;
}

.assignment-summary span {
  color: var(--muted);
  font-weight: 700;
}

.check-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.check-card {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  padding: 14px;
}

.check-card input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.check-card span {
  color: var(--muted);
  display: grid;
  gap: 3px;
}

.check-card strong {
  color: var(--text);
}

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

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

.feature-card {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  padding: 14px;
}

.feature-card input {
  margin-top: 4px;
  min-height: auto;
  width: auto;
}

.feature-card span {
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.feature-card strong {
  color: var(--text);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button-row--start {
  justify-content: flex-start;
}

.inline-status-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-status-form select {
  min-width: 150px;
  width: auto;
}

.logo-preview {
  align-items: center;
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 120px;
  padding: 18px;
}

.logo-preview img {
  display: block;
  height: auto;
  max-height: 90px;
  max-width: 100%;
}

.check-line {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
}

.check-line input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.check-line span {
  color: var(--text);
  font-weight: 700;
}

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

.odometer-list {
  display: grid;
  gap: 14px;
}

.odometer-card {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(220px, 1fr);
  padding: 16px;
}

.odometer-card--simple {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
}

.odometer-card--day {
  align-items: start;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.4fr);
}

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

.odometer-card.is-missing {
  background: #fffaf0;
  border-color: #f0d48b;
}

.odometer-card h2 {
  margin: 7px 0 3px;
}

.odometer-card p {
  color: var(--muted);
  margin-bottom: 0;
}

.odometer-card input {
  font-size: 20px;
  font-weight: 800;
  min-height: 52px;
}

.upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.upload-list a {
  background: #eef7f2;
  border: 1px solid #cfe3d9;
  border-radius: 8px;
  color: var(--primary-strong);
  display: inline-flex;
  flex-direction: column;
  font-weight: 800;
  gap: 2px;
  padding: 8px 10px;
}

.upload-list small {
  color: var(--muted);
  font-size: 12px;
}

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

.status-tag {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 9px;
}

.status-tag--success {
  background: #e8f5ee;
  color: #145d38;
}

.status-tag--warning {
  background: #fff0c7;
  color: var(--warning);
}

.row-warning {
  background: #fffaf0;
}

.row-selected {
  background: #eef7f2;
}

.odometer-card__meta {
  color: var(--primary-strong) !important;
  font-weight: 800;
  margin-top: 8px;
}

td code {
  color: var(--muted);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .userbar {
    margin-left: 0;
  }

  .stat-grid,
  .admin-grid,
  .layout-grid,
  .form--grid,
  .filter-bar,
  .filter-bar--compact,
  .filter-bar--actions,
  .odometer-card,
  .odometer-card__fields {
    grid-template-columns: 1fr;
  }

  .assignment-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row,
  .link-group {
    justify-content: stretch;
  }

  .inline-status-form,
  .inline-status-form select {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .shell {
    padding-top: 20px;
  }

  .auth-card,
  .panel {
    padding: 18px;
  }

  .summary-row {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .button {
    width: 100%;
  }

  .nav,
  .userbar {
    width: 100%;
  }

  .nav a {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .brand__logo {
    max-height: 44px;
    max-width: min(190px, 58vw);
  }

  .stat-card,
  .admin-tile {
    min-height: 92px;
    padding: 16px;
  }

  .stat-card strong,
  .admin-tile strong {
    font-size: 24px;
  }

  .odometer-card input {
    font-size: 24px;
  }
}

@media print {
  .topbar,
  .footer,
  .page-head .button {
    display: none;
  }

  body {
    background: #fff;
  }

  .shell {
    max-width: none;
    padding: 0;
  }

  .panel,
  .stat-card,
  .admin-tile {
    border: 0;
    box-shadow: none;
  }
}
