:root {
  --bg: #eef3fb;
  --bg-deep: #050b14;
  --bg-deep-2: #081321;
  --bg-deep-3: #0d1d33;
  --surface: #ffffff;
  --surface-alt: #f6f9ff;
  --surface-muted: #edf3ff;
  --border: #d9e3f2;
  --border-strong: #bccadd;
  --text: #081120;
  --text-soft: #14233c;
  --muted: #62718a;
  --muted-strong: #8ca0bf;
  --sidebar: #06101d;
  --sidebar-soft: #0b182a;
  --sidebar-border: rgba(130, 156, 196, 0.16);
  --primary: #2f6bff;
  --primary-strong: #1557ff;
  --primary-soft: #e7efff;
  --primary-border: #b6cafc;
  --primary-glow: rgba(47, 107, 255, 0.28);
  --accent: #6ac7ff;
  --danger: #e04f4f;
  --danger-bg: #fff0f0;
  --danger-border: #ffc7c7;
  --warning: #a06700;
  --warning-bg: #fff6dd;
  --warning-border: #f6dc8a;
  --success: #0f8f5a;
  --success-bg: #eafcf3;
  --success-border: #b5f0d1;
  --shadow: 0 18px 48px rgba(8, 17, 32, 0.08);
  --shadow-strong: 0 28px 72px rgba(8, 17, 32, 0.14);
  --shadow-primary: 0 22px 48px rgba(47, 107, 255, 0.24);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(circle at top right, rgba(106, 199, 255, 0.12), transparent 24%),
    radial-gradient(circle at top left, rgba(47, 107, 255, 0.10), transparent 28%),
    var(--bg);
  color: var(--text);
}

body {
  line-height: 1.45;
}

.page-loader {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(6, 16, 29, 0.92);
  color: #f8fbff;
  border: 1px solid rgba(130, 156, 196, 0.18);
  box-shadow: var(--shadow-strong);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

html.js-booting .page-loader,
body.is-page-loading .page-loader {
  opacity: 1;
  pointer-events: none;
  transform: translateY(0);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--primary-soft);
  color: #17357c;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(47, 107, 255, 0.08);
}

.public-layout {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(106, 199, 255, 0.18), transparent 22%),
    radial-gradient(circle at top right, rgba(47, 107, 255, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-deep-2) 44%, #eef3fb 44%, #eef3fb 100%);
}

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 18px;
}

.auth-card {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(217, 227, 242, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow-strong);
  padding: 30px;
  backdrop-filter: blur(12px);
}

.auth-brand,
.sidebar-brand {
  display: grid;
  gap: 12px;
}

.auth-brand {
  margin-bottom: 24px;
}

.sidebar-brand {
  margin-bottom: 34px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.brand-logo img {
  height: 36px;
  width: auto;
}

.brand-logo--sidebar img {
  height: 34px;
}

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

.brand-context {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.sidebar .brand-context {
  color: var(--accent);
}

.sidebar .brand-subtitle {
  color: #90a4c3;
}

.card,
.stat-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(217, 227, 242, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
}

.card-head {
  margin-bottom: 18px;
}

.card-head--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.card-head-note {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.08), rgba(106, 199, 255, 0.12));
  border: 1px solid rgba(47, 107, 255, 0.16);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.card-head h1,
.card-head h2,
.page-head h1 {
  margin: 0 0 6px;
  color: var(--text);
}

.card-head h1,
.page-head h1 {
  font-size: 30px;
  line-height: 1.1;
}

.card-head h2 {
  font-size: 22px;
}

.card-head p,
.page-head p,
.stat-card small,
.inline-note,
.muted,
.toolbar-note {
  color: var(--muted);
}

.page-kicker,
.search-cta-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.page-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.page-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.page-breadcrumbs a:hover {
  text-decoration: underline;
}

.page-head--spotlight {
  align-items: stretch;
  padding: 28px;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at top right, rgba(106, 199, 255, 0.22), transparent 35%),
    linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-deep-2) 56%, var(--bg-deep-3) 100%);
  border: 1px solid rgba(130, 156, 196, 0.16);
  box-shadow: var(--shadow-strong);
  color: #f8fbff;
}

.page-head--spotlight h1,
.page-head--spotlight p,
.page-head--spotlight .page-head-copy {
  color: inherit;
}

.page-head-copy {
  display: grid;
  align-content: start;
  gap: 12px;
  max-width: 760px;
}

.page-head--spotlight p {
  color: #d1def3;
}

.search-cta-shell {
  min-width: 340px;
  max-width: 460px;
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(130, 156, 196, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.search-cta-copy {
  display: grid;
  gap: 10px;
}

.search-cta-copy strong {
  font-size: 18px;
  line-height: 1.3;
}

.search-cta-note {
  color: #d1def3;
  font-size: 13px;
}

.search-cta-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.search-cta-shell .inline-form {
  gap: 0;
}

.search-cta-shell .inline-field {
  min-width: 0;
}

.search-cta-shell label span {
  color: #d7e5fb;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

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

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 14px 15px;
  font: inherit;
  color: var(--text-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

textarea {
  resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(47, 107, 255, 0.54);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.14);
}

.search-cta-shell select {
  background: rgba(255, 255, 255, 0.96);
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #9ab1d1;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(8, 17, 32, 0.04);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

input[type="radio"] {
  border-radius: 999px;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: #628ce9;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 6.2L4.6 8.8L10 3.4' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

input[type="radio"]:checked {
  background-image: radial-gradient(circle at center, white 0 28%, transparent 33%), linear-gradient(var(--primary), var(--primary));
  background-size: cover;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.btn.is-loading {
  position: relative;
  opacity: 0.92;
}

.btn.is-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  display: inline-block;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 5v5h-5'/%3E%3Cpath d='M4 19v-5h5'/%3E%3Cpath d='M20 10a8 8 0 0 0-14.13-3.36L4 10'/%3E%3Cpath d='M4 14a8 8 0 0 0 14.13 3.36L20 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  animation: spin 0.9s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-warning.is-loading::after,
.btn-danger.is-loading::after {
  filter: invert(13%) sepia(23%) saturate(1145%) hue-rotate(180deg) brightness(92%) contrast(92%);
}

.btn-primary {
  background: linear-gradient(180deg, #3d79ff 0%, var(--primary) 100%);
  color: white;
  box-shadow: 0 10px 20px rgba(47, 107, 255, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2f6bff 0%, var(--primary-strong) 100%);
  box-shadow: var(--shadow-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #f8fbff;
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: #ffe8e8;
}

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.btn-warning:hover {
  background: #fff0c8;
}

.btn-cta {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #67c4ff 0%, #2f6bff 52%, #1448e0 100%);
  color: white;
  box-shadow: 0 18px 40px rgba(47, 107, 255, 0.34);
}

.btn-cta:hover {
  box-shadow: 0 22px 46px rgba(47, 107, 255, 0.40);
}

.btn-cta-search {
  min-width: 180px;
  justify-self: stretch;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 12px;
}

.form-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  font-size: 14px;
}

.form-links a {
  color: var(--primary);
  font-weight: 600;
}

.flash-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.flash {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 14px;
}

.flash-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #147446;
}

.flash-error {
  background: #fff1f1;
  border-color: #ffcaca;
  color: #a52d2d;
}

.flash-warning {
  background: #fff8e5;
  border-color: #f6dc8a;
  color: #8f5d00;
}

.private-layout .app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(106, 199, 255, 0.14), transparent 26%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-soft) 100%);
  color: #e5efff;
  padding: 30px 22px;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  position: relative;
  display: block;
  padding: 13px 15px 13px 18px;
  border-radius: 14px;
  color: #c5d5ee;
  border: 1px solid transparent;
}

.sidebar-nav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(130, 156, 196, 0.14);
  color: #fff;
}

.sidebar-nav a.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active::before {
  background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
}

.sidebar-divider {
  height: 1px;
  margin: 8px 0 4px;
  background: rgba(148, 163, 184, 0.14);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.impersonation-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-border);
  color: #7b4f00;
  padding: 14px 24px;
}

.impersonation-banner span {
  display: block;
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(217, 227, 242, 0.84);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title span {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

.topbar-title small {
  color: var(--muted);
  letter-spacing: 0.04em;
}

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

.topbar-actions form {
  margin: 0;
}

.page-content {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.stats-grid,
.card-grid,
.card-grid-2 {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid,
.card-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
  padding: 20px;
  display: grid;
  gap: 8px;
}

.stat-card strong {
  font-size: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.meta-grid .full {
  grid-column: 1 / -1;
}

.meta-grid dt {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.meta-grid dd {
  margin: 0;
  font-weight: 700;
}

.inline-form,
.button-row,
.toolbar,
.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form--search {
  width: 100%;
}

.inline-field {
  min-width: 280px;
}

.inline-field--compact {
  min-width: 0;
  width: 100%;
}

.toolbar {
  margin-bottom: 18px;
}

.toolbar--split {
  justify-content: space-between;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar-note {
  font-size: 13px;
}

.selection-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.05), rgba(106, 199, 255, 0.08));
  border: 1px solid rgba(47, 107, 255, 0.14);
  border-radius: 16px;
  color: #1d4ed8;
}

.selection-summary strong {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(217, 227, 242, 0.94);
  border-radius: 16px;
  background: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(217, 227, 242, 0.84);
  vertical-align: top;
}

.data-table thead th {
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr {
  transition: background-color 0.14s ease;
}

.data-table tbody tr:hover {
  background: #fbfdff;
}

.data-table tbody tr.is-selected {
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.06), rgba(106, 199, 255, 0.09));
}

.checkbox-col {
  width: 52px;
  min-width: 52px;
  text-align: center;
}

.checkbox-col input {
  margin-inline: auto;
}

.tags-cell {
  vertical-align: middle;
}

.tags-cell-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid rgba(55, 48, 163, 0.08);
  color: #4338ca;
  font-size: 12px;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: lowercase;
  border: 1px solid transparent;
}

.status-running,
.status-available,
.status-active,
.status-valid,
.status-success,
.status-in-use,
.status-attached {
  background: var(--success-bg);
  color: #147446;
  border-color: var(--success-border);
}

.status-stopped,
.status-stop,
.status-pending_email_verification,
.status-pending,
.status-partial,
.status-warning,
.status-creating,
.status-detaching,
.status-modifying {
  background: #fff8e5;
  color: #8f5d00;
  border-color: #f6dc8a;
}

.status-terminated,
.status-blocked,
.status-invalid,
.status-error,
.status-denied,
.status-deleted {
  background: #fff1f1;
  color: #a52d2d;
  border-color: #ffcaca;
}

.status-neutral,
.status-unknown,
.status-down,
.status-user,
.status-admin {
  background: var(--primary-soft);
  color: #1d4ed8;
  border-color: rgba(47, 107, 255, 0.18);
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.empty-state.compact {
  padding: 20px;
}

.inline-warning {
  margin-bottom: 14px;
  padding: 13px 14px;
  background: #fff7e7;
  border: 1px solid #f6dc8a;
  border-radius: 14px;
  color: #8f5d00;
}

.log-context {
  display: inline-block;
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal {
  border: none;
  padding: 0;
  border-radius: 22px;
  box-shadow: 0 40px 80px rgba(8, 17, 32, 0.25);
  width: min(560px, calc(100vw - 32px));
  background: #fff;
}

.modal::backdrop {
  background: rgba(8, 17, 32, 0.54);
}

.modal-shell {
  margin: 0;
  padding: 0;
}

.modal-head,
.modal-actions {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head {
  border-bottom: 1px solid var(--border);
}

.modal-head--search {
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-deep-2) 60%, var(--bg-deep-3) 100%);
  color: #f8fbff;
  border-bottom-color: rgba(130, 156, 196, 0.18);
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.modal-head--search .icon-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(130, 156, 196, 0.18);
  color: white;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.trade-wizard-stepper {
  font-size: 13px;
  color: var(--muted);
}

.trade-wizard-step {
  display: grid;
  gap: 10px;
}

.trade-wizard-step h4 {
  margin: 0;
}

.trade-wizard-step label {
  display: grid;
  gap: 6px;
}

.trade-wizard-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.trade-wizard-plan ul,
.trade-wizard-timeline {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.trade-wizard-timeline li {
  display: flex;
  align-items: center;
  gap: 8px;
}



.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: rgba(47, 107, 255, 0.035);
}

.clickable-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.table-link {
  color: inherit;
  font-weight: 700;
}

.table-link:hover {
  color: var(--primary-strong);
}

.stats-grid--details {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-sections {
  align-items: start;
}

.detail-grid {
  display: grid;
  gap: 18px;
}

.detail-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.notice-box {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--muted);
}

.notice-box strong {
  color: var(--text);
}

.mini-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,255,0.95));
}

.mini-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.mini-card-head strong {
  font-size: 17px;
}

.mini-card-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.meta-grid--detail dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-subsection {
  display: grid;
  gap: 10px;
}

.form-split {
  display: grid;
  gap: 14px;
}

.form-split--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-split--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-split--2 {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.compact-form {
  gap: 14px;
}

.form-actions-inline {
  display: flex;
  align-items: end;
  height: 100%;
}

.button-row--space-between {
  justify-content: space-between;
}

.action-stack--danger {
  justify-content: flex-start;
}

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

.ip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.ip-row strong {
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.toggle-field span {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-soft);
}

.toggle-field--inline {
  justify-content: flex-start;
}

.skeleton-box {
  display: inline-flex;
  width: 100%;
  min-height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(217, 227, 242, 0.72), rgba(255, 255, 255, 0.9), rgba(217, 227, 242, 0.72));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}

.skeleton-box--checkbox {
  width: 18px;
  min-height: 18px;
  border-radius: 6px;
}

.skeleton-box--code {
  max-width: 158px;
}

.skeleton-box--text {
  max-width: 180px;
}

.skeleton-box--wide {
  max-width: 260px;
}

.skeleton-box--badge {
  max-width: 84px;
}

.skeleton-box--chips {
  max-width: 220px;
}

.skeleton-box--heading {
  max-width: 220px;
  min-height: 22px;
}

.table-skeleton-row td {
  padding-top: 18px;
  padding-bottom: 18px;
}

.lazy-card,
.lazy-leaf {
  overflow: hidden;
}

.lazy-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.heading-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.refresh-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(47, 107, 255, 0.18);
  background: rgba(47, 107, 255, 0.08);
  color: var(--primary-strong);
}

.refresh-indicator svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.refresh-indicator.is-active svg {
  animation: spin 0.9s linear infinite;
}

.card-subnote {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.card-subnote.is-warning {
  color: #8f5d00;
}

.inline-action-form {
  display: inline-flex;
  align-items: center;
}

.button-row--api-actions {
  margin-top: 16px;
}

.inline-action-form--api-check {
  gap: 10px;
}

.validation-scope-box {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.scope-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(47, 107, 255, 0.16);
  background: rgba(47, 107, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.check-pill input[type="checkbox"] {
  accent-color: var(--primary);
}

.refresh-indicator--idle-hidden {
  opacity: 0;
  transition: opacity 0.16s ease;
}

.refresh-indicator--idle-hidden.is-active {
  opacity: 1;
}

#api-key-check-note.is-warning {
  color: #8f5d00;
}

.guidance-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-soft);
}

.guidance-list--ordered {
  padding-left: 22px;
}

.api-guidance-grid {
  margin-bottom: 18px;
}

.details-card {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,255,0.95));
  overflow: hidden;
}

.details-card summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 800;
  color: var(--text);
}

.details-card summary::-webkit-details-marker {
  display: none;
}

.details-card summary::after {
  content: '+';
  float: right;
  color: var(--primary-strong);
}

.details-card[open] summary::after {
  content: '−';
}

.details-card pre {
  margin: 0;
  padding: 0 18px 18px;
  overflow: auto;
}

.details-card code {
  display: block;
  min-width: min-content;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(47, 107, 255, 0.10);
  background: #0b1526;
  color: #d7e5fb;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@media (max-width: 1260px) {
  .page-head--spotlight {
    flex-direction: column;
  }

  .search-cta-shell {
    max-width: none;
  }
}

@media (max-width: 1180px) {
  .stats-grid,
  .card-grid,
  .card-grid-2,
  .detail-grid--2 {
    grid-template-columns: 1fr 1fr;
  }

  .form-split--4,
  .form-split--3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 960px) {
  .private-layout .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    padding-bottom: 18px;
  }

  .stats-grid,
  .card-grid,
  .card-grid-2,
  .meta-grid,
  .detail-grid--2,
  .form-split--4,
  .form-split--3,
  .form-split--2 {
    grid-template-columns: 1fr;
  }

  .page-head,
  .page-head-actions,
  .topbar,
  .impersonation-banner,
  .card-head--split,
  .toolbar--split {
    flex-direction: column;
    align-items: stretch;
  }

  .search-cta-controls {
    grid-template-columns: 1fr;
  }

  .btn-cta-search {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .auth-card,
  .card,
  .page-head--spotlight {
    padding: 20px;
  }

  .page-loader {
    top: 12px;
    right: 12px;
    min-height: 44px;
    padding: 0 12px;
  }

  .page-content,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .sidebar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 12px;
  }
}

.details-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.notice-box.compact {
  margin-bottom: 0;
}

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

.resource-tree-shell {
  display: grid;
  gap: 20px;
}

.resource-tree-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.resource-card {
  display: grid;
  gap: 16px;
}

.resource-leaf-grid {
  display: grid;
  gap: 18px;
}

.resource-leaf-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-leaf,
.resource-branch {
  border-color: rgba(47, 107, 255, 0.10);
}

.resource-branch-list {
  display: grid;
  gap: 16px;
}

.resource-inline-help {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .resource-leaf-grid--2,
  .detail-grid--2,
  .stats-grid--details,
  .form-split--4,
  .form-split--3 {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.action-stack--tight {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.is-disabled {
  pointer-events: none;
  opacity: 0.52;
}


.sidebar-backdrop {
  display: none;
}

.sidebar-group {
  display: grid;
  gap: 8px;
}

.sidebar-group + .sidebar-group {
  margin-top: 14px;
}

.sidebar-group-label {
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #87a2c7;
}

.sidebar-group--admin .sidebar-group-label {
  color: var(--accent);
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(47, 107, 255, 0.12);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(8, 17, 32, 0.08);
}

.topbar-nav-toggle svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-stack-gap {
  display: grid;
  gap: 18px;
}

.settings-grid {
  display: grid;
  gap: 24px;
}

.settings-form {
  gap: 18px;
}

.settings-repeater {
  display: grid;
  gap: 14px;
}

.settings-repeater--stack {
  gap: 18px;
}

.settings-row {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(217, 227, 242, 0.88);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.92), rgba(255, 255, 255, 0.98));
}

.settings-row--exchange {
  grid-template-columns: 1fr 1.15fr 1.45fr;
}

.settings-stack-card {
  display: grid;
  gap: 16px;
}

.settings-stack-card .form-grid {
  gap: 16px;
}

.inline-warning a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 960px) {
  .private-layout .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    background: rgba(5, 11, 20, 0.54);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    min-height: 100vh;
    z-index: 42;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    box-shadow: 0 24px 64px rgba(5, 11, 20, 0.28);
    padding-top: 26px;
    padding-bottom: 28px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .topbar-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .topbar {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .topbar-title span {
    font-size: 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions .btn,
  .topbar-actions form {
    flex: 1 1 auto;
  }

  .topbar-actions form .btn {
    width: 100%;
  }

  .page-content {
    padding-top: 22px;
  }

  .settings-row--exchange {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-head--spotlight,
  .card,
  .stat-card,
  .mini-card {
    border-radius: 16px;
  }

  .page-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar {
    width: min(92vw, 320px);
    padding-left: 16px;
    padding-right: 16px;
  }

  .button-row,
  .toolbar-group,
  .chip-list {
    flex-wrap: wrap;
  }

  .button-row > .btn,
  .button-row > form,
  .toolbar-group > .btn,
  .toolbar-group > form {
    width: 100%;
  }

  .button-row > form .btn,
  .toolbar-group > form .btn {
    width: 100%;
  }

  .page-head-copy p,
  .card-head p,
  .mini-card-subtitle {
    max-width: none;
  }

  .table-wrap {
    margin-left: -4px;
    margin-right: -4px;
  }

  .data-table {
    min-width: 720px;
  }
}

/* Clean P7: EC2 launch modal layout refinements. */
.form-split--instance-basics {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px);
  align-items: end;
}

.form-split--2-even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.form-split--ami-ssh label {
  min-width: 0;
}

.launch-footprint-grid {
  display: grid;
  grid-template-columns: 120px 120px minmax(150px, 1fr);
  gap: 14px;
  align-items: start;
}

.compact-number-field input[type="number"] {
  min-width: 0;
  text-align: left;
}

.compact-number-field .field-note,
.range-field .field-note {
  display: block;
  margin-top: 6px;
}


.range-field-control {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px auto;
  gap: 12px;
  align-items: center;
}

.range-field-control input[type="range"] {
  width: 100%;
  appearance: auto;
  padding: 0;
  box-shadow: none;
}

.range-field-control output {
  min-width: 72px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.desired-event-log {
  margin-top: 10px;
}

.desired-event-log summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 12px;
}

.desired-event-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.desired-event-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.desired-event-item header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.desired-event-item pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border-radius: 10px;
  background: #0b1526;
  color: #d7e5fb;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .form-split--instance-basics,
  .form-split--2-even,
  .launch-footprint-grid,
  .range-field-control {
    grid-template-columns: 1fr;
  }
}

.range-field-control input[type="range"] {
  border: none;
  background: transparent;
}

/* Clean P8: EC2 create-only modal and adaptive AWS logs. */
#create-ec2-modal {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}

#create-ec2-modal .modal-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
}

.launch-footprint-grid {
  grid-template-columns: 120px 120px 132px;
}


.data-table--desired-state {
  min-width: 1080px;
}

.desired-event-log-row td {
  padding: 0 14px 18px;
  background: #f8fbff;
}

.desired-event-log-row:hover {
  background: #f8fbff !important;
}

.desired-log-anchor {
  display: inline-block;
  margin-top: 6px;
  font-weight: 800;
  font-size: 12px;
}

.desired-event-log {
  margin-top: 0;
  width: 100%;
}

.desired-event-list {
  grid-template-columns: minmax(0, 1fr);
}

.desired-event-item {
  max-width: 100%;
}

.desired-event-message,
.error-cell {
  overflow-wrap: anywhere;
}

.desired-event-item pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 1180px) {
  #create-ec2-modal {
    width: min(740px, calc(100vw - 64px));
  }

  .desired-event-item pre {
    max-height: 420px;
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  #create-ec2-modal {
    width: min(100vw - 12px, 680px);
    max-height: calc(100vh - 12px);
  }

  #create-ec2-modal .modal-head,
  #create-ec2-modal .modal-body,
  #create-ec2-modal .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  #create-ec2-modal .modal-actions {
    justify-content: stretch;
  }

  #create-ec2-modal .modal-actions .btn {
    flex: 1 1 auto;
  }

  .launch-footprint-grid {
    grid-template-columns: 1fr 1fr;
  }


  .range-field-control {
    grid-template-columns: 1fr 96px;
  }

  .range-field-control output {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .launch-footprint-grid {
    grid-template-columns: 1fr;
  }

}

/* Clean P10: profile-first UX simplification. */
.card--primary-resource {
  margin-top: 0;
}

.card-head--resource {
  align-items: flex-start;
}

.resource-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: end;
  gap: 12px;
  min-width: min(460px, 100%);
}

.inline-form--resource-filter {
  min-width: 220px;
}

.form-split--single-primary {
  grid-template-columns: minmax(220px, 280px);
}

.launch-footprint-grid {
  grid-template-columns: 120px 120px;
}

.validation-card-head {
  margin-bottom: 12px;
}

.validation-compact-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.validation-compact-meta div,
.validation-arn {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.validation-compact-meta span,
.validation-arn span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.validation-compact-meta strong,
.validation-arn code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.readonly-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.readonly-check {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "box label" "box state";
  gap: 2px 8px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.readonly-check input[type="checkbox"] {
  grid-area: box;
  cursor: default;
}

.readonly-check span {
  grid-area: label;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.readonly-check small {
  grid-area: state;
  color: var(--muted);
  font-size: 12px;
}

.readonly-check--ok {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.readonly-check--error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.validation-arn,
.validation-short-message {
  margin-top: 12px;
}

@media (max-width: 960px) {
  .card-head--resource,
  .resource-card-actions {
    align-items: stretch;
  }

  .resource-card-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .inline-form--resource-filter,
  .resource-card-actions .btn {
    width: 100%;
  }

  .validation-compact-meta,
  .readonly-check-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .validation-compact-meta,
  .readonly-check-grid,
  .launch-footprint-grid,
  .form-split--single-primary {
    grid-template-columns: 1fr;
  }
}

/* Clean P11: compact profile management and resource controls. */
.profiles-management-card {
  display: grid;
  gap: 20px;
}

.profiles-management-head {
  margin-bottom: 0;
}

.profiles-head-actions {
  justify-content: flex-end;
}

.profiles-editor-grid {
  align-items: start;
}

.profiles-list {
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.profiles-list-head {
  padding-top: 4px;
}

.profiles-table-wrap {
  margin-top: 0;
}

.data-table--compact th,
.data-table--compact td {
  padding: 11px 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid rgba(47, 107, 255, 0.14);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  vertical-align: middle;
}

.status-pill--success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.topbar-profile-switch select {
  min-width: 230px;
  max-width: min(360px, 42vw);
  min-height: 42px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: 14px;
  font-weight: 700;
  background-color: #fff;
}

.resource-control-bar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0 18px;
  padding: 14px;
  border: 1px solid rgba(217, 227, 242, 0.78);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.84), rgba(255, 255, 255, 0.96));
}

.resource-exchange-form {
  min-width: 0;
}

.resource-region-chip {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  width: fit-content;
  max-width: 100%;
  padding: 0 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.08), rgba(106, 199, 255, 0.12));
  border: 1px solid rgba(47, 107, 255, 0.16);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.resource-create-button {
  min-width: 132px;
  align-self: end;
}

@media (max-width: 1100px) {
  .resource-control-bar {
    grid-template-columns: 1fr 1fr;
  }

  .resource-create-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 960px) {
  .profiles-management-head,
  .profiles-list-head {
    align-items: stretch;
  }

  .profiles-head-actions {
    justify-content: flex-start;
  }

  .topbar-profile-switch,
  .topbar-profile-switch select {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .resource-control-bar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .resource-region-chip,
  .resource-create-button {
    width: 100%;
  }
}

/* Clean P12: friendly EC2 management layout. */
.instances-card {
  display: grid;
  gap: 18px;
  overflow: hidden;
}

.instances-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 22px;
  align-items: start;
}

.instances-card-copy {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.instances-card-head {
  margin-bottom: 0;
}

.instances-card-head p {
  max-width: 720px;
  margin-bottom: 8px;
}

.instances-inline-warning {
  width: min(720px, 100%);
  margin: 0;
}

.instances-controls,
.resource-control-bar.instances-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-self: start;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(217, 227, 242, 0.88);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(255, 255, 255, 0.98));
  box-shadow: 0 16px 36px rgba(8, 17, 32, 0.07);
}

.instances-exchange-form,
.resource-exchange-form.instances-exchange-form {
  display: grid;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.instance-control-field,
.instance-region-block {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.instance-control-field span,
.instance-control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instance-control-field select {
  width: 100%;
  min-width: 0;
}

.resource-region-chip--full {
  display: flex;
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  line-height: 1.25;
}

.instances-controls .resource-create-button {
  width: 100%;
  min-width: 0;
  justify-content: center;
}

.toolbar--instances {
  gap: 14px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(217, 227, 242, 0.78);
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.72);
}

.toolbar--instances .toolbar-group {
  gap: 8px;
}

.toolbar--instances .toolbar-note {
  max-width: 420px;
  text-align: right;
}

.card--primary-resource .table-wrap {
  border-radius: 16px;
  overflow: auto;
}

@media (min-width: 1340px) {
  .instances-card-header {
    grid-template-columns: minmax(0, 1fr) 400px;
  }
}

@media (max-width: 1180px) {
  .instances-card-header {
    grid-template-columns: 1fr;
  }

  .instances-controls,
  .resource-control-bar.instances-controls {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(150px, auto);
    align-items: end;
  }

  .instances-controls .resource-create-button {
    min-height: 48px;
  }
}

@media (max-width: 760px) {
  .instances-controls,
  .resource-control-bar.instances-controls {
    grid-template-columns: 1fr;
  }

  .toolbar--instances {
    align-items: stretch;
  }

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

  .toolbar--instances .toolbar-group .btn {
    width: 100%;
  }

  .toolbar--instances .toolbar-note {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .toolbar--instances .toolbar-group {
    grid-template-columns: 1fr;
  }
}

/* v3.1: explicit AWS profile lifecycle controls. */
.profile-state-badges,
.profile-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.profile-state-badges {
  justify-content: flex-end;
}

.profile-row--disabled {
  opacity: 0.72;
}

.profile-row--disabled:hover {
  opacity: 0.9;
}

.profiles-table .table-actions {
  min-width: 250px;
}

@media (max-width: 760px) {
  .profile-state-badges {
    justify-content: flex-start;
  }

  .profiles-table .table-actions {
    min-width: 220px;
  }
}

/* v3.5.0-preview4: extended AWS network topology and Direct Connect telemetry. */
.network-overview {
  display: grid;
  gap: 18px;
}

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

.network-overview-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.network-overview-tile:hover {
  border-color: var(--primary-border);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 54, 108, .12);
}

.network-overview-tile span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.network-overview-tile strong {
  grid-row: span 2;
  font-size: 26px;
  line-height: 1;
  color: var(--accent-muted, var(--primary));
}

.network-overview-tile small {
  min-width: 0;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.network-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

.network-card-grid > .card {
  min-width: 0;
  margin: 0;
}

.data-table--network-wide {
  min-width: 1120px;
}

.network-wrap-text {
  display: inline-block;
  min-width: 0;
  max-width: 360px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.network-description-cell {
  min-width: 220px;
  max-width: 420px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.network-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.network-stack > strong,
.network-stack > small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.network-stack > small {
  color: var(--muted);
  font-size: 11px;
}

.network-detail-row > td {
  padding: 0 !important;
  border-top: 0 !important;
  background: var(--surface-alt);
}

.network-details {
  padding: 0 14px 14px;
}

.network-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 10px 2px;
  cursor: pointer;
  color: var(--accent-muted, var(--primary));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  list-style: none;
}

.network-details > summary::-webkit-details-marker {
  display: none;
}

.network-details > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  transition: transform .16s ease;
}

.network-details[open] > summary::before {
  content: "−";
}

.network-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  padding-top: 4px;
}

.network-detail-grid--rules > div,
.network-subsection {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.network-detail-grid h3,
.network-subsection h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.network-kv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
}

.network-kv-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
}

.network-kv-grid > div > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.network-kv-grid > div > strong {
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.network-mini-table-wrap {
  margin-top: 12px;
  border-radius: var(--radius-sm);
}

.network-mini-table {
  min-width: 680px;
  font-size: 12px;
}

.network-rule-list {
  display: grid;
  gap: 8px;
}

.network-rule-row {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
}

.network-rule-row > span {
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.network-health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-weight: 700;
  text-transform: capitalize;
}

.network-health::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.network-health--available {
  color: var(--success);
}

.network-health--pending {
  color: var(--warning);
}

.network-health--failed {
  color: var(--danger);
}

.network-health--unknown {
  color: var(--muted);
}

.network-subsection {
  margin-top: 12px;
}

@media (max-width: 1280px) {
  .network-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .network-card-grid {
    grid-template-columns: 1fr;
  }

  .network-kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .network-overview-grid,
  .network-detail-grid,
  .network-kv-grid {
    grid-template-columns: 1fr;
  }

  .network-overview-tile {
    padding: 13px 14px;
  }

  .network-rule-row {
    grid-template-columns: 1fr;
  }

  .network-details {
    padding-inline: 10px;
  }
}

/* v3.6.0: exchange credential validation controls. */
.exchange-credential-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.exchange-credential-actions form {
    margin: 0;
}

.exchange-key-check-message {
    margin-top: 0.875rem;
    overflow-wrap: anywhere;
}

/* Security Group management */
.modal--wide {
  width: min(760px, calc(100vw - 32px));
}

.security-group-card-actions,
.security-group-actions,
.security-rule-actions,
.security-rule-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.security-group-card-actions,
.security-rule-heading {
  justify-content: space-between;
}

.security-group-actions,
.security-rule-actions {
  align-items: stretch;
}

.security-group-actions .inline-form,
.security-rule-actions .inline-form {
  margin: 0;
}

.security-group-table {
  min-width: 1180px;
}

.security-group-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  padding: 8px 0 12px;
  color: var(--text-soft);
  font-size: 12px;
}

.security-group-detail-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.security-rule-grid {
  grid-template-columns: 1fr;
}

.security-rule-heading {
  margin-bottom: 10px;
}

.security-rule-heading h3 {
  margin: 0 0 3px;
}

.security-rule-heading small {
  color: var(--muted);
}

.security-rule-table-wrap {
  border-radius: var(--radius-sm);
}

.security-rule-table {
  min-width: 900px;
  font-size: 12px;
}

.security-rule-table th:last-child,
.security-rule-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.security-rule-warning {
  margin-bottom: 10px;
}

.security-rule-form-grid,
.security-rule-port-grid {
  align-items: start;
}

.security-public-ingress-confirm {
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 82, 57, 0.32);
  border-radius: var(--radius-sm);
  background: rgba(201, 82, 57, 0.07);
  color: var(--text-soft);
}

.security-public-ingress-confirm input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.security-public-ingress-confirm span {
  line-height: 1.45;
}

@media (max-width: 760px) {
  .security-group-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .security-group-card-actions .btn {
    flex: 1 1 auto;
  }

  .security-rule-heading {
    align-items: flex-start;
  }

  .security-rule-heading .btn {
    width: 100%;
  }
}

.security-group-assignment {
  margin-top: 12px;
}

.security-group-selector {
  display: grid;
  gap: 8px;
  max-height: 340px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.security-group-selector legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.security-group-selector-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  cursor: pointer;
}

.security-group-selector-row:hover {
  border-color: var(--border-strong);
}

.security-group-selector-row > input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.security-group-selector-row > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.security-group-selector-row strong,
.security-group-selector-row code,
.security-group-selector-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.security-group-selector-row small {
  color: var(--muted);
}
