:root {
  --ink: #151515;
  --muted: #62645f;
  --line: #dedfd8;
  --paper: #ffffff;
  --soft: #f5f5f0;
  --green: #93ff00;
  --green-dark: #4f8f00;
  --coral: #ff8f73;
  --graphite: #242521;
  --shadow: 0 24px 70px rgba(22, 24, 20, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(245, 245, 240, 0.96), rgba(245, 245, 240, 0.62)),
    url("/assets/proposal-studio.png") center / cover;
}

.login-panel {
  width: min(430px, 100%);
  padding: 34px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(21, 21, 21, 0.1);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.login-panel h1 {
  margin: 34px 0 10px;
  font-size: 38px;
  line-height: 1;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.55;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--graphite);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #9a9d95;
  opacity: 1;
}

textarea {
  min-height: 96px;
  resize: vertical;
  text-transform: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(147, 255, 0, 0.28);
}

button,
.primary-link,
.secondary-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.secondary-link,
.ghost-button {
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

button:hover,
.primary-link:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.hero {
  min-height: 92vh;
  background:
    linear-gradient(90deg, rgba(245, 245, 240, 0.98) 0%, rgba(245, 245, 240, 0.88) 38%, rgba(245, 245, 240, 0.2) 78%),
    url("/assets/proposal-studio.png") center / cover;
  border-bottom: 1px solid var(--line);
}

.nav {
  width: min(1180px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.seller-badge {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(21, 21, 21, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.seller-menu {
  position: relative;
}

.seller-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 15;
  min-width: 150px;
  padding: 8px;
  border: 1px solid rgba(21, 21, 21, 0.14);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(22, 24, 20, 0.16);
}

.seller-popover button {
  width: 100%;
  min-height: 38px;
  background: #fff;
  color: var(--ink);
}

.nav-actions a {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
}

.hero-grid {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(92vh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  align-items: center;
  gap: 48px;
  padding: 52px 0 86px;
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.91;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 28px 0 0;
  color: #40423d;
  font-size: 19px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.app-create-button {
  border: 0;
}

.hero-preview {
  align-self: end;
  padding: 26px;
  min-height: 460px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(21, 21, 21, 0.11);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-preview strong {
  display: block;
  margin-top: 16px;
  font-size: 36px;
  line-height: 1;
}

.hero-preview p {
  margin: 12px 0 34px;
  color: var(--muted);
}

.hero-lines {
  height: 260px;
  background:
    linear-gradient(var(--green), var(--green)) 0 0 / 74px 7px no-repeat,
    linear-gradient(#191919, #191919) 0 44px / 100% 1px no-repeat,
    linear-gradient(#d9dbd4, #d9dbd4) 0 92px / 100% 1px no-repeat,
    linear-gradient(#d9dbd4, #d9dbd4) 0 140px / 100% 1px no-repeat,
    linear-gradient(#d9dbd4, #d9dbd4) 0 188px / 100% 1px no-repeat,
    linear-gradient(90deg, #191919 0 34%, var(--coral) 34% 46%, #191919 46% 100%) 0 236px / 100% 22px no-repeat;
}

.workspace {
  width: min(1320px, calc(100% - 32px));
  margin: -42px auto 64px;
  padding-top: 42px;
}

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

.section-label {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workspace-header h2 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.builder {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(520px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.wizard-builder {
  grid-template-columns: minmax(420px, 0.78fr) minmax(560px, 1.22fr);
}

.editor-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 48px rgba(20, 22, 18, 0.08);
}

.wizard-panel {
  position: sticky;
  top: 16px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stepper span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
}

.stepper li.active span,
.stepper li.done span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.wizard-step {
  display: grid;
  gap: 16px;
}

.wizard-step h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.options-head h3 {
  margin: 0;
  font-size: 18px;
}

.options-head button,
.option-row button {
  min-height: 36px;
  background: #fff;
  color: var(--ink);
}

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

.option-row {
  display: grid;
  grid-template-columns: 0.95fr 0.78fr 0.55fr 1.2fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf6;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.wizard-actions button {
  min-width: 118px;
}

.wizard-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.review-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f2;
}

.review-box span {
  font-size: 24px;
  font-weight: 950;
}

.proposal-document {
  min-height: 920px;
  padding: 54px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(147, 255, 0, 0.16), transparent 22%) 0 0 / 100% 9px no-repeat,
    var(--paper);
  box-shadow: var(--shadow);
  border: 1px solid rgba(21, 21, 21, 0.08);
}

.proposal-review {
  display: grid;
  gap: 14px;
}

.review-send-panel {
  position: sticky;
  bottom: 14px;
  z-index: 9;
  padding: 12px;
  border: 1px solid rgba(21, 21, 21, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 42px rgba(20, 22, 18, 0.14);
  backdrop-filter: blur(16px);
}

.review-send-panel button {
  width: 100%;
  min-height: 50px;
}

.doc-cover {
  min-height: 520px;
  display: grid;
  align-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 34px;
}

.doc-top {
  display: flex;
  justify-content: space-between;
  gap: 28px;
}

.doc-brand {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 0.13em;
}

.doc-meta {
  color: var(--muted);
  text-align: right;
  font-size: 13px;
  line-height: 1.5;
}

.doc-cover h2 {
  max-width: 680px;
  margin: 80px 0 18px;
  font-size: 60px;
  line-height: 0.95;
}

.doc-cover p {
  max-width: 660px;
  color: #4d504a;
  font-size: 17px;
  line-height: 1.6;
}

.doc-section {
  padding: 34px 0;
  border-bottom: 1px solid #eceee7;
}

.doc-section h3 {
  margin: 0 0 16px;
  font-size: 25px;
}

.doc-section p,
.doc-section li {
  color: #454842;
  font-size: 15px;
  line-height: 1.62;
}

.doc-section ul,
.doc-section ol {
  margin: 0;
  padding-left: 20px;
}

.option-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.proposal-option {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.proposal-option h4 {
  margin: 0;
  font-size: 20px;
}

.proposal-option .option-type {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(147, 255, 0, 0.28);
  color: #355e00;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.price {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.roadmap li {
  padding: 14px;
  border-radius: 8px;
  background: #f4f5f0;
  border-left: 5px solid var(--green);
}

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

.team-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf6;
}

.team-grid strong {
  display: block;
  margin-bottom: 8px;
}

.history-section {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto 72px;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
}

.history-section h2 {
  margin: 0 0 18px;
  font-size: 34px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.history-item div {
  display: grid;
  gap: 5px;
}

.history-item span,
.history-item em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.share-fallback {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  width: min(640px, calc(100% - 28px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.share-fallback p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.share-fallback .secondary-link,
.share-fallback button {
  border-color: #fff;
}

.pdf-body {
  background: #fff;
}

.pdf-document {
  width: 100%;
  min-height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.status-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
}

@media (max-width: 980px) {
  .hero-grid,
  .builder {
    grid-template-columns: 1fr;
  }

  .wizard-panel {
    position: static;
  }

  .hero-grid {
    padding-top: 36px;
  }

  .hero-preview {
    min-height: 330px;
  }

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

  .option-cards,
  .roadmap,
  .team-grid,
  .field-grid,
  .option-row {
    grid-template-columns: 1fr;
  }

  .stepper {
    grid-template-columns: repeat(3, 1fr);
  }

  .proposal-document {
    padding: 30px;
  }
}

@media (max-width: 620px) {
  html {
    scroll-behavior: auto;
  }

  body {
    min-height: 100vh;
    background: #f3f4ef;
  }

  .login-screen {
    padding: 18px;
  }

  .login-panel {
    min-height: calc(100vh - 36px);
    display: grid;
    align-content: center;
    padding: 26px;
  }

  .login-panel h1 {
    font-size: 34px;
  }

  .login-form button {
    min-height: 54px;
  }

  .hero {
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr;
    background:
      linear-gradient(180deg, rgba(245, 245, 240, 0.92) 0%, rgba(245, 245, 240, 0.74) 44%, rgba(245, 245, 240, 0.28) 100%),
      url("/assets/proposal-studio.png") center / cover;
    border-bottom: 0;
  }

  .nav {
    width: min(100% - 28px, 1180px);
    height: 62px;
    position: relative;
    z-index: 3;
  }

  .brand-mark {
    font-size: 14px;
  }

  .nav-actions a {
    display: none;
  }

  .ghost-button {
    display: none;
  }

  .seller-badge {
    max-width: 165px;
    min-height: 34px;
    overflow: hidden;
    border-color: rgba(21, 21, 21, 0.18);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-grid,
  .workspace {
    width: min(100% - 24px, 1180px);
  }

  .hero-grid {
    min-height: auto;
    align-content: end;
    padding: 22px 0 110px;
  }

  .hero-copy h1 {
    font-size: 46px;
    line-height: 0.94;
  }

  .hero-copy p {
    margin-top: 18px;
    font-size: 16px;
    line-height: 1.48;
  }

  .hero-actions {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 12;
    margin: 0;
  }

  .app-create-button {
    width: 100%;
    min-height: 58px;
    border-radius: 8px;
    box-shadow: 0 18px 36px rgba(21, 21, 21, 0.22);
    font-size: 15px;
  }

  .hero-preview {
    display: none;
  }

  body.is-building .hero,
  body.is-building .hero-actions {
    display: none;
  }

  .workspace {
    min-height: 100svh;
    margin: 0 auto;
    padding: 18px 0 calc(28px + env(safe-area-inset-bottom));
    display: none;
  }

  body.is-building .workspace {
    display: block;
  }

  .history-section,
  body.is-building .history-section {
    display: none;
  }

  .workspace-header {
    margin-bottom: 14px;
  }

  .workspace-header h2 {
    font-size: 30px;
  }

  .section-label {
    font-size: 10px;
  }

  .builder,
  .wizard-builder {
    display: block;
  }

  .editor-panel {
    min-height: calc(100svh - 120px);
    align-content: start;
    padding: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 50px rgba(20, 22, 18, 0.1);
  }

  .stepper {
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }

  .stepper li {
    font-size: 0;
    gap: 0;
  }

  .stepper span {
    width: 100%;
    height: 5px;
    border: 0;
    border-radius: 999px;
    background: #dfe2d8;
    color: transparent;
  }

  .stepper li.active span,
  .stepper li.done span {
    background: var(--ink);
  }

  .wizard-step {
    min-height: calc(100svh - 280px);
    align-content: start;
    padding-top: clamp(28px, 8vh, 72px);
  }

  .wizard-step h3 {
    font-size: 34px;
  }

  input,
  textarea,
  select {
    min-height: 50px;
    font-size: 16px;
  }

  textarea {
    min-height: 140px;
  }

  .field-note {
    font-size: 13px;
  }

  .options-head {
    align-items: stretch;
    flex-direction: column;
  }

  .options-head button,
  .option-row button {
    min-height: 44px;
  }

  .option-row {
    padding: 14px;
  }

  .wizard-actions {
    position: sticky;
    bottom: calc(0px + env(safe-area-inset-bottom));
    margin: 0 -16px -16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
  }

  .wizard-actions button {
    min-width: 0;
    min-height: 52px;
    flex: 1;
  }

  #nextStepButton,
  #generateButton {
    flex: 2;
  }

  .proposal-review {
    margin-top: 16px;
  }

  .review-send-panel {
    bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .doc-cover h2 {
    font-size: 39px;
  }

  .history-item,
  .share-fallback {
    grid-template-columns: 1fr;
  }

  .share-fallback {
    align-items: stretch;
  }
}

@media print {
  body {
    background: #fff;
  }

  .hero,
  .editor-panel,
  .workspace-header,
  .history-section,
  .share-fallback,
  .status-toast {
    display: none !important;
  }

  .workspace {
    width: auto;
    margin: 0;
    padding: 0;
  }

  .builder {
    display: block;
  }

  .proposal-document {
    min-height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .doc-section {
    break-inside: avoid;
  }
}
