:root {
  color-scheme: dark;
  --bg: #020806;
  --panel: #071511;
  --panel-2: #0d211b;
  --line: rgba(132, 255, 198, 0.22);
  --text: #f2fff9;
  --muted: #92ad9f;
  --cyan: #5cffc9;
  --mint: #c8ff5c;
  --violet: #65a7ff;
  --danger: #ff7a8b;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(92, 255, 201, 0.18), transparent 30%),
    radial-gradient(circle at 82% 24%, rgba(200, 255, 92, 0.12), transparent 28%),
    linear-gradient(rgba(132, 255, 198, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 255, 198, 0.035) 1px, transparent 1px),
    linear-gradient(160deg, #020806 0%, #071511 54%, #020806 100%);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 32, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 2px solid rgba(92, 255, 201, 0.9);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(200, 255, 92, 0.22), transparent 42%),
    linear-gradient(135deg, rgba(92, 255, 201, 0.18), rgba(101, 167, 255, 0.12)),
    #0c1118;
  box-shadow: 0 0 34px rgba(92, 255, 201, 0.18), inset 0 0 0 8px rgba(92, 255, 201, 0.08);
}

.runtime-pill,
.console-head span,
.section-kicker {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.runtime-pill {
  padding: 10px 14px;
  border: 1px solid rgba(92, 255, 201, 0.32);
  border-radius: 999px;
  background: rgba(92, 255, 201, 0.08);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px;
  align-items: stretch;
  padding: 42px 0 26px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 16px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.96;
}

.lede {
  max-width: 900px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.58;
}

.price-card,
.source-console,
.result-board,
.advanced-drawer,
.saved-runs {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 32, 0.88);
  box-shadow: var(--shadow);
}

.price-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.price-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.price-card strong {
  margin: 8px 0 12px;
  color: var(--cyan);
  font-size: 42px;
  line-height: 1;
}

.price-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: start;
}

.source-console,
.result-board {
  min-height: 650px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(92, 255, 201, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(7, 21, 17, 0.9);
}

.console-head,
.section-title,
.result-head,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.console-head h2,
.section-title h2 {
  margin: 6px 0 0;
  font-size: 30px;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

textarea,
input {
  width: 100%;
  border: 1px solid rgba(151, 170, 188, 0.26);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 230px;
  padding: 18px;
  resize: vertical;
  line-height: 1.52;
}

input {
  min-height: 54px;
  padding: 0 16px;
}

textarea:focus,
input:focus {
  border-color: rgba(121, 233, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(92, 255, 201, 0.12);
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 14px;
}

.source-options {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.source-options summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.source-options .input-grid {
  padding: 0 14px 14px;
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  font-weight: 950;
}

.primary-action {
  width: 100%;
  margin-top: 22px;
  color: #071016;
  background: linear-gradient(135deg, #f4fff9, var(--cyan));
  box-shadow: 0 22px 44px rgba(92, 255, 201, 0.18);
}

.secondary-action,
.danger-action {
  min-width: 160px;
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.danger-action {
  color: #ffdce2;
  border-color: rgba(255, 122, 139, 0.42);
}

.empty-state {
  display: grid;
  align-content: center;
  min-height: 590px;
  padding: 24px;
  border: 1px dashed rgba(121, 233, 255, 0.28);
  border-radius: 18px;
  background: rgba(121, 233, 255, 0.05);
}

.empty-state span {
  color: var(--mint);
  font-weight: 900;
  text-transform: uppercase;
}

.empty-state h2 {
  max-width: 580px;
  margin: 10px 0;
  font-size: 34px;
}

.empty-state p {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-grid {
  display: grid;
  gap: 14px;
}

.result-hero {
  padding: 22px;
  border: 1px solid rgba(121, 233, 255, 0.3);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(121, 233, 255, 0.14), rgba(183, 140, 255, 0.12));
}

.result-hero h2 {
  margin: 8px 0 10px;
  font-size: 38px;
}

.result-hero p {
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.5;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric,
.result-card,
.task-table,
.brief-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
}

.metric span,
.result-card span,
.task-table span,
.brief-box span {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.metric strong {
  font-size: 18px;
}

.result-card p,
.brief-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.52;
}

.memory-graph {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.memory-node {
  min-height: 96px;
  padding: 14px;
  border: 1px solid rgba(104, 240, 191, 0.26);
  border-radius: 14px;
  background: rgba(104, 240, 191, 0.08);
}

.memory-node strong {
  display: block;
  margin-bottom: 8px;
}

.memory-node small {
  color: var(--muted);
  line-height: 1.35;
}

.workflow-list,
.saved-list {
  display: grid;
  gap: 10px;
}

.workflow-step,
.saved-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.workflow-step b {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #071016;
  background: var(--cyan);
}

.workflow-step p,
.saved-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(151, 170, 188, 0.16);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

.brief-box pre {
  overflow: auto;
  max-height: 260px;
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  color: #d8e8f3;
  white-space: pre-wrap;
}

.action-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.advanced-drawer,
.saved-runs {
  margin-top: 24px;
  padding: 22px;
}

.advanced-drawer summary {
  cursor: pointer;
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
}

.engine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.engine-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.engine-grid article span {
  color: var(--mint);
  font-weight: 900;
}

.engine-grid h3 {
  margin: 8px 0;
}

.engine-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.saved-runs {
  margin-bottom: 44px;
}

.local-llm-card {
  display: grid;
  gap: 14px;
  margin: 24px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 32, 0.88);
  box-shadow: var(--shadow);
}

.local-llm-card .section-title strong {
  color: var(--mint);
  font-size: 13px;
  text-transform: uppercase;
}

.llm-note,
.hf-model-card p,
.hf-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.token-drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.token-drawer summary {
  min-height: 42px;
  padding: 11px 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.token-drawer input,
.llm-search-row input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
}

.token-drawer input {
  margin: 0 14px 14px;
  width: calc(100% - 28px);
}

.llm-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.llm-search-row button,
.hf-file-row button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #02100b;
  background: linear-gradient(135deg, var(--cyan), var(--mint));
  font-weight: 950;
}

.llm-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid rgba(92, 255, 201, 0.22);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(92, 255, 201, 0.06);
}

.hf-results {
  display: grid;
  gap: 12px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 8px;
}

.hf-model-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.hf-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.hf-title span {
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 950;
}

.hf-title strong,
.hf-badges span {
  border: 1px solid rgba(92, 255, 201, 0.28);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--cyan);
  background: rgba(92, 255, 201, 0.08);
  font-size: 12px;
}

.hf-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hf-file-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(92, 255, 201, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.hf-file-list > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.hf-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.hf-file-row span {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 850;
}

.hf-file-row button {
  min-height: 34px;
  font-size: 12px;
}

.download-progress {
  display: grid;
  gap: 8px;
}

.download-progress div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.download-progress i {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

.download-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
}

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

.saved-card button {
  align-self: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 122, 139, 0.45);
  border-radius: 12px;
  color: #ffdce2;
  background: rgba(255, 122, 139, 0.08);
}

@media (max-width: 980px) {
  .hero-panel,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .source-console,
  .result-board {
    min-height: auto;
  }

  .metric-strip,
  .memory-graph,
  .engine-grid,
  .llm-search-row,
  .hf-file-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
    padding-top: 14px;
  }

  h1 {
    font-size: 42px;
  }

  .topbar,
  .console-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .secondary-action,
  .danger-action {
    width: 100%;
  }
}
