:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e4e6eb;
  --muted: #8a909c;
  --accent: #7c9cff;
  --warn: #f0a040;
  --error: #e35d5d;
  --ok: #6cd6a0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, sans-serif;
  line-height: 1.5;
}

header {
  padding: 24px 32px 12px;
  border-bottom: 1px solid var(--border);
}
header h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.tagline { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.pill-idle { background: #2a2f3a; color: var(--muted); }
.pill-loading { background: #3a2a1a; color: var(--warn); }
.pill-ready { background: #1a3a2a; color: var(--ok); }
.pill-busy { background: #1a2a3a; color: var(--accent); }
.pill-error { background: #3a1a1a; color: var(--error); }

main {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 2fr;
  gap: 24px;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.input-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
}

label { font-size: 12px; color: var(--muted); margin-top: 4px; }

textarea, input[type=text], select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  font-size: 14px;
}
textarea { min-height: 200px; resize: vertical; font-family: ui-monospace, monospace; }

.charbar {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}
.warn { color: var(--warn); }
.warn.hard { color: var(--error); font-weight: 600; }

button {
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.tiny { padding: 3px 8px; font-size: 11px; font-weight: 500; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }

.output-section { display: flex; flex-direction: column; gap: 12px; }

/* model loader */
.loader {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.loader-row {
  display: flex; align-items: center; gap: 12px;
}
#load-btn { flex: none; }
.status-text { font-size: 12px; color: var(--muted); flex: 1; }
.live-stat { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; flex: none; }

.bar {
  height: 6px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
}
.bar.done .bar-fill { background: var(--ok); }

.output-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 460px;
}
.box-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.box-header h2 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.actions { display: flex; gap: 6px; }

.result {
  margin: 0; padding: 14px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  overflow: auto;
  color: var(--text);
}

.notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warn);
}
.notice.fallback { border-left-color: var(--error); color: var(--error); }
.notice.ok { border-left-color: var(--ok); color: var(--ok); }
