:root {
  --navy: #0d1b2e;
  --navy-mid: #152540;
  --blue: #1a5fa8;
  --gold: #c9a84c;
  --gold-light: #e0bf72;
  --off-white: #f5f3ef;
  --paper: #fffdf9;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #d9d4c8;
  --ok: #1f7a4d;
  --warn: #9a6b00;
  --err: #b3261e;
  --radius: 8px;
  --wrap: 860px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--blue); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* header */
.masthead {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(201, 168, 76, 0.25);
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em;
}
.masthead nav a {
  color: rgba(255, 255, 255, 0.8); text-decoration: none;
  margin-left: 1.25rem; font-size: 0.9rem;
}
.masthead nav a:hover { color: var(--gold-light); }

/* intro */
.intro { padding: 48px 0 28px; }
.intro h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700; font-size: 1.9rem; color: var(--navy);
  line-height: 1.2; margin-bottom: 0.5rem;
}
.intro p { color: var(--muted); max-width: 46em; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); }
.tab {
  font: inherit; cursor: pointer; background: none; border: 0;
  padding: 10px 16px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover:not(:disabled) { color: var(--navy); }
.tab.is-active { color: var(--navy); font-weight: 600; border-bottom-color: var(--gold); }
.tab:disabled { cursor: not-allowed; opacity: 0.55; }
.soon {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--border); color: var(--navy); border-radius: 999px;
  padding: 1px 7px; margin-left: 4px;
}

/* panels */
.panel { display: none; padding: 28px 0 60px; }
.panel.is-active { display: block; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--paper); padding: 40px 20px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.is-drag { border-color: var(--gold); background: #fff; }
.drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-label { color: var(--muted); }
.drop-file { font-weight: 600; color: var(--navy); }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  margin-top: 16px; padding: 10px 22px; border: 0; border-radius: var(--radius);
  background: var(--navy); color: #fff;
}
.btn:hover { background: var(--navy-mid); }
.btn[disabled] { opacity: 0.5; cursor: progress; }

/* results */
.result { margin-top: 24px; }
.verdict {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 1.1rem; padding: 12px 16px;
  border-radius: var(--radius); border: 1px solid;
}
.verdict.ok { color: var(--ok); border-color: var(--ok); background: #eef7f1; }
.verdict.bad { color: var(--err); border-color: var(--err); background: #fbeeed; }
.meta { color: var(--muted); font-size: 0.85rem; margin: 8px 2px 18px; }

.stage { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; background: var(--paper); }
.stage > h3 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.95rem; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.pill { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 9px; border-radius: 999px; }
.pill.passed { background: #eef7f1; color: var(--ok); }
.pill.failed { background: #fbeeed; color: var(--err); }
.pill.skipped { background: var(--border); color: var(--navy); }

.finding { padding: 9px 14px; border-bottom: 1px solid var(--off-white); font-size: 0.88rem; }
.finding:last-child { border-bottom: 0; }
.finding .sev { font-weight: 600; margin-right: 6px; }
.finding .sev.error, .finding .sev.fatal { color: var(--err); }
.finding .sev.warning { color: var(--warn); }
.finding .sev.info { color: var(--blue); }
.finding code { background: var(--off-white); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.finding .loc { color: var(--muted); display: block; margin-top: 2px; font-size: 0.8rem; }

pre.xml {
  background: var(--navy); color: #e8e6df; padding: 16px; border-radius: var(--radius);
  overflow-x: auto; font-size: 0.8rem; line-height: 1.5; max-height: 420px;
}

.error-box { color: var(--err); border: 1px solid var(--err); background: #fbeeed; padding: 12px 16px; border-radius: var(--radius); }

/* invoice preview */
.invoice-doc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); padding: 22px 24px; }
.invoice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.invoice-number { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 1.3rem; color: var(--navy); }

.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; }
.party h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.party-name { font-weight: 600; color: var(--navy); }
.muted { color: var(--muted); font-size: 0.85rem; }

.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 0.9rem; }
.invoice-table th, .invoice-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.invoice-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.invoice-table td:nth-child(3), .invoice-table td:nth-child(4), .invoice-table td:nth-child(5),
.invoice-table th:nth-child(3), .invoice-table th:nth-child(4), .invoice-table th:nth-child(5) { text-align: right; }
.invoice-vat td:nth-child(2), .invoice-vat th:nth-child(2) { text-align: right; }

.invoice-totals { max-width: 320px; margin-left: auto; }
.invoice-totals div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.9rem; }
.invoice-totals .grand { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.invoice-terms { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }

@media (max-width: 640px) {
  .invoice-parties { grid-template-columns: 1fr; }
  .invoice-totals { max-width: none; }
}

/* convert form */
.convert-form h3 {
  font-family: 'Playfair Display', Georgia, serif; color: var(--navy); font-size: 1.05rem;
  margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--border);
}
.convert-form h3:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.form-grid label {
  display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--muted);
}
.convert-form input {
  font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); width: 100%;
}
.convert-form input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }

.line-row {
  display: grid; grid-template-columns: 2fr 0.8fr 0.8fr 1fr 0.7fr auto;
  gap: 8px; margin-bottom: 8px; align-items: center;
}
.line-row-head span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

.btn-secondary {
  font: inherit; cursor: pointer; padding: 7px 14px; margin: 4px 0 20px;
  border: 1px solid var(--navy); border-radius: var(--radius); background: none;
  color: var(--navy); font-weight: 600;
}
.btn-secondary:hover { background: var(--off-white); }

.btn-remove {
  font: inherit; cursor: pointer; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: #fff; color: var(--err);
  line-height: 1;
}
.btn-remove:hover { border-color: var(--err); }
.btn-remove:disabled { opacity: 0.35; cursor: not-allowed; }

@media (max-width: 720px) {
  .line-row, .line-row-head { grid-template-columns: 1fr 1fr; }
  .line-row-head { display: none; }
}

.foot {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 0.8rem; padding-top: 20px; padding-bottom: 40px;
  border-top: 1px solid var(--border);
}
