/* 4UKvisas Forms — styled after 4ukvisas.co.za:
   dark contact bar, white header with logo and red-underlined nav, red square-ish buttons, Poppins.
   Office pages are light for long tables; the client form is dark like the website's contact form. */
:root {
  --ink: #262626;          /* website top bar / contact-form background */
  --ink-2: #2f2f2f;        /* client form cards */
  --ink-3: #3b3b3b;        /* client form card borders */
  --field-dark: #555555;   /* client form inputs (as on the contact form) */
  --red: #dd3333; --red-h: #bf2626; --red-soft: #fbe9e9;
  --bg: #f4f4f4; --card: #ffffff; --line: #e1e1e1; --line2: #eeeeee; --soft: #f8f8f8;
  --text: #2b2b2b; --muted: #6e6e6e;
  --ok: #e6f4ea; --okt: #1d6b38; --err: #fdecec; --errt: #b3261e; --warn: #fff6dc; --warnline: #f0dc9b;
  --info: #eef2f8; --infot: #24467e;
  --c-name-sent: #d6e4ff; --c-name-sent-t: #163f8f; --c-appt-complete: #c9efd6; --c-appt-sent: #ffe6a8;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;
  --r: 3px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14.5px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--red); }
h1 { font-size: 1.6rem; font-weight: 600; margin: .3rem 0 .6rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.08rem; font-weight: 600; margin: 0 0 .7rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main { max-width: 1180px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
main.wide { max-width: none; }
main.narrow { max-width: 460px; padding-top: 6vh; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.center { text-align: center; } .nowrap { white-space: nowrap; }
code { background: var(--soft); border: 1px solid var(--line2); padding: 1px 5px; border-radius: var(--r); font-size: .85em; font-family: var(--mono); }
pre { white-space: pre-wrap; background: var(--soft); border: 1px solid var(--line); padding: 10px; border-radius: var(--r); font: .85rem/1.5 var(--mono); }

/* ---------- website header */
.contactbar { background: var(--ink); color: #fff; font-size: .8rem; }
.contactbar .wrap { display: flex; gap: 8px 22px; align-items: center; flex-wrap: wrap; min-height: 40px; padding-block: 6px; }
.cb-item { display: inline-flex; align-items: center; gap: 8px; }
.cb-item svg { width: 14px; height: 14px; fill: #fff; }
.cb-user { margin-left: auto; opacity: .85; }
.cb-user a { color: #fff; }
.sitehead { background: #fff; border-bottom: 1px solid var(--line); }
.sitehead .wrap { display: flex; align-items: center; gap: 12px 32px; flex-wrap: wrap; min-height: 76px; padding-block: 8px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo img { height: 44px; width: auto; display: block; }
.logotext { font-weight: 600; font-size: 1.05rem; color: #2a3c7a; }
.logo-sub { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--red); border-left: 1px solid var(--line); padding-left: 10px; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px 26px; margin-left: auto; }
.mainnav a { color: #333; text-decoration: none; font-size: .93rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.mainnav a:hover { color: var(--red); }
.mainnav a.on { color: var(--red); border-color: var(--red); }
.headbtn { margin-left: auto; }

.tabs { background: #fff; border-bottom: 1px solid var(--line); }
.tabs .wrap { display: flex; gap: 2px; overflow-x: auto; }
.tabs a { padding: 11px 18px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--red); font-weight: 600; }
.tabs a.inactive { opacity: .5; }
.banner { padding: 8px 0; font-size: .88rem; }
.banner.warn { background: var(--warn); border-bottom: 1px solid var(--warnline); }
.banner a { color: inherit; font-weight: 600; }

/* ---------- basics */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 18px; margin-bottom: 14px; }
.flash { padding: 10px 14px; border-radius: var(--r); margin-bottom: 12px; }
.flash.ok { background: var(--ok); color: var(--okt); } .flash.err { background: var(--err); color: var(--errt); }
label { display: block; margin-bottom: 10px; font-size: .9rem; font-weight: 500; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 0 0; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); padding: 9px 11px; border: 1px solid #cfcfcf; border-radius: var(--r); background: #fff; width: 100%; margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; accent-color: var(--red); }
input.short, select.short { max-width: 340px; }
input.tiny { width: 64px; padding: 4px 6px; }
textarea.mono { font-family: var(--mono); font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(221, 51, 51, .35); border-color: var(--red); }
:focus-visible { outline: 2px solid rgba(221, 51, 51, .5); outline-offset: 1px; }
.saved { outline: 2px solid #2e9e57 !important; }

.btn { display: inline-block; padding: 9px 16px; border-radius: var(--r); border: 1px solid #cfcfcf; background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #b5b5b5; background: var(--soft); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-h); border-color: var(--red-h); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkbtn { align-self: flex-start; background: none; border: 0; color: var(--red); cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.pill.waiting, .pill.manual { background: #efefef; color: #555; } .pill.submitted { background: var(--info); color: var(--infot); }
.pill.checked { background: var(--ok); color: var(--okt); } .pill.expired { background: var(--err); color: var(--errt); }

/* ---------- tracker */
.tracker-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sendbox { display: flex; gap: 8px; align-items: center; margin: 0; padding: 10px 12px; flex-wrap: wrap; }
.sendbox input { width: 220px; margin: 0; flex: 1 1 180px; }
.tracker-tools { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); vertical-align: middle; }
.sw.name-sent { background: var(--c-name-sent); } .sw.appt-complete { background: var(--c-appt-complete); } .sw.appt-sent { background: var(--c-appt-sent); }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; }
.tracker th, .tracker td, .list th, .list td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; font-size: .86rem; }
.tracker th, .list th { background: var(--ink); color: #fff; font-weight: 500; position: sticky; top: 0; white-space: nowrap; font-size: .78rem; }
.tracker td { font-variant-numeric: tabular-nums; }
.tracker td input, .tracker td textarea { margin: 0; padding: 4px 6px; font-size: .84rem; }
.tracker td input[type=date] { width: 145px; }
.tracker .notes { min-width: 220px; }
.tracker tbody tr:hover td { background-color: #fafafa; }
.tracker tr.st-checked td { background: #f5fbf7; }
.tracker tr.st-waiting td, .tracker tr.st-expired td { color: var(--muted); }
.tracker .namecell { cursor: pointer; font-weight: 500; }
.tracker .namecell:hover { text-decoration: underline dotted; }
.tracker tr.appt-sent-row td.namecell { background: var(--c-name-sent); color: var(--c-name-sent-t); font-weight: 600; }
.tracker td.apptcell { white-space: nowrap; }
.tracker td.apptcell select { width: auto; margin: 4px 0 0; padding: 2px 4px; font-size: .78rem; display: block; background: transparent; }
.tracker tr td.appt-complete { background: var(--c-appt-complete); }
.tracker tr td.appt-sent { background: var(--c-appt-sent); }
.tracker .appt-complete input, .tracker .appt-sent input { background: rgba(255,255,255,.75); }
.emailpreview summary { cursor: pointer; font-weight: 600; }
.emailframe { width: 100%; height: 470px; border: 1px solid var(--line); border-radius: 4px; background: #fff; margin: 8px 0; }

/* ---------- applicant / lists */
.detail-head, .builder-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.card .grid2 { grid-template-columns: 1fr 1fr; gap: 0 14px; }
.answers { width: 100%; }
.answers th { width: 45%; text-align: left; font-weight: 500; color: var(--muted); padding: 6px 10px 6px 0; vertical-align: top; font-size: .86rem; }
.answers td { padding: 6px 0; border-bottom: 1px solid var(--line2); }
.inlineform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inlineform h2 { width: 100%; }
.inlineform input, .inlineform select { width: auto; flex: 1 1 160px; margin: 0; }
form.inline { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
form.inline input { width: 140px; margin: 0; }
.manualform .grid2 { grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- builder */
.bsection { border-top: 3px solid var(--red); }
.brow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brow > input, .brow > select { margin: 0; }
.btitle { flex: 1; font-weight: 600; font-size: 1.05rem; }
.blabel { flex: 1 1 260px; font-weight: 500; }
.brow select { width: auto; }
.secno { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bdesc { margin: 8px 0; font-size: .88rem; }
.bfield { border: 1px solid var(--line); border-radius: 4px; padding: 10px; margin: 8px 0; background: var(--soft); }
.bfield.followup { background: #fff; border-left: 3px solid var(--red); }
.bhelp { font-size: .85rem; margin-top: 6px; }
.bopts { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.bopts label { flex: 1 1 220px; margin: 0; font-weight: 400; }
.bbtns { display: inline-flex; gap: 3px; margin-left: auto; }
.bbtns button { border: 1px solid #d4d4d4; background: #fff; border-radius: var(--r); width: 30px; height: 30px; cursor: pointer; color: var(--text); }
.bbtns button.danger:hover { background: var(--err); color: var(--errt); }
.fadd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.fadd select { width: auto; margin: 0; padding: 4px 6px; font-size: .85rem; }
.chipbtn { font: inherit; font-size: .82rem; border: 1px dashed var(--red); color: var(--red); background: #fff; border-radius: 99px; padding: 3px 12px; cursor: pointer; }
.chipbtn:hover { background: var(--red-soft); }
.fgroup { margin: 10px 0 2px 14px; padding-left: 12px; border-left: 2px solid #f0c4c4; }
.fgroup-head { font-size: .85rem; color: var(--muted); }
.fgroup-head strong { color: var(--text); }
.fnote { margin-top: 6px; padding: 6px 8px; background: var(--info); border-radius: var(--r); color: var(--infot); }
.warn-text { color: var(--errt); }

/* ---------- client side: dark, like the website's contact form */
.public { background: var(--ink); color: #fff; }
.public main { max-width: 820px; }
.public a { color: #ff8a8a; }
.public .muted, .public .help { color: #bdbdbd; }
.public h1 { color: #fff; }
.public .card { background: var(--ink-2); border-color: var(--ink-3); color: #fff; }
.public input, .public select, .public textarea { background: var(--field-dark); border-color: #6a6a6a; color: #fff; }
.public input::placeholder, .public textarea::placeholder { color: #c9c9c9; }
.public input[type=file] { background: #474747; padding: 7px; }
.public select option { background: #3a3a3a; color: #fff; }
.public input:focus, .public select:focus, .public textarea:focus { border-color: #ff6b6b; outline-color: rgba(255, 107, 107, .4); }
.public .btn { background: transparent; border: 2px solid #fff; color: #fff; }
.public .btn:hover { background: rgba(255,255,255,.1); }
.public .btn.primary { background: var(--red); border-color: var(--red); }
.public .btn.primary:hover { background: var(--red-h); border-color: var(--red-h); }
.public .sitehead .btn.primary { border-width: 1px; }
.public .flash.ok { background: #1f3d2a; color: #a7e3b9; } .public .flash.err { background: #4a1e1e; color: #ffb3b3; }
.public code { background: #3a3a3a; border-color: #4a4a4a; color: #fff; }
.public .linkbtn { color: #ff8a8a; }

.formhead { margin-bottom: 14px; }
.fsection h2 { border-bottom: 2px solid var(--red); padding-bottom: 8px; }
.desc { background: rgba(0,0,0,.04); padding: 10px 12px; border-radius: var(--r); font-size: .9rem; }
.public .desc { background: #3a3a3a; }
.field { margin: 18px 0; }
.flabel { font-weight: 500; }
.req { color: var(--red); }
.public .req { color: #ff6b6b; }
.help { font-size: .84rem; color: var(--muted); }
.field[data-if], .infoblock[data-if] { margin-left: 4px; padding-left: 14px; border-left: 3px solid var(--red); }
.haserr input:not([type=radio]):not([type=checkbox]), .haserr select, .haserr textarea { border-color: var(--errt); background: #fff8f8; }
.public .haserr input:not([type=radio]):not([type=checkbox]), .public .haserr select, .public .haserr textarea { border-color: #ff6b6b; background: #5d4040; }
.haserr .flabel { color: var(--errt); }
.public .haserr .flabel, .public .errmsg { color: #ff8a8a; }
.errmsg { color: var(--errt); font-size: .85rem; margin-top: 3px; }
.choices { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.choice { display: flex; gap: 8px; align-items: center; margin: 0; font-size: .95rem; font-weight: 400; }
.matrix { margin-top: 6px; max-width: 480px; }
.matrix th, .matrix td { padding: 6px; border-bottom: 1px solid var(--line2); font-size: .9rem; text-align: left; font-weight: 500; }
.public .matrix th, .public .matrix td { border-color: var(--ink-3); }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; width: 70px; }
.infoblock { background: rgba(0,0,0,.04); border-left: 3px solid var(--red); padding: 8px 12px; margin: 16px 0 6px; }
.public .infoblock { background: #3a3a3a; }
.infoblock p { margin: 4px 0 0; }
.filerow { display: flex; gap: 10px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.filerow label { margin: 0; display: inline-flex; gap: 4px; font-weight: 400; }
.formactions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 94%, transparent); padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; justify-content: flex-end; }
.public .formactions { background: color-mix(in srgb, var(--ink) 94%, transparent); }

/* client form tabs */
.formtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.public .formtabs { background: var(--ink); border-color: #444; }
.formtabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px;
  padding: 11px 16px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.public .formtabs button { color: #bdbdbd; }
.formtabs button[aria-selected="true"] { color: var(--text); border-color: var(--red); }
.public .formtabs button[aria-selected="true"] { color: #fff; }
.formtabs .cnt { font-size: .74rem; font-weight: 600; background: #efefef; color: #555; border-radius: 99px; padding: 1px 8px; }
.public .formtabs .cnt { background: #444; color: #ddd; }
.formtabs .errdot { width: 8px; height: 8px; border-radius: 50%; background: #ff5a5a; }
.tabnext { display: flex; justify-content: flex-end; margin: 4px 0 10px; }

@media (max-width: 760px) {
  .grid2, .card .grid2, .manualform .grid2 { grid-template-columns: 1fr; }
  .mainnav { margin-left: 0; gap: 4px 18px; }
  .sendbox input { width: 100%; }
  .cb-user { margin-left: 0; }
  .logo img { height: 38px; }
  .public .sitehead .wrap { flex-wrap: nowrap; min-height: 64px; }
  .headbtn { padding: 6px 10px; font-size: .8rem; }
}
@media print {
  .contactbar, .sitehead, .tabs, .banner, .actions, .grid2 > div:last-child, p:first-child { display: none; }
  .grid2 { display: block; } .card { border: 0; padding: 0; }
}
