:root {
  --bg: #edf1ef;
  --ink: #171a18;
  --muted: #66706b;
  --line: #d9e0dc;
  --paper: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5b54;
  --soft: #f7f9f8;
  --button: #191714;
  --button-text: #fffdf8;
  --shadow: 0 28px 80px rgba(19, 34, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(237, 241, 239, 0.9) 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  min-height: 100vh;
}

.builder-view {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 22px;
  align-items: stretch;
}

.editor-panel,
.preview-panel {
  border: 1px solid rgba(25, 23, 20, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.editor-panel {
  padding: 24px;
}

.preview-panel {
  padding: 20px;
}

.private-notes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.fit-card {
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: #f3fbf8;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(19, 34, 28, 0.06);
}

.fit-card.not-fit {
  border-color: rgba(190, 18, 60, 0.24);
  background: #fff5f6;
}

.fit-card.good-fit {
  border-color: rgba(20, 168, 0, 0.24);
  background: #f4fbf2;
}

.fit-label {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fit-card.not-fit .fit-label {
  color: #be123c;
}

.fit-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.02rem;
}

.fit-card p:last-child {
  margin: 0;
  color: #3d4541;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-line;
}

.note-card {
  position: relative;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 16px 16px 16px 52px;
  box-shadow: 0 10px 24px rgba(19, 34, 28, 0.06);
}

.note-step {
  position: absolute;
  left: 14px;
  top: 15px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.82rem;
  font-weight: 800;
}

.note-card h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 0.98rem;
}

.note-card p:last-child {
  margin-bottom: 0;
  color: #3d4541;
  font-size: 0.92rem;
  line-height: 1.62;
  white-space: pre-line;
}

.panel-heading p {
  color: var(--muted);
  line-height: 1.5;
}

.input-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 16px;
  background: #fbfdfc;
  color: var(--ink);
  line-height: 1.6;
}

.question-input {
  min-height: 74px;
  margin-bottom: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.controls-row {
  margin: 18px 0;
}

.questions-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(25, 23, 20, 0.1);
}

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

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

.ghost-button,
.copy-button,
.open-button,
.rewrite-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.rewrite-button {
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: #eef8f6;
  color: var(--accent-dark);
  padding: 0 18px;
  transition: background 0.15s ease;
}

.rewrite-button:hover {
  background: #e2f2ef;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.chip-button {
  min-height: 38px;
  border: 1px solid rgba(25, 23, 20, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0 18px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chip-button:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: #f3fbf8;
}

.chip-button.primary {
  border-color: transparent;
  background: var(--accent);
  color: white;
}

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

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 6px 12px;
}

.ai-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.ghost-button {
  border: 1px solid rgba(25, 23, 20, 0.18);
  background: rgba(255, 253, 248, 0.7);
  color: var(--ink);
  padding: 0 18px;
}

.copy-button {
  background: var(--accent);
  color: white;
  padding: 0 16px;
}

.open-button {
  border: 1px solid rgba(15, 118, 110, 0.26);
  background: #eef8f6;
  color: var(--accent-dark);
  padding: 0 16px;
}

.proposal-paper,
.client-paper {
  position: relative;
  border: 1px solid rgba(13, 79, 70, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%),
    var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.proposal-paper {
  min-height: 360px;
}

.client-paper {
  width: min(1040px, calc(100% - 28px));
  min-height: 0;
}

.proposal-card {
  display: block;
  overflow: hidden;
}

.profile-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b5b54;
  color: white;
  padding: 20px;
}

.profile-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 18px);
}

.profile-photo-wrap {
  position: relative;
  width: clamp(58px, 6.5vw, 72px);
  height: clamp(58px, 6.5vw, 72px);
}

.profile-photo {
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  object-fit: cover;
  background: #2c2c2c;
}

.online-dot {
  position: absolute;
  left: 2px;
  top: 5px;
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 2px solid #171817;
  border-radius: 999px;
  background: #75d66c;
}

.edit-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1.5px solid #14a800;
  border-radius: 999px;
  background: #111412;
  color: #14a800;
  display: none;
}

.edit-dot::before {
  content: "";
  width: 9px;
  height: 3px;
  border: 1.5px solid #14a800;
  border-left: 0;
  border-right: 0;
  transform: rotate(-45deg);
}

.profile-copy {
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-name-row h3 {
  margin: 0;
  color: white;
  font-size: clamp(1.28rem, 2.4vw, 1.75rem);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.verified-badge {
  display: inline-grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #1f6fff;
  color: white;
  font-size: 0.7rem;
  font-weight: 900;
}

.profile-meta,
.profile-status {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(0.76rem, 1.25vw, 0.86rem);
  font-weight: 700;
  line-height: 1.35;
}

.profile-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 5px;
}

.profile-contact a {
  display: inline-flex;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.74rem, 1.18vw, 0.82rem);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.profile-contact a:hover {
  color: white;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.profile-status {
  color: rgba(255, 255, 255, 0.9);
}

.profile-achievements {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 16px;
  padding-top: 0;
}

.achievement {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: white;
  font-size: clamp(0.78rem, 1.35vw, 0.92rem);
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.job-success-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
}

.job-success-icon svg {
  width: 32px;
  height: 32px;
}

.air3-progress-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 2;
}

.air3-progress-circle-fg {
  fill: none;
  stroke: #1f6fff;
  stroke-linecap: round;
  stroke-width: 2.5;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.top-rated-icon,
.top-rated-icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.profile-metrics {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  padding: 9px 12px;
}

.profile-metrics div {
  min-width: 0;
}

.profile-metrics strong,
.profile-metrics span {
  display: block;
}

.profile-metrics strong {
  color: white;
  font-size: clamp(0.98rem, 2vw, 1.24rem);
  line-height: 1.05;
}

.profile-metrics span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.68rem, 1.2vw, 0.78rem);
  font-weight: 700;
}

.profile-footer-bar {
  display: none;
}

.letter-content {
  position: relative;
  padding: clamp(28px, 5vw, 64px);
}



.hook {
  max-width: 740px;
  margin: 0 auto 24px;
  color: var(--accent-dark);
  font-size: clamp(1.28rem, 4.2vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.salutation {
  max-width: 760px;
  margin: 0 0 22px;
  color: #28231d;
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 600;
  line-height: 1.5;
}

#proposalBody,
#clientProposalBody {
  color: #28231d;
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.72;
  white-space: pre-line;
}

.portfolio-links,
.answers-block {
  /* max-width: 640px; */
  margin-top: 28px;
}

.portfolio-links:empty,
.answers-block:empty {
  display: none;
}

.mini-heading {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portfolio-links a {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0;
  color: #154f49;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.answer-item {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(25, 23, 20, 0.11);
}

.answer-question {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.45;
}

.answer-text {
  margin-bottom: 0;
  color: #28231d;
  line-height: 1.7;
}

.meeting-box {
  margin-top: 30px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 18px;
}

.meeting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meeting-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.meeting-grid input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.meeting-button {
  min-height: 42px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--button);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 0 16px;
}

.meeting-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.closing {
  margin: 34px 0 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.55;
}

.link-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.rewrite-button {
  flex: 0 0 auto;
}

.copy-button {
  flex: 1 1 auto;
}

.link-box input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 0 14px;
  color: var(--muted);
  outline: none;
}

.history-panel {
  margin-top: 18px;
  border: 1px solid rgba(25, 23, 20, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-heading h2,
.history-heading p {
  margin: 0;
}

.history-heading p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

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

.history-item {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-title {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef3f1;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 800;
}

.history-status.viewed {
  background: #e9f8ef;
  color: #137333;
}

.history-link {
  min-width: 0;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-actions button,
.history-actions a {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: #f3fbf8;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0 11px;
  text-decoration: none;
}

.empty-history {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

#saveStatus {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.proposal-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(18px, 5vw, 46px) 0;
}

.hidden {
  display: none;
}

/* ===== Message Polisher (fixer.html) ===== */
.nav-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .nav-link {
    width: 100%;
  }
}

.fixer-intro {
  max-width: 760px;
  margin: -8px 0 22px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mode-label {
  margin: 0;
}

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

.seg-button {
  min-height: 40px;
  border: 1px solid rgba(25, 23, 20, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 18px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.seg-button:hover {
  border-color: rgba(15, 118, 110, 0.4);
  color: var(--ink);
}

.seg-button.active {
  border-color: transparent;
  background: var(--accent);
  color: white;
}

.fixer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: stretch;
}

.fixer-panel {
  display: flex;
  flex-direction: column;
}

.fixer-panel textarea {
  min-height: 300px;
  flex: 1;
}

.output-box {
  display: block;
  flex: 1;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: #28231d;
  padding: 16px;
  font-size: 1.02rem;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.output-box.is-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.98rem;
  white-space: normal;
}

.output-box.is-loading {
  opacity: 0.5;
}

@media (max-width: 900px) {
  .fixer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .segmented {
    width: 100%;
  }

  .seg-button {
    flex: 1 1 calc(50% - 4px);
    padding: 0 8px;
  }

  .fixer-panel textarea,
  .output-box {
    min-height: 200px;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .proposal-card {
    display: block;
  }

  .profile-achievements {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 10px 18px;
  }

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

  .ghost-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .builder-view {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .editor-panel,
  .preview-panel {
    padding: 16px;
  }

  .proposal-paper {
    min-height: auto;
  }

  .private-notes {
    grid-template-columns: 1fr;
  }

  .profile-card {
    grid-template-columns: 1fr;
    padding: 16px 16px 0;
  }

  .profile-main {
    gap: 14px;
  }

  .profile-photo-wrap,
  .profile-photo {
    width: 72px;
    height: 72px;
  }

  .online-dot {
    width: 15px;
    height: 15px;
    border-width: 2px;
  }

  .edit-dot {
    width: 26px;
    height: 26px;
  }

  .letter-content {
    padding: 28px 18px;
  }

 

  .profile-meta,
  .profile-status {
    font-size: 0.86rem;
  }

  .profile-contact {
    display: grid;
    gap: 6px;
  }

  .profile-contact a {
    font-size: 0.82rem;
  }

  .profile-achievements {
    display: flex;
    gap: 10px 14px;
  }

  .achievement {
    white-space: normal;
  }

  .job-success-icon,
  .job-success-icon svg {
    width: 30px;
    height: 30px;
  }

  .top-rated-icon,
  .top-rated-icon svg {
    width: 26px;
    height: 26px;
  }

  .profile-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

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

  .profile-footer-bar {
    display: none;
  }

  .hook {
    font-size: clamp(1.05rem, 7vw, 1.55rem);
  }

  .link-box {
    flex-direction: column;
  }

  .rewrite-button,
  .copy-button {
    width: 100%;
  }

  .editor-toolbar {
    gap: 8px;
  }

  .ai-badge {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .history-heading,
  .history-item-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-row {
    min-height: 24px;
  }
}
