:root {
  color-scheme: light;
  --sidebar: #27557C;
  --sidebar-text: #F4FAFF;
  --sidebar-muted: #C2D9EC;
  --brand: #2879B9;
  --bg-page: #F2F8FC;
  --bg-panel: #FFFFFF;
  --bg-panel-raised: #F6FAFD;
  --bg-overlay: #EBF4FA;
  --bg-input: #FFFFFF;
  --border: #D2E1EB;
  --border-strong: #91AFC3;
  --border-accent: #72B6E8;
  --text: #172B3C;
  --text-muted: #5D7282;
  --text-soft: #435F73;
  --text-inverse: #FFFFFF;
  --accent: #70C5F5;
  --accent-strong: #438FD1;
  --accent-soft: #E1F2FC;
  --line: #E1EBF2;
  --row: #F7FBFE;
  --row-selected: #E5F3FB;
  --success: #14663F;
  --success-bg: #E3F4EA;
  --success-border: #A9D6BB;
  --fail: #A3281C;
  --fail-bg: #FBE9E7;
  --fail-border: #E2B4AE;
  --warning-bg: #FDF1DC;
  --warning-fg: #8A5A0B;
  --pending: #8A5A0B;
  --skip-bg: #EDF0F5;
  --skip-border: #C7D1DE;
  --shadow: 0 1px 2px rgba(15, 42, 77, .07);
}

body[data-theme="light"] { color-scheme: light; }

body[data-theme="dark"] {
  color-scheme: dark;
  --sidebar: #14283A;
  --sidebar-text: #EAF5FC;
  --sidebar-muted: #B2C7D8;
  --brand: #82C8F3;
  --bg-page: #0D1721;
  --bg-panel: #151B24;
  --bg-panel-raised: #1A212B;
  --bg-overlay: #1D2530;
  --bg-input: #151B24;
  --border: #2C3644;
  --border-strong: #7D8A9B;
  --border-accent: #6AA9FF;
  --text: #E8ECF2;
  --text-muted: #A7B1BF;
  --text-soft: #B1BCCA;
  --text-inverse: #08142A;
  --accent: #83CEF6;
  --accent-strong: #75BCEE;
  --accent-soft: #1B3345;
  --line: #222B37;
  --row: #1A212B;
  --row-selected: #212A36;
  --success: #7DD3A6;
  --success-bg: #163A29;
  --success-border: #356B4D;
  --fail: #F2A59B;
  --fail-bg: #43201C;
  --fail-border: #78413A;
  --warning-bg: #40300F;
  --warning-fg: #EBC070;
  --pending: #EBC070;
  --skip-bg: #232B36;
  --skip-border: #484D55;
  --shadow: none;
}

* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background: var(--bg-page);
  min-height: 100vh;
}

code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  background: var(--bg-overlay);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ── shell layout ───────────────────────────────────────────── */

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 20px;
}

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

.brand-mark {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.icon-btn:hover { border-color: var(--border-accent); }
.icon-btn:active { transform: scale(0.94); }

.app-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── step nav (the "menu") ──────────────────────────────────── */

.stepnav {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.stepnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.stepnav-item:hover {
  background: var(--bg-panel-raised);
  color: var(--text);
}

.stepnav-item.active {
  background: var(--row-selected);
  color: var(--text);
  border-left-color: var(--accent);
}

.stepnav-num {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-muted);
}

.stepnav-item.active .stepnav-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inverse);
}

/* ── panels ──────────────────────────────────────────────────── */

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  scroll-margin-top: 20px;
  overflow: hidden;
}

.panel-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.panel-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.panel-body {
  padding: 18px 22px 22px;
}

.panel-body > * + * { margin-top: 14px; }

h3.subhead {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-soft);
  margin: 4px 0 8px;
}

/* ── form controls ──────────────────────────────────────────── */

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.field.grow { flex: 1; }

.field-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.field-label .optional {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  opacity: 0.8;
}

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

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus, select:focus, textarea:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, .14);
}

input::placeholder { color: var(--text-muted); opacity: 0.7; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-strong);
}

details.advanced {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-overlay);
  padding: 4px 14px;
}

details.advanced summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 12.5px;
  padding: 10px 0;
  list-style: none;
  color: var(--text);
}

/* display:flex directly on <summary> breaks Chrome's native click-to-toggle
   (confirmed: .open toggled fine via JS but not via click) - so the arrow
   is an inline ::before instead of a flex child. */
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--text-muted);
  transition: transform 0.12s ease;
}
details.advanced[open] summary::before { transform: rotate(90deg); }

details.advanced .panel-body-inner {
  padding-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── buttons ─────────────────────────────────────────────────── */

button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-panel-raised);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, transform 0.06s ease, opacity 0.12s ease;
}
button:hover { border-color: var(--border-accent); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
body[data-theme="light"] button.btn-primary { color: #fffaf2; }
button.btn-primary:hover { filter: brightness(1.08); }

button.btn-danger-outline {
  background: transparent;
  border-color: var(--fail-border);
  color: var(--fail);
}
button.btn-danger-outline:hover { background: var(--fail-bg); }

button.btn-ghost {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
}
button.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-panel-raised); }

/* ── tables ──────────────────────────────────────────────────── */

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

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-overlay);
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--row); }

table input:not([type="checkbox"]):not([type="radio"]), table select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12.5px;
}

.icon-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  background: transparent;
  color: var(--text-muted);
}
.icon-remove:hover { color: var(--fail); border-color: var(--fail-border); background: var(--fail-bg); }

/* ── status pills / dots ────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--text-muted);
  flex-shrink: 0;
}

.pill-up .dot { background: var(--success); }
.pill-down .dot { background: var(--fail); }
.pill-mid .dot { background: var(--pending); }

.active-app {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 14px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  color: var(--text);
}

.meta-line {
  font-size: 12px;
  color: var(--text-muted);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ── log console ─────────────────────────────────────────────── */

.log {
  background: #101722;
  color: #B5D3FF;
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 10px;
  max-height: 340px;
  overflow-y: auto;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 44px;
}

.log:empty::before {
  content: "Output will appear here…";
  color: #7D8A9B;
  font-style: italic;
}

/* ── per-service action row + modal ─────────────────────────── */

#statusTable th:last-child { text-align: right; }

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

.row-actions button {
  font-size: 11px;
  padding: 5px 9px;
}

.service-icon-action {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--bg-panel);
  font: 700 15px/1 ui-monospace, monospace;
  cursor: pointer;
  position: relative;
  overflow: visible;
}
.service-icon-action:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: var(--bg-panel-raised); }
.service-icon-action[data-action="remove-plugin"] { color: var(--fail); }
.service-icon-action[data-action="remove-plugin"]:hover:not(:disabled) { color: var(--fail); border-color: var(--fail); background: var(--fail-bg); }
.service-icon-action:disabled { opacity: .4; cursor: not-allowed; }
.service-icon-action svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ce-section-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.ce-section-fields:disabled { opacity: .78; }
.service-icon-action::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 200;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translate(-50%, 3px);
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-inset, #14283a);
  color: var(--text-inverse, #fff);
  font: 600 11px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  box-shadow: 0 5px 16px rgba(10, 30, 50, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.service-icon-action:hover::after, .service-icon-action:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.service-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-info-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
.service-info-card h3 { margin: 0 0 12px; font-size: 14px; }
.service-info-card p { overflow-wrap: anywhere; }
.service-info-card dl { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr); gap: 7px 12px; margin: 0; font-size: 12px; }
.service-info-card dt { color: var(--text-muted); }
.service-info-card dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.service-info-card ul { max-height: 150px; margin: 0; padding-left: 18px; overflow: auto; font-size: 12px; overflow-wrap: anywhere; }
.service-settings-form { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.service-settings-form .field { margin: 0; }
.service-settings-form .row { align-items: flex-end; }
.service-settings-form .check-field { display: flex; align-items: center; gap: 9px; }
.service-terminal { height: min(60vh, 620px); min-height: 280px; padding: 8px; border-radius: 10px; overflow: hidden; background: #102335; }
.service-terminal .xterm { height: 100%; }
@media (max-width: 760px) { .service-settings-grid { grid-template-columns: 1fr; } .service-settings-form { grid-column: auto; } }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 6, 12, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(760px, 100%);
  max-height: min(640px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-overlay);
}

.modal-title {
  font-size: 13px;
  font-weight: 700;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

.modal-body {
  margin: 16px;
  flex: 1;
  max-height: none;
}

/* ── compose editor (structured form) ───────────────────────── */

.compose-editor { overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.compose-editor[hidden] { display: none; }

.ce-note { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.ce-note-inline { font-weight: 500; color: var(--text-muted); font-size: 11px; text-transform: none; }

.ce-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ce-file {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.ce-banner-error {
  background: var(--fail-bg);
  border: 1px solid var(--fail-border);
  color: var(--fail);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.ce-fields { display: flex; flex-direction: column; gap: 8px; }

.ce-row {
  display: grid;
  grid-template-columns: 140px 90px 1fr 26px;
  gap: 8px;
  align-items: start;
}

.ce-row .ce-key { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.ce-row .ce-kind { font-size: 12px; padding: 8px 9px; }
.ce-row > .icon-remove { margin-top: 1px; }

.ce-value input[type="text"] {
  width: 100%;
  font-size: 12.5px;
  padding: 8px 9px;
}

.ce-value .ce-raw {
  width: 100%;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 8px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  resize: vertical;
}

.ce-list, .ce-map { display: flex; flex-direction: column; gap: 6px; }

.ce-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ce-item .ce-list-val { flex: 1; }
.ce-item .ce-map-key { width: 40%; }
.ce-item .ce-map-val { flex: 1; }

.ce-add-select { font-size: 12px; padding: 8px 9px; }

.ce-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  align-self: flex-start;
}

.ce-toggle-btn {
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.ce-toggle-btn.active {
  background: var(--row-selected);
  color: var(--text);
}

.ce-monaco {
  height: 320px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 560px) {
  .ce-row { grid-template-columns: 1fr; }
}

/* ── smoke checklist ─────────────────────────────────────────── */

.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }

.checklist li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: var(--bg-overlay);
}

.checklist li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--text-muted);
}

.checklist li.pass { border-color: var(--success-border); background: var(--success-bg); }
.checklist li.pass::before { background: var(--success); }
.checklist li.fail { border-color: var(--fail-border); background: var(--fail-bg); }
.checklist li.fail::before { background: var(--fail); }
.checklist li.skip { opacity: 0.75; }
.checklist li.skip::before { background: var(--text-muted); }

#smokeSummary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

#generateResult {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ── responsive ──────────────────────────────────────────────── */

@media (max-width: 760px) {
  .app-shell { padding: 0 14px 48px; }
  .app-body { grid-template-columns: 1fr; }
  .stepnav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .stepnav-item { flex-shrink: 0; }
}
/* Portal colors and type follow karuna-admin-dashboard/src/theme/portalTheme.js. */
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg-page); }
.auth-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-panel); box-shadow: var(--shadow); }
.auth-card h1 { margin: 14px 0 4px; color: var(--text); font-size: 25px; }
.auth-card > p { margin: 0 0 22px; color: var(--text-muted); }
.auth-mark { width: 44px; height: 44px; display: grid; place-items: center; font-size: 23px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .field { display: grid; }
.auth-form input { width: 100%; }
.auth-error { padding: 10px 12px; border-radius: 8px; color: var(--fail); background: var(--fail-bg); border: 1px solid var(--fail-border); }
.signed-in-user { color: var(--text-muted); font-size: 13px; }
.app-shell { max-width: 1440px; padding: 0 24px 40px; }
.topbar { position: sticky; top: 0; z-index: 20; margin: 0 -24px 20px; padding: 12px 24px; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.brand-mark { background: var(--bg-panel); color: var(--brand); border-radius: 10px; border-color: var(--border); font-weight: 800; }
.brand-title { font-size: 17px; letter-spacing: 0; }
.brand-sub { font-size: 12px; }
.topbar-actions { flex-wrap: wrap; }
.stack-picker { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; }
.stack-picker select { min-width: 190px; }
.app-body { grid-template-columns: 248px minmax(0, 1fr); gap: 24px; }
.stepnav { top: 82px; min-height: min(600px, calc(100vh - 100px)); background: var(--sidebar); border: 0; border-radius: 14px; padding: 18px 14px; box-shadow: none; }
.nav-caption { color: var(--sidebar-muted); font-size: 10px; font-weight: 700; letter-spacing: .09em; padding: 4px 12px 10px; }
.stepnav-item { width: 100%; border: 0; border-radius: 10px; text-align: left; background: transparent; color: var(--sidebar-text); font: inherit; font-size: 14px; padding: 12px; cursor: pointer; }
.stepnav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.stepnav-item.active { position: relative; border-left: 0; background: rgba(77,163,255,.16); color: #fff; }
.stepnav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-icon { width: 22px; color: var(--accent); font-size: 19px; text-align: center; }
.nav-stack-actions { margin-top: auto; padding: 14px 8px 2px; }
.nav-stack-actions .btn-danger-outline { width: 100%; }
.content { min-width: 0; }
.panel { border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.panel-head { padding: 24px 28px 18px; }
.panel-head h2 { letter-spacing: -.02em; }
.panel-body { padding: 22px 28px 28px; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--text-inverse); }
.btn-primary:hover { filter: brightness(.92); }
.icon-btn { background: var(--bg-panel-raised); }
.env-table { table-layout: fixed; }
.env-table td { height: 42px; white-space: nowrap; overflow: hidden; }
.env-table .key-cell { width: 35%; }
.env-table .value-cell { width: 42%; }
.env-table .source-cell { width: 35%; }
.env-table .action-cell { width: 180px; overflow: visible; text-align: right; }
.env-table .cell-ellipsis { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.env-table .secret-value { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12px; }
.env-table .action-cell .btn-ghost { white-space: nowrap; margin-left: 4px; }
.environment-table .key-cell { width: 25%; }
.environment-table .value-cell { width: 39%; }
.environment-table .source-cell { width: 28%; }
.secrets-table .key-cell { width: 28%; }
.secrets-table .value-cell { width: auto; }
.secrets-table .action-cell { width: 280px; text-align: right; }
.secrets-table .action-cell .btn-ghost { margin-left: 4px; }
.secret-edit-toolbar { align-items: center; margin: 12px 0; }
.secret-edit-toolbar .panel-desc { margin: 0; }
.secret-dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 14px; padding: 24px; color: var(--text); background: var(--bg-panel); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.secret-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.secret-dialog h2 { margin: 0 0 18px; }
.secret-dialog .field { display: block; margin: 12px 0; }
.secret-dialog input { width: 100%; }
.secret-dialog .dialog-actions { justify-content: flex-end; margin-top: 20px; }
.overview-actions { align-items: center; margin-top: 18px; }
.custom-service-upload, .create-user-form { padding: 18px; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel-raised); }
.custom-service-upload h3, .create-user-form h3 { margin: 0 0 8px; color: var(--text); }
.custom-service-upload .panel-desc { margin: 0 0 14px; }
.custom-service-upload input[type="file"] { max-width: 100%; }
.bundle-manager { margin: 0 0 22px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
.bundle-manager-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; padding: 18px; border-bottom: 1px solid var(--border); }
.bundle-manager-head h3 { margin: 0 0 5px; color: var(--text); }
.bundle-manager-head .panel-desc { margin: 0; }
.bundle-select-row { align-items: flex-end; flex-wrap: nowrap; }
.bundle-select-row .field { min-width: 210px; }
.bundle-editor-layout { display: grid; grid-template-columns: minmax(210px, 270px) minmax(0, 1fr); min-height: 560px; }
.bundle-file-browser { min-width: 0; border-right: 1px solid var(--border); background: var(--bg-page); }
.bundle-browser-title { padding: 13px 15px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.bundle-file-tree { max-height: 68vh; overflow: auto; padding: 9px; }
.bundle-tree-list { list-style: none; margin: 0; padding: 0; }
.bundle-tree-list .bundle-tree-list { padding-left: 15px; }
.bundle-tree-node { margin: 1px 0; }
.bundle-tree-entry { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.bundle-tree-entry:hover { background: var(--bg-overlay); }
.bundle-tree-entry[aria-current="true"] { background: var(--accent-soft); color: var(--text-soft); }
.bundle-tree-entry:disabled { cursor: not-allowed; opacity: .5; }
.bundle-tree-icon { width: 14px; flex: 0 0 14px; color: var(--text-muted); text-align: center; }
.bundle-code-panel { display: flex; min-width: 0; flex-direction: column; background: #011627; }
.bundle-editor-toolbar { display: flex; min-height: 54px; align-items: center; gap: 14px; padding: 9px 12px; border-bottom: 1px solid #193549; flex-wrap: wrap; }
.bundle-editor-path { color: #d6deeb; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.bundle-editor-status { flex: 1; min-width: 180px; color: #8195a8; font-size: 12px; }
.bundle-editor-actions { align-items: center; gap: 8px; }
.bundle-editor-actions button { padding: 8px 11px; font-size: 12px; }
.bundle-monaco-host { width: 100%; height: min(66vh, 780px); min-height: 500px; }
.bundle-build-log { max-height: 200px; margin: 0; border-top: 1px solid #193549; border-radius: 0; }
.create-user-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(160px, 1fr); align-items: start; gap: 16px 20px; }
.create-user-fields .field { min-width: 0; }
.stack-access-field { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-page); }
.stack-access-field .field-label { margin-bottom: 2px; }
.stack-access-list { display: flex; flex-wrap: wrap; gap: 10px 12px; margin: 10px 0 0; }
.stack-access-list label { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-panel); color: var(--text); }
.stack-access-list input { margin: 0; }
.create-user-actions { align-items: center; margin-top: 18px; }
.change-password-form { margin-top: 22px; }
.change-password-form .panel-desc { margin: 4px 0 16px; }
.service-guide { margin: 12px 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-panel); color: var(--text); }
.service-guide summary { cursor: pointer; font-weight: 700; }
.service-guide p { line-height: 1.55; color: var(--text-muted); }
.service-guide pre { overflow-x: auto; padding: 12px; border-radius: 8px; background: var(--bg-page); color: var(--text); }
.service-guide code { font-size: .92em; }
.service-kind-badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.service-kind-badge[data-kind="add-on"] { border-color: var(--border-accent); background: var(--accent-soft); color: var(--text-soft); }
.users-list { display: grid; gap: 12px; margin-bottom: 20px; }
.user-access-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--bg-panel); }
.user-access-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.user-access-head strong { color: var(--text); }
.app-shell[hidden], .auth-gate[hidden] { display: none; }
button:disabled { cursor: not-allowed; opacity: .48; filter: grayscale(.45); }
.notice { margin: 12px 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--pending); color: var(--text); background: var(--skip-bg); }
.notice-warning { border-color: var(--warning-fg); color: var(--warning-fg); background: var(--warning-bg); }
.active-app { overflow-wrap: anywhere; }
.field-help { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.migration-builder { display: grid; gap: 14px; }
.migration-builder-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.migration-builder-heading h3 { margin: 0 0 4px; color: var(--text); font-size: 16px; }
.migration-databases { display: grid; gap: 12px; }
.migration-empty-state { padding: 18px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg-panel-raised); }
.migration-database-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel-raised); }
.migration-database-heading { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: end; gap: 14px; }
.migration-database-heading .field { min-width: 0; }
.migration-skip-database { min-height: 42px; padding: 0 4px 9px; white-space: nowrap; }
.migration-collection-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.migration-collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.migration-collection-list { display: grid; gap: 8px; }
.migration-collection-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(190px, 260px) auto; align-items: center; gap: 10px; }
.migration-collection-row input, .migration-collection-row select { width: 100%; min-width: 0; }
.migration-collection-row .btn-ghost, .migration-database-heading > .btn-ghost { white-space: nowrap; }
.migration-database-card.is-database-skipped .migration-collection-section { opacity: .45; pointer-events: none; }
.migration-database-card.is-database-skipped .migration-database-name { opacity: .72; }
.migration-database-card .field-label { color: var(--text-soft); }
.migration-run-panel { display: grid; gap: 14px; margin-top: 24px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel-raised); }
.migration-run-panel .migration-builder-heading { align-items: center; }
.migration-run-actions { margin: 0; flex: 0 0 auto; }
.migration-status { margin: 0; color: var(--text-muted); line-height: 1.5; }
.migration-status.is-error { color: var(--fail); }
.migration-status.is-success { color: var(--success); }
.migration-preview { overflow: auto; max-height: min(46vh, 520px); border: 1px solid var(--border); border-radius: 10px; background: var(--bg-panel); }
.migration-preview-summary { position: sticky; top: 0; z-index: 1; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-panel-raised); color: var(--text); font-weight: 650; }
.migration-preview table { width: 100%; min-width: 760px; border-collapse: collapse; }
.migration-preview th, .migration-preview td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.migration-preview th { position: sticky; top: 45px; background: var(--bg-panel); color: var(--text-soft); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.migration-preview td { color: var(--text); font-size: 13px; }
.migration-preview tr:last-child td { border-bottom: 0; }
.migration-action-copy { color: var(--warning-fg); font-weight: 650; }
.migration-action-indexesOnly { color: var(--accent-strong); font-weight: 650; }
.migration-action-skip, .migration-action-unclassified { color: var(--text-muted); }
.migration-confirmation { max-width: 520px; }
.migration-job { display: grid; gap: 8px; }
.migration-job-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.migration-job-log { min-height: 70px; max-height: 220px; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-panel); color: var(--text); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Clickable controls use the same quiet outlined / clear-primary language as the admin portal. */
body[data-theme="light"] button.btn-primary { color: #fff; }
body[data-theme="dark"] button.btn-primary { color: #08142A; }
button:not(.btn-primary):not(.btn-ghost):not(.stepnav-item):not(.icon-btn):not(.btn-danger-outline):not(.bundle-tree-entry):not(.icon-remove):not(.ce-toggle-btn) {
  background: var(--bg-panel);
  border-color: #B4BFCE;
  color: var(--text);
}
body[data-theme="dark"] button:not(.btn-primary):not(.btn-ghost):not(.stepnav-item):not(.icon-btn):not(.btn-danger-outline):not(.bundle-tree-entry):not(.icon-remove):not(.ce-toggle-btn) {
  border-color: rgba(255,255,255,.24);
}
button:not(.btn-primary):not(.btn-danger-outline):hover {
  border-color: var(--border-strong);
}
.icon-btn { background: var(--bg-panel); color: var(--text); border-color: var(--border); }
.stepnav-item { color: var(--sidebar-text); }
.stepnav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.stepnav-item.active { background: rgba(77,163,255,.16); color: #fff; }
.stepnav-item.active::before, .nav-icon { color: var(--accent); }
.stepnav-item.active::before { background: var(--accent); }
.nav-caption { color: var(--sidebar-muted); }
.bundle-code-panel { background: #011627; }
.bundle-editor-toolbar { border-color: #193549; }
.bundle-editor-path { color: #D6DEEB; }
.bundle-editor-status { color: #8195A8; }
@media (max-width: 820px) {
  .app-shell { padding: 0 12px 24px; }
  .topbar { margin: 0 -12px 14px; padding: 10px 12px; align-items: flex-start; }
  .app-body { display: block; }
  .stepnav { position: sticky; top: 64px; z-index: 15; min-height: 0; flex-direction: row; overflow-x: auto; margin-bottom: 14px; padding: 8px; border-radius: 10px; }
  .nav-caption, .nav-stack-actions { display: none; }
  .stepnav-item { flex: 0 0 auto; width: auto; white-space: nowrap; padding: 9px 11px; }
  .stepnav-item.active::before { left: 10px; right: 10px; top: auto; bottom: 0; height: 3px; width: auto; border-radius: 3px 3px 0 0; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .create-user-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bundle-manager-head { align-items: stretch; flex-direction: column; }
  .bundle-editor-layout { grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); }
  .bundle-monaco-host { height: 58vh; min-height: 400px; }
}
@media (max-width: 560px) {
  .create-user-fields { grid-template-columns: minmax(0, 1fr); }
  .bundle-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .bundle-file-browser { border-right: 0; border-bottom: 1px solid var(--border); }
  .bundle-file-tree { max-height: 220px; }
  .bundle-editor-toolbar { align-items: flex-start; flex-direction: column; }
  .migration-builder-heading { align-items: stretch; flex-direction: column; }
  .migration-database-heading { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .migration-skip-database { min-height: 34px; padding: 0; }
  .migration-collection-row { grid-template-columns: minmax(0, 1fr); }
  .migration-collection-row .btn-ghost { justify-self: start; }
  .migration-run-panel .migration-builder-heading { align-items: stretch; }
  .migration-run-actions { align-items: stretch; flex-direction: column; }
}

/* Backend Stack visual system: airy blue surfaces, one control rhythm, and a
   focused code-workbench treatment. Keep the editor itself Night Owl. */
body[data-theme="light"] {
  background: linear-gradient(135deg, #F7FBFE 0%, #EFF7FC 54%, #F8FBFD 100%);
}
body[data-theme="light"] .topbar {
  background: linear-gradient(105deg, #FFFFFF 0%, #F6FBFF 58%, #EEF7FD 100%);
}
.brand-mark {
  overflow: hidden;
  background: linear-gradient(145deg, #9CE0FF 0%, #69B8F0 52%, #5596E2 100%);
  border-color: rgba(76, 145, 199, .24);
  color: white;
  box-shadow: 0 5px 14px rgba(57, 132, 190, .18);
}
.brand-svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-svg circle { fill: currentColor; stroke: none; }
.brand-svg .brand-link { stroke-width: 2; opacity: .9; }
.brand-mark.auth-mark { width: 54px; height: 54px; border-radius: 16px; }
.auth-mark .brand-svg { width: 34px; height: 34px; }
.stepnav {
  background: linear-gradient(165deg, #2B5D85 0%, #234F76 48%, #1D4266 100%);
  box-shadow: 0 12px 28px rgba(38, 82, 118, .13);
}
.stepnav-item.active {
  background: linear-gradient(105deg, rgba(130, 207, 249, .24), rgba(107, 180, 231, .12));
  box-shadow: inset 0 0 0 1px rgba(188, 229, 252, .12);
}
.stepnav-item.active::before { background: linear-gradient(180deg, #B1E7FF, #67C1F2); }
.nav-icon { color: #A6DFFF; }

/* Carry the same light-catching treatment from the header into the workspace nav. */
.stepnav { position: sticky; isolation: isolate; overflow: hidden; }
.stepnav::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(4px 4px at 18% 12%, rgba(255,255,255,.95) 0 35%, transparent 75%),
    radial-gradient(3px 3px at 78% 31%, rgba(255,255,255,.82) 0 35%, transparent 75%),
    radial-gradient(3px 3px at 46% 76%, rgba(206,240,255,.78) 0 35%, transparent 75%),
    linear-gradient(118deg, transparent 0 19%, rgba(255,255,255,.12) 23%, rgba(255,255,255,.025) 30%, transparent 36%),
    linear-gradient(118deg, transparent 0 69%, rgba(255,255,255,.13) 73%, transparent 79%);
  opacity: .9;
}
.stepnav > * { position: relative; z-index: 1; }

button.btn-primary,
button.btn-ghost,
button.btn-danger-outline {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
}
button.btn-primary,
.btn-primary {
  border-color: #4B96D5;
  background: linear-gradient(130deg, #68B8ED 0%, #4A9ADD 55%, #3E85CF 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(58, 132, 195, .16);
}
button.btn-primary:hover,
.btn-primary:hover {
  border-color: #3982C2;
  background: linear-gradient(130deg, #75C4F4 0%, #55A4E4 55%, #478FD6 100%);
  filter: none;
  box-shadow: 0 5px 12px rgba(58, 132, 195, .22);
}
button.btn-primary:disabled,
.btn-primary:disabled {
  box-shadow: none;
}
button.btn-ghost,
.btn-ghost {
  border-color: #C8DCEB;
  background: linear-gradient(135deg, #FFFFFF 0%, #F7FBFE 100%);
  color: #24435C;
}
button.btn-ghost:hover,
.btn-ghost:hover {
  border-color: #8DBFE2;
  background: linear-gradient(135deg, #FFFFFF 0%, #EDF7FD 100%);
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(104, 184, 237, .32);
  outline-offset: 2px;
}

.panel {
  background: linear-gradient(145deg, #FFFFFF 0%, #FCFEFF 100%);
  border-color: #D3E2ED;
  box-shadow: 0 5px 18px rgba(41, 81, 111, .055);
}
.panel-head { border-bottom-color: #E3EDF4; }
.bundle-manager {
  border-color: #D4E4EE;
  box-shadow: 0 5px 18px rgba(41, 81, 111, .055);
}
.bundle-manager-head {
  align-items: flex-start;
  padding: 22px 24px;
  background: linear-gradient(115deg, #FFFFFF 0%, #F7FBFE 60%, #EEF7FC 100%);
}
.bundle-manager-head h3 { font-size: 20px; letter-spacing: -.02em; }
.bundle-select-row { gap: 10px; }
.bundle-select-row .field { min-width: 250px; }
.bundle-select-row select { min-height: 42px; }
.bundle-example-status {
  margin: 14px 16px 0;
  padding: 11px 14px;
  border: 1px solid #D5E9F5;
  border-radius: 9px;
  background: linear-gradient(110deg, #F0F9FE 0%, #EAF6FD 100%);
  color: #45677F;
  font-size: 13px;
  line-height: 1.5;
}
.bundle-editor-layout {
  min-height: min(680px, calc(100vh - 330px));
  margin-top: 14px;
  border-top: 1px solid #E1EBF2;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
}
.bundle-file-browser {
  background: linear-gradient(180deg, #F6FAFD 0%, #F0F6FA 100%);
}
.bundle-browser-title {
  padding: 14px 16px;
  background: linear-gradient(100deg, #EAF4FA 0%, #E5F1F8 100%);
  color: #57758B;
}
.bundle-file-tree { max-height: min(66vh, 700px); padding: 12px; }
.bundle-tree-entry { min-height: 34px; border-radius: 7px; }
.bundle-tree-entry[aria-current="true"] {
  background: linear-gradient(105deg, #DFF1FC 0%, #EAF6FC 100%);
  color: #245E8C;
}
.bundle-code-panel { background: #011627; }
.bundle-editor-toolbar {
  min-height: 64px;
  padding: 10px 14px;
  background: linear-gradient(100deg, #071E30 0%, #0A263A 100%);
}
.bundle-editor-actions { gap: 8px; }
.bundle-editor-actions button { min-height: 40px; padding: 8px 14px; font-size: 12px; }
.bundle-editor-actions .btn-ghost {
  border-color: #527084;
  background: linear-gradient(135deg, #18384D, #112B3E);
  color: #D9EAF4;
}
.bundle-editor-actions .btn-ghost:hover { background: linear-gradient(135deg, #224A64, #18384D); }
.bundle-editor-actions .btn-primary { background: linear-gradient(130deg, #67B7EB, #3E8ACD); }
.bundle-monaco-host { height: min(64vh, 700px); min-height: 380px; }
.bundle-build-log { border-color: #193549; }
.migration-run-panel {
  border-color: #D2E4F0;
  background: linear-gradient(135deg, #F7FBFE 0%, #EEF7FC 100%);
}
.migration-run-actions { gap: 10px; }
.migration-run-actions button { min-width: 172px; min-height: 44px; }
.migration-preview-summary {
  background: linear-gradient(100deg, #EAF5FB 0%, #F3F9FD 100%);
}

@media (max-width: 820px) {
  .bundle-manager-head { gap: 14px; }
  .bundle-select-row { flex-wrap: wrap; }
  .bundle-select-row .field { flex: 1 1 250px; }
  .bundle-editor-layout { min-height: 0; }
}
@media (max-width: 560px) {
  .bundle-manager-head { padding: 18px 16px; }
  .bundle-select-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bundle-select-row .field { grid-column: 1 / -1; min-width: 0; }
  .bundle-select-row button { width: 100%; }
  .bundle-example-status { margin: 12px 12px 0; }
  .bundle-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .bundle-editor-toolbar { min-height: 0; }
  .bundle-editor-actions { width: 100%; }
  .bundle-editor-actions button { flex: 1; }
  .migration-run-actions button { width: 100%; }
}
@media (max-width: 980px) {
  .stepnav { overflow-x: auto; overflow-y: hidden; }
}

/* Light-catching rays/sparkles add polish to the blue without turning the UI
   into a high-contrast pattern. */
.topbar { isolation: isolate; overflow: hidden; }
.topbar::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .64;
  background:
    radial-gradient(5px 5px at 18% 34%, rgba(255,255,255,.92) 0 34%, transparent 70%),
    radial-gradient(3px 3px at 18.8% 38%, rgba(255,255,255,.8) 0 35%, transparent 75%),
    radial-gradient(4px 4px at 76% 24%, rgba(255,255,255,.84) 0 34%, transparent 72%),
    linear-gradient(112deg, transparent 0 25%, rgba(255,255,255,.45) 27%, rgba(255,255,255,.08) 31%, transparent 36%),
    linear-gradient(112deg, transparent 0 67%, rgba(255,255,255,.3) 69%, transparent 73%);
}
.topbar > * { position: relative; z-index: 1; }
.brand-mark { position: relative; }
.brand-mark::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  opacity: .95;
  background: #FFFFFF;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 3px rgba(255,255,255,.9));
}
button.btn-primary:not(:disabled), .btn-primary:not(:disabled) {
  background-image:
    linear-gradient(112deg, transparent 0 42%, rgba(255,255,255,.2) 46%, rgba(255,255,255,.04) 50%, transparent 55%),
    linear-gradient(130deg, #68B8ED 0%, #4A9ADD 55%, #3E85CF 100%);
}
button.btn-primary:not(:disabled)::after, .btn-primary:not(:disabled)::after {
  content: "";
  width: 5px;
  height: 5px;
  margin-left: 9px;
  flex: 0 0 5px;
  opacity: .86;
  background: rgba(255,255,255,.95);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
  filter: drop-shadow(0 0 3px rgba(255,255,255,.65));
}
.btn-primary:not(:disabled):hover {
  background-image:
    linear-gradient(112deg, transparent 0 37%, rgba(255,255,255,.25) 43%, rgba(255,255,255,.05) 49%, transparent 56%),
    linear-gradient(130deg, #75C4F4 0%, #55A4E4 55%, #478FD6 100%);
}
.bundle-runtime {
  display: grid;
  gap: 14px;
  margin: 14px 16px 0;
  padding: 17px 18px;
  border: 1px solid #CFE3F0;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 92% 0%, rgba(255,255,255,.95) 0, rgba(255,255,255,0) 35%),
    linear-gradient(115deg, #F0F8FD 0%, #EAF5FB 56%, #F4FAFD 100%);
}
.bundle-output-card {
  display: grid;
  gap: 12px;
  margin: 14px 16px 0;
  padding: 16px 18px;
  border: 1px solid #D3E3EC;
  border-radius: 12px;
  background: linear-gradient(145deg, #FFFFFF 0%, #F8FBFD 100%);
  box-shadow: 0 4px 12px rgba(47, 91, 120, .045);
}
.bundle-card-heading h4 { margin: 0 0 4px; color: var(--text); font-size: 14px; }
.bundle-card-heading .panel-desc { margin: 0; }
.bundle-terminal {
  max-height: 220px;
  min-height: 58px;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #D4E4EE;
  border-radius: 9px;
  background: #FFFFFF;
  color: #28465D;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bundle-runtime-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.bundle-runtime-heading h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.bundle-runtime-heading .panel-desc { margin: 0; line-height: 1.5; }
.bundle-runtime-state { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.bundle-runtime-state a { font-size: 12px; color: #2D7DB8; overflow-wrap: anywhere; }
.service-kind-badge[data-kind="private"] { border-color: #BBDCEC; background: linear-gradient(120deg, #F9FDFF, #E5F4FC); color: #336D92; }
.bundle-runtime-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bundle-runtime-actions button { min-width: 86px; min-height: 40px; }
.bundle-runtime-divider { width: 1px; height: 26px; margin: 0 5px; background: #C6DCEB; }
.bundle-runtime-actions #btnPromoteBundle { min-width: 178px; }
.bundle-runtime-actions #btnRevertBundle { min-width: 148px; }
.bundle-private-logs {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #D4E4EE;
  border-radius: 9px;
  background: #FFFFFF;
  color: #28465D;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .bundle-runtime { margin-left: 12px; margin-right: 12px; padding: 15px; }
  .bundle-output-card { margin-left: 12px; margin-right: 12px; padding: 15px; }
  .bundle-runtime-heading { flex-direction: column; }
  .bundle-runtime-state { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .bundle-runtime-actions button { flex: 1 1 calc(50% - 8px); }
  .bundle-runtime-divider { display: none; }
  .bundle-runtime-actions #btnPromoteBundle,
  .bundle-runtime-actions #btnRevertBundle { flex-basis: 100%; }
}
