/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #0f172a;            /* sidebar */
  --surface-2-ink: #cbd5e1;
  --surface-2-ink-strong: #f8fafc;
  --surface-2-line: #1e293b;
  --surface-elev: #ffffff;

  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --line: #e4e7ec;
  --line-strong: #cbd2dc;

  --accent: #147a73;
  --accent-dark: #0f5f59;
  --accent-soft: #e6f4f2;
  --accent-ink: #0a3f3b;

  --success: #1e7a4d;
  --success-soft: #e6f4ec;
  --warn: #9b5c00;
  --warn-soft: #fff4dc;
  --danger: #9b1c31;
  --danger-soft: #fdecef;
  --info: #1e4fa3;
  --info-soft: #e8efff;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html { height: 100%; }
body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; color: var(--ink); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 650; }

p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-2);
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre {
  max-width: 100%; overflow: auto;
  background: #0f172a; color: #f1f5f9;
  border-radius: var(--r-md); padding: 14px; margin: 0;
  font-size: 12.5px; line-height: 1.55;
}

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  background: var(--surface-2);
  color: var(--surface-2-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  padding: 18px 14px;
  border-right: 1px solid var(--surface-2-line);
}

.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  color: var(--surface-2-ink-strong);
  font-weight: 800; font-size: 16px; letter-spacing: -.01em;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #2dd4bf);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800;
}

.sidebar__nav { flex: 1; overflow-y: auto; }
.sidebar__group { margin-bottom: 14px; }
.sidebar__heading {
  display: block;
  padding: 10px 10px 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2);
}
.sidebar__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--surface-2-ink);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 1px;
  transition: background .12s, color .12s;
}
.sidebar__link:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--surface-2-ink-strong);
  text-decoration: none;
}
.sidebar__link.is-active {
  background: rgba(20, 122, 115, .18);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar__link svg {
  width: 16px; height: 16px; flex: 0 0 16px;
  opacity: .85;
}
.sidebar__link.is-active svg { opacity: 1; color: #5eead4; }

.sidebar__footer {
  border-top: 1px solid var(--surface-2-line);
  padding: 12px 10px 4px;
  margin-top: 8px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar__user {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.sidebar__user strong {
  color: var(--surface-2-ink-strong);
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar__user span {
  color: var(--muted-2); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #fff; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 32px;
}
.btn-logout {
  background: transparent; border: 1px solid var(--surface-2-line);
  color: var(--surface-2-ink); min-height: 32px; padding: 0 10px;
  font-size: 12.5px; font-weight: 600;
}
.btn-logout:hover { background: rgba(255,255,255,.06); color: var(--surface-2-ink-strong); }

/* ---------- Main column ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 56px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
}
.topbar__crumbs {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px;
}
.topbar__crumbs strong { color: var(--ink); font-weight: 600; }
.topbar__crumbs .sep { color: var(--muted-2); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.org-switcher select {
  min-height: 36px; padding: 0 28px 0 12px;
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  width: auto; min-width: 180px;
  border-radius: var(--r-md);
}
.org-switcher select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.role-pill {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-ink);
  text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- Page ---------- */
.page {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 22px;
}
.page-header__text { flex: 1; min-width: 0; }
.page-header h1 { margin: 0 0 4px; }
.page-header p { margin: 0; color: var(--muted); }
.page-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toast {
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin: 0 0 14px;
  font-weight: 500;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: opacity .35s ease, transform .35s ease;
}
.toast--leaving { opacity: 0; transform: translateY(-6px); }
.toast__icon { width: 18px; height: 18px; flex: 0 0 18px; }
.toast__body { flex: 1; min-width: 0; }
.toast__close {
  background: transparent; border: 0; padding: 4px;
  min-height: auto; color: inherit; opacity: .55; cursor: pointer;
  border-radius: var(--r-sm);
}
.toast__close:hover { opacity: 1; background: rgba(15,23,42,.06); }
.toast__close svg { width: 14px; height: 14px; }
.toast--ok    { background: var(--success-soft); border-color: #b6dec6; color: var(--success); }
.toast--err   { background: var(--danger-soft);  border-color: #eac2cb; color: var(--danger); }
.toast--info  { background: var(--info-soft);    border-color: #c7d4f0; color: var(--info); }
.toast--warn  { background: var(--warn-soft);    border-color: #ebd8a4; color: var(--warn); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card__header h2 { margin: 0; font-size: 14px; font-weight: 650; }
.card__header p { margin: 0; font-size: 12.5px; color: var(--muted); }
.card__title { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.card__actions { display: flex; gap: 8px; align-items: center; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  font-size: 12.5px; color: var(--muted);
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .12s, transform .12s;
  color: var(--ink);
}
.stat:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}
a.stat:hover { transform: translateY(-1px); }
.stat__icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-dark);
  flex: 0 0 38px;
}
.stat__icon svg { width: 18px; height: 18px; }
.stat__body { flex: 1; min-width: 0; }
.stat__label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 2px;
}
.stat__value {
  display: block;
  font-size: 26px; font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.stat__hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Split layout ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
}
.split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data thead th {
  position: sticky; top: 0;
  background: #fafbfc;
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
table.data td.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink-2); }
table.data td.muted { color: var(--muted); }

.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.table-toolbar input[type="search"] {
  height: 34px; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  width: 240px; font-size: 13px; background: #f8fafc;
}
.table-toolbar input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
.table-toolbar .spacer { flex: 1; }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: #f1f5f9; color: var(--ink-2);
  font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent;
}
.filter-chip:hover { background: #e2e8f0; text-decoration: none; }
.filter-chip.is-active {
  background: var(--accent-soft); color: var(--accent-ink);
  border-color: #b9ded9;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}
.empty-state .empty-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-dark);
  margin: 0 auto 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.empty-state .empty-icon svg { width: 20px; height: 20px; }
.empty-state h3 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty-state p { margin-bottom: 12px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
  letter-spacing: .01em;
  background: #eef2f7; color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .85;
}
.badge--neutral { background: #eef2f7; color: var(--ink-2); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warn    { background: var(--warn-soft); color: var(--warn); }
.badge--danger  { background: var(--danger-soft); color: var(--danger); }
.badge--info    { background: var(--info-soft); color: var(--info); }

/* keep the legacy .pill name working */
.pill {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7; color: var(--ink-2);
  font-size: 11.5px; font-weight: 650;
}

/* ---------- Buttons ---------- */
:where(.btn, button[type], .button-link) {
  border: 1px solid transparent;
  border-radius: var(--r-md);
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  background: var(--accent); color: #fff;
  transition: background .12s, border-color .12s, color .12s;
}
:where(.btn, button[type], .button-link):hover {
  background: var(--accent-dark); text-decoration: none;
}
:where(.btn, button[type], .button-link) svg { width: 14px; height: 14px; }

.btn--primary  { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--secondary {
  background: #f1f5f9; color: var(--ink);
  border-color: var(--line);
}
.btn--secondary:hover { background: #e2e8f0; }
.btn--ghost {
  background: transparent; color: var(--ink-2);
  border-color: transparent;
}
.btn--ghost:hover { background: #f1f5f9; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #821628; }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; }

.btn--link {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  min-height: auto;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
}
.btn--link:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.btn--link.is-danger { color: var(--danger); }
.btn--link.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

.row-actions { display: flex; justify-content: flex-end; gap: 4px; align-items: center; }

/* ---------- Dialog ---------- */
dialog.modal {
  border: 0;
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--ink);
  max-width: 720px;
  width: calc(100% - 32px);
}
dialog.modal::backdrop {
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
}
.modal__header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal__title { flex: 1; min-width: 0; }
.modal__title h2 { margin: 0; font-size: 16px; }
.modal__title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.modal__close {
  background: transparent; border: 0; padding: 4px; min-height: auto;
  color: var(--muted); border-radius: var(--r-sm); cursor: pointer;
}
.modal__close:hover { background: #f1f5f9; color: var(--ink); }
.modal__body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal__footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 14px; }
.form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label,
label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 6px;
}
.field .helper, .helper {
  font-size: 12px; color: var(--muted); font-weight: 400;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-height: 40px;
  padding: 9px 11px;
  font: inherit; font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 122, 115, .18);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.form-actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  padding-top: 4px;
}

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center; justify-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 122, 115, .08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(20, 122, 115, .06), transparent 40%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
}
.auth-card__brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
  font-weight: 800; font-size: 16px;
  color: var(--ink);
}
.auth-card h1 { font-size: 22px; margin-bottom: 2px; }
.auth-card .lead { color: var(--muted); margin-bottom: 18px; }
.auth-card .form-grid { gap: 12px; }
.auth-card .btn { width: 100%; min-height: 42px; }
.auth-card .meta {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-align: center; color: var(--muted);
}

/* ---------- Job detail timeline ---------- */
.kv-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  align-items: baseline;
  font-size: 13px;
}
.kv-grid dt { color: var(--muted); font-weight: 500; }
.kv-grid dd { margin: 0; color: var(--ink); }

/* ---------- Provisioned resources: at-a-glance tiles ---------- */
.rs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.rs-stat {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fafbfc;
}
.rs-stat__label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.rs-stat__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.rs-stat__sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ---------- Provisioned resources: topology diagram ---------- */
.rs-topo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0 18px;
  font-size: 13px;
}
.rs-topo__internet,
.rs-topo__node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 500;
}
.rs-topo__node--gw {
  border-style: solid;
  color: var(--ink);
  background: #f4f6f9;
}
.rs-topo__icon { font-size: 14px; }
.rs-topo__line {
  width: 2px;
  height: 18px;
  background: var(--line-strong);
}
.rs-topo__vpc {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #f4f6f9;
  padding: 12px;
}
.rs-topo__vpc-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink);
  margin-bottom: 10px;
}
.rs-topo__zone {
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 6px);
  background: #fff;
  padding: 10px 12px;
}
.rs-topo__zone + .rs-topo__zone { margin-top: 8px; }
.rs-topo__zone--public { border-left: 3px solid #3b82f6; }
.rs-topo__zone--private { border-left: 3px solid #94a3b8; }
.rs-topo__zone-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.rs-topo__resources { display: flex; flex-direction: column; gap: 6px; }
.rs-topo__res {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 6px);
  background: #fafbfc;
  font-size: 13px;
}
.rs-topo__res--empty {
  color: var(--muted);
  font-style: italic;
  border-style: dashed;
  background: transparent;
}
.rs-topo__res-icon {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--success-soft, #e7f5ec);
  color: var(--success, #2c7a4f);
}
.rs-topo__res--db .rs-topo__res-icon {
  background: #eef2ff;
  color: #4f46e5;
}
.rs-topo__res-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
}

/* ---------- Topology diagram (inline SVG) ---------- */
.topo-diagram {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 8px auto 18px;
  height: auto;
}
.topo-diagram text {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  fill: var(--ink);
  font-size: 13px;
}
.topo-diagram .topo-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  fill: var(--muted);
}
.topo-diagram .topo-sub {
  font-size: 11px;
  fill: var(--muted);
}
.topo-diagram .topo-node-name { font-weight: 600; }

/* Pill: Internet */
.topo-diagram .topo-internet rect {
  fill: #f1f5f9;
  stroke: var(--line-strong);
  stroke-dasharray: 4 4;
}
.topo-diagram .topo-internet text { fill: var(--ink-2); font-weight: 600; }

/* IGW */
.topo-diagram .topo-igw rect {
  fill: #ffffff;
  stroke: var(--line-strong);
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .05));
}

/* VPC frame */
.topo-diagram .topo-vpc rect {
  fill: #fafbfd;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 6 4;
}

/* Public subnet */
.topo-diagram .topo-public rect {
  fill: #eff6ff;
  stroke: #3b82f6;
}
.topo-diagram .topo-public .topo-label { fill: #1e40af; }

/* Private subnet */
.topo-diagram .topo-private rect {
  fill: #ecfdf5;
  stroke: #059669;
}
.topo-diagram .topo-private .topo-label { fill: #065f46; }

/* Resource boxes */
.topo-diagram .topo-res rect {
  fill: #ffffff;
  stroke: var(--line-strong);
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .08));
}
.topo-diagram .topo-res--paused rect { fill: #f1f5f9; }
.topo-diagram .topo-res--paused text { fill: var(--muted); }
.topo-diagram .topo-res--empty rect {
  fill: transparent;
  stroke-dasharray: 4 4;
}
.topo-diagram .topo-res--empty text { fill: var(--muted); font-style: italic; }
.topo-diagram .topo-res .topo-icon {
  fill: var(--accent-dark);
}
.topo-diagram .topo-res--db .topo-icon { fill: #4338ca; }

/* Edges (lines + arrows) */
.topo-diagram .topo-edge {
  stroke: var(--line-strong);
  stroke-width: 1.6;
  fill: none;
}
.topo-diagram .topo-edge--solid { stroke: #94a3b8; }
.topo-diagram .topo-edge--secure { stroke: #4338ca; stroke-dasharray: 5 4; }
.topo-diagram .topo-edge-label {
  font-size: 10.5px;
  font-weight: 600;
  fill: #334155;
}
.topo-diagram .topo-edge-label-bg {
  fill: #ffffff;
  stroke: var(--line);
}

/* ---------- Database connection block ---------- */
.rs-conn {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fafbfc;
}
.rs-conn__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.rs-conn__list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-conn__row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: baseline;
}
.rs-conn__row dt { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.rs-conn__row dd { margin: 0; font-size: 13px; word-break: break-all; }

/* ---------- Collapsible card ---------- */
details.card {
  padding: 0;
}
details.card > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
  color: var(--ink);
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 120ms ease;
  flex: 0 0 auto;
}
details.card[open] > summary::after { transform: rotate(45deg); }
details.card > summary .summary__title { display: flex; flex-direction: column; gap: 2px; }
details.card > summary .summary__title strong { font-weight: 600; }
details.card > summary .summary__title span { color: var(--muted); font-weight: 400; font-size: 12.5px; }
details.card[open] > summary { border-bottom: 1px solid var(--line); }
details.card > .card__body { border-top: 0; }

/* ---------- Application detail: public URLs strip ---------- */
.app-urls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 4px 0 0;
}
.app-urls a {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.app-urls__sep { color: var(--muted); }

/* ---------- Collapsed AWS IDs ---------- */
.rs-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.rs-details > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0;
  user-select: none;
}
.rs-details > summary:hover { color: var(--ink); }
.rs-details[open] > summary { color: var(--ink); margin-bottom: 8px; }
.rs-details__body > .resource-group:first-child { margin-top: 0; }

/* ---------- Provisioned resources panel ---------- */
.resource-group + .resource-group { margin-top: 18px; }
.resource-group__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 8px;
}
.resource-list { margin: 0; display: flex; flex-direction: column; }
.resource-list__row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.resource-list__row:last-child { border-bottom: 0; }
.resource-list__label { display: block; font-weight: 600; color: var(--ink); font-size: 13px; }
.resource-list__hint  { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; line-height: 1.35; }
.resource-list dt { margin: 0; }
.resource-list dd { margin: 0; font-size: 13px; word-break: break-all; }
.resource-list dd a.code { text-decoration: none; }
.resource-list dd a.code:hover { text-decoration: underline; }

.timeline { display: flex; flex-direction: column; }
.timeline__row {
  display: grid;
  grid-template-columns: 130px max-content minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.timeline__row:last-child { border-bottom: 0; }
.timeline__time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.timeline__msg { font-size: 13.5px; color: var(--ink); min-width: 0; }
.timeline__msg pre {
  margin-top: 8px;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.level-info  { color: var(--info); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.level-warn  { color: var(--warn); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.level-error { color: var(--danger); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.level-debug { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Checklist ---------- */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist__item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  transition: border-color .12s;
}
.checklist__item:hover { border-color: var(--line-strong); text-decoration: none; }
.checklist__item .check {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
}
.checklist__item.is-done {
  background: var(--success-soft);
  border-color: #b6dec6;
  color: var(--success);
}
.checklist__item.is-done .check {
  background: var(--success); color: #fff; border-color: var(--success);
}
.checklist__item.is-done .check svg { width: 12px; height: 12px; }
.checklist__item .label { flex: 1; }
.checklist__item .arrow { color: var(--muted); }

/* ---------- Drawer (collapsible form) ---------- */
details.drawer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
details.drawer > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; color: var(--ink);
}
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer > summary .chev {
  margin-left: auto; transition: transform .15s;
  color: var(--muted);
}
details.drawer[open] > summary .chev { transform: rotate(180deg); }
details.drawer > summary:hover { background: #fafbfc; border-radius: var(--r-lg); }
details.drawer .drawer__body {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--line);
}

/* ---------- Misc ---------- */
.notice, .error {
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid;
}
.notice { background: var(--success-soft); border-color: #b6dec6; color: var(--success); }
.error  { background: var(--danger-soft);  border-color: #eac2cb; color: var(--danger); }

.inline-form { display: inline; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --sidebar-w: 72px; }
  .sidebar__brand strong, .sidebar__heading,
  .sidebar__link span, .sidebar__user, .btn-logout { display: none; }
  .sidebar { padding: 18px 8px; }
  .sidebar__link { justify-content: center; padding: 10px; }
  .sidebar__brand { justify-content: center; }
  .sidebar__footer { justify-content: center; padding: 10px 0 0; }
}

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto;
    flex-direction: row; flex-wrap: wrap;
    padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid var(--surface-2-line);
  }
  .sidebar__nav { display: flex; flex-direction: row; gap: 4px; overflow-x: auto; flex: 1; }
  .sidebar__group { display: contents; }
  .sidebar__heading { display: none; }
  .sidebar__link { padding: 8px 10px; }
  .sidebar__brand { padding: 0 10px 0 0; }
  .sidebar__footer { display: none; }
  .topbar { padding: 0 16px; gap: 8px; }
  .org-switcher select { min-width: 140px; }
  .page { padding: 18px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split--even { grid-template-columns: 1fr; }
  .form-grid--2 { grid-template-columns: 1fr; }
  .timeline__row { grid-template-columns: 1fr; }
  .timeline__time { font-size: 11.5px; }
  .job-grid { grid-template-columns: 1fr; }
  .job-hero__main { gap: 12px; }
  .job-hero__icon { width: 40px; height: 40px; }
  .job-hero__icon svg { width: 18px; height: 18px; }
}

/* ========================================================================
   Job detail page
   ======================================================================== */

.job-hero {
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 22px 20px;
  margin-bottom: 18px;
}
.job-hero__top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.job-hero__top .eyebrow { margin: 0; }
.job-hero__top .eyebrow a { color: inherit; }
.job-hero__main {
  display: flex; align-items: center; gap: 16px;
}
.job-hero__icon {
  width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2f7; color: var(--ink);
}
.job-hero__icon svg { width: 22px; height: 22px; }
.job-hero__icon--success { background: color-mix(in srgb, var(--success) 14%, #fff); color: var(--success); }
.job-hero__icon--warn    { background: color-mix(in srgb, var(--warn)    14%, #fff); color: var(--warn); }
.job-hero__icon--danger  { background: color-mix(in srgb, var(--danger)  14%, #fff); color: var(--danger); }
.job-hero__icon--info    { background: color-mix(in srgb, var(--info)    14%, #fff); color: var(--info); }
.job-hero__text h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ink);
}
.job-hero__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px;
}
.job-hero__sep { color: var(--muted); }
.job-hero__error {
  margin-top: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, #fff);
  border-radius: var(--r-md);
  color: var(--ink);
}
.job-hero__error svg {
  width: 16px; height: 16px; flex: 0 0 16px;
  color: var(--danger);
  margin-top: 2px;
}
.job-hero__error strong { display: block; margin-bottom: 2px; }
.job-hero__error span { color: var(--muted); font-size: 13px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1.4s linear infinite; transform-origin: center; }

/* ----- Layout grid ----- */
.job-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.job-side { display: flex; flex-direction: column; gap: 14px; }

/* ----- Live pill ----- */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 12%, #fff);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.live-pill__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 50%, transparent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0  color-mix(in srgb, var(--warn) 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--warn)  0%, transparent); }
  100% { box-shadow: 0 0 0 0  color-mix(in srgb, var(--warn)  0%, transparent); }
}

/* ----- Event feed ----- */
.evt-feed {
  list-style: none;
  margin: 0;
  padding: 6px 18px 14px;
}
.evt {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
  position: relative;
}
.evt__rail {
  position: relative;
  display: flex; justify-content: center;
}
.evt__rail::before {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: -12px;
  width: 2px;
  background: var(--line);
  transform: translateX(-50%);
}
.evt:last-child .evt__rail::before { bottom: 50%; }
.evt:first-child .evt__rail::before { top: 50%; }
.evt__dot {
  position: relative;
  z-index: 1;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 8px;
  background: var(--info);
  box-shadow: 0 0 0 3px #fff;
}
.evt--warn  .evt__dot { background: var(--warn); }
.evt--error .evt__dot { background: var(--danger); }
.evt--debug .evt__dot { background: var(--muted); }
.evt--active .evt__dot {
  background: var(--warn);
  animation: pulse 1.6s ease-out infinite;
}
.evt__body { padding: 4px 0 10px; min-width: 0; }
.evt__head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.evt__msg {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}
.evt--error .evt__msg { color: var(--danger); }
.evt__count {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.evt__time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.evt__details {
  margin-top: 6px;
  font-size: 12.5px;
}
.evt__details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
  list-style: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 0;
}
.evt__details summary::-webkit-details-marker { display: none; }
.evt__details summary::before {
  content: "▸";
  font-size: 9px;
  transition: transform .15s;
  display: inline-block;
}
.evt__details[open] summary::before { transform: rotate(90deg); }
.evt__details summary:hover { color: var(--ink); }
.evt__details pre {
  margin: 6px 0 0;
  padding: 10px 12px;
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ----- Meta list (sidebar) ----- */
.meta-list { margin: 0; }
.meta-list__row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.meta-list__row:last-child { border-bottom: 0; }
.meta-list__row dt { color: var(--muted); margin: 0; }
.meta-list__row dd { margin: 0; color: var(--ink); text-align: right; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--line);
  color: var(--ink);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background .12s, border-color .12s;
}
.copy-btn:hover { background: var(--line); border-color: var(--line-strong); }
.copy-btn--ok {
  background: color-mix(in srgb, var(--success) 18%, #fff);
  border-color: color-mix(in srgb, var(--success) 40%, var(--line));
}
.copy-btn--ok::after {
  content: "Copied";
  font-size: 11px;
  color: var(--success);
}
