:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #64717d;
  --line: #dce2e6;
  --accent: #245b55;
  --accent-strong: #163f3b;
  --warning: #9a5a22;
  --soft: #edf4f2;
  --shadow: 0 18px 55px rgba(23, 32, 38, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.briefing-panel,
.results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.briefing-panel {
  align-self: start;
  border-radius: 8px;
  padding: 22px;
  position: sticky;
  top: 18px;
}

.results-panel {
  border-radius: 8px;
  min-height: calc(100vh - 36px);
  padding: 26px;
}

.brand-row,
.result-header,
.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.wordmark {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.wordmark img {
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(22, 63, 59, 0.12);
}

.wordmark .eyebrow {
  margin: 0;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: clamp(1.9rem, 3vw, 2.55rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.65rem);
}

h3 {
  font-size: 1.1rem;
}

p {
  line-height: 1.55;
}

.status-pill {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-strong);
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 8px 10px;
}

.briefing-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

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

.field > span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 750;
}

input[type="text"],
input[type="month"],
input[type="date"],
input:not([type]),
select {
  appearance: none;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 48px;
  outline: none;
  padding: 0 14px;
  width: 100%;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 12px) 21px;
  background-repeat: no-repeat;
  background-size: 6px 6px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 110, 99, 0.15);
}

.segmented {
  background: #f1f4f5;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
}

.segmented label {
  cursor: pointer;
}

.segmented input,
.interest-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.timing-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sub-field {
  display: grid;
  gap: 7px;
}

.sub-field > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.date-range,
.month-range {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented span {
  border-radius: 5px;
  display: block;
  font-weight: 750;
  padding: 11px 10px;
  text-align: center;
}

.segmented input:checked + span {
  background: var(--panel);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
  color: var(--accent-strong);
}

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

.interest-grid label {
  cursor: pointer;
  min-width: 0;
}

.interest-grid span {
  align-items: center;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  font-size: 0.88rem;
  font-weight: 700;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 10px;
  text-align: left;
}

.interest-option {
  gap: 9px;
}

.interest-icon {
  background: var(--tone-soft, #eef2f3);
  border: 1px solid var(--tone-line, var(--line));
  border-radius: 5px;
  color: var(--tone, var(--accent));
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 900;
  height: 24px;
  letter-spacing: 0.04em;
  line-height: 1;
  place-items: center;
  width: 30px;
}

.interest-grid input:checked + span {
  background: #ffffff;
  border-color: var(--tone, var(--accent));
  box-shadow: inset 3px 0 0 var(--tone, var(--accent));
  color: var(--ink);
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
  min-height: 50px;
  padding: 0 18px;
}

.primary-button:hover,
.primary-button:focus {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-button,
.icon-button {
  background: #eff3f4;
  color: var(--ink);
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
}

.icon-button {
  height: 36px;
  width: 36px;
}

.form-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: -4px 0 0;
}

.empty-state,
.loading-state,
.error-state {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 104px);
  place-content: center;
  text-align: center;
}

.empty-state p,
.loading-state p {
  color: var(--muted);
  margin-left: auto;
  margin-right: auto;
  max-width: 560px;
}

.loading-state {
  gap: 20px;
}

.spinner {
  animation: spin 0.9s linear infinite;
  border: 4px solid #dce4df;
  border-top-color: var(--accent);
  border-radius: 50%;
  height: 48px;
  margin: 0 auto;
  width: 48px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state {
  color: var(--warning);
}

.briefing-result {
  display: grid;
  gap: 20px;
}

.overview-box,
.section-card,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview-box {
  background: #f9fbfb;
  padding: 18px;
}

.overview-box h3 {
  margin-bottom: 12px;
}

.section-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.section-card {
  background: white;
  border-left: 4px solid var(--tone, var(--accent));
  color: var(--ink);
  cursor: pointer;
  display: block;
  font: inherit;
  min-height: 175px;
  padding: 18px;
  text-align: left;
  width: 100%;
}

.card-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.card-icon {
  background: #ffffff;
  border: 1px solid var(--tone-line, var(--line));
  border-radius: 7px;
  color: var(--tone, var(--accent));
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 900;
  height: 34px;
  letter-spacing: 0.04em;
  place-items: center;
  width: 42px;
}

.section-card:hover,
.section-card:focus {
  border-color: var(--tone, var(--accent));
  box-shadow: 0 12px 28px rgba(44, 110, 99, 0.12);
  outline: none;
}

.section-card h3 {
  margin-bottom: 10px;
}

.section-card .open-detail {
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 800;
  margin-top: 14px;
}

.detail-panel {
  background: #f9fbfb;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.detail-fallback {
  border-left: 4px solid var(--warning);
  padding-left: 16px;
}

.muted {
  color: var(--muted);
}

.tone-teal {
  --tone: #245b55;
  --tone-soft: #edf6f4;
  --tone-line: #c9dfdb;
}

.tone-amber {
  --tone: #9a5a22;
  --tone-soft: #fbf1e6;
  --tone-line: #e4ccb2;
}

.tone-green {
  --tone: #527044;
  --tone-soft: #f0f6ec;
  --tone-line: #cbdcbe;
}

.tone-blue {
  --tone: #406f91;
  --tone-soft: #edf4f8;
  --tone-line: #c5d7e3;
}

.tone-pink {
  --tone: #8d5c70;
  --tone-soft: #f7eef2;
  --tone-line: #ddc8d1;
}

.tone-navy {
  --tone: #344563;
  --tone-soft: #e9edf4;
  --tone-line: #c5cedd;
}

.tone-slate {
  --tone: #66737f;
  --tone-soft: #eef1f3;
  --tone-line: #cfd6db;
}

.tone-violet {
  --tone: #7356a7;
  --tone-soft: #f0ebf8;
  --tone-line: #d4c5eb;
}

.tone-sky {
  --tone: #4583a5;
  --tone-soft: #e6f3f8;
  --tone-line: #bddbe8;
}

ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

li {
  line-height: 1.48;
  margin: 6px 0;
}

.markdown h2,
.markdown h3 {
  margin-top: 18px;
}

.markdown h2:first-child,
.markdown h3:first-child {
  margin-top: 0;
}

.markdown p {
  margin: 8px 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .briefing-panel {
    position: static;
  }

  .results-panel {
    min-height: 460px;
    padding: 20px;
  }

  h1 {
    max-width: none;
  }
}

@media (max-width: 620px) {
  .brand-row,
  .result-header,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .section-grid,
  .interest-grid,
  .date-range,
  .month-range {
    grid-template-columns: 1fr;
  }

  .empty-state,
  .loading-state,
  .error-state {
    min-height: 340px;
  }
}
