/* ============================================================
   INFINOX knowledge base — same design system as
   callcenter.ixfluence.com / cpa.ixfluence.com (tokens copied
   from cpa-portal/public/style.css), plus article styles.
   ============================================================ */

/* ---------- Design tokens (shared) ---------- */
:root {
  --primitive-black:               #000;
  --primitive-white:               #fff;
  --primitive-brand-yellow:        #ffc200;
  --primitive-brand-yellow-border: #fec201;
  --primitive-brand-yellow-hover:  #ffd44c;
  --primitive-brand-orange:        #ff6200;
  --primitive-brand-orange-mid:    #ff9200;
  --primitive-brand-orange-light:  #fd9520;
  --primitive-brand-red:           #fd2720;
  --primitive-warm-black:          #140400;
  --primitive-warm-800:            #2a0800;
  --primitive-warm-700:            #4a1200;
  --primitive-neutral-950:         #0a0a0a;
  --primitive-neutral-900:         #111;
  --primitive-neutral-870:         #171717;
  --primitive-neutral-800:         #2d2d2d;

  --surface-page:     var(--primitive-black);
  --surface-card:     linear-gradient(180deg, var(--primitive-neutral-870), var(--primitive-neutral-950));
  --surface-warm:     linear-gradient(115deg, var(--primitive-warm-700) 0%, var(--primitive-warm-800) 45%, var(--primitive-warm-black) 100%);
  --surface-inset:    rgba(0,0,0,0.35);
  --text-default:     var(--primitive-white);
  --text-muted:       rgba(255,255,255,0.60);
  --text-subtle:      rgba(255,255,255,0.38);
  --text-accent:      var(--primitive-brand-yellow);
  --text-inverse:     var(--primitive-black);
  --border-card:      rgba(255,255,255,0.08);
  --border-input:     rgba(255,255,255,0.16);
  --border-brand-soft: rgba(255,194,0,0.30);

  --gradient-brand:       radial-gradient(ellipse 95% 85% at 79% 5%, var(--primitive-brand-orange) 0%, var(--primitive-brand-orange-mid) 50%, var(--primitive-brand-yellow) 100%);
  --gradient-brand-hover: radial-gradient(ellipse 130% 115% at 88% -5%, var(--primitive-brand-orange) 0%, var(--primitive-brand-orange-mid) 45%, var(--primitive-brand-yellow-hover) 100%);

  --radius-base:   5px;
  --radius-medium: 8px;
  --radius-large:  12px;

  --font-base: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Payout flows — three steps along the brand gradient */
  --flow-weekly:  var(--primitive-brand-yellow);
  --flow-prepay:  var(--primitive-brand-orange-mid);
  --flow-monthly: var(--primitive-brand-orange);

  /* Field colours — what to swap in each email */
  --f-dept:    #8ab4ff;
  --f-partner: #ff8fbd;
  --f-geo:     #6fe0a8;
  --f-period:  #ffd166;
  --f-inv:     #c4a7ff;
  --f-amt:     #5fd4e6;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font: 15px/1.55 var(--font-base);
  background: var(--surface-page);
  color: var(--text-default);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(255, 98, 0, 0.12), transparent 70%),
    radial-gradient(ellipse 40% 30% at 90% 100%, rgba(255, 194, 0, 0.07), transparent 60%);
  background-attachment: fixed;
}
a { color: var(--text-accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primitive-brand-yellow-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primitive-brand-yellow); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; text-wrap: balance; }

/* ---------- Header ---------- */
.topbar {
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
  position: sticky; top: 0; z-index: 20;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; }
.brand { white-space: nowrap; color: var(--text-accent); font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.brand:hover { text-decoration: none; color: var(--primitive-brand-yellow-hover); }
.topbar nav { display: flex; gap: 24px; flex-wrap: wrap; }
.topbar nav a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.topbar nav a:hover { color: var(--text-default); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-large);
  padding: 24px;
  border: 1px solid var(--border-card);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-accent); }
.label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }

/* Buttons */
.btn {
  cursor: pointer; padding: 7px 14px; border-radius: var(--radius-medium);
  font: 500 13px/1 var(--font-base); white-space: nowrap;
  background: rgba(255,194,0,0.08); color: var(--text-default);
  border: 1px solid var(--border-brand-soft);
  transition: background .18s, border-color .18s, color .15s;
}
.btn:hover { background: rgba(255,194,0,0.18); border-color: var(--primitive-brand-yellow); }
.btn.primary { background: var(--gradient-brand); color: var(--text-inverse); border-color: transparent; font-weight: 600; box-shadow: 0 4px 16px rgba(255,98,0,0.25); }
.btn.primary:hover { background: var(--gradient-brand-hover); }

/* ---------- Hero ---------- */
.hero {
  background: var(--surface-warm);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-large);
  padding: 36px 32px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 60% at 90% 0%, rgba(255,98,0,0.35), transparent 70%);
}
.hero > * { position: relative; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.hero p { margin: 0; color: var(--text-muted); max-width: 64ch; }

.page { display: flex; flex-direction: column; gap: 48px; padding-block: 40px 96px; }

/* ---------- Overview: three flows ---------- */
.flows-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ov {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface-card); border: 1px solid var(--border-card);
  border-radius: var(--radius-large); padding: 20px;
  color: inherit; position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.ov::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c); }
.ov:hover { text-decoration: none; border-color: var(--c); color: inherit; }
.ov .tag { font: 500 11px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--c); }
.ov .name { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.ov dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.ov dt { color: var(--text-subtle); }
.ov dd { margin: 0; font-weight: 500; }
.ov .go { font-size: 13px; color: var(--c); margin-top: auto; }

/* ---------- Field key & pills ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 18px; }
.legend .label { margin-right: 6px; }
.f {
  --fc: var(--text-default);
  color: var(--fc);
  background: color-mix(in srgb, var(--fc) 14%, transparent);
  border-radius: 4px; padding: 1px 6px; font-weight: 500;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.f.ph { font-family: var(--font-mono); font-size: .88em; border: 1px dashed color-mix(in srgb, var(--fc) 60%, transparent); background: transparent; }
.f-dept { --fc: var(--f-dept); } .f-partner { --fc: var(--f-partner); } .f-geo { --fc: var(--f-geo); }
.f-period { --fc: var(--f-period); } .f-inv { --fc: var(--f-inv); } .f-amt { --fc: var(--f-amt); }
.legend .f { font-size: 13px; }

/* ---------- Flow section ---------- */
.flow { display: flex; flex-direction: column; gap: 28px; scroll-margin-top: 80px; }
.flow-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border-card); position: relative;
}
.flow-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 80px; height: 2px; background: var(--c); }
.flow-head .tag { font: 500 11px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--c); }
.flow-head h2 { font-size: 24px; font-weight: 600; margin-top: 4px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact {
  font-size: 13px; border-radius: 20px; padding: 5px 12px;
  background: color-mix(in srgb, var(--c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  color: var(--text-muted);
}
.fact b { color: var(--c); font-weight: 600; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tab {
  cursor: pointer; font: 500 12.5px var(--font-base);
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border-input); border-radius: var(--radius-base); padding: 6px 10px;
  transition: background .15s, border-color .15s, color .15s;
}
.tab:hover { color: var(--text-default); border-color: var(--text-subtle); }
.tab[aria-selected="true"] { background: var(--c); border-color: var(--c); color: var(--text-inverse); font-weight: 600; }

/* ---------- Email mock ---------- */
.mail { background: var(--surface-card); border: 1px solid var(--border-card); border-radius: var(--radius-large); overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,0.4); }
.mail.tpl { background: var(--surface-inset); border: 1px dashed var(--border-input); box-shadow: none; }
.mrow { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border-card); font-size: 13.5px; }
.mrow .k { padding-top: 2px; }
.mrow .v { min-width: 0; overflow-wrap: anywhere; }
.subject .v { font-weight: 600; line-height: 1.8; }
.addr { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.addr span { font: 12px var(--font-mono); color: var(--text-muted); background: rgba(255,255,255,0.05); border: 1px solid var(--border-card); border-radius: 4px; padding: 1px 6px; }
.addr .rep { border-style: dashed; border-color: var(--border-brand-soft); color: var(--text-accent); background: transparent; }
.mbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.mbody .inv { font-weight: 600; line-height: 1.8; }
.mbody ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.mbody li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px; margin: 0; color: var(--text-default); }
.mbody li .lk { color: var(--text-subtle); }
.bundle { display: flex; flex-direction: column; gap: 14px; }
.bundle .item { border-left: 2px solid var(--border-input); padding-left: 12px; display: flex; flex-direction: column; gap: 6px; }
.attach {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 100%;
  font: 12px var(--font-mono); color: var(--text-muted); overflow-wrap: anywhere;
  border: 1px solid var(--border-input); border-radius: var(--radius-base); padding: 6px 10px;
}
.attach::before { content: "PDF"; flex: none; font: 700 10px var(--font-base); color: var(--text-inverse); background: var(--gradient-brand); border-radius: 3px; padding: 2px 5px; }

/* ---------- Notes ---------- */
.note {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.55;
  padding: 12px 14px; background: rgba(0,0,0,0.25);
  border-left: 2px solid var(--c, var(--primitive-brand-yellow));
  border-radius: var(--radius-base);
}
.note b { color: var(--text-default); }
.empty {
  border: 1px dashed var(--border-input); border-radius: var(--radius-large);
  padding: 22px 20px; color: var(--text-muted); font-size: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.empty b { color: var(--text-default); }

/* ---------- Invoice number anatomy ---------- */
.anatomy { display: flex; flex-direction: column; gap: 18px; }
.anatomy h2 { font-size: 20px; font-weight: 600; }
.an-row { display: flex; flex-wrap: wrap; gap: 24px 48px; }
.an { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.an .num { display: flex; flex-wrap: wrap; font: 500 clamp(18px, 3vw, 24px) var(--font-mono); }
.an .num span { padding: 2px 1px 4px; border-bottom: 3px solid currentColor; }
.an .num .h { color: var(--text-subtle); }
.an .parts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-muted); }
.an .parts i { font-style: normal; font-weight: 600; font-family: var(--font-mono); }
.c-date { color: var(--f-period); } .c-name { color: var(--f-partner); } .c-id { color: var(--f-inv); } .c-sfx { color: var(--primitive-brand-orange); }

/* ---------- Home: article list ---------- */
.articles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.article { display: flex; flex-direction: column; gap: 10px; color: inherit; transition: border-color .15s; }
.article:hover { text-decoration: none; color: inherit; border-color: var(--border-brand-soft); }
.article h2 { font-size: 18px; font-weight: 600; }
.article p { margin: 0; color: var(--text-muted); font-size: 14px; }
.article .go { color: var(--text-accent); font-size: 13px; margin-top: 4px; }

footer.foot { color: var(--text-subtle); font-size: 12.5px; border-top: 1px solid var(--border-card); padding-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 768px) {
  .flows-overview { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: 16px; }
  .page { gap: 36px; }
  #flows { gap: 64px !important; }
  .topbar .wrap { padding: 12px 16px; }
  .hero { padding: 26px 20px; }
}
@media (max-width: 860px) { .topbar nav { display: none; } }
@media (max-width: 520px) {
  .mrow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .mbody li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .topbar nav { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* ---------- Template-only flow ---------- */
.cols.single { grid-template-columns: minmax(0, 640px); }

/* ---------- Gmail message view (examples) ----------
   Deliberately light, like a screenshot of Gmail on the dark page. */
.gmail {
  --g-bg: #fff; --g-fg: #202124; --g-muted: #5f6368; --g-line: #dadce0; --g-chip: #f1f3f4;
  /* field colours darkened for a white ground */
  --f-dept: #1a56c4; --f-partner: #b0175a; --f-geo: #0b7a46; --f-period: #8a5a00; --f-inv: #6a35c9; --f-amt: #0b6e80;
  background: var(--g-bg); color: var(--g-fg);
  border-radius: var(--radius-large); overflow: hidden;
  font: 14px/1.5 "Roboto", Arial, Helvetica, sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px rgba(0,0,0,.55);
}
.gmail .f { background: color-mix(in srgb, var(--fc) 12%, transparent); font-weight: 500; padding: 0 3px; }
.gi { width: 20px; height: 20px; fill: var(--g-muted); flex: none; }
.gi.sm { width: 18px; height: 18px; vertical-align: middle; margin-left: -2px; }
.g-muted { color: var(--g-muted); }
.g-tool { display: flex; align-items: center; gap: 22px; padding: 12px 18px; border-bottom: 1px solid var(--g-line); }
.g-sep { width: 1px; height: 20px; background: var(--g-line); margin: 0 -6px; }
.g-grow { flex: 1; }
.g-subj { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 18px 20px 6px 72px; }
.g-subj h4 { margin: 0; font: 400 21px/1.35 "Roboto", Arial, sans-serif; color: var(--g-fg); letter-spacing: 0; overflow-wrap: anywhere; min-width: 0; }
.g-label { font-size: 12px; background: var(--g-chip); color: var(--g-muted); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.g-label b { font-weight: 400; margin-left: 2px; }
.g-msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 20px 20px 20px; }
.g-avatar { width: 40px; height: 40px; border-radius: 50%; background: #e8710a; color: #fff; display: grid; place-items: center; font: 500 18px "Roboto", Arial, sans-serif; }
.g-main { min-width: 0; display: flex; flex-direction: column; }
.g-from { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.g-from b { font-weight: 700; }
.g-right { display: inline-flex; align-items: center; gap: 14px; font-size: 12px; }
.g-to { font-size: 12px; margin-top: 1px; overflow-wrap: anywhere; }
.g-details {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px;
  margin-top: 8px; padding: 10px 12px; font-size: 12px;
  border: 1px solid var(--g-line); border-radius: 4px; box-shadow: 0 1px 3px rgba(60,64,67,.15);
}
.g-details > span:nth-child(odd) { color: var(--g-muted); text-align: right; }
.g-details > span:nth-child(even) { overflow-wrap: anywhere; }
.g-body { margin-top: 18px; font: 14px/1.6 Arial, Helvetica, sans-serif; }
.g-body p { margin: 0; }
.g-body ul { margin: 2px 0 14px; padding-left: 28px; }
.g-body li { margin: 0; color: var(--g-fg); }
.g-body ul:last-child { margin-bottom: 0; }
.g-att-head { font-size: 13px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--g-line); }
.g-att { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s, border-color .15s; margin-top: 10px; width: 200px; max-width: 100%; border: 1px solid var(--g-line); border-radius: 6px; overflow: hidden; }
.g-thumb { height: 92px; background: var(--g-chip); display: grid; place-items: center; }
.g-thumb span { font: 700 13px Arial, sans-serif; color: #fff; background: #d93025; border-radius: 3px; padding: 6px 8px; }
.g-name { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; font-weight: 500; }
.g-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.g-pdf { flex: none; font: 700 8px Arial, sans-serif; color: #fff; background: #d93025; border-radius: 2px; padding: 2px 3px; }
.g-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.g-actions span { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #747775; border-radius: 18px; padding: 7px 18px 7px 14px; font-weight: 500; color: #444746; }
.g-actions .gi { width: 18px; height: 18px; fill: #444746; }
@media (max-width: 520px) {
  .g-subj { padding-left: 20px; }
  .g-tool { gap: 16px; }
  .g-right .gi { display: none; }
}
.g-att:hover { text-decoration: none; color: inherit; border-color: #1a73e8; box-shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px rgba(60,64,67,.15); }
.g-att:hover .g-name > span:last-child { color: #1a73e8; }
