/* Cumarex S.A. Vendor Self-Assessment — oceanic, editorial */

:root {
  --accent: #0a4f6e;          /* deep ocean */
  --accent-soft: #0a4f6e14;
  --accent-line: #0a4f6e22;
  --ink: #0e1b22;
  --ink-2: #3c4d56;
  --ink-3: #6b7d87;
  --line: #d9dfe2;
  --line-2: #e8ecee;
  --bg: #f4f1ea;              /* sand / paper */
  --paper: #fcfaf6;
  --foam: #eef3f5;
  --warn: #b54d2a;
  --ok: #1d6b4f;
  --ff-display: "GT Sectra", "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --ff-body: "Inter Tight", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: 1rem;
  --radius: 6px;
  --pad-section: 28px;
  --gap-row: 14px;
}

[data-density="compact"] { --pad-section: 18px; --gap-row: 10px; }
[data-density="comfy"]   { --pad-section: 38px; --gap-row: 18px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

/* ── Wave background ─────────────────────────────────────────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -10%, #cfdde3 0%, transparent 60%),
    radial-gradient(900px 500px at 0% 110%, #e3dccb 0%, transparent 55%);
}
.bg svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .35; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.shell { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 32px 24px 80px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-mark .crest {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  overflow: hidden;
}
.brand-mark .crest svg { width: 20px; height: 20px; }
.brand-mark .crest img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-mark .name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-mark .since {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 1px;
}

.lang-switch {
  display: flex; align-items: center; gap: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.lang-switch button {
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--ink-2);
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--accent); color: #fff;
}

/* ── Document header ─────────────────────────────────────────────────────── */
.doc-head {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 40px 32px;
  position: relative;
  overflow: hidden;
}
.doc-head::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent);
}
.doc-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}
.doc-title {
  font-family: var(--ff-display);
  font-size: 38px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
  text-wrap: balance;
}
.doc-subtitle {
  color: var(--ink-2);
  font-size: 15px;
  max-width: 56ch;
  margin: 0 0 24px;
  text-wrap: pretty;
}
.doc-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  border-top: 1px solid var(--line-2);
  padding-top: 18px;
  font-size: 12px;
}
.doc-meta .lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
  font-weight: 500;
}
.doc-meta .val {
  font-family: var(--ff-mono);
  color: var(--ink);
  font-size: 12px;
}

/* ── Progress ────────────────────────────────────────────────────────────── */
.progress-bar {
  margin: 20px 0 24px;
  display: flex; align-items: center; gap: 14px;
  font-size: 12px;
  color: var(--ink-2);
}
.progress-bar .track {
  flex: 1; height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  transition: width .3s cubic-bezier(.3,.7,.4,1);
  border-radius: 999px;
}
.progress-bar .pct {
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink);
  min-width: 36px;
  text-align: right;
}
.progress-bar .lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color .2s;
}
.section[data-complete="1"] { border-color: var(--accent-line); }
.section-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(to bottom, var(--foam), transparent);
}
.section-num {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  width: 36px; height: 36px;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
}
.section[data-complete="1"] .section-num {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.section-title {
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  color: var(--ink);
}
.section-desc { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.section-status { color: var(--accent); display: grid; place-items: center; width: 20px; height: 20px; }
.section-body { padding: var(--pad-section) 28px; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap-row);
  margin-bottom: var(--gap-row);
}
.row:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }
.field.span-6 { grid-column: span 6; }
.field.span-8 { grid-column: span 8; }
.field.span-9 { grid-column: span 9; }
.field.span-12 { grid-column: span 12; }

.field-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
  display: flex; align-items: center; gap: 4px;
}
.field-label .req { color: var(--warn); font-style: normal; font-weight: 700; }
.field-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }

.input {
  width: 100%;
  font: inherit; font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: #b9c2c7; }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 78px; line-height: 1.5; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute; right: 12px; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select { appearance: none; padding-right: 30px; cursor: pointer; }

/* ── Checkboxes / pills ──────────────────────────────────────────────────── */
.check-grid { display: grid; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.check:hover { border-color: #b9c2c7; background: #fcfdfd; }
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  background: #fff;
  display: grid; place-items: center;
  color: transparent;
  flex-shrink: 0;
}
.check.on .check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.check-label { font-size: 13.5px; color: var(--ink); line-height: 1.3; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all .12s;
}
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:hover { border-color: #b9c2c7; }
.pill.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── File drop ───────────────────────────────────────────────────────────── */
.filedrop {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}
.filedrop:hover, .filedrop.hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.filedrop.has-file { border-style: solid; background: var(--foam); }
.filedrop-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.filedrop-body { flex: 1; min-width: 0; }
.filedrop-label {
  font-size: 13.5px; font-weight: 500; color: var(--ink); margin-bottom: 2px;
}
.filedrop-hint {
  font-size: 12px; color: var(--ink-3);
  font-family: var(--ff-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filedrop.has-file .filedrop-hint { color: var(--accent); }
.filedrop-clear {
  appearance: none; border: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink-3);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: grid; place-items: center;
}
.filedrop-clear:hover { background: var(--ink); }

/* ── Reference card ──────────────────────────────────────────────────────── */
.ref-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fcfdfd;
  margin-bottom: 12px;
}
.ref-card-head {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}

/* ── Declaration ─────────────────────────────────────────────────────────── */
.declaration {
  background: var(--foam);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Sticky action bar ───────────────────────────────────────────────────── */
.actions {
  position: sticky; bottom: 16px;
  margin-top: 22px;
  display: flex; gap: 10px; align-items: center;
  padding: 14px 18px;
  background: rgba(252, 250, 246, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px -8px rgba(14, 27, 34, 0.18);
}
.actions .req-note {
  flex: 1;
  font-size: 11.5px;
  color: var(--ink-3);
}
.btn {
  appearance: none;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all .12s;
  letter-spacing: 0.01em;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover { background: #073a52; border-color: #073a52; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); border-color: transparent; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.footer .conf {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 500;
}

/* ── Toast / confirmation ────────────────────────────────────────────────── */
.toast-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(14, 27, 34, 0.4);
  display: grid; place-items: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.toast {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 420px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(14, 27, 34, 0.3);
  animation: pop .25s cubic-bezier(.3,.7,.4,1);
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.toast h3 {
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.toast p { color: var(--ink-2); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.toast .actions-row { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Print: single A4 page with branded header ────────────────────────── */
@page {
  size: A4 portrait;
  margin: 12mm 12mm 10mm 12mm;
}

/* Print-only header (hidden on screen) */
.print-header { display: none; }

@media print {
  /* Reset page */
  html, body { background: #fff !important; }
  body { font-size: 8.5pt; line-height: 1.28; color: #111; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Hide all interactive / decorative chrome */
  .bg, .topbar, .progress-bar, .actions, .twk-panel,
  .footer, .risk-banner, .doc-eyebrow, .doc-subtitle,
  .toast-back, .toast,
  .shell > p:last-child { display: none !important; }

  /* Page container */
  .shell {
    padding: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }

  /* Branded print header */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 0 8px 0;
    margin: 0 0 10px 0;
    border-bottom: 1.5pt solid #0a4f6e;
  }
  .print-header .ph-left { display: flex; align-items: center; gap: 12px; }
  .print-header img.ph-logo {
    width: 42px; height: 42px; object-fit: contain;
  }
  .print-header .ph-name {
    font-family: var(--ff-display);
    font-size: 14pt; font-weight: 600; color: #0a4f6e;
    letter-spacing: 0.02em;
    line-height: 1;
  }
  .print-header .ph-tag {
    font-size: 7.5pt; color: #555; margin-top: 3px;
    text-transform: uppercase; letter-spacing: 0.12em;
  }
  .print-header .ph-meta {
    text-align: right; font-size: 7.5pt; color: #333;
    font-family: var(--ff-mono);
    line-height: 1.4;
  }
  .print-header .ph-meta strong { color: #0a4f6e; font-weight: 600; }
  .print-header .ph-title {
    font-family: var(--ff-display);
    font-size: 11pt; font-weight: 500; color: #111;
    margin-top: 2px;
  }

  /* Document head: keep just the title compact, hide the meta box */
  .doc-head { padding: 0 !important; margin: 0 0 6px 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
  .doc-title { font-size: 12pt !important; margin: 0 0 4px 0 !important; }
  .doc-meta { display: none !important; }

  /* Sections — tight, no shadows, no breaks */
  .section {
    box-shadow: none !important;
    border: 0.5pt solid #c8ced1 !important;
    border-radius: 3pt !important;
    margin: 0 0 5pt 0 !important;
    background: #fff !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .section-head {
    padding: 4pt 8pt !important;
    gap: 6pt !important;
    border-bottom: 0.5pt solid #e2e6e8 !important;
    background: #f6f4ee !important;
  }
  .section-head .section-index {
    font-size: 7.5pt !important;
    width: 16pt !important; height: 16pt !important;
    flex: 0 0 auto !important;
  }
  .section-title { font-size: 9.5pt !important; margin: 0 !important; }
  .section-desc { font-size: 7.5pt !important; margin: 1pt 0 0 0 !important; color: #666 !important; }
  .section-status, .section-head svg.check { display: none !important; }
  .section-body { padding: 5pt 8pt !important; }

  /* Rows tighter */
  .row { gap: 5pt !important; margin: 0 0 4pt 0 !important; }
  .field { gap: 1pt !important; }
  .field-label { font-size: 7pt !important; letter-spacing: 0.06em !important; }
  .field-hint { display: none !important; }

  /* Inputs: render values, drop big chrome */
  .input, input, select, textarea {
    border: 0 !important;
    border-bottom: 0.5pt solid #aaa !important;
    border-radius: 0 !important;
    padding: 1pt 0 !important;
    background: transparent !important;
    font-size: 8.5pt !important;
    min-height: 0 !important;
    box-shadow: none !important;
  }
  textarea { min-height: 22pt !important; }

  /* Pills — show selected state only */
  .pill-group { gap: 4pt !important; flex-wrap: wrap; }
  .pill {
    border: 0.5pt solid #c8ced1 !important;
    background: #fff !important;
    color: #555 !important;
    padding: 1pt 5pt !important;
    font-size: 7.5pt !important;
    border-radius: 8pt !important;
    box-shadow: none !important;
  }
  .pill[aria-pressed="true"], .pill.on {
    background: #0a4f6e !important;
    color: #fff !important;
    border-color: #0a4f6e !important;
  }

  /* Checkbox */
  .check { padding: 2pt 0 !important; background: transparent !important; border: 0 !important; }
  .check-box { width: 9pt !important; height: 9pt !important; }
  .check-label { font-size: 8pt !important; }
  .declaration { font-size: 7.5pt !important; padding: 4pt 6pt !important; margin: 0 0 4pt 0 !important; }

  /* Squeeze it all */
  .shell, .section, .doc-head { font-size: 8.5pt !important; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .shell { padding: 16px 12px 60px; }
  .doc-head { padding: 24px 20px; }
  .doc-title { font-size: 28px; }
  .doc-meta { grid-template-columns: repeat(2, 1fr); }
  .section-head { padding: 16px 18px; gap: 12px; }
  .section-body { padding: 22px 18px; }
  .field.span-3, .field.span-4, .field.span-6, .field.span-8, .field.span-9 { grid-column: span 12; }
  .check-grid { grid-template-columns: 1fr 1fr !important; }
  .actions { flex-wrap: wrap; }
  .actions .req-note { flex-basis: 100%; order: -1; }
}
