:root {
  --navy: #123a63;
  --line: #8aa0b8;
  --muted: #4a5560;
  --fill: #f3f7fb;
  --gold: #e0b000;
  --ok: #0f7b3b;
  --err: #b42318;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #d9e2ec;
  color: #1c1c1c;
  font-family: "Calibri", "Segoe UI", Arial, sans-serif;
}
a { color: var(--navy); }
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
}
.toolbar a { color: #fff; text-decoration: none; font-weight: 600; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar button, .btn {
  background: var(--gold);
  color: #1a1a1a;
  border: 0;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
}
.toolbar button.secondary, .btn.secondary { background: #fff; }
.btn.ok { background: #1f9d55; color: #fff; }
.bottom-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 210mm;
  margin: 0 auto 20px;
  padding: 14px 16px;
  background: #123a63;
  box-shadow: 0 -4px 18px rgba(0,0,0,.18);
  border-radius: 8px 8px 0 0;
}
.bottom-actions .btn {
  min-width: 160px;
  padding: 12px 20px;
  font-size: 15px;
  border: 0;
  cursor: pointer;
}
.bottom-actions .print-btn {
  background: #e0b000;
  color: #1a1a1a;
}
.bottom-actions .save-btn {
  background: #1f9d55;
  color: #fff;
}
.bottom-actions .secondary {
  background: #fff;
  color: #123a63;
}
.sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 12px auto;
  background: #fff;
  padding: 12mm 14mm;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  page-break-after: always;
}
.sheet:last-of-type { page-break-after: auto; }
.panel {
  max-width: 1100px;
  margin: 16px auto;
  background: #fff;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  border-radius: 6px;
}
.letterhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--navy);
  padding-bottom: 8px;
  margin-bottom: 10px;
  gap: 12px;
}
.letterhead img, .logo { height: 46px; }
.company-meta {
  text-align: right;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.company-meta strong {
  display: block;
  color: var(--navy);
  font-size: 13px;
}
h1 {
  text-align: center;
  font-size: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 8px 0 6px;
  border: 1px solid var(--navy);
  padding: 5px;
}
.panel h1 { text-align: left; border: 0; padding: 0; text-transform: none; letter-spacing: 0; font-size: 22px; }
.intro { font-size: 12px; color: var(--muted); margin: 0 0 10px; text-align: center; }
h2 {
  font-size: 13px;
  color: #fff;
  background: var(--navy);
  margin: 12px 0 0;
  padding: 5px 8px;
}
table.form {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.form th, table.form td {
  border: 1px solid var(--line);
  padding: 5px 8px;
  vertical-align: middle;
}
table.form th {
  background: var(--fill);
  color: var(--navy);
  font-weight: 700;
  text-align: left;
  width: 34%;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="password"],
input[type="month"],
select,
textarea {
  width: 100%;
  border: 1px solid #9bb0c4;
  outline: none;
  background: #fff;
  font: inherit;
  padding: 6px 8px;
  color: #111;
  border-radius: 3px;
  min-height: 34px;
}
table.form th, table.form td {
  border: 1px solid var(--line);
  padding: 6px 6px;
  vertical-align: middle;
}
table.form input,
table.form select,
table.form textarea {
  border: 1px solid #8aa0b8;
  background: #fff;
}
table.pay {
  table-layout: fixed;
  width: 100%;
}
table.pay th {
  width: auto;
  font-size: 11px;
  text-align: center;
  padding: 8px 4px;
}
table.pay td {
  text-align: center;
  padding: 6px 4px;
  background: #fff;
}
table.pay td:nth-child(1) { width: 4%; }
table.pay td:nth-child(2),
table.pay th:nth-child(2) { width: 14%; }
table.pay td:nth-child(3),
table.pay th:nth-child(3) { width: 10%; }
table.pay input[type="number"] {
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 6px 2px;
  font-size: 13px;
  -moz-appearance: textfield;
  appearance: textfield;
}
table.pay input[type="number"]::-webkit-outer-spin-button,
table.pay input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
table.pay select {
  width: 100%;
  font-size: 12px;
  padding: 6px 4px;
  background: #fffbe6;
  border: 1px solid #c9a227;
}
.pay-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fff;
}
.checks { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; align-items: center; }
.checks label { display: inline-flex; gap: 5px; align-items: center; }
.tiny { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.hint { font-size: 10.5px; color: #667; font-weight: 400; }
textarea { min-height: 42px; resize: vertical; }
.panel input, .panel select, .login-card input {
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 4px;
  background: #fff;
}
.my-wrap {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 4px;
}
.sig {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  font-size: 12.5px;
  gap: 16px;
}
.sig .col { width: 48%; }
.sig .space {
  height: 22mm;
  border-bottom: 1px solid #c9d6e5;
  margin: 4mm 0 2mm;
}
.footer-note {
  margin-top: 14px;
  font-size: 10px;
  color: #667;
  border-top: 1px solid #c9d6e5;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.flash {
  max-width: 210mm;
  margin: 12px auto 0;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 14px;
}
.flash.ok { background: #e8f8ef; color: var(--ok); border: 1px solid #9ad4b2; }
.flash.err { background: #fdeceb; color: var(--err); border: 1px solid #f0b4ae; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}
.data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.data-table th { background: var(--navy); color: #fff; }
.data-table tr:nth-child(even) { background: #f7fafc; }
.data-table .actions a { margin-right: 8px; }
.login-card {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  padding: 28px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  text-align: center;
}
.login-card form { display: grid; gap: 10px; margin-top: 12px; }
.err { color: var(--err); }
.badge {
  display: inline-block;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  margin: 2px;
}
@media print {
  body { background: #fff; }
  .toolbar, .flash, .no-print { display: none !important; }
  .sheet { margin: 0; box-shadow: none; }
}
@media (max-width: 900px) {
  .sheet { width: auto; margin: 8px; padding: 16px; min-height: 0; }
  .letterhead { flex-direction: column; align-items: flex-start; }
  .company-meta { text-align: left; }
  .data-table { font-size: 12px; display: block; overflow-x: auto; }
}
