:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #172026;
  --muted: #5f6b76;
  --line: #d9dee5;
  --accent: #176b5b;
  --accent-strong: #0d4f43;
  --danger: #b3261e;
  --shadow: 0 16px 40px rgba(22, 32, 38, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101417;
    --surface: #171d21;
    --surface-2: #20282d;
    --text: #eff3f6;
    --muted: #a8b2bc;
    --line: #303a42;
    --accent: #4cc3a7;
    --accent-strong: #80dbc8;
    --danger: #ffb4ab;
    --shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--surface-2);
}

.danger {
  border-color: color-mix(in srgb, var(--danger), transparent 55%);
  color: var(--danger);
  background: transparent;
}

.icon {
  width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.app {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

.tab {
  justify-content: start;
  width: 100%;
  text-align: left;
}

.tab.active {
  border-color: color-mix(in srgb, var(--accent), transparent 55%);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--accent-strong);
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel {
  display: none;
}

.active-panel {
  display: block;
}

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

.metric,
.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
}

.metric span,
.item small {
  color: var(--muted);
}

.metric strong {
  overflow-wrap: anywhere;
  font-size: 22px;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.item-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  min-width: 0;
}

.item-title strong,
.mono {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

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

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

td {
  overflow-wrap: anywhere;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
}

textarea {
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
}

.check-row input {
  width: auto;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.46);
}

.dialog-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-form header,
.dialog-form menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.dialog-form menu {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secret,
.error {
  margin: 0;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

  .sidebar {
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .tab {
    justify-content: center;
    padding-inline: 8px;
    text-align: center;
  }

  .content {
    padding: 18px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 520px) {
  .tabs,
  .metrics {
    grid-template-columns: 1fr;
  }

  .actions,
  .dialog-form menu {
    display: grid;
    grid-template-columns: 1fr;
  }
}
