:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --border: #d8dee6;
  --text: #17202a;
  --muted: #667085;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 8px 22px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

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

.topbar {
  margin-bottom: 18px;
}

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

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

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

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

.status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.status-muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.status-ok {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status-error {
  border-color: rgba(180, 35, 24, 0.25);
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.icon-button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 0 14px;
}

.icon-button:hover {
  background: var(--accent-strong);
}

.notice {
  margin-bottom: 16px;
  border: 1px solid rgba(161, 92, 7, 0.24);
  border-radius: 8px;
  background: rgba(161, 92, 7, 0.08);
  color: #7a4100;
  padding: 12px 14px;
  font-size: 14px;
}

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

.metric,
.sidebar,
.content-area,
.table-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.sidebar,
.content-area,
.table-section {
  min-width: 0;
  padding: 16px;
}

.subsection {
  margin-top: 24px;
}

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

.group-button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 10px;
  text-align: left;
}

.group-button:hover,
.group-button.active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.group-button strong,
.group-button span {
  display: block;
}

.group-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

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

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

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

td {
  font-size: 14px;
}

.mono {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-top: 16px;
  align-items: end;
}

.inline-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.inline-form input,
.inline-form select {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font: inherit;
  padding: 7px 9px;
}

.inline-form input:focus,
.inline-form select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.14);
}

.table-input,
.table-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
}

.compact-input {
  max-width: 86px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.compact-row {
  flex-wrap: wrap;
  min-width: 320px;
  margin-top: 8px;
}

.alias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.pill {
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 3px 8px;
}

.small-button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.small-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-button {
  color: var(--danger);
}

.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.small-button:disabled:hover {
  border-color: var(--border);
  color: var(--text);
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics-grid,
  .workspace,
  .inline-form {
    grid-template-columns: 1fr;
  }
}
