:root {
  color-scheme: light dark;
  --field-border: #8a8f98;
  --bg: #f7f7f5; --card: #ffffff; --fg: #1f2328; --muted: #5d6470; --line: #e3e3df;
  --accent: #0b6e4f; --accent-fg: #ffffff; --warn-bg: #fff7e0; --warn: #8a5a00;
  --err-bg: #fdecec; --err: #a12020; --info-bg: #eaf3ff; --info: #164a8a; --ok: #0b6e4f; --bad: #a12020;
  --close-bg: #fde4e4; --close-border: #f3a6a6; --close-fg: #b42323;
}
@media (prefers-color-scheme: dark) {
  :root {
    --field-border: #6f7680;
    --bg: #111315; --card: #1a1d20; --fg: #e8e9eb; --muted: #a2a8b0; --line: #2b3035;
    --accent: #3fb68b; --accent-fg: #0b1512; --warn-bg: #2d2511; --warn: #f0c45a;
    --err-bg: #331818; --err: #ff8c8c; --info-bg: #13243a; --info: #8fbcf5; --ok: #58d3a2; --bad: #ff8c8c;
    --close-bg: #3d2224; --close-border: #e79a9a; --close-fg: #ffb8b8;
  }
}
* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 8px 12px; background: var(--card); border: 2px solid var(--accent); border-radius: 8px; }
.skip:focus { left: 8px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
header.site, footer.site { max-width: 920px; margin: 0 auto; padding: 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
header.site .brand { font-weight: 700; text-decoration: none; color: var(--fg); margin-right: auto; }
header.site nav { display: flex; gap: 8px; flex-wrap: wrap; }
.navbtn { display: inline-flex; align-items: center; padding: 7px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); text-decoration: none; font-size: .95rem; font-weight: 500; line-height: 1.2; transition: border-color .15s, background .15s; }
.navbtn:hover { border-color: var(--accent); color: var(--accent); }
.navbtn[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.navbtn[aria-current="page"]:hover { filter: brightness(1.08); color: var(--accent-fg); }
.navbtn:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
footer.site { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 48px; }
main { max-width: 920px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.2; margin: 24px 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 24px 0; }
#n43-drop { display: block; border: 2px dashed var(--field-border); border-radius: 12px; padding: 32px 16px; text-align: center; cursor: pointer; }
#n43-drop.over, #n43-drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
#n43-drop:has(#n43-file:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; border-color: var(--accent); }
body.dragging #n43-drop { border-width: 3px; }
.tool.has-file #n43-drop { padding: 12px 16px; }
.tool.has-file #n43-drop strong { font-size: 1rem; }
.tool.has-file #n43-drop .formats, .tool.has-file .howto, .tool.has-file .limit-note { display: none; }
#n43-drop strong { display: block; font-size: 1.1rem; }
#n43-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.formats { color: var(--muted); font-size: .9rem; }
button { font: inherit; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--field-border); background: var(--card); color: var(--fg); cursor: pointer; }
button.primary, a.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; text-decoration: none; display: inline-block; padding: 10px 16px; border-radius: 10px; }
button.link { border: none; background: none; color: var(--accent); text-decoration: underline; padding: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.actions .alert { flex-basis: 100%; }
.alert { border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
section.account { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
section.account h3 { margin: 0 0 8px; font-size: 1.05rem; overflow-wrap: anywhere; }
/* Each field spans two rows (label, box) on a shared subgrid, so labels and boxes line up across the row
   even when a label wraps (for example after page translation). */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); column-gap: 10px; row-gap: 0; }
.grid .field { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 4px; align-items: end; margin-bottom: 10px; font-size: .85rem; color: var(--muted); }
.grid input { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--field-border); background: var(--bg); color: var(--fg); min-width: 0; align-self: start; }
.grid input::placeholder, .iban-row input::placeholder { color: var(--muted); opacity: 1; }
.grid input[aria-invalid="true"], .iban-row input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.field-msg { min-height: 1em; font-size: .78rem; color: var(--bad); line-height: 1.3; }
.iban-row { display: grid; gap: 4px; margin: 4px 0 10px; font-size: .85rem; color: var(--muted); max-width: 420px; }
.iban-row input { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--field-border); background: var(--bg); color: var(--fg); }
.iban-row .field-msg { color: var(--muted); }
.iban-row input[aria-invalid="true"] + .field-msg { color: var(--bad); }
.review .confirm { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-weight: 600; cursor: pointer; }
.review .confirm input { margin-top: 3px; }
button:disabled, button:disabled:hover, button.is-disabled, button.is-disabled:hover { opacity: .45; cursor: not-allowed; }
.file-tab.tab-error { border-color: var(--bad); color: var(--bad); }
.file-tab.tab-map { border-style: dashed; }
/* Fixed columns: a long unbroken concept wraps instead of pushing the amount and code out of view. */
table.moves { table-layout: fixed; }
table.moves th:first-child, table.moves td.date { width: 92px; }
table.moves th.num, table.moves td.num { width: 110px; }
table.moves th.code, table.moves td.code { width: 200px; }
table.moves td.concept { overflow-wrap: anywhere; }
section.account.excluded { opacity: .9; }
.grid-note { margin: 0 0 4px; font-size: .8rem; color: var(--muted); }
.totals dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.neg { color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.steps li { margin-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 16px 0; }
.plan { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.plan h2 { margin: 0; font-size: 1.25rem; }
.plan .tag { position: absolute; top: -12px; right: 16px; background: var(--accent); color: var(--accent-fg); border-radius: 99px; padding: 2px 12px; font-size: .8rem; font-weight: 700; }
.plan .tag[hidden] { display: none; }
.plan .net { margin: 0; font-size: .85rem; color: var(--muted); }
.plan .secondary-link { margin-top: auto; text-align: center; display: block; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 10px; text-decoration: none; font-weight: 600; }
.plan .for { margin: 2px 0 6px; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.plan .price { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.plan ul { padding-left: 18px; margin: 8px 0 18px; flex-grow: 1; }
.plan li { margin-bottom: 6px; }
.plan .primary { margin-top: auto; text-align: center; width: 100%; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); max-width: 520px; width: calc(100% - 32px); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog input, dialog select { font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--field-border); background: var(--bg); color: var(--fg); width: 100%; min-width: 0; height: 46px; }
dialog form { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: end; }
dialog form button { height: 46px; }
dialog .field { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
#license-form { grid-template-columns: minmax(0, 1fr) auto; }
#wait-form { grid-template-columns: minmax(0, 1fr) auto; }
#wait-form .field:first-child { grid-column: 1 / -1; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dlg-head h2 { margin: 0; font-size: 1.3rem; }
.dlg-x { width: 40px; height: 40px; padding: 0; border-radius: 50%; flex: none; }
dialog h3 { font-size: 1rem; margin: 18px 0 4px; }
.form-msg { min-height: 1.2em; margin: 4px 0; font-size: .9rem; }
.form-msg.ok { color: var(--ok); font-weight: 600; }
.form-msg.err { color: var(--bad); font-weight: 600; }
.ok-box { background: color-mix(in srgb, var(--ok) 12%, var(--card)); color: var(--fg); border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line)); }
.ok-box strong { color: var(--ok); }
@media (max-width: 520px) { dialog form, #license-form { grid-template-columns: minmax(0, 1fr); } }
#pro-badge { background: var(--accent); color: var(--accent-fg); border-radius: 99px; padding: 2px 10px; font-size: .8rem; }
.crumbs { font-size: .85rem; margin-top: 16px; }

/* ---------- FROM -> TO picker ---------- */
.route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: end; margin-bottom: 14px; }
.route-end { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.route-label { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fmt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); }
.fmt:hover, .fmt[aria-expanded="true"] { border-color: var(--accent); }
.fmt.fixed { cursor: default; }
.fmt.fixed:hover { border-color: var(--line); }
.fmt-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; min-width: 52px; height: 40px; padding: 0 6px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .02em; }
.fmt-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.fmt-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmt-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmt-chev { flex: none; width: 16px; height: 16px; margin-left: auto; color: var(--muted); }
.fmt-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: min(440px, calc(100vw - 32px)); display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 12px 32px rgb(0 0 0 / .18); }
.fmt-menu[hidden] { display: none; }
.end-right .fmt-menu { left: 0; right: auto; width: max(100%, min(440px, calc(100vw - 32px))); }
@media (min-width: 521px) { .end-right .fmt-menu { width: 100%; grid-template-columns: minmax(0, 1fr); } }
.fmt-option { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px; text-align: left; border: 1px solid transparent; border-radius: 10px; background: none; }
.fmt-option:hover { background: var(--bg); }
.fmt-option:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; background: var(--bg); }
.fmt-option[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.fmt-option .fmt-badge { width: 48px; min-width: 48px; height: 34px; }
.swap { width: 44px; height: 44px; margin-bottom: 10px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.swap svg { width: 22px; height: 22px; }
.swap svg.v { display: none; }
.swap:hover { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.howto { margin: 12px 0 4px; padding: 10px 14px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); border-radius: 0 10px 10px 0; font-size: .92rem; }
.howto ul { margin: 4px 0 0; padding-left: 18px; }
.howto li { margin: 2px 0; }
.tool.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); transition: box-shadow .3s; }
@media (max-width: 520px) {
  /* Phones: stack FROM over TO, with the swap button between them pointing down. */
  .route { grid-template-columns: minmax(0, 1fr); gap: 6px; position: relative; }
  .swap { justify-self: center; width: 44px; height: 44px; margin: 0; }
  .swap svg.h { display: none; }
  .swap svg.v { display: block; }
  .fmt { min-height: 56px; padding: 8px 10px; }
  .fmt-menu, .end-right .fmt-menu { left: 0; right: 0; width: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fmt-option { padding: 6px 8px; gap: 8px; min-height: 44px; }
  .fmt-option .fmt-badge { display: none; }
  .fmt-option .fmt-sub { display: none; }
}

/* ---------- shortcuts ---------- */
.shortcuts { margin: 32px 0; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 12px; }
.chip { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
/* Source pinned left, target pinned right, arrow fixed in the centre whatever the label lengths. */
.chip-btn { flex: 1; color: var(--fg); text-decoration: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; border: none; border-radius: 0; background: none; padding: 10px 14px; font-weight: 600; }
.chip-btn > span:first-child { text-align: left; }
.chip-btn > span:last-child { text-align: right; }
.chip-btn .arrow { color: var(--accent); font-size: 1.45rem; line-height: 1; }
.chip-btn:hover, .chip-btn[aria-current="true"] { background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.chip-btn[aria-current="true"] { box-shadow: inset 3px 0 0 var(--accent); }
/* The chip clips its corners, so the focus ring is drawn inside. */
.chip-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
footer .footer-links { display: flex; flex-wrap: wrap; gap: 6px 14px; flex-basis: 100%; }
footer.site p { flex-basis: 100%; margin: 6px 0 0; }
.guide-list { list-style: none; padding: 0; }
.guide-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.guide-list li a { font-weight: 600; display: block; }
.guide-list li span { color: var(--muted); font-size: .92rem; }
.pending { color: var(--warn); }
footer .footer-links span { color: var(--muted); }

/* ---------- notes inside the converter ---------- */
.limit-note { margin: 8px 2px 0; font-size: .85rem; color: var(--muted); }
.tool-foot { margin-top: 12px; font-size: .85rem; color: var(--muted); }
.tool-foot p { margin: 2px 0; }
/* Spacing comes from the gap, not from whitespace, so page translators cannot squash it. */
.sample-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.sample-wrap[hidden] { display: none; }
.sample-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--accent); font-weight: 600; }
.sample-btn:hover { background: color-mix(in srgb, var(--accent) 18%, var(--card)); }
.sample-btn svg { width: 14px; height: 14px; }
#n43-result.has-result { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-head h2 { margin: 12px 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.result-head h2:focus { outline: none; }
.close-btn { padding: 6px 12px; font-size: .9rem; color: var(--muted); }
/* Pastel red on hover and keyboard focus. */
.close-btn:hover, .close-btn:focus-visible { background: var(--close-bg); border-color: var(--close-border); color: var(--close-fg); }
th.num { text-align: right; }
.totals dd.num, .totals dd .num { font-variant-numeric: tabular-nums; }
.block { display: block; margin-top: 6px; }
td.code select { font: inherit; font-size: .82rem; max-width: 190px; padding: 3px 4px; border-radius: 6px; border: 1px solid var(--field-border); background: var(--bg); color: var(--fg); }
.more-rows { margin: 8px 0; }
.file-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.file-tab { padding: 6px 12px; font-size: .9rem; border-radius: 99px; }
.file-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 10px 0; }
.mapping-grid .field { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.mapping-grid select { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--field-border); background: var(--bg); color: var(--fg); min-width: 0; }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading::before { animation: none; } * { scroll-behavior: auto !important; } }
@media (max-width: 520px) {
  /* Phones: each movement is a small card (date and amount, then the concept, then the code), so no amount is
     ever cut off; result actions take the full width. */
  table.moves thead { display: none; }
  table.moves tr { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "date num" "concept concept" "code code"; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.moves td { border: none; padding: 0; }
  table.moves td.date { grid-area: date; color: var(--muted); }
  table.moves td.num { grid-area: num; text-align: right; font-weight: 600; }
  table.moves td.concept { grid-area: concept; overflow-wrap: anywhere; }
  table.moves td.code { grid-area: code; text-align: left; width: auto; }
  table.moves td.code::before { content: "Concepto común: "; color: var(--muted); font-size: .85rem; }
  .crumbs a, .navbtn { min-height: 44px; display: inline-flex; align-items: center; }
  .actions > button, .actions > a { width: 100%; text-align: center; }
  .faq summary { min-height: 44px; display: flex; align-items: center; }
  footer .footer-links a { padding: 6px 0; }
  .close-btn { min-height: 40px; }
}
th.code, td.code { text-align: center; }

/* Import help under the download buttons */
.import-help { margin: 14px 0 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.import-help summary { cursor: pointer; font-weight: 600; }
.import-help ol { margin: 8px 0; padding-left: 20px; }
.import-help li { margin: 3px 0; }
.import-help p { margin: 6px 0; font-size: .92rem; }

/* Toggle rows (FAQ questions, movement previews, Sage 50 help) are controls: clicking them must not select text.
   The revealed answers stay selectable. */
summary { user-select: none; -webkit-user-select: none; }
