/* Colours are taken from the KhayaKin logo: deep teal and coral on white. */
:root {
  color-scheme: light;
  --brand: #0a4a50;        /* logo teal */
  --brand-dark: #063a3f;
  --on-brand: #ffffff;     /* text on teal */
  --on-brand-soft: rgba(255, 255, 255, .78);
  --brand-soft: #e7f0f0;   /* pale teal wash */
  --accent: #ff6f59;       /* logo coral */
  --ink: #12292c;
  --muted: #5f7275;
  --line: #dde6e6;
  --field: #c9d6d6;
  --bg: #f4f7f7;
  --card: #ffffff;
  --ok: #1f7a55;
  --warn: #8f5f00;
  --err: #c23b2a;
  --radius: 18px;
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #e3eaea;
}
a { color: var(--brand); text-decoration: none; }
h2 { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
h3 { font-size: .98rem; font-weight: 600; margin: 0 0 2px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.icon { display: block; flex: none; }

/* A single phone-width column: full screen on phones, centred on larger screens */
.app {
  position: relative; max-width: 480px; min-height: 100vh; min-height: 100dvh;
  margin: 0 auto; background: var(--bg);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
main { flex: 1; padding: 16px 16px calc(var(--tab-h) + 36px + env(safe-area-inset-bottom)); }
main.bare { padding: 0 0 32px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; min-height: 58px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
.topbar h1 { flex: 1; margin: 0; font-size: 1.08rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back {
  color: var(--brand); width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; margin-right: 4px;
}
.topbar .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .9rem; font-weight: 700;
}

.tabbar {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 454px; z-index: 20;
  display: flex; gap: 4px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 8px 24px rgba(10, 74, 80, .16);
}
.tabbar a {
  flex: 1; height: calc(var(--tab-h) - 14px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .68rem; font-weight: 500; color: var(--muted); border-radius: 16px;
}
.tabbar a.on { background: var(--brand); color: var(--on-brand); font-weight: 700; }

/* Cards & lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
/* The teal "feature" card */
.card.tint { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.card.tint .muted, .card.tint a:not(.btn) { color: var(--on-brand-soft); }
.card.tint .btn { background: #fff; border-color: #fff; color: var(--brand); }
.card.tint .badge { background: #fff; color: var(--brand); }
.card.warn { background: #fff6e0; border-color: #f0dfb0; }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow, .list-item .grow { flex: 1; min-width: 0; }
.list-item { display: flex; gap: 12px; align-items: center; color: inherit; }
.list-item .chev { color: #a3b3b4; }
.pic {
  width: 48px; height: 48px; flex: none; border-radius: 14px; object-fit: cover;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: .95rem; font-weight: 700; letter-spacing: .02em;
}
.pic.big { width: 92px; height: 92px; border-radius: 50%; font-size: 1.5rem; margin: 0 auto; border: 3px solid var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: .74rem; padding: 3px 9px; border-radius: 99px; color: var(--brand); background: var(--brand-soft); }
.tag.verified { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.badge { font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #e9eeee; color: var(--muted); white-space: nowrap; }
.badge.approved, .badge.accepted, .badge.completed { background: #dff1e8; color: var(--ok); }
.badge.pending { background: #fbefd0; color: var(--warn); }
.badge.rejected, .badge.declined, .badge.cancelled { background: #fbe3df; color: var(--err); }
dl.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .9rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts.stack { display: block; }
dl.facts.stack dt { font-size: .82rem; margin-top: 10px; }
video { display: block; width: 100%; max-height: 420px; border-radius: 12px; background: #000; }
details summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--brand); }

/* Forms */
.field { margin-bottom: 18px; }
.field > label, .label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 1px solid var(--field); border-radius: 14px; outline: none; appearance: none;
}
::placeholder { color: #9aabac; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235f7275' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 74, 80, .14); }
input:disabled { background: #eef2f2; color: var(--muted); }
input[type=file] { width: 100%; padding: 10px; background: var(--card); border: 1px dashed #a9bcbc; border-radius: 14px; font-size: .85rem; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Segmented radios, chips and option cards all hide the native input */
.seg, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label, .chips label, .options label { cursor: pointer; margin: 0; }
.seg input, .chips input, .options input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .chips span {
  display: block; padding: 9px 15px; border-radius: 99px; background: var(--card); border: 1px solid var(--field);
  font-size: .88rem; font-weight: 500;
}
.seg label { flex: 1; text-align: center; }
.seg input:checked + span, .chips input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.options { display: grid; gap: 8px; }
.options.grid2 { grid-template-columns: 1fr 1fr; }
.options .opt { display: block; height: 100%; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--field); }
.options .opt b { display: block; font-weight: 600; }
.options .opt .icon { color: var(--accent); margin-bottom: 8px; }
.options .opt small { color: var(--muted); }
.options input:checked + .opt { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.options input:checked + .opt small { color: var(--on-brand-soft); }
.seg input:focus-visible + span, .chips input:focus-visible + span, .options input:focus-visible + .opt { outline: 2px solid var(--brand); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); margin: 1px 0 0; }

.btn {
  display: block; width: 100%; padding: 14px 18px; border: 1px solid var(--brand); border-radius: 99px; cursor: pointer;
  font: inherit; font-weight: 700; text-align: center; color: var(--on-brand); background: var(--brand);
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--card); color: var(--brand); border-color: var(--field); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--card); color: var(--err); border-color: #efc4bd; }
.btn.danger:hover { background: #fdf1ef; }
.btn.sm { padding: 10px 16px; font-size: .88rem; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.flash { padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-size: .9rem; border: 1px solid; }
.flash.ok { background: #e6f4ed; border-color: #bfe0cf; color: #165c40; }
.flash.err { background: #fdecea; border-color: #f2c5be; color: #8f2318; }
.flash ul { margin: 0; padding-left: 18px; }

/* Onboarding stepper */
.steps { display: flex; gap: 5px; margin-bottom: 8px; }
.steps a, .steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--field); }
.steps .done { background: var(--brand); }
.steps .now { background: var(--accent); }
.step-label { font-size: .8rem; color: var(--muted); margin-bottom: 16px; }
.uploaded { font-size: .82rem; color: var(--ok); margin-bottom: 6px; }
fieldset.ref { min-width: 0; margin: 0 0 12px; }
[hidden] { display: none !important; }

/* Teal panel at the top of the "how it works" page */
.hero {
  margin: 12px; padding: calc(28px + env(safe-area-inset-top)) 22px 30px;
  background: var(--brand); color: var(--on-brand); border-radius: 28px;
}
.hero h1 { font-weight: 700; font-size: 2rem; line-height: 1.12; letter-spacing: -.02em; margin: 44px 0 10px; }
.hero p { color: var(--on-brand-soft); margin: 0; max-width: 34ch; }
.landing { padding: 8px 16px 0; }
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--card); color: var(--ink); font-size: .85rem; font-weight: 500; border: 1px solid var(--field); }
.filters a.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 600; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }

/* Login screen */
.app:has(.signin) { background: #fff; }
.signin { padding: calc(32px + env(safe-area-inset-top)) 24px 0; }
.signin .brand { text-align: center; margin-bottom: 28px; }
.signin .brand .logo { display: block; margin: 0 auto; }
.signin .brand p { margin: 6px 0 0; }
.num {
  width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .82rem; font-weight: 700;
}

@media (min-width: 520px) {
  .topbar { position: static; }
}

/* Results lists: stacked on phones, a grid on wide screens */
.side-brand { display: none; }

/* ---------- PC version: applies automatically on screens 900px and wider ---------- */
@media (min-width: 900px) {
  body { background: var(--bg); }
  .app { max-width: none; border: 0; }
  .topbar { max-width: 640px; width: 100%; margin: 0 auto; padding: 28px 32px 8px; }
  .topbar h1 { font-size: 1.5rem; }
  main { max-width: 640px; width: 100%; margin: 0 auto; padding: 16px 32px 56px; }
  main.bare { max-width: none; padding: 0 0 56px; }

  /* Signed-in pages get a sidebar instead of the bottom tab bar, and a wider page */
  .app:has(.tabbar) { padding-left: 248px; }
  .app:has(.tabbar) .topbar, .app:has(.tabbar) main { max-width: 1040px; }
  .tabbar {
    top: 0; bottom: 0; left: 0; transform: none; width: 248px; max-width: none;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 22px 14px;
    border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none;
  }
  .tabbar a {
    flex: none; height: 46px; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 0 14px; font-size: .92rem; border-radius: 12px;
  }
  .tabbar a:hover:not(.on) { background: var(--brand-soft); color: var(--brand); }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-size: 1.15rem; font-weight: 700; color: var(--brand); }
  .side-brand img { border-radius: 10px; }

  /* Forms stay at a readable width even on the wide page */
  main > form:not(.wide), main > .flash, main > p { max-width: 640px; }
  main > .list-item, main > .card:not(.wide) { max-width: 640px; }

  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
  .grid > .card { margin: 0; height: 100%; }
  a.card { transition: border-color .15s, box-shadow .15s; }
  a.card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(10, 74, 80, .1); }

  .search { display: grid; grid-template-columns: 1fr 1fr 1.3fr 1fr auto; gap: 12px; align-items: end; }
  .search .two { display: contents; }
  .search .field { margin: 0; }
  .search .btn { width: auto; padding: 12px 28px; font-size: 1rem; }
  .filters { margin: 0 0 14px; padding: 0; flex-wrap: wrap; }

  /* Carer profile: summary on the left, detail on the right */
  .split { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
  .split > div:first-child { position: sticky; top: 20px; }

  /* Login */
  .signin { max-width: 420px; margin: 0 auto; padding-top: 64px; }
  .hero { margin: 0 0 4px; }
}

/* ---------- Stats, ratings, messages, checklists ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; color: inherit; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; color: var(--brand); }
.stat span { font-size: .8rem; color: var(--muted); }
.rating { display: inline-flex; align-items: center; gap: 3px; font-size: .82rem; font-weight: 700; }
.rating .icon { color: var(--accent); fill: var(--accent); }
.rating .muted { font-weight: 400; }
.tags .rating { margin-right: 2px; }
.timeline { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; display: inline-grid; place-items: center; }
.tabbar a { position: relative; }
.tabbar .dot { position: absolute; top: 4px; left: calc(50% + 6px); }

.msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 10px; }
.msg .bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--brand-soft); white-space: pre-line; overflow-wrap: anywhere; font-size: .92rem; }
.msg .when { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.msg.me { align-items: flex-end; }
.msg.me .bubble { background: var(--brand); color: var(--on-brand); border-radius: 16px 16px 4px 16px; }

.meter { height: 8px; border-radius: 8px; background: var(--brand-soft); margin: 10px 0 6px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.todo { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.todo .tick { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--field); display: grid; place-items: center; }
.todo.done { color: var(--muted); }
.todo.done .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
details.more { margin-top: 4px; }
main.bare > .flash { margin: 16px 16px 0; }

@media (min-width: 900px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .tabbar .dot { position: static; margin-left: auto; }
  details.more .chips { max-width: 760px; }
}
/* ---------- Banners, link-style buttons, interview and report panels ---------- */
.flash.warn { background: #fff6e0; border-color: #f0dfb0; color: #6b4a00; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
.quiet { display: block; text-align: center; font-size: .85rem; color: var(--muted); margin: 14px 0; }
.quiet:hover { color: var(--err); }
.callout { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 10px 0; }
input[type=datetime-local], input[type=time] {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 1px solid var(--field); border-radius: 14px; outline: none;
}
.note-item { padding: 10px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.note-item:first-of-type { border-top: 0; }
.tabbar a { min-width: 0; }
.page-hero { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: 80% center; border-radius: var(--radius); margin-bottom: 16px; }
