:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18212d;
  background: #f4f6f8;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fbfc;
  --line: #dbe3ea;
  --line-strong: #c5d1dc;
  --text: #18212d;
  --muted: #607082;
  --muted-2: #8795a5;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --shadow: 0 10px 30px rgb(31 45 61 / 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  background: var(--bg);
}

body.auth-locked {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  background: #eef3f5;
}

body.auth-locked .sidebar,
body.auth-locked main {
  display: none;
}

body.is-authed .loginScreen {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
}

.loginScreen {
  width: min(100%, 430px);
}

.loginPanel {
  width: 100%;
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(31 45 61 / 0.12);
}

.loginBrand {
  padding: 0 0 16px;
}

.loginHint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sidebar {
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line);
}

.brandMark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #16332f;
  color: #f7fffd;
  font-size: 13px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 26px;
  line-height: 1.15;
}

h3 {
  font-size: 16px;
}

nav {
  display: grid;
  gap: 4px;
}

.navItem {
  color: #344457;
  background: transparent;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 7px;
  font-weight: 750;
  font-size: 14px;
  border: 1px solid transparent;
  text-align: left;
}

.navItem.active,
.navItem:hover {
  background: #eef7f6;
  color: #0f5f59;
  border-color: #cce5e1;
}

.status {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.55;
}

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

main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
  min-width: min(240px, 100%);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 16px;
  display: grid;
  gap: 7px;
  min-height: 112px;
  border-top: 3px solid var(--line-strong);
}

.metrics article:nth-child(1) {
  border-top-color: var(--teal);
}

.metrics article:nth-child(2) {
  border-top-color: var(--blue);
}

.metrics article:nth-child(3) {
  border-top-color: var(--amber);
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metrics strong {
  font-size: 23px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

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

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

.overviewGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

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

.debugGrid,
.commandList,
.readinessList {
  display: grid;
  gap: 8px;
}

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

.debugItem,
.commandItem {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.debugItem span,
.commandItem strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.debugItem strong,
.commandItem code {
  overflow-wrap: anywhere;
}

.commandItem {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.commandItem code {
  display: block;
  margin-top: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--text);
}

.checkItem {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.checkItem span {
  min-width: 48px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.checkItem.pass span {
  background: #dcfce7;
  color: #166534;
}

.checkItem.warn span {
  background: #fff7ed;
  color: #b45309;
}

.checkItem.fail span {
  background: #fee2e2;
  color: #b91c1c;
}

.checkItem strong {
  display: block;
  line-height: 1.25;
}

.checkItem p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.panel {
  padding: 16px;
}

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

.headHint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

form {
  display: grid;
  gap: 12px;
}

.fieldPair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.checkGrid label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.checkGrid input {
  width: auto;
}

label {
  display: grid;
  gap: 6px;
  color: #4c5f73;
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--text);
  background: #ffffff;
  outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.13);
}

textarea {
  resize: vertical;
  min-height: 178px;
  line-height: 1.45;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--teal);
  color: white;
  font-weight: 850;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

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

button:active {
  transform: translateY(1px);
}

.secondary {
  background: #233142;
}

.secondary:hover {
  background: #111827;
}

.ghost {
  min-height: 34px;
  padding: 7px 10px;
  background: #eef7f6;
  color: #0f5f59;
  border: 1px solid #cce5e1;
}

.ghost:hover {
  background: #dff0ed;
}

.danger {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.danger:hover {
  background: #ffe4e6;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.rowActions {
  display: flex;
  justify-content: end;
  gap: 8px;
}

.tableWrap {
  width: 100%;
  overflow-x: auto;
}

.tableTools {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 0 0 12px;
}

.filterBox {
  width: min(360px, 100%);
}

.dataTable {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

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

.dataTable th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  background: #f7fafb;
}

.sortButton {
  width: 100%;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}

.sortButton:hover {
  background: transparent;
  color: var(--teal);
}

.sortButton::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  color: var(--teal);
}

.sortButton.active[data-sort-dir="asc"]::after {
  content: "↑";
}

.sortButton.active[data-sort-dir="desc"]::after {
  content: "↓";
}

.dataTable td {
  font-size: 13px;
}

.dataTable tbody tr:hover {
  background: #fbfcfd;
}

.actionCol {
  width: 150px;
}

.tableMeta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.usageStack {
  display: grid;
  min-width: 220px;
  gap: 7px;
}

.usageStack .quota {
  gap: 5px;
}

.usageStack .quotaTop {
  font-size: 11px;
}

.usageStack .bar {
  height: 6px;
}

.usageRemain {
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
}

.modal.wideModal {
  width: min(1040px, calc(100vw - 28px));
}

.modal::backdrop {
  background: rgb(15 23 42 / 0.34);
}

.modalPanel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgb(31 45 61 / 0.2);
}

.reportBody {
  display: grid;
  gap: 14px;
  max-height: min(72vh, 780px);
  overflow: auto;
}

input[readonly] {
  color: var(--muted);
  background: #f4f7f8;
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.list.compact {
  margin-top: 0;
}

.list.compact .item {
  padding: 10px;
}

.item {
  border: 1px solid #e1e8ee;
  border-radius: 7px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  background: #fbfcfd;
  align-items: center;
}

.item strong {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.item .meta {
  grid-column: 1 / -1;
}

.item .submeta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e8f5f2;
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.blue {
  background: #eff6ff;
  color: #1d4ed8;
}

.pill.amber {
  background: #fff7ed;
  color: #b45309;
}

.quota {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
}

.quotaTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef3;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--teal);
}

.empty {
  padding: 24px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: #fbfcfd;
  text-align: center;
}

.output input,
.output textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  background: #182635;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgb(15 25 35 / 0.24);
}

@media (max-width: 920px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .navItem {
    text-align: center;
    padding-inline: 8px;
  }

  .topbar,
  .grid,
  .overviewGrid,
  .statusGrid,
  .readinessList,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar,
  .actions {
    display: grid;
  }

  .fieldPair {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main {
    padding: 14px;
  }

  .sidebar {
    padding: 16px 14px;
  }

  nav {
    grid-template-columns: 1fr 1fr;
  }

  h2 {
    font-size: 23px;
  }

  .item {
    grid-template-columns: 1fr;
  }

  .commandItem {
    grid-template-columns: 1fr;
  }
}
