@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600&display=swap");

:root {
  color-scheme: light;
  font-family: "DM Sans", sans-serif;
  color: #202522;
  background: #f7f7f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #69716b;
  --line: #e5e8e2;
  --green: #315c49;
  --green-dark: #264936;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 0; }

[hidden] { display: none !important; }
.account-panel { width: min(420px, calc(100% - 40px)); margin: 64px auto; }
.account-panel h1 { font-family: "Playfair Display", serif; font-size: 36px; letter-spacing: 0; }
.account-panel h2 { font-size: 22px; }
.account-panel form { display: grid; gap: 12px; }
.account-panel input { width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; }
.account-actions { display: flex; gap: 12px; flex-wrap: wrap; }
#account-message { font-size: 14px; line-height: 1.5; }
.topbar { height: auto; min-height: 72px; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.topbar-actions { flex-wrap: wrap; }
#account-email { overflow-wrap: anywhere; max-width: 220px; }

button, input, textarea { font: inherit; }

button { cursor: pointer; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5vw, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid #e9ebe7;
  background: rgba(255, 255, 255, .64);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #26362d;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #315c49;
  color: white;
  font-family: "Playfair Display", serif;
  font-size: 19px;
}

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

.google-status { color: var(--muted); font-size: 10px; }

.help-link { display: inline-flex; min-height: 26px; align-items: center; gap: 4px; padding: 2px 7px; border: 1px solid #dce4dd; border-radius: 4px; color: var(--green-dark); font-size: 10px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; }

.help-link:hover, .help-link:focus-visible { border-color: #9bb2a1; background: #f4f8f4; outline: none; }

.topbar-help { min-height: 30px; }

.heading-actions { display: flex; align-items: center; gap: 9px; }

.privacy-note, .saved-status {
  color: var(--muted);
  font-size: 12px;
}

.privacy-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #78a786;
}

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  max-width: 710px;
  margin: 75px auto 42px;
  text-align: center;
}

.eyebrow, .step-label {
  color: #63816e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 17px; }

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

h1 {
  margin-bottom: 17px;
  font-family: "DM Sans", sans-serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.08;
}

h1 .headline-line { display: block; color: inherit; }

h1 .headline-accent { color: var(--green); }

.intro-copy {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel, .command-panel, .output-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(38, 57, 44, .035);
}

.panel { padding: 25px; }

.panel-heading, .output-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.step-label { margin: 0 0 9px; font-size: 9px; }

.step-label span { margin-left: 5px; color: #88918b; }

h2 {
  margin-bottom: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -.025em;
}

.master-purpose { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }

.saved-status { padding-top: 18px; }

.optional-label {
  padding-top: 18px;
  color: #8b938d;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: #444c46;
  font-size: 11px;
  font-weight: 600;
}

.inline-optional { padding-left: 4px; font-size: 9px; }

textarea, .url-row input, .command-input input, .engine-select, .company-input {
  width: 100%;
  border: 1px solid #e2e6e1;
  border-radius: 7px;
  outline: none;
  background: #fcfdfb;
  color: #27312a;
  font-size: 12px;
  transition: border-color .15s, box-shadow .15s;
}

textarea:focus, .url-row input:focus, .command-input input:focus, .engine-select:focus, .company-input:focus {
  border-color: #8aaa95;
  box-shadow: 0 0 0 3px rgba(85, 133, 103, .12);
}

textarea {
  min-height: 200px;
  padding: 13px;
  resize: vertical;
  line-height: 1.65;
}

.job-textarea { min-height: 145px; }

textarea::placeholder, input::placeholder { color: #a0a7a1; }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  color: #89918b;
  font-size: 10px;
}

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

.builder-details { margin: 14px 0 8px; border-top: 1px solid var(--line); }

.builder-details summary { padding: 13px 0 6px; color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer; }

.builder-form { padding-top: 12px; }

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

.builder-grid .field-label { min-width: 0; }

.builder-textarea { min-height: 78px; margin-bottom: 13px; }

.builder-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 6px; }

.builder-section-heading h3 { margin: 0; color: #34463a; font-size: 14px; font-weight: 600; }

.builder-entry { padding: 13px 0 3px; border-top: 1px solid var(--line); }

.builder-insert { justify-content: center; margin-top: 5px; }

.button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .15s;
}

.button:active { transform: translateY(1px); }

.button-quiet {
  border-color: #e2e6e1;
  background: white;
  color: #424c45;
}

.button-quiet:hover { border-color: #bfcac1; background: #fafcf9; }

.button-primary {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  background: var(--green);
  color: #fff;
}

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

.url-row {
  display: flex;
  gap: 8px;
  margin: 11px 0 15px;
}

.url-row input, .command-input input { min-height: 36px; padding: 0 11px; }

.company-input { min-height: 36px; margin-bottom: 13px; padding: 0 11px; }

.engine-select { min-height: 36px; margin: -2px 0 13px; padding: 0 10px; }

.fine-print { margin: 10px 0 0; color: #89918b; font-size: 10px; }

.command-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 17px 21px;
}

.command-panel .step-label { margin-bottom: 5px; }

.command-help { margin: 0; color: var(--muted); font-size: 11px; }

.command-panel > div:first-child > .help-link { margin-top: 8px; }

code {
  padding: 2px 4px;
  border-radius: 3px;
  background: #f0f3ef;
  color: #355945;
  font-size: 10px;
}

.command-input { display: flex; width: min(410px, 50%); gap: 8px; }

.command-input textarea { flex: 1; min-width: 0; min-height: 40px; padding: 10px; resize: vertical; }

.output-section { margin-top: 22px; padding: 25px; }

.export-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }

.view-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #f6f8f5; }

.view-toggle-button { min-height: 29px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: #59645d; font: inherit; font-size: 10px; font-weight: 600; cursor: pointer; }

.view-toggle-button.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 3px rgba(32, 37, 34, .13); }

.review-section { margin-top: 18px; padding: 25px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.review-save { width: auto; min-height: 36px; gap: 8px; }

.review-question { padding: 16px 0; border-top: 1px solid var(--line); }

.review-question h3 { margin: 0 0 6px; color: #34463a; font-size: 14px; font-weight: 600; }

.review-question p { margin: 0 0 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.review-question textarea { min-height: 76px; }

.review-empty { padding: 14px 0 0; color: var(--muted); font-size: 12px; }

.output-heading { align-items: center; margin-bottom: 10px; }

.output-note { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.document-toolbar { display: flex; min-height: 42px; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf7; }

.format-group { display: inline-flex; align-items: center; gap: 2px; padding-right: 7px; border-right: 1px solid #dce2dc; }

.format-group:last-child { padding-right: 0; border-right: 0; }

.format-button { display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #35483b; cursor: pointer; }

.format-button svg, .format-block-group > svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.format-button:hover, .format-button:focus-visible { border-color: #d7e0d8; background: #fff; outline: none; }

.format-button:focus-visible { box-shadow: 0 0 0 2px rgba(49, 92, 73, .22); }

.format-block-group { gap: 7px; padding: 0 8px 0 4px; }

.format-select { min-height: 30px; max-width: 150px; padding: 0 7px; border: 1px solid #e2e6e1; border-radius: 4px; background: #fff; color: #34463a; font: inherit; font-size: 11px; }

.resume-document {
  min-height: 420px;
  max-height: 760px;
  overflow: auto;
  padding: clamp(22px, 5vw, 54px) clamp(20px, 8vw, 86px);
  border: 1px solid #e7e9e4;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #252a26;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  box-shadow: 0 5px 20px rgba(38, 57, 44, .045);
}

.resume-document:focus { border-color: #9bb2a1; box-shadow: 0 0 0 3px rgba(85, 133, 103, .1); }

.resume-document h1 { margin: 0 0 15px; color: #202522; font-size: 27px; line-height: 1.2; }

.resume-document h2 { margin: 23px 0 7px; padding-bottom: 4px; border-bottom: 1px solid #dfe6df; color: var(--green-dark); font-size: 17px; line-height: 1.35; }

.resume-document h3 { margin: 15px 0 4px; color: #303a33; font-size: 14px; font-weight: 700; }

.resume-document h4, .resume-document h5, .resume-document h6 { margin: 12px 0 4px; font-size: 13px; }

.resume-document p { margin: 5px 0 9px; }

.resume-document ul, .resume-document ol { margin: 5px 0 12px; padding-left: 28px; }

.resume-document ul { list-style: disc outside; }

.resume-document ol { list-style: decimal outside; }

.resume-document li { padding-left: 3px; margin: 2px 0; }

.resume-document li::marker { color: #315c49; }

.resume-document li > input[type="checkbox"] { margin: 0 7px 0 0; accent-color: #315c49; }

.resume-document blockquote { margin: 10px 0; padding: 2px 0 2px 15px; border-left: 3px solid #9bb2a1; color: #56645a; }

.resume-document pre { overflow-x: auto; margin: 10px 0; padding: 12px; border-radius: 4px; background: #f1f3f0; font: 12px/1.55 Consolas, "Courier New", monospace; white-space: pre-wrap; }

.resume-document pre code { padding: 0; background: transparent; }

.resume-document hr { margin: 18px 0; border: 0; border-top: 1px solid #dce2dc; }

.resume-document a { color: #286548; text-decoration: underline; }

.resume-document code { padding: 1px 4px; background: #f1f3f0; color: #34463a; font-size: .9em; }

.resume-source {
  width: 100%;
  min-height: 420px;
  max-height: 760px;
  padding: 18px;
  border: 1px solid #e2e6e1;
  border-radius: 4px;
  background: #fbfcfa;
  color: #27312a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.65;
  resize: vertical;
}

.resume-chat { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.review-refresh { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.review-refresh input { width: 16px; height: 16px; margin: 0; }

.job-panel { order: 1; }
.master-chat-panel { order: 2; grid-column: 1 / -1; border-top: 1px solid var(--line); min-width: 0; }
.master-chat-panel select { margin-bottom: 12px; max-width: 260px; }
#master-chat-proposal { margin-top: 16px; }
#master-chat-preview { width: 100%; height: 320px; margin-bottom: 12px; }

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

.chat-heading h3 { margin: 0; color: #34463a; font-size: 14px; font-weight: 600; }

.chat-messages { display: flex; max-height: 240px; flex-direction: column; gap: 8px; overflow-y: auto; }

.chat-message { max-width: min(760px, 92%); padding: 9px 12px; border-radius: 7px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.chat-message.user { align-self: flex-end; background: #e9f0ea; color: #26392d; }

.chat-message.assistant { align-self: flex-start; background: #f2f4f1; color: #343d36; }

.chat-message.error { align-self: flex-start; background: #fbefed; color: #8c332d; }

.chat-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 9px; }

.chat-form textarea { min-height: 42px; max-height: 140px; padding: 10px 12px; resize: vertical; }

.chat-send { width: auto; min-width: 82px; min-height: 42px; justify-content: center; gap: 7px; }

.chat-send svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status-message {
  min-height: 18px;
  margin: 12px 2px 0;
  color: #55735e;
  font-size: 11px;
}

.page-footer {
  padding: 30px 20px 26px;
  color: #89918b;
  font-size: 10px;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .topbar { min-height: 62px; height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 20px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .privacy-note { font-size: 10px; }
  .intro { margin: 54px auto 32px; }
  h1 { font-size: 36px; }
  .workspace { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .command-panel { align-items: stretch; flex-direction: column; }
  .command-input { width: 100%; }
}

@media (max-width: 430px) {
  .topbar-actions { justify-content: flex-start; }
  .google-status { display: none; }
  main { width: calc(100% - 28px); }
  .intro-copy { font-size: 13px; }
  h1 { font-size: 30px; }
  .saved-status { font-size: 10px; }
  .panel-footer { align-items: flex-start; flex-direction: column; }
  .output-heading { align-items: flex-start; flex-direction: column; }
  .master-actions { width: 100%; }
  .builder-grid { grid-template-columns: 1fr; }
  .export-actions { justify-content: flex-start; }
  .chat-form { align-items: stretch; }
  .chat-send { min-width: 42px; padding: 0 10px; }
  .resume-document { min-height: 340px; max-height: 680px; padding: 23px 19px; font-size: 13px; }
  .resume-document h1 { font-size: 23px; }
  .resume-source { min-height: 340px; }
  .review-save { width: 100%; }
  .output-section { padding: 19px; }
}

@media (max-width: 280px) {
  h1 { font-size: 27px; }
  main { width: calc(100% - 20px); }
  .panel { padding: 15px; }
}
