/* CFM Member Portal — the CFM app's teal Material look (ColorScheme.fromSeed
   teal), as in its member portal screen. Mobile first; the sidebar becomes a
   slide-in drawer under 900px. Inline styles are blocked by the CSP, so
   everything is here. */

:root {
  --primary: #00796b;
  --primary-dark: #004d40;
  --primary-soft: #e0f2f1;
  --indigo: #3949ab;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --text: #1b2524;
  --muted: #5f6b6a;
  --line: #e3eae9;
  --green: #2e7d32;
  --red: #c62828;
  --orange: #ef6c00;
  --blue: #1565c0;
  --amber: #b26a00;
  --radius: 14px;
  --sidebar: 264px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
small { font-size: 12.5px; }
img { max-width: 100%; }

.mi {
  font-family: "Material Icons Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  display: inline-block;
  vertical-align: middle;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
  overflow: hidden;
  width: 1em;
  flex: none;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

/* Colour accents: c-<name> sets --c for chips, tiles, progress bars. */
.c-teal { --c: var(--primary); }
.c-indigo { --c: var(--indigo); }
.c-orange { --c: var(--orange); }
.c-red { --c: var(--red); }
.c-green { --c: var(--green); }
.c-blue { --c: var(--blue); }
.c-grey { --c: #607d8b; }

/* ── Buttons & chips ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 22px; padding: 10px 20px;
  background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-small { padding: 7px 14px; font-size: 13.5px; }
.btn-plain { background: transparent; color: var(--primary); }
.btn-tonal { background: rgba(255,255,255,.18); color: #fff; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }

.chip {
  display: inline-block; padding: 2px 10px; border-radius: 20px; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--c, #607d8b);
  background: color-mix(in srgb, var(--c, #607d8b) 12%, transparent);
}

/* Amounts; "hide amounts" blurs them (for viewing on a shared screen). */
.amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.in, .in .amt, td.in { color: var(--green); }
.amt.out, .out .amt, td.out { color: var(--red); }
body.hide-amounts .amt { color: transparent !important; text-shadow: 0 0 9px rgba(0,0,0,.55); user-select: none; }
body.hide-amounts .hero .amt { text-shadow: 0 0 9px rgba(255,255,255,.9); }

/* ── Login ─────────────────────────────────────────────────────────────── */

body.auth {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 55%, #263238 100%);
  color: #fff;
}
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 40px 16px 24px; text-align: center; }
.auth-logo {
  width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 22px; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.auth-logo .mi { font-size: 48px; color: var(--primary); }
.auth-title { font-size: 22px; line-height: 1.25; }
.auth-sub { margin: 6px 0 22px; opacity: .85; }
.auth-card {
  background: var(--surface); color: var(--text); border-radius: 20px; padding: 22px 20px;
  text-align: left; box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.auth-card h2 { font-size: 18px; margin-bottom: 14px; }
.coop-info { list-style: none; margin: 0 0 14px; padding: 10px 12px; background: var(--primary-soft); border-radius: 12px; }
.coop-info li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 3px 0; }
.coop-info .mi { color: var(--primary); font-size: 18px; }
.auth-error {
  display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; padding: 10px 12px;
  border-radius: 10px; background: #fdecea; color: var(--red); font-size: 14px;
}
.field { position: relative; margin-top: 14px; }
.field input {
  width: 100%; padding: 22px 44px 8px 44px; font: inherit; color: var(--text);
  border: 1px solid #b7c4c2; border-radius: 12px; background: #fff; outline: none;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.field label {
  position: absolute; left: 44px; top: 15px; color: var(--muted); pointer-events: none;
  transition: all .12s ease;
}
.field input:focus + label, .field input:not(:placeholder-shown) + label { top: 6px; font-size: 12px; color: var(--primary); }
.field .lead { position: absolute; left: 13px; top: 15px; color: var(--muted); }
.field .trail { position: absolute; right: 4px; top: 7px; }
.field-hint { margin: 6px 4px 0; font-size: 12.5px; color: var(--muted); }
.btn-login { width: 100%; margin-top: 20px; padding: 13px; font-size: 16px; }
.auth-switch { margin: 16px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-foot { margin-top: 28px; font-size: 12px; opacity: .75; display: flex; flex-direction: column; gap: 2px; }

/* ── App shell: sidebar, app bar, content ──────────────────────────────── */

.drawer-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  display: flex; flex-direction: column; background: #1f2a2e; color: #dfe7e6;
  transform: translateX(-100%); transition: transform .2s ease;
}
.drawer-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.4); }
.scrim { display: none; position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); }
.drawer-toggle:checked ~ .scrim { display: block; }
.sb-header { display: flex; align-items: center; gap: 4px; padding: 14px 10px 14px 14px; background: var(--primary); }
.sb-brand { flex: 1; display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.sb-brand:hover { text-decoration: none; }
.sb-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; flex: none; display: flex; }
.sb-logo img { width: 100%; height: 100%; object-fit: contain; }
.sb-title { font-weight: 700; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-close { color: #fff; padding: 8px; cursor: pointer; border-radius: 50%; }
.sb-menu { flex: 1; overflow-y: auto; padding: 10px 8px; }
.sb-item { display: flex; align-items: center; gap: 14px; padding: 11px 14px; margin-bottom: 2px; border-radius: 24px; color: #dfe7e6; font-weight: 500; }
.sb-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sb-item.selected { background: color-mix(in srgb, var(--primary) 55%, transparent); color: #fff; }
.sb-item .mi { color: #8fd3c9; }
.sb-item.selected .mi { color: #fff; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sb-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: #b2dfdb; }
.sb-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-user-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-logout button { background: none; border: 0; color: #dfe7e6; cursor: pointer; padding: 8px; border-radius: 50%; }
.sb-logout button:hover { background: rgba(255,255,255,.1); }

.main-col { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.content, .cols > *, .hero-id > div, .tile > span, .summary-bar > span { min-width: 0; }
.appbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 2px;
  min-height: 56px; padding: 0 6px; background: var(--primary); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.appbar-title { flex: 1; font-size: 18px; font-weight: 600; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border: 0; border-radius: 50%; background: none; color: #fff; cursor: pointer;
}
.appbar-btn:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.appbar-form { display: contents; }
.content { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px 12px 24px; }

@media (min-width: 900px) {
  .sidebar { transform: none; }
  .main-col { margin-left: var(--sidebar); }
  .menu-btn, .sb-close, .scrim, .drawer-toggle:checked ~ .scrim { display: none; }
  .drawer-toggle:checked ~ .sidebar { box-shadow: none; }
  .content { padding: 22px 24px 28px; }
  .appbar-form { display: none; }   /* the sidebar has Log out */
}

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; font-size: 14px; }
.banner-warn { background: #fff4e5; color: #8a4b00; }
.banner-info { background: #e3f2fd; color: #0d47a1; }
.records-asof { margin: 28px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.records-asof .mi { font-size: 16px; color: var(--primary); }

/* ── Cards & sections ──────────────────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 24px 2px 10px; font-size: 16px; }
.section-title .mi { color: var(--primary); }
.see-all { margin-left: auto; font-size: 13px; font-weight: 600; background: none; border: 0; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty .mi { font-size: 36px; color: #b0bec5; }
.empty p { margin: 8px 0 0; }

.hero {
  display: flex; flex-direction: column; gap: 20px; padding: 20px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--primary), #33508f);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 18%, transparent);
}
.hero-id { display: flex; gap: 16px; align-items: center; }
.hero-photo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; background: #b2dfdb; flex: none; }
.hero-greet { display: block; opacity: .8; }
.hero-name { display: block; font-size: 22px; line-height: 1.2; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hero-chips span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; background: rgba(255,255,255,.16); font-size: 12.5px; }
.hero-chips .mi { font-size: 15px; }
.hero-total span { display: block; opacity: .8; }
.hero-total strong { display: block; font-size: 28px; margin: 2px 0 10px; }
@media (min-width: 700px) {
  .hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 26px 28px; }
  .hero-total { text-align: right; }
  .hero-photo { width: 92px; height: 92px; }
}

.tiles { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.tile { display: flex; align-items: center; gap: 12px; padding: 16px; color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--c); }
.tile > .mi, .summary-bar > .mi { box-sizing: content-box; }
.tile > .mi { padding: 10px; border-radius: 50%; font-size: 22px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.tile small { display: block; color: var(--muted); }
.tile .amt { font-size: 19px; font-weight: 700; color: var(--c); }

.summary-bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px; }
.summary-bar > .mi { padding: 10px; border-radius: 50%; font-size: 22px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.summary-bar small { display: block; color: var(--muted); }
.summary-bar .amt { font-size: 22px; font-weight: 700; color: var(--c); }

.cols { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 1000px) { .cols { grid-template-columns: 3fr 2fr; } }

.list { overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; color: var(--text); border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--primary-soft); text-decoration: none; }
.list-row b, .list-row small { display: block; }
.list-row small { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #90a4ae; flex: none; }
.act-icon { padding: 7px; border-radius: 50%; flex: none; display: flex; }
.act-icon .mi { font-size: 18px; }
.act-icon.in { color: var(--green); background: #e8f5e9; }
.act-icon.out { color: var(--red); background: #ffebee; }

.loan-card { display: block; padding: 16px; margin-bottom: 10px; color: var(--text); }
.loan-card:hover { text-decoration: none; border-color: var(--primary); }
.loan-head { display: flex; align-items: center; gap: 8px; }
.loan-head strong { flex: 1; }
.loan-card p { margin: 4px 0 0; }
progress {
  display: block; width: 100%; height: 8px; margin-top: 12px; border: 0; border-radius: 6px; overflow: hidden;
  appearance: none; -webkit-appearance: none;
  background: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent); color: var(--c, var(--primary));
}
progress::-webkit-progress-bar { background: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent); }
progress::-webkit-progress-value { background: var(--c, var(--primary)); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--c, var(--primary)); border-radius: 6px; }
.loan-progress { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.next-due { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: #fff8e1; color: var(--amber); font-size: 13px; }
.next-due.overdue { background: #ffebee; color: var(--red); }

/* ── Tables & statements ───────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #f8fbfa; white-space: nowrap; }
td small { display: block; color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 700; background: #f8fbfa; border-bottom: 0; }
tr.opening td { background: #f8fbfa; font-style: italic; }
tr.late td { background: #fff5f5; }
tbody tr:last-child td { border-bottom: 0; }

.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 4px 0 12px; }
.filter label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.filter input { font: inherit; padding: 7px 10px; border: 1px solid #b7c4c2; border-radius: 10px; background: #fff; color: var(--text); }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.tab { flex: none; display: flex; flex-direction: column; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.tab span { font-size: 13px; color: var(--muted); }
.tab .amt { font-weight: 700; }
.tab:hover { text-decoration: none; border-color: var(--primary); }
.tab.selected { background: var(--primary); border-color: var(--primary); }
.tab.selected, .tab.selected span, .tab.selected .amt { color: #fff; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; padding: 16px; }
@media (min-width: 700px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts small { display: block; color: var(--muted); }
.facts span { font-weight: 600; }
.facts .wide { grid-column: 1 / -1; }
.link-row a { font-weight: 600; }

.purchase { margin-bottom: 8px; overflow: hidden; }
.purchase summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.purchase summary::-webkit-details-marker { display: none; }
.purchase summary b, .purchase summary small { display: block; }
.purchase summary small { color: var(--muted); }
.purchase .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.purchase[open] summary { border-bottom: 1px solid var(--line); }

.meeting { padding: 14px 16px; margin-bottom: 10px; }
.meeting-head { display: flex; align-items: center; gap: 12px; }
.meeting-head b, .meeting-head small { display: block; }
.meeting-head small { color: var(--muted); }
.date-badge { flex: none; width: 58px; padding: 6px 0; border-radius: 10px; text-align: center; font-size: 11px; background: var(--primary-soft); color: var(--primary-dark); }
.date-badge b { display: block; font-size: 20px; line-height: 1.1; }
.resolutions { margin: 12px 0 0; padding-left: 20px; font-size: 14px; }
.resolutions li { padding: 4px 0; }
.resolutions li span { margin-right: 8px; }

.profile-head { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 14px; }
.profile-head img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #b2dfdb; }
.profile-head strong { display: block; font-size: 18px; }
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .profile-grid { grid-template-columns: 1fr 1fr; } }
.details { padding: 14px 16px; }
.details h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.details h3 .mi { color: var(--primary); }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.detail-row small { color: var(--muted); font-size: 13px; flex: none; }
.detail-row span { text-align: right; word-break: break-word; }

.print-head { display: none; }

/* ── Print: statements on plain paper ──────────────────────────────────── */

@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .scrim, .appbar, .filter, .banner, .see-all, .tabs, .records-asof .mi { display: none !important; }
  .main-col { margin: 0; }
  .content { padding: 0; max-width: none; }
  .print-head { display: block; margin-bottom: 10px; font-size: 13px; }
  .card { border-color: #ccc; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  th, td { padding: 5px 6px; }
  body.hide-amounts .amt { color: inherit !important; text-shadow: none; }
}
