/* ============================================================
   App shell layout — header, sidebar (desktop), bottom nav (mobile)
   ============================================================ */

/* ---- Top app bar ---- */
.topbar {
  position: sticky; top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}
.topbar--gradient { background: var(--gradient-dark); border-bottom: none; color: #fff; }
.topbar--gradient .topbar__greeting span { color: rgba(255, 255, 255, 0.8); }
.topbar__brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.topbar__logo { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; }
.topbar__greeting { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar__greeting strong { font-size: var(--fs-sm); font-weight: 600; }
.topbar__greeting span { font-size: var(--fs-xs); color: var(--color-text-hint); }
.topbar__title { font-size: var(--fs-lg); font-weight: 700; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-1); }
.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  color: var(--color-text-secondary);
  transition: background var(--dur-fast);
}
.icon-btn:hover { background: var(--color-background); }
.topbar--gradient .icon-btn { color: #fff; }

/* ---- Sub-page header (gradient bar with back arrow, e.g. Airtime/Data pages) ---- */
.page-header {
  background: var(--gradient-dark);
  color: #fff;
  padding: var(--space-2) var(--space-4) var(--space-6);
}
.page-header__row { display: flex; align-items: center; gap: var(--space-2); }
.page-header__title { font-size: var(--fs-2xl); font-weight: 700; }
.page-header__subtitle { font-size: var(--fs-sm); color: rgba(255, 255, 255, 0.65); margin-top: 2px; }

/* ---- Page body ---- */
.page-body {
  padding: var(--space-4);
  /* Must clear the bottom nav's full rendered height, including the safe-area
     inset it adds on notched phones and the floating bar's own bottom
     margin (see .bottom-nav) — not just the base 64px. */
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0) + var(--space-3) + var(--space-6));
  max-width: 640px;
  margin-inline: auto;
  width: 100%;
}
.page-body--wide { max-width: var(--content-max-width); }

/* ---- Bottom navigation (mobile) ----
   A floating pill bar, inset from the screen edges, with Services raised as
   a gradient circular button in the middle rather than a plain flat tab -
   it's the single most-used destination (every purchase starts there). */
.bottom-nav {
  position: fixed; left: var(--space-3); right: var(--space-3); bottom: var(--space-3);
  z-index: var(--z-nav);
  display: flex;
  align-items: flex-end;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(15, 42, 87, 0.14);
  border: 1px solid var(--color-divider);
  /* box-sizing is border-box globally, so padding-bottom below would eat
     into the icon/label content area on a notched phone (safe-area-inset-bottom
     can be ~34px) unless the safe area is added on top of the content height
     here explicitly. */
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  margin-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--color-text-hint);
  font-size: 10px;
  font-weight: 500;
}
.bottom-nav__item .icon { font-size: 20px; }
.bottom-nav__item.active { color: var(--color-primary); font-weight: 600; }

.bottom-nav__item--center { justify-content: flex-start; position: relative; }
.bottom-nav__fab {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: -24px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 20px;
  border: 3px solid var(--color-surface);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--color-primary) 45%, transparent);
  transition: transform var(--dur-fast);
}
.bottom-nav__item--center:active .bottom-nav__fab { transform: scale(0.94); }
.bottom-nav__item--center.active .bottom-nav__fab { background: var(--gradient-dark); box-shadow: 0 8px 20px color-mix(in srgb, var(--color-gold) 55%, transparent); }
.bottom-nav__center-label { margin-top: 5px; color: var(--color-text-hint); }
.bottom-nav__item--center.active .bottom-nav__center-label { color: var(--color-primary); font-weight: 600; }

/* ---- Sidebar (desktop/tablet) ---- */
.sidebar {
  display: none;
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  padding: var(--space-5) var(--space-3);
  overflow-y: auto;
  z-index: var(--z-nav);
}
.sidebar__brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3) var(--space-6); }
.sidebar__brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar__brand strong { font-size: var(--fs-lg); }
.sidebar__item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--fs-md);
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar__item .icon { font-size: 20px; width: 22px; text-align: center; }
.sidebar__item:hover { background: var(--color-background); }
.sidebar__item.active { background: var(--color-icon-bg-alt); color: var(--color-primary); font-weight: 600; }
.sidebar__section-label { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; color: var(--color-text-hint); text-transform: uppercase; padding: var(--space-4) var(--space-3) var(--space-2); }

/* ---- Content shell wrapper for desktop 2/3-column dashboards ---- */
.dash-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

/* Horizontal scroller for service rows on narrow screens if the grid overflows */
.hscroll { display: flex; gap: var(--space-3); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.hscroll::-webkit-scrollbar { display: none; }
