/* ============================================================
   E-Invoicing — design system
   Palette taken from the brand mark: the sage circle, the deep
   teal arrow, the poster lime and the navy of the collateral.
   Display type is condensed and set in caps, echoing the printed
   material; body copy is the same superfamily at normal width.
   ============================================================ */

:root {
  /* Brand */
  --navy-900: #101625;   /* darkest band, footer, sidebar */
  --navy-800: #18213a;
  --navy-700: #24304f;
  --teal-700: #045679;   /* the arrow in the mark */
  --teal-600: #0a6e96;
  --teal-050: #e8f1f6;
  --lime-500: #8cc63f;   /* action colour */
  --lime-600: #74a82f;
  --lime-100: #eaf5d8;
  --lime-050: #f5faec;
  --sage-400: #a9c27d;   /* the circle in the mark */

  /* Neutrals — very slightly green so white never looks blue */
  --paper: #ffffff;
  --mist: #f4f7f1;
  --line: #e2e8dd;
  --line-soft: #eef2ea;

  --ink-900: #101625;
  --ink-700: #3b455c;
  --ink-500: #6b7689;
  --ink-300: #a3abb9;

  --ok: #2e7d32;
  --warn: #b26a00;
  --risk: #b3261e;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 22, 37, .05), 0 2px 10px rgba(16, 22, 37, .05);
  --shadow-md: 0 10px 34px rgba(16, 22, 37, .12);
  --shadow-lg: 0 24px 60px rgba(16, 22, 37, .18);

  --font-display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  color: var(--ink-900);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main, body > .auth-wrap, body > .app-shell { flex: 1 0 auto; }

.wrap { width: min(var(--wrap), 92vw); margin-inline: auto; }
.wrap-narrow { width: min(820px, 92vw); margin-inline: auto; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.04;
  margin: 0 0 .45em;
  font-weight: 700;
  letter-spacing: .005em;
}
h1 { font-size: clamp(2.4rem, 4.6vw, 3.7rem); text-transform: uppercase; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); text-transform: uppercase; }
h3 { font-size: 1.3rem; font-family: var(--font-body); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

.lede { font-size: 1.12rem; color: var(--ink-700); }
.muted { color: var(--ink-500); }
.mono { font-family: var(--font-mono); font-size: .84em; letter-spacing: -.01em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--teal-700);
  margin: 0 0 .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.eyebrow::before {
  content: '';
  width: 22px; height: 3px;
  background: var(--lime-500);
  flex: 0 0 22px;
}
.eyebrow.on-dark { color: var(--sage-400); }

/* ---------- The stripe motif ----------
   Sheared bands lifted from the brand collateral. Used only at
   section joins and behind the dark bands, never as filler.      */
.stripes {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    115deg,
    rgba(140, 198, 63, .10) 0 26px,
    transparent 26px 96px
  );
}
.stripes-teal {
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, .05) 0 22px,
    transparent 22px 84px
  );
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 600; font-size: .96rem;
  padding: .72rem 1.35rem; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:disabled { cursor: not-allowed; }
.btn-primary:disabled, .btn-dark:disabled {
  background: var(--line); color: var(--ink-500); border-color: var(--line);
}
.btn-outline:disabled { opacity: .5; }

.btn-primary { background: var(--lime-500); color: var(--navy-900); }
.btn-primary:hover:not(:disabled) { background: var(--lime-600); color: #fff; }

.btn-dark { background: var(--navy-900); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--teal-700); }

.btn-outline { background: transparent; border-color: var(--line); color: var(--ink-900); }
.btn-outline:hover:not(:disabled) { border-color: var(--teal-700); color: var(--teal-700); }

.btn-onnavy { background: transparent; border-color: rgba(255,255,255,.34); color: #fff; }
.btn-onnavy:hover:not(:disabled) { background: rgba(255,255,255,.1); border-color: #fff; }

.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover:not(:disabled) { background: var(--mist); color: var(--ink-900); }

.btn-lg { padding: .92rem 1.7rem; font-size: 1.02rem; }
.btn-sm { padding: .42rem .85rem; font-size: .86rem; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* ---------- Utility bar ---------- */
.util-bar {
  background: var(--navy-900);
  color: rgba(255,255,255,.72);
  font-size: .82rem;
}
.util-inner { display: flex; align-items: center; gap: 1.4rem; height: 38px; }
.util-bar a { color: rgba(255,255,255,.82); }
.util-bar a:hover { color: #fff; }
.util-spacer { margin-left: auto; }
.util-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--sage-400);
}
.util-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--lime-500); box-shadow: 0 0 0 3px rgba(140,198,63,.25);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 2rem; height: 74px; }
.brand-logo { height: 36px; width: auto; display: block; }
.main-nav { display: flex; gap: 1.7rem; }
.main-nav a {
  color: var(--ink-700); font-weight: 500; font-size: .95rem;
  padding: .45rem 0; border-bottom: 2.5px solid transparent;
}
.main-nav a:hover { color: var(--ink-900); text-decoration: none; }
.main-nav a.is-active { color: var(--ink-900); border-bottom-color: var(--lime-500); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; margin-left: auto; padding: .4rem;
}
.nav-toggle span { width: 24px; height: 2.5px; background: var(--ink-900); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--navy-900);
  color: #fff;
  padding: clamp(3.2rem, 7vw, 5.4rem) 0 clamp(3.2rem, 7vw, 5rem);
}
.hero::after {
  content: ''; position: absolute; right: -8%; top: -30%;
  width: 46%; height: 160%;
  background: radial-gradient(closest-side, rgba(10,110,150,.5), transparent 72%);
  pointer-events: none;
}
.hero-grid {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1.02fr .98fr; gap: 3.4rem; align-items: center;
}
.hero h1 { color: #fff; margin-bottom: .35em; }
.hero h1 em { font-style: normal; color: var(--lime-500); }
.hero-lede { color: rgba(255,255,255,.8); font-size: 1.13rem; max-width: 48ch; }
.hero-cta { display: flex; gap: .8rem; margin-top: 1.8rem; flex-wrap: wrap; }
.hero-foot {
  margin-top: 2.2rem; padding-top: 1.4rem;
  border-top: 1px solid rgba(255,255,255,.14);
  display: flex; gap: 2rem; flex-wrap: wrap;
  font-size: .88rem; color: rgba(255,255,255,.7);
}
.hero-foot b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: #fff; line-height: 1; }

/* ---------- Signature: the fiscalisation trace ---------- */
.trace {
  background: #fff; color: var(--ink-900);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.trace-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--line);
  background: var(--mist);
}
.trace-title { font-weight: 600; font-size: .95rem; }
.trace-env {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--teal-700);
  background: var(--teal-050); padding: .25rem .55rem; border-radius: 100px;
}
.trace-body { padding: 1.2rem 1.2rem .4rem; }

.trace-step {
  display: grid; grid-template-columns: 26px 1fr; gap: .9rem;
  padding-bottom: 1.05rem; position: relative;
}
.trace-step::before {
  content: ''; position: absolute; left: 12.5px; top: 24px; bottom: 0;
  width: 1.5px; background: var(--line);
}
.trace-step:last-child { padding-bottom: 1rem; }
.trace-step:last-child::before { display: none; }
.trace-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .68rem; color: var(--ink-300);
  position: relative; z-index: 2;
}
.trace-label { font-weight: 600; font-size: .93rem; line-height: 1.3; }
.trace-meta { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-500); margin-top: .15rem; word-break: break-all; }

.trace-step.is-done .trace-dot { border-color: var(--lime-500); background: var(--lime-500); color: var(--navy-900); font-weight: 600; }
.trace-step.is-done .trace-dot::after { content: '✓'; font-size: .78rem; }
.trace-step.is-done .trace-dot span { display: none; }
.trace-step.is-active .trace-dot { border-color: var(--teal-700); color: var(--teal-700); }
.trace-step.is-active .trace-label { color: var(--teal-700); }

.trace-foot {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; border-top: 1px solid var(--line); background: var(--mist);
}
.trace-qr {
  width: 62px; height: 62px; flex: 0 0 62px; border-radius: 6px;
  background: #fff; border: 1px solid var(--line); padding: 5px;
}
.trace-qr svg { width: 100%; height: 100%; display: block; }
.trace-foot-text { min-width: 0; }
.trace-foot-text b { display: block; font-size: .88rem; }
.trace-foot-text span { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-500); word-break: break-all; }

/* ---------- Sections ---------- */
.band { padding: clamp(3.2rem, 6.5vw, 5.4rem) 0; position: relative; }
.band-mist { background: var(--mist); border-block: 1px solid var(--line); }
.band-navy { background: var(--navy-900); color: #fff; overflow: hidden; }
.band-navy h2, .band-navy h3 { color: #fff; }
.band-navy p { color: rgba(255,255,255,.75); }
.band-teal { background: var(--teal-700); color: #fff; overflow: hidden; }
.band-teal h2 { color: #fff; }
.band-teal p { color: rgba(255,255,255,.82); }

.band-head { max-width: 62ch; margin-bottom: 2.6rem; }
.band-head.center { margin-inline: auto; text-align: center; }
.band-head.center .eyebrow { justify-content: center; }
.band-head p { color: var(--ink-700); font-size: 1.06rem; margin-bottom: 0; }
.band-navy .band-head p { color: rgba(255,255,255,.75); }

/* ---------- Two-column feature ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3.4rem; align-items: center; }
.split-tight { gap: 2.6rem; }

/* ---------- Module cards (IX / CX / SX / Dx) ---------- */
.modules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.module {
  position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem 1.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.module:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--sage-400); }
.module-tag {
  display: inline-block;
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--lime-500); color: var(--navy-900);
  padding: .18rem .7rem; border-radius: 5px; margin-bottom: .9rem;
}
.module h3 { margin-bottom: .4rem; }
.module p { color: var(--ink-700); font-size: .97rem; margin: 0; }

/* ---------- Plain cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: .45rem; }
.card p { color: var(--ink-700); font-size: .97rem; margin: 0; }
.card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--lime-100); color: var(--teal-700);
  display: grid; place-items: center; margin-bottom: 1rem;
}
.card-icon svg { width: 21px; height: 21px; }

/* ---------- Numbered sequence (onboarding is a real sequence) ---------- */
.sequence { counter-reset: seq; display: grid; gap: 0; }
.seq-item {
  counter-increment: seq;
  display: grid; grid-template-columns: 72px 1fr; gap: 1.6rem;
  padding: 1.5rem 0; border-top: 1px solid var(--line);
}
.seq-item:last-child { border-bottom: 1px solid var(--line); }
.seq-item::before {
  content: counter(seq, decimal-leading-zero);
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 700;
  color: var(--sage-400); line-height: 1;
}
.seq-item h3 { margin-bottom: .3rem; }
.seq-item p { color: var(--ink-700); margin: 0; font-size: .98rem; }
.band-navy .seq-item, .band-navy .seq-item:last-child { border-color: rgba(255,255,255,.14); }
.band-navy .seq-item p { color: rgba(255,255,255,.72); }

/* ---------- Stat band ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.stat { text-align: center; }
.stat b {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3rem, 6vw, 4.6rem); line-height: 1; color: var(--lime-500);
}
.stat span { display: block; margin-top: .5rem; font-size: .95rem; color: rgba(255,255,255,.75); }

/* ---------- Compatible packages ---------- */
.packages { display: flex; flex-wrap: wrap; gap: .7rem; }
.package-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); border-radius: 100px;
  background: #fff; padding: .55rem 1.1rem;
  font-weight: 600; font-size: .92rem; color: var(--ink-700);
}
.package-chip::before {
  content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--sage-400);
}

/* ---------- Quote ---------- */
.pull-quote {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.15;
  text-transform: none; letter-spacing: -.005em;
  max-width: 22ch;
}
.pull-quote::before { content: '“'; color: var(--lime-500); }
.pull-quote::after { content: '”'; color: var(--lime-500); }

/* ---------- CTA band ---------- */
.cta {
  position: relative; overflow: hidden;
  background: var(--lime-500); color: var(--navy-900);
  border-radius: var(--radius-lg);
  padding: clamp(2.4rem, 5vw, 3.6rem);
  text-align: center;
}
.cta h2 { color: var(--navy-900); margin-bottom: .3em; }
.cta p { color: rgba(16,22,37,.78); max-width: 54ch; margin-inline: auto; }
.cta .btn-dark { margin-top: 1.5rem; }
.cta .stripes {
  background: repeating-linear-gradient(115deg, rgba(16,22,37,.055) 0 20px, transparent 20px 74px);
}
.cta > * { position: relative; z-index: 2; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: #b9c2cf; margin-top: auto; padding-top: 3.4rem; }
.footer-inner { display: grid; grid-template-columns: 1.5fr 2fr; gap: 3rem; padding-bottom: 2.4rem; }
.footer-logo { height: 36px; margin-bottom: 1.1rem; }
.footer-tag { color: #e7ecf1; font-weight: 500; max-width: 34ch; }
.footer-contact { font-size: .92rem; margin-top: 1.2rem; }
.footer-contact a { color: var(--sage-400); display: block; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }
.footer-col h4 {
  font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .16em; color: var(--sage-400); margin-bottom: 1rem; font-weight: 500;
}
.footer-col a { display: block; color: #b9c2cf; font-size: .93rem; margin-bottom: .55rem; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.3rem 0; border-top: 1px solid rgba(255,255,255,.1);
  font-size: .84rem; color: #7d8798;
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  position: relative; overflow: hidden;
  background: var(--mist); border-bottom: 1px solid var(--line);
  padding: clamp(2.6rem, 5.5vw, 4.2rem) 0;
}
.page-hero > .wrap { position: relative; z-index: 2; }
.page-hero h1 { max-width: 18ch; margin-bottom: .35em; }
.page-hero p { color: var(--ink-700); max-width: 58ch; font-size: 1.08rem; margin-bottom: 0; }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.8rem; }
.prose p, .prose li { color: var(--ink-700); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .5rem; }

/* ---------- Definition list ---------- */
.deflist { display: grid; gap: 0; }
.deflist > div { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.deflist > div:last-child { border-bottom: 1px solid var(--line); }
.deflist dt { font-weight: 700; margin-bottom: .2rem; }
.deflist dd { margin: 0; color: var(--ink-700); font-size: .97rem; }

/* ---------- Code block ---------- */
.code {
  background: var(--navy-900); color: #dde5ec;
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.65;
  overflow-x: auto; white-space: pre;
}
.code .k { color: var(--sage-400); }
.code .s { color: #ffd9a0; }
.code .c { color: #6f7b8d; }

/* ---------- Auth pages ---------- */
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 74px); }
.auth-aside {
  position: relative; overflow: hidden;
  background: var(--navy-900); color: #fff;
  padding: clamp(2.2rem, 5vw, 4rem);
  display: flex; flex-direction: column; justify-content: center;
}
.auth-aside > * { position: relative; z-index: 2; }
.auth-logo { height: 40px; width: auto; max-width: 240px; object-fit: contain; align-self: flex-start; margin-bottom: 2.2rem; }
.auth-aside h2 { color: #fff; }
.auth-aside p { color: rgba(255,255,255,.75); max-width: 40ch; }
.auth-aside ul { list-style: none; padding: 0; margin: 1.8rem 0 0; }
.auth-aside li { display: flex; gap: .7rem; margin-bottom: .9rem; color: rgba(255,255,255,.92); font-size: .96rem; }
.auth-aside li::before { content: '✓'; color: var(--lime-500); font-weight: 700; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; }
.auth-card { width: min(430px, 100%); }
.auth-card h1 { font-size: 2.1rem; }
.auth-sub { color: var(--ink-500); margin-bottom: 1.7rem; }
.auth-card.is-submitting { opacity: .65; pointer-events: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-weight: 600; font-size: .89rem; margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .74rem .85rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: .96rem; background: #fff; color: var(--ink-900);
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal-700); box-shadow: 0 0 0 3px var(--teal-050);
}
.field input:disabled { background: var(--mist); color: var(--ink-500); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-note { font-size: .82rem; margin: .35rem 0 0; color: var(--ink-500); }
.field-note.is-ok { color: var(--ok); }
.field-note.is-error { color: var(--risk); }

.form-alert {
  background: rgba(179,38,30,.07); border: 1px solid rgba(179,38,30,.25); color: #8c1e17;
  padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 1.1rem;
}
.form-alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.form-alert.is-ok { background: rgba(46,125,50,.08); border-color: rgba(46,125,50,.3); color: #1d5c21; }
.form-alert.is-info { background: var(--teal-050); border-color: rgba(4,86,121,.22); color: var(--teal-700); }
.form-foot { margin-top: 1.2rem; font-size: .92rem; color: var(--ink-500); text-align: center; }

.checkline {
  display: grid; grid-template-columns: auto 1fr; gap: .6rem;
  align-items: start; font-size: .92rem; color: var(--ink-700);
}
.checkline input { width: auto; margin-top: .28rem; }
/* A note under a checkbox belongs under the label, not squeezed beside it. */
.checkline .merge-note { grid-column: 2; margin-top: .35rem; }

/* ---------- Sign-up wizard ---------- */
.signup-wrap { width: min(760px, 92vw); margin-inline: auto; padding: 2.8rem 0 1rem; }
.signup-head { margin-bottom: 1.8rem; }
.signup-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.signup-head p { color: var(--ink-500); margin-bottom: 0; }

.steps { display: flex; list-style: none; padding: 0; margin: 0 0 1.6rem; gap: .5rem; }
.step {
  flex: 1; display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.step-n {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--mist); color: var(--ink-500);
  font-family: var(--font-mono); font-size: .74rem; font-weight: 500;
}
.step-l { font-size: .88rem; color: var(--ink-500); font-weight: 600; }
.step.is-active { border-color: var(--teal-700); box-shadow: 0 0 0 3px var(--teal-050); }
.step.is-active .step-n { background: var(--teal-700); color: #fff; }
.step.is-active .step-l { color: var(--ink-900); }
.step.is-done .step-n { background: var(--lime-500); color: var(--navy-900); font-size: 0; }
.step.is-done .step-n::after { content: '✓'; font-size: .78rem; font-weight: 700; }

.step-panel { animation: fade .2s ease; }
.step-actions { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.5rem; }
.step-error { color: var(--risk); font-size: .92rem; margin: .9rem 0 0; }

.selected-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: .9rem; padding: .9rem 1rem;
  border: 1.5px solid var(--sage-400); background: var(--lime-050); border-radius: var(--radius-sm);
}
.sel-name { font-weight: 600; }
.sel-meta { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-500); }

.manual-entry { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.manual-entry summary { cursor: pointer; font-size: .92rem; color: var(--teal-700); font-weight: 600; }

.summary-strip {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  padding: 1.1rem; background: var(--mist); border-radius: var(--radius-sm); margin-bottom: 1.4rem;
}
.done-tick {
  width: 58px; height: 58px; margin: 0 auto 1.1rem; border-radius: 50%;
  background: var(--lime-100); color: var(--ok);
  display: grid; place-items: center; font-size: 1.8rem; font-weight: 700;
}

/* ---------- Predictive dropdown ---------- */
.search-autocomplete { position: relative; }
.autocomplete-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 320px; overflow-y: auto; padding: .35rem;
}
.autocomplete-dropdown[hidden] { display: none; }
.ac-item {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .6rem .7rem; border-radius: var(--radius-sm); cursor: pointer;
}
.ac-item:hover, .ac-item.is-active { background: var(--lime-050); }
.ac-text { display: flex; flex-direction: column; min-width: 0; }
.ac-name { font-weight: 600; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-meta { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-500); }
.ac-message { padding: .7rem .8rem; color: var(--ink-500); font-size: .88rem; display: flex; align-items: center; }

/* ============================================================
   Authenticated area
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.app-side {
  background: var(--navy-900); color: #fff;
  padding: 1.4rem 1rem 2rem;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-logo { height: 32px; width: auto; margin: .4rem .6rem 1.5rem; }
.entity-badge {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm); padding: .75rem .8rem; margin-bottom: 1.3rem;
}
.eb-label {
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--sage-400); display: block;
}
.eb-name {
  display: block; margin-top: .3rem;
  font-size: .9rem; font-weight: 600; color: #fff; line-height: 1.3;
}
.eb-name.is-missing { color: rgba(255,255,255,.55); font-weight: 500; }

.app-nav { display: flex; flex-direction: column; gap: .15rem; }
.app-nav-group {
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.4);
  padding: 1.1rem .8rem .4rem;
}
.app-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .58rem .8rem; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.78); font-weight: 500; font-size: .94rem;
}
.app-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.app-nav a.is-active { background: var(--lime-500); color: var(--navy-900); font-weight: 600; }
.app-nav svg { width: 17px; height: 17px; flex: 0 0 17px; }

.side-foot { margin-top: auto; padding-top: 1.5rem; }
.side-user {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem; border-radius: var(--radius-sm); color: #fff;
}
.side-user:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; object-fit: cover;
}
.side-avatar-fallback {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: var(--teal-600); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .8rem;
}
.side-user-meta { min-width: 0; line-height: 1.25; }
.side-user-name { display: block; font-size: .88rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { display: block; font-size: .76rem; color: rgba(255,255,255,.6); }
.side-logout {
  width: 100%; margin-top: .5rem; background: transparent;
  border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.8);
  padding: .5rem; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: .86rem;
}
.side-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

.bu-select {
  width: 100%; margin-top: .3rem; font: inherit; font-size: .84rem;
  background: rgba(255,255,255,.08); color: #fff;
  border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: .35rem .4rem;
}
.bu-select option { color: var(--ink-900); }

.app-main { padding: 2rem clamp(1.2rem, 3vw, 2.6rem) 3rem; min-width: 0; background: var(--mist); }
.app-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.6rem;
}
.app-head h1 { font-size: 2rem; margin: 0; }
.app-head p { color: var(--ink-500); margin: .2rem 0 0; font-size: .95rem; }
.app-head-actions { display: flex; gap: .6rem; }

.mobile-appbar { display: none; }

/* Panels */
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.5rem; margin-bottom: 1.2rem;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: -.2rem 0 1.1rem;
}
.panel-head h3 { margin: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 1.2rem 1.5rem; margin: 0; border-bottom: 1px solid var(--line); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; box-shadow: var(--shadow-sm);
}
.tile-label {
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-500); display: block; margin-bottom: .5rem;
}
.tile b { display: block; font-family: var(--font-display); font-size: 2.3rem; line-height: 1; }
.tile b:empty::after, .tile b.is-empty { color: var(--ink-300); }
.tile-note { font-size: .84rem; color: var(--ink-500); margin: .35rem 0 0; }
.tile-accent b { color: var(--teal-700); }

/* Tables */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-family: var(--font-mono); font-size: .66rem;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-500);
  padding: .75rem .9rem; border-bottom: 1px solid var(--line); font-weight: 500; white-space: nowrap;
}
.table td { padding: .8rem .9rem; border-bottom: 1px solid var(--line-soft); font-size: .93rem; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--font-mono); font-size: .86rem; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .76rem; font-weight: 600; padding: .22rem .6rem; border-radius: 5px; white-space: nowrap;
}
.badge-ok { background: rgba(46,125,50,.12); color: var(--ok); }
.badge-warn { background: rgba(178,106,0,.14); color: var(--warn); }
.badge-risk { background: rgba(179,38,30,.1); color: var(--risk); }
.badge-idle { background: var(--mist); color: var(--ink-500); }
.badge-teal { background: var(--teal-050); color: var(--teal-700); }

/* Empty / disconnected states */
.empty {
  text-align: center; padding: 2.6rem 1.5rem; max-width: 46ch; margin-inline: auto;
}
.empty-mark {
  width: 46px; height: 46px; margin: 0 auto 1rem; border-radius: 12px;
  background: var(--mist); color: var(--ink-300); display: grid; place-items: center;
}
.empty h3 { margin-bottom: .4rem; }
.empty p { color: var(--ink-500); font-size: .95rem; }
.empty .btn { margin-top: .6rem; }

/* Connection rows */
.conn-list { display: grid; gap: .8rem; }
.conn {
  display: flex; align-items: center; gap: 1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; padding: 1rem 1.2rem;
}
.conn-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 9px;
  background: var(--mist); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--teal-700);
}
.conn-text { min-width: 0; flex: 1; }
.conn-text b { display: block; font-size: .96rem; }
.conn-text span { font-size: .86rem; color: var(--ink-500); }

/* Document composer */
.compose-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.2rem; align-items: start; }
.line-table { width: 100%; border-collapse: collapse; }
.line-table th {
  text-align: left; font-family: var(--font-mono); font-size: .64rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-500);
  padding: 0 .45rem .5rem; font-weight: 500; white-space: nowrap;
}
.line-table td { padding: .25rem .45rem; vertical-align: middle; }
.line-table input, .line-table select {
  width: 100%; padding: .5rem .55rem; border: 1.5px solid var(--line);
  border-radius: 6px; font: inherit; font-size: .9rem; background: #fff;
}
.line-table input:focus, .line-table select:focus {
  outline: none; border-color: var(--teal-700); box-shadow: 0 0 0 3px var(--teal-050);
}
.line-table input.num { text-align: right; font-family: var(--font-mono); }
.line-total { font-family: var(--font-mono); font-size: .88rem; text-align: right; white-space: nowrap; }
.line-remove {
  background: none; border: 0; cursor: pointer; color: var(--ink-300);
  font-size: 1.1rem; line-height: 1; padding: .3rem;
}
.line-remove:hover { color: var(--risk); }

.summary-panel { position: sticky; top: 1.5rem; }
.sum-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; font-size: .93rem; }
.sum-row + .sum-row { border-top: 1px solid var(--line-soft); }
.sum-row span:last-child { font-family: var(--font-mono); }
.sum-row.is-total { border-top: 2px solid var(--ink-900); font-weight: 700; font-size: 1.05rem; padding-top: .7rem; margin-top: .3rem; }
.sum-row.is-total span:last-child { font-family: var(--font-display); font-size: 1.5rem; }

/* Payload preview */
.payload-toggle {
  background: none; border: 0; cursor: pointer; padding: 0;
  font: inherit; font-size: .88rem; font-weight: 600; color: var(--teal-700);
}

/* Loading */
.spinner {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--teal-700);
  animation: spin .8s linear infinite; display: inline-block;
}
.spinner-sm { width: 13px; height: 13px; flex: 0 0 13px; border-width: 2px; vertical-align: -2px; margin-right: .45rem; }
.spinner-onprimary { border-color: rgba(16,22,37,.25); border-top-color: var(--navy-900); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.loading-row { display: flex; align-items: center; gap: .8rem; color: var(--ink-500); font-size: .93rem; padding: 1.5rem; }

[hidden] { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .compose-grid { grid-template-columns: 1fr; }
  .summary-panel { position: static; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .hero-grid, .split, .footer-inner, .auth-wrap, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .cards, .modules { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-wrap { min-height: auto; }
  .main-nav, .header-actions { display: none; }
  body.nav-open .main-nav {
    display: flex; position: absolute; top: 74px; left: 0; right: 0; flex-direction: column;
    background: #fff; border-bottom: 1px solid var(--line); padding: 1rem 4vw; gap: .2rem;
  }
  body.nav-open .main-nav a { border-bottom: 0; padding: .6rem 0; }
  body.nav-open .header-actions {
    display: flex; position: absolute; top: calc(74px + 250px); left: 0; right: 0;
    padding: 0 4vw 1.2rem; background: #fff; gap: .6rem;
  }
  body.nav-open .header-actions .btn { flex: 1; }
  .nav-toggle { display: flex; }
  .util-inner { justify-content: center; }
  .util-hide-sm { display: none; }

  /* App shell becomes a top bar + drawer */
  .app-shell { grid-template-columns: 1fr; }
  .app-side {
    position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 90;
    transform: translateX(-100%); transition: transform .22s ease; height: 100vh;
  }
  body.side-open .app-side { transform: none; }
  body.side-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(16,22,37,.45); z-index: 80;
  }
  .mobile-appbar {
    display: flex; align-items: center; gap: .8rem;
    background: var(--navy-900); padding: .7rem 1rem; position: sticky; top: 0; z-index: 70;
  }
  .mobile-appbar img { height: 26px; }
  .mobile-appbar button {
    background: rgba(255,255,255,.1); border: 0; color: #fff; border-radius: 7px;
    width: 36px; height: 36px; cursor: pointer; display: grid; place-items: center;
  }
  .app-main { padding: 1.4rem 1rem 2.5rem; }
}

@media (max-width: 700px) {
  .steps { flex-direction: column; }
  .summary-strip, .field-row { grid-template-columns: 1fr; }
  .step-actions { flex-direction: column-reverse; }
  .step-actions .btn { width: 100%; }
  .tiles, .stats { grid-template-columns: 1fr; }
  .seq-item { grid-template-columns: 1fr; gap: .4rem; }
  .footer-cols { grid-template-columns: 1fr; }
  .app-head { align-items: flex-start; }
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2.5px solid var(--teal-600); outline-offset: 2px; border-radius: 3px; }
.app-side :focus-visible, .hero :focus-visible, .band-navy :focus-visible { outline-color: var(--lime-500); }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--navy-900); color: #fff; padding: .7rem 1.1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .util-bar, .site-footer, .app-side, .mobile-appbar, .app-head-actions { display: none !important; }
  .app-main { padding: 0; background: #fff; }
  .panel { box-shadow: none; border-color: #ccc; }
}

/* ============================================================
   Module screens
   ============================================================ */

.side-empty { color: rgba(255,255,255,.55); font-size: .88rem; padding: .6rem .8rem; }

.tiles-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--teal-700); }
.chart .bar:hover { fill: var(--lime-500); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .x-label, .chart .y-label {
  font-family: var(--font-mono); font-size: 10px; fill: var(--ink-500);
}
.chart-foot { margin: .8rem 0 0; font-size: .88rem; color: var(--ink-500); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: .25rem; margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: .93rem; font-weight: 600; color: var(--ink-500);
  padding: .7rem 1rem; border-bottom: 2.5px solid transparent;
  white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--ink-900); }
.tab.is-active { color: var(--ink-900); border-bottom-color: var(--lime-500); }

/* ---------- Rows that act as buttons ---------- */
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--lime-050); }

.log-msg { max-width: 32ch; font-size: .86rem; color: var(--ink-700); }
.irn-cell { max-width: 24ch; word-break: break-all; }

.key-box {
  background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .7rem .8rem; word-break: break-all; margin: 0 0 .8rem;
}

/* ---------- Playground ---------- */
.play-grid { display: grid; grid-template-columns: 1fr 460px; gap: 1.2rem; align-items: start; }

.action-row { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; }
.action-row b { display: block; font-size: .96rem; }
.action-row span { font-size: .88rem; color: var(--ink-500); }

.payload-input {
  width: 100%; min-height: 260px; resize: vertical;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.55;
  padding: .8rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink-900);
}
.payload-input:focus {
  outline: none; border-color: var(--teal-700); box-shadow: 0 0 0 3px var(--teal-050);
}

.preset-row { margin-top: 1rem; }
.preset-label {
  display: block; font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-500); margin-bottom: .5rem;
}
.presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.preset {
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff;
  font: inherit; font-weight: 700; font-size: .88rem; color: var(--ink-700);
}
.preset:hover { border-color: var(--lime-500); background: var(--lime-050); color: var(--navy-900); }
.preset-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

.muted.is-ok { color: var(--ok); }
.muted.is-error { color: var(--risk); }

/* ---------- Console ---------- */
.console-panel { position: sticky; top: 1.2rem; display: flex; flex-direction: column; max-height: calc(100vh - 3rem); }
.console { overflow-y: auto; padding: .8rem; flex: 1; }
.console-empty { color: var(--ink-500); font-size: .9rem; padding: 1.5rem; text-align: center; margin: 0; }

.console-entry {
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm); margin-bottom: .6rem; overflow: hidden;
  animation: fade .2s ease;
}
.console-entry.is-ok { border-left-color: var(--ok); }
.console-entry.is-error { border-left-color: var(--risk); }
.console-entry.is-warn { border-left-color: var(--warn); }
.console-entry.is-info { border-left-color: var(--teal-600); }

.console-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .8rem;
  padding: .55rem .7rem; background: var(--mist);
}
.console-title { font-size: .88rem; font-weight: 600; }
.console-time { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-500); }
.console-body {
  margin: 0; padding: .7rem; max-height: 300px; overflow: auto;
  font-family: var(--font-mono); font-size: .74rem; line-height: 1.5;
  background: var(--navy-900); color: #dde5ec; white-space: pre-wrap; word-break: break-word;
}

@media (max-width: 1200px) {
  .play-grid { grid-template-columns: 1fr; }
  .console-panel { position: static; max-height: none; }
  .console { max-height: 460px; }
}
@media (max-width: 900px) {
  .tiles-3 { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; align-items: flex-start; }
  .action-row .btn { width: 100%; }
}

/* Notes cell mixes free text with a count badge; keep them apart. */
.log-msg .badge { margin-left: .4rem; vertical-align: baseline; }

/* ---------- Fiscal document editor ---------- */
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }

.buyer-row { display: grid; grid-template-columns: 130px 1fr; gap: .5rem; position: relative; }
.buyer-row select { width: 100%; }

.req { color: var(--risk); font-weight: 700; }

.items-table th.num-h { text-align: right; }
/* The VAT cell holds "TC01 — Taxable (15%)", so it needs room to stay readable. */
.items-table select[data-f="taxCodeId"] { min-width: 150px; }
.items-table select[data-f="nature"] { min-width: 96px; }
.items-table td { padding: .3rem .45rem; }
.items-table .line-total { min-width: 92px; }
.items-table thead th { padding-top: .3rem; }

.totals-panel .totals-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; align-items: end;
}
.totals-panel .field { margin-bottom: 0; }
.total-out {
  display: block; padding: .74rem .85rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--mist); color: var(--ink-700);
  font-family: var(--font-mono); font-size: .95rem; text-align: right;
}
.total-out.is-grand {
  background: var(--navy-900); color: #fff; border-color: var(--navy-900);
  font-weight: 600;
}

/* Add-document menu */
.add-menu { position: relative; }
.add-menu .btn { gap: .4rem; }
.add-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: .3rem;
}
.add-menu-list a {
  display: block; padding: .55rem .7rem; border-radius: 6px;
  color: var(--ink-900); font-size: .93rem; font-weight: 500;
}
.add-menu-list a:hover { background: var(--lime-050); text-decoration: none; }

@media (max-width: 1100px) {
  .doc-grid { grid-template-columns: 1fr; }
  .totals-panel .totals-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .buyer-row { grid-template-columns: 1fr; }
  .totals-panel .totals-row { grid-template-columns: 1fr; }
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(16,22,37,.5);
  display: grid; place-items: center; padding: 1.2rem;
  animation: fade .16s ease;
}
.modal-card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(520px, 100%); max-height: 90vh; display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 1.08rem; }
.modal-close {
  background: none; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1;
  color: var(--ink-300); padding: 0 .2rem;
}
.modal-close:hover { color: var(--ink-900); }
.modal-body { padding: 1.3rem; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: 1rem 1.3rem; border-top: 1px solid var(--line); background: var(--mist);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .3rem; text-align: center; cursor: pointer;
  padding: 2rem 1.2rem; margin-top: 1rem;
  border: 2px dashed var(--sage-400); border-radius: var(--radius);
  background: var(--lime-050);
  transition: background .16s ease, border-color .16s ease;
}
.dropzone:hover, .dropzone.is-over { background: var(--lime-100); border-color: var(--lime-600); }
.dropzone b { font-size: .98rem; }
.dropzone span { font-size: .86rem; color: var(--ink-500); }

/* ---------- Document view ---------- */
.fiscal-panel { border-left: 3px solid var(--lime-500); }
.fiscal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; }
.fiscal-grid b { display: block; font-size: 1.02rem; font-weight: 600; margin-top: .3rem; }
.fiscal-grid .wrap { word-break: break-all; font-size: .86rem; }
.fiscal-grid .tile-note { margin: .25rem 0 0; }
.deflist dd.wrap { word-break: break-all; }

@media (max-width: 900px) { .fiscal-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .fiscal-grid { grid-template-columns: 1fr; } }

/* Grid children default to min-content width, so a long IRN or account number
   pushes the whole track wider than its container. Let them shrink instead. */
.doc-grid > *, .fiscal-grid > *, .grid-2 > *, .grid-3 > *, .totals-row > * { min-width: 0; }
.deflist dd { overflow-wrap: anywhere; }

/* ---------- Accounting-package marks ---------- */
/* Some marks stack an icon above the wordmark, so 18px left them illegible. */
.api-logo {
  height: 22px; width: auto; max-width: 92px;
  object-fit: contain; vertical-align: middle;
  display: inline-block;
}
/* An inline wrapper, not a flex td — making the cell itself a flex container
   detaches it from the table and breaks the row border. */
.id-cell { white-space: nowrap; }
.id-cell .api-logo { margin-right: .45rem; }
.id-cell .badge { margin-left: .4rem; }
.api-logo { min-width: 26px; }

/* ---------- Compatible package wall (public site) ----------
   The marks carry the message here, so they sit on white tiles at a uniform
   optical height with the name underneath for anyone who does not recognise
   one — and for screen readers. */
.logo-wall {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.logo-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem .8rem .85rem; min-height: 96px;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.logo-tile:hover {
  border-color: var(--sage-400); transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.logo-tile img {
  height: 28px; width: auto; max-width: 108px; object-fit: contain; display: block;
}
.logo-name {
  font-size: .78rem; color: var(--ink-500); font-weight: 500; line-height: 1.25;
}
/* No artwork: the name becomes the tile. */
.logo-tile.is-textonly .logo-name { font-size: .95rem; color: var(--ink-900); font-weight: 600; }
.logo-note {
  margin: 1.1rem 0 0; font-size: .86rem; color: var(--ink-500); max-width: 60ch;
}
.band-navy .logo-note { color: rgba(255,255,255,.6); }

@media (max-width: 560px) {
  .logo-wall { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .logo-tile img { height: 24px; }
}

/* ---------- Row actions ---------- */
.row-actions { width: 1%; white-space: nowrap; text-align: right; }
.icon-btn {
  background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--ink-500); cursor: pointer; padding: .3rem;
  display: inline-grid; place-items: center; line-height: 0;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover:not(:disabled) { border-color: var(--line); color: var(--teal-700); background: #fff; }
.icon-btn:disabled { opacity: .4; cursor: progress; }

/* ---------- Connected system picker ---------- */
.system-grid {
  display: grid; gap: .8rem; margin: 1rem 0 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.system-tile {
  position: relative; cursor: pointer; font: inherit; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem .7rem .9rem; min-height: 96px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.system-tile:hover { border-color: var(--sage-400); transform: translateY(-2px); }
.system-tile.is-on { border-color: var(--lime-600); box-shadow: 0 0 0 3px var(--lime-100); }
.system-tile img { height: 26px; width: auto; max-width: 104px; object-fit: contain; }
.system-name { font-size: .8rem; color: var(--ink-500); font-weight: 500; }
.system-marks { position: absolute; left: .45rem; bottom: .4rem; display: flex; gap: .25rem; }
.system-marks .mark {
  font-size: .58rem; font-weight: 700; line-height: 1;
  padding: .18rem .28rem; border-radius: 4px;
  background: var(--mist); color: var(--ink-500);
}
.system-marks .mark.is-on { background: var(--lime-500); color: var(--navy-900); }
.system-marks .mark.is-beta { background: rgba(179,38,30,.12); color: var(--risk); }

/* ---------- Automatic connection ---------- */
.connect-intro { text-align: center; margin-bottom: 1.2rem; }
.connect-logo { height: 34px; width: auto; max-width: 140px; object-fit: contain; margin-bottom: .9rem; }
.connect-intro p { margin: 0; }

.connect-result { text-align: center; padding: 1.4rem 0 .4rem; }
.connect-mark {
  width: 54px; height: 54px; margin: 0 auto 1rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 700;
}
.connect-mark.is-ok { background: var(--lime-100); color: var(--ok); }
.connect-mark.is-error { background: rgba(179,38,30,.1); color: var(--risk); }

/* In a dialog the facts are a reference table, not prose: label and value on
   one line, so the response body is visible without scrolling past them. */
.modal .deflist > div {
  display: grid; grid-template-columns: 128px 1fr; gap: .8rem;
  padding: .42rem 0; border-top: 1px solid var(--line-soft);
}
.modal .deflist > div:first-child { border-top: 0; }
.modal .deflist > div:last-child { border-bottom: 0; }
.modal .deflist dt { font-size: .82rem; font-weight: 500; color: var(--ink-500); margin: 0; }
.modal .deflist dd { font-size: .88rem; }
.modal .deflist dd.wrap { word-break: break-all; }
.modal .code { white-space: pre-wrap; word-break: break-word; }
.modal .table td, .modal .table th { padding: .45rem .6rem; }

@media (max-width: 560px) {
  .modal .deflist > div { grid-template-columns: 1fr; gap: .1rem; }
}

/* ---------- Document tabs ---------- */
.tab-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 .3rem; margin-left: .35rem; border-radius: 100px;
  background: var(--lime-500); color: var(--navy-900);
  font-size: .68rem; font-weight: 700; line-height: 1;
}
.tab:not(.is-active) .tab-count { background: var(--line); color: var(--ink-500); }
.custom-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1.2rem; }
.custom-grid .field-note { margin-top: -.5rem; }
@media (max-width: 800px) { .custom-grid { grid-template-columns: 1fr; } }

/* ---------- Social links ---------- */
.social {
  list-style: none; display: flex; gap: .5rem; padding: 0; margin: 1.3rem 0 0;
}
.social a {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: rgba(255,255,255,.07);
  transition: background .16s ease, transform .16s ease;
}
.social a:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }
.social img { width: 22px; height: 22px; display: block; }

/* ---------- Segmented toggle ---------- */
.segmented {
  display: inline-flex; background: var(--mist);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px;
}
.seg {
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: .9rem; font-weight: 600; color: var(--ink-500);
  padding: .42rem .95rem; border-radius: 6px;
}
.seg:hover { color: var(--ink-900); }
.seg.is-on { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-sm); }

/* Buffers in the webhook detail, each in its own labelled block. */
.buffer-block { margin-top: 1.2rem; }
.buffer-block h4 { margin: 0 0 .5rem; }
.buffer-block .code { max-height: 26vh; overflow: auto; }
.buffer-block.is-error .code { border-left: 3px solid var(--risk); }
