:root {
  --font-main: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-head: "Space Grotesk", "Trebuchet MS", sans-serif;
  --server-card-height: 102px;
  --fm-row-height: 40px;
  --bg: #0a0f1c;
  --bg-soft: #111a2d;
  --panel: #121b2f;
  --text: #e9eef8;
  --muted: #94a3bd;
  --accent: #2f80ff;
  --accent-2: #57a0ff;
  --ok: #25c06d;
  --border: #24324f;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  --bg: #eef3fb;
  --bg-soft: #dde7f7;
  --panel: #ffffff;
  --text: #182235;
  --muted: #55637d;
  --accent: #0f62fe;
  --accent-2: #2f80ff;
  --ok: #118341;
  --border: #d7e0f0;
  --shadow: 0 8px 18px rgba(40, 67, 116, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.site-header {
  margin: 20px auto 0;
  width: min(1150px, calc(100% - 30px));
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.brand {
  font-family: var(--font-head);
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

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

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.landing,
.panel {
  width: min(1150px, calc(100% - 30px));
  margin: 26px auto 40px;
  position: relative;
  z-index: 2;
}

.hero {
  border-radius: 24px;
  padding: clamp(24px, 4vw, 44px);
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.9rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin-top: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 14px;
}

h2 {
  font-size: 1.3rem;
}

p {
  color: var(--muted);
}

.hero-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cards {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  padding: 18px;
  border-radius: 18px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
  font-weight: 600;
}

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

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), #226ad6);
  color: #fff;
}

.btn.secondary {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.inline {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

.panel-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

.panel-block {
  border-radius: 10px;
  padding: 16px;
}

.panel-block.wide {
  grid-column: 1 / -1;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.muted {
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px 8px;
  color: var(--text);
}

.table tbody tr {
  cursor: pointer;
}

.table tbody tr:hover td {
  background: rgba(47, 128, 255, 0.08);
}

.table-compact th,
.table-compact td {
  padding: 8px 6px;
  font-size: 0.92rem;
}

.job-error {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}

.hidden {
  display: none !important;
}

.code-block {
  min-height: 70px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: #ffe5b6;
  overflow-x: auto;
}

.kb-list {
  margin: 0;
  padding-left: 16px;
}

.kb-list li {
  margin-bottom: 12px;
}

.kb-list strong {
  color: var(--text);
}

.integration-box {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.integration-box h3 {
  margin: 0 0 8px;
  font-family: var(--font-head);
}

.jobs-filters {
  margin-top: 10px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) auto minmax(130px, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.jobs-load-more {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.auto-form {
  display: grid;
  gap: 8px;
}

.remote-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 6px;
}

.remote-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.remote-file-form-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.remote-tree-list {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
  max-height: 320px;
  overflow: auto;
}

.remote-tree-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.remote-tree-entry:last-child {
  border-bottom: none;
}

.remote-tree-kind {
  font-family: var(--font-head);
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--muted);
}

.remote-tree-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
}

.remote-tree-pick {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.remote-tree-pick:hover {
  opacity: 0.92;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.badge.success {
  background: rgba(48, 209, 88, 0.15);
}

.badge.failed {
  background: rgba(255, 104, 71, 0.2);
}

.badge.pending {
  background: rgba(255, 209, 102, 0.2);
}

.field-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
}

.paywall {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}

.paywall.hidden {
  display: none;
}

.paywall-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 14, 0.72);
  backdrop-filter: blur(4px);
}

.paywall-card {
  position: relative;
  z-index: 2;
  width: min(980px, calc(100% - 30px));
  border-radius: 18px;
  padding: 18px;
}

.billing-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.plan {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.plan h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-family: var(--font-head);
}

.plan-price {
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 8px;
}

.plan ul {
  margin: 0 0 12px;
  padding-left: 16px;
}

.plan li {
  color: var(--muted);
}

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

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .jobs-filters {
    grid-template-columns: 1fr;
  }

  .remote-toolbar {
    grid-template-columns: 1fr;
  }

  .remote-grid {
    grid-template-columns: 1fr;
  }

  .remote-file-form-row {
    grid-template-columns: 1fr;
  }
}

.dash-shell {
  width: min(1240px, calc(100% - 30px));
  margin: 26px auto 40px;
  position: relative;
  z-index: 2;
}

.product-screen {
  border-radius: 18px;
  padding: 20px;
}

.product-head {
  margin-bottom: 14px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  text-align: left;
  padding: 14px;
  cursor: pointer;
}

.product-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.product-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
}

.workspace-sidebar {
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.workspace-game {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.workspace-game-code {
  font-family: var(--font-head);
  font-size: 1.4rem;
  margin-top: 3px;
}

.workspace-nav-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
}

.workspace-nav-btn.active {
  border-color: var(--accent);
  background: rgba(47, 128, 255, 0.16);
}

.workspace-back {
  margin-top: 8px;
}

.workspace-content {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.workspace-grid {
  display: block;
}

.control-tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.control-empty {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.server-cards {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: calc((var(--server-card-height) * 5) + (10px * 4));
  overflow-y: auto;
  padding-right: 4px;
}

.server-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  display: grid;
  gap: 3px;
  min-height: var(--server-card-height);
}

.server-card.selected {
  border-color: var(--accent);
  background: rgba(47, 128, 255, 0.16);
}

.server-card-address {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.96rem;
}

.server-card-meta {
  font-size: 0.86rem;
}

.console-stream {
  margin-top: 10px;
  min-height: calc((1em * 1.45 * 15) + 20px);
  max-height: calc((1em * 1.45 * 15) + 20px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #0b1221;
  color: #d6ffd0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.console-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.fm-toolbar {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

#control-workspace > .panel-block {
  margin-bottom: 12px;
}

.fm-nav-tools,
.fm-item-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fm-selected-line {
  margin: 8px 0 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.fm-name-cell {
  white-space: nowrap;
}

.fm-kind-badge {
  display: inline-flex;
  margin-right: 8px;
  min-width: 38px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.fm-row-selected td {
  background: rgba(47, 128, 255, 0.14);
}

.fm-table-wrap {
  margin-top: 8px;
  max-height: calc((var(--fm-row-height) * 15) + 44px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.fm-table-wrap .table {
  margin-top: 0;
  table-layout: fixed;
}

.fm-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.fm-table-wrap tbody td {
  height: var(--fm-row-height);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fm-table-wrap tbody tr:nth-child(2n) td {
  background: rgba(255, 255, 255, 0.02);
}

.fm-actions-cell {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
}

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