:root {
  color-scheme: dark;
  --bg: #080b12;
  --surface: #101621;
  --surface-raised: #151d2b;
  --surface-soft: #0c111b;
  --border: #263246;
  --border-strong: #3b4a63;
  --text: #f3f6fb;
  --muted: #a7b2c5;
  --subtle: #76849b;
  --primary: #4f8cff;
  --primary-hover: #6ca0ff;
  --primary-action: #2563eb;
  --primary-action-hover: #1d4ed8;
  --primary-soft: #172b4f;
  --positive: #42d392;
  --positive-soft: #12342b;
  --warning: #ffb454;
  --warning-soft: #392912;
  --danger: #ff727c;
  --danger-soft: #3b1c23;
  --focus: #8cb5ff;
  --shadow: 0 24px 70px rgb(0 0 0 / 45%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --max-width: 1440px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-soft: #edf2f8;
    --border: #d7e0eb;
    --border-strong: #b8c5d6;
    --text: #172033;
    --muted: #526178;
    --subtle: #59697f;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #e4edff;
    --positive: #06684b;
    --positive-soft: #dff7ed;
    --warning: #9a5b00;
    --warning-soft: #fff0d6;
    --danger: #c92a3a;
    --danger-soft: #ffe7e9;
    --focus: #1d4ed8;
    --shadow: 0 24px 70px rgb(32 49 78 / 18%);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

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

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
summary {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 58%, transparent);
  outline-offset: 2px;
}

a {
  color: var(--primary-hover);
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.dialog-icon,
.empty-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border));
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.brand-mark svg,
.dialog-icon svg,
.empty-icon svg {
  width: 23px;
  height: 23px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -.01em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.connection-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.connection-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-raised);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--subtle);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--subtle) 17%, transparent);
}

.connection-button.connected .connection-dot {
  background: var(--positive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--positive) 18%, transparent);
}

.shell {
  width: min(calc(100% - clamp(32px, 8vw, 112px)), var(--max-width));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-hover);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(29px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.hero-copy {
  max-width: 730px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions,
.dialog-actions {
  display: flex;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.button .icon,
.search-field .icon {
  width: 18px;
  height: 18px;
}

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

.button.primary:hover:not(:disabled) {
  border-color: var(--primary-action-hover);
  background: var(--primary-action-hover);
}

.button.secondary {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.button.secondary:hover:not(:disabled),
.button.ghost:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

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

.button.full {
  width: 100%;
}

.button:disabled {
  cursor: wait;
  opacity: .58;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
}

.stat-card {
  min-height: 150px;
  padding: 21px;
  border-radius: var(--radius-md);
}

.stat-label,
.stat-note {
  display: block;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.stat-value {
  display: block;
  min-height: 48px;
  margin: 12px 0 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 32px;
  line-height: 1.35;
  letter-spacing: -.04em;
}

.stat-value.positive {
  color: var(--positive);
}

.stat-note {
  color: var(--subtle);
  font-size: 12px;
}

.panel {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin-bottom: 3px;
  font-size: 18px;
  letter-spacing: -.015em;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--subtle);
  font-size: 12px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(100%, 300px);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--subtle);
}

.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--subtle);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.account-name {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-weight: 700;
}

.account-meta,
.cell-note {
  display: block;
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.credit-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.badge.healthy {
  border-color: color-mix(in srgb, var(--positive) 38%, transparent);
  background: var(--positive-soft);
  color: var(--positive);
}

.badge.warning {
  border-color: color-mix(in srgb, var(--warning) 38%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.danger,
.badge.disabled {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button.danger:hover {
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 64px 24px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state h3 {
  margin: 16px 0 5px;
  font-size: 17px;
}

.empty-state p {
  max-width: 430px;
  margin-bottom: 20px;
  color: var(--muted);
}

.api-section {
  margin-top: 56px;
  scroll-margin-top: 94px;
}

.api-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}

.api-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -.03em;
}

.api-heading > div > p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 16px;
}

.api-card,
.quickstart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.api-card {
  min-width: 0;
  padding: 22px;
}

.api-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.api-card-heading h3 {
  margin-bottom: 2px;
  font-size: 17px;
}

.api-card-heading p {
  margin-bottom: 0;
  color: var(--subtle);
  font-size: 11px;
}

.api-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--primary) 50%, var(--border));
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.api-card-icon svg,
.security-note svg {
  width: 21px;
  height: 21px;
}

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

.access-placeholder,
.credential-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.credential-item {
  display: grid;
  grid-template-columns: minmax(110px, .35fr) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.credential-caller {
  min-width: 0;
}

.credential-caller strong,
.credential-caller small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credential-caller strong { font-size: 13px; }
.credential-caller small { color: var(--subtle); font-size: 10px; }

.credential-value {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.credential-value:focus { border-color: var(--primary); }

.copy-button,
.reveal-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.copy-button:hover,
.reveal-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--subtle);
  font-size: 11px;
}

.security-note svg {
  flex: 0 0 auto;
  color: var(--positive);
}

.endpoint-list {
  display: grid;
  gap: 2px;
  margin: 0;
}

.endpoint-list > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.endpoint-list > div:first-child { padding-top: 0; }
.endpoint-list > div:last-child { padding-bottom: 0; border-bottom: 0; }

.endpoint-list dt {
  margin-bottom: 5px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.endpoint-list dd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.endpoint-list code,
.endpoint-list a {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-list a { color: var(--primary-hover); }

.quickstart-card {
  display: grid;
  grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr);
  gap: 28px;
  margin-top: 16px;
  padding: 24px;
}

.quickstart-copy h3 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -.02em;
}

.quickstart-copy > p:not(.eyebrow) {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.request-flow {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.request-flow li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.request-flow li > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.code-sample {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #263246;
  border-radius: var(--radius-md);
  background: #080b12;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 7px 9px 7px 16px;
  border-bottom: 1px solid #263246;
  color: #a7b2c5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.copy-button.inverse {
  border-color: #3b4a63;
  background: #151d2b;
  color: #f3f6fb;
}

.code-sample pre {
  min-height: 250px;
  max-height: 400px;
  padding: 18px;
  margin: 0;
  overflow: auto;
  color: #d6deeb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}

.code-sample pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.dialog {
  width: min(calc(100% - 32px), 760px);
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgb(0 0 0 / 62%);
  backdrop-filter: blur(4px);
}

.dialog form {
  padding: 28px;
}

.auth-dialog {
  width: min(calc(100% - 32px), 460px);
}

.auth-dialog form {
  padding: 32px;
}

.dialog-heading,
.dialog-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dialog-topbar {
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.dialog h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -.025em;
}

.dialog-heading .eyebrow,
.dialog-topbar .eyebrow {
  margin-bottom: 3px;
}

.dialog-copy {
  margin-bottom: 22px;
  color: var(--muted);
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .88em;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.field em {
  margin-left: 5px;
  color: var(--subtle);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 450;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 17%, transparent);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field small {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 450;
}

.input-with-action {
  position: relative;
  display: block;
}

.input-with-action input {
  padding-right: 52px;
}

.input-with-action .icon-button {
  position: absolute;
  top: 0;
  right: 0;
}

.eye-closed {
  display: none;
}

.input-with-action.revealed .eye-open {
  display: none;
}

.input-with-action.revealed .eye-closed {
  display: block;
}

.import-guide {
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.guide-title {
  margin-bottom: 12px;
  font-weight: 700;
}

.guide-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--warning);
  font-size: 12px;
}

.import-guide ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.import-guide li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.import-guide li > span {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.import-guide li p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

.field-help-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.format-status {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 650;
}

.format-status.valid {
  color: var(--positive);
}

.format-status.invalid {
  color: var(--danger);
}

.advanced-fields {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.advanced-fields summary {
  min-height: 48px;
  padding: 14px 2px;
  color: var(--muted);
  font-weight: 700;
}

.details-grid {
  padding: 4px 0 20px;
}

.form-error {
  min-height: 22px;
  margin: 14px 0 4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.dialog-actions {
  justify-content: flex-end;
  padding-top: 10px;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  width: min(calc(100% - 40px), 380px);
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--positive);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1000px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-grid,
  .quickstart-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-header {
    min-height: 64px;
  }

  .brand small,
  .connection-button #connection-label {
    display: none;
  }

  .connection-button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .shell {
    width: min(calc(100% - 28px), var(--max-width));
    padding-top: 32px;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .search-field {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
  }

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

  td {
    padding: 0;
    border: 0;
  }

  td:first-child,
  td:last-child {
    grid-column: 1 / -1;
  }

  td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--subtle);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .07em;
    text-transform: uppercase;
  }

  td:first-child::before,
  td:last-child::before {
    display: none;
  }

  .row-actions {
    justify-content: flex-start;
    padding-top: 2px;
  }

  .import-guide ol {
    grid-template-columns: 1fr;
  }

  .api-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .credential-caller {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .hero-actions,
  .dialog-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .hero-actions .button {
    flex: 1 1 140px;
  }

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

  .stat-card {
    min-height: 128px;
  }

  .dialog form,
  .auth-dialog form {
    padding: 22px 18px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .dialog-actions .button {
    flex: 1 1 100%;
  }

  .dialog-actions .ghost {
    order: 3;
  }

  .field-help-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-heading .button {
    width: 100%;
  }

  .api-card,
  .quickstart-card {
    padding: 18px;
  }

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

  .credential-value,
  .credential-caller {
    grid-column: 1 / -1;
  }

  .endpoint-list dd {
    align-items: stretch;
    flex-direction: column;
  }

  .endpoint-list .copy-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
