/* Member Hub — mobile-first styles (no build step, no external requests).
   Works in a phone browser and inside a Flutter WebView. */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --text: #14201d;
  --muted: #5b6b66;
  --line: #e0e8e5;
  --primary: #0f766e;
  --primary-d: #0b5c56;
  --primary-soft: #d8f1ed;
  --on-primary: #ffffff;
  --accent: #e11d48;
  --accent-soft: #ffe3e9;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --fb: #1877f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 29, .06), 0 8px 24px rgba(16, 32, 29, .06);
  --tap: 46px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #151f1c;
    --text: #e8f0ed;
    --muted: #94a8a1;
    --line: #25332f;
    --primary: #2dd4bf;
    --primary-d: #5eead4;
    --primary-soft: #11332e;
    --on-primary: #04201c;
    --accent: #fb7185;
    --accent-soft: #3a1822;
    --warn: #fbbf24;
    --warn-soft: #3a2c0a;
    --ok: #4ade80;
    --ok-soft: #12301d;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
[hidden] { display: none !important; }
.icon { flex: none; vertical-align: middle; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header / nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-weight: 800;
}
.nav-desktop { display: none; align-items: center; gap: 4px; }
.nav-desktop a, .nav-desktop button.linklike {
  padding: 8px 12px; border-radius: 10px; color: var(--text); font-weight: 600;
  background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer;
}
.nav-desktop a:hover, .nav-desktop button.linklike:hover { background: var(--primary-soft); text-decoration: none; }
.nav-desktop a.active { color: var(--primary); background: var(--primary-soft); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; font-size: .68rem; font-weight: 600; color: var(--muted);
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.active { color: var(--primary); }
body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

@media (min-width: 800px) {
  .nav-desktop { display: flex; }
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

.page { padding-top: 18px; padding-bottom: 28px; }
.footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .9rem; text-align: center; }
body.is-app .footer { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; background: var(--primary); color: var(--on-primary);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
  touch-action: manipulation;
}
.btn:hover { background: var(--primary-d); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--accent); color: #fff; }
.btn-danger:hover { background: #be123c; }
.btn-fb { background: var(--fb); color: #fff; }
.btn-fb:hover { background: #1264cc; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.active { background: var(--ok); color: #fff; }
.btn.active-interest { background: var(--warn); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards, grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #134e4a 100%);
  color: #fff; border-radius: 20px; padding: 26px 20px; margin-bottom: 8px;
}
.hero h1 { font-size: 1.75rem; }
.hero p { opacity: .92; max-width: 560px; }
.hero .btn { background: #fff; color: #0b5c56; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat { background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { font-size: .78rem; opacity: .9; }

/* ---------- Badges, chips ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
}
.badge-red { background: var(--accent-soft); color: var(--accent); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem;
}
.chip:hover { text-decoration: none; background: var(--primary-soft); }
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ---------- Event cards ---------- */
.event-card { overflow: hidden; display: flex; flex-direction: column; color: var(--text); }
.event-card:hover { text-decoration: none; }
.event-cover { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--primary-soft), var(--primary)); position: relative; overflow: hidden; }
.event-cover img { width: 100%; height: 100%; object-fit: cover; }
.date-pill {
  position: absolute; left: 12px; top: 12px; background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 4px 10px; text-align: center; line-height: 1.1; box-shadow: var(--shadow);
}
.date-pill b { display: block; font-size: 1.2rem; }
.date-pill span { font-size: .7rem; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.event-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.event-body h3 { margin: 0; }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.counts { display: flex; gap: 14px; margin-top: auto; padding-top: 6px; font-size: .85rem; color: var(--muted); }
.counts b { color: var(--text); }
.event-hero { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--primary-soft), var(--primary)); }
.event-hero img { width: 100%; height: 100%; object-fit: cover; }
.rsvp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share { display: flex; flex-wrap: wrap; gap: 10px; }
.prose { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Gallery + lightbox ---------- */
.photo-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.photo:hover img { transform: scale(1.04); }
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: .78rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: env(safe-area-inset-top) 8px env(safe-area-inset-bottom);
}
.lightbox img { max-width: 100%; max-height: 80vh; max-height: 80dvh; object-fit: contain; }
.lightbox p { color: #fff; margin: 10px 0 0; text-align: center; font-size: .95rem; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; display: grid; place-items: center; font-size: 1.4rem;
}
.lb-close { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .92rem; }
.req { color: var(--accent); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a8a1' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--accent); }
.error { color: var(--accent); font-size: .85rem; }
.hint { color: var(--muted); font-size: .82rem; }
.form-cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-cols { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick input[type=file] { font-size: .9rem; max-width: 100%; }

.avatar {
  border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
  font-weight: 800; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 38px; height: 38px; font-size: .85rem; }
.avatar-md { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-lg { width: 104px; height: 104px; font-size: 2rem; }

.auth-card { max-width: 480px; margin: 8px auto; }
.auth-wide { max-width: 760px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: .95rem; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-err { background: var(--accent-soft); color: var(--accent); }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 1fr; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
dl.kv { margin: 0; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pager-btn {
  min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600;
}
.pager-btn.disabled { opacity: .4; }
.pager-info { color: var(--muted); font-size: .9rem; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 800; background: var(--primary-soft); }
.nowrap { white-space: nowrap; }
@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: block; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 12px; background: var(--surface); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 7px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; font-size: .85rem; }
  .table-stack td.actions { justify-content: flex-end; padding-top: 10px; }
  .table-stack td.actions::before { content: none; }
}
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Report bars ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 44px; align-items: center; gap: 10px; font-size: .92rem; }
.bar-row a { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.bar { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.red > i { background: var(--accent); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Admin shell ---------- */
.admin-top {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: 270px; z-index: 60; background: var(--surface);
  border-right: 1px solid var(--line); padding: calc(14px + env(safe-area-inset-top)) 12px 14px; overflow-y: auto;
  transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar.open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); }
.side-link {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px;
  color: var(--text); font-weight: 600; background: none; border: 0; width: 100%; font: inherit; font-weight: 600; cursor: pointer;
}
.side-link:hover { background: var(--primary-soft); text-decoration: none; }
.side-link.active { background: var(--primary); color: var(--on-primary); }
.side-sep { height: 1px; background: var(--line); margin: 10px 0; }
.admin-main { padding: 16px 14px 40px; max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px; }
.kpi b { display: block; font-size: 1.7rem; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .85rem; }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; align-items: end; }
.filters .wide { grid-column: span 2; }
@media (min-width: 900px) {
  .admin-top .icon-btn { display: none; }
  .admin-shell { display: grid; grid-template-columns: 260px 1fr; }
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; width: auto; z-index: 1; }
  .scrim { display: none; }
  .admin-main { padding: 22px 28px 50px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; }
  .filters .wide { grid-column: auto; }
}
.lookup { display: grid; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.lookup:last-child { border-bottom: 0; }
.lookup-form { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .lookup-form { grid-template-columns: 1fr auto auto auto; align-items: center; } }

/* ---------- Confirm dialog + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 20px; }
.modal-box { background: var(--surface); border-radius: 16px; padding: 20px; max-width: 380px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-box p { font-weight: 600; margin-bottom: 16px; }
.modal-box .row { justify-content: flex-end; }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #111; color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 300; font-size: .9rem; max-width: 90vw;
}

/* ---------- Print (reports) ---------- */
@media print {
  .topbar, .bottom-nav, .sidebar, .admin-top, .scrim, .no-print, .footer, .btn { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .admin-shell { display: block; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .admin-main { padding: 0; max-width: none; }
  .bar { background: #ddd; }
  .bar > i { background: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Members directory ---------- */
.member-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .member-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .member-grid { grid-template-columns: repeat(5, 1fr); } }
.member-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 10px; color: var(--text); }
.member-card:hover { text-decoration: none; background: var(--primary-soft); }
.member-name { overflow-wrap: anywhere; line-height: 1.25; }
@media (min-width: 900px) {
  .filters.filters-4 { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
}

/* ---------- Payments ---------- */
.method-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.method { position: relative; display: block; cursor: pointer; }
.method input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.method span {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 700; padding: 0 8px;
}
.method input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.method input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pay-item { display: grid; gap: 2px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pay-item:last-child { border-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }

/* =====================================================================
   Responsive refinements: small phones -> phones -> tablets -> laptops -> large screens
   (later rules intentionally override earlier ones)
   ===================================================================== */
html { scroll-padding-top: 72px; }
body { overflow-wrap: break-word; }
img, svg, video { max-width: 100%; }
input, select, textarea { max-width: 100%; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
h2 { font-size: clamp(1.15rem, 1rem + .7vw, 1.4rem); }
.event-body h3, .member-name, .kv dd { overflow-wrap: anywhere; }

/* Respect notches in landscape */
.container {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* Cards never force a horizontal page scroll: wide tables scroll inside their card */
.card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Bottom bar copes with 5 or 6 items on any width */
.bottom-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.bottom-nav a { padding: 0 2px; min-width: 0; }
.grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }

/* ---- Small phones (<= 380px) ---- */
@media (max-width: 380px) {
  .container { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .card-pad { padding: 12px; }
  .btn { padding: 0 12px; }
  .hero { padding: 20px 14px; border-radius: 16px; }
  .stat b { font-size: 1.15rem; }
  .rsvp { grid-template-columns: 1fr; }
  .share .btn { flex: 1 1 100%; }
  .kv div { flex-direction: column; gap: 2px; }
  .kv dd { text-align: left; }
  .bar-row { grid-template-columns: 78px 1fr 34px; gap: 8px; }
  .bottom-nav a { font-size: .6rem; }
  .bottom-nav .icon { width: 20px; height: 20px; }
  .avatar-lg { width: 84px; height: 84px; }
  .photo-pick { flex-direction: column; align-items: flex-start; }
}

/* ---- Phones (< 600px) ---- */
@media (max-width: 599.98px) {
  .share .btn { flex: 1 1 calc(50% - 10px); }
  .page-head .btn, .profile-head .row .btn { flex: 1 1 auto; }
  .actions .btn { flex: 1 1 auto; }
  .method-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Tablets and up (>= 600px) ---- */
@media (min-width: 600px) {
  .hero { padding: 34px 30px; }
  .hero h1 { font-size: 2.1rem; }
  .rsvp { max-width: 440px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Tablets (800-999px): keep the touch-friendly bottom bar; the 9-item top menu needs more room ---- */
@media (min-width: 800px) and (max-width: 999.98px) {
  .nav-desktop { display: none; }
  .bottom-nav { display: grid; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
}

/* ---- Admin: slide-in menu on tablets too (permanent sidebar only from 1100px) ---- */
@media (min-width: 900px) and (max-width: 1099.98px) {
  .admin-top .icon-btn { display: grid; }
  .admin-shell { display: block; }
  .sidebar { position: fixed; height: auto; width: 270px; transform: translateX(-100%); z-index: 60; }
  .sidebar.open { transform: none; }
  .scrim { display: block; }
  .admin-main { padding: 18px 20px 44px; }
}

/* ---- Landscape phones (short screens) ---- */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { position: static; }
  .bottom-nav a { flex-direction: row; gap: 6px; min-height: 46px; font-size: .78rem; }
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .lightbox img { max-height: 68vh; max-height: 68dvh; }
  .modal-box { max-height: 90vh; overflow-y: auto; }
}

/* ---- Large screens ---- */
@media (min-width: 1400px) {
  body { font-size: 17px; }
  .container { max-width: 1240px; }
  .admin-main { max-width: 1400px; }
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
  .member-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}


.brand-mark.has-logo {
  width: 80px;
  height: 80px;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
}
.brand-mark.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.event-hero a { display: block; width: 100%; height: 100%; cursor: zoom-in; }

.blur-phone {
  filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

/* ---------- Fix: number inputs (fee amount, payment amount) ---------- */
input[type=number] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type=number]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.field.has-error input[type=number] { border-color: var(--accent); }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Fix: side-by-side fields (password / confirm password, etc.) ---------- */
.field { align-content: start; }      /* extra row height no longer stretches label + input */
.form-cols { align-items: start; }    /* each field keeps its own natural height */

/* ---------- Fee box under the "Participation fee required" checkbox ---------- */
#fee-box { margin-top: 4px; }

/* ---------- Browser autofill (saved passwords) keeps the site colours ---------- */
input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--text);
}

/* ---------- About page ---------- */
.about { max-width: 820px; margin: 0 auto; }

.about-cover {
  display: block;
  width: 100%;
  /* aspect-ratio: 16 / 7; */
  object-fit: cover;
  border-radius: 16px;
  background: var(--line);
  margin-bottom: 16px;
}

.about-body h1 { margin: 0 0 14px; }
.about-body p  { margin: 0 0 14px; line-height: 1.75; font-size: 1.02rem; }
.about-body p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  .about-cover { aspect-ratio: 16 / 9; border-radius: 12px; }
}

.footer a { color: inherit; text-decoration: underline; }

.bottom-nav a { min-width: 0; font-size: 11px; padding-left: 2px; padding-right: 2px; }
.bottom-nav a .icon { flex-shrink: 0; }
@media (max-width: 380px) {
  .bottom-nav a { font-size: 10px; }
}

/* ---------- Dashboard finance row ---------- */
.kpis-finance { margin-bottom: 16px; }
.kpi-pos b { color: #15803d; }
.kpi-neg b { color: #dc2626; }
.kpis-finance .kpi { border-left: 4px solid var(--primary); }
.kpis-finance .kpi.kpi-pos { border-left-color: #15803d; }
.kpis-finance .kpi.kpi-neg { border-left-color: #dc2626; }

/* ---------- Click-to-zoom member photo ---------- */
.avatar-zoom { display: inline-block; border-radius: 50%; cursor: zoom-in; position: relative; }
.avatar-zoom:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.avatar-zoom::after {
  content: "";
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0); transition: background .15s;
}
.avatar-zoom:hover::after { background: rgba(0, 0, 0, .12); }
