:root {
  --ink: #17223b;
  --muted: #657188;
  --line: #dbe1ea;
  --paper: #ffffff;
  --canvas: #edf1f6;
  --blue: #204b93;
  --blue-dark: #17396f;
  --blue-pale: #eaf1ff;
  --warning: #8a4b08;
  --warning-bg: #fff5df;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(39, 85, 164, .08), transparent 30rem),
    var(--canvas);
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-header {
  min-height: 142px;
  padding: 32px clamp(24px, 5vw, 72px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  color: white;
  background: linear-gradient(120deg, #132e5a, #2455a0 68%, #2a63ba);
  border-bottom: 4px solid #9bb8e9;
}
.eyebrow { margin: 0 0 7px; color: #b9cff4; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.app-header h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }
.subtitle { margin: 9px 0 0; color: #d6e2f8; }
.privacy { display: flex; gap: 8px; align-items: center; white-space: nowrap; font-size: 13px; color: #dfe9fa; }
.privacy span { width: 8px; height: 8px; border-radius: 50%; background: #70d5a3; box-shadow: 0 0 0 4px rgba(112, 213, 163, .14); }

.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.controls { display: grid; gap: 16px; position: sticky; top: 18px; }
.panel {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 9px 22px rgba(25, 43, 72, .055);
}
.step-label { margin-bottom: 13px; color: var(--blue); font-size: 13px; font-weight: 800; }

.dropzone {
  min-height: 210px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed #8ea5c9;
  border-radius: 12px;
  background: #f8faff;
  transition: .18s ease;
}
.dropzone.is-dragging { border-color: var(--blue); background: var(--blue-pale); transform: translateY(-2px); }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-mark {
  width: 42px; height: 42px; margin-bottom: 14px;
  display: grid; place-items: center;
  border-radius: 12px; color: white; background: var(--blue);
  font-size: 28px; line-height: 1;
}
.dropzone strong { font-size: 15px; }
.dropzone span { margin: 7px 0 15px; color: var(--muted); font-size: 12px; }
.dropzone button { padding: 8px 14px; border: 1px solid #9bb0d1; border-radius: 8px; color: var(--blue-dark); background: white; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 7px; }
.file-list li { padding: 9px 10px; display: flex; justify-content: space-between; gap: 8px; border-radius: 8px; background: #f4f6fa; font-size: 12px; }
.file-list small { color: var(--muted); white-space: nowrap; }

.form-panel { display: grid; gap: 11px; }
.form-panel .step-label { margin-bottom: 2px; }
.form-panel label { display: grid; gap: 5px; color: #46536a; font-size: 12px; font-weight: 700; }
.form-panel input { width: 100%; padding: 10px 11px; border: 1px solid #ccd4e1; border-radius: 8px; background: white; color: var(--ink); }
.form-panel input:focus { outline: 2px solid #a9c2ed; border-color: var(--blue); }

.primary, .secondary { width: 100%; min-height: 45px; border-radius: 9px; font-weight: 800; }
.primary { border: 0; color: white; background: var(--blue); }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.primary:disabled { cursor: not-allowed; opacity: .45; }
.secondary { margin-top: 9px; border: 1px solid #8ca3c7; color: var(--blue-dark); background: white; }
.status { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.warnings-panel { color: var(--warning); background: var(--warning-bg); border-color: #efd7aa; }
.warnings-panel ul { padding-left: 18px; margin: 0; font-size: 12px; line-height: 1.6; }

.preview-shell { min-width: 0; }
.preview-toolbar { display: flex; justify-content: space-between; padding: 0 4px 10px; color: var(--muted); font-size: 12px; }
.report-paper {
  width: min(210mm, 100%);
  min-height: 297mm;
  margin: 0 auto;
  padding: 25.4mm;
  color: #000;
  background: var(--paper);
  box-shadow: 0 18px 45px rgba(23, 34, 59, .15);
}
.report-paper h2 { margin: 0 0 20px; font-size: 21pt; line-height: 1; letter-spacing: -.04em; }
.report-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 25px; font-size: 10.7pt; }
.report-meta span { display: inline-flex; gap: 9px; }
.report-meta b { font-weight: 700; }
.report-meta i { font-style: normal; }
.report-section { margin-top: 16px; }
.report-section h3 { margin: 0 0 8px; font-size: 14pt; line-height: 1.2; }
.editable { min-height: 25px; padding: 2px 0; font-size: 10.5pt; line-height: 1.62; white-space: pre-wrap; }
.editable:focus, .receipt-note:focus { outline: 2px solid #b3c8ee; outline-offset: 3px; border-radius: 2px; }
.editable p { margin: 0 0 5px; }
.editable ul { margin: 0; padding-left: 21px; }
.editable li { margin-bottom: 5px; }
.receipt-note { margin: 14px 0 0; font-size: 9.5pt; }
.report-footer { margin-top: 26px; padding-top: 9px; display: flex; justify-content: space-between; border-top: 1px solid #d9d9d9; color: #777; font-size: 8pt; }

@media (max-width: 980px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .controls { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .controls .panel:first-child { grid-row: span 2; }
  .report-paper { padding: 18mm 14mm; }
}
@media (max-width: 640px) {
  .workspace { padding: 14px; }
  .controls { grid-template-columns: 1fr; }
  .app-header { padding: 24px 20px; }
  .privacy { white-space: normal; }
  .report-paper { min-height: 0; padding: 12mm 9mm; }
  .report-meta { display: grid; gap: 6px; }
}

@page { size: A4; margin: 0; }
@media print {
  html, body { background: white; }
  .no-print { display: none !important; }
  .workspace { display: block; max-width: none; padding: 0; }
  .preview-shell { width: 100%; }
  .report-paper { width: 210mm; min-height: 297mm; margin: 0; padding: 25.4mm; box-shadow: none; }
  .editable:focus, .receipt-note:focus { outline: none; }
  .report-section { break-inside: avoid; }
}
