:root {
  color-scheme: light;
  --ink: #15201d;
  --muted: #5e6b66;
  --line: #c9d0cc;
  --paper: #f4f6f2;
  --panel: #fff;
  --green: #145b43;
  --green-light: #e1f1e8;
  --amber-light: #fff0c7;
  --red: #9a2f2f;
  --red-light: #fce7e5;
  --blue: #245a78;
  --shadow: 0 8px 24px rgba(21, 32, 29, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: #fff; padding: 0.75rem; }

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 3rem;
  background: #13211d;
  color: #fff;
  border-bottom: 4px solid #4da478;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #13211d;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.topbar nav { display: flex; gap: 0.25rem; }
.topbar nav a,
.link-button {
  color: #dbe9e2;
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.topbar nav a:hover,
.topbar nav a:focus,
.link-button:hover,
.link-button:focus { background: #263a34; color: #fff; }

.operator { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.operator form { margin: 0; }
.read-only { padding: 0.55rem 1rem; text-align: center; background: var(--amber-light); color: #593800; border-bottom: 1px solid #d8b86a; }

.page { width: min(1500px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.page-title h1,
.auth-panel h1 {
  margin: 0.15rem 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: 0;
}
.page-title p { margin: 0.35rem 0; color: var(--muted); }
.eyebrow { text-transform: uppercase; color: var(--green); font-size: 0.72rem; font-weight: 800; letter-spacing: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 2rem; }
.metric { display: flex; min-height: 120px; flex-direction: column; justify-content: flex-end; background: var(--panel); padding: 1rem; color: var(--ink); text-decoration: none; }
.metric strong { font-family: "Iowan Old Style", serif; font-size: 2.4rem; font-weight: 600; }
.metric span { color: var(--muted); }
.metric.warning { border-top: 4px solid #d99b23; }
.metric.danger { border-top: 4px solid var(--red); }

.section { margin-top: 2rem; }
.section h2,
.detail-grid h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th,
td { text-align: left; padding: 0.8rem 0.9rem; border-bottom: 1px solid #e5e9e6; vertical-align: top; }
th { background: #edf1ee; color: #3d4b46; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0; white-space: nowrap; }
tbody tr:hover { background: #fafcf9; }
.entity { display: block; color: var(--blue); font-weight: 700; text-decoration: none; }
.entity:hover { text-decoration: underline; }
.secondary { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.82em; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

.status { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid var(--line); background: #eef1ef; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.status.active { background: var(--green-light); border-color: #8ebda5; color: #0c5139; }
.status.suspended,
.status.failed { background: var(--red-light); border-color: #ddaaa5; color: #7b2222; }
.status.provisioning { background: var(--amber-light); border-color: #d8b86a; color: #694100; }

.search { min-width: min(560px, 100%); }
.search > label { display: block; font-weight: 700; font-size: 0.8rem; margin-bottom: 0.35rem; }
.search > div { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; }
.search select,
.search button { border-left: 0; }
.next-page { display: inline-block; margin-top: 1rem; color: var(--blue); font-weight: 700; }

.auth-shell { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 2rem; background: linear-gradient(135deg, #e9efe9 0, #f7f8f4 55%, #dce9e3 100%); }
.auth-panel { width: min(480px, 100%); padding: 2.25rem; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--green); box-shadow: var(--shadow); }
.auth-panel > p { color: var(--muted); }
.stack { display: grid; gap: 1rem; margin-top: 1.5rem; }

label { display: grid; gap: 0.4rem; font-weight: 700; font-size: 0.86rem; }
input,
textarea,
select,
button { font: inherit; letter-spacing: 0; }
input,
textarea,
select { width: 100%; border: 1px solid #9ca8a3; background: #fff; padding: 0.7rem 0.75rem; color: var(--ink); }
textarea { min-height: 86px; resize: vertical; }
input:focus,
textarea:focus,
select:focus,
button:focus,
a:focus { outline: 3px solid #e3a72b; outline-offset: 2px; }
button { border: 1px solid #78847f; background: #fff; color: var(--ink); padding: 0.7rem 0.9rem; font-weight: 700; cursor: pointer; }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.danger-button { background: var(--red); border-color: var(--red); color: #fff; }

.alert { padding: 0.85rem 1rem; margin: 1rem 0; border-left: 4px solid; }
.alert.error { background: var(--red-light); border-color: var(--red); }
.alert.success { background: var(--green-light); border-color: var(--green); }
.back { display: inline-block; margin-bottom: 1rem; color: var(--blue); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.detail-grid > div { background: var(--panel); padding: 1.35rem; }
dl { display: grid; grid-template-columns: minmax(120px, 0.45fr) 1fr; margin: 0; }
dt,
dd { padding: 0.55rem 0; border-bottom: 1px solid #e7eae8; }
dt { color: var(--muted); }
dd { margin: 0; }
.entity-list { list-style: none; margin: 0; padding: 0; }
.entity-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid #e7eae8; }
.entity-list a { color: var(--blue); font-weight: 700; }
.entity-list span { color: var(--muted); }

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.action { display: flex; flex-direction: column; gap: 0.85rem; background: var(--panel); border: 1px solid var(--line); padding: 1.2rem; }
.action h3,
.action p { margin: 0; }
.action p { color: var(--muted); font-size: 0.88rem; }
.danger-zone { border-top: 4px solid var(--red); }
.confirm { display: grid; grid-template-columns: auto 1fr; align-items: start; font-weight: 500; }
.confirm input { width: auto; margin-top: 0.2rem; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar { padding-inline: 1.5rem; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .operator { margin-left: auto; }
  .page { width: min(100% - 1rem, 1500px); padding-top: 1rem; }
  .page-title { align-items: stretch; flex-direction: column; gap: 1rem; }
  .page-title h1,
  .auth-panel h1 { font-size: 2.1rem; }
  .search { min-width: 0; }
  .search > div { grid-template-columns: 1fr; }
  .search select,
  .search button { border-left: 1px solid #9ca8a3; border-top: 0; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 100px; }
  .detail-grid { grid-template-columns: 1fr; }
  .auth-panel { padding: 1.35rem; }
  dl { grid-template-columns: 1fr; }
  dt { border-bottom: 0; padding-bottom: 0; }
  .entity-list li { align-items: flex-start; flex-direction: column; gap: 0.25rem; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .topbar .operator span { display: none; }
}