/* BlacTec client area: phone layout. Loaded after the layout's own <style>. */
.bt-tabbar { display: none; }

@media (max-width: 960px) {
  /* bottom tab bar (logged-in clients) */
  .bt-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,.06); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bt-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; min-width: 0; -webkit-tap-highlight-color: transparent; }
  .bt-tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bt-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bt-tab.is-active { color: var(--primary); background: var(--primary-light); }
  .pn-footer { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  /* the slide-down menu: reachable to the bottom, bigger tap targets, current page marked */
  .pn-mobile-menu.open { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .pn-mobile-menu a { padding: 13px 20px; font-size: 15px; }
  .pn-mobile-menu a.bt-m-sub { padding-left: 34px; }
  .pn-mobile-menu a.bt-m-lead { font-weight: 700; color: var(--primary); }
  .pn-mobile-menu a.is-active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
  .pn-mobile-sec { padding: 16px 20px 6px; }
}

@media (max-width: 768px) {
  /* less wasted width */
  .pn-main { padding: 16px 14px 24px; }
  .pn-card { margin-bottom: 14px; }
  .pn-card-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .pn-card-body { padding: 16px; }
  .pn-page-title { font-size: 20px; }
  .pn-page-header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .pn-page-header .btn { width: 100%; }
  .pn-stat-grid { gap: 12px; }
  .pn-stat { padding: 14px; }
  .pn-stat-val { font-size: 24px; }

  /* touch-friendly controls, and 16px inputs so iPhones do not zoom the page on focus */
  .btn { min-height: 44px; }
  .form-control, input, select, textarea { font-size: 16px !important; }

  /* tables become one card per row: first cell is the title, the rest are label / value lines */
  .pn-table { display: block; overflow: visible; }
  .pn-table thead { display: none; }
  .pn-table tbody { display: block; }
  .pn-table tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .pn-table tbody tr:last-child { border-bottom: none; }
  .pn-table td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 6px 0; border: 0; text-align: right; }
  .pn-table td::before { content: attr(data-label); flex-shrink: 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); text-align: left; }
  .pn-table td:not([data-label])::before { content: none; }
  .pn-table td:first-child { justify-content: flex-start; text-align: left; font-weight: 700; padding-bottom: 8px; }
  .pn-table td:first-child::before { content: none; }
  .pn-table td[colspan] { display: block; text-align: center; }
  .pn-table td .btn { min-height: 38px; }
  .pn-table td.bt-act { gap: 8px; padding-top: 10px; }
  .pn-table td.bt-act::before { content: none; }
  .pn-table td.bt-act a, .pn-table td.bt-act .btn, .pn-table td.bt-act button { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--primary); font-weight: 600; text-decoration: none; }

  /* dashboard quick actions: main action full width, the rest two per row */
  .pn-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pn-actions .btn { width: 100%; }
  .pn-actions .btn-primary { grid-column: 1 / -1; }
}

/* big inline numbers (Add Funds balance) must fit a phone card */
@media (max-width: 768px) {
  [style*="font-size:42px"] { font-size: clamp(24px, 7.5vw, 42px) !important; }
}

/* ---------- phone polish + installed-app touches ---------- */
html { -webkit-text-size-adjust: 100%; }
a, button, .btn, .pn-stat { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.bt-install, .bt-back { display: none; }
.bt-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bt-net { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); transform: translate(-50%, -160%); z-index: 10000; padding: 9px 16px; border-radius: 999px; font: 600 13px 'DM Sans', system-ui, sans-serif; color: #fff; background: #0e0f13; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .25s ease; }
.bt-net.is-on { transform: translate(-50%, 0); opacity: 1; }
.bt-net.is-off { background: #b42318; }
.bt-net.is-ok { background: #067647; }
.pn-mobile-menu a.bt-m-install { color: var(--primary); font-weight: 600; }
html.bt-standalone .bt-back { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; margin: 0 2px 0 -6px; border: 0; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
html.bt-standalone .bt-back:active { background: var(--primary-light); }
html.bt-standalone .pn-navbar { padding-top: env(safe-area-inset-top); }

@media (max-width: 960px) {
  .bt-install { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 8px 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06); }
  .bt-install__ic { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 11px; background: #0e0f13 url('/branding/bt-pwa/icon-192.png') center / cover no-repeat; }
  .bt-install__tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
  .bt-install__tx strong { font-size: 14px; color: var(--text); }
  .bt-install__go { flex: 0 0 auto; height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: #0e0f13; color: #fff; font: 600 13.5px 'DM Sans', system-ui, sans-serif; cursor: pointer; }
  .bt-install__x { flex: 0 0 auto; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
  html.bt-standalone .pn-footer { display: none; }
  html.bt-standalone .pn-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 768px) {
  .pn-main { padding-top: 14px; }
  .pn-page-title { font-size: 22px; line-height: 1.2; letter-spacing: -.3px; }
  .pn-page-subtitle { font-size: 14px; line-height: 1.45; }
  .pn-card, .pn-stat { border-radius: 16px; }
  .pn-card { box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05); }
  .pn-stat-val { font-variant-numeric: tabular-nums; }
  .btn, .pn-stat, .bt-tab { transition: transform .12s ease, background-color .15s ease; }
  .btn:active, .pn-stat:active, .bt-tab:active { transform: scale(.97); }

  html body .form-control { min-height: 48px; border-radius: 12px; }
  html body .pn-main .btn { border-radius: 12px; }
  html body .pn-main .btn-primary { background: #0e0f13 !important; border-color: #0e0f13 !important; color: #fff !important; }
  html body .pn-main .btn-outline, html body .pn-main .btn-default { background: #fff !important; border: 1px solid #d8dde6 !important; color: #1c1c28 !important; }
  :root[data-theme="dark"] body .pn-main .btn-primary { background: #e2e8f0 !important; border-color: #e2e8f0 !important; color: #0f172a !important; }
  :root[data-theme="dark"] body .pn-main .btn-outline, :root[data-theme="dark"] body .pn-main .btn-default { background: transparent !important; border-color: #475569 !important; color: #e2e8f0 !important; }

  /* dashboard quick actions: tappable tiles, the first one is a full-width button */
  .pn-actions .btn { flex-direction: column; height: auto; min-height: 88px; padding: 14px 8px; gap: 8px; font-size: 13px; font-weight: 600; text-align: center; white-space: normal; box-shadow: none; }
  .pn-actions .btn svg { width: 22px; height: 22px; }
  html body .pn-main .pn-actions .btn-primary { flex-direction: row; min-height: 54px; gap: 10px; font-size: 14px; }
  .pn-actions .btn:last-child:nth-child(even) { grid-column: 1 / -1; min-height: 60px; flex-direction: row; gap: 10px; }
}

/* ---------- dashboard welcome card on phones: greeting, then a full-width credit panel with an Add funds button ---------- */
.pn-welcome-credit .credit-add { display: none; }
@media (max-width: 768px) {
  .pn-welcome { padding: 20px 18px 18px; gap: 14px; align-items: stretch; border-radius: 18px; margin-bottom: 16px; }
  .pn-welcome-text { flex: 1 1 100%; }
  .pn-welcome-text h2 { font-size: 21px; line-height: 1.25; }
  .pn-welcome-text p { font-size: 13.5px; margin-top: 3px; }
  .pn-welcome-credit { flex: 1 1 100%; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lbl add" "val val"; align-items: center; gap: 8px 12px; padding: 14px 14px 14px 16px; text-align: left; border-radius: 14px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.24); }
  .pn-welcome-credit .credit-lbl { grid-area: lbl; display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; color: rgba(255,255,255,.78); }
  .pn-welcome-credit .credit-lbl::before { content: ""; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3C/svg%3E") center / contain no-repeat; }
  .pn-welcome-credit .credit-val { grid-area: val; font-size: clamp(24px, 7.6vw, 30px); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
  .pn-welcome-credit .credit-add { grid-area: add; display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px; border-radius: 10px; background: #fff; color: #0e0f13 !important; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
  .pn-welcome-credit .credit-add:active { transform: scale(.97); }
}
