:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #292721;
  background: #eee8dc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, #f5f1e8 0%, #e9e0d2 100%);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.study-shell {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.study-header, .carrier-heading, .period-heading, .conversation-heading, .continuity-heading, .action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.study-header { margin-bottom: 18px; }
.study-brand { display: flex; align-items: center; gap: 10px; }
.study-brand > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: #5d6854;
  font-family: Georgia, serif;
  font-size: 22px;
}
.study-brand div { display: grid; }
.study-brand small { color: #6f6a61; }

.locale-switch {
  display: flex;
  padding: 3px;
  border: 1px solid #cfc5b6;
  border-radius: 999px;
  background: #faf7f1;
}
.locale-switch button {
  min-width: 42px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  color: #666057;
  background: transparent;
}
.locale-switch button[aria-pressed="true"] { color: #fff; background: #5d6854; }

.privacy-banner, .neutral-note, .global-status {
  border-radius: 14px;
  padding: 12px 16px;
}
.privacy-banner { border: 1px solid #d2c3a8; background: #fff9e9; }
.privacy-banner p { margin: 4px 0 0; color: #625c51; line-height: 1.5; }
.neutral-note { color: #5f5b53; background: #e7e3da; }
.global-status:empty { display: none; }
.global-status[data-state="error"] { color: #8b2e2e; background: #f8dfdc; }
.global-status[data-state="success"] { color: #35523c; background: #dfeadd; }

.study-panel {
  margin-top: 18px;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid #d7cebf;
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 14px 34px rgba(59, 52, 41, 0.08);
}

.enroll-panel { max-width: 620px; margin-inline: auto; }
.eyebrow {
  margin: 0 0 7px;
  color: #6c745e;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(27px, 6vw, 42px); line-height: 1.08; }
h2 { font-size: clamp(20px, 4vw, 28px); }

form { display: grid; gap: 12px; }
label { font-weight: 650; }
input[type="text"], textarea, select {
  width: 100%;
  border: 1px solid #bfb5a6;
  border-radius: 12px;
  padding: 12px 14px;
  color: #292721;
  background: #fff;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(93, 104, 84, 0.2);
  border-color: #5d6854;
}
.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
.check-row input { margin-top: 4px; }
.disclosure-card {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #cfc5b6;
  border-radius: 16px;
  background: #f7f3eb;
}
.disclosure-card h2 { font-size: 20px; }
.disclosure-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.disclosure-list div { min-width: 0; padding: 10px; border-radius: 10px; background: #fff; }
.disclosure-list dt { color: #6e675d; font-size: 12px; }
.disclosure-list dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.disclosure-list a { color: #4f5a47; }
.retention-copy { margin-top: 14px; }
.retention-copy h3 { margin-bottom: 8px; }
.retention-copy p { margin-bottom: 7px; color: #625c51; line-height: 1.45; }
.inline-error, .privacy-note {
  padding: 11px 13px;
  border-radius: 10px;
  color: #7b352f;
  background: #f8dfdc;
}

.primary-button, .secondary-button, .quiet-button, .danger-button, .danger-link {
  border-radius: 999px;
  padding: 10px 17px;
  font-weight: 720;
}
.primary-button { border: 1px solid #5d6854; color: #fff; background: #5d6854; }
.secondary-button { border: 1px solid #5d6854; color: #4f5a47; background: #fff; }
.quiet-button { border: 1px solid #cfc5b6; color: #58534b; background: transparent; }
.danger-button { border: 1px solid #8a3731; color: #fff; background: #8a3731; }
.danger-link { border: 0; color: #8a3731; background: transparent; }
button:disabled { cursor: wait; opacity: 0.55; }

.version-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.version-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 18px;
  text-align: left;
  color: #292721;
  background: #fffdf8;
  box-shadow: 0 8px 20px rgba(54, 48, 39, 0.07);
}
.version-card[aria-pressed="true"] { border-color: #5d6854; background: #f5f7ef; }
.version-card[data-readonly="true"] { border-style: dashed; background: #f0ede6; }
.version-card:disabled { cursor: not-allowed; }
.version-card strong { font-size: 22px; }
.version-card small { color: #6c675f; }

.period-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 0;
}
.period-stats div { padding: 14px; border-radius: 14px; background: #f1ede5; }
.period-stats dt { color: #6e675d; font-size: 13px; }
.period-stats dd { margin: 4px 0 0; font-size: 25px; font-weight: 780; }
.period-gate {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #ddd4c7;
}
.criteria-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.criteria-list li {
  padding: 10px 12px 10px 38px;
  border-radius: 10px;
  background: #f3efe7;
  position: relative;
}
.criteria-list li::before {
  content: "○";
  position: absolute;
  left: 14px;
  font-weight: 800;
}
.criteria-list li[data-complete="true"]::before { content: "✓"; color: #35523c; }
#period-feedback-form {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: #f5f2ea;
}

.provider-status {
  padding: 7px 11px;
  border-radius: 999px;
  color: #625d54;
  background: #eee9df;
  font-size: 13px;
}
.provider-status[data-state="working"] { color: #41503b; background: #e0e9dc; }
.provider-status[data-state="failed"] { color: #76403b; background: #f2dfdc; }
.workspace-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.workspace-columns > section {
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background: #f3efe7;
}
.workspace-columns h3 { margin: 0 0 10px; }
.empty-copy { color: #716a60; }
.state-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.state-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
}
.state-list li div { min-width: 0; }
.state-list small { color: #6c745e; font-weight: 700; }
.state-list p { margin: 4px 0 0; overflow-wrap: anywhere; }
.state-list .danger-link { flex: 0 0 auto; padding: 5px; }
.conversation-divider {
  margin: 14px 0 7px;
  color: #7c756a;
  font-size: 12px;
  text-align: center;
}
.conversation-thread {
  min-height: 92px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 14px;
  background: #f3efe7;
}
.conversation-thread:empty::before { content: "…"; color: #898277; }
.message-bubble {
  width: fit-content;
  max-width: 82%;
  margin: 7px 0;
  padding: 10px 13px;
  border-radius: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.message-bubble.user { margin-left: auto; background: #dce5d7; }
.message-bubble.service { background: #fff; }
.field-note { margin: -4px 0 0; color: #716a60; font-size: 13px; }
.candidate-values {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.candidate-values p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f1ede5;
  overflow-wrap: anywhere;
}

.followup-panel blockquote {
  margin: 1rem 0 .5rem;
  padding: .9rem 1rem;
  border-left: 3px solid #68745e;
  background: #f4efe6;
  border-radius: 0 .65rem .65rem 0;
}
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.exit-panel:focus { outline: 3px solid rgba(93, 104, 84, 0.25); }
.exit-panel form { margin-top: 18px; }
.exit-panel fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}
.exit-panel legend { margin-bottom: 12px; font-size: 18px; font-weight: 750; }
.exit-panel fieldset label {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #d7cebf;
  border-radius: 12px;
  background: #fff;
}
.price-card {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid #aeb8a4;
  border-radius: 18px;
  background: #f3f7ef;
}
.price-card h3, .price-card p { margin: 0; }
.offer-amount { font-size: clamp(28px, 6vw, 42px); color: #44503e; }
.control-panel { border-color: #d8b6b1; }

@media (max-width: 640px) {
  .study-shell { width: min(100% - 20px, 880px); padding-top: 12px; }
  .study-header, .carrier-heading, .period-heading, .conversation-heading, .continuity-heading { align-items: flex-start; }
  .carrier-heading, .period-heading, .continuity-heading { flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1; }
  .disclosure-list { grid-template-columns: 1fr; }
  .version-grid, .period-stats, .workspace-columns { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; }
  .action-row button { width: 100%; }
}
