/* RBA member portal – Phase 1 design system. Dark is the default; light follows the existing oba-theme preference. */
:root, html.dark {
  --m-bg: #060E25; --m-card: #101D3B; --m-raised: #15274B; --m-border: #30466E;
  --m-text: #F5F7FF; --m-muted: #B6C4DF; --m-blue: #2777FF; --m-blue-btn: #175BD1; --m-blue-text: #8CB4FF;
  --m-gold: #F4C75C; --m-success: #13C987; --m-warning: #F5B940; --m-danger: #FF8A8A;
  --m-radius: 16px; --m-radius-id: 20px; --m-radius-input: 12px;
  --m-shadow: 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
html.m-light {
  --m-bg: #F3F6FC; --m-card: #FFFFFF; --m-raised: #EEF3FB; --m-border: #CBD6EA;
  --m-text: #0C1A36; --m-muted: #4A5B7A; --m-blue: #175BD1; --m-blue-btn: #175BD1; --m-blue-text: #175BD1;
  --m-gold: #8A6200; --m-success: #0B7A52; --m-warning: #8A5A00; --m-danger: #B42318;
  --m-shadow: 0 6px 18px rgba(12,26,54,.08);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body.m-app { margin: 0; background-image: url('../images/member/app-glow.svg'); min-height: 100vh; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Sinhala", sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--m-text);
  background-color: var(--m-bg); background-size: cover; background-attachment: fixed; }
html.m-light body.m-app { background: var(--m-bg); }
.j-illus, .m-illus { border-radius: 14px; -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); object-fit: contain; }
.m-app a { color: var(--m-blue-text); }
.m-app :focus-visible { outline: 3px solid var(--m-blue-text); outline-offset: 2px; border-radius: 6px; }
.m-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.m-ic { display: inline-flex; width: var(--s, 22px); height: var(--s, 22px); flex: none; align-items: center; justify-content: center; }
.m-ic svg { width: 100%; height: 100%; display: block; }
.m-quick .m-ic { --s: 30px; }
.m-tab .m-ic { --s: 24px; }
.m-field > .m-ic { color: var(--m-blue-text); margin-top: 24px; }
.m-menu .m-ic:first-child { color: var(--m-blue-text); }
.m-menu .chev { margin-left: auto; color: var(--m-muted); --s: 18px; }
.m-avatar img[src$="default-avatar.svg"], .m-idcard-photo img[src$="default-avatar.svg"] { object-fit: contain; background: #243b62; }
.m-icon { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; display: inline-block; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; flex: none; }
.m-skip { position: absolute; left: -999px; top: 8px; background: var(--m-blue-btn); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.m-skip:focus { left: 8px; }

/* Shell */
.m-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--m-bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid color-mix(in srgb, var(--m-border) 60%, transparent); padding-top: env(safe-area-inset-top); }
.m-top-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; }
.m-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--m-text) !important; min-width: 0; flex: 1; }
.m-crest { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; flex: none; }
.m-brand b { display: block; font-size: 18px; line-height: 1.1; letter-spacing: .02em; }
.m-brand small { display: block; font-size: 12px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-iconbtn { position: relative; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--m-text) !important; text-decoration: none; background: transparent; border: 1px solid transparent; cursor: pointer; }
.m-iconbtn:hover { background: var(--m-raised); }
.m-badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--m-gold); color: #1B1300; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.m-desknav { display: none; gap: 4px; }
.m-main { max-width: 1040px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.m-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--m-card) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--m-border); padding-bottom: env(safe-area-inset-bottom); }
.m-bottom ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 560px; }
.m-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: 12px; color: var(--m-muted) !important; text-decoration: none; position: relative; }
.m-tab[aria-current="page"] { color: var(--m-blue-text) !important; font-weight: 600; }
.m-tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 6px; width: 24px; height: 3px; border-radius: 2px; background: var(--m-blue); }
.m-tab .m-badge { top: 6px; right: calc(50% - 22px); }
@media (min-width: 900px) {
  .m-bottom { display: none; }
  .m-desknav { display: flex; }
  .m-desknav .m-tab { flex-direction: row; min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: 10px; gap: 6px; }
  .m-desknav .m-tab::after { display: none; }
  .m-desknav .m-tab[aria-current="page"] { background: var(--m-raised); }
  .m-main { padding-bottom: 48px; }
}

/* Typography & blocks */
.m-h1 { font-size: clamp(24px, 6vw, 28px); line-height: 1.2; margin: 0; font-weight: 700; }
.m-h2 { font-size: 18px; margin: 0; font-weight: 700; }
.m-sub { color: var(--m-muted); margin: 4px 0 0; font-size: 14px; }
.m-cap { font-size: 12.5px; color: var(--m-muted); }
.m-section { margin-top: 24px; }
.m-section-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.m-section-h a { font-size: 14px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.m-card { background: var(--m-card); border: 1px solid var(--m-border); border-radius: var(--m-radius); padding: 16px; }
.m-card + .m-card { margin-top: 10px; }
.m-row { display: flex; align-items: center; gap: 12px; }
.m-grow { flex: 1; min-width: 0; }
.m-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; margin: -8px 0 4px; }
.m-pagehead { margin-bottom: 16px; }
.m-two { display: grid; gap: 16px; }
@media (min-width: 900px) { .m-two { grid-template-columns: 1fr 1fr; align-items: start; } .m-two > .m-section { margin-top: 0; } }

/* Buttons */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: 16px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, opacity .15s; font-family: inherit; }
.m-btn:active { transform: scale(.98); }
.m-btn[disabled], .m-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.m-btn-primary { background: var(--m-blue-btn); color: #fff !important; box-shadow: 0 6px 18px rgba(23,91,209,.35); }
.m-btn-primary:hover { background: #1E6BEA; }
.m-btn-ghost { background: transparent; color: var(--m-text) !important; border-color: var(--m-border); }
.m-btn-ghost:hover { background: var(--m-raised); }
.m-btn-sm { min-height: 44px; font-size: 14px; padding: 0 14px; }
.m-btn-block { width: 100%; }
.m-btn-success { background: #0E8F61; color: #fff !important; }

/* Pills / status */
.m-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.m-pill .m-icon { font-size: 16px; }
.m-pill-success { color: var(--m-success); border-color: color-mix(in srgb, var(--m-success) 50%, transparent); background: color-mix(in srgb, var(--m-success) 14%, transparent); }
.m-pill-warning { color: var(--m-warning); border-color: color-mix(in srgb, var(--m-warning) 50%, transparent); background: color-mix(in srgb, var(--m-warning) 12%, transparent); }
.m-pill-info { color: var(--m-blue-text); border-color: color-mix(in srgb, var(--m-blue) 50%, transparent); background: color-mix(in srgb, var(--m-blue) 14%, transparent); }
.m-pill-muted { color: var(--m-muted); border-color: var(--m-border); }
.m-pill-danger { color: var(--m-danger); border-color: color-mix(in srgb, var(--m-danger) 50%, transparent); background: color-mix(in srgb, var(--m-danger) 12%, transparent); }
.m-tag { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.m-tag-oba { color: var(--m-gold); } .m-tag-batch { color: var(--m-blue-text); }

/* Greeting */
.m-hello { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.m-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid color-mix(in srgb, var(--m-gold) 60%, transparent); background: var(--m-raised); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; color: var(--m-text); overflow: hidden; text-decoration: none; }
.m-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Membership card */
.m-idcard { position: relative; border-radius: var(--m-radius-id); padding: 18px; overflow: hidden; color: #F5F7FF;
  background: url('../images/member/membership-card.svg') center / cover no-repeat, linear-gradient(135deg, #183768 0%, #081b42 55%, #050e25 100%);
  border: 1.5px solid rgba(244,199,92,.75); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.m-idcard-photo { position: relative; }
.m-photo-add { position: absolute; right: -4px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--m-gold); color: #1B1300 !important; display: flex; align-items: center; justify-content: center; border: 2px solid #0B1A40; }
.m-photo-add .m-ic { --s: 15px; }
.m-idcard-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.m-idcard-title { white-space: nowrap; }
.m-idcard-head .m-crest { width: 36px; height: 36px; }
.m-idcard-title { font-weight: 800; color: #F4C75C; letter-spacing: .04em; font-size: 15px; line-height: 1.1; }
.m-idcard-title small { display: block; color: #DCE4F5; font-weight: 500; letter-spacing: 0; font-size: 12.5px; }
.m-idcard-body { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-top: 14px; }
.m-idcard-photo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.85); background: #1B2E5C; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; }
.m-idcard-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.m-idcard-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.m-idcard-batch { color: #F4C75C; font-weight: 700; font-size: 15px; }
.m-idcard-meta { color: #DCE4F5; font-size: 13px; line-height: 1.45; }
.m-idcard-meta .nw { white-space: nowrap; }
.m-qr { background: #fff; border-radius: 12px; padding: 6px; width: 92px; height: 92px; display: flex; align-items: center; justify-content: center; }
.m-qr svg, .m-qr img { width: 100%; height: 100%; display: block; }
.m-idcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.m-idcard-foot .m-cap { color: #DCE4F5; flex: 1; min-width: 140px; }
.m-idbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.55); color: #fff !important; text-decoration: none; font-weight: 600; font-size: 14px; background: rgba(255,255,255,.04); cursor: pointer; font-family: inherit; }
.m-idbtn:hover { background: rgba(255,255,255,.12); }
@media (max-width: 430px) { .m-idcard { padding: 16px 14px; } .m-idcard-body { gap: 10px; } .m-idcard-photo { width: 60px; height: 60px; font-size: 22px; } .m-qr { width: 84px; height: 84px; } .m-idcard-name { font-size: 18px; } .m-idcard-foot .m-cap { flex-basis: 100%; } .m-idcard-body > * { min-width: 0; } }
@media (max-width: 340px) { .m-idcard-body { grid-template-columns: auto 1fr; } .m-idcard-body .m-qr { grid-column: 1 / -1; justify-self: start; } }

/* Quick access */
.m-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 16px 0 0; }
@media (min-width: 640px) { .m-quick { grid-template-columns: repeat(6, 1fr); } }
.m-quick a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 6px; text-align: center; border-radius: 14px; background: var(--m-card); border: 1px solid var(--m-border); color: var(--m-text) !important; text-decoration: none; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.m-quick a:hover { background: var(--m-raised); }
.m-quick .m-icon { font-size: 28px; }

/* Lists */
.m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.m-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--m-card); border: 1px solid var(--m-border); color: var(--m-text) !important; text-decoration: none; min-height: 64px; }
a.m-item:hover { background: var(--m-raised); }
.m-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--m-raised); display: flex; align-items: center; justify-content: center; color: var(--m-muted); }
.m-item-title { font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.m-item-text { color: var(--m-muted); font-size: 13.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--m-gold); flex: none; }

/* Progress */
.m-progress { height: 8px; border-radius: 99px; background: var(--m-raised); overflow: hidden; border: 1px solid var(--m-border); }
.m-progress > span { display: block; height: 100%; background: linear-gradient(90deg, #0E8F61, var(--m-success)); border-radius: 99px; }

/* Tabs / chips */
.m-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.m-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--m-border); color: var(--m-text) !important; text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; background: var(--m-card); }
.m-chip[aria-current="page"], .m-chip[aria-selected="true"] { background: var(--m-blue-btn); border-color: var(--m-blue-btn); color: #fff !important; }

/* Forms */
.m-field { display: flex; gap: 12px; align-items: flex-start; background: var(--m-card); border: 1px solid var(--m-border); border-radius: 14px; padding: 12px 14px; }
.m-field:focus-within { border-color: var(--m-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-blue) 30%, transparent); }
.m-field > .m-icon { color: var(--m-blue-text); margin-top: 22px; }
.m-field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--m-muted); margin-bottom: 4px; }
.m-field label .req { color: var(--m-danger); }
.m-input { width: 100%; font: inherit; font-size: 16px; color: var(--m-text); background: var(--m-raised); border: 1px solid var(--m-border); border-radius: var(--m-radius-input); padding: 10px 12px; min-height: 46px; }
.m-input::placeholder { color: color-mix(in srgb, var(--m-muted) 75%, transparent); }
textarea.m-input { min-height: 84px; resize: vertical; }
.m-input[aria-invalid="true"] { border-color: var(--m-danger); }
.m-err { color: var(--m-danger); font-size: 13.5px; margin-top: 6px; display: flex; gap: 4px; align-items: flex-start; }
.m-err:empty { display: none; }
.m-fields { display: grid; gap: 12px; }
.m-fields-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 360px) { .m-fields-2 { grid-template-columns: 1fr 1fr; } }

/* Stepper (membership stages + wizard) */
.m-stepper { list-style: none; display: flex; padding: 0; margin: 0; }
.m-step { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.m-step::before { content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px; background: var(--m-border); z-index: 0; }
.m-step:first-child::before { display: none; }
.m-step.is-done::before, .m-step.is-current::before { background: var(--m-success); }
.m-step .m-node { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--m-raised); border: 2px solid var(--m-border); color: var(--m-muted); }
.m-step .m-node .m-icon { font-size: 19px; }
.m-step.is-done .m-node { background: #0E8F61; border-color: var(--m-success); color: #fff; }
.m-step.is-current .m-node { background: var(--m-blue-btn); border-color: #7EA6FF; color: #fff; box-shadow: 0 0 0 5px rgba(39,119,255,.25); }
.m-step .m-steplabel { font-size: 12.5px; line-height: 1.2; color: var(--m-muted); }
.m-step.is-current .m-steplabel { color: var(--m-text); font-weight: 700; }
.m-step.is-done .m-steplabel { color: var(--m-text); }

/* Empty / notice */
.m-empty { text-align: center; padding: 28px 16px; color: var(--m-muted); border: 1px dashed var(--m-border); border-radius: var(--m-radius); }
.m-empty .m-icon { font-size: 36px; color: var(--m-blue-text); display: block; margin: 0 auto 8px; }
.m-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14px; }
.m-notice-info { border-color: color-mix(in srgb, var(--m-blue) 45%, transparent); background: color-mix(in srgb, var(--m-blue) 10%, transparent); }
.m-notice-warning { border-color: color-mix(in srgb, var(--m-warning) 45%, transparent); background: color-mix(in srgb, var(--m-warning) 10%, transparent); }
.m-notice-success { border-color: color-mix(in srgb, var(--m-success) 45%, transparent); background: color-mix(in srgb, var(--m-success) 10%, transparent); }
.m-notice-error { border-color: color-mix(in srgb, var(--m-danger) 45%, transparent); background: color-mix(in srgb, var(--m-danger) 10%, transparent); }
.m-kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 8px 12px; margin: 0; font-size: 14.5px; }
.m-kv dt { color: var(--m-muted); }
.m-kv dd { margin: 0; word-break: break-word; }
.m-money { font-variant-numeric: tabular-nums; }
.m-menu { list-style: none; margin: 0; padding: 0; border-radius: var(--m-radius); overflow: hidden; border: 1px solid var(--m-border); background: var(--m-card); }
.m-menu li + li { border-top: 1px solid var(--m-border); }
.m-menu a, .m-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 16px; color: var(--m-text) !important; text-decoration: none; font: inherit; font-size: 15.5px; background: none; border: 0; cursor: pointer; text-align: left; }
.m-menu a:hover, .m-menu button:hover { background: var(--m-raised); }
.m-menu .m-icon:first-child { color: var(--m-blue-text); }
.m-menu .chev { margin-left: auto; color: var(--m-muted); }
.m-flash { margin-bottom: 12px; }
.m-skel { background: linear-gradient(90deg, var(--m-card), var(--m-raised), var(--m-card)); background-size: 200% 100%; animation: mSk 1.4s infinite; border-radius: 10px; }
@keyframes mSk { to { background-position: -200% 0; } }
.m-fade { animation: mFade .2s ease-out; }
@keyframes mFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* a success pill on the dark ID card stays bright in light mode too */
.m-idcard .m-pill-success { color: #3BE3A6; border-color: #3BE3A6; }

/* Dashboard: school crest, school name and batch */
.m-school { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; min-width: 0; }
.m-school-logos { position: relative; flex: none; display: inline-flex; }
.m-school-logo { width: 68px; height: 68px; object-fit: contain; border-radius: 14px; }
.m-school-logos .ob-batchlogo { position: absolute; right: -6px; bottom: -6px; }
.m-school-text { min-width: 0; }
.m-school-text .m-h1 { font-size: 21px; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.m-school-text .m-sub { margin: 4px 0 0; }
.m-count { flex: none; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--m-gold); color: #1B1300; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.m-top .m-tab { position: relative; }
@media (max-width: 480px) { .m-top-in { gap: 8px; padding-left: 12px; padding-right: 12px; } .m-top .m-brand small { display: none; } .m-top .m-brand { gap: 6px; } .m-top .m-brand .m-crest { width: 36px; height: 36px; } }
