:root {
  --bg: #111416;
  --surface: #171b1f;
  --surface-soft: #20262b;
  --line: #313a42;
  --ink: #f4f2ed;
  --muted: #aeb7bf;
  --quiet: #838e96;
  --teal: #65b8ad;
  --amber: #d6a85e;
  --red: #d96f78;
  --blue: #7aa7d9;
  --green: #76bd86;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.admin-shell {
  min-height: 100vh;
  padding-bottom: 62px;
}

.topbar {
  align-items: center;
  background: rgba(17, 20, 22, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(16px, 3vw, 34px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand__logo {
  display: block;
  height: 42px;
  max-width: min(230px, 42vw);
  object-fit: contain;
}

.brand__scope {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-height: 27px;
  padding: 5px 10px;
}

.topbar__controls {
  align-items: end;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.org-picker,
.filter-field {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.org-picker select,
.filter-field select {
  min-width: 220px;
}

select,
input,
textarea {
  background: #0e1113;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

input[type="checkbox"] {
  min-height: auto;
  width: auto;
}

select:focus,
input:focus,
textarea:focus,
button:focus {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.icon-button {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-size: 20px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  min-width: 38px;
}

.tabs {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 clamp(16px, 3vw, 34px);
}

.tab-button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  min-height: 49px;
  padding: 0 16px;
  white-space: nowrap;
}

.tab-button.is-active {
  border-color: var(--teal);
  color: var(--ink);
}

.workspace {
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px clamp(14px, 3vw, 34px);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

.section-heading {
  margin-bottom: 20px;
}

.eyebrow,
.metric-card__label {
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 28px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  line-height: 1.16;
}

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

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-bottom: 18px;
}

.action-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.action-form {
  align-content: start;
  display: grid;
  gap: 12px;
}

.action-form--wide {
  margin-bottom: 18px;
}

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

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

.primary-button,
.secondary-button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
}

.primary-button {
  background: var(--teal);
  border: 1px solid transparent;
  color: #081311;
}

.secondary-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary-button--aligned {
  align-self: end;
}

.checkbox-field {
  align-content: end;
  align-items: center;
  display: flex;
  gap: 9px;
  min-height: 38px;
}

.copy-line {
  background: #0e1113;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
  overflow-wrap: anywhere;
  padding: 9px 10px;
}

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

.metric-card,
.panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 102px;
  padding: 15px;
}

.metric-card strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  margin-top: 14px;
}

.split-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.growth-filters {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.growth-filters .filter-field {
  min-width: 190px;
}

.panel {
  min-width: 0;
  padding: 17px;
}

.status-badge {
  align-items: center;
  background: rgba(122, 167, 217, 0.14);
  border: 1px solid rgba(122, 167, 217, 0.4);
  border-radius: 999px;
  color: #d9ecff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 27px;
  padding: 5px 10px;
  white-space: nowrap;
}

.status-badge[data-tone="good"] {
  background: rgba(118, 189, 134, 0.14);
  border-color: rgba(118, 189, 134, 0.42);
  color: #d8ffe0;
}

.status-badge[data-tone="warn"] {
  background: rgba(214, 168, 94, 0.14);
  border-color: rgba(214, 168, 94, 0.45);
  color: #ffe8bd;
}

.status-badge[data-tone="bad"] {
  background: rgba(217, 111, 120, 0.14);
  border-color: rgba(217, 111, 120, 0.48);
  color: #ffd9dd;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div,
.stack-item {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.detail-list dt,
.stack-item span,
th {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  color: var(--ink);
  font-size: 14px;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-wrap {
  margin-bottom: 18px;
  overflow: auto;
}

.table-select,
.table-input {
  min-width: 150px;
}

.table-input {
  min-width: 220px;
}

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

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

tbody tr:last-child td {
  border-bottom: 0;
}

td {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

td strong,
.stack-item strong {
  color: var(--ink);
  font-weight: 800;
}

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

.stack-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.stack-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.stack-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: anywhere;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-list a {
  color: #caefe9;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.device-test-grid {
  display: grid;
  gap: 10px;
}

.device-test-item {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  padding-top: 10px;
}

.device-test-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.device-test-item a {
  color: #caefe9;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.device-test-item span {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  color: var(--quiet);
  font-size: 14px;
  padding: 12px 0;
}

.status-line {
  background: rgba(17, 20, 22, 0.96);
  border-top: 1px solid var(--line);
  bottom: 0;
  color: var(--muted);
  font-size: 13px;
  left: 0;
  margin: 0;
  padding: 12px clamp(16px, 3vw, 34px);
  position: fixed;
  right: 0;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

@media (max-width: 820px) {
  .topbar,
  .topbar__controls,
  .section-heading,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .org-picker select,
  .filter-field select {
    min-width: 0;
    width: 100%;
  }

  .metric-grid,
  .split-layout,
  .action-grid,
  .form-row,
  .form-row--four {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
