/* ─── Detail pages (app, node) ──────────────────────────────────────────── */

.page--detail { padding-top: 36px; }

/* Header */
.detail-head { margin-bottom: 28px; }

.detail-status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text-2);
  min-height: 20px;
}
.detail-status-meta { color: var(--muted); }

.detail-head-row { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.detail-head-id { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 10px; }
.detail-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }

.detail-type-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--hover);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail-type-icon svg { width: 22px; height: 22px; display: block; }
.detail-type-icon svg.wide { width: 30px; height: auto; }
.detail-type-icon:empty { display: none; }

.detail-name {
  font-size: 40px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.detail-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; color: var(--muted); min-height: 18px; }   /* its line is there before the app is loaded */
.detail-url { display: inline-flex; color: var(--accent); }
.detail-url:hover { text-decoration: underline; text-underline-offset: 3px; }
.detail-repo { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

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

/* Tabs */
.tabs {
  display: flex;
  gap: 24px;
  margin-top: 28px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 12px;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--text); }
.tab-btn svg { display: none; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Logs ──────────────────────────────────────────────────────────────── */
.logs-panel {
  display: flex;
  flex-direction: column;
  height: max(420px, calc(100vh - 360px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--code);
  overflow: hidden;
}
.logs-panel .logs-toolbar { border-bottom: 1px solid var(--line) !important; padding: 10px 16px !important; background: transparent !important; }
.logs-panel .logs-toolbar .input { height: 30px; width: auto; }

.log-terminal {
  flex: 1;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-2);
  overflow: auto;
}
.log-line { display: flex; border-radius: 4px; }
.log-line:hover { background: var(--hover); }
.log-num  { color: var(--faint); user-select: none; min-width: 44px; flex-shrink: 0; }
.log-text { white-space: pre-wrap; word-break: break-all; }
.log-error   .log-text { color: var(--red); }
.log-warn    .log-text { color: var(--yellow); }
.log-success .log-text { color: var(--green); }
.log-info    .log-text { color: var(--text); }
.log-default .log-text { color: var(--text-2); }
.log-action { margin: 4px 0; }
.log-action:hover { background: transparent; }
.log-action .log-text { font-size: 11px; letter-spacing: .02em; }
.log-empty { color: var(--muted); padding: 6px 0; }
/* History: when and where each line came from */
.log-ts  { color: var(--faint); user-select: none; flex-shrink: 0; min-width: 72px; margin-right: 12px; white-space: nowrap; }
.log-src { color: var(--muted); user-select: none; flex-shrink: 0; width: 132px; margin-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-more { display: flex; justify-content: center; padding: 4px 0 12px; font-family: var(--font-sans); font-size: 12px; color: var(--faint); }
.log-notice { margin-bottom: 10px; padding: 7px 10px; border: 1px solid var(--yellow-border); border-radius: var(--radius-sm);
  background: var(--yellow-bg); color: var(--yellow); font-family: var(--font-sans); font-size: 12px; }

.log-empty-state {
  height: 100%;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  font-family: var(--font-sans, inherit);
}
.log-empty-title { font-size: 14px; font-weight: 500; color: var(--text); }
.log-empty-state p { max-width: 400px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.log-empty-state strong { color: var(--text-2); font-weight: 500; }
.log-empty-state code {
  display: block;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}
.logs-idle .logs-live .dot { background: var(--muted); box-shadow: none; }

/* ─── Metrics ───────────────────────────────────────────────────────────── */
.stats-panel { display: flex; flex-direction: column; gap: 28px; }

.stats-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2fr;
  gap: 32px;
  align-items: start;
}

.sinfo-panel.card { background: transparent; border: 0; border-radius: 0; }
.sinfo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.sinfo-row:last-child { border-bottom: none; }
.sinfo-divider { height: 1px; background: var(--line-strong); }
.sinfo-label { font-size: 13px; color: var(--muted); }
.sinfo-val   { font-family: var(--font-mono); font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.smet-mono   { font-family: var(--font-mono); font-size: 12px; }

.stats-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.history-row       { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.chart-card.card { background: transparent; }
.chart-card { padding: 16px 18px; position: relative; }
.chart-hdr { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chart-title    { font-size: 13px; font-weight: 500; color: var(--text); }
.chart-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chart-badge { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; flex-shrink: 0; }

.chart-offline-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  color: var(--muted);
}
.chart-offline-overlay svg { opacity: .35; }
.chart-offline-overlay span { font-size: 12px; }

.docker-row { display: none; }

/* ─── Files ─────────────────────────────────────────────────────────────── */
.files-panel {
  display: flex;
  height: max(420px, calc(100vh - 360px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.files-sidebar { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.files-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 40px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.files-breadcrumb .crumb-btn { color: var(--text-2); font-size: 12px; }
.files-breadcrumb .crumb-btn:hover { color: var(--text); }
.files-breadcrumb .sep { color: var(--faint); }
.files-list { flex: 1; overflow-y: auto; padding: 6px; }
.file-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.file-entry:hover { background: var(--hover); color: var(--text); }
.file-entry.active { background: var(--hover); color: var(--text); }
.file-entry svg { flex-shrink: 0; }
.file-entry .dir-icon  { color: var(--muted); }
.file-entry .file-icon { color: var(--faint); }
.file-entry .file-size { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

.files-viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--code); overflow: hidden; }
.file-viewer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.file-viewer-header .file-path { font-family: var(--font-mono); color: var(--text); }
.file-viewer-header .file-mime { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.file-content {
  flex: 1;
  overflow: auto;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre;
}
.file-empty-hint { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 100%; color: var(--muted); }

/* ─── Settings ──────────────────────────────────────────────────────────── */
.settings-bar {
  position: sticky;
  top: 52px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.settings-bar-title { font-size: 13px; color: var(--muted); }

.settings-group {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.settings-group:last-child { border-bottom: none; }
.settings-group-hd { padding-top: 2px; }
.settings-group-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.settings-group-sub { font-size: 12px; color: var(--muted); line-height: 1.55; }
.settings-group--danger .settings-group-title { color: var(--red); }
.section-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--muted); }
.info-row .value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: none;
  border: 0;
  padding: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.action-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.action-tile:hover:not(:disabled) { border-color: var(--faint); background: var(--hover); }
.action-tile:disabled { opacity: .45; cursor: not-allowed; }
.action-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--hover);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-tile-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.action-tile-sub   { font-size: 12px; color: var(--muted); }

.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.danger-row-text .title { font-size: 13px; font-weight: 500; color: var(--text); }
.danger-row-text .sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

.add-env-btn { color: var(--text-2); }
.add-env-btn:hover { color: var(--text); }
.env-count { color: var(--faint); }

/* ─── Node detail pieces ────────────────────────────────────────────────── */
/* This server: one card per topic, in the look of the settings cards (transparent, hairline border, rows with dividers), filled top to bottom in two columns */
.node-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.node-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* The last card of a column grows to the height of the other column, and its rows share the extra room */
.node-col > .node-group:last-child { flex: 1; display: flex; flex-direction: column; }
.node-col > .node-group:last-child .node-details-grid { flex: 1; display: flex; flex-direction: column; }
.node-col > .node-group:last-child .node-detail-item { flex: 1; align-items: center; }
.node-group { border: 1px solid var(--line); border-radius: var(--radius); }
.node-group-head { padding: 16px 18px 12px; }
.node-group-head h3 { margin: 0; font-size: 13px; font-weight: 500; color: var(--text); }
.node-group-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.node-group .node-details-grid { display: block; }
.node-group .node-detail-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: baseline; gap: 16px; padding: 12px 18px; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.node-group .node-detail-label { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; }
.node-group .node-detail-value { font-family: inherit; font-size: 13px; text-align: left; color: var(--text); overflow-wrap: anywhere; }
.node-group .node-detail-value.node-detail-value-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.node-group .node-detail-value.node-detail-value-live { color: var(--green); }
.node-group .node-detail-value.node-detail-value-warn { color: var(--yellow); }
.node-group .node-detail-value.node-detail-value-bad { color: var(--red); }
@media (max-width: 900px) { .node-groups { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .node-group .node-detail-item { grid-template-columns: 1fr; gap: 2px; } }
.node-details-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.node-detail-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}
.node-detail-label { font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; flex-shrink: 0; }
.node-detail-value { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.node-detail-value.node-detail-value-live { color: var(--green); }
.node-detail-value.node-detail-value-warn { color: var(--yellow); }
.node-detail-value.node-detail-value-bad { color: var(--red); }

.node-log-view {
  margin: 0;
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  background: var(--code);
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .stats-layout, .history-row, .stats-charts-grid { grid-template-columns: 1fr; }
  .settings-group { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 720px) {
  .detail-name { font-size: 30px; }
  .files-sidebar { width: 180px; }
  .node-details-grid { grid-template-columns: 1fr; }
}

#app-badge { display: inline-flex; align-items: center; gap: 10px; }

/* ─── Instances ─────────────────────────────────────────────────────────── */
.inst-list { overflow-x: auto; }
.inst-main {
  display: grid;
  grid-template-columns: 108px 110px minmax(100px, 1fr) 80px 120px 130px 72px 176px;
  gap: 14px;
  align-items: center;
  min-width: 860px;
}
.inst-head { padding: 10px 0; font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--line); }
.inst-head .inst-id { font-family: inherit; color: inherit; }
.inst-row { padding: 12px 0; border-bottom: 1px solid var(--line); }

/* Starting up: one line over the whole row that fills step by step; done steps tick, the current one pulses.
   The table is redrawn every 1.5 s, so the endless animations take their phase from the clock (--phase) and the
   fill grows from where the previous drawing left it (--from → --to): nothing jumps on a redraw. */
@property --fill { syntax: "<number>"; inherits: false; initial-value: 0; }
.inst-progress { position: relative; margin: 12px 0 2px; padding: 12px 0 0; border-top: 1px dashed var(--line); }
.inst-progress-track { position: absolute; top: 19px; left: calc(50% / var(--n)); right: calc(50% / var(--n)); height: 2px; border-radius: 2px; background: var(--line); }
.inst-progress-fill {
  position: relative; height: 100%; border-radius: inherit; width: calc(var(--fill) * 100%);
  background: linear-gradient(90deg, var(--green) 0%, var(--green) 70%, var(--yellow) 100%);
  animation: inst-fill 700ms cubic-bezier(.2, .8, .2, 1) both;
}
.inst-progress-fill::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: inst-shimmer 1.6s linear infinite; animation-delay: var(--phase, 0ms);
}
@keyframes inst-fill { from { --fill: var(--from); } to { --fill: var(--to); } }
@keyframes inst-shimmer { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.inst-progress-steps { position: relative; display: flex; list-style: none; margin: 0; padding: 0; }
.inst-progress-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.inst-progress-dot {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--bg);
  transition: background var(--transition), border-color var(--transition);
}
.inst-progress-dot svg { width: 9px; height: 9px; stroke: var(--bg); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 24; stroke-dashoffset: 0; }
.inst-progress-label { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  transition: color var(--transition); }

.inst-progress-step.done .inst-progress-dot { background: var(--green); border-color: var(--green); }
.inst-progress-step.done .inst-progress-label { color: var(--text-2); }
.inst-progress-step.just-done .inst-progress-dot { animation: inst-dot-pop 520ms cubic-bezier(.3, 1.6, .5, 1) both; }
.inst-progress-step.just-done .inst-progress-dot svg { animation: inst-check-draw 420ms ease 160ms both; }
.inst-progress-step.active .inst-progress-dot {
  background: var(--yellow); border-color: var(--yellow);
  animation: inst-dot-pulse 1.6s ease-in-out infinite; animation-delay: var(--phase, 0ms);
}
.inst-progress-step.active .inst-progress-dot::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bg);
}
.inst-progress-step.active .inst-progress-label { color: var(--text); font-weight: 500; }
.inst-progress-step.active .inst-progress-label::after { content: "…"; }
@keyframes inst-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--yellow-halo); }
  50%      { box-shadow: 0 0 0 6px var(--yellow-halo); }
}
@keyframes inst-dot-pop { 0% { transform: scale(.55); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes inst-check-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }

/* Done: all green, "Live", and after a moment the bar folds away (--elapsed keeps that going over redraws) */
.inst-progress.is-complete { animation: inst-progress-out 480ms ease forwards; animation-delay: calc(1900ms - var(--elapsed, 0ms)); }
.inst-progress.is-complete .inst-progress-fill { background: var(--green); }
.inst-progress.is-complete .inst-progress-fill::after { display: none; }
.inst-progress.is-complete .inst-progress-step:last-child .inst-progress-dot { box-shadow: 0 0 0 4px var(--green-halo); }
.inst-progress-live { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 500; }
@keyframes inst-progress-out {
  0%   { opacity: 1; max-height: 90px; }
  60%  { opacity: 0; max-height: 90px; margin-top: 12px; padding-top: 12px; }
  100% { opacity: 0; max-height: 0; margin-top: 0; padding-top: 0; border-top-color: transparent; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .inst-progress-fill, .inst-progress-fill::after, .inst-progress-step .inst-progress-dot,
  .inst-progress-step .inst-progress-dot svg { animation: none !important; }
  .inst-progress-fill { --fill: var(--to); }
  .inst-progress-step.active .inst-progress-dot { box-shadow: 0 0 0 4px var(--yellow-halo); }
}
#btn-remove-selected[hidden], #btn-restart-selected[hidden] { display: none; }
.inst-id { display: inline-flex; align-items: center; gap: 14px; }
.inst-check { position: relative; display: inline-flex; cursor: pointer; }
.inst-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.inst-check-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: transparent;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.inst-check:hover .inst-check-box { border-color: var(--text-2); }
.inst-check input:checked + .inst-check-box,
.inst-check input:indeterminate + .inst-check-box { background: var(--text); border-color: var(--text); }
.inst-check input:checked + .inst-check-box::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  margin: 1px 0 0 4px;
  border: solid var(--bg);
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}
.inst-check input:indeterminate + .inst-check-box::after {
  content: "";
  display: block;
  width: 8px;
  height: 0;
  margin: 5.5px 0 0 2.5px;
  border-top: 1.6px solid var(--bg);
}
.inst-check input:focus-visible + .inst-check-box { box-shadow: 0 0 0 3px var(--focus); }
.inst-check input:disabled + .inst-check-box { opacity: 0.4; }
.inst-id, .inst-port, .inst-usage { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.inst-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.inst-node { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst-uptime { color: var(--muted); font-size: 12px; }
.inst-actions { display: flex; justify-content: flex-end; gap: 6px; }
.inst-meta { display: flex; gap: 14px; padding: 6px 0 0 122px; font-size: 12px; color: var(--faint); }
.inst-meta .mono { font-family: var(--font-mono); }
.inst-error {
  margin: 8px 0 0 70px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}
.inst-row > div[style*="border-top"] { margin-left: 70px; }

/* ─── Node page ─────────────────────────────────────────────────────────── */
.node-log-frame {
  position: relative;
  height: 420px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.node-log-frame .node-log-view { flex: 1; min-height: 0; }



/* Settings forms stay a readable width on wide screens: label, field, hint
   and toggle sit together instead of stretching across the page. */
.settings-group { grid-template-columns: 240px minmax(0, 720px); justify-content: start; gap: 56px; }
.settings-group .field { margin-bottom: 20px; }
.settings-group .field:last-child { margin-bottom: 0; }
.settings-group .toggle-row .field-label { margin-bottom: 0; }
@media (max-width: 1000px) {
  .settings-group { grid-template-columns: 1fr; gap: 14px; }
}

/* Logs toolbar */
.logs-toolbar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logs-toolbar-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.logs-toolbar .input { width: auto; max-width: 360px; height: 30px; }

/* The controls in a log toolbar: rounded, quiet, with their own arrow and search glass instead of the browser's */
.logs-toolbar .input {
  border-radius: 10px;
  background-color: var(--surface);
  border-color: var(--line-strong);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}
.logs-toolbar input.input { font-weight: 400; }
.logs-toolbar .input:hover { border-color: var(--faint); }
.logs-toolbar .input:focus { border-color: var(--muted); box-shadow: 0 0 0 3px var(--hover); }
.logs-toolbar select.input {
  -webkit-appearance: none; appearance: none;
  padding: 0 30px 0 11px; cursor: pointer; max-width: 260px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7f88' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 13px;
}
.logs-toolbar select.input option { background: var(--pop); color: var(--text); }
.logs-toolbar input[type="search"].input {
  width: 220px; padding: 0 10px 0 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7f88' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center; background-size: 13px;
}
.logs-toolbar input[type="search"].input::-webkit-search-cancel-button { -webkit-appearance: none; }
.logs-toolbar input[type="search"].input { flex: 1 1 200px; width: auto; max-width: 280px; }

/* One control for a choice of a few: the time range */
.seg {
  display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 2px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.seg-btn {
  height: 100%; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  font: 500 12.5px var(--font-sans); color: var(--muted); font-variant-numeric: tabular-nums;
  transition: color var(--transition), background var(--transition);
}
.seg-btn:hover { color: var(--text); }
.seg-btn:disabled { color: var(--faint); opacity: .45; cursor: not-allowed; }
.seg-btn:disabled:hover { color: var(--faint); }
.seg-btn.active { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg-btn:focus-visible, .chip-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* An on/off filter */
.chip-toggle {
  height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  font: 500 12.5px var(--font-sans); color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.chip-toggle:hover { color: var(--text); border-color: var(--faint); }
.chip-toggle[aria-pressed="true"] { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.logs-live { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.logs-live .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-halo); }

/* ─── Deployments ───────────────────────────────────────────────────────── */
.deploys-head { margin-bottom: 14px; }
.deploys-auto { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; color: var(--text-2); }
.deploys-auto > span:nth-child(2) { flex: 1; }
.deploys-auto code { font-size: 12px; color: var(--text); background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.deploys-list { border: 1px solid var(--line); border-radius: var(--radius); }
.deploys-empty { display: flex; flex-direction: column; gap: 4px; padding: 28px 18px; font-size: 13px; color: var(--muted); }
.deploys-empty strong { color: var(--text); font-weight: 500; }
.deploy-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.deploy-row:first-child { border-top: none; }
.deploy-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.deploy-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.deploy-row.success .deploy-dot { background: var(--text-2); }
.deploy-row.live .deploy-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-halo); }
.deploy-row.live .deploy-status { color: var(--text); }
.deploy-row.failed .deploy-dot { background: var(--red); }
.deploy-row.failed .deploy-status { color: var(--red); }
.deploy-row.running .deploy-dot { background: var(--yellow); animation: deploy-pulse 1.2s ease-in-out infinite; }
.deploy-row.running .deploy-status { color: var(--yellow); }
@keyframes deploy-pulse { 50% { opacity: .3; } }
.deploy-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deploy-msg { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deploy-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deploy-meta code { font-size: 11.5px; color: var(--text-2); }
.deploy-error { font-size: 12px; color: var(--red); overflow-wrap: anywhere; }
.deploy-when { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--muted); white-space: nowrap; }
.deploy-when small { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.deploy-actions { display: flex; gap: 6px; justify-content: flex-end; }
.deploy-log {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--field);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 860px) {
  .deploy-row { grid-template-columns: 1fr auto; }
  .deploy-status { grid-column: 1 / -1; }
  .deploy-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Auto-deploy settings: options fade out while it's off */
#autodeploy-options { transition: opacity var(--transition); }
#autodeploy-options[hidden], #autodeploy-check[hidden], #autodeploy-webhook[hidden] { display: none; }
#cfg-deploy-strategy[hidden] { display: none; }

/* ─── App settings tab ──────────────────────────────────────────────────────
   Nav on the left picks one section. Every section is a header plus cards of
   rows: label and description on the left, the control on the right (or
   full width below the label for long values). */
.sv2 { display: grid; grid-template-columns: 200px minmax(0, 720px); gap: 48px; align-items: start; }

.sv2-side { position: sticky; top: 76px; padding-top: 24px; }
.sv2-nav { display: flex; flex-direction: column; gap: 2px; }
.sv2-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted); text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.sv2-nav a svg { flex-shrink: 0; opacity: .8; }
.sv2-nav a:hover { color: var(--text); background: var(--hover); }
.sv2-nav a.active { color: var(--text); background: var(--hover); font-weight: 500; }
.sv2-nav a.active svg { opacity: 1; }
.sv2-nav a.danger { color: var(--red); }
.sv2-nav a.dirty::after {
  content: ""; width: 6px; height: 6px; margin-left: auto;
  border-radius: 50%; background: var(--yellow);
}

.sv2-main { min-width: 0; padding-bottom: 8px; }

.settings-group.sv2-sec { display: block; padding: 24px 0 8px; border-bottom: none; }
.settings-group.sv2-sec.is-inactive { display: none; }
.sv2-head { margin-bottom: 20px; }
.sv2-head h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.sv2-head p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.settings-group--danger .sv2-head h3 { color: var(--red); }

/* Card of rows */
.s3-card { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
/* No overflow: hidden on the card (it would cut off the menus inside it); the outer rows round their own corners */
.s3-card > :first-child { border-top-left-radius: calc(var(--radius) - 1px); border-top-right-radius: calc(var(--radius) - 1px); }
.s3-card > :last-child { border-bottom-left-radius: calc(var(--radius) - 1px); border-bottom-right-radius: calc(var(--radius) - 1px); }
.s3-card--danger { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }

.s3-row {
  display: flex; align-items: center; gap: 24px;
  width: 100%; min-height: 60px; padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: none; color: inherit; font: inherit; text-align: left;
}
.s3-card > :first-child, .s3-card > :first-child > .s3-row:first-child { border-top: none; }
label.s3-row { cursor: pointer; }
.s3-row--stack { flex-direction: column; align-items: stretch; gap: 10px; }
.s3-row[hidden] { display: none; }
.db-card[hidden] { display: none; }
.s3-row--sub { padding-left: 34px; min-height: 52px; }

.s3-label { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.s3-title { font-size: 13px; font-weight: 500; color: var(--text); }
.s3-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.s3-desc .mono { color: var(--text-2); }
.s3-value { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Every control on the right has the same width */
.s3-ctl { width: 240px; flex-shrink: 0; display: flex; justify-content: flex-end; }
.s3-ctl > .input { width: 100%; }
.s3-ctl--pair { width: 300px; gap: 8px; align-items: center; }
.s3-ctl--pair > .input { flex: 1; min-width: 0; width: auto; }
.s3-ctl--pair > .btn { flex-shrink: 0; }
.s3-row .toggle { flex-shrink: 0; }
.s3-row--stack > .input, .s3-inline { width: 100%; }
.s3-inline { display: flex; gap: 8px; align-items: center; }
.s3-inline .input { flex: 1; min-width: 0; }
.s3-inline .btn { white-space: nowrap; flex-shrink: 0; }
#cfg-deploy-strategy[hidden] { display: none; }

/* Clickable rows */
button.s3-link { cursor: pointer; transition: background var(--transition); }
button.s3-link:hover { background: var(--hover); }
.s3-chev { width: 7px; height: 7px; flex-shrink: 0; margin-left: 4px; border-right: 1.5px solid var(--faint); border-top: 1.5px solid var(--faint); transform: rotate(45deg); }

/* Footer row with actions, and notes */
.s3-foot { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--hover) 45%, transparent); }
.s3-foot .btn[hidden] { display: none; }
.s3-foot .env-count { margin: 0 0 0 auto; }
.s3-note { padding: 12px 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; background: color-mix(in srgb, var(--yellow) 9%, transparent); }

/* Domains and env vars inside a card */
.s3-card .net-domains { border: none; border-radius: 0; }
.s3-card .net-row { padding: 12px 18px; min-height: 56px; }
.s3-card .net-empty { padding: 18px; }
/* Connections: a small heading per kind, then the same rows as the other sections */
.conn-group { padding: 10px 18px 8px; border-top: 1px solid var(--line); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: color-mix(in srgb, var(--hover) 45%, transparent); }
.conn-group:first-child { border-top: none; }
a.s3-title { text-decoration: none; }
a.s3-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.s3-desc code { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.s3-card .net-cert { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); }
.s3-card .net-cert:empty { display: none; }
.s3-env { padding: 14px 18px 6px; max-height: 360px; }
.s3-env:empty { display: none; }
.s3-env .env-row { margin-bottom: 8px; }

/* Autoscale and auto-deploy options follow their toggle */
#autodeploy-options { transition: opacity var(--transition); }
#autodeploy-options[hidden], #autodeploy-check[hidden], #autodeploy-webhook[hidden] { display: none; }

/* Save bar: sticks to the bottom while the section scrolls */
.s3-savebar {
  position: sticky; bottom: 16px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 10px 10px 10px 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.s3-savebar.is-hidden { display: none; }
.s3-save-state { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.s3-save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.s3-savebar .btn[hidden] { display: none; }
.s3-savebar.is-dirty { border-color: color-mix(in srgb, var(--yellow) 50%, var(--line)); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.s3-savebar.is-dirty .s3-save-state { color: var(--text); }
.s3-savebar.is-dirty .s3-save-state::before { background: var(--yellow); }

@media (max-width: 1000px) {
  .sv2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sv2-side { position: static; padding-top: 4px; }
  .sv2-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; scrollbar-width: none; }
  .sv2-nav a { white-space: nowrap; }
}
@media (max-width: 640px) {
  .s3-row:not(.s3-link) { flex-wrap: wrap; gap: 10px; }
  .s3-ctl { width: 100%; }
  .s3-row--sub { padding-left: 18px; }
}

/* ─── Database detail ───────────────────────────────────────────────────── */
.db-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.db-meta > *:not(:last-child)::after { content: '·'; margin-left: 14px; color: var(--faint); }
.db-meta code { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

.db-error {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
  font-size: 13px;
  line-height: 1.5;
}

.db-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 22px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.db-stats > div { padding: 12px 16px; min-width: 0; }
.db-stats > div + div { border-left: 1px solid var(--line); }
.db-stats dt { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.db-stats dd { margin: 0; font-family: var(--font-mono); font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.db-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.tab-panel > .db-card + .db-card { margin-top: 16px; }

.db-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  min-width: 0;
}
.db-card--danger { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.db-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.db-card-head h2 { font-size: 14px; font-weight: 500; color: var(--text); margin: 0; }
.db-card-sub { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
p.db-card-sub { margin: 0 0 6px; }
.db-card-foot { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0 0; }

.db-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 6px; }
.db-subhead h3 { font-size: 13px; font-weight: 500; color: var(--text); margin: 0; }

/* Key / value rows with inline actions */
.db-kv { display: flex; flex-direction: column; }
.db-kv-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.db-kv-row:last-child { border-bottom: none; }
.db-kv-label { color: var(--muted); }
.db-kv-value { font-family: var(--font-mono); font-size: 12px; color: var(--text); background: none; padding: 0; overflow-wrap: anywhere; }
.db-kv-value.masked { letter-spacing: 1px; color: var(--muted); }
.db-kv-warn { grid-column: 2 / -1; font-size: 12px; color: var(--yellow); padding: 8px 0; }
.db-kv-actions { display: inline-flex; gap: 2px; }

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }

/* Lists: linked apps, allowed IPs */
.db-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); }
.db-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; }
.db-list-row + .db-list-row { border-top: 1px solid var(--line); }
.db-list-main { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; font-size: 13px; }
.db-list-title { font-weight: 500; color: var(--text); }
code.db-list-title { font-family: var(--font-mono); font-size: 12.5px; background: none; padding: 0; }
.db-list-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.db-list-empty { font-size: 13px; color: var(--muted); padding: 12px 14px; }
.db-list-empty--warn { color: var(--yellow); }
.db-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--radius-xs); padding: 0 6px; line-height: 18px; }
.db-tag--you { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

.allow-add { display: flex; gap: 8px; margin-top: 10px; }
.db-tls-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.db-note a { color: inherit; text-decoration: underline; }
.allow-add .input { flex: 1; min-width: 0; }

.db-note { margin-top: 18px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--hover); font-size: 12px; line-height: 1.55; color: var(--text-2); }
.db-note p { margin: 0; }
.db-note p + p { margin-top: 4px; }
.db-note--warn { background: color-mix(in srgb, var(--yellow) 10%, transparent); color: var(--yellow); }

.db-logs {
  margin: 0;
  height: max(320px, calc(100vh - 460px));
  overflow: auto;
  padding: 14px 16px;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Usage charts */
.db-usage { margin-top: 16px; }
.db-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 6px; }
.db-chart { margin: 0; min-width: 0; }
.db-chart figcaption { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.db-chart figcaption span { font-family: var(--font-mono); color: var(--text); }
.db-chart canvas { display: block; width: 100%; height: 110px; }
@media (max-width: 900px) { .db-charts { grid-template-columns: minmax(0, 1fr); } }

/* Backups */
.db-card-actions { display: flex; gap: 8px; }
.db-card-actions label.btn { cursor: pointer; }
.db-tag--busy { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 40%, transparent); }
.db-tag--update { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.db-tag--offsite { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.db-tag--failed { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.db-list-error { flex-basis: 100%; font-size: 12px; color: var(--red); }
.db-other-backups { margin-top: 16px; }
.db-offsite-hint { margin-top: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.5;
  background: color-mix(in srgb, var(--yellow) 10%, transparent); color: var(--yellow); }
.db-offsite-hint--on { background: color-mix(in srgb, var(--green) 9%, transparent); color: var(--green); }
.db-offsite-hint a { color: inherit; text-decoration: underline; }
.db-other-backups summary { cursor: pointer; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.db-schedule { display: grid; grid-template-columns: repeat(3, minmax(0, 180px)); gap: 12px; margin-top: 4px; }
.db-restore-banner { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; }
.db-restore-banner--running { background: color-mix(in srgb, var(--yellow) 10%, transparent); color: var(--yellow); }
.db-restore-banner--success { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); }
.db-restore-banner--failed { background: color-mix(in srgb, var(--red) 8%, transparent); color: var(--red); white-space: pre-wrap; }
a.icon-btn { text-decoration: none; }

.db-limits { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; max-width: 520px; }

@media (max-width: 900px) {
  .db-grid { grid-template-columns: minmax(0, 1fr); }
  .db-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .db-stats > div:nth-child(4) { border-left: none; }
  .db-stats > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-stats > div { border-left: none !important; }
  .db-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .db-stats > div:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .db-kv-row { grid-template-columns: 76px minmax(0, 1fr) auto; }
  .allow-add { flex-wrap: wrap; }
  .allow-add .input { flex-basis: 100%; }
  .db-limits { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .db-schedule { grid-template-columns: minmax(0, 1fr); }
  .db-card-head { flex-wrap: wrap; }
  .db-limits .btn { grid-column: 1 / -1; }
}

/* Logs tab: filters for the "Cloudbase" source */
.logs-cb-filters { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logs-cb-filters[hidden] { display: none; }
#log-cb-q { min-width: 160px; }
@media (max-width: 640px) {
  #logs-toolbar { flex-wrap: wrap; }
  .logs-cb-filters, .logs-cb-filters .input { flex: 1 1 100%; max-width: none; }
}

/* Structured Cloudbase logs (System logs page + "Cloudbase" source in the Logs tab) */
.cblog { line-height: 1.6; }
.cblog-row {
  display: grid;
  grid-template-columns: 62px 92px minmax(0, 1fr);
  column-gap: 12px;
  padding: 2px 6px;
  margin: 0 -6px;
  border-radius: 4px;
}
.cblog-row:hover { background: var(--hover); }
.cblog-row--warn  { background: color-mix(in srgb, var(--yellow-bg) 60%, transparent); }
.cblog-row--error { background: var(--red-bg); }
.cblog-time { color: var(--faint); font-variant-numeric: tabular-nums; user-select: none; }
.cblog-comp {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--cc);
  background: color-mix(in srgb, var(--cc) 12%, transparent);
}
.cblog-body { min-width: 0; color: var(--text-2); }
.cblog-body--raw { grid-column: 1 / -1; }
.cblog-msg { white-space: pre-wrap; word-break: break-word; }
.cblog-row--warn .cblog-msg  { color: var(--text); }
.cblog-row--error .cblog-msg { color: var(--red); }
.cblog-level {
  display: inline-block;
  margin-right: 8px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 17px;
  vertical-align: 1px;
}
.cblog-level--warn  { color: var(--yellow); background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.cblog-level--error { color: var(--red); background: var(--red-bg); border: 1px solid var(--red-border); }
.cblog-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 17px;
  color: var(--muted);
  vertical-align: 1px;
}
.cblog-cont {
  margin: 2px 0 4px;
  padding: 4px 0 4px 10px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.cblog-row--error .cblog-cont { border-left-color: var(--red-border); }
.cblog-day {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}
.cblog-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.cblog-day:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .cblog-row { grid-template-columns: 56px minmax(0, 1fr); }
  .cblog-comp { grid-column: 2; grid-row: 1; }
  .cblog-body { grid-column: 1 / -1; }
}

/* Settings → Notifications */
.an-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.an-channels .pill { color: var(--text); }
.an-type { color: var(--muted); }
.an-off { opacity: .55; }

/* Runs tab (cron jobs) */
.runs-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.runs-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.runs-k { font-size: 12px; color: var(--muted); }
.runs-v { font-size: 15px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runs-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runs-sub code { font-size: 11.5px; color: var(--text-2); }
.runs-table tr.cron-run td:first-child { width: 1%; }
.run-detail td { padding: 0 0 14px !important; border-bottom: 1px solid var(--line); }
.run-output pre {
  margin: 0; max-height: 360px; overflow: auto; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--code); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px;
  line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.run-error { margin-bottom: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); font-size: 12.5px; }
@media (max-width: 1000px) { .runs-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .runs-table th:nth-child(5), .runs-table td:nth-child(5), .runs-table th:nth-child(6), .runs-table td:nth-child(6) { display: none; }
}
.cron-settings .cron-editor { border: 0; border-radius: 0; }
.cron-settings .cron-row--card { border-top: 1px solid var(--line); }

/* Autoscaling: the last scale actions under the settings */
.s3-group { margin: 24px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* (i) next to a label: the explanation shows on hover or focus */
.info-tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 6px; border: 1px solid var(--line); border-radius: 50%;
  font: 600 9px/1 var(--font-mono); color: var(--muted); cursor: help; vertical-align: 1px;
}
.info-tip:hover, .info-tip:focus { color: var(--text); border-color: var(--muted); outline: none; }
.info-tip::after {
  content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 20;
  width: max-content; max-width: 260px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface, var(--bg)); color: var(--text); box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  font: 400 12px/1.45 var(--font-sans, inherit); text-align: left; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; }
.conn-value { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.conn-value code { word-break: break-all; }
