:root {
  color-scheme: dark;
  --bg: #070b0a;
  --panel: #101513;
  --panel-soft: #151d1a;
  --ink: #f5f7f3;
  --muted: rgba(255, 255, 255, .62);
  --line: rgba(255, 255, 255, .12);
  --green: #5ed29c;
  --green-soft: #79b6a7;
  --amber: #d2a45f;
  --red: #dc2626;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(94, 210, 156, .32); outline-offset: 2px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); background: radial-gradient(circle at 70% 0%, rgba(94, 210, 156, .12), transparent 35%), var(--bg); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 18px 16px 24px; border-right: 1px solid var(--line); background: rgba(7, 11, 10, .78); backdrop-filter: blur(18px); }
.admin-logo { display: inline-flex; align-items: center; width: 232px; min-height: 78px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.admin-logo img { width: 100%; height: auto; display: block; }
.admin-nav { display: grid; gap: 8px; }
.admin-nav-item { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 999px; color: rgba(255,255,255,.72); font-weight: 800; font-size: 13px; letter-spacing: -.01em; transition: background .18s ease, color .18s ease, transform .18s ease; }
.admin-nav-item span { color: var(--green); width: 18px; text-align: center; }
.admin-nav-item:hover, .admin-nav-item.active { color: white; background: rgba(94, 210, 156, .12); transform: translateX(2px); }
.tenant-lock { margin-top: auto; display: flex; gap: 10px; padding: 14px; border: 1px solid rgba(94, 210, 156, .22); border-radius: 18px; background: rgba(94, 210, 156, .08); }
.tenant-lock strong, .tenant-lock small { display: block; }
.tenant-lock small { color: var(--muted); margin-top: 3px; }
.status-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 999px; background: var(--green); box-shadow: 0 0 18px var(--green); flex: 0 0 auto; }
.admin-workspace { min-width: 0; }
.admin-topbar { position: sticky; top: 0; z-index: 30; height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(7, 11, 10, .72); backdrop-filter: blur(18px); }
.admin-topbar span, .admin-topbar strong { display: block; }
.admin-topbar span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.admin-topbar strong { color: white; margin-top: 3px; }

.cluster-admin-dashboard { position: relative; min-height: calc(100vh - 76px); overflow: hidden; border-bottom: 1px solid var(--line); background: var(--bg); isolation: isolate; }
.dashboard-video, .dashboard-scrim, .grid-lines, .center-glow { position: absolute; pointer-events: none; }
.dashboard-video { inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .6; z-index: 0; }
.dashboard-scrim { inset: 0; background: linear-gradient(90deg, #070b0a 0%, rgba(7,11,10,.86) 28%, rgba(7,11,10,.22) 76%), linear-gradient(0deg, #070b0a 0%, rgba(7,11,10,.7) 20%, rgba(7,11,10,.08) 68%); z-index: 1; }
.grid-lines { inset: 0; z-index: 2; }
.grid-lines span { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.1); }
.grid-lines span:nth-child(1) { left: 25%; }
.grid-lines span:nth-child(2) { left: 50%; }
.grid-lines span:nth-child(3) { left: 75%; }
.center-glow { top: 4%; left: 50%; width: min(900px, 92vw); transform: translateX(-50%); z-index: 3; }
.dashboard-layout { position: relative; z-index: 10; min-height: calc(100vh - 76px); display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: center; gap: 28px; width: min(1280px, calc(100vw - 40px)); margin: 0 auto; padding: 58px 0; }
.admin-hero-card { min-height: 420px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; padding: clamp(26px, 4vw, 44px); border: 1px solid rgba(255,255,255,.12); border-radius: 28px; background: rgba(7, 11, 10, .34); backdrop-filter: blur(10px); box-shadow: inset 0 1px 1px rgba(255,255,255,.08), 0 28px 80px rgba(0,0,0,.24); }
.admin-hero-card h1 { max-width: 820px; margin: 0; color: white; font-size: clamp(40px, 6.6vw, 72px); line-height: .88; font-weight: 800; letter-spacing: -.075em; text-transform: uppercase; }
.admin-hero-card h1 span { color: var(--green); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.liquid-card { position: relative; width: 200px; height: 200px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 18px; margin-left: clamp(0px, 4vw, 72px); margin-bottom: -8px; transform: translateY(-50px); border-radius: 28px; overflow: hidden; background: rgba(255, 255, 255, 0.01); background-blend-mode: luminosity; backdrop-filter: blur(4px); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1); }
.liquid-card::before { content: ""; position: absolute; inset: 0; padding: 1.4px; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.08)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.liquid-card span { font-size: 14px; color: rgba(255,255,255,.72); letter-spacing: .08em; }
.liquid-card h2 { max-width: 150px; font-size: 18px; line-height: 1.05; letter-spacing: -.03em; color: white; }
.liquid-card em { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; }
.liquid-card p { font-size: 11px; line-height: 1.45; color: rgba(255,255,255,.62); }
.admin-security-card { align-self: center; margin: 0; transform: translateY(-50px); }
.hero-content { max-width: 760px; }
.hero-eyebrow { margin-bottom: 16px; color: var(--green); font-family: "Plus Jakarta Sans", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.hero-content h1 { max-width: 900px; margin: 0; color: white; font-size: clamp(40px, 8vw, 72px); line-height: .88; font-weight: 800; letter-spacing: -.075em; text-transform: uppercase; }
.hero-content h1 span { color: var(--green); }
.hero-description { max-width: 512px; margin-top: 22px; color: rgba(255,255,255,.7); font-size: 14px; line-height: 1.75; }
.clusteration-cta { width: fit-content; display: inline-flex; align-items: center; gap: 10px; margin-top: 32px; border-radius: 999px; background: var(--green); color: var(--bg); padding: 14px 22px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; box-shadow: 0 18px 45px rgba(94, 210, 156, .24); transition: transform .2s ease, box-shadow .2s ease; }
.clusteration-cta:hover { transform: translateY(-2px); box-shadow: 0 22px 60px rgba(94, 210, 156, .34); }
.clusteration-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.content, .dashboard-content { width: min(1280px, calc(100vw - 40px)); margin: 0 auto; padding: 32px 0 42px; display: grid; gap: 18px; background: transparent; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.section-header h1 { color: white; font-size: 30px; line-height: 1.15; }
.section-header p { color: var(--muted); margin-top: 8px; max-width: 760px; }
.eyebrow { color: var(--green); font-weight: 800; font-size: 12px; text-transform: uppercase; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 22px 55px rgba(0,0,0,.18); color: var(--ink); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stat-card { min-height: 112px; display: grid; align-content: space-between; border-top: 3px solid var(--green-soft); }
.stat-card.green { border-top-color: var(--green); }
.stat-card.amber { border-top-color: var(--amber); }
.stat-card.slate { border-top-color: #64748b; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { color: white; font-size: 24px; line-height: 1.1; overflow-wrap: anywhere; }

.primary-button, .ghost-button, .danger-button, .button { border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 800; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.primary-button, .button { background: var(--green); color: var(--bg); box-shadow: 0 8px 18px rgba(94, 210, 156, .22); }
.ghost-button { background: rgba(94, 210, 156, .12); color: var(--ink); }
.danger-button { background: var(--red); color: white; }
.primary-button:hover, .ghost-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button, .ghost-button, .danger-button { transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 980px; }
.table th { color: var(--muted); font-size: 12px; text-align: left; border-bottom: 1px solid var(--line); padding: 0 12px 10px; }
.table td { border-bottom: 1px solid var(--line); padding: 13px 12px; vertical-align: middle; color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.actions .primary-button, .actions .ghost-button, .actions .danger-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.badge, .pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge, .pill { color: #bfdbfe; background: rgba(59, 130, 246, .18); }
.badge-running, .pill.good { color: #bbf7d0; background: rgba(34, 197, 94, .18); }
.badge-error, .badge-failed { color: #fecaca; background: rgba(220, 38, 38, .2); }
.badge-stopped { color: #cbd5e1; background: rgba(148, 163, 184, .18); }
.badge-provisioning, .badge-pending, .pill.warn { color: #fde68a; background: rgba(245, 158, 11, .18); }
.empty { text-align: center; color: var(--muted); padding: 32px !important; }
.error { color: #fca5a5; background: rgba(185, 28, 28, .14); border: 1px solid rgba(252, 165, 165, .24); border-radius: 12px; padding: 12px; }
.success { color: #bbf7d0; background: rgba(34, 197, 94, .14); border: 1px solid rgba(187, 247, 208, .24); border-radius: 12px; padding: 12px; }

.form-card { max-width: 760px; }
.form, .form-grid { display: grid; gap: 13px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label { min-width: 0; }
.form-grid label:first-child, .form-grid label:last-of-type, .form-actions, #form-message { grid-column: 1 / -1; }
.form-grid label span, .login-card label span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.form-grid input, .form-grid select, .login-card input { width: 100%; border: 1px solid var(--line); outline: 0; min-height: 42px; border-radius: 10px; padding: 0 12px; background: var(--panel-soft); color: var(--ink); min-width: 0; }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 8px; }
.password-field input { min-width: 0; }
.password-toggle { min-width: 76px; border: 1px solid var(--line); border-radius: 10px; background: rgba(94, 210, 156, .12); color: var(--ink); font-weight: 800; padding: 0 10px; }
.password-toggle:hover { background: rgba(94, 210, 156, .2); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
#form-message { color: var(--muted); min-height: 20px; }
.details { display: grid; grid-template-columns: 140px 1fr; gap: 0.75rem; }
.details dt { color: var(--muted); font-weight: 800; }
.details dd { margin: 0; }

.login-page { position: relative; min-height: 100svh; display: grid; place-items: center; padding: clamp(18px, 4vw, 32px); background: var(--bg); overflow: hidden; isolation: isolate; }
.login-animation-layer { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
.login-animation-layer .dashboard-video { opacity: .6; }
.login-animation-layer .dashboard-scrim { background: linear-gradient(90deg, #070b0a 0%, rgba(7,11,10,.78) 34%, rgba(7,11,10,.08) 76%), linear-gradient(0deg, #070b0a 0%, rgba(7,11,10,.72) 18%, rgba(7,11,10,.08) 66%); }
.login-grid-lines { inset: 0; z-index: 2; }
.login-glow { top: 8%; z-index: 3; }
.login-card { position: relative; z-index: 10; display: grid; gap: 1rem; width: min(440px, calc(100vw - 2rem)); max-height: calc(100svh - 36px); overflow: auto; background: rgba(255, 255, 255, 0.01); background-blend-mode: luminosity; backdrop-filter: blur(4px); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 28px 80px rgba(0,0,0,.36); }
.login-card::before { content: ""; position: absolute; inset: 0; padding: 1.4px; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.08)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.login-logo { display: block; width: min(320px, 100%); height: auto; margin-bottom: 4px; }
.login-card .error { margin: 0; }
.login-card p { color: var(--muted); line-height: 1.5; }

.terminal-header { display: flex; justify-content: space-between; align-items: center; }
#terminal { height: 70vh; background: #000; padding: 0.5rem; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }

@media (max-width: 1080px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px 16px; }
  .admin-logo { width: 190px; flex: 0 0 auto; }
  .admin-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-item { flex: 0 0 auto; }
  .tenant-lock { margin-top: 0; margin-left: auto; min-width: 210px; }
  .admin-topbar { top: 78px; }
  .dashboard-layout { grid-template-columns: 1fr; align-items: stretch; }
  .admin-security-card { transform: none; width: min(100%, 320px); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  html, body { font-size: 15px; }
  .app-body, .admin-shell, .admin-workspace, .admin-workspace main { width: 100%; max-width: 100%; }
  .admin-shell { display: block; overflow-x: hidden; }
  .admin-sidebar { display: grid; grid-template-columns: 1fr; align-items: stretch; padding: 12px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-logo { width: min(210px, 100%); justify-self: center; }
  .admin-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
  .admin-nav-item { justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 14px; font-size: 12px; }
  .tenant-lock { display: none; }
  .admin-topbar { position: static; height: auto; padding: 14px 16px; align-items: stretch; flex-direction: column; }
  .admin-topbar form, .admin-topbar button { width: 100%; }
  .grid-lines { display: none; }
  .cluster-admin-dashboard { min-height: auto; }
  .dashboard-layout { width: min(100% - 24px, 680px); min-height: auto; padding: 20px 0; }
  .admin-hero-card { min-height: 0; padding: 22px; }
  .admin-hero-card h1 { font-size: clamp(34px, 13vw, 48px); line-height: .95; }
  .admin-hero-card h1 { letter-spacing: -.065em; }
  .admin-security-card { width: 100%; }
  .content, .dashboard-content { width: min(100% - 24px, 680px); padding: 24px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions .primary-button, .form-actions .ghost-button, .form-actions .danger-button, .form-actions a, .form-actions button { width: 100%; }
  .section-header, .terminal-header { align-items: stretch; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .card-title { align-items: flex-start; flex-direction: column; }
  .table-wrap { overflow: visible; }
  .table { min-width: 0; border-collapse: separate; border-spacing: 0 12px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
  .table td { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .table td:last-child { border-bottom: 0; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
  .table td.actions { display: block; }
  .table td.actions::before { display: block; margin-bottom: 10px; }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .actions .primary-button, .actions .ghost-button, .actions .danger-button { width: 100%; min-height: 40px; font-size: 12px; }
  .empty { display: block !important; text-align: center; }
  .empty::before { display: none !important; }
  .password-field { grid-template-columns: 1fr; }
  .password-toggle { min-height: 40px; }
  #terminal { height: 62vh; min-height: 360px; }
  .login-page { align-items: center; padding: 14px; min-height: 100dvh; }
  .login-card { width: min(100%, 440px); max-height: calc(100dvh - 28px); gap: .75rem; padding: 16px; }
  .login-logo { width: min(240px, 100%); }
  .login-card h1 { font-size: 26px; line-height: 1.05; }
  .login-card p { font-size: 14px; }
}

@media (max-width: 430px) {
  .admin-nav { grid-template-columns: 1fr; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-actions a { width: 100%; }
  .actions { grid-template-columns: 1fr; }
  .stats-grid { gap: 10px; }
  .login-card { padding: 14px; }
  .login-logo { width: min(210px, 100%); }
}

