:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #5b6878;
  --line: #d8dee7;
  --line-strong: #b7c1cd;
  --accent: #1f4e79;
  --accent-soft: #eaf1f8;
  --ok: #1a7f52;
  --warn: #9a6b00;
  --err: #b42318;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

/* ---- Toolbar (netlačí sa) ---- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.toolbar .brand {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .3px;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar .brand small { font-weight: 500; color: var(--muted); }

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: #f3f6fa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #18446a; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f0f3f7; }

/* ---- Rozloženie ---- */
.wrap {
  max-width: 940px;
  margin: 24px auto 60px;
  padding: 0 16px;
}

/* ---- Dropzóna / vstupný panel ---- */
.intake {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.intake h1 { margin: 0 0 6px; font-size: 22px; }
.intake p.lead { margin: 0 0 20px; color: var(--muted); }

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: #fafbfd;
  transition: border-color .12s, background .12s;
  cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .big { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.dropzone.drag .big { color: var(--accent); }
.dropzone .hint { font-size: 13px; }

.or-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.or-sep::before, .or-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.paste-area { margin-top: 0; }
.paste-area summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.paste-area textarea {
  width: 100%;
  min-height: 160px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  resize: vertical;
}
.intake .row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.intake .docslink { margin-top: 20px; font-size: 13px; color: var(--muted); }

.notice {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.notice.err { background: #fdecea; color: var(--err); border: 1px solid #f3c6c1; }
.notice.info { background: var(--accent-soft); color: var(--accent); border: 1px solid #cfe0f0; }

/* ---- Hárok faktúry (tlačí sa) ---- */
.sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 44px;
}

.doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.doc-title { font-size: 26px; font-weight: 800; color: var(--accent); margin: 0; letter-spacing: .5px; }
.doc-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.doc-meta { text-align: right; font-size: 13px; }
.doc-meta .num { font-size: 20px; font-weight: 800; }
.doc-meta table { border-collapse: collapse; margin-left: auto; margin-top: 8px; }
.doc-meta td { padding: 2px 0 2px 14px; white-space: nowrap; }
.doc-meta td.k { color: var(--muted); text-align: right; }
.doc-meta td.v { font-weight: 600; text-align: right; }

.parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.party {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fcfdfe;
}
.party h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.party .name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.party .line { font-size: 13px; color: var(--ink); }
.party .ids { margin-top: 8px; font-size: 12px; color: var(--muted); }
.party .ids span { display: inline-block; margin-right: 12px; }

.section-title {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}

table.lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.lines thead th {
  background: var(--accent-soft);
  color: var(--accent);
  text-align: right;
  padding: 9px 10px;
  border-bottom: 2px solid var(--line-strong);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
table.lines thead th.l { text-align: left; }
table.lines tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
table.lines tbody td.l { text-align: left; }
table.lines tbody tr:nth-child(even) { background: #fafbfd; }
table.lines .item-name { font-weight: 600; }
table.lines .item-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
table.lines .item-id { color: var(--muted); font-size: 11px; margin-top: 2px; }

.bottom {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 720px) { .bottom { grid-template-columns: 1fr; } .parties { grid-template-columns: 1fr; } }

.pay-box { font-size: 13px; }
.pay-box .kv { margin-bottom: 5px; }
.pay-box .kv b { color: var(--muted); font-weight: 600; display: inline-block; min-width: 130px; }

.totals { font-size: 14px; }
.totals table { width: 100%; border-collapse: collapse; }
.totals td { padding: 6px 0; }
.totals td.k { color: var(--muted); }
.totals td.v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals tr.grand td { border-top: 2px solid var(--accent); padding-top: 10px; font-size: 18px; font-weight: 800; color: var(--accent); }

.vat-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.vat-table th, .vat-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.vat-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }
.vat-table th.l, .vat-table td.l { text-align: left; }

.notes-box {
  margin-top: 22px;
  padding: 12px 16px;
  background: #fbfbf4;
  border: 1px solid #ece7cf;
  border-radius: 8px;
  font-size: 13px;
  color: #51492e;
  white-space: pre-wrap;
}

.attach {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid #cfe0f0;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 13px;
}
.attach b { color: var(--accent); }

.foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
}

/* surové XML */
.raw {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}
.raw pre {
  margin: 0;
  padding: 18px;
  max-height: 70vh;
  overflow: auto;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  white-space: pre;
}

/* ---- Ephemeral badge v toolbare ---- */
.ephemeral {
  font-size: 12px;
  color: var(--warn);
  background: #fff6e6;
  border: 1px solid #f0dcb0;
  padding: 3px 9px;
  border-radius: 999px;
  margin-right: auto;
  white-space: nowrap;
}

/* ---- Privacy poznámka na úvode ---- */
.intake .privacy {
  margin: 18px 0 0;
  padding: 10px 14px;
  background: #f3faf5;
  border: 1px solid #cfe9d8;
  border-radius: 8px;
  font-size: 13px;
  color: #1a5e3a;
}

/* ---- Box integrácie ---- */
.integration {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
}
.integration > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}
.integration-body { padding: 0 16px 16px; font-size: 13.5px; }
.integration-body p { margin: 10px 0; color: var(--ink); }
.integration-body .docslink { color: var(--muted); font-size: 12.5px; }
table.spec { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
table.spec td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.spec td:first-child { width: 130px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.code-label { margin-top: 14px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
pre.code {
  margin: 6px 0 0;
  padding: 12px 14px;
  background: #0f1b2d;
  color: #e7eef7;
  border-radius: 8px;
  font: 12px/1.55 ui-monospace, Consolas, monospace;
  overflow-x: auto;
  white-space: pre;
}
.integration-body code {
  background: #eef1f6;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font: 12px ui-monospace, Consolas, monospace;
}

/* ---- O službe / dôveryhodnosť ---- */
.about {
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid #cfe0f0;
  background: linear-gradient(180deg, #f5f9fd, #eef4fb);
  border-radius: 12px;
}
.about h2 { margin: 0 0 10px; font-size: 17px; color: var(--accent); }
.about p { margin: 8px 0; font-size: 13.5px; color: var(--ink); line-height: 1.6; }
.about-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px !important; }
.about-badges span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: #fff;
  border: 1px solid #cfe0f0;
  border-radius: 999px;
  padding: 5px 12px;
}

.hidden { display: none !important; }

/* ---- Tlač / PDF ---- */
@media print {
  .toolbar, .intake, .raw, .no-print { display: none !important; }
  html, body { background: #fff; }
  .wrap { margin: 0; max-width: none; padding: 0; }
  .sheet { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  table.lines tbody tr { page-break-inside: avoid; }
  @page { size: A4; margin: 16mm 14mm; }
}
