/* ============================================
   IONIC TEMPLATE — Original design
   Based on Ionic Framework's component patterns
   ============================================ */

:root {
  /* Brand */
  --ion-primary: #3b5998;
  --ion-primary-dark: #2d4373;
  --ion-primary-light: #4c6aaf;
  --ion-primary-rgb: 59, 89, 152;
  --ion-primary-contrast: #ffffff;

  /* Semantic */
  --ion-success: #1DCC70;
  --ion-danger: #FF396F;
  --ion-warning: #FFB400;
  --ion-info: #05D0A4;

  /* Neutrals */
  --ion-white: #ffffff;
  --ion-step-50: #f4f5f8;
  --ion-step-100: #e9ecf1;
  --ion-step-200: #d3d7df;
  --ion-step-400: #92949c;
  --ion-step-600: #57575c;
  --ion-step-800: #2a2a2e;
  --ion-black: #1a1a1d;

  --ion-text: #1a1a1d;
  --ion-text-muted: #70757f;
  --ion-bg: #f4f5f8;
  --ion-card-bg: #ffffff;

  /* Layout */
  --header-h: 56px;
  --tabbar-h: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.18), 0 30px 60px rgba(0,0,0,0.12);

  --ease: cubic-bezier(0.36, 0.66, 0.04, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--ion-bg);
  color: var(--ion-text);
}

body {
  min-height: 100vh;
}

/* ===== App wrapper — fills the viewport ===== */
.ion-device {
  width: 100%;
  height: 100vh;
  background: var(--ion-bg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===== Desktop layout (≥900px) — persistent left sidebar ===== */
@media (min-width: 900px) {
  .ion-device.desktop-sidebar {
    padding-left: 280px;
    transition: padding-left 0.25s var(--ease);
  }
  .ion-device.desktop-sidebar.sidebar-hidden {
    padding-left: 0;
  }
  /* Left menu becomes a fixed sidebar, not a drawer */
  .ion-device.desktop-sidebar .ion-menu-left {
    transform: translateX(0) !important;
    width: 280px;
    box-shadow: none;
    border-right: 1px solid var(--ion-step-100);
    z-index: 5;
  }
  .ion-device.desktop-sidebar.sidebar-hidden .ion-menu-left {
    transform: translateX(-100%) !important;
  }
  /* Hide scrim on desktop (sidebar is always there) */
  .ion-device.desktop-sidebar .ion-scrim.left-triggered {
    display: none;
  }
  /* The bottom tab bar's "Menu" button toggles sidebar visibility on desktop */
  /* Show the app content with max width for readability */
  .ion-device.desktop-sidebar .ion-content {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
  }
}

/* Dark mode: sidebar border */
.ion-device.dark.desktop-sidebar .ion-menu-left {
  border-right-color: #2e3543;
}

/* ===== ion-header ===== */
.ion-header {
  height: var(--header-h);
  background: var(--ion-primary);
  color: var(--ion-primary-contrast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
  position: relative;
  z-index: 10;
}

.ion-header .ion-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ion-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.ion-icon-btn:hover { background: rgba(255,255,255,0.1); }
.ion-icon-btn:active { background: rgba(255,255,255,0.18); }

.ion-icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--ion-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ion-primary);
}

/* ===== ion-content ===== */
.ion-content {
  flex: 1;
  overflow-y: auto;
  background: var(--ion-bg);
  padding-bottom: calc(var(--tabbar-h) + 12px);
  scrollbar-width: thin;
}
.ion-content::-webkit-scrollbar { width: 4px; }
.ion-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* ===== ion-card ===== */
.ion-card {
  background: var(--ion-card-bg);
  border-radius: var(--radius-md);
  margin: 12px 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ion-card-header {
  padding: 18px 18px 8px;
}

.ion-card-subtitle {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ion-text-muted);
  margin: 0 0 4px;
}

.ion-card-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ion-text);
}

.ion-card-content {
  padding: 12px 18px 18px;
}

/* ===== Quick actions grid ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 8px 18px 18px;
  border-top: 1px solid var(--ion-step-100);
  margin-top: 8px;
  padding-top: 16px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--ion-text);
}

.quick-action .tile {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.15s var(--ease);
}
.quick-action:hover .tile { transform: translateY(-2px); }
.quick-action:active .tile { transform: scale(0.96); }

.quick-action .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ion-text-muted);
}

/* ===== Color swatches (palette card) ===== */
.palette-group { margin-bottom: 18px; }
.palette-group-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ion-text);
  margin: 0 0 10px;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}
.swatch .chip {
  width: 100%;
  height: 54px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.05);
}
.swatch .name {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--ion-text);
}
.swatch .hex {
  font-size: 11px;
  color: var(--ion-text-muted);
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}

/* ===== ion-list / ion-item ===== */
.ion-list { margin: 12px 12px; background: #fff; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.ion-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ion-step-100);
  cursor: pointer;
  transition: background 0.1s;
}
.ion-item:last-child { border-bottom: none; }
.ion-item:hover { background: var(--ion-step-50); }
.ion-item .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.ion-item .text { flex: 1; min-width: 0; }
.ion-item .primary { font-size: 15px; font-weight: 600; color: var(--ion-text); }
.ion-item .secondary { font-size: 13px; color: var(--ion-text-muted); margin-top: 2px; }
.ion-item .chev { color: var(--ion-step-400); flex-shrink: 0; }

/* ===== ion-tab-bar (bottom) ===== */
.ion-tab-bar {
  height: var(--tabbar-h);
  background: var(--ion-primary);
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
}

.ion-tab-btn {
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255,255,255,0.65);
  transition: color 0.15s;
  padding: 0;
}
.ion-tab-btn.active { color: #fff; }
.ion-tab-btn:hover { color: rgba(255,255,255,0.9); }
.ion-tab-btn .tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* center FAB */
.ion-tab-fab {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--ion-black);
  border: 4px solid var(--ion-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -28px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  transition: transform 0.2s var(--ease);
}
.ion-tab-fab:hover { transform: translateY(-2px); }
.ion-tab-fab:active { transform: scale(0.95); }

/* ===== ion-menu (side drawers) ===== */
.ion-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  pointer-events: none;
  transition: background 0.3s var(--ease);
  z-index: 30;
}
.ion-scrim.active {
  background: rgba(0,0,0,0.4);
  pointer-events: auto;
}

.ion-menu {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 300px;
  background: #fff;
  z-index: 40;
  transition: transform 0.32s var(--ease);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,0.2);
}
.ion-menu-left { left: 0; transform: translateX(-100%); }
.ion-menu-left.open { transform: translateX(0); }
.ion-menu-right { right: 0; transform: translateX(100%); }
.ion-menu-right.open { transform: translateX(0); }

.ion-menu-header {
  padding: 24px 20px 20px;
  background: linear-gradient(135deg, var(--ion-primary), var(--ion-primary-dark));
  color: #fff;
}
.ion-menu-header .profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin-bottom: 10px;
  border: 2px solid rgba(255,255,255,0.3);
}
.ion-menu-header .profile-name {
  font-size: 18px; font-weight: 700;
}
.ion-menu-header .profile-email {
  font-size: 13px; opacity: 0.8; margin-top: 2px;
}

.ion-menu-body { flex: 1; overflow-y: auto; padding: 8px 0; }

.ion-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  color: var(--ion-text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: background 0.12s;
}
.ion-menu-item:hover { background: var(--ion-step-50); }
.ion-menu-item.active { background: rgba(var(--ion-primary-rgb), 0.08); color: var(--ion-primary); font-weight: 600; }
.ion-menu-item .mi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ion-step-50); color: var(--ion-text-muted); flex-shrink: 0;
}
.ion-menu-item.active .mi-icon { background: rgba(var(--ion-primary-rgb), 0.12); color: var(--ion-primary); }

.ion-menu-label {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ion-text-muted);
}

.ion-menu-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ion-step-100);
  font-size: 12px;
  color: var(--ion-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== ion-modal (center home modal) ===== */
.ion-modal-wrap {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.ion-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s var(--ease);
}
.ion-modal-wrap.open { pointer-events: auto; }
.ion-modal-wrap.open .ion-modal-scrim { background: rgba(0,0,0,0.5); }

.ion-modal {
  position: relative;
  width: 100%;
  max-height: 85%;
  background: var(--ion-bg);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ion-modal-wrap.open .ion-modal { transform: translateY(0); }

.ion-modal-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--ion-step-200);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.ion-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
  flex-shrink: 0;
}
.ion-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ion-text);
}
.ion-modal-header .subtitle {
  font-size: 13px;
  color: var(--ion-text-muted);
  margin-top: 2px;
}
.ion-modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ion-step-100); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ion-text-muted);
}
.ion-modal-close:hover { background: var(--ion-step-200); }

.ion-modal-body {
  padding: 8px 16px 22px;
  overflow-y: auto;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.section-btn {
  background: #fff;
  border: 1px solid var(--ion-step-100);
  border-radius: 14px;
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s var(--ease);
}
.section-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ion-step-200); }
.section-btn:active { transform: scale(0.97); }

.section-btn .sb-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.section-btn .sb-text { min-width: 0; }
.section-btn .sb-title { font-size: 14px; font-weight: 700; color: var(--ion-text); }
.section-btn .sb-desc { font-size: 11px; color: var(--ion-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Page titles ===== */
.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 18px 20px 4px;
  color: var(--ion-text);
}
.page-sub {
  font-size: 14px;
  color: var(--ion-text-muted);
  padding: 0 20px 14px;
}

/* ===== Utility: fade transitions for page switches ===== */
.page-enter {
  animation: pageEnter 0.25s var(--ease);
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats card (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 12px; }
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: 12px; color: var(--ion-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .stat-value { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; color: var(--ion-text); }
.stat-card .stat-trend { font-size: 12px; margin-top: 4px; font-weight: 600; }
.stat-card .stat-trend.up { color: var(--ion-success); }
.stat-card .stat-trend.down { color: var(--ion-danger); }

/* Spark bars for dashboard */
.sparks { display: flex; gap: 3px; align-items: flex-end; height: 30px; margin-top: 8px; }
.sparks span { flex: 1; background: var(--ion-primary-light); border-radius: 2px; opacity: 0.55; }

/* Settings toggle */
.ion-toggle {
  width: 44px; height: 26px;
  border-radius: 14px;
  background: var(--ion-step-200);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ion-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s var(--ease);
}
.ion-toggle.on { background: var(--ion-primary); }
.ion-toggle.on::after { transform: translateX(18px); }

/* Tweaks panel */
.tweaks-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 260px;
  background: #1a1d24;
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  border: 1px solid rgba(255,255,255,0.08);
}
.tweaks-panel.visible { display: block; }
.tweaks-panel h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.tweaks-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.tweaks-row label { opacity: 0.8; }
.tweaks-swatches { display: flex; gap: 6px; }
.tweaks-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.tweaks-swatch.active { border-color: #fff; }

/* Toast */
.ion-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--ion-black);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 70;
  box-shadow: var(--shadow-md);
}
.ion-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Dark mode ===== */
.ion-device.dark {
  --ion-bg: #0f1218;
  --ion-card-bg: #1a1e27;
  --ion-text: #f0f2f6;
  --ion-text-muted: #8b91a0;
  --ion-step-50: #1a1e27;
  --ion-step-100: #232833;
  --ion-step-200: #2e3543;
  --ion-step-400: #5a6270;
  --ion-step-600: #8b91a0;
  --ion-step-800: #d5d9e2;
  background: #0f1218;
}
.ion-device.dark .ion-header { background: #151a23; }
.ion-device.dark .ion-tab-bar { background: #151a23 !important; }
.ion-device.dark .ion-tab-fab { background: var(--ion-primary) !important; border-color: #151a23 !important; }
.ion-device.dark .ion-menu { background: #1a1e27; }
.ion-device.dark .ion-menu-footer { border-top-color: #2e3543; }
.ion-device.dark .ion-modal { background: #0f1218; }
.ion-device.dark .ion-modal-close { background: #232833; color: #d5d9e2; }
.ion-device.dark .ion-modal-close:hover { background: #2e3543; }
.ion-device.dark .section-btn { background: #232833; border-color: #2e3543; }
.ion-device.dark .ion-seg-btn.active { background: #2e3543; color: #fff; }
.ion-device.dark .sparks span { background: var(--ion-primary-light); }
.ion-device.dark .ion-item { border-bottom-color: #232833; }
.ion-device.dark .ion-item:hover { background: #232833; }
.ion-device.dark .ion-card,
.ion-device.dark .ion-list,
.ion-device.dark .stat-card,
.ion-device.dark .notif-row,
.ion-device.dark .fb-card { box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4); }
.ion-device.dark .quick-actions { border-top-color: #232833; }
.ion-device.dark .ion-menu-item:hover { background: #232833; }
.ion-device.dark .ion-menu-item.active { background: rgba(var(--ion-primary-rgb), 0.18); }
.ion-device.dark .ion-toast { background: #f0f2f6; color: #0f1218; }
.ion-device.dark .txn { border-bottom-color: #232833; }
.ion-device.dark .notif-row { background: #1a1e27; border-bottom-color: #232833; }
.ion-device.dark .notif-row.unread { background: #1e2635; }
.ion-device.dark .fb-cover { background: linear-gradient(135deg, #2d4373, #1a1e27); }

/* ===== Profile (cover + centered avatar + pill nav) ===== */
.fb-wrap { padding-bottom: 8px; }
.fb-cover {
  height: 180px;
  background: linear-gradient(135deg, #6b7a96, #3b5998 60%, #2d4373);
  background-image:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08), transparent 50%),
    linear-gradient(135deg, #6b7a96, #3b5998 60%, #2d4373);
  position: relative;
}
.pf-avatar-wrap {
  margin-top: -70px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
}
.pf-avatar {
  width: 130px; height: 130px;
  border-radius: 20px;
  background: var(--ion-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: 800;
  border: 5px solid var(--ion-bg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.pf-avatar .pf-cam {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ion-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ion-bg);
}
.pf-nav-pill {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 18px 16px 0;
  background: var(--ion-primary);
  border-radius: 999px;
  padding: 6px 4px;
  box-shadow: var(--shadow-sm);
}
.pf-nav-btn {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
}
.pf-nav-btn.active {
  background: rgba(255,255,255,0.18);
}
.pf-card {
  background: var(--ion-card-bg);
  margin: 16px 12px 0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.pf-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ion-text);
}
.pf-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ion-text-muted);
  line-height: 1.55;
}
.pf-footer {
  background: var(--ion-card-bg);
  margin: 14px 12px 0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--ion-text-muted);
  box-shadow: var(--shadow-sm);
}

/* ===== Flat email-style notifications list ===== */
.flat-notif {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 16px;
  background: var(--ion-card-bg);
  border-bottom: 1px solid var(--ion-step-100);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.flat-notif:hover { background: var(--ion-step-50); }
.flat-notif.unread { background: var(--ion-step-50); }
.flat-notif .fn-ic {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.flat-notif .fn-body { flex: 1; min-width: 0; }
.flat-notif .fn-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ion-text);
  letter-spacing: -0.01em;
}
.flat-notif .fn-desc {
  font-size: 13px;
  color: var(--ion-text-muted);
  margin-top: 3px;
  line-height: 1.4;
}
.flat-notif .fn-time {
  font-size: 12px;
  color: var(--ion-text-muted);
  margin-top: 5px;
}
.flat-notif .fn-end {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  padding-top: 2px;
}
.flat-notif .fn-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ion-primary);
}
.flat-notif .fn-badge {
  min-width: 22px; height: 22px; border-radius: 11px;
  background: var(--ion-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.flat-notif .fn-chev {
  color: var(--ion-step-400);
}

.fb-cover-old-unused {
  height: 160px;
  background: linear-gradient(135deg, var(--ion-primary), var(--ion-primary-dark));
  position: relative;
}
.fb-cover-btn {
  position: absolute;
  bottom: 10px; right: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(8px);
}
.fb-head {
  padding: 0 16px 14px;
  position: relative;
  background: var(--ion-card-bg);
  border-bottom: 8px solid var(--ion-bg);
}
.fb-avatar-wrap {
  margin-top: -54px;
  display: flex;
  justify-content: flex-start;
}
.fb-avatar {
  width: 108px; height: 108px; border-radius: 50%;
  background: var(--ion-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800;
  border: 5px solid var(--ion-card-bg);
  position: relative;
}
.fb-avatar .fb-cam {
  position: absolute; bottom: 0; right: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ion-step-100);
  color: var(--ion-text);
  border: 3px solid var(--ion-card-bg);
  display: flex; align-items: center; justify-content: center;
}
.fb-name { font-size: 22px; font-weight: 800; color: var(--ion-text); margin-top: 10px; letter-spacing: -0.01em; }
.fb-bio { font-size: 13px; color: var(--ion-text-muted); margin-top: 2px; }
.fb-friends { font-size: 13px; color: var(--ion-text-muted); margin-top: 8px; font-weight: 500; }
.fb-friend-stack { display: inline-flex; margin-right: 6px; vertical-align: middle; }
.fb-friend-stack > div { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ion-card-bg); margin-left: -6px; }
.fb-friend-stack > div:first-child { margin-left: 0; }

.fb-btn-row { display: flex; gap: 6px; margin-top: 12px; }
.fb-btn {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.fb-btn.primary { background: var(--ion-primary); color: #fff; }
.fb-btn.secondary { background: var(--ion-step-100); color: var(--ion-text); }
.fb-btn.icon-only { flex: 0 0 40px; padding: 9px 0; }

.fb-card {
  background: var(--ion-card-bg);
  margin-bottom: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.fb-card-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--ion-text);
}
.fb-info-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  font-size: 14px;
  color: var(--ion-text);
}
.fb-info-row .fi-ic {
  color: var(--ion-text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.fb-info-row b { font-weight: 700; }

.fb-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.fb-composer .fc-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ion-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.fb-composer input {
  flex: 1;
  border: 1px solid var(--ion-step-200);
  background: var(--ion-bg);
  border-radius: 20px;
  padding: 9px 14px;
  color: var(--ion-text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.fb-post {
  padding: 2px 0 0;
}
.fb-post-head {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 0 6px;
}
.fb-post-head .fp-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ion-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.fb-post-head .fp-meta { flex: 1; min-width: 0; }
.fb-post-head .fp-name { font-size: 14px; font-weight: 700; color: var(--ion-text); }
.fb-post-head .fp-time { font-size: 12px; color: var(--ion-text-muted); margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.fb-post-text { font-size: 14px; color: var(--ion-text); line-height: 1.45; padding: 6px 0 10px; }
.fb-post-media {
  height: 180px;
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, var(--ion-step-100) 0 12px, var(--ion-step-50) 12px 24px);
  display: flex; align-items: center; justify-content: center;
  color: var(--ion-text-muted);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  margin-bottom: 8px;
}
.fb-post-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ion-text-muted);
  padding: 8px 0;
  border-top: 1px solid var(--ion-step-100);
  border-bottom: 1px solid var(--ion-step-100);
}
.fb-post-actions {
  display: flex;
  padding: 4px 0;
}
.fb-post-action {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ion-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 6px;
}
.fb-post-action:hover { background: var(--ion-step-50); }

.fb-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.fb-photo {
  aspect-ratio: 1;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, var(--ion-step-100) 0 8px, var(--ion-step-50) 8px 16px);
}

/* ===== Email-style notifications inbox ===== */
.mail-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--ion-card-bg);
  border-bottom: 1px solid var(--ion-step-100);
  position: sticky;
  top: 0;
  z-index: 2;
}
.mail-search {
  flex: 1;
  background: var(--ion-step-100);
  border-radius: 20px;
  padding: 8px 14px 8px 36px;
  border: none;
  font-size: 13px;
  color: var(--ion-text);
  outline: none;
  position: relative;
  font-family: inherit;
}
.mail-search-wrap {
  flex: 1;
  position: relative;
}
.mail-search-wrap .ms-ic {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ion-text-muted);
}
.mail-chips {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: var(--ion-card-bg);
  border-bottom: 1px solid var(--ion-step-100);
  overflow-x: auto;
}
.mail-chip {
  padding: 6px 12px;
  border-radius: 16px;
  background: var(--ion-step-100);
  font-size: 12px;
  font-weight: 600;
  color: var(--ion-text);
  white-space: nowrap;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mail-chip.active {
  background: rgba(var(--ion-primary-rgb), 0.14);
  color: var(--ion-primary);
}

.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--ion-card-bg);
  border-bottom: 1px solid var(--ion-step-100);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.notif-row:hover { background: var(--ion-step-50); }
.notif-row.unread {
  background: var(--ion-card-bg);
}
.notif-row.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ion-primary);
}
.notif-row.unread .nr-title,
.notif-row.unread .nr-preview { font-weight: 700; color: var(--ion-text); }

.nr-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.nr-body { flex: 1; min-width: 0; }
.nr-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
}
.nr-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ion-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nr-time {
  font-size: 11px;
  color: var(--ion-text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.nr-subject {
  font-size: 13px;
  color: var(--ion-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nr-preview {
  font-size: 12px;
  color: var(--ion-text-muted);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nr-tags { display: flex; gap: 6px; margin-top: 6px; }
.nr-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}
.nr-star {
  color: var(--ion-step-400);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.nr-star.filled { color: var(--ion-warning); }

.mail-section-label {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ion-text-muted);
  background: var(--ion-bg);
}

/* transaction row */
.txn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ion-step-100);
}
.txn:last-child { border-bottom: none; }
.txn .txn-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.txn .txn-body { flex: 1; min-width: 0; }
.txn .txn-title { font-size: 14px; font-weight: 600; }
.txn .txn-sub { font-size: 12px; color: var(--ion-text-muted); margin-top: 2px; }
.txn .txn-amt { font-size: 14px; font-weight: 700; }
.txn .txn-amt.pos { color: var(--ion-success); }
.txn .txn-amt.neg { color: var(--ion-danger); }

/* Segment control */
.ion-segment {
  display: flex;
  margin: 10px 12px;
  background: var(--ion-step-100);
  border-radius: 10px;
  padding: 3px;
}
.ion-seg-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ion-text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.ion-seg-btn.active {
  background: #fff;
  color: var(--ion-primary);
  box-shadow: var(--shadow-sm);
}


/* ===== Edit Profile ===== */
.ep-wrap { padding-bottom: 24px; }
.ep-head {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 8px;
}
.ep-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--ion-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800;
  position: relative;
  box-shadow: var(--shadow-md);
}
.ep-avatar-cam {
  position: absolute; bottom: 0; right: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ion-card-bg);
  color: var(--ion-text);
  border: 2px solid var(--ion-bg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ep-avatar-btn {
  margin-top: 10px;
  background: none; border: none;
  color: var(--ion-primary);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.ep-list {
  background: var(--ion-card-bg);
  margin: 0 12px 8px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ep-field {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ion-step-100);
}
.ep-field:last-child { border-bottom: none; }
.ep-field > span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ion-text-muted);
  margin-bottom: 4px;
}
.ep-field input, .ep-field textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--ion-text);
  padding: 2px 0;
  outline: none;
  resize: none;
  font-family: inherit;
}
.ep-actions {
  display: flex;
  gap: 10px;
  padding: 14px 12px;
}
.ep-btn-primary, .ep-btn-secondary {
  flex: 1;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}
.ep-btn-primary {
  background: var(--ion-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--ion-primary-rgb), 0.3);
}
.ep-btn-secondary {
  background: var(--ion-card-bg);
  color: var(--ion-text);
  border: 1px solid var(--ion-step-200);
}

/* ===== Auth (login + register) ===== */
.auth-wrap {
  padding: 20px 14px 28px;
}
.auth-hero {
  text-align: center;
  padding: 8px 0 20px;
}
.auth-logo {
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--ion-primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(var(--ion-primary-rgb), 0.3);
}
.auth-title {
  font-size: 24px; font-weight: 800;
  margin: 0 0 6px; color: var(--ion-text);
  letter-spacing: -0.02em;
}
.auth-sub {
  font-size: 14px;
  color: var(--ion-text-muted);
  margin: 0;
}
.auth-card {
  background: var(--ion-card-bg);
  border-radius: 14px;
  padding: 20px 18px;
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 14px;
}
.auth-field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ion-text);
  margin-bottom: 6px;
}
.af-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  background: var(--ion-step-50);
  border: 1px solid var(--ion-step-100);
  border-radius: 10px;
  color: var(--ion-text-muted);
}
.af-input input {
  flex: 1;
  border: none; outline: none; background: none;
  font-size: 14px;
  color: var(--ion-text);
}
.af-eye {
  background: none; border: none;
  color: var(--ion-text-muted);
  cursor: pointer;
}
.auth-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
  margin-top: -4px;
}
.auth-check {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ion-text-muted);
  cursor: pointer;
}
.auth-link {
  background: none; border: none;
  color: var(--ion-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
.auth-submit {
  margin-top: 4px;
  padding: 13px 16px;
  border: none; border-radius: 10px;
  background: var(--ion-primary);
  color: #fff;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(var(--ion-primary-rgb), 0.3);
}
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--ion-text-muted);
  font-size: 12px;
  margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--ion-step-100);
}
.auth-socials {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.auth-social {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px;
  background: var(--ion-card-bg);
  border: 1px solid var(--ion-step-200);
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  color: var(--ion-text);
  cursor: pointer;
}
.auth-foot {
  text-align: center;
  font-size: 13px;
  color: var(--ion-text-muted);
  margin-top: 4px;
}

/* ===== Stub page (section welcome screens) ===== */
.stub-wrap {
  padding: 24px 16px 32px;
  text-align: center;
}
.stub-hero {
  width: 110px; height: 110px;
  border-radius: 28px;
  margin: 12px auto 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.stub-icon { display: flex; align-items: center; justify-content: center; }
.stub-title {
  font-size: 26px; font-weight: 800;
  color: var(--ion-text);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.stub-sub {
  font-size: 15px; line-height: 1.55;
  color: var(--ion-text-muted);
  margin: 0 auto 22px;
  max-width: 320px;
}
.stub-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 320px;
  margin: 0 auto;
}
.stub-actions > button { flex: 1; }

/* Dark-mode overrides for new surfaces */
.ion-device.dark .ep-list,
.ion-device.dark .auth-card { box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4); }
.ion-device.dark .ep-field { border-bottom-color: #232833; }
.ion-device.dark .af-input { background: #232833; border-color: #2e3543; }
.ion-device.dark .auth-divider::before,
.ion-device.dark .auth-divider::after { background: #2e3543; }
.ion-device.dark .auth-social { background: #1a1e27; border-color: #2e3543; }
.ion-device.dark .ep-btn-secondary { background: #1a1e27; border-color: #2e3543; }
