:root { --sunds: #003a6b; --line: #ccc; }
* { box-sizing: border-box; }
body { margin: 0; background: #e9edf2; font-family: "Segoe UI", Arial, sans-serif; color: #111; }
.sheet {
  background: #fff; max-width: 210mm; margin: 14px auto; padding: 18mm 16mm;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-bottom: 2px solid var(--sunds); padding-bottom: 6mm; margin-bottom: 8mm;
}
.logo { height: 58px; width: auto; display: block; }
.header-meta { font-size: 9pt; color: #666; }
h1.doc-title { font-size: 19pt; color: var(--sunds); margin: 0 0 7mm; }

table.fields { width: 100%; border-collapse: collapse; margin-bottom: 5mm; }
/* Tvåkolumns-layout: etiketter krymper till innehåll (en rad, ingen radbrytning),
   inputs delar resterande bredd. Gap före kolumn 2. */
table.fields th {
  text-align: left; width: 1%; white-space: nowrap;
  padding: 2.5mm 3mm 2.5mm 7mm; vertical-align: middle;
  border-bottom: 1px solid var(--line); font-size: 10pt;
}
table.fields tr > th:first-child { padding-left: 0; }
table.fields td { width: 49%; padding: 1.5mm 4mm 1.5mm 0; border-bottom: 1px solid var(--line); }
table.fields th.grp { vertical-align: top; color: var(--sunds); white-space: normal; }
table.sub { margin: 0; }
table.sub th, table.sub td { border-bottom: 1px dotted #ddd; font-size: 10pt; }

input[type=text] {
  width: 100%; border: 1px solid #bcc6d2; border-radius: 4px;
  padding: 4px 7px; font: inherit; font-size: 10.5pt; background: #fbfcfd;
}
input[type=text]:focus { outline: 2px solid var(--sunds); background: #fff; }
select {
  width: 100%; max-width: 70mm; border: 1px solid #bcc6d2; border-radius: 4px;
  padding: 4px 7px; font: inherit; font-size: 10.5pt; background: #fbfcfd;
}
select:focus { outline: 2px solid var(--sunds); background: #fff; }
.fixed-text { color: #333; font-size: 10pt; }

.statement {
  font-style: italic; margin: 6mm 0; padding: 4mm 5mm;
  background: #f4f6f9; border-left: 3px solid var(--sunds);
}

.choice-group { display: flex; gap: 14px; flex-wrap: wrap; }
.choice {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 4px 10px; border: 1px solid #bcc6d2; border-radius: 6px;
  background: #fbfcfd; user-select: none; font-size: 10.5pt;
}
.choice:hover { border-color: var(--sunds); }
.choice.selected { background: var(--sunds); color: #fff; border-color: var(--sunds); }
.choice .box { font-size: 13pt; line-height: 1; }
.choice.hidden { display: none; }

.rows-table { margin-bottom: 3mm; }
.rows-table thead th {
  background: var(--sunds); color: #fff; font-size: 9pt; padding: 2mm 3mm; width: auto;
}
.rows-table td { padding: 1mm 2mm; }
.rows-table input { font-size: 9.5pt; }
.delrow { border: 0; background: #b00020; color: #fff; border-radius: 4px; cursor: pointer; padding: 2px 8px; }
.addrow {
  border: 1px solid var(--sunds); background: #fff; color: var(--sunds);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font: inherit; font-weight: 600;
}
.addrow:hover { background: #e8f0f8; }

.signature-section { margin-top: 12mm; }
.signature-section h2 {
  font-size: 12pt; border-bottom: 1px solid var(--sunds); padding-bottom: 1.5mm; margin-bottom: 6mm;
}
.sig-grid { display: flex; gap: 14mm; flex-wrap: wrap; }
.sig-block { flex: 1; min-width: 60mm; }
.sig-role { font-weight: 700; color: var(--sunds); margin-bottom: 3mm; }
.sig-place { margin-bottom: 3mm; }
.sig-date { width: 48mm; }
.sig-signer { width: 60mm; }
.role-input { width: 55mm; }
.sig-line { border-top: 1px solid #444; width: 70mm; margin: 12mm 0 1.5mm; }
.sig-name { font-weight: 700; min-height: 1.4em; }

.toolbar {
  position: sticky; top: 0; background: var(--sunds); color: #fff;
  padding: 10px 18px; display: flex; gap: 10px; align-items: center; z-index: 10;
}
.toolbar b { margin-right: auto; font-size: 14px; }
.toolbar button {
  border: 0; border-radius: 6px; padding: 8px 14px; font: inherit; font-weight: 600;
  cursor: pointer; background: #fff; color: var(--sunds);
}
.toolbar button:hover { background: #d8e3f0; }
.toolbar .uploadbtn {
  border: 0; border-radius: 6px; padding: 8px 14px; font: inherit; font-weight: 600;
  cursor: pointer; background: #fff; color: var(--sunds);
}
.toolbar .uploadbtn:hover { background: #d8e3f0; }

@media print {
  body { background: #fff; }
  .toolbar, .addrow, .delrow { display: none; }
  .sheet { box-shadow: none; margin: 0; max-width: none; padding: 0; }
  input[type=text] { border: none; background: none; padding: 0; }
  .choice { border: none; padding: 0; }
  .choice.hidden { display: none; }
}
