/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

/* Primary: inverted (white on dark, near-black on light) */
.btn-primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-text);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-secondary { color: var(--text); }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }

.btn-success { color: var(--green); border-color: var(--green-border); }
.btn-success:hover:not(:disabled) { background: var(--green-bg); }

.btn-danger { color: var(--red); border-color: var(--red-border); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }

.btn-icon { width: 34px; padding: 0; }

.btn-sm {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  gap: 5px;
}
.btn-sm.btn-icon { width: 28px; }

/* ─── Surfaces ──────────────────────────────────────────────────────────── */
/* Cards are rare in this design — sections are separated by lines and
   space. A .card is a quiet framed area for things that must stand apart. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.divider { height: 1px; background: var(--line); border: 0; }

.section { padding: 28px 0 32px; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; padding-top: 0; }
.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.section-head h2, .section-heading {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-link { color: var(--text-2); }
.section-link:hover { color: var(--text); }

.page-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-title-row h1 { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.page-title-row .page-title-meta { color: var(--muted); }
.page-title-row .page-title-actions { margin-left: auto; display: flex; gap: 8px; }

/* ─── Service type badge ────────────────────────────────────────────────── */
.service-type-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
}
.service-type-badge--worker { color: var(--purple); border-color: var(--purple-border); }

/* ─── Status badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--faint);
}

.badge-running  { color: var(--text); }
.badge-running::before  { background: var(--green); box-shadow: 0 0 0 3px var(--green-halo); }

.badge-stopped  { color: var(--muted); }
.badge-scheduled { color: var(--text); }
.badge-scheduled::before { background: var(--green); }
.badge-paused { color: var(--muted); }

.badge-error, .badge-unhealthy, .badge-node_offline { color: var(--red); }
.badge-error::before, .badge-unhealthy::before, .badge-node_offline::before { background: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }

.badge-deploying, .badge-starting, .badge-stopping, .badge-restarting, .badge-pending, .badge-creating,
.badge-building, .badge-scaling, .badge-updating { color: var(--yellow); }
.badge-deploying::before, .badge-starting::before, .badge-stopping::before,
.badge-restarting::before, .badge-pending::before, .badge-creating::before,
.badge-building::before, .badge-scaling::before, .badge-updating::before {
  background: var(--yellow);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

/* Neutral pill (counts, tags) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ─── Form inputs ───────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field[hidden] { display: none; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-label .req  { color: var(--red); margin-left: 3px; }
.field-label .hint { color: var(--muted); font-weight: 400; margin-left: 6px; }

.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.field-hint code { font-size: 11px; color: var(--text-2); background: var(--hover); padding: 1px 4px; border-radius: 4px; }

.input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.55; }
select.input { padding-right: 28px; }
.input:hover { border-color: var(--faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.input::placeholder { color: var(--faint); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 36px; }
.input-icon-wrap .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.input-mono { font-family: var(--font-mono); font-size: 12px; }

.input-scan-wrap { display: flex; gap: 6px; align-items: center; }
.input-scan-wrap .input { flex: 1; min-width: 0; }

/* Cert upload row (filename display + action buttons) */
.cert-upload-row { display: flex; gap: 6px; align-items: center; }
.cert-filename {
  flex: 1;
  min-width: 0;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--muted);
  background: var(--field);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cert-filename.has-value { color: var(--text); border-style: solid; }

.btn-scan {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.btn-scan:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.btn-scan:disabled { opacity: 0.45; cursor: not-allowed; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }

/* ─── Toggle switch ─────────────────────────────────────────────────────── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 18px;
  background: var(--line-strong);
  transition: background var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(14px); background: #fff; }
.toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* ─── Segmented control ─────────────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--field);
}
.segmented button {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}
.segmented button:hover { color: var(--text); }
.segmented button.active, .segmented button[aria-pressed="true"] { background: var(--hover); color: var(--text); }

/* ─── Tables ────────────────────────────────────────────────────────────── */
/* Key numbers: a label, a big number and a small chart, without a box (the overview and the node page) */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 28px 32px;
  padding-bottom: 36px;
}
.kpi { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.kpi-value strong {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi-value span { color: var(--muted); }
.kpi-spark { width: 96px; height: 18px; overflow: visible; }
.kpi-spark polyline { fill: none; stroke: var(--text-2); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.kpi-spark.accent polyline { stroke: var(--accent); }
.kpi-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-sub.faint { color: var(--faint); }
.kpi-value--text { align-items: center; gap: 8px; min-height: 36px; }
.kpi-value--text strong { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }

/* A long list stays a fixed height and scrolls inside, with its header in view */
.scroll-list { max-height: 360px; overflow-y: auto; }
.scroll-list .table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.table th.num { font-family: var(--font-sans); }
.table .num { text-align: right; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ─── Meters ────────────────────────────────────────────────────────────── */
.meter { height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 2px; background: var(--text-2); transition: width .5s ease; }
.meter.warn > span { background: var(--yellow); }
.meter.crit > span { background: var(--red); }

/* ─── Section titles inside dialogs / legacy cards ──────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}
.section-title svg { color: var(--muted); }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 420px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--pop);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 13px;
  animation: toast-in .18s ease;
}
.toast::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}
.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.warn::before    { background: var(--yellow); }

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

/* ─── Spinner ───────────────────────────────────────────────────────────── */
.spinner {
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Dialogs ───────────────────────────────────────────────────────────── */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dialog {
  background: var(--pop);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  width: 400px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: palette-in 140ms ease;
}

.dialog.dialog-modern {
  padding: 0;
  display: flex;
  flex-direction: column;
}
.dialog-modern .dialog-title { padding: 18px 22px 14px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.dialog-modern .dialog-body  { padding: 18px 22px; margin-bottom: 0; overflow: auto; }
.dialog-modern .dialog-actions { padding: 14px 22px; border-top: 1px solid var(--line); }

.dialog-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.dialog-body  { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tab-btn.active-tab { background: var(--hover); color: var(--text); border-color: var(--line-strong); }

.gh-token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.gh-token-row-label { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.gh-token-row-hint {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
}

/* ── Users & Roles manager ──────────────────────────────────────────────── */
.mgr-shell {
  max-width: 720px;
  width: 96%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.mgr-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.mgr-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--text); white-space: nowrap; flex: 1; }
.mgr-close {
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.mgr-close:hover { background: var(--hover); color: var(--text); }
.mgr-body { flex: 1; min-height: 0; overflow-y: auto; }
.mgr-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.mgr-section:last-child { border-bottom: none; }
.mgr-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mgr-section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); }
.mgr-section-count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.mgr-section-action {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.mgr-section-action:hover { background: var(--hover); }

.mgr-list { display: flex; flex-direction: column; }
.mgr-list--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.mgr-loading, .mgr-empty, .mgr-error { font-size: 12px; color: var(--muted); text-align: center; padding: 20px 0; }
.mgr-error { color: var(--red); }

.mgr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.mgr-card:last-child { border-bottom: 0; }
.mgr-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--hover);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mgr-card-avatar--gold { color: var(--yellow); border-color: var(--yellow-border); background: var(--yellow-bg); }
.mgr-card-info { flex: 1; min-width: 0; }
.mgr-card-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgr-card-meta { font-size: 12px; color: var(--muted); }
.mgr-card-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }

.mgr-card-badge, .mgr-badge {
  font-size: 12px;
  padding: 0 8px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}
.mgr-badge--default { color: var(--text-2); }
.mgr-badge--gold { color: var(--yellow); border-color: var(--yellow-border); }
.mgr-badge--xs { font-size: 10px; height: 18px; padding: 0 6px; letter-spacing: .02em; }

.mgr-role-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}
.mgr-role-tile:hover { border-color: var(--line-strong); }
.mgr-role-tile-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mgr-role-tile-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--hover);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mgr-role-tile-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.mgr-role-tile-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mgr-role-tile-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.mgr-role-tile-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--faint); font-family: var(--font-mono); }
.mgr-role-tile-actions { display: flex; gap: 3px; }

.mgr-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.mgr-icon-btn:hover { background: var(--hover); color: var(--text); }
.mgr-icon-btn--danger:hover { background: var(--red-bg); color: var(--red); }
.mgr-icon-btn--xs { width: 22px; height: 22px; }

.mgr-perm-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mgr-perm-pill {
  font-size: 12px;
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.mgr-perm-pill:hover { color: var(--text); border-color: var(--faint); }
.mgr-perm-pill--active { color: var(--text); background: var(--accent-fill); border-color: var(--accent-border); }

.mgr-sub-backdrop { z-index: 1100; }
.mgr-sub { padding: 0; overflow: hidden; }
.mgr-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.mgr-sub-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.mgr-sub-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.mgr-field { display: flex; flex-direction: column; gap: 6px; }
.mgr-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.mgr-err { font-size: 12px; color: var(--red); padding: 8px 12px; background: var(--red-bg); border-radius: var(--radius-sm); border: 1px solid var(--red-border); }

.mgr-builtin-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.mgr-builtin-notice svg { color: var(--yellow); flex-shrink: 0; }

.mgr-perm-pills--readonly .mgr-perm-pill { cursor: default; }
.mgr-perm-pills--readonly .mgr-perm-pill:hover { border-color: var(--line-strong); color: var(--muted); }


/* ─── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 0;
  text-align: center;
}
.empty-icon {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.empty-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.empty-sub   { font-size: 13px; color: var(--muted); max-width: 340px; margin-bottom: 22px; }

/* ─── Loading skeleton ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--hover) 25%, var(--line-strong) 50%, var(--hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Code / pre ────────────────────────────────────────────────────────── */
.code-block {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  overflow: auto;
  color: var(--text-2);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── Shared table cells & empty notes ──────────────────────────────────── */
.cell-muted { color: var(--text-2); }
.cell-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.apps-empty { padding: 56px 0; text-align: center; color: var(--muted); }
.apps-empty strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 6px; font-size: 15px; }

/* ─── Audit table ───────────────────────────────────────────────────────── */
.audit-table-wrap { overflow-x: auto; }
.audit-table { min-width: 720px; }
.audit-time { white-space: nowrap; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.audit-action { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text); white-space: nowrap; }
.audit-detail { max-width: 420px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Form dialogs (e.g. Add instance) ──────────────────────────────────── */
.form-dialog { width: 460px; }
.form-dialog .dialog-body { display: flex; flex-direction: column; gap: 22px; color: var(--text-2); }
.form-dialog-intro { font-size: 13px; color: var(--muted); line-height: 1.5; }
.form-dialog-intro strong { color: var(--text); font-weight: 500; }

.form-block { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-block legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-block legend small { font-weight: 400; color: var(--faint); margin-left: 6px; }

.choice-list { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background var(--transition);
}
.choice:last-child { border-bottom: 0; }
.choice:hover { background: var(--hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.choice input:checked + .choice-dot { border: 4px solid var(--text); }
.choice input:focus-visible + .choice-dot { box-shadow: 0 0 0 3px var(--focus); }
.choice-text { display: flex; flex-direction: column; min-width: 0; }
.choice-text > span { color: var(--text); }
.choice-text small { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.unit-input { position: relative; display: block; }
.unit-input .input { padding-right: 44px; }
.unit-input .unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  pointer-events: none;
}

.form-advanced { border-top: 1px solid var(--line); padding-top: 14px; }
.form-advanced summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.form-advanced summary::-webkit-details-marker { display: none; }
.form-advanced summary::before { content: '›'; display: inline-block; transition: transform var(--transition); color: var(--muted); }
.form-advanced[open] summary::before { transform: rotate(90deg); }
.form-advanced summary:hover { color: var(--text); }
/* <details> cannot be a flex container in every browser — space children with margins */
.form-advanced > :not(summary) { margin-top: 16px; }
.form-toggle .field-label { display: block; margin-bottom: 2px; color: var(--text); }
.form-toggle .field-hint { margin-top: 0; }
.form-tmpfs-size { width: 140px; }

/* ─── Database engine logos ─────────────────────────────────────────────── */
.engine-icon {
  width: var(--size, 30px);
  height: var(--size, 30px);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--size, 30px) * 0.26);
  background: var(--engine, var(--line-strong));
}
.engine-icon svg { width: 60%; height: 60%; display: block; }
.engine-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ─── New database dialog ───────────────────────────────────────────────── */
.db-mem-warning {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--yellow) 10%, transparent);
  color: var(--yellow);
  font-size: 12px;
  line-height: 1.5;
}
.db-dialog { width: 560px; max-width: calc(100vw - 32px); }
.engine-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.engine-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.engine-card:hover { border-color: var(--faint); background: var(--hover); }
.engine-card:has(input:checked) { border-color: var(--text-2); background: var(--hover); }
.engine-card:has(input:focus-visible) { outline: 2px solid var(--text-2); outline-offset: 2px; }
.engine-card .engine-icon { margin-bottom: 8px; }
.engine-name { font-size: 13px; font-weight: 500; color: var(--text); }
.engine-kind { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
@media (max-width: 520px) {
  .engine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ─── Cron jobs ─────────────────────────────────────────────────────────── */
.cron-editor { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); }

/* Every part is a row: title and explanation left, the choice right */
.cron-row, .cron-top { padding: 14px 18px; border-top: 1px solid var(--line); }
.cron-editor > :first-child { border-top: none; }
.cron-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 16px; }
.cron-row[hidden] { display: none; }
.cron-row-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cron-row-title { font-size: 13px; font-weight: 500; color: var(--text); }
.cron-row-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Top: Schedule + Simple/Cron, then how often */
.cron-top { display: flex; flex-direction: column; gap: 12px; }
.cron-top-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cron-mode { flex-shrink: 0; }
.cron-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--field); border: 1px solid var(--line); }
.cron-tabs[hidden] { display: none; }
.cron-tabs button { height: 30px; border-radius: 5px; font-size: 13px; color: var(--muted); transition: background var(--transition), color var(--transition); }
.cron-tabs button:hover { color: var(--text); }
.cron-tabs button[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); font-weight: 500; }
.cron-simple { display: contents; }
.cron-simple[hidden] { display: none; }
.cron-advanced { display: flex; flex-direction: column; gap: 8px; }
.cron-advanced[hidden] { display: none; }

/* Chips */
.cron-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cron-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 44px; height: 30px; padding: 0 11px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: transparent;
  font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
button.cron-chip:hover { border-color: var(--muted); color: var(--text); }
.cron-chip[aria-pressed="true"], .cron-chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.cron-chip-input { padding: 0 10px 0 4px; cursor: text; border-style: dashed; }
.cron-chip-input input {
  width: 46px; height: 26px; padding: 0 4px; border: 0; outline: 0; background: transparent;
  font: inherit; color: inherit; text-align: center;
}
.cron-chip-input input::placeholder { color: var(--faint); }
.cron-chip-input:focus-within { border-style: solid; border-color: var(--muted); background: transparent; color: var(--text); }
.cron-chip-input.active { border-style: solid; }
.cron-chip-input.active input::placeholder { color: inherit; }
.cron-chip-input.invalid { border-color: var(--red); color: var(--red); }

/* The result: what you've set and when it runs next */
.cron-summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--field); }
.cron-summary:empty { display: none; }
.cron-summary-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-strong); color: var(--text); flex-shrink: 0; }
.cron-summary-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cron-summary-title { font-size: 14px; font-weight: 500; color: var(--text); }
.cron-summary-expr { flex-shrink: 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.cron-summary[data-tone="error"] { color: var(--red); background: var(--red-bg); font-size: 12.5px; align-items: center; }
.cron-note { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--yellow); line-height: 1.45; background: var(--yellow-bg); }
.cron-note[hidden] { display: none; }

.cron-tz .input { max-width: 260px; height: 32px; }
.cron-tz .input.invalid { border-color: var(--red); }

@media (max-width: 640px) {
  .cron-row { grid-template-columns: 1fr; gap: 10px; }
  .cron-row, .cron-top, .cron-summary { padding: 14px; }
  .cron-tabs button { font-size: 11.5px; }
  .cron-summary-expr { display: none; }
}

.run-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.run-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.run-status[data-status="success"] { color: var(--text); }
.run-status[data-status="success"]::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-halo); }
.run-status[data-status="failed"], .run-status[data-status="timeout"] { color: var(--red); }
.run-status[data-status="failed"]::before, .run-status[data-status="timeout"]::before { background: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }
.run-status[data-status="running"] { color: var(--yellow); }
.run-status[data-status="running"]::before { background: var(--yellow); animation: pulse 1.1s ease-in-out infinite; }
.deploy-modal .cron-row { grid-template-columns: 150px minmax(0, 1fr); }
@media (max-width: 640px) { .deploy-modal .cron-row { grid-template-columns: 1fr; } }
