@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --color-bg-deep: #080a0f;
  --color-bg: #0e1117;
  --color-surface: #151922;
  --color-surface-raised: #1a1f2a;
  --color-surface-hover: #222836;
  --color-border: rgba(255, 255, 255, 0.07);
  --color-border-strong: rgba(255, 255, 255, 0.12);
  --color-text: #e8eaef;
  --color-muted: #8f97a6;
  --color-accent: #3b82f6;
  --color-accent-soft: rgba(59, 130, 246, 0.18);
  --color-accent-hover: #60a5fa;
  --color-success: #34d399;
  --color-danger: #fb7185;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.55);
  --font-sans: "DM Sans", system-ui, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ide-sidebar-width: 300px;
  --ide-bottom-height: 280px;
}

html {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg-deep);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Login screen: full-viewport media behind glass panels (see login.html). */
body.login-page {
  background-color: var(--color-bg-deep);
  min-height: 100vh;
  position: relative;
}

.login-page-media {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--color-bg-deep);
}

.login-page-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.login-page-scrim {
  position: absolute;
  inset: 0;
  /* Light touch so the parrot video stays visible behind the card */
  background:
    linear-gradient(160deg, rgba(6, 8, 12, 0.45) 0%, rgba(6, 8, 12, 0.22) 38%, rgba(6, 8, 12, 0.38) 100%),
    radial-gradient(ellipse 85% 65% at 70% 20%, rgba(59, 130, 246, 0.08), transparent 50%);
}

.login-footer-hud {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px 16px;
  pointer-events: none;
}

.login-footer-hud > * {
  pointer-events: auto;
}

.login-media-credit {
  flex: 1 1 220px;
  max-width: 720px;
  margin: 0;
  padding: 0;
  font-size: 0.62rem;
  line-height: 1.5;
  color: rgba(232, 234, 239, 0.42);
  text-align: right;
}

.login-media-credit a {
  color: rgba(147, 197, 253, 0.78);
  text-decoration: none;
}

.login-media-credit a:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .login-page-video {
    display: none;
  }

  .login-page-media {
    background: center / cover no-repeat #080a0f
      url("https://images.unsplash.com/photo-1552728089-57bdde30beb3?auto=format&fit=crop&w=1920&q=80");
  }
}

.brand {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a8b4cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1 {
  margin: 0 0 10px 0;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

h2 {
  margin: 0 0 12px 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}

h3 {
  margin: 0 0 10px 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
}

.hint {
  margin-top: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

label {
  display: block;
  margin: 14px 0 8px;
  color: #b4bac6;
  font-size: 0.82rem;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: var(--color-text);
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: var(--color-text);
  font-family: inherit;
  cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  transform: translateY(1px);
  accent-color: var(--color-accent);
}

button {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: linear-gradient(180deg, #4b8ff7 0%, #2563eb 100%);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform 120ms var(--ease), filter 120ms var(--ease), box-shadow 120ms var(--ease);
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  margin-top: 0;
  color: var(--color-text);
  box-shadow: none;
}

button.secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  filter: none;
}

.error {
  color: var(--color-danger);
  font-size: 0.875rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.25);
}

.panel {
  max-width: 420px;
  margin: 10vh auto;
  background: rgba(21, 25, 34, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

/* Centered narrow stack — keeps most of the viewport for background media */
.login-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 400px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 20px 120px;
  box-sizing: border-box;
}

.login-brand {
  text-align: center;
  padding: 0 4px 4px;
}

.login-brand .hero-badge {
  margin-bottom: 10px;
}

.login-brand h1 {
  margin: 0 0 8px 0;
  font-size: clamp(1.65rem, 5vw, 2rem);
}

.login-brand__tagline {
  margin: 0 auto;
  max-width: 34em;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(180, 188, 200, 0.92);
}

body.login-page .login-panel {
  margin: 0;
  max-width: none;
  width: 100%;
  padding: 22px 22px 24px;
  background: rgba(10, 12, 18, 0.48);
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

body.login-page .login-panel .hint:first-of-type {
  margin-bottom: 4px;
}

body.login-page .login-panel label:first-of-type {
  margin-top: 10px;
}

.oauth-login {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(147, 197, 253, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

.oauth-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.oauth-buttons .oauth-btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
}

.oauth-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 120ms var(--ease), filter 120ms var(--ease), box-shadow 120ms var(--ease), border-color 140ms var(--ease);
}

.oauth-btn__icon {
  flex-shrink: 0;
}

.oauth-btn--discord {
  background: #5865f2;
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) inset;
}

.oauth-btn--discord:hover {
  filter: brightness(1.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.oauth-btn--steam {
  background: linear-gradient(180deg, #2a475e 0%, #1b2838 100%);
  color: #dbe7f5;
  border-color: rgba(102, 192, 244, 0.25);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.oauth-btn--steam:hover {
  filter: brightness(1.06);
  border-color: rgba(102, 192, 244, 0.45);
}

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

.oauth-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
.link-btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.activity-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.ide-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) 6px minmax(160px, var(--ide-bottom-height));
  background: var(--color-bg);
}

.ide-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 16px;
  background: linear-gradient(180deg, rgba(26, 31, 42, 0.98) 0%, rgba(21, 25, 34, 0.99) 100%);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ide-title-left,
.ide-title-center,
.ide-title-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ide-title-center {
  margin-left: auto;
  margin-right: auto;
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.ide-title-right .link-btn,
.ide-title-right button.secondary {
  margin-top: 0;
}

.ide-title-center strong {
  color: var(--color-text);
  font-weight: 600;
}

.oauth-link-banner {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(52, 211, 153, 0.32);
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
  font-size: 0.82rem;
}

.title-muted {
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid var(--color-border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: #c4cad4;
}

.status-up {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--color-success);
  background: rgba(52, 211, 153, 0.1);
}

.status-down {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--color-danger);
  background: rgba(251, 113, 133, 0.08);
}

.status-unknown {
  border-color: rgba(96, 165, 250, 0.45);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
}

.link-btn {
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: var(--color-surface-raised);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}

.link-btn:hover {
  background: var(--color-surface-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.ide-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 52px minmax(220px, var(--ide-sidebar-width)) 6px minmax(0, 1fr);
}

.pane-splitter {
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 5;
}

.pane-splitter::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 120ms var(--ease);
  background: rgba(96, 165, 250, 0.35);
}

.pane-splitter:hover::after,
.pane-splitter.is-dragging::after {
  opacity: 1;
}

.pane-splitter--vertical {
  cursor: col-resize;
}

.pane-splitter--horizontal {
  cursor: row-resize;
}

.activity-bar {
  background: rgba(14, 17, 23, 0.85);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
}

.activity-btn {
  margin-top: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: none;
}

.activity-btn:hover:not(:disabled) {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-surface-raised);
  filter: none;
}

.activity-btn.active {
  color: #fff;
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2) inset;
}

.ide-sidebar {
  min-height: 0;
  overflow: auto;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 14px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.sidebar-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.editor-stack {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.editor-tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 0 4px;
  gap: 2px;
}

.editor-tab {
  margin-top: 0;
  border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--color-muted);
  padding: 0 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: none;
}

.editor-tab:hover:not(:disabled) {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
  filter: none;
}

.editor-tab.active {
  background: var(--color-bg);
  color: #fff;
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: -1px;
}

.editor-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--color-border);
  padding: 16px;
}

.panel-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--color-surface);
  margin-bottom: 0;
}

.messages {
  min-height: 220px;
  max-height: 380px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar,
.thinking-output::-webkit-scrollbar,
.cmd-out::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.messages::-webkit-scrollbar-thumb,
.thinking-output::-webkit-scrollbar-thumb,
.cmd-out::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 4px;
}

.thinking-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  padding: 12px;
  margin-bottom: 14px;
}

.mode-switcher {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.22);
}

.mode-btn {
  margin-top: 0;
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-muted);
  box-shadow: none;
}

.mode-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  color: #dbeafe;
}

.mode-hint {
  margin: 0 0 10px 0;
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #b8c0cc;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.thinking-header::-webkit-details-marker {
  display: none;
}

.thinking-panel[open] .thinking-header {
  margin-bottom: 8px;
}

.thinking-header button {
  margin-top: 0;
  padding: 5px 10px;
  font-size: 0.75rem;
}

.thinking-output {
  margin: 0;
  max-height: 140px;
  overflow: auto;
  color: #aeb6c2;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg {
  margin: 10px 0;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: msg-in 200ms var(--ease) both;
  overflow: hidden;
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(220, 227, 236, 0.76);
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.msg-copy-btn {
  margin: 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: none;
}

.msg-copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.msg-body {
  padding: 10px 12px 12px;
  white-space: pre-wrap;
}

.msg-body p {
  margin: 0 0 8px;
}

.msg-body p:last-child {
  margin-bottom: 0;
}

.msg-body ul,
.msg-body ol {
  margin: 0 0 8px 18px;
  padding: 0;
}

.msg-body h3,
.msg-body h4,
.msg-body h5 {
  margin: 0 0 8px;
  color: #eaf2ff;
  font-size: 0.88rem;
}

.msg-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1px 5px;
}

.msg-body pre {
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px;
  overflow: auto;
}

.msg-body pre[class*="language-"] {
  margin: 8px 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px;
}

.plan-inline-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(10, 14, 22, 0.42);
}

.plan-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.plan-inline-row code {
  flex: 1;
  font-size: 0.78rem;
}

.plan-inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.user {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(37, 99, 235, 0.12) 100%);
  border-color: rgba(59, 130, 246, 0.28);
}

.msg.assistant {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(5, 150, 105, 0.08) 100%);
  border-color: rgba(16, 185, 129, 0.22);
}

.chat-form {
  margin-top: 10px;
}

.stacked input,
.stacked textarea {
  margin-bottom: 8px;
}

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

.row.wrap {
  flex-wrap: wrap;
}

.row input {
  flex: 1;
}

.row label {
  margin: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.queue-list {
  margin-top: 10px;
}

.queue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--color-surface-raised);
  transition: border-color 140ms var(--ease);
}

.queue-row:hover {
  border-color: var(--color-border-strong);
}

.queue-row code {
  flex: 1;
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.browser-grid {
  margin: 10px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.browser-item {
  margin-top: 0;
  text-align: left;
  width: 100%;
  font-size: 0.84rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}

.browser-item:hover {
  border-color: var(--color-border-strong);
}

.browser-dir {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}

.browser-file {
  background: var(--color-surface-raised);
}

.meter-wrap {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin: 10px 0 6px;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 300ms ease;
}

.meter-cpu {
  background: linear-gradient(90deg, #0ea5e9, #2563eb);
}

.meter-ram {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.meter-gpu {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
}

.meter-gpu-mem {
  background: linear-gradient(90deg, #a855f7, #7c3aed);
}

.metric-big {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  margin: 6px 0 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.plan-box {
  margin-top: 12px;
}

.cmd-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--color-surface-raised);
}

.cmd-block code {
  display: block;
  margin-bottom: 8px;
  white-space: pre-wrap;
  color: #d4d4d4;
}

.cmd-out {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  line-height: 1.45;
}

.bottom-panel {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  min-height: 0;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr);
}

.panel-tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
  padding: 0 4px;
  gap: 2px;
}

.panel-tab {
  margin-top: 0;
  border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0 14px;
  height: auto;
  min-height: 38px;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
  box-shadow: none;
}

.panel-tab:hover:not(:disabled) {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
  filter: none;
}

.panel-tab.active {
  color: #fff;
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: -1px;
}

.bottom-grid {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-strip {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.server-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
}

.server-shell.admin-shell > .server-main {
  min-height: 0;
}

.server-main {
  padding: 20px 24px 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  gap: 12px;
  align-content: start;
}

.page-intro {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.page-eyebrow {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.page-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.page-intro-hint {
  margin: 0;
  max-width: 52ch;
}

.server-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.server-stat-card,
.server-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(21, 25, 34, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.server-stat-card:hover,
.server-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

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

.server-stat-card .metric-big {
  margin: 4px 0 8px 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

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

.admin-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  padding: 14px;
  display: grid;
  gap: 10px;
}

/* —— Admin console: sidebar + main —— */
.server-main.admin-main {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--color-border);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(14, 17, 23, 0.98) 0%, rgba(10, 12, 18, 1) 100%);
  border-right: 1px solid var(--color-border);
}

.admin-nav-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--color-border);
}

.admin-nav-eyebrow {
  margin: 0 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.admin-nav-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.admin-nav-desc {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}

.admin-nav-list {
  display: flex;
  flex-direction: column;
  padding: 10px 10px 12px;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.admin-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  margin-top: 0;
  padding: 11px 12px;
  text-align: left;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}

.admin-nav-item:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-border);
  filter: none;
}

.admin-nav-item.is-active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15) inset;
}

.admin-nav-item.is-active .admin-nav-item-title {
  color: #fff;
}

.admin-nav-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-nav-item-hint {
  font-size: 0.72rem;
  color: var(--color-muted);
  line-height: 1.35;
}

.admin-nav-item.is-active .admin-nav-item-hint {
  color: #9ca8b8;
}

.admin-nav-footer {
  margin-top: auto;
  padding: 14px 14px 18px;
  border-top: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
}

.admin-nav-refresh {
  width: 100%;
  margin-top: 0;
}

.admin-nav-footer-hint {
  margin: 10px 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.admin-panel-host {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg);
  -webkit-overflow-scrolling: touch;
}
.admin-flash {
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  line-height: 1.45;
  color: var(--color-text);
  word-break: break-word;
  max-height: 6rem;
  overflow-y: auto;
}

.admin-flash[hidden] {
  display: none !important;
}

.admin-panel {
  padding: 24px 28px 40px;
  max-width: 920px;
}

.admin-panel[hidden] {
  display: none !important;
}

.admin-view-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.admin-view-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.admin-view-desc {
  margin: 0;
  max-width: 56ch;
  line-height: 1.55;
}

.admin-view-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-card .admin-card-head {
  margin-bottom: 16px;
}

.admin-card-title {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.admin-card .admin-card-desc {
  margin: 0;
  max-width: 70ch;
  line-height: 1.5;
}

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

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

.admin-form-grid--stack {
  grid-template-columns: 1fr;
}

.admin-field label {
  margin: 0 0 6px;
  font-size: 0.8rem;
}

.admin-field--btn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.admin-form-grid--3 .admin-field--btn {
  padding-top: 1.65rem;
}

.admin-field--btn button {
  margin-top: 0;
  width: fit-content;
}

.admin-field--compact label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.admin-card--tall {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.admin-list--scroll {
  flex: 1;
  min-height: 200px;
  max-height: min(62vh, 720px);
  overflow-y: auto;
  padding-right: 4px;
}

.admin-card--oauth .admin-oauth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.admin-oauth-panel {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
  min-width: 0;
}

.admin-oauth-legend {
  padding: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.admin-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.admin-checkbox input {
  width: auto;
  margin: 0;
}

.admin-oauth-panel .admin-field {
  margin-top: 12px;
}

.admin-oauth-panel .admin-field:first-of-type {
  margin-top: 0;
}

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

.admin-actions button {
  margin-top: 0;
}

.admin-oauth-meta {
  margin: 12px 0 0;
}

.admin-secret-wrap {
  position: relative;
  display: block;
}

.admin-secret-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 44px;
}

.admin-secret-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted, #9a9a9a);
  cursor: pointer;
}

.admin-secret-toggle:hover {
  color: var(--color-text, #e8e8e8);
  background: rgba(255, 255, 255, 0.06);
}

.admin-secret-toggle:focus-visible {
  outline: 2px solid var(--color-accent, #6b9fff);
  outline-offset: 2px;
}

.admin-secret-icon {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.admin-secret-icon--slash {
  display: none;
}

.admin-secret-toggle.is-revealed .admin-secret-icon--open {
  display: none;
}

.admin-secret-toggle.is-revealed .admin-secret-icon--slash {
  display: block;
}

.admin-status-log {
  margin-top: 0;
  max-height: min(50vh, 420px);
  min-height: 120px;
}

#panel-activity .admin-card--log {
  padding: 0;
  overflow: hidden;
}

#panel-activity .admin-status-log {
  margin: 0;
  max-height: min(55vh, 480px);
  min-height: 200px;
  border: none;
  border-radius: var(--radius-sm);
}

.admin-empty {
  margin: 0;
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
}

.admin-user-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.admin-role-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.admin-user-name,
.admin-role-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.admin-user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
}

.admin-badge--ok {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--color-success);
  background: rgba(52, 211, 153, 0.1);
}

.admin-badge--warn {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

.admin-badge--danger {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--color-danger);
  background: rgba(251, 113, 133, 0.1);
}

.admin-badge--muted {
  color: var(--color-muted);
  font-weight: 500;
}

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

.admin-subsection-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.admin-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-button-row button {
  margin-top: 0;
}

.admin-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.admin-field-row .admin-select-multi {
  flex: 1;
  min-width: 160px;
  min-height: 100px;
}

.admin-field-row button {
  margin-top: 0;
}

.admin-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
}

.admin-perm-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.8rem;
  color: #b8c0cc;
  cursor: pointer;
}

.admin-perm-label input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  margin-top: 2px;
}

.admin-perm-label span {
  word-break: break-word;
  line-height: 1.35;
}

.admin-subsection > button[data-save-perms],
.admin-subsection > button[data-save-limits],
.admin-subsection > button[data-save-role-perms] {
  width: fit-content;
  margin-top: 0;
}

.admin-limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.admin-role-desc {
  margin: 4px 0 0;
  width: 100%;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  .server-summary {
    grid-template-columns: 1fr;
  }
  .server-grid {
    grid-template-columns: 1fr;
  }
  .admin-form-grid--3 {
    grid-template-columns: 1fr;
  }
  .admin-form-grid--3 .admin-field--btn {
    padding-top: 0;
  }
  .admin-card--oauth .admin-oauth-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .admin-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .admin-nav {
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .admin-nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 10px 12px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-nav-item {
    flex: 0 0 auto;
    min-width: 148px;
  }

  .admin-nav-footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 14px 14px;
  }

  .admin-nav-refresh {
    width: auto;
    flex: 0 0 auto;
  }

  .admin-nav-footer-hint {
    margin: 0;
    flex: 1 1 160px;
    font-size: 0.72rem;
  }

  .admin-panel {
    padding: 18px 16px 32px;
  }
}

@media (max-width: 980px) {
  .login-shell {
    padding-top: 20px;
    padding-bottom: 140px;
  }
  .login-media-credit {
    text-align: left;
    flex: 1 1 100%;
    max-width: none;
  }
  .panel {
    margin: 24px auto;
  }
  .ide-shell {
    grid-template-rows: 48px minmax(0, 1fr) minmax(240px, 40vh);
  }
  .ide-body {
    grid-template-columns: 1fr;
    grid-template-rows: 48px minmax(200px, 32vh) minmax(0, 1fr);
  }
  .pane-splitter {
    display: none;
  }
  .activity-bar {
    flex-direction: row;
    justify-content: flex-start;
    padding: 6px 10px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .ide-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .ide-titlebar {
    flex-wrap: wrap;
    min-height: 44px;
    padding: 8px 12px;
  }
  .ide-title-center {
    order: 3;
    width: 100%;
    justify-content: center;
    margin: 4px 0 0;
  }
}

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