/* Mobile-first shell for the resident-facing portal — a bottom tab bar
   instead of the staff sidebar, since this is meant to be used on phones. */

body { padding-bottom: 0; }

.mb-topbar {
  min-height: 60px;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 18px), var(--topbar-bg, var(--sea-blue));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.mb-topbar-brand { display: flex; align-items: center; gap: 9px; }
.mb-topbar-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: rgba(255,255,255,0.15); }
.mb-topbar-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.mb-topbar-sub { font-size: 10.5px; opacity: 0.8; letter-spacing: 0.02em; margin-top: 1px; }
.mb-topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mb-icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 15px; display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.mb-icon-btn:hover { background: rgba(255,255,255,0.25); }
.mb-icon-btn-emergency { background: #c0392b; }
.mb-icon-btn-emergency:hover { background: #a83226; }

.mb-banner {
  background: rgba(193,103,59,0.12); color: var(--accent-terracotta);
  padding: 10px 16px; font-size: 12.5px; text-align: center;
}
.mb-banner-emergency {
  background: #c0392b; color: #fff; font-weight: 600; padding: 12px 16px; font-size: 13px;
  position: sticky; top: 56px; z-index: 19;
}

.mb-content {
  max-width: 640px; margin: 0 auto; padding: 16px 16px 90px;
  min-height: calc(100vh - 56px);
}

.mb-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--bg-card); border-top: 1px solid var(--border-soft);
  max-width: 640px; margin: 0 auto; z-index: 20;
}
.mb-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; border: none; background: none; font-size: 10.5px; color: var(--text-secondary);
  transition: color 0.15s;
}
.mb-tab span { font-size: 19px; }
.mb-tab.active { color: var(--portal-primary, var(--sea-blue)); font-weight: 700; }

.mb-section-title { font-size: 16px; font-weight: 700; margin: 4px 0 12px; }
.mb-list-item {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 10px;
}
.mb-list-item-emergency { border-left: 3px solid #c0392b; background: rgba(192,57,43,0.05); }
.mb-list-item .title { font-weight: 700; font-size: 14px; }
.mb-list-item .meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.mb-quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.mb-quick-actions button {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 16px 10px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  transition: all 0.2s ease; cursor: pointer;
}
.mb-quick-actions button:hover {
  border-color: var(--portal-primary, var(--sea-blue));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.mb-quick-actions button:active {
  transform: translateY(0);
}
.mb-quick-actions button .icon { font-size: 22px; display: block; margin-bottom: 6px; }

/* ── Home: welcome header ─────────────────────────────────────── */
.mb-welcome {
  background: var(--welcome-bg, linear-gradient(135deg, var(--sea-blue), var(--hill-green)));
  color: #fff; border-radius: var(--radius-md); padding: 20px 18px; margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.mb-welcome-greeting { font-size: 19px; font-weight: 700; }
.mb-welcome-sub { font-size: 12.5px; opacity: 0.92; margin-top: 4px; }

/* ── E-Services: certificate catalog + "your info" card ─────────── */
.mb-service-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mb-service-card {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 16px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.mb-service-card .icon { font-size: 22px; }
.mb-service-card .label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.mb-service-card .fee { font-size: 11px; color: var(--text-secondary); }

.mb-your-info {
  background: rgba(30,58,95,0.06); border-radius: var(--radius-md); padding: 12px 14px;
}
.mb-your-info .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--sea-blue); }
.mb-your-info .value.name { font-size: 14px; font-weight: 700; margin-top: 4px; }
.mb-your-info .value.muted { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

/* ── Radio-button option groups (purpose, update reason) ─────────── */
.mb-radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.mb-radio-option { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.mb-radio-option input { margin: 0; }

/* ── My Documents: digital document wallet ───────────────────────── */
.mb-doc-card {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 10px; display: flex; align-items: flex-start; gap: 12px;
}
.mb-doc-icon { font-size: 26px; flex-shrink: 0; }
.mb-doc-info { flex: 1; min-width: 0; }
.mb-doc-info .title { font-weight: 700; font-size: 14px; }
.mb-doc-info .meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.mb-doc-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ── My Requests: timeline stepper ───────────────────────────────── */
.mb-timeline { display: flex; flex-direction: column; }
.mb-timeline-step { display: flex; align-items: center; gap: 10px; }
.mb-timeline-step .dot {
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; background: var(--bg-page); border: 2px solid var(--border-soft); color: var(--text-secondary);
}
.mb-timeline-step.done .dot { background: var(--hill-green); border-color: var(--hill-green); color: #fff; }
.mb-timeline-step.active .dot { background: var(--accent-terracotta); border-color: var(--accent-terracotta); color: #fff; }
.mb-timeline-step .label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.mb-timeline-step.done .label, .mb-timeline-step.active .label { color: var(--text-primary); font-weight: 600; }
.mb-timeline-connector { width: 2px; height: 16px; background: var(--border-soft); margin-left: 10px; }
.mb-timeline-fail {
  margin-top: 12px; background: rgba(192,57,43,0.1); color: #c0392b; border-radius: var(--radius-md);
  padding: 10px 12px; font-size: 12.5px; font-weight: 600;
}
.mb-timeline-note {
  margin-top: 12px; background: rgba(79,122,92,0.08); border-radius: var(--radius-md);
  padding: 10px 12px; font-size: 12.5px;
}

/* ── More menu ────────────────────────────────────────────────── */
.mb-more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mb-more-grid button {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 16px 10px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text-primary);
}
.mb-more-grid button .icon { font-size: 22px; display: block; margin-bottom: 6px; }

/* ── Emergency Center ─────────────────────────────────────────── */
.mb-emergency-header {
  background: linear-gradient(135deg, #c0392b, #8e2a1f); color: #fff; border-radius: var(--radius-md);
  padding: 22px 16px; text-align: center;
}
.mb-emergency-header .icon { font-size: 36px; }
.mb-emergency-header .title { font-size: 18px; font-weight: 800; letter-spacing: 0.04em; margin-top: 4px; }
.mb-emergency-contact { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13.5px; font-weight: 600; }
.mb-emergency-contact:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.mb-emergency-contact a { color: var(--sea-blue); }

/* ── Itanong Mo Kay Sec chat ──────────────────────────────────── */
.mb-kaysec-thread { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; padding-bottom: 8px; }
.mb-kaysec-bubble { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; }
.mb-kaysec-bubble.bot { background: var(--bg-card); border: 1px solid var(--border-soft); align-self: flex-start; border-bottom-left-radius: 3px; }
.mb-kaysec-bubble.user { background: var(--sea-blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.mb-kaysec-input { display: flex; gap: 8px; margin-top: 12px; position: sticky; bottom: 0; background: var(--bg-page); padding-top: 6px; }
.mb-kaysec-input input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 20px; font-size: 13.5px;
}
.mb-kaysec-input button { border-radius: 20px; }

/* ── Barangay Projects progress bar ──────────────────────────────── */
.mb-progress-bar { height: 6px; background: var(--border-soft); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.mb-progress-fill { height: 100%; background: var(--accent-terracotta); border-radius: 4px; }

/* ── Contact Barangay ─────────────────────────────────────────── */
.mb-contact-note {
  background: rgba(30,58,95,0.06); border-radius: var(--radius-md); padding: 12px 14px; font-size: 12.5px; line-height: 1.5;
}
.mb-contact-link {
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 16px 10px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text-primary); display: block;
}
.mb-contact-link .icon { font-size: 22px; display: block; margin-bottom: 6px; }

/* ── Auth tabs (Sign In / Create Account) — modern segmented control ── */
.auth-tabs {
  display: flex; gap: 3px; background: var(--bg-page); border-radius: var(--radius-md);
  padding: 4px; margin-top: 18px;
}
.auth-tab {
  flex: 1; background: none; border: none; padding: 9px 10px; border-radius: calc(var(--radius-md) - 3px);
  font-size: 13px; font-weight: 600; color: var(--text-secondary); transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tab.active { background: var(--bg-card); color: var(--portal-primary, var(--sea-blue)); box-shadow: var(--shadow-card); }

/* ── Consent trigger — replaces a bare checkbox with a tappable card
   that opens the full agreement modal; only that modal's "Agree" click
   can flip it into the agreed state. ─────────────────────────────── */
.consent-trigger {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: rgba(30,58,95,0.05); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 12px 14px; transition: background 0.15s, border-color 0.15s;
}
.consent-trigger:hover { background: rgba(30,58,95,0.09); }
.consent-trigger-icon { font-size: 19px; flex-shrink: 0; }
.consent-trigger-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.consent-trigger-text strong { font-size: 13px; color: var(--text-primary); }
.consent-trigger-text span { font-size: 11.5px; color: var(--text-secondary); line-height: 1.4; }
.consent-trigger-mark {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-soft); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 700;
}
.consent-trigger.agreed { background: rgba(79,122,92,0.09); border-color: var(--hill-green); }
.consent-trigger.agreed .consent-trigger-text span { color: var(--hill-green); font-weight: 600; }
.consent-trigger.agreed .consent-trigger-mark { background: var(--hill-green); border-color: var(--hill-green); }

/* ── Consent modal — Privacy Policy / Terms of Service ────────────── */
.consent-modal { display: flex; flex-direction: column; }
.consent-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 12px; }
.consent-tab {
  padding: 9px 14px; background: none; border: none; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.consent-tab.active { color: var(--portal-primary, var(--sea-blue)); border-bottom-color: var(--portal-primary, var(--sea-blue)); }
.consent-tab-panel {
  max-height: 260px; overflow-y: auto; white-space: pre-wrap;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 13px; line-height: 1.65; color: var(--text-primary);
  background: var(--bg-page);
}
.consent-confirm-row {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.consent-confirm-row input { margin-top: 2px; flex-shrink: 0; }
.consent-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (min-width: 641px) {
  .mb-topbar, .mb-tabbar { max-width: 640px; margin: 0 auto; }
}
