/* Kanara Entrepreneurs - shared styles for the member portal and director console. */
:root {
  --brand:#B72827; --brand-dark:#8f1f1e; --brand-darker:#6e1716; --brand-light:#f8e2e1;
  --accent:#1b6e6a; --accent-light:#e3f3f2;
  --bg:#f7f5f4; --card:#fff; --border:#e5dcdb; --text:#241c1b; --muted:#6b5f5e;
  --danger:#c0392b; --ok:#1e8e4b; --warn-bg:#fff8e1; --warn-border:#f0d98c;
}
* { box-sizing: border-box; }
body { margin:0; font-family:-apple-system, Segoe UI, Roboto, Arial, sans-serif; background:var(--bg); color:var(--text); line-height:1.4; }
a { color:var(--accent); }

header.top { background:#fff; border-bottom:3px solid var(--brand); padding:10px 20px; display:flex; align-items:center; justify-content:space-between; gap:12px; box-shadow:0 1px 3px rgba(20,10,10,.06); position:sticky; top:0; z-index:5; flex-wrap:wrap; }
header.top .hleft { display:flex; align-items:center; gap:12px; }
header.top img.logo { height:40px; width:auto; display:block; }
header.top h1 { margin:0; font-size:17px; color:var(--brand-darker); }
header.top .hright { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); flex-wrap:wrap; }

.wrap { max-width:1100px; margin:20px auto; padding:0 16px 60px; }
.wrap.narrow { max-width:820px; }
.card { background:var(--card); border:1px solid var(--border); border-radius:14px; padding:20px; margin-bottom:16px; box-shadow:0 1px 2px rgba(20,10,10,.04), 0 4px 16px rgba(20,10,10,.03); }
.card h2 { margin:0 0 14px; font-size:16px; padding-bottom:10px; border-bottom:1px solid #efe6e5; color:var(--brand-darker); letter-spacing:-.1px; }
.card h3 { margin:16px 0 8px; font-size:14px; color:var(--brand-darker); }
.hidden { display:none !important; }

label { display:block; font-size:13px; color:var(--muted); margin:10px 0 4px; font-weight:500; }
input, select, textarea { width:100%; padding:9px 10px; border:1px solid var(--border); border-radius:8px; font-size:14px; background:#fff; color:var(--text); font-family:inherit; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-light); }
input[readonly] { background:#faf7f6; color:var(--muted); }
textarea { min-height:60px; resize:vertical; }
.row { display:flex; gap:12px; flex-wrap:wrap; }
.row > div { flex:1; min-width:170px; }
.repeat-row { display:flex; gap:8px; align-items:flex-end; margin-bottom:8px; }
.repeat-row > div { flex:1; }
.req { color:var(--brand); }
.field-missing input, .field-missing select, .field-missing textarea { border-color:#e0a09f; background:#fffafa; }

button, .btn { cursor:pointer; border-radius:8px; border:none; font-size:14px; padding:10px 18px; font-weight:600; font-family:inherit; text-decoration:none; display:inline-block; }
.btn-primary { background:var(--brand); color:#fff; }
.btn-primary:hover:not(:disabled) { background:var(--brand-dark); }
.btn-secondary { background:var(--accent-light); color:var(--accent); }
.btn-outline { background:#fff; color:var(--brand); border:1px solid var(--brand); padding:7px 14px; }
.btn-link { background:transparent; color:var(--accent); padding:4px 0; text-decoration:underline; font-weight:500; }
.btn-danger-text { background:transparent; color:var(--danger); padding:4px 8px; font-weight:500; }
.btn-small { padding:6px 12px; font-size:13px; }
button:disabled { opacity:.6; cursor:default; }

.msg { margin-top:10px; font-size:13px; }
.msg.error { color:var(--danger); }
.msg.ok { color:var(--ok); }
.note { font-size:12px; color:var(--muted); margin-top:4px; }
.banner { background:var(--warn-bg); border:1px solid var(--warn-border); border-radius:10px; padding:12px 14px; font-size:13px; margin-bottom:16px; }

.tabs { display:flex; gap:4px; margin-bottom:16px; padding:4px; background:#fff; border:1px solid var(--border); border-radius:12px; overflow-x:auto; scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
.tabs button { flex:1 0 auto; padding:9px 16px; border-radius:9px; border:none; background:transparent; color:var(--muted); font-weight:600; white-space:nowrap; transition:background .15s, color .15s; }
.tabs button:hover:not(.active) { background:#f6f2f1; color:var(--text); }
.tabs button.active { background:var(--brand); color:#fff; box-shadow:0 1px 3px rgba(183,40,39,.35); }

table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { text-align:left; padding:8px 10px; border-bottom:1px solid #f0eaea; vertical-align:top; }
th { background:#faf7f6; color:var(--brand-darker); font-weight:600; white-space:nowrap; }
tr.clickable { cursor:pointer; }
tr.clickable:hover td { background:#faf7f6; }
.table-scroll { overflow-x:auto; }

.pill { display:inline-block; padding:2px 9px; border-radius:20px; font-size:11px; font-weight:600; white-space:nowrap; }
.pill.approved { background:#d8f3dc; color:#1e6b3e; }
.pill.left { background:#ece3e2; color:#6e1716; }
.pill.rejected { background:#fde2e1; color:#a83226; }
.pill.pending_approval, .pill.pending_payment { background:#fff3cd; color:#7a5f00; }
.pill.type { background:var(--accent-light); color:var(--accent); }

dl.fields { display:grid; grid-template-columns:190px 1fr; gap:8px 14px; margin:0; }
dl.fields dt { color:var(--muted); font-size:13px; }
dl.fields dd { margin:0; font-size:14px; overflow-wrap:anywhere; }

.avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; background:var(--brand-light); color:var(--brand-darker); display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex-shrink:0; }
.avatar.lg { width:96px; height:96px; border-radius:12px; font-size:28px; }
.who { display:flex; gap:10px; align-items:center; }

/* Overview number tiles: text in ink tokens, no colour-coding. */
.tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:12px; margin-bottom:16px; }
.tile { background:#fff; border:1px solid var(--border); border-radius:14px; padding:14px 16px 15px; box-shadow:0 1px 2px rgba(20,10,10,.04); transition:border-color .15s, box-shadow .15s; }
.tile .t-label { font-size:13px; color:var(--muted); font-weight:500; }
.tile .t-value { font-size:28px; font-weight:650; color:var(--text); margin-top:4px; letter-spacing:-.3px; line-height:1.15; }
.tile .t-sub { font-size:12px; color:var(--muted); margin-top:4px; }
a.tile { text-decoration:none; color:inherit; }
a.tile:hover { border-color:#cfc4c3; box-shadow:0 4px 14px rgba(20,10,10,.07); }

.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.toolbar input[type=search] { max-width:360px; }
.toolbar select { width:auto; }
.count-note { font-size:12px; color:var(--muted); margin:0 0 8px; }

.modal-back { position:fixed; inset:0; background:rgba(30,20,20,.45); display:flex; align-items:center; justify-content:center; padding:16px; z-index:20; }
.modal { background:#fff; border-radius:14px; max-width:460px; width:100%; padding:22px; }

@media (max-width: 640px) {
  dl.fields { grid-template-columns:1fr; }
  dl.fields dt { margin-top:6px; }
  header.top img.logo { height:32px; }
  .hide-sm { display:none; }
}

/* Director console: left-hand menu */
.layout { display:grid; grid-template-columns:220px minmax(0, 1fr); gap:20px; max-width:1320px; margin:20px auto; padding:0 16px 60px; }
.sidenav { position:sticky; top:84px; align-self:start; background:#fff; border:1px solid var(--border); border-radius:12px; padding:8px; display:flex; flex-direction:column; gap:2px; }
.sidenav a { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; color:var(--text); text-decoration:none; font-weight:500; font-size:14px; }
.sidenav a svg { width:18px; height:18px; flex-shrink:0; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; opacity:.8; }
.sidenav a:hover { background:#faf7f6; }
.sidenav a.active { background:var(--brand); color:#fff; }
.sidenav a.active svg { opacity:1; }
.sidenav .badge { margin-left:auto; background:var(--brand); color:#fff; border-radius:10px; padding:1px 8px; font-size:12px; font-weight:700; }
.sidenav a.active .badge { background:#fff; color:var(--brand); }
.subtabs { display:flex; gap:4px; flex-wrap:wrap; align-items:center; border-bottom:1px solid var(--border); margin-bottom:16px; }
.subtabs button { background:transparent; border-radius:0; border-bottom:3px solid transparent; padding:9px 14px; color:var(--muted); font-weight:600; margin-bottom:-1px; }
.subtabs button.active { color:var(--brand-darker); border-bottom-color:var(--brand); }
.subtabs .spacer { flex:1; }
.subtabs select { width:auto; padding:6px 8px; font-size:13px; }
.money { font-variant-numeric:tabular-nums; white-space:nowrap; text-align:right; }
th.money { text-align:right; }
.pill.paid { background:#d8f3dc; color:#1e6b3e; }
.pill.part { background:#fff3cd; color:#7a5f00; }
.pill.unpaid { background:#fde2e1; color:#a83226; }
.pill.credit { background:var(--accent-light); color:var(--accent); }
.pill.cancelled { background:#ece3e2; color:#6e1716; }
.progress { height:8px; background:#f0eaea; border-radius:6px; overflow:hidden; margin-top:10px; }
.progress > div { height:100%; width:0; background:var(--accent); transition:width .3s; }
.fy-block { border:1px solid var(--border); border-radius:10px; padding:14px; margin-bottom:12px; }
.fy-block h3 { margin:0 0 8px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.sums { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:8px; margin:8px 0; }
.sums div { background:#faf7f6; border-radius:8px; padding:8px 10px; font-size:12px; color:var(--muted); }
.sums strong { display:block; font-size:16px; color:var(--text); font-variant-numeric:tabular-nums; }
tr.voided td { color:#a99; text-decoration:line-through; }
tr.voided td.why { text-decoration:none; }
fieldset { border:1px solid var(--border); border-radius:10px; padding:4px 16px 14px; margin:0 0 14px; }
legend { font-weight:600; color:var(--brand-darker); padding:0 6px; font-size:14px; }
@media (max-width: 860px) {
  .layout { grid-template-columns:minmax(0, 1fr); margin-top:12px; }
  .sidenav { position:static; flex-direction:row; overflow-x:auto; padding:6px; }
  .sidenav a { white-space:nowrap; padding:8px 12px; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
  .tile { padding:12px; }
  .tile .t-value { font-size:22px; overflow-wrap:anywhere; }
}


/* Membership badges: M = Member (KE red), LM = Lead Member (blue), VM = Virtual Member (KE teal) */
.mbadge { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:20px; padding:0 6px; border-radius:6px; font-size:11px; font-weight:800; letter-spacing:.4px; color:#fff; vertical-align:middle; margin-left:6px; line-height:1; flex-shrink:0; }
.mbadge.m { background:var(--brand); }
.mbadge.lm { background:#1c5cab; }
.mbadge.vm { background:var(--accent); }
h2 .mbadge { height:22px; font-size:12px; }

.mbadge.cell { margin-left:0; }
/* Board role badges: gold P = President, navy BoD = Board of Directors. Solid = serving now, outlined = past. */
.mbadge.rbadge.pres { background:#d4a72c; color:#2b2100; }
.mbadge.rbadge.bod { background:#1f2a4d; color:#fff; }
.mbadge.rbadge.past { background:#fff; }
.mbadge.rbadge.pres.past { color:#7a5c00; box-shadow:inset 0 0 0 1.5px #d4a72c; }
.mbadge.rbadge.bod.past { color:#1f2a4d; box-shadow:inset 0 0 0 1.5px #1f2a4d; }
.mbadge.cell + .mbadge.rbadge { margin-left:4px; }
.role-form { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-top:12px; }
.role-form label { display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:600; }
.role-form input, .role-form select { width:auto; min-width:120px; }
.role-form input#roleTo { min-width:170px; }
.role-line { font-size:13px; color:var(--muted); margin-top:2px; }
img.avatar { background:#fff; border:1px solid var(--border); }

/* ---------- Chart kit (public/assets/charts.js) ---------- */
.kc { margin:0; }
.kc figcaption { margin-bottom:8px; }
.kc-title { margin:0; font-size:15px; font-weight:650; color:var(--text); }
.kc-sub { margin:2px 0 0; font-size:12.5px; color:var(--muted); }
.kc-legend { display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12.5px; color:var(--muted); margin:4px 0 10px; }
.kc-legend span { display:inline-flex; align-items:center; gap:6px; }
.kc-key { display:inline-block; width:10px; height:10px; border-radius:3px; flex-shrink:0; }
.kc-key.line { width:12px; height:3px; border-radius:2px; }
.kc-plot { position:relative; }
.kc-plot svg { display:block; overflow:visible; }
.kc-tick { font-size:11px; fill:#898781; font-variant-numeric:tabular-nums; }
.kc-dlabel { font-size:11.5px; font-weight:650; fill:var(--text); font-variant-numeric:tabular-nums; }
.kc-hit { outline:none; cursor:default; }
.kc-hit:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.kc-tip { position:absolute; z-index:6; pointer-events:none; background:#fff; border:1px solid rgba(11,11,11,.12); border-radius:8px; box-shadow:0 6px 18px rgba(20,10,10,.12); padding:8px 10px; font-size:12px; min-width:120px; max-width:260px; }
.kc-tip-h { color:var(--muted); font-size:11.5px; margin-bottom:4px; }
.kc-tip-r { display:flex; align-items:center; gap:7px; white-space:nowrap; }
.kc-tip-r strong { font-size:13px; color:var(--text); font-variant-numeric:tabular-nums; }
.kc-tip-r span { color:var(--muted); overflow:hidden; text-overflow:ellipsis; }
.kc-empty { color:var(--muted); font-size:13px; padding:28px 0; text-align:center; margin:0; }
.kc-table { margin-top:8px; font-size:12.5px; }
.kc-table summary { cursor:pointer; color:var(--accent); font-weight:500; }
.kc-table table { margin-top:8px; }
.kc-hbars { display:flex; flex-direction:column; gap:4px; }
.kc-hrow { display:grid; grid-template-columns:minmax(90px, 38%) 1fr auto; align-items:center; gap:10px; padding:5px 4px; border-radius:6px; color:inherit; text-decoration:none; outline:none; }
.kc-hrow:hover, .kc-hrow:focus-visible { background:#f6f4f3; }
.kc-hlabel { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:flex; align-items:center; gap:6px; }
.kc-hlabel .mbadge { margin-left:0; }
.kc-htrack { height:14px; display:block; }
.kc-hfill { display:block; height:100%; border-radius:0 4px 4px 0; min-width:0; }
.kc-hval { font-size:12.5px; font-weight:600; font-variant-numeric:tabular-nums; min-width:44px; text-align:right; }
.kc-stacks { display:flex; flex-direction:column; gap:14px; }
.kc-shead { display:flex; justify-content:space-between; gap:10px; font-size:13px; margin-bottom:5px; }
.kc-slabel { display:flex; align-items:center; gap:6px; font-weight:500; }
.kc-slabel .mbadge { margin-left:0; }
.kc-snote { color:var(--muted); font-size:12px; text-align:right; }
.kc-sbar { display:flex; gap:2px; height:16px; }
.kc-seg { display:block; height:100%; min-width:3px; outline:none; }
.kc-seg:first-child { border-radius:0; }
.kc-seg:last-child { border-radius:0 4px 4px 0; }
.kc-seg:hover, .kc-seg:focus-visible { filter:brightness(1.08); }
.kc-ssum { font-size:12px; color:var(--muted); margin-top:4px; }
.kc-meter { height:8px; border-radius:6px; overflow:hidden; margin:8px 0 2px; }
.kc-meter span { display:block; height:100%; border-radius:6px; }
.kc-delta { font-weight:600; color:var(--muted); }
.kc-delta.good { color:#006300; }
.kc-delta.bad { color:#b3261e; }
.kc-spark { display:block; margin-top:6px; }
.viz-cards { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:16px; margin-bottom:16px; }
.viz-cards > .card { margin-bottom:0; min-width:0; }
.viz-cards > .card.wide { grid-column:1 / -1; }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin:6px 0 12px; }
.section-head h2 { margin:0; font-size:17px; color:var(--brand-darker); }
.section-head select { width:auto; padding:6px 8px; font-size:13px; }
@media (max-width: 900px) { .viz-cards { grid-template-columns:1fr; } }

.meter-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:14px 24px; }
.meter-head { display:flex; justify-content:space-between; font-size:13px; }
.meter-head strong { font-weight:650; }
.att-cell { display:flex; align-items:center; gap:10px; }
.att-cell .kc-meter { flex:1; margin:0; min-width:60px; }
.att-cell span { font-size:12.5px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.card .kc-title { margin:0; font-size:15px; color:var(--brand-darker); }
.kc-rowlegend { margin:6px 0 0; font-size:12px; }
.kc-rowlegend strong { color:var(--text); font-weight:600; font-variant-numeric:tabular-nums; }

/* Member portal: profile card with a brand band */
.profile-card { overflow:hidden; padding-top:0; }
.profile-card::before { content:''; display:block; height:64px; margin:0 -20px 0; background:linear-gradient(115deg, #B72827 0%, #8f1f1e 55%, #6e1716 100%); }
.profile-card .profile-head { margin-top:-40px; align-items:flex-end; }
.profile-card .avatar.lg { border:4px solid #fff; box-shadow:0 2px 8px rgba(20,10,10,.12); width:104px; height:104px; background-color:var(--brand-light); }
.profile-card .profile-head h2 { color:var(--text); }
.profile-card .corner-badge { background:#fff; border-radius:9px; padding:3px; display:inline-flex; gap:3px; box-shadow:0 1px 4px rgba(0,0,0,.15); }
.profile-card .corner-badge .mbadge + .mbadge { margin-left:0; }
.profile-card .profile-head { align-items:flex-start; }
.profile-card .profile-head > div:last-child { padding-top:48px; min-width:0; }
@media (max-width:520px) { .profile-card .profile-head > div:last-child { padding-top:0; flex-basis:100%; } }

.show-sm { display:none; }
@media (max-width: 640px) { .show-sm { display:inline; } .tabs button { padding:8px 10px; font-size:13.5px; flex:1 1 auto; } }
@media (max-width: 640px) { .kc-hrow { grid-template-columns:minmax(80px, 42%) 1fr auto; gap:8px; } .kc-hlabel { white-space:normal; font-size:12.5px; line-height:1.25; } }

.kc-seg.clickable, .kc-slabel.clickable { cursor:pointer; }
.kc-slabel.clickable:hover { text-decoration:underline; }
.kc-seg.selected { box-shadow:inset 0 0 0 2px #241c1b; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip { border:1px solid var(--border); background:#fff; color:var(--text); border-radius:20px; padding:5px 12px; font-size:13px; font-weight:500; }
.chip.active { background:var(--text); color:#fff; border-color:var(--text); }
.chip .n { color:var(--muted); font-weight:600; margin-left:4px; }
.chip.active .n { color:#ddd; }
.drill-tools { display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between; margin:4px 0 10px; }
.drill-tools input[type=search] { max-width:260px; }
.period-pick { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.period-pick select { width:auto; padding:6px 8px; font-size:13px; }
.viz-cards > .card { scroll-margin-top:84px; }

/* Referral Tracker */
.pill.rf-expected { background:#eef1f5; color:#3d4a5c; }
.pill.rf-expired { background:#fde9d9; color:#8a4b10; }
dl.kv { display:grid; grid-template-columns:160px 1fr; gap:6px 12px; margin:10px 0; font-size:14px; }
dl.kv dt { color:var(--muted); font-size:13px; } dl.kv dd { margin:0; }
@media (max-width:600px) { dl.kv { grid-template-columns:1fr; gap:2px 0; } dl.kv dd { margin-bottom:6px; } }

tr.selected td { background:#faf3f2; }
