:root {
  --bg0: #0f1412;
  --bg1: #17201c;
  --panel: #1c2823;
  --line: #2f4138;
  --text: #e8f0eb;
  --muted: #9bb0a4;
  --accent: #3dba7e;
  --accent2: #c9a227;
  --danger: #e07070;
  --radius: 14px;
  --font: "Be Vietnam Pro", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, #1f3d30 0%, transparent 55%),
    radial-gradient(700px 400px at 100% 0%, #3a3220 0%, transparent 50%),
    linear-gradient(180deg, #101612, #0c100e 60%);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 18, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: 0.02em; }
.brand small { color: var(--muted); }
.mark {
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  border-radius: 0.7rem;
  background: linear-gradient(145deg, var(--accent), #1f7a4f);
  font-weight: 700;
}

.top-right { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.api-url { display: flex; gap: 0.4rem; align-items: center; color: var(--muted); font-size: 0.85rem; }
.api-url input {
  width: min(280px, 42vw);
  font-family: var(--mono);
  font-size: 0.78rem;
}

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.login { max-width: 420px; margin: 3rem auto; }
.login h1 { margin: 0 0 0.35rem; font-size: 1.6rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.wide { grid-column: 1 / -1; }

h2 { margin: 0 0 0.85rem; font-size: 1.05rem; font-weight: 600; }

.stack { display: grid; gap: 0.75rem; }
.row { display: flex; gap: 0.6rem; align-items: end; flex-wrap: wrap; margin-top: 0.75rem; }
.grow { flex: 1; min-width: 140px; }

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
}
input, select, textarea, button, a.btn {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
textarea { font-family: var(--mono); font-size: 0.82rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line);
  background: #24332c;
  color: var(--text);
  border-radius: 10px;
  padding: 0.62rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { filter: brightness(1.08); }
.btn.primary {
  background: linear-gradient(180deg, #45c789, #2f9a64);
  border-color: #2f9a64;
  color: #062015;
  font-weight: 600;
}
.btn.ghost { background: transparent; }

.chip {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #223028;
}

.list { margin-top: 0.85rem; display: grid; gap: 0.45rem; }
.item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #16201b;
  cursor: pointer;
}
.item:hover { border-color: var(--accent); }
.item strong { font-size: 0.92rem; }
.item span { color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }

.out, .error {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #101714;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
}
.error { color: #ffd0d0; border-color: #5a3030; background: #2a1616; }

footer {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .top { align-items: flex-start; flex-direction: column; }
}
