:root {
  color: #17212b;
  background: #f5f6f3;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px calc(72px + var(--safe-bottom));
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 12px 0;
  background: rgba(245, 246, 243, 0.92);
  border-bottom: 1px solid transparent;
}

.app-header.sticky-top {
  border-bottom-color: #dfe5df;
}

.app-header .brand {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - var(--touch-min) - 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand {
  color: #123f35;
  font-size: clamp(0.95rem, 3.5vw + 0.35rem, 1.5rem);
  font-weight: 750;
  text-decoration: none;
}

.card {
  background: #fff;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid #dfe5df;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(23, 33, 43, .08);
}

h1 {
  margin: 4px 0 12px;
  font-size: clamp(1.75rem, 5vw, 3.2rem);
  letter-spacing: -.05em;
  line-height: 1.08;
}

.eyebrow { color: #23715d; font-size: .75rem; letter-spacing: .12em; font-weight: 750; margin: 0; }
.intro, .message { color: #52616d; line-height: 1.6; }
.hint { color: #52616d; font-size: .9rem; line-height: 1.5; }
.page-intro { margin-bottom: 28px; }

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

.admin-grid .card { padding: clamp(20px, 3vw, 30px); }
.admin-grid .card-wide { grid-column: 1 / -1; }
.admin-grid h2 { margin: 0; font-size: 1.25rem; }

.health-card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.health-card__head .hint {
  margin: 6px 0 0;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.health-metric {
  border: 1px solid #dfe5df;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8faf8;
}

.health-metric__label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #52616d;
  margin-bottom: 4px;
}

.health-metric__value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #123f35;
  line-height: 1.2;
}

.health-metric__value.is-warn {
  color: #9a3412;
}

.health-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.health-subtitle {
  margin: 0 0 8px;
  font-size: .95rem;
}

.health-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.health-list li {
  border: 1px solid #e6ebe6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .85rem;
  color: #2a3a33;
  background: #fff;
}

.health-list .empty {
  color: #52616d;
  border-style: dashed;
}

.costs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: 0 0 14px;
  font-size: .85rem;
  color: #52616d;
}

.costs-breadcrumb button {
  border: 0;
  background: transparent;
  color: #123f35;
  font: inherit;
  font-weight: 650;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.costs-breadcrumb .is-current {
  color: #52616d;
  font-weight: 650;
  text-decoration: none;
  cursor: default;
}

.costs-breadcrumb .sep {
  color: #9aa79e;
}

.costs-detail {
  margin-top: 4px;
}

.costs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 480px;
}

.costs-table th,
.costs-table td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #dfe5df;
}

.costs-table th {
  color: #52616d;
  font-weight: 700;
  white-space: nowrap;
}

.costs-table button.linkish {
  border: 0;
  background: transparent;
  color: #123f35;
  font: inherit;
  font-weight: 650;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.costs-table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-period-bars {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.usage-bar__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 650;
  margin-bottom: 6px;
}

.usage-bar__meta {
  color: #52616d;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.usage-bar__track {
  height: 10px;
  border-radius: 999px;
  background: #e4ebe4;
  overflow: hidden;
}

.usage-bar__fill {
  height: 100%;
  background: #1f6b57;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.usage-bar__fill.is-warn {
  background: #b45309;
}

.policy-packs {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dfe5df;
}

.policy-packs__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 280px; }
th, td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #dfe5df;
}
th { color: #52616d; font-weight: 700; white-space: nowrap; }

.audit-table { min-width: 720px; }

form { display: grid; gap: 20px; margin-top: 32px; }
label { display: grid; gap: 7px; font-weight: 650; font-size: .9rem; }
input, textarea, select {
  width: 100%;
  border: 1px solid #b9c7bc;
  border-radius: 8px;
  padding: 12px;
  color: inherit;
  font: inherit;
}
textarea { resize: vertical; min-height: 100px; }

fieldset {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0;
  padding: 14px;
  border: 1px solid #dfe5df;
  border-radius: 8px;
}

fieldset label { display: flex; align-items: center; gap: 7px; }
fieldset input { width: 18px; height: 18px; padding: 0; }

button, .button-link {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: #123f35;
  color: white;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  width: 100%;
}

button.quiet {
  background: transparent;
  color: #123f35;
  padding: 8px 12px;
  width: auto;
  min-width: var(--touch-min);
  border: 1px solid #b9c7bc;
}

button:disabled { cursor: not-allowed; opacity: .55; }

.app-header .header-actions .quiet {
  width: auto;
  min-width: var(--touch-min);
}

.settings-drawer--dark .settings-drawer__foot button:not(.quiet) {
  background: #c8f06a;
  color: #102016;
  border: 0;
}

@media (min-width: 640px) {
  .shell { padding-top: 28px; }
  .app-header { margin-bottom: 48px; }
  button, .button-link { width: auto; }
}

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1024px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
