:root {
  color-scheme: light;
  --ink: #102f2b;
  --muted: #64736f;
  --paper: #ffffff;
  --canvas: #f3f5f2;
  --line: #ced8d4;
  --green: #0f6758;
  --green-dark: #0a4d43;
  --mint: #dff2ec;
  --turquoise: #1b8f7d;
  --gold: #cfa84d;
  --gold-soft: #f6edda;
  --guide: #eef2f6;
  --danger: #a83939;
  --shadow: 0 10px 30px rgb(16 47 43 / 9%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  min-height: 48px;
}

button {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(27 143 125 / 30%);
  outline-offset: 2px;
}

.demo-page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 48px) 40px;
}

.demo-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: 0;
}

.header-actions,
.language-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-control span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.language-control select {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 34px 0 14px;
}

.icon-button {
  width: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--green);
}

.icon-button svg,
.tile-icon svg,
.mini-icon svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: clamp(18px, 3vw, 36px);
}

.simulation-shell {
  min-width: 0;
}

.simulation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 6px;
}

.simulation-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin: 0;
  color: #5e7180;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.simulation-label::before {
  width: 10px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 1px;
  content: "";
}

.demo-back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--green);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}

.demo-back-button:hover {
  background: var(--mint);
}

.demo-back-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.product-frame {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.product-frame {
  min-height: 680px;
  overflow: hidden;
}

.app-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 16px 20px;
  color: #ffffff;
  background: var(--ink);
}

.app-bar div:first-child {
  display: grid;
  gap: 4px;
}

.app-bar strong {
  font-size: 18px;
  text-transform: uppercase;
}

.app-bar span {
  font-size: 13px;
}

.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #57d8b7;
}

.app-screen {
  min-height: 540px;
  padding: clamp(18px, 3vw, 30px);
  background: #f9faf8;
}

.screen-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.screen-heading h2 {
  margin-bottom: 3px;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 500;
}

.screen-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.demo-badge,
.local-badge,
.saved-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.app-tile {
  position: relative;
  display: flex;
  min-height: 155px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 0;
  border-radius: 4px;
  padding: 20px;
  text-align: left;
}

.app-tile.primary {
  grid-column: 1 / -1;
  min-height: 210px;
  color: #ffffff;
  background: var(--green);
}

.app-tile.gold {
  color: #2d250f;
  background: var(--gold);
}

.app-tile.mint {
  color: var(--green-dark);
  background: var(--mint);
}

.app-tile.soft {
  color: var(--ink);
  background: #e8eeeb;
}

.app-tile strong {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 500;
}

.app-tile small {
  display: block;
  margin-top: 5px;
  font-weight: 700;
}

.tile-icon {
  display: inline-flex;
}

.capture-layout,
.review-grid,
.contact-workspace,
.mail-workspace {
  display: grid;
  grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr);
  gap: 20px;
}

.card-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #edf1ee;
}

.card-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.75 / 1;
  object-fit: cover;
}

.capture-actions,
.analysis-panel,
.contact-card,
.context-panel,
.mail-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  padding: 20px;
}

.capture-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.capture-actions h3,
.analysis-panel h3,
.context-panel h3,
.mail-card h3 {
  margin-bottom: 8px;
  font-size: 22px;
}

.capture-actions p,
.analysis-panel p,
.context-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.text-button {
  border-radius: 4px;
  padding: 12px 18px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--green);
  color: #ffffff;
  background: var(--green);
}

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

.secondary-button,
.text-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.loading-panel {
  display: grid;
  min-height: 250px;
  place-items: center;
  text-align: center;
}

.loading-ring {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border: 5px solid var(--mint);
  border-top-color: var(--turquoise);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.contact-card {
  min-height: 100%;
}

.contact-card h3 {
  margin-bottom: 4px;
  font-size: clamp(23px, 3vw, 32px);
}

.contact-company {
  margin-bottom: 20px;
  color: var(--green);
  font-weight: 800;
}

.data-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.data-list div {
  border-bottom: 1px solid #e6ebe8;
  padding-bottom: 10px;
}

.data-list dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.context-panel label {
  display: block;
  margin: 18px 0 7px;
  font-size: 14px;
  font-weight: 800;
}

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

.context-chip {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 700;
}

.context-chip.selected {
  border: 2px solid var(--turquoise);
  color: var(--green-dark);
  background: var(--mint);
}

.context-chip.selected::before {
  content: "✓ ";
  font-weight: 900;
}

textarea,
.mail-input,
.select-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--paper);
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

.mail-input {
  min-height: 48px;
  padding: 10px 12px;
  font-weight: 700;
}

.mail-card label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mail-card textarea {
  min-height: 280px;
}

.select-field {
  padding: 0 12px;
}

.contact-list {
  display: grid;
  gap: 12px;
}

.contact-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: var(--paper);
}

.contact-row img {
  width: 72px;
  aspect-ratio: 1.6 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
}

.contact-row strong,
.contact-row span {
  display: block;
}

.contact-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.saved-badge {
  border-color: #acd8cb;
  color: var(--green);
  background: var(--mint);
}

.mail-card {
  min-height: 100%;
}

.mail-subject {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  font-weight: 800;
}

.mail-body {
  margin: 18px 0 0;
  white-space: pre-line;
  line-height: 1.65;
}

.handoff-flow {
  display: grid;
  grid-template-columns: minmax(200px, .7fr) 64px minmax(320px, 1.3fr);
  align-items: center;
  gap: 16px;
}

.handoff-state,
.mail-client {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.handoff-state {
  padding: 24px;
}

.handoff-check {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
  font-size: 28px;
  font-weight: 900;
}

.handoff-state strong,
.handoff-state span {
  display: block;
}

.handoff-state strong {
  margin-bottom: 7px;
  font-size: 22px;
}

.handoff-state span,
.handoff-note {
  color: var(--muted);
  line-height: 1.55;
}

.handoff-arrow {
  color: var(--gold);
  font-size: 48px;
  text-align: center;
}

.mail-client {
  overflow: hidden;
  box-shadow: 0 12px 28px rgb(16 47 43 / 9%);
}

.mail-client-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: #ffffff;
  background: var(--ink);
}

.mail-client-dots {
  letter-spacing: 4px;
}

.mail-client-content {
  padding: 18px;
}

.mail-client-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid #e5ebe8;
  padding: 9px 0;
}

.mail-client-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mail-client-row strong {
  overflow-wrap: anywhere;
}

.mail-client-preview {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.55;
}

.handoff-note {
  margin: 20px 0 0;
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.app-tab {
  min-height: 64px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper);
  font-size: 13px;
  font-weight: 800;
}

.app-tab:last-child {
  border-right: 0;
}

.app-tab.active {
  color: var(--green);
  background: var(--mint);
}

.app-tab:disabled {
  cursor: default;
  opacity: .55;
}

.guide-panel {
  position: sticky;
  top: 20px;
  overflow: hidden;
  border: 1px solid #d8dfe7;
  border-radius: 4px;
  background: var(--guide);
  box-shadow: 0 8px 24px rgb(30 51 65 / 7%);
}

.guide-panel summary {
  display: block;
  padding: 26px 26px 0;
  cursor: default;
  list-style: none;
}

.guide-panel summary::-webkit-details-marker {
  display: none;
}

.guide-step {
  display: block;
  margin-bottom: 14px;
  color: #5e7180;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.guide-panel h2 {
  margin: 0;
  font-size: clamp(23px, 2.2vw, 30px);
  font-weight: 650;
  line-height: 1.16;
}

.guide-body {
  padding: 18px 26px 26px;
}

.guide-section-label {
  margin-bottom: 7px;
  color: #5e7180;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.guide-body > #guideText {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.guide-note {
  margin: 0;
  border-left: 3px solid var(--green);
  padding: 2px 0 2px 13px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.guide-progress {
  display: flex;
  gap: 7px;
  margin-top: 26px;
}

.guide-progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c7d0d7;
}

.guide-progress-dot.done {
  background: var(--green);
}

.guide-progress-dot.active {
  background: var(--gold);
}

.privacy-note {
  margin: 20px 0 0;
  border-top: 1px solid #d8dfe7;
  padding-top: 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: 20px;
  max-width: min(390px, calc(100vw - 40px));
  transform: translateY(130%);
  border-radius: 4px;
  padding: 14px 18px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .2s ease;
}

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

@media (min-width: 981px) {
  .guide-panel summary {
    pointer-events: none;
  }
}

@media (max-width: 980px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    display: none;
  }

  .mobile-guide {
    display: block;
    border-bottom: 1px solid var(--line);
    background: var(--gold-soft);
  }

  .mobile-guide summary {
    display: grid;
    min-height: 58px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    cursor: pointer;
    list-style: none;
  }

  .mobile-guide summary::-webkit-details-marker {
    display: none;
  }

  .mobile-guide summary::after {
    content: "+";
    grid-column: 3;
    color: var(--green);
    font-size: 23px;
    font-weight: 500;
  }

  .mobile-guide[open] summary::after {
    content: "−";
  }

  .mobile-guide summary span {
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-guide summary strong {
    font-size: 16px;
  }

  .mobile-guide-body {
    padding: 0 18px 16px;
  }

  .mobile-guide-body p {
    margin-bottom: 10px;
    color: #40534e;
    line-height: 1.5;
  }

  .mobile-guide-body .mobile-guide-note {
    margin-bottom: 0;
    border-left: 3px solid var(--gold);
    padding-left: 12px;
    color: #665323;
    font-size: 13px;
  }

  .handoff-flow {
    grid-template-columns: minmax(180px, .65fr) 52px minmax(300px, 1.35fr);
  }
}

@media (max-width: 680px) {
  .demo-page {
    padding: 14px 12px 28px;
  }

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

  .progress-nav {
    display: none;
  }

  .language-control span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .product-frame {
    min-height: 0;
  }

  .app-bar {
    align-items: flex-start;
  }

  .app-status {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .app-screen {
    min-height: 500px;
    padding: 16px;
  }

  .dashboard-grid,
  .capture-layout,
  .review-grid,
  .contact-workspace,
  .mail-workspace,
  .handoff-flow {
    grid-template-columns: 1fr;
  }

  .handoff-arrow {
    transform: rotate(90deg);
    font-size: 38px;
  }

  .mail-client-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app-tile.primary {
    grid-column: auto;
    min-height: 180px;
  }

  .screen-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

  .contact-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .contact-row img {
    width: 64px;
  }

  .contact-row .saved-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* The guide is a separate presentation layer on tablet and mobile. */
@media (max-width: 980px) {
  .demo-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .guide-panel {
    position: static;
    display: block;
    order: -1;
  }

  .guide-panel summary {
    position: relative;
    min-height: 76px;
    padding: 18px 56px 16px 20px;
    cursor: pointer;
  }

  .guide-panel summary::after {
    position: absolute;
    top: 50%;
    right: 20px;
    content: "+";
    transform: translateY(-50%);
    color: var(--green);
    font-size: 25px;
    font-weight: 400;
  }

  .guide-panel[open] summary::after {
    content: "−";
  }

  .guide-step {
    margin-bottom: 7px;
  }

  .guide-panel h2 {
    font-size: 21px;
  }

  .guide-body {
    padding: 0 20px 20px;
  }
}

@media (max-width: 680px) {
  .simulation-label {
    margin-top: 2px;
  }

  .guide-panel summary {
    min-height: 70px;
    padding: 15px 50px 14px 16px;
  }

  .guide-panel summary::after {
    right: 16px;
  }

  .guide-panel h2 {
    font-size: 18px;
  }

  .guide-body {
    padding: 0 16px 16px;
  }

  .guide-progress {
    margin-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
