:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #17202f;
  --muted: #627083;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-dark: #0a5a54;
  --danger: #b42318;
  --soft: #eef8f6;
  --shadow: 0 18px 48px rgba(21, 31, 46, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle,
.status-pill,
.hero p,
.panel-heading p,
.field span,
.doc-footer {
  color: var(--muted);
}

.status-pill {
  border: 1px solid #b8d9d4;
  background: var(--soft);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.workspace {
  padding: 28px clamp(16px, 4vw, 44px) 44px;
  max-width: 1480px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: end;
  margin-bottom: 22px;
}

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

h1 {
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.02;
  margin: 0 0 14px;
}

.hero p {
  max-width: 760px;
  margin: 0;
  line-height: 1.7;
}

.safety-box {
  padding: 18px;
  border: 1px solid #ffd1cc;
  border-left: 5px solid var(--danger);
  background: #fff7f6;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  line-height: 1.55;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 20px;
}

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

h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.panel-heading p {
  margin: 0;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 7px;
  padding: 11px 12px;
  outline: none;
  color: var(--ink);
}

textarea {
  min-height: 78px;
  resize: vertical;
}

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

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 10px 8px;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 7px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  border-color: var(--accent);
}

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

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

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 20px;
}

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

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-control button {
  width: 36px;
  height: 36px;
  padding: 0;
}

#zoom-label {
  min-width: 54px;
  text-align: center;
  font-weight: 800;
}

.preview-shell {
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(45deg, rgba(15, 118, 110, 0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 118, 110, 0.06) 25%, transparent 25%),
    #e9eef3;
  border-radius: 8px;
  border: 1px solid var(--line);
  min-height: 720px;
}

.document {
  position: relative;
  width: 760px;
  min-height: 980px;
  margin: 0 auto;
  padding: 42px 46px;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  transform-origin: top center;
  overflow: hidden;
}

.doc-watermark {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  transform: rotate(-28deg);
  color: rgba(180, 35, 24, 0.12);
  font-weight: 900;
  font-size: 46px;
  text-align: center;
  line-height: 1.25;
  pointer-events: none;
}

.doc-top-warning {
  position: relative;
  z-index: 1;
  margin: -42px -46px 30px;
  padding: 11px 18px;
  background: var(--danger);
  color: white;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.doc-header,
.doc-banner,
.doc-recipient,
.doc-table,
.doc-total,
.doc-footer {
  position: relative;
  z-index: 1;
}

.doc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid #14213d;
  padding-bottom: 24px;
}

.fictional-logo {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  background: #14213d;
  color: white;
  border-radius: 8px;
  font-size: 26px;
  font-weight: 900;
}

.doc-header h3 {
  margin: 0 0 6px;
  font-size: 27px;
}

.doc-header p,
.doc-recipient p,
.doc-footer p {
  margin: 0;
}

.doc-banner {
  margin: 28px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef4f8;
  border: 1px solid #cfdbe7;
}

.doc-banner div {
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}

.doc-banner div:first-child {
  border-right: 1px solid #cfdbe7;
}

.doc-banner span {
  color: #607086;
  font-size: 12px;
  text-transform: uppercase;
}

.doc-recipient {
  margin-bottom: 30px;
}

.doc-recipient h4 {
  margin: 6px 0 8px;
  font-size: 22px;
}

.doc-table {
  border: 1px solid #cfdbe7;
}

.row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid #cfdbe7;
}

.row:last-child {
  border-bottom: 0;
}

.row.head {
  background: #14213d;
  color: white;
  font-weight: 850;
}

.row.muted {
  color: #607086;
}

.row span:last-child {
  text-align: right;
}

.doc-total {
  margin: 26px 0 34px auto;
  width: 360px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-top: 3px solid #14213d;
  background: #f8fafc;
  font-size: 18px;
}

.doc-footer {
  border-top: 1px solid #cfdbe7;
  padding-top: 18px;
  line-height: 1.55;
}

.doc-disclaimer {
  margin-top: 14px !important;
  color: var(--danger);
  font-weight: 800;
}

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

  .safety-box {
    max-width: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .two-cols,
  .actions {
    grid-template-columns: 1fr;
  }

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

  .preview-shell {
    padding: 12px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .hero,
  .form-panel,
  .preview-panel > .panel-heading {
    display: none !important;
  }

  .workspace,
  .app-grid,
  .preview-panel,
  .preview-shell {
    display: block;
    padding: 0;
    margin: 0;
    max-width: none;
    border: 0;
    box-shadow: none;
    background: white;
  }

  .document {
    transform: none !important;
    width: 100%;
    min-height: 0;
    box-shadow: none;
    page-break-after: avoid;
  }
}
