/*
 * Kibo design system. Change the look here only:
 *   1. Tokens (colours, fonts, sizes)   2. Base elements   3. Components   4. Layout helpers
 *   5. Client form   6. Admin pages     7. Small screens
 * Pages use these classes; the only inline styles are data-driven widths (progress bars).
 */

/* ---------- 1. Tokens ---------- */
:root {
  --brand: #004aad;          /* main colour (Kibo logo blue): header, buttons, progress */
  --brand-ink: #ffffff;      /* text on brand colour */
  --brand-soft: #e6eef9;     /* light brand background */
  --bg: #f3f5f9;             /* page background */
  --card: #ffffff;
  --ink: #1b2420;            /* main text */
  --muted: #64716b;          /* secondary text */
  --line: #dfe5e2;           /* borders */
  --input-line: #c9d2ce;
  --warn-bg: #fff6e0; --warn-ink: #7a5300;
  --ok-bg: #e6f4ea;   --ok-ink: #1e5631;
  --info-bg: #e3edff; --info-ink: #1d4ed8;
  --purple-bg: #f1e8ff; --purple-ink: #6b21a8;
  --err: #b42318;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --radius-s: 10px;
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem; --space-6: 2rem;
  --page-width: 1100px;
  --form-width: 640px;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--brand); }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 var(--space-2); }
h2 { font-size: 1.1rem; margin: 0 0 var(--space-3); }
h3 { font-size: 1rem; margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
input, select, textarea { width: 100%; font: inherit; padding: .7rem .8rem; border: 1px solid var(--input-line); border-radius: var(--radius-s); background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=file] { padding: .5rem; }

/* ---------- 3. Components ---------- */
.topbar { background: var(--brand); color: var(--brand-ink); padding: var(--space-3) var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.topbar nav { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.topbar a { color: var(--brand-ink); text-decoration: none; opacity: .9; }
.topbar a:hover, .topbar a.on { opacity: 1; text-decoration: underline; }
.topbar .nav-link { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); opacity: .9; cursor: pointer; }
.topbar .nav-link:hover { opacity: 1; text-decoration: underline; }
.brand { font-weight: 700; display: flex; align-items: center; gap: var(--space-2); }
.topbar a.brand { opacity: 1; }
.topbar a.brand:hover { text-decoration: none; }
/* Client pages: brand on the left, home + language on the right, always on one line and the same height. */
.client-top { flex-wrap: nowrap; }
.client-top .brand { min-width: 0; }
.client-top .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.topbar .home-link { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; font-size: .875rem; font-weight: 600; opacity: 1; white-space: nowrap; }
.topbar .home-link:hover { text-decoration: none; background: rgba(255,255,255,.12); }
.client-top .lang-switch { gap: 0; height: 32px; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; overflow: hidden; }
.client-top .lang-switch[hidden] { display: none; }
.client-top .lang-switch button { border: 0; border-radius: 0; height: 100%; padding: 0 10px; font-size: .8rem; }
.client-top .lang-switch button + button { border-left: 1px solid rgba(255,255,255,.5); }
.lg-short { display: none; }
@media (max-width: 560px) {
  .lg-long { display: none; }
  .lg-short { display: inline; }
}
@media (max-width: 360px) {
  .home-text { display: none; }
}
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand-ink); color: var(--brand); font-weight: 800; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-5); }
.card + .card, .section + .section { margin-top: var(--space-4); }
.section { margin-bottom: var(--space-5); }

.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--radius-s); padding: .65rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.link { border: 0; background: none; color: var(--brand); padding: .4rem 0; font-weight: 500; }
.btn.small { padding: .35rem .7rem; font-size: .875rem; }
.btn.big { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn.danger { color: var(--err); }
.btn.block { width: 100%; }

.field { margin-bottom: var(--space-4); }
.hint { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.error { color: var(--err); font-size: .9rem; margin-top: .3rem; }
.alert { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-s); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.info { background: var(--info-bg); color: var(--info-ink); }
.alert > * + * { margin-top: var(--space-1); }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: #eceff1; color: #455a64; white-space: nowrap; }
.badge.in_progress { background: var(--warn-bg); color: var(--warn-ink); }
.badge.submitted { background: var(--info-bg); color: var(--info-ink); }
.badge.filed { background: var(--purple-bg); color: var(--purple-ink); }
.badge.done { background: var(--ok-bg); color: var(--ok-ink); }
.badge.expired { background: #fde8e8; color: var(--err); }

details > summary { cursor: pointer; }
details > summary h2 { display: inline; }
details[open] > summary { margin-bottom: var(--space-3); }

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); margin-bottom: var(--space-4); overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }

.checks { display: grid; gap: var(--space-2); }
.check { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .75rem .9rem; font-weight: 500; cursor: pointer; margin: 0; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check.off, .chip.off { opacity: .55; cursor: not-allowed; }
.check small { color: var(--muted); font-weight: 400; }
.field.is-unclear input, .field.is-unclear select, .field.is-unclear textarea { border-color: var(--warn-ink); background: var(--warn-bg); }
.unclear { color: var(--warn-ink); font-size: .9rem; font-weight: 600; margin-top: .3rem; }
.scan-panel { position: fixed; top: 64px; bottom: 16px; left: 16px; width: calc(100vw - var(--form-width) - 72px); overflow: auto; display: grid; gap: var(--space-3); align-content: start; }
.scan-panel img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.scan-panel iframe { width: 100%; height: calc(100vh - 100px); border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.scan-panel iframe.scan-text { height: 60vh; }
.wizard:has(.scan-panel) { margin-left: auto; margin-right: 24px; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); background: var(--brand-soft); border-radius: var(--radius-s); padding: var(--space-3); margin: var(--space-2) 0; }
.sum span { display: block; font-size: .8rem; color: var(--muted); }
.sum b { font-size: 1.05rem; }
.sum.bad { background: var(--warn-bg); }
.sum-line { margin: .3rem 0 0; font-weight: 600; color: var(--brand); }
@media (max-width: 420px) { .sum { grid-template-columns: 1fr; } }
.check.consent { margin: var(--space-4) 0 var(--space-2); font-weight: 500; align-items: flex-start; }
.check.consent input { margin-top: .2rem; }
.check.select-all { margin-bottom: var(--space-3); font-weight: 600; }
.section-start { text-align: center; padding-top: var(--space-6); }
.section-start .nav { flex-direction: column-reverse; align-items: stretch; gap: var(--space-2); }
.person-badge { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto var(--space-4); border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 1.8rem; font-weight: 800; }
.done-list { display: inline-block; text-align: left; margin: 0 auto var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-s); background: var(--ok-bg); color: var(--ok-ink); font-weight: 500; }
.done-list .hint { margin: 0 0 var(--space-1); }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 99px; padding: .4rem .8rem; font-weight: 500; font-size: .9rem; cursor: pointer; margin: 0; background: var(--card); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.inline-check { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 500; margin: 0; }

.copy-row { display: grid; grid-template-columns: 11rem 1fr auto; gap: var(--space-2); align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); font-size: .93rem; }
.copy-row:first-of-type { border-top: 0; }
.copy-row > span { color: var(--muted); }
.copy-row > b { font-weight: 500; overflow-wrap: anywhere; }
.copy { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .2rem .55rem; font-size: .8rem; cursor: pointer; color: var(--muted); }
.copy:hover { color: var(--brand); border-color: var(--brand); }
.copy.done { color: var(--ok-ink); border-color: var(--ok-ink); }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfa; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.actions { text-align: right; white-space: nowrap; }
.minibar { width: 80px; height: 6px; background: #e3e8e6; border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: .4rem; }
.minibar > i { display: block; height: 100%; background: var(--brand); }

.linkbox { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; background: var(--brand-soft); border-radius: var(--radius-s); padding: var(--space-3); }
.linkbox input { flex: 1 1 260px; width: auto; }

.rowform { display: grid; gap: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: var(--space-3); margin-bottom: .6rem; position: relative; }
.rowform .remove { position: absolute; top: .4rem; right: .5rem; }
.numbered { display: grid; gap: .4rem; counter-reset: item; }
.numbered > .item { display: grid; grid-template-columns: 2.6rem 1fr auto; gap: var(--space-2); align-items: start; counter-increment: item; }
.numbered > .item::before { content: counter(item, upper-roman) "."; font-weight: 700; color: var(--muted); padding-top: .65rem; text-align: right; }
.numbered.lower > .item::before { content: "(" counter(item, lower-roman) ")"; }
.numbered.plain > .item::before { content: counter(item) "."; }
.numbered textarea { min-height: 3.2rem; font-size: .92rem; }
.item-tools { display: flex; flex-direction: column; gap: .2rem; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(4px); padding: var(--space-3) 0; display: flex; gap: var(--space-3); justify-content: flex-end; align-items: center; border-top: 1px solid var(--line); margin-top: var(--space-4); flex-wrap: wrap; }
.save-state { color: var(--muted); font-size: .85rem; margin-right: auto; }

/* ---------- 4. Layout helpers ---------- */
.page { max-width: var(--page-width); margin: 0 auto; padding: var(--space-5) 16px 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-narrow { max-width: 720px; }
.narrow { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.span2 { grid-column: span 2; }
.search { display: flex; gap: var(--space-2); max-width: 560px; }
.search input { flex: 1; min-width: 0; padding-top: .6rem; padding-bottom: .6rem; }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1 1 auto; }
.align-end { display: flex; align-items: flex-end; }
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.upper { text-transform: uppercase; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- 5. Client form ---------- */
.wizard { max-width: var(--form-width); margin: 0 auto; padding: var(--space-4) 16px 3rem; }
.lang-switch { display: flex; gap: .25rem; }
.lang-switch button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: var(--brand-ink); border-radius: 6px; padding: .15rem .5rem; font: inherit; font-size: .8rem; cursor: pointer; }
.lang-switch button.on { background: var(--brand-ink); color: var(--brand); }
.progress-wrap { margin: var(--space-2) 0 var(--space-4); }
.progress-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); font-weight: 600; }
.progress { height: 10px; background: #dbe3df; border-radius: 99px; overflow: hidden; margin: .35rem 0; }
.progress > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .35s ease; }
.progress-cheer { font-size: .9rem; }
.kicker { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); margin-bottom: .35rem; }
.help { color: var(--muted); margin: 0 0 1.1rem; }
.nav { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-5); }
.nav.end { justify-content: flex-end; }
.saved { font-size: .8rem; color: var(--muted); margin-top: .6rem; min-height: 1.2em; }
.needlist { display: grid; gap: var(--space-4); margin: var(--space-4) 0; }
.needlist > div { background: var(--bg); border-radius: var(--radius-s); padding: .9rem 1rem; }
.needlist ul, .needlist ol { margin: .2rem 0 0; padding-left: 1.2rem; }
.needlist li { margin: .15rem 0; }
.review-block { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .8rem 1rem; margin-bottom: .8rem; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.review-head h2 { margin: 0; }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: var(--space-2); padding: .25rem 0; font-size: .92rem; border-top: 1px dashed var(--line); }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; overflow-wrap: anywhere; }
.center { text-align: center; }
.done { text-align: center; padding: var(--space-6) var(--space-5); }
.bigcheck { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 2rem; display: grid; place-items: center; margin: 0 auto var(--space-4); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 6. Admin pages ---------- */
.text-editor .text-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.text-editor .text-row:first-of-type { border-top: 0; }
.text-editor .text-id { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); font-family: ui-monospace, monospace; }
.text-editor textarea { font-size: .9rem; min-height: 2.6rem; }
.text-editor .changed textarea { border-color: var(--brand); background: var(--brand-soft); }
.sector-list a { display: block; padding: .45rem .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.sector-list a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sector-list a:hover { background: var(--bg); }
.sector-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-4); align-items: start; }
.sector-select { display: none; }

/* ---------- 7. Small screens ---------- */
@media (max-width: 720px) {
  .sector-layout { grid-template-columns: 1fr; }
  .sector-layout .sector-list { display: none; }
  .sector-select { display: block; }
  .text-editor .text-row { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; gap: 0; }
  .copy-row { grid-template-columns: 1fr auto; }
  .copy-row > span { grid-column: 1 / -1; font-size: .8rem; }
  table.list .hide-sm { display: none; }
  h1 { font-size: 1.25rem; }
}

/* Business activity picker (business name form) */
.act-pill { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border: 1px solid var(--brand); background: var(--brand-soft); border-radius: var(--radius-s); padding: .6rem .9rem; margin-bottom: var(--space-2); }
.act-pill small { display: block; color: var(--muted); font-size: .8rem; }
.act-search { margin-bottom: var(--space-2); }
.act-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-s); padding: var(--space-2); }
.act-results .hint { margin: var(--space-1) var(--space-1) var(--space-2); }
.act-opt { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: .5rem .6rem; font: inherit; color: var(--ink); cursor: pointer; }
.act-opt:hover, .act-opt:focus { background: var(--brand-soft); }
.act-opt small { display: block; color: var(--muted); font-size: .78rem; }

/* Business names: kind badge, more BRELA steps, and the steps card on the client page */
.badge.kind { background: var(--brand-soft); color: var(--brand); }
.badge.signed { background: var(--warn-bg); color: var(--warn-ink); }
.badge.paid { background: var(--purple-bg); color: var(--purple-ink); }
form.inline { display: inline; }
.steps .step { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.steps .step:first-of-type { border-top: 0; }
.step-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: #eceff1; color: var(--muted); }
.step.done .step-mark { background: var(--ok-bg); color: var(--ok-ink); }
.step.now .step-mark { background: var(--brand); color: #fff; }
.step-body { flex: 1; min-width: 0; }
.step-head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; min-height: 28px; }
.step.todo .step-head b { color: var(--muted); }
.step .doc { margin-top: var(--space-1); overflow-wrap: anywhere; }
.step .upload { margin-top: var(--space-2); }
.step .upload input { width: auto; flex: 1; min-width: 0; }
.filters { display: flex; gap: var(--space-1); margin-bottom: var(--space-3); flex-wrap: wrap; }
.filters a { padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 600; }
.filters a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.log { white-space: pre-wrap; word-break: break-word; font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: var(--space-3); max-height: 360px; overflow: auto; }

/* Name generator (majina.php) */
.wizard.wide { max-width: 920px; }
.gen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); margin-top: var(--space-4); }
.gen-grid .span2 { grid-column: 1 / -1; }
.seg { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.seg button { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: .5rem 1rem; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; }
.seg button:hover { border-color: var(--brand); }
.seg button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.seg.compact { gap: 6px; }
.seg.compact button { padding: .35rem .8rem; font-size: .85rem; font-weight: 500; }
.gen-own { margin-top: var(--space-3); }
.gen-results h2 { margin-bottom: var(--space-3); }
.gen-filter { margin-bottom: var(--space-4); }
.gen-filter .count, .name-group h3 .count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 700; text-align: center; }
.gen-filter button.on .count { background: rgba(255,255,255,.25); color: inherit; }
.name-group { margin-bottom: var(--space-5); }
.name-group h3 { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: 1rem; }
.nav.center { justify-content: center; }
/* Name generator: the loading card over the page */
body.gen-locked { overflow: hidden; }
.gen-veil { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--space-4); background: rgba(8, 24, 56, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease; }
.gen-veil.in { opacity: 1; }
.gen-pop { width: min(360px, 100%); background: var(--card); border-radius: 22px; padding: 28px 24px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0, 20, 60, .35); transform: translateY(14px) scale(.96); transition: transform .35s cubic-bezier(.2, .9, .3, 1.2); outline: none; }
.gen-veil.in .gen-pop { transform: none; }
.gen-pop h2 { margin: 14px 0 10px; font-size: 1.1rem; }
.gen-ring { position: relative; width: 132px; height: 132px; margin: 0 auto; }
.gen-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.gen-ring circle { fill: none; }
.gen-ring .g1 { stop-color: var(--brand); }
.gen-ring .g2 { stop-color: #33b5f0; }
.gen-ring .track { stroke: var(--brand-soft); stroke-width: 10; }
.gen-ring .bar { stroke: url(#gen-grad); stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 2px 6px rgba(0, 90, 200, .35)); }
.gen-ring .orbit { stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 2 9; opacity: .35; transform-origin: 60px 60px; animation: gen-spin 6s linear infinite; }
.gen-pct { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; align-items: baseline; color: var(--brand); }
.gen-pct b { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gen-pct small { font-size: 1rem; font-weight: 700; margin-left: 2px; }
.gen-preview { display: inline-block; min-width: 60%; padding: 8px 16px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 800; letter-spacing: .08em; font-size: .95rem; min-height: 1.3em; }
.gen-pop.finished .gen-preview { background: #e3f6ea; color: #17803d; animation: gen-pop-in .4s ease; }
.gen-pop.finished .gen-ring { animation: gen-pop-in .45s ease; }
.gen-steps { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; display: grid; gap: 9px; }
.gen-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; opacity: .55; transition: opacity .25s, color .25s; }
.gen-steps li.step-now { opacity: 1; color: var(--ink); font-weight: 600; }
.gen-steps li.step-done { opacity: 1; color: var(--ink); }
.gen-steps .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 11px; line-height: 1; }
.gen-steps li.step-now .dot { border-color: var(--brand-soft); border-top-color: var(--brand); animation: gen-spin .8s linear infinite; }
.gen-steps li.step-done .dot { border-color: #22a35a; background: #22a35a; color: #fff; }
.gen-steps li.step-done .dot::after { content: "✓"; font-weight: 800; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
@keyframes gen-pop-in { 0% { transform: scale(1); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .gen-ring .orbit, .gen-steps li.step-now .dot { animation: none; } .gen-pop { transition: none; } }
.gen-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: var(--space-4); background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.gen-tabs button { appearance: none; border: 0; background: transparent; color: var(--ink); border-radius: 9px; padding: .7rem .5rem; font: inherit; font-weight: 700; cursor: pointer; }
.gen-tabs button.on { background: var(--brand); color: var(--brand-ink); }
.gen-add { margin: -.25rem 0 var(--space-3); }
.help.small { font-size: .88rem; margin-bottom: var(--space-3); }
.gen-results { margin-top: var(--space-5); }
.gen-results h2, .favs h2, .gen-tips h2 { margin: 0; font-size: 1.1rem; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.name-card { display: flex; flex-direction: column; gap: var(--space-2); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }
.name-card .name { font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; line-height: 1.3; overflow-wrap: anywhere; }
.name-card .note { color: var(--muted); font-size: .85rem; min-height: 1.2em; }
.name-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }
.name-actions .btn:not(.primary) { flex: 1; }
.name-actions .primary { flex-basis: 100%; }
.btn.starred { border-color: #c99a06; color: #8a6a00; background: #fff8e1; }
.favs { margin-top: var(--space-5); }
.fav-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.fav { display: inline-flex; align-items: center; gap: .4rem; background: #fff8e1; border: 1px solid #f0d78a; border-radius: 99px; padding: .3rem .4rem .3rem .8rem; font-weight: 700; font-size: .88rem; }
.fav button { appearance: none; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: .9rem; padding: 0 .3rem; }
.gen-tips { margin-top: var(--space-5); }
.gen-tips ul { margin: var(--space-3) 0 0; padding-left: 1.2rem; color: var(--muted); }
.gen-tips li { margin: .3rem 0; }
@media (max-width: 640px) {
  .gen-grid { grid-template-columns: 1fr; }
}

/* A button that opens a short list of links (dashboard: blank paper forms) */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: var(--space-1); }
.menu-list a { display: block; padding: .55rem .8rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; }
.menu-list a:hover { background: var(--brand-soft); }

/* Partnership deed page */
.grid-when { display: grid; grid-template-columns: 2fr 1fr 1.4fr 1fr; gap: 0 var(--space-3); }
.list .num { text-align: right; white-space: nowrap; }
@media (max-width: 640px) { .grid-when { grid-template-columns: 1fr 1fr; } }

/* Home page (index.php): one language shown at a time */
html[lang="sw"] .l-en, html[lang="en"] .l-sw { display: none; }
html:not([lang="en"]) .l-en { display: none; }
.home { max-width: 980px; margin: 0 auto; padding: var(--space-5) 16px 3rem; }
.hero { text-align: center; padding: var(--space-5) 0 var(--space-5); }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.2; margin: 0 0 var(--space-3); }
.hero .lead { color: var(--muted); font-size: 1.08rem; max-width: 640px; margin: 0 auto; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); }
.svc { display: flex; flex-direction: column; gap: var(--space-2); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-5); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.svc:hover { border-color: var(--brand); box-shadow: 0 8px 24px rgba(0, 74, 173, .12); transform: translateY(-2px); }
.svc h2 { margin: var(--space-1) 0 0; font-size: 1.2rem; }
.svc p { margin: 0; color: var(--muted); font-size: .95rem; }
.svc .svc-go { margin-top: auto; align-self: stretch; }
.svc .svc-draft { color: var(--warn-ink); font-weight: 600; font-size: .88rem; }
.svc.has-draft { border-color: var(--warn-ink); }
.svc.gen { background: var(--brand-soft); border-color: transparent; }
.svc-icon { width: 40px; height: 40px; fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.others { margin-top: var(--space-5); }
.others h2 { margin: 0; font-size: 1.15rem; }
.other-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.other-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: .7rem 0; border-top: 1px solid var(--line); }
.other-list li:first-child { border-top: 0; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; flex: none; }
.center { text-align: center; }
.done .nav { justify-content: center; }

/* Partners (admin Partners page) and the partner's own dashboard (portal.php) */
.narrow-card { max-width: 560px; }
.grid2.tight { gap: 0 var(--space-4); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); text-decoration: none; color: var(--ink); }
.stat span { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
a.stat:hover { border-color: var(--brand); }
.pay-row, .doc-row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px dashed var(--line); overflow-wrap: anywhere; }
.pay-row > div, .doc-row > div { min-width: 0; }
.topbar-who { opacity: .9; }
.portal h2 { margin-top: var(--space-5); }
.job-card { margin-bottom: var(--space-3); }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.job-head > div { min-width: 0; overflow-wrap: anywhere; }
.track { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: 6px; }
.track li { position: relative; padding-left: 26px; font-size: .92rem; color: var(--muted); }
.track li::before { content: ""; position: absolute; left: 0; top: .2em; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); box-sizing: border-box; }
.track li.done { color: var(--ink); }
.track li.done::before { border-color: var(--ok-ink); background: var(--ok-ink); }
.track li.now { color: var(--ink); font-weight: 700; }
.track li.now::before { border-color: var(--brand); background: var(--brand-soft); }
.note { background: var(--bg); border-radius: var(--radius-s); padding: var(--space-2) var(--space-3); margin-top: var(--space-3); }
.upload-signed { margin-top: var(--space-4); }
.upload-signed input[type=file] { width: auto; flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .job-head { flex-direction: column; }
}

/* A just-saved message: a short highlight so it is noticed */
.alert.flash-in { animation: flash-in 1.2s ease; }
@keyframes flash-in { 0% { transform: scale(.98); box-shadow: 0 0 0 4px var(--brand-soft); } 100% { transform: none; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .alert.flash-in { animation: none; } }
