:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5eb;
  --text: #1a1d24;
  --text-muted: #5c6370;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow);
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0.25rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list button {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.nav-list button:hover {
  background: var(--bg);
}

.nav-list button.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
  font-weight: 600;
}

main {
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem);
  max-width: 960px;
}

.tool {
  display: none;
}

.tool.active {
  display: block;
}

.tool h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.tool-desc {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  max-width: 56ch;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

textarea.input-json {
  width: 100%;
  min-height: 180px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
}

textarea.input-json:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 0;
  border-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

button.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

button.btn:hover {
  background: var(--bg);
}

button.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.output-wrap {
  position: relative;
}

textarea.output-models {
  width: 100%;
  min-height: 220px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  background: #fafbfc;
  color: var(--text);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}
