:root {
  --navy: #071d3a;
  --midnight: #06152a;
  --blue: #071d3a;
  --blue-dark: #071d3a;
  --accent: #071d3a;
  --ink: #162236;
  --muted: #627084;
  --line: #d7e1ec;
  --soft: #eef4f9;
  --panel: #fbfdff;
  --white: #ffffff;
  --success: #1e7a4d;
  --shadow: 0 18px 60px rgba(7, 29, 58, 0.1);
  --shadow-tight: 0 10px 24px rgba(7, 29, 58, 0.08);
  --brand-font: "Invoce Brand", Arial, Helvetica, sans-serif;
}

@font-face {
  font-display: swap;
  font-family: "Invoce Brand";
  src: url("assets/fonts/invoce.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f6;
  color: var(--ink);
  font-family: var(--brand-font);
}

body::before {
  content: none;
}

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

.top-strip {
  align-items: center;
  background: var(--midnight);
  color: #d8dee8;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 18px;
  justify-content: flex-end;
  min-height: 34px;
  padding: 7px 32px;
}

.top-strip strong {
  color: var(--white);
}

.app-header {
  align-items: center;
  background: var(--navy);
  border-bottom: 4px solid var(--midnight);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 132px;
  padding: 24px 32px;
}

.app-header h1,
.form-section h2,
.preview-toolbar h2,
.history-panel h2 {
  margin: 0;
}

.app-header h1 {
  font-size: 30px;
  line-height: 1.15;
}

.header-subtitle {
  color: #d8dee8;
  margin: 7px 0 0;
}

.header-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.brand-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.brand-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-stats span {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #d8dee8;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
}

.brand-stats strong {
  color: var(--white);
}

.eyebrow,
.section-kicker {
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.header-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:hover {
  box-shadow: var(--shadow-tight);
  transform: translateY(-1px);
}

.primary-button {
  background: var(--blue);
  color: var(--white);
}

.secondary-button {
  background: var(--white);
  color: var(--blue-dark);
}

.ghost-button {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--blue-dark);
}

.danger-button {
  background: #fff5f5;
  border: 1px solid #f2c7c7;
  color: #9b1c1c;
}

.app-shell {
  display: grid;
  gap: 22px;
  grid-template-columns: 300px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1480px;
  padding: 24px;
}

.brand-banner {
  background: var(--navy);
  border: 1px solid var(--navy);
  border-bottom: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--white);
  display: grid;
  grid-column: 1 / -1;
  overflow: hidden;
  padding: 0;
}

.banner-image {
  display: block;
  width: 100%;
}

.banner-copy {
  background: var(--navy);
  max-width: 720px;
  padding: 24px 30px 28px;
}

.app-header .eyebrow,
.banner-copy .eyebrow {
  color: var(--white);
}

.banner-copy h2 {
  font-size: 32px;
  line-height: 1.13;
  margin: 0;
  max-width: 680px;
}

.history-panel,
.proposal-form,
.preview-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.history-panel::before,
.proposal-form::before,
.preview-shell::before {
  background: var(--accent);
  border-radius: 8px 8px 0 0;
  content: "";
  display: block;
  height: 4px;
  margin: -1px -1px 16px;
}

.history-panel {
  align-self: start;
  max-height: calc(100vh - 144px);
  overflow: auto;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.panel-title-row,
.preview-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.panel-title-row span,
#saveStatus {
  background: #f3f6fa;
  border-radius: 999px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
}

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

.history-empty {
  color: var(--muted);
  line-height: 1.45;
  margin: 18px 0 0;
}

.history-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.history-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0 0 10px;
}

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

.history-actions button {
  font-size: 12px;
  min-height: 34px;
  padding: 7px 9px;
}

.workspace {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(380px, 0.95fr) minmax(420px, 1.05fr);
}

.proposal-form {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 20px;
}

.form-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.form-section:last-of-type {
  border-bottom: 1px solid var(--line);
}

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

label,
legend {
  color: #2d3a4d;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

input,
select,
textarea {
  background: #f8fbfe;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 11px;
  width: 100%;
}

textarea {
  line-height: 1.4;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(7, 29, 58, 0.14);
  outline: none;
}

.span-2 {
  grid-column: 1 / -1;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 14px;
}

.checks-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.checks-grid label {
  align-items: center;
  background: #f3f6fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  font-weight: 700;
  gap: 8px;
  padding: 9px;
}

.checks-grid input {
  min-height: auto;
  width: auto;
}

.preview-shell {
  min-width: 0;
  padding: 20px;
}

.preview-toolbar {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.proposal-preview {
  background: var(--white);
  color: #1d2939;
  line-height: 1.55;
}

.proposal-cover {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 8px solid var(--navy);
  color: var(--ink);
  display: grid;
  margin-bottom: 28px;
  min-height: 420px;
  overflow: hidden;
  padding: 0;
}

.proposal-cover-banner {
  display: block;
  width: 100%;
}

.proposal-cover-content {
  display: grid;
  gap: 28px;
  padding: 44px 48px 52px;
}

.proposal-cover .brand {
  align-self: start;
  align-items: center;
  display: flex;
  font-size: 24px;
  font-weight: 800;
  gap: 14px;
}

.proposal-cover-kicker {
  align-self: start;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.proposal-cover h2 {
  align-self: center;
  color: var(--navy);
  font-size: 42px;
  line-height: 1.1;
  margin: 0;
  max-width: 720px;
}

.proposal-cover dl {
  align-self: end;
  display: grid;
  gap: 7px;
  grid-template-columns: max-content 1fr;
  margin: 0;
}

.proposal-cover dt {
  color: var(--navy);
  font-weight: 700;
}

.proposal-cover dd {
  margin: 0;
}

.proposal-section {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.proposal-section h3 {
  color: var(--navy);
  font-size: 20px;
  margin: 0 0 8px;
  position: relative;
}

.proposal-section h3::after {
  background: var(--accent);
  content: "";
  display: block;
  height: 3px;
  margin-top: 7px;
  width: 42px;
}

.proposal-section p,
.proposal-section ul {
  margin: 0;
}

.proposal-section ul {
  padding-left: 20px;
}

.investment-box {
  background: #f3f6fa;
  border-left: 5px solid var(--accent);
  display: grid;
  gap: 6px;
  padding: 16px;
}

.investment-box strong {
  color: var(--navy);
  font-size: 22px;
}

.contact-block {
  background: #f3f6fa;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

@media (max-width: 1180px) {
  .app-shell,
  .workspace {
    grid-template-columns: 1fr;
  }

  .history-panel {
    max-height: none;
    position: static;
  }
}

@media (max-width: 720px) {
  .app-header,
  .top-strip,
  .panel-title-row,
  .preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-heading {
    align-items: flex-start;
  }

  .brand-banner {
    min-height: 0;
  }

  .banner-copy h2 {
    font-size: 26px;
  }

  .app-header {
    padding: 20px;
  }

  .top-strip {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px 20px;
  }

  .app-shell {
    padding: 14px;
  }

  .form-grid,
  .checks-grid {
    grid-template-columns: 1fr;
  }

  .proposal-cover {
    min-height: 260px;
    padding: 28px;
  }

  .proposal-cover h2 {
    font-size: 30px;
  }
}

@media print {
  body {
    background: var(--white);
  }

  .top-strip,
  .app-header,
  .brand-banner,
  .history-panel,
  .proposal-form,
  .preview-toolbar {
    display: none;
  }

  .app-shell,
  .workspace,
  .preview-shell {
    display: block;
    padding: 0;
  }

  .preview-shell {
    border: 0;
    box-shadow: none;
  }

  .proposal-cover {
    break-after: page;
    border-top-color: var(--navy);
    min-height: 78vh;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

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