:root {
  color-scheme: light;
  font: 14px/1.55 "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172621;
  background: #f5f7f5;
  --ink: #172621;
  --muted: #52635c;
  --border: #dce5df;
  --accent: #165943;
  --accent-hover: #104733;
  --sidebar: #112520;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(29px, 4vw, 37px); line-height: 1.13; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 17px; letter-spacing: -.015em; }
h3 { font-size: 14px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .19em; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
:focus-visible { outline: 2px solid #387f6a; outline-offset: 3px; }

.muted, .page-heading p, .empty { color: var(--muted); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.startup { padding: 32px; text-align: center; color: var(--muted); }
.button {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-height: 39px;
  padding: 7px 13px;
  border: 1px solid #cbd9d0;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-weight: 640;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { color: var(--ink); background: #f2f7f3; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { border-color: #a12637; background: #a12637; color: #fff; }
.button.danger:hover { background: #821c2b; }
.button.quiet { border-color: transparent; background: transparent; }
.button.quiet:hover { background: #edf4ef; }

input, select, textarea {
  min-height: 40px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #cbd9d0;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
input::placeholder { color: #63746b; }
textarea { resize: vertical; }
label { display: block; margin-bottom: 5px; font-weight: 650; }
.field { margin: 14px 0; }
.field small { display: block; margin-top: 5px; color: var(--muted); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 750; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #a8e0c5;
  color: #112b21;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
}
.auth-shell { width: min(100% - 32px, 425px); margin: min(12vh, 100px) auto 40px; }
.auth-brand { margin: 0 0 18px 4px; }
.auth-card { border: 1px solid var(--border); border-radius: 13px; background: #fff; padding: clamp(19px, 5vw, 29px); box-shadow: 0 8px 25px #132d2010; }
.auth-card h1 { font-size: 29px; }
.auth-card form > .button.primary { width: 100%; margin-top: 4px; }
.auth-card > p { margin-top: 9px; }
.auth-card .quiet { margin-top: 10px; }
.setup-key { display: block; margin: 12px 0 6px; padding: 9px 10px; background: #edf4ef; overflow-wrap: anywhere; border-radius: 6px; user-select: all; }
.feedback { margin: 12px 0; padding: 10px 12px; border-radius: 7px; background: #e8f6ed; color: #1e5840; }
.feedback.error { background: #fbeef0; color: #892030; }
.feedback.warning { background: #fff3d9; color: #674b12; }

.console { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 22px 14px; background: var(--sidebar); color: #e9f4ed; }
.sidebar .brand { margin: 0 6px 29px; }
.sidebar .brand:hover { color: #fff; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { padding: 9px 11px; color: #d3e3d9; text-decoration: none; border-radius: 7px; }
.sidebar nav a:hover { background: #223a31; color: #fff; }
.sidebar nav a[aria-current="page"] { background: #284b3c; color: #fff; font-weight: 650; }
.sidebar a:focus-visible { outline-color: #a8e0c5; }
.main-shell { min-width: 0; }
.topbar {
  min-height: 68px;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(15px, 3.2vw, 36px);
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.global-search { display: flex; width: min(100%, 430px); min-width: 140px; gap: 5px; }
.account-menu { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.environment { padding: 3px 8px; border: 1px solid #dfcca6; border-radius: 999px; color: #6b4b16; background: #fff4df; font-size: 12px; font-weight: 650; white-space: nowrap; }
.content { max-width: 1470px; margin-inline: auto; padding: 30px clamp(15px, 3.2vw, 36px) 60px; }
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 22px; }
.page-heading p { margin-top: 6px; }
.page-heading .actions { padding-top: 3px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; margin-bottom: 12px; }
.section-stack { display: grid; gap: 16px; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.metric, .panel { border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.metric { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 15px; color: inherit; text-decoration: none; }
.metric:hover { border-color: #8cb5a3; color: var(--ink); }
.metric span { font-weight: 650; color: var(--muted); }
.metric strong { font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric small { color: var(--muted); }
.panel { min-width: 0; }
.panel > h2, .panel-body { padding: 15px 16px; }
.panel > h2 { border-bottom: 1px solid var(--border); }
.panel > .empty { padding: 17px 16px; }
.empty { font-size: 14px; }
.activity-list { padding: 0; list-style: none; margin: 0; }
.activity-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 12px; padding: 12px 16px; }
.activity-list li + li { border-top: 1px solid #edf1ee; }
.activity-list a { font-weight: 640; }
.activity-list time { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.toolbar .filter-text { flex: 0 1 300px; }
.toolbar .filter-select { flex: 0 1 180px; }
.toolbar label { font-size: 12px; margin: 0 0 3px; color: var(--muted); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; background: #fff; }
th, td { padding: 10px 13px; vertical-align: middle; border-bottom: 1px solid #edf1ee; }
th { color: #4d6156; font-size: 12px; font-weight: 700; white-space: nowrap; background: #f9fbf9; }
td { font-size: 13px; }
td a { font-weight: 640; }
td .secondary-line { display: block; color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faf8; }
.table-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; padding: 11px 15px; border-top: 1px solid var(--border); }
.table-bottom p { color: var(--muted); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 680; white-space: nowrap; color: #3b5046; background: #edf2ee; }
.badge.good { color: #19583b; background: #e4f6ec; }
.badge.warn { color: #64490f; background: #fff1cb; }
.badge.bad { color: #862638; background: #fcecef; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 14px; margin: 0; }
.details-grid dt { color: var(--muted); font-size: 12px; }
.details-grid dd { margin: 3px 0 0; font-weight: 650; overflow-wrap: anywhere; }

.dialog {
  width: min(460px, 100% - 20px);
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  box-shadow: 0 12px 45px #13261d32;
}
.dialog::backdrop { background: #10252080; }
.dialog p { margin: 7px 0 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 840px) {
  .console { grid-template-columns: 165px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .brand { gap: 7px; font-size: 13px; margin-inline: 3px; }
  .sidebar .brand-mark { width: 28px; height: 28px; font-size: 15px; }
  .dashboard-columns { grid-template-columns: 1fr; }
  .admin-email { display: none; }
}
@media (max-width: 570px) {
  .console { display: block; }
  .sidebar { padding: 12px; }
  .sidebar .brand { margin-bottom: 10px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar nav a { padding: 6px 8px; font-size: 13px; }
  .topbar { padding-block: 8px; gap: 5px; min-height: auto; }
  .topbar .button { padding-inline: 7px; }
  .account-menu { gap: 0; }
  .environment { display: none; }
  .content { padding-top: 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar > div { flex: 1 !important; }
}
