:root {
  color-scheme: light;
  --bg: #f6f7f9; --panel: #ffffff; --panel-alt: #f0f2f5;
  --text: #16171a; --muted: #5b6270;
  --border: #d6dbe3; --border-strong: #aeb6c2;
  --accent: #174ea6; --accent-soft: #e7eefc; --accent-text: #ffffff;
  --warning: #704700; --warning-bg: #fff4d7;
  --success-bg: #e8f5ee; --success-text: #145332;
  --radius: 8px;
  --focus: 0 0 0 3px rgba(23, 78, 166, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111316; --panel: #1a1d22; --panel-alt: #232830;
  --text: #f2f4f7; --muted: #b5bdca;
  --border: #363c46; --border-strong: #596270;
  --accent: #9bb8ff; --accent-soft: #25314f; --accent-text: #101216;
  --warning: #ffd27a; --warning-bg: #3a2a0d;
  --success-bg: #153422; --success-text: #a9e8c1;
}

* { box-sizing: border-box; }

body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }

button,
input,
textarea,
select {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
}

button {
  min-height: 2.25rem;
  padding: 0.42rem 0.7rem;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover { border-color: var(--border-strong); background: var(--panel-alt); }

input,
textarea,
select {
  width: 100%;
  background: var(--panel);
  color: var(--text);
}

input,
select {
  min-height: 2.4rem;
  padding: 0.45rem 0.6rem;
}

textarea { min-height: 5.75rem; padding: 0.55rem 0.65rem; resize: vertical; }

::placeholder { color: var(--muted); opacity: 0.78; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.app-header h1,
.detail-pane h2,
.followup h3,
.versions summary,
.repeatableGroup h4 { margin: 0; line-height: 1.2; }

.app-header h1 { font-size: 1.25rem; }

.app-header p,
.summary,
.help-text,
.metadata,
.tags,
.use-case,
.cautions,
.result-count,
.empty-state {
  color: var(--muted);
}

.app-header p,
.result-count {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

.theme-toggle {
  flex: 0 0 auto; width: 2.25rem;
  min-width: 2.25rem;
  padding: 0; display: inline-grid; place-items: center;
}

.theme-icon { width: 1.15rem; height: 1.15rem; }

.search-label,
.field-control label,
.repeatable-item label,
.control-label,
.modifier-label {
  display: block;
  margin: 0.8rem 0 0.3rem;
  font-weight: 700;
}

.filter-group { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.85rem 0; }

.filter-group button,
.theme-toggle,
.field-control button,
.repeatableGroup > button,
.repeatable-item button {
  font-size: 0.9rem;
}

.filter-group button[aria-pressed="true"],
.prompt-row[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }

.prompt-list {
  display: grid;
  gap: 0.45rem;
  min-height: 0;
  overflow-y: auto;
}

.prompt-row {
  display: grid;
  width: 100%;
  min-height: 0;
  padding: 0.65rem;
  text-align: left;
  gap: 0.18rem;
}

.prompt-row strong { font-size: 0.98rem; }

.prompt-row span { color: var(--muted); font-size: 0.84rem; }

.prompt-row span:first-of-type {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-pane {
  width: 100%;
  padding: 1.25rem clamp(1rem, 3vw, 2.25rem);
  overflow-x: hidden;
}

.detail-pane h2 { font-size: 1.6rem; margin-bottom: 0.45rem; }
.summary { margin: 0 0 0.75rem; font-size: 1rem; }

a { color: var(--accent); }

@media (max-width: 760px) {
  .app-shell { display: block; }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }

  .prompt-list { overflow-y: visible; }
  .app-header { align-items: center; }
  .detail-pane { padding: 1rem; }
}
