:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-raised: #fbfcfd;
  --surface-muted: #edf2f4;
  --ink: #17212b;
  --ink-soft: #5c6874;
  --border: #d8e0e6;
  --border-strong: #c5d0d8;
  --teal: #0b766f;
  --teal-dark: #075f5a;
  --teal-soft: #dff2f0;
  --clay: #a6503c;
  --clay-soft: #f6e8e4;
  --ochre: #906314;
  --ochre-soft: #f5ebd2;
  --violet: #5d55a7;
  --blue: #2e638c;
  --shadow: 0 18px 42px rgba(23, 33, 43, 0.12);
  --shadow-soft: 0 8px 22px rgba(23, 33, 43, 0.08);
  --shadow-line: 0 1px 0 rgba(23, 33, 43, 0.04);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0) 240px),
    linear-gradient(90deg, rgba(11, 118, 111, 0.06), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 132px;
  padding: 22px 28px;
  border-bottom: 1px solid rgba(197, 208, 216, 0.88);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 248, 0.94)),
    var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(23, 33, 43, 0.08);
}

.header-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 16px;
}

.header-icon {
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.header-brand h1 {
  font-size: 2.15rem;
  line-height: 1.03;
}

.header-brand p {
  max-width: 620px;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.header-brand .credibility-line {
  max-width: 760px;
  color: #344453;
  font-size: 0.92rem;
  font-weight: 700;
}

.header-brand .guidance-line {
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.header-summary {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.summary-item {
  display: grid;
  min-width: 112px;
  min-height: 58px;
  align-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-line);
}

.summary-item strong {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.1;
}

.summary-item span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.sidebar {
  position: sticky;
  top: 132px;
  height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  overflow: auto;
  border-right: 1px solid var(--border);
  background: rgba(247, 249, 251, 0.94);
  backdrop-filter: blur(14px);
}

.brand-panel {
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(46, 99, 140, 0.18);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft), var(--shadow-line);
}

.brand-image {
  display: block;
  width: 100%;
  height: 104px;
  object-fit: contain;
  background: #243fb2;
}

.brand-title {
  padding: 18px;
}

.brand-title p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-header .eyebrow {
  font-size: 0.9rem;
}

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

h1 {
  font-size: 1.62rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.18;
}

h3 {
  font-size: 1rem;
  line-height: 1.2;
}

.access-panel {
  flex-shrink: 0;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(11, 118, 111, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 249, 247, 0.96)),
    var(--surface);
  box-shadow: var(--shadow-soft), var(--shadow-line);
}

.access-panel strong {
  display: block;
  font-size: 1.05rem;
}

.access-panel p,
.fine-print {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.access-meter {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.access-meter span {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}

.access-meter span:first-child,
.access-meter span:nth-child(2) {
  background: var(--teal);
}

.unlocked .access-meter span {
  background: var(--teal);
}

.search-panel,
.filter-group {
  display: grid;
  gap: 8px;
}

label {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow-line);
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.category-nav {
  display: grid;
  gap: 8px;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
}

.category-button:hover,
.category-button.active {
  border-color: rgba(11, 118, 111, 0.48);
  background: #e7f5f3;
  box-shadow: var(--shadow-line);
}

.category-button span {
  overflow-wrap: anywhere;
}

.category-button strong {
  min-width: 30px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
  text-align: center;
}

.small-note {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.results-pane {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.78);
}

.pane-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(10px);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.result-count {
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.price-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(144, 99, 20, 0.24);
  border-radius: 999px;
  background: var(--ochre-soft);
  color: #6c4b07;
  font-size: 0.82rem;
  font-weight: 800;
}

.prompt-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.prompt-card {
  position: relative;
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 15px 15px 15px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-line);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.prompt-card::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--teal);
  content: "";
}

.prompt-card:hover,
.prompt-card.active {
  border-color: rgba(11, 118, 111, 0.52);
  box-shadow: 0 12px 24px rgba(23, 33, 43, 0.1);
  transform: translateY(-1px);
}

.prompt-card h3 {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.prompt-card p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.92rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip,
.tag,
.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 740;
}

.meta-chip.category-start,
.category-pill.category-start {
  background: #e4f1ef;
  color: var(--teal-dark);
}

.meta-chip.category-difficult,
.category-pill.category-difficult {
  background: #f5e9e5;
  color: var(--clay);
}

.meta-chip.category-feedback,
.category-pill.category-feedback {
  background: #e8f0e5;
  color: #3f6c31;
}

.meta-chip.category-trust,
.category-pill.category-trust {
  background: #ece9f6;
  color: var(--violet);
}

.meta-chip.category-managing,
.category-pill.category-managing {
  background: #e6eef5;
  color: var(--blue);
}

.prompt-card.category-start::before {
  background: var(--teal);
}

.prompt-card.category-difficult::before {
  background: var(--clay);
}

.prompt-card.category-feedback::before {
  background: #4f7c3e;
}

.prompt-card.category-trust::before {
  background: var(--violet);
}

.prompt-card.category-managing::before {
  background: var(--blue);
}

.meta-chip.access-unlocked {
  background: #e7f0df;
  color: #42672f;
}

.detail-pane {
  min-width: 0;
  padding: 28px;
  overflow: auto;
}

.empty-state {
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state img {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.prompt-detail {
  display: grid;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.detail-topline,
.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.detail-header {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-header h2 {
  max-width: 840px;
  font-size: 2.08rem;
  line-height: 1.08;
}

.detail-header p {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 760px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ochre);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-button.active {
  border-color: rgba(149, 107, 19, 0.45);
  background: #f8efd8;
}

.builder-section,
.prompt-output {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft), var(--shadow-line);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-control {
  display: grid;
  gap: 8px;
}

.field-control.full {
  grid-column: 1 / -1;
}

.field-control textarea {
  min-height: 108px;
  padding: 12px 13px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.align-end {
  justify-content: flex-end;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 7px;
  font-weight: 780;
}

.full-button {
  width: 100%;
}

.primary-button {
  border: 1px solid var(--teal);
  background: linear-gradient(180deg, #11887f, var(--teal-dark));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(11, 118, 111, 0.2);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

button:disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.72;
}

.secondary-button:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #edf5f3;
}

#filledPrompt {
  min-height: 380px;
  padding: 16px;
  resize: vertical;
  white-space: pre-wrap;
  line-height: 1.58;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  transform: translateY(18px);
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  background: #133d39;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  }

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

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-summary {
    width: 100%;
  }

  .summary-item {
    min-width: 0;
    flex: 1 1 140px;
  }

  .header-summary .primary-button {
    flex: 1 1 180px;
  }
}

@media (max-width: 860px) {
  .app-shell,
  .workspace {
    display: block;
    min-height: 0;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar .access-panel {
    display: none;
  }

  .category-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .prompt-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-pane {
    padding: 18px;
  }

  .detail-header h2 {
    font-size: 1.55rem;
  }

}

@media (max-width: 620px) {
  .app-header {
    gap: 18px;
    min-height: auto;
    padding: 18px;
  }

  .header-brand {
    align-items: flex-start;
  }

  .header-icon {
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }

  .header-brand h1 {
    font-size: 1.65rem;
  }

  .app-header .eyebrow {
    font-size: 0.82rem;
  }

  .header-brand p {
    font-size: 0.94rem;
  }

  .header-brand .credibility-line {
    font-size: 0.86rem;
  }

  .header-brand .guidance-line {
    font-size: 0.74rem;
  }

  .header-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-summary .primary-button {
    grid-column: 1 / -1;
  }

  .category-nav,
  .prompt-list {
    grid-template-columns: 1fr;
  }

  .pane-header,
  .output-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .button-row,
  .align-end {
    width: 100%;
    justify-content: stretch;
  }

  .primary-button,
  .secondary-button {
    flex: 1 1 150px;
  }
}
