:root {
  --background: #050505;
  --surface: #0c0d0f;
  --surface-2: #111316;
  --surface-3: #171a1f;
  --text: #f1f5f2;
  --muted: #8b938e;
  --dim: #59615d;
  --border: rgba(142, 155, 148, 0.22);
  --green: #00ff88;
  --cyan: #00d4ff;
  --amber: #ffb800;
  --purple: #b066ff;
  --red: #ff5c45;
  --radius: 8px;
  --shadow-green: 0 0 20px rgba(0, 255, 136, 0.15), 0 0 40px rgba(0, 255, 136, 0.04);
  --shadow-cyan: 0 0 20px rgba(0, 212, 255, 0.14), 0 0 40px rgba(0, 212, 255, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--background);
  font-family: "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.grid-bg {
  background-image:
    linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.scanline::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 136, 0.012) 2px,
    rgba(0, 255, 136, 0.012) 4px
  );
  z-index: 20;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: rgba(8, 9, 10, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: var(--radius);
  background: rgba(0, 255, 136, 0.08);
  color: var(--green);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-green);
}

.brand-name {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 15px;
}

.brand-name span {
  color: var(--green);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.45);
}

.brand-sub,
.mini-label,
.metric-label {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--green);
  border-color: rgba(0, 255, 136, 0.22);
  background: rgba(0, 255, 136, 0.06);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.policy-line,
.policy-threshold {
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
}

.policy-threshold {
  color: var(--amber);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(142, 155, 148, 0.16);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.7);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.topbar p,
.panel-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

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

.icon-button,
.primary-button,
.action-button {
  min-height: 40px;
  border: 1px solid rgba(0, 255, 136, 0.32);
  border-radius: var(--radius);
  background: rgba(0, 255, 136, 0.1);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.icon-button {
  width: 40px;
}

.primary-button,
.action-button {
  padding: 0 14px;
  font-weight: 700;
}

.primary-button:hover,
.icon-button:hover,
.action-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-green);
  border-color: rgba(0, 255, 136, 0.68);
}

.action-button.secondary {
  color: var(--amber);
  border-color: rgba(255, 184, 0, 0.3);
  background: rgba(255, 184, 0, 0.08);
}

.action-button.cyan {
  color: var(--cyan);
  border-color: rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(14, 16, 18, 0.82);
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 28px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
}

.green { color: var(--green); background: rgba(0, 255, 136, 0.08); }
.cyan { color: var(--cyan); background: rgba(0, 212, 255, 0.08); }
.amber { color: var(--amber); background: rgba(255, 184, 0, 0.08); }
.purple { color: var(--purple); background: rgba(176, 102, 255, 0.08); }
.red { color: var(--red); background: rgba(255, 92, 69, 0.08); }
.glow-green { box-shadow: var(--shadow-green); }
.glow-cyan { box-shadow: var(--shadow-cyan); }
.glow-amber { box-shadow: 0 0 20px rgba(255, 184, 0, 0.12); }
.glow-purple { box-shadow: 0 0 20px rgba(176, 102, 255, 0.12); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.6fr);
  gap: 16px;
}

.workspace.lower {
  margin-top: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(12, 13, 15, 0.86);
  overflow: hidden;
}

.panel-head {
  min-height: 78px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(142, 155, 148, 0.14);
}

.panel-head h2 {
  font-size: 18px;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 136, 0.24);
  background: rgba(0, 255, 136, 0.08);
  color: var(--green);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  white-space: nowrap;
}

.status-pill.unavailable,
.status-pill.failed {
  color: var(--red);
  background: rgba(255, 92, 69, 0.08);
  border-color: rgba(255, 92, 69, 0.24);
}

.status-pill.running {
  color: var(--amber);
  background: rgba(255, 184, 0, 0.08);
  border-color: rgba(255, 184, 0, 0.24);
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap.compact {
  max-height: 420px;
  overflow-y: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(142, 155, 148, 0.12);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

td {
  color: var(--text);
  font-size: 14px;
}

tr[data-account-fill] {
  cursor: pointer;
}

tr[data-account-fill]:hover {
  background: rgba(0, 255, 136, 0.045);
}

.mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.score-bar {
  width: 116px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.ops-stack,
.provider-list {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(142, 155, 148, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.billing-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px;
}

.billing-form .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(142, 155, 148, 0.22);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 255, 136, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.08);
}

.provider-card {
  border: 1px solid rgba(142, 155, 148, 0.14);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.provider-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-name {
  font-weight: 700;
}

.provider-url {
  margin-top: 5px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.provider-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.terminal-panel {
  min-height: 360px;
}

.terminal {
  min-height: 284px;
  max-height: 440px;
  overflow: auto;
  padding: 16px 18px;
  margin: 0;
  color: var(--green);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.billing-policy {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--amber);
}

.empty {
  padding: 20px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(142, 155, 148, 0.35);
  border-radius: 3px;
}

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

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    overflow-x: auto;
  }

  .nav {
    display: flex;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace,
  .workspace.lower,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .primary-button {
    flex: 1;
  }

  .metric-grid,
  .workspace,
  .workspace.lower {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    min-width: 190px;
    padding-bottom: 8px;
  }
}
