/* ══════════════════════════════════════════════
   NOTEPAY — Global Design System
   v1.0 — matches notepay_v5.html palette
   ══════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Brand colours */
  --primary:        #1A4E8C;
  --primary-dk:     #0D2B55;
  --primary-lt:     #EDF3FF;
  --teal:           #0FA3A3;

  /* Button Variables (Light Mode) */
  --btn-primary-bg: #1A4E8C;
  --btn-primary-text: #FFFFFF;
  --btn-danger-bg: #C0392B;
  --btn-danger-text: #FFFFFF;

  /* Surfaces */
  --surface:        #FFFFFF;
  --surf-var:       #EAF0F6;
  --surf-var2:      #D6E4F0;
  --card:           #FFFFFF;

  /* Borders */
  --border:         #D6E4F0;
  --border2:        #C2D4E8;

  /* Text */
  --text:           #0D1B2A;
  --text2:          #3D5A7A;
  --text3:          #6B8AA8;

  /* Semantic */
  --green:          #1A7A5E;
  --green2:         #0e5c44;
  --red:            #C0392B;
  --amber:          #C4860A;

  /* Inputs */
  --input-bg:       #F2F7FB;
  --input-border:   #C2D4E8;
  --input-focus:    #1A4E8C;

  /* Buttons */
  --btn-primary:    #1A4E8C;
  --btn-shadow:     #0D2B55;

  /* Table rows */
  --row-alt:        #F0F5FB;
  --row-new:        #EBF7F4;
  --row-mod:        #EDF3FF;
  --row-lp:         #FFF8EC;

  /* Misc */
  --deact-bar:      #C47A00;
  --tab-active:     #0D2B55;
  --tog-off:        #C2D4E8;
  --tog-on:         #0FA3A3;
  --scroll-thumb:   #6B8AA8;
}

/* ── DARK MODE ── */
body.dark-mode {
  --primary:      #5A9BE8;
  --primary-dk:   #2A4A72;
  --primary-lt:   #182B47;
  --teal:         #12C5C5;

  /* Button Variables (Dark Mode) */
  --btn-primary-bg: #5A9BE8;
  --btn-primary-text: #FFFFFF;
  --btn-danger-bg: #F87171;
  --btn-danger-text: #0A0A0A;
  
  --surface:      #1A1A1A;
  --surf-var:     #242424;
  --surf-var2:    #2C2C2C;
  --card:         #222222;
  --border:       #333333;
  --border2:      #2E2E2E;
  --text:         #E8E8E8;
  --text2:        #AAAAAA;
  --text3:        #777777;
  --green:        #22B580;
  --green2:       #19a06e;
  --red:          #E05252;
  --amber:        #E0A020;
  --input-bg:     #2A2A2A;
  --input-border: #444444;
  --input-focus:  #5A9BE8;
  --row-alt:      #262626;
  --row-new:      #1A2E28;
  --row-mod:      #1A2440;
  --row-lp:       #2E2010;
  --scroll-thumb: #555555;
  --tab-active:   #5A9BE8;
  --tog-off:      #444444;
  --tog-on:       #12C5C5;
  --deact-bar:    #8a5400;
}

/* ── RESET ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: inherit;
}

/* Mandatory fields red star */
.required::after {
    content: " *";
    color: #ef4444;
}

body { -webkit-tap-highlight-color: transparent;
}

/* ── BASE ── */
html {
  box-sizing: border-box;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

.page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 0 0 1px var(--border);
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
}

body {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

input, textarea, [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

body.dark-mode { background: #0A0A0A; }
body.dark-mode .badge-role-o, body.dark-mode .rb-o { color: var(--primary) !important; }
body.dark-mode .save-btn, body.dark-mode .ef-save, body.dark-mode .pbk.b, body.dark-mode .fab { color: var(--card) !important; }
body.dark-mode .badge-members, body.dark-mode .rot-role.org { color: var(--primary) !important; }

/* ── TYPOGRAPHY ── */
h1, h2, h3, .font-heading {
  font-family: 'Nunito', sans-serif;
}

/* ── INPUT RESET ── */
input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ── SCROLLBAR HIDE ── */
.scr {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.scr::-webkit-scrollbar { display: none; }
.scr { -ms-overflow-style: none; scrollbar-width: none; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dk);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 200000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.28s ease, toast-out 0.28s ease 1.8s forwards;
  pointer-events: none;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.toast.toast-error {
  background: var(--red);
}

/* ── APP BAR ── */
.app-bar {
  background: var(--primary-dk);
  display: flex;
  align-items: center;
  padding: 10px 16px 12px;
  gap: 8px;
  flex-shrink: 0;
  min-height: 52px;
}
.app-bar.light-bar {
  background: var(--surf-var);
  border-bottom: 1.5px solid var(--border2);
}
.ab-title {
  flex: 1;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: white;
}
.ab-title.dark-title { color: var(--text); }

/* ── BACK BUTTON ── */
.back-btn {
  color: rgba(255,255,255,.85);
  font-size: 22px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
  line-height: 1;
}
.back-btn.dark-btn { color: var(--primary); }
.back-btn:hover { background: rgba(255,255,255,0.1); }

/* ── LOGO ROW ── */
.logo-row { display: flex; align-items: center; gap: 9px; }
.logo-box {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.logo-box svg { width: 20px; height: 20px; }
.logo-text {
  font-family: 'Nunito', sans-serif;
  font-size: 19px;
  font-weight: 900;
  color: white;
}

/* ── AVATAR BUTTON ── */
.av-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
  font-family: 'Nunito', sans-serif;
  transition: transform 0.15s;
}
.av-btn:hover { transform: scale(1.08); }

/* ── STATUS BAR ── */
.status-bar {
  background: var(--surf-var);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  flex-shrink: 0;
}
.status-bar.dark-bar {
  background: var(--primary-dk);
  color: rgba(255,255,255,0.85);
}

/* ── BADGE ── */
.badge-role-o {
  background: var(--surf-var);
  color: var(--primary-dk);
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
}
.badge-role-c {
  background: var(--surf-var);
  color: var(--teal);
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
}

/* ── NOTE BOXES ── */
.note {
  background: #EAF4FF;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: #1a4a80;
  line-height: 1.6;
  display: flex;
  gap: 7px;
}
.warn-note {
  background: #FFF8E6;
  border: 1.5px solid #E8C870;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: #7A5800;
  line-height: 1.6;
  display: flex;
  gap: 7px;
}
.err-note {
  background: #FFF0EC;
  border: 1.5px solid #D4906A;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--red);
  line-height: 1.6;
  display: flex;
  gap: 7px;
}

/* ── CARD ── */
.p-card {
  background: var(--card);
  border-radius: 13px;
  border: 1.5px solid var(--border2);
  overflow: hidden;
}
.p-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border2);
}
.p-row:last-child { border-bottom: none; }
.p-row.clickable { cursor: pointer; transition: background 0.12s; }
.p-row.clickable:hover { background: var(--surf-var); }

/* ── POPUP OVERLAY ── */
.pop-ov {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: pop-fade-in 0.2s ease;
}
@keyframes pop-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.pop-box {
  background: var(--card);
  border-radius: 22px;
  padding: 22px 20px;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: pop-scale-in 0.2s cubic-bezier(0.32, 1.2, 0.4, 1);
}
@keyframes pop-scale-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── BOTTOM SHEET ── */
.sheet-ov {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 42, 0.8);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  animation: pop-fade-in 0.2s ease;
}
.sheet-box {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 14px 18px 32px;
  width: 100%;
  animation: sheet-up 0.25s cubic-bezier(0.32, 1, 0.4, 1);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-handle {
  width: 44px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  margin: 0 auto 16px;
}

/* ── TABS ── */
.tab-heading {
  display: flex;
  border-bottom: 2px solid var(--border2);
  flex-shrink: 0;
  background: var(--surface);
}
.tab-h {
  flex: 1;
  text-align: center;
  padding: 10px 4px 11px;
  font-family: 'Nunito', sans-serif;
  font-size: 12.5px;
  font-weight: 900;
  color: var(--text3);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.3px;
  user-select: none;
}
.tab-h.active {
  color: var(--primary);
  border-bottom-color: var(--teal);
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-dk);
  border-radius: 24px;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: white;
  font-size: 14px;
  font-weight: 900;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(13, 43, 85, 0.45);
  transition: transform 0.15s;
  z-index: 20;
  user-select: none;
  border: none;
}
.fab:hover { transform: scale(1.04); }
.fab:active { transform: scale(0.97); }

/* ── DEACT BAR ── */
.deact-bar {
  background: var(--deact-bar);
  padding: 7px 16px;
  font-size: 11.5px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── GENDER SELECTOR ── */
.gender-row { display: flex; gap: 8px; margin: 6px 0 12px; }
.gender-pill {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  border: 2px solid var(--border);
  color: var(--text2);
  background: var(--input-bg);
  transition: all 0.15s;
  user-select: none;
}
.gender-pill.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── OTP BOXES ── */
.otp-row { display: flex; gap: 8px; margin: 14px 0 12px; }
.otp-box {
  flex: 1;
  height: 52px;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  transition: border-color 0.15s;
}
.otp-box.filled { border-color: var(--primary); }
.otp-box.active { border-color: var(--primary); border-width: 2.5px; }

/* ── PROFESSIONAL BUTTONS ── */
.btn {
  width: 100%;
  border-radius: 30px;
  padding: 14px;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none !important; pointer-events: none; }
.btn.loading .btn-text { display: none; }
.btn.loading .spinner { display: block; }

.btn-solid-primary {
  background-color: var(--btn-primary-bg) !important;
  color: var(--btn-primary-text) !important;
  box-shadow: 0 4px 12px rgba(26, 78, 140, 0.2);
}
.btn-solid-primary:hover { opacity: 0.9; }
body.dark-mode .btn-solid-primary { box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2); }

.btn-solid-danger {
  background-color: var(--btn-danger-bg) !important;
  color: var(--btn-danger-text) !important;
}

.btn-solid-amber {
  background-color: var(--amber) !important;
  color: #0A0A0A !important;
}

.btn-tonal {
  background-color: var(--primary-lt) !important;
  color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  box-shadow: none !important;
}
.btn-tonal:hover {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

.btn-text-secondary {
  color: var(--text3) !important;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 0;
}
.btn-text-secondary:hover { color: var(--text) !important; }

/* ── TOGGLE ── */
.toggle {
  width: 40px;
  height: 24px;
  background: var(--tog-off);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on { background: var(--tog-on); }
.toggle-thumb {
  position: absolute;
  top: 4px; left: 4px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle.on .toggle-thumb { transform: translateX(16px); }

/* ── MEMBER ROW ── */
.mem-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border2);
}
.mem-row:last-child { border-bottom: none; }
.mem-av {
  width: 36px; height: 36px;
  background: var(--primary-dk);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
  font-family: 'Nunito', sans-serif;
}
.mem-name { font-size: 13.5px; font-weight: 800; color: var(--text); }
.mem-role { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
}
.empty-icon { font-size: 44px; margin-bottom: 4px; }
.empty-title { font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 900; color: var(--text2); }
.empty-sub { font-size: 12.5px; color: var(--text3); line-height: 1.65; }

/* ── UTILITY ── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-teal   { color: var(--teal); }
.text-muted  { color: var(--text3); }
.fw-900      { font-weight: 900; font-family: 'Nunito', sans-serif; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── LOGO ROW ── */
.logo-row { display: flex; align-items: center; gap: 9px; }
.logo-box {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.logo-box svg { width: 20px; height: 20px; }
.logo-text {
  font-family: 'Nunito', sans-serif;
  font-size: 19px;
  font-weight: 900;
  color: white;
}



/* Required Field Indicator */
.required::after {
    content: ' *';
    color: var(--color-danger, #e74c3c);
}

/* --- APP SPLASH SCREEN --- */
#app-splash {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100dvh;
  background: var(--surface);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s;
}
#app-splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-logo-box {
  width: 72px;
  height: 72px;
  background: var(--primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(var(--primary-rgb), 0.4);
  animation: splash-pulse 1.5s infinite alternate ease-in-out;
  margin-bottom: 20px;
}
.splash-logo-box svg {
  width: 44px;
  height: 44px;
  color: white;
}
.splash-title {
  font-family: 'Nunito', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.splash-sub {
  font-size: 13px;
  color: var(--text3);
  font-weight: 600;
}
@keyframes splash-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.3); }
  100% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(var(--primary-rgb), 0); }
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

