:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-border: #dce1e7;
  --text: #111827;
  --muted: #687385;
  --primary: #166f62;
  --primary-dark: #0f5a50;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.shell-header {
  align-items: center;
  background: #111827;
  color: #fff;
  display: flex;
  gap: 20px;
  min-height: 64px;
  padding: 0 28px;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-weight: 800;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: #22c55e;
  border-radius: 6px;
  color: #052e16;
  display: inline-flex;
  font-size: 12px;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.nav-links {
  display: flex;
  gap: 6px;
  margin-right: auto;
}

.nav-links a {
  border-radius: 6px;
  color: #d1d5db;
  padding: 9px 12px;
  text-decoration: none;
}

.nav-links a.active,
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.shell-main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 30px 24px 56px;
}

.auth-main {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-main .flash {
  max-width: 430px;
  width: 100%;
}

.login-panel,
.panel,
.empty-state,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.login-panel {
  display: grid;
  gap: 26px;
  max-width: 430px;
  padding: 32px;
  width: 100%;
}

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

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

h1 {
  font-size: 32px;
  line-height: 1.15;
  margin-bottom: 6px;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 8px;
  text-transform: uppercase;
}

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

.button {
  align-items: center;
  background: #fff;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

.button:hover {
  background: #f3f6f8;
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(22, 111, 98, 0.25);
  outline-offset: 2px;
}

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

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

.button.ghost {
  background: transparent;
  color: inherit;
}

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

.button.danger:hover {
  background: #fef3f2;
}

.button.small {
  min-height: 34px;
  padding: 0 11px;
}

.button.full {
  width: 100%;
}

.flash {
  border-radius: var(--radius);
  font-weight: 700;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.flash.error {
  background: #fef3f2;
  color: var(--danger);
}

.flash.success {
  background: #ecfdf3;
  color: var(--success);
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.plugin-grid,
.split {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

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

.gateway-focus {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  margin-bottom: 18px;
}

.gateway-power {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.power-toggle {
  align-items: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  gap: 10px;
  min-height: 52px;
  padding: 6px 16px 6px 6px;
}

.power-toggle span {
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
  display: block;
  height: 40px;
  width: 40px;
}

.power-toggle strong {
  color: #fff;
  min-width: 28px;
}

.power-toggle.on {
  background: var(--success);
}

.power-toggle.off {
  background: #667085;
}

.monitor-panel .panel-head {
  margin-bottom: 10px;
}

.response-chart {
  align-items: end;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 5px;
  min-height: 88px;
  overflow: hidden;
  padding-top: 8px;
}

.chart-bar {
  background: #98a2b3;
  border-radius: 4px 4px 0 0;
  flex: 1;
  min-width: 5px;
}

.chart-bar.ok {
  background: var(--primary);
}

.chart-bar.fail {
  background: var(--danger);
}

.chart-empty {
  align-self: center;
  color: var(--muted);
  text-align: center;
  width: 100%;
}

.gateway-main,
.gateway-side {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.gateway-side {
  position: sticky;
  top: 18px;
}

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

.stat-tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
}

.stat-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-tile strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.panel {
  padding: 20px;
}

.panel-head {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pill,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.pill {
  background: #eef2f6;
  color: #334155;
}

.status.running,
.status.success {
  background: #dcfae6;
  color: var(--success);
}

.status.exited,
.status.not_deployed,
.status.unknown {
  background: #f2f4f7;
  color: #475467;
}

.status.error {
  background: #fef3f2;
  color: var(--danger);
}

.status.restarting {
  background: #fffaeb;
  color: var(--warning);
}

.meta-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.meta-list.compact {
  margin-bottom: 0;
}

.meta-list div {
  display: grid;
  gap: 4px;
}

.meta-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

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

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

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

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

.stack,
.form-panel {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.form-section-title {
  font-weight: 800;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

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

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

.control-grid {
  display: grid;
}

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

.event-row {
  align-items: center;
  border-top: 1px solid var(--panel-border);
  display: grid;
  gap: 10px;
  grid-template-columns: auto auto 1fr auto;
  padding-top: 10px;
}

.log-view {
  background: #0f172a;
  border-radius: 6px;
  color: #e5eefb;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  max-height: 440px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.env-summary {
  display: grid;
  gap: 10px;
  margin: 0;
}

.env-summary div {
  border-top: 1px solid var(--panel-border);
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.env-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.env-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.edit-form {
  margin: 0 auto;
  max-width: 980px;
}

.sticky-actions {
  background: linear-gradient(rgba(255, 255, 255, 0.92), #fff);
  border-top: 1px solid var(--panel-border);
  bottom: 0;
  margin: 4px -20px -20px;
  padding: 14px 20px;
  position: sticky;
}

.structured-field {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  padding: 14px;
}

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

.field-label {
  display: block;
  font-weight: 800;
  margin-bottom: 5px;
}

.structured-source {
  display: none;
}

.structured-note {
  background: #fffaeb;
  border: 1px solid #fedf89;
  border-radius: 6px;
  color: var(--warning);
  font-size: 14px;
  margin: 0;
  padding: 10px 12px;
}

.structured-table-wrap {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow-x: auto;
}

.structured-table th,
.structured-table td {
  white-space: nowrap;
}

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

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

.structured-dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  max-width: 560px;
  padding: 0;
  width: min(calc(100vw - 28px), 560px);
}

.structured-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.structured-dialog-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.structured-dialog-fields {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

code {
  background: #eef2f6;
  border-radius: 4px;
  padding: 2px 5px;
}

@media (max-width: 720px) {
  .shell-header,
  .page-heading,
  .event-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .shell-header {
    padding: 14px;
  }

  .nav-links {
    margin-right: 0;
  }

  .shell-main {
    padding: 20px 14px 40px;
  }
}

@media (max-width: 920px) {
  .gateway-focus,
  .gateway-layout {
    grid-template-columns: 1fr;
  }

  .gateway-side {
    position: static;
  }
}

@media (max-width: 640px) {
  .heading-actions,
  .actions {
    justify-content: stretch;
  }

  .heading-actions .button,
  .actions .button {
    width: 100%;
  }

  .stats-grid,
  .form-grid,
  .structured-dialog-fields {
    grid-template-columns: 1fr;
  }

  .structured-field-head {
    align-items: stretch;
    flex-direction: column;
  }

  .structured-field-head .button {
    width: 100%;
  }

  .structured-table thead {
    display: none;
  }

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

  .structured-table tr {
    border-bottom: 1px solid var(--panel-border);
    padding: 10px 0;
  }

  .structured-table tr:last-child {
    border-bottom: 0;
  }

  .structured-table td {
    align-items: center;
    border-bottom: 0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 10px;
    white-space: normal;
  }

  .structured-table td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 96px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .structured-empty {
    display: block;
    padding: 16px 10px;
    text-align: center;
  }

  .structured-empty::before {
    content: "";
    display: none;
  }

  .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .gateway-power {
    align-items: stretch;
    flex-direction: column;
  }

  .gateway-power form,
  .power-toggle {
    width: 100%;
  }

  .power-toggle {
    justify-content: space-between;
  }

  .log-view {
    max-height: 340px;
  }
}

/* Operations dashboard refresh */
:root {
  --ops-navy: #0f172a;
  --ops-blue: #2563eb;
  --ops-cyan: #0891b2;
  --ops-green: #15803d;
  --ops-amber: #b45309;
  --ops-red: #b42318;
  --ops-surface: #f8fafc;
  --ops-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.shell-header { border-bottom: 1px solid #dbe3ee; box-shadow: 0 1px 0 rgba(15, 23, 42, .03); }
.shell-main { max-width: 1320px; }
.brand-mark { background: linear-gradient(145deg, var(--ops-blue), var(--ops-cyan)); box-shadow: 0 5px 14px rgba(37, 99, 235, .25); }
.button { cursor: pointer; transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(37, 99, 235, .3); outline-offset: 2px; }
.button.primary { background: var(--ops-blue); border-color: var(--ops-blue); box-shadow: 0 6px 14px rgba(37, 99, 235, .2); }

.dashboard-heading { margin-bottom: 18px; }
.overview-strip { background: var(--ops-navy); border-radius: 12px; color: white; display: grid; gap: 1px; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; overflow: hidden; }
.overview-strip > div { background: rgba(255,255,255,.035); display: grid; gap: 6px; padding: 18px 20px; }
.overview-strip span { color: #aebed4; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.overview-strip strong { font-size: 26px; }
.gateway-cards { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gateway-card { background: white; border: 1px solid #dbe3ee; border-radius: 12px; box-shadow: var(--ops-shadow); display: grid; gap: 18px; padding: 20px; }
.gateway-card-head, .gateway-card-foot { align-items: center; display: flex; gap: 16px; justify-content: space-between; }
.gateway-card-head h2 { margin: 2px 0 0; }
.gateway-card-head h2 a { color: var(--ops-navy); text-decoration: none; }
.gateway-card-metrics { border-block: 1px solid #e5eaf1; display: grid; grid-template-columns: repeat(4, 1fr); }
.gateway-card-metrics > div { display: grid; gap: 5px; padding: 14px 10px; }
.gateway-card-metrics > div + div { border-left: 1px solid #e5eaf1; }
.gateway-card-metrics span { color: var(--muted); font-size: 12px; font-weight: 700; }
.gateway-card-metrics strong { font-size: 14px; overflow-wrap: anywhere; text-transform: capitalize; }
.power-toggle.compact { min-width: 132px; padding: 9px 12px; }

.status.degraded, .status.error { background: #fef3f2; color: var(--ops-red); }
.status.pending, .status.unconfigured, .status.warning { background: #fff7ed; color: var(--ops-amber); }
.status.healthy, .status.success, .status.running { background: #ecfdf3; color: var(--ops-green); }
.status.stopped, .status.exited, .status.not_deployed { background: #f1f5f9; color: #475569; }

.section-tabs { background: white; border: 1px solid #dbe3ee; border-radius: 10px; display: flex; gap: 4px; margin: 0 0 20px; overflow-x: auto; padding: 5px; position: sticky; top: 8px; z-index: 4; }
.section-tabs a { border-radius: 7px; color: #475569; font-size: 14px; font-weight: 750; padding: 9px 12px; text-decoration: none; white-space: nowrap; }
.section-tabs a:hover { background: #eff6ff; color: var(--ops-blue); }
.section-tabs a.active { background: var(--ops-navy); color: white; }
.real-tabs { position: static; }
.compact-heading { margin-bottom: 16px; }
.back-link { color: var(--ops-blue); display: inline-block; font-size: 13px; font-weight: 750; margin-bottom: 14px; text-decoration: none; }
.back-link::before { content: "← "; }
.tab-intro { align-items: end; display: flex; justify-content: space-between; margin: 24px 0 14px; }
.tab-intro h2 { font-size: 24px; margin-bottom: 4px; }
.concise-focus { margin-bottom: 16px; }
.overview-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); }
.compact-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.routing-panel { max-width: 980px; }
.focused-log { max-height: calc(100vh - 300px); min-height: 480px; }
.domain-panel { scroll-margin-top: 72px; }
.domain-add-form { align-items: end; background: var(--ops-surface); border: 1px solid #e2e8f0; border-radius: 9px; display: grid; gap: 12px; grid-template-columns: 1.4fr 1fr auto; margin: 16px 0; padding: 14px; }
.domain-add-form label, .gateway-select-form label, .integration-card label { display: grid; font-weight: 750; gap: 6px; }
.input-with-action { display: flex; position: relative; }
.input-with-action input { padding-right: 116px; }
.input-suffix-button { align-items: center; background: #eff6ff; border: 0; border-left: 1px solid #bfdbfe; border-radius: 0 6px 6px 0; color: var(--ops-blue); cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 800; gap: 6px; height: calc(100% - 2px); padding: 0 12px; position: absolute; right: 1px; top: 1px; }
.input-suffix-button:hover { background: #dbeafe; }
.input-suffix-button:focus-visible { outline: 3px solid rgba(37, 99, 235, .3); outline-offset: 2px; }
.input-suffix-button:disabled { cursor: wait; opacity: .65; }
.input-suffix-button svg { fill: currentColor; height: 16px; width: 16px; }
.input-suffix-button.loading svg { animation: resolve-pulse .8s ease-in-out infinite alternate; }
.domain-resolve-status { color: var(--muted); font-size: 13px; grid-column: 1 / -1; margin: -4px 0 0; min-height: 18px; }
.domain-resolve-status.success { color: var(--ops-green); }
.domain-resolve-status.error { color: var(--ops-red); }
@keyframes resolve-pulse { to { opacity: .25; transform: scale(.82); } }
.count-pill { background: #eff6ff; border-radius: 999px; color: var(--ops-blue); font-size: 12px; font-weight: 800; padding: 6px 10px; }
.inline-empty { align-items: center; border: 1px dashed #cbd5e1; border-radius: 8px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; padding: 26px; text-align: center; }
.gateway-select-form { align-items: end; display: grid; gap: 14px; grid-template-columns: minmax(260px, 1fr) auto; margin: 16px 0 20px; max-width: 760px; }
.sync-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sync-card { border: 1px solid #dbe3ee; border-radius: 9px; padding: 14px; }
.sync-card > div { align-items: center; display: flex; justify-content: space-between; }
.sync-card p { color: var(--muted); min-height: 22px; }
.sync-card small { color: #64748b; }
.integration-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.integration-card { align-content: start; display: grid; gap: 16px; margin: 0; }
.integration-link-card { grid-template-rows: auto 1fr auto; }
.integration-link-card .button { justify-self: start; }
.integration-form-page { display: grid; gap: 18px; margin: 0 auto; max-width: 760px; }
.integration-form-page > label { display: grid; font-weight: 750; gap: 7px; }
.form-page-actions { border-top: 1px solid #e2e8f0; margin-top: 4px; padding-top: 18px; }
.helper-downloads { margin-top: 20px; }
.platform-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.platform-card { background: #f8fafc; border: 1px solid #dbe3ee; border-radius: 10px; display: grid; gap: 16px; padding: 18px; }
.platform-card-head { align-items: center; display: flex; gap: 12px; }
.platform-card-head h3, .platform-card-head p { margin: 0; }
.platform-card-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.platform-icon { align-items: center; background: #e8f0ff; border-radius: 9px; color: #185abd; display: inline-flex; font-size: 18px; font-weight: 900; height: 42px; justify-content: center; width: 42px; }
.platform-icon.linux { background: #fff3dc; color: #8a5200; }
.install-steps { color: #475569; display: grid; gap: 7px; margin: 0; padding-left: 22px; }
.command-snippet { background: #0f172a; border-radius: 7px; color: #e2e8f0; font-size: 12px; margin: 0; overflow-x: auto; padding: 12px; white-space: pre-wrap; }
.download-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.guide-callout { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; margin-top: 16px; padding: 14px 16px; }
.guide-callout p { color: #475569; margin: 5px 0 0; }
.integration-actions { grid-column: 1 / -1; justify-content: flex-end; }
.check-row { align-items: center; display: flex !important; flex-direction: row; }
.check-row input { width: auto; }

.network-heading { align-items: center; display: flex; gap: 20px; justify-content: space-between; }
.network-kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0; }
.stat-card { background: var(--ops-navy); border-radius: 10px; color: white; display: grid; gap: 4px; padding: 16px 18px; }
.stat-card strong { font-size: 25px; }
.stat-card span { color: #b8c6d9; font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.status-pill { align-items: center; border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 800; padding: 7px 11px; white-space: nowrap; }
.status-pill.healthy { background: #ecfdf3; color: var(--ops-green); }
.status-pill.warning { background: #fff7ed; color: var(--ops-amber); }
.status-pill.neutral { background: #eef2f7; color: #475569; }
.network-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.network-panel { margin: 0; min-width: 0; }
.network-panel .section-heading { align-items: start; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 16px; }
.network-panel .section-heading h2 { margin: 2px 0 0; }
.network-panel details { border-top: 1px solid #e2e8f0; margin-top: 16px; padding-top: 14px; }
.network-panel summary { color: var(--ops-blue); cursor: pointer; font-weight: 800; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.form-grid label, .inline-form label { display: grid; font-weight: 750; gap: 6px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-grid .checkbox { align-items: center; display: flex; flex-direction: row; }
.form-grid .checkbox input { width: auto; }
.inline-form { align-items: end; display: grid; gap: 12px; grid-template-columns: 1fr 150px auto; margin-top: 16px; }
.compact-list { display: grid; gap: 1px; list-style: none; margin: 0; padding: 0; }
.compact-list li { align-items: center; background: #f8fafc; display: flex; gap: 12px; justify-content: space-between; padding: 10px 12px; }
.compact-list li:first-child { border-radius: 8px 8px 0 0; }
.compact-list li:last-child { border-radius: 0 0 8px 8px; }
.compact-list li span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.empty-state { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; color: var(--muted); padding: 18px; text-align: center; }
.reconciliation-panel { grid-column: 1 / -1; }
.preview-summary { display: grid; gap: 1px; grid-template-columns: repeat(4, 1fr); overflow: hidden; }
.preview-summary span { background: #f8fafc; display: grid; gap: 3px; padding: 12px; text-align: center; }
.preview-summary strong { color: var(--ops-navy); font-size: 20px; }
.code-preview { background: #0f172a; border-radius: 8px; color: #dbeafe; max-height: 420px; overflow: auto; padding: 14px; white-space: pre; }
.danger-zone { align-items: center; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 9px; display: flex; gap: 18px; justify-content: space-between; margin-top: 16px; padding: 14px; }
.danger-zone p { margin: 0; max-width: 780px; }
.button.danger { background: #b42318; border-color: #b42318; color: white; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }

@media (max-width: 820px) {
  .gateway-cards, .integration-grid, .sync-grid, .platform-grid, .overview-grid, .network-grid { grid-template-columns: 1fr; }
  .reconciliation-panel { grid-column: auto; }
  .network-kpis, .preview-summary { grid-template-columns: repeat(2, 1fr); }
  .integration-actions { grid-column: auto; }
  .overview-strip { grid-template-columns: repeat(2, 1fr); }
  .domain-add-form { grid-template-columns: 1fr 1fr; }
  .domain-add-form .button { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .overview-strip, .domain-add-form, .gateway-select-form { grid-template-columns: 1fr; }
  .gateway-card-head, .gateway-card-foot { align-items: stretch; flex-direction: column; }
  .gateway-card-metrics { grid-template-columns: 1fr; }
  .gateway-card-metrics > div + div { border-left: 0; border-top: 1px solid #e5eaf1; }
  .power-toggle.compact { width: 100%; }
  .section-tabs { margin-inline: -8px; }
  .real-tabs { border-radius: 0; padding-inline: 8px; }
  .real-tabs a { flex: 0 0 auto; }
  .compact-heading .heading-actions { align-items: stretch; width: 100%; }
  .compact-heading .heading-actions form { width: 100%; }
  .focused-log { min-height: 360px; }
  .network-heading, .danger-zone { align-items: stretch; flex-direction: column; }
  .network-kpis, .preview-summary, .form-grid, .inline-form { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: auto; }
}

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