/* Verité Research Master Dashboard - PWA and device-fit styles.
 * Load after the app's own stylesheet. Uses the app's existing CSS variables. */

/* Respect notches and home indicators when installed on phones */
body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

/* Installed app: no pull-to-refresh bounce, no long-press callouts on controls */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  html, body { overscroll-behavior-y: none; }
  button, a, [role="button"] { -webkit-touch-callout: none; }
}

/* Comfortable tap targets on touch screens */
@media (pointer: coarse) {
  button, .btn, select, input, [role="button"], [data-act] { min-height: 40px; }
}

/* Update bar (pwa.js) */
#pwa-update {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 9999;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border-radius: 10px;
  background: var(--side, #14304f); color: var(--side-ink, #eef5f2);
  box-shadow: var(--shadow, 0 12px 32px rgba(0,0,0,.2)); font-size: 13px;
}
#pwa-update button {
  border: 0; border-radius: 7px; padding: 6px 12px; font-weight: 600;
  background: var(--accent, #1f5a8e); color: var(--accent-ink, #fff);
}

/* Install button: hidden until the browser says the app can be installed */
[data-pwa-install][hidden] { display: none !important; }

/* Already running as an installed app: nothing to install */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  [data-pwa-install] { display: none !important; }
}

/* Notifications (push.css): its variable names, mapped to the dashboard's own colours and fonts */
:root {
  --bad: var(--critical, #b3261e); --side-bg: var(--side, #14304f); --font-ui: var(--font, system-ui, sans-serif);
  --font-display: var(--font-d, Georgia, serif); --line-strong: var(--line-2, #c4bdb1); --r-s: var(--radius-s, 7px);
  --accent-line: var(--accent-2, #3b7bb0);
}
/* The red count on My Work, on the icon's corner in the folded sidebar rail */
.app.rail .nav a .notif-badge { position: absolute; top: 1px; right: 0; margin: 0; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }

/* Install on a phone: the banner at the top of the page, and the sheet of steps (pwa.js) */
#pwa-install-banner { display: flex; align-items: center; gap: 10px; margin: 10px 16px 0; padding: 10px 10px 10px 12px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.08)); }
#pwa-install-banner img { border-radius: 9px; flex: none; }
#pwa-install-banner .pwa-b-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
#pwa-install-banner .pwa-b-t b { font-size: 14px; font-weight: 650; color: var(--ink, #0f172a); }
#pwa-install-banner .pwa-b-t span { font-size: 12px; color: var(--ink-3, #8a94a6); }
#pwa-install-banner .pwa-b-go { flex: none; border: 0; border-radius: 9px; padding: 0 14px; height: 36px; min-height: 36px; font: inherit; font-size: 13.5px; font-weight: 600;
  background: var(--accent, #2456a6); color: var(--accent-ink, #fff); cursor: pointer; }
#pwa-install-banner .pwa-b-x { flex: none; width: 32px; height: 32px; min-height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-3, #8a94a6); font-size: 20px; line-height: 1; cursor: pointer; }
@media (display-mode: standalone), (display-mode: minimal-ui) { #pwa-install-banner { display: none !important; } }

#pwa-install-sheet { border: 0; padding: 0; width: min(440px, 100vw); max-width: 100vw; margin: auto auto 0; border-radius: 20px 20px 0 0;
  background: var(--surface, #fff); color: var(--ink, #0f172a); box-shadow: 0 -12px 40px rgba(15,23,42,.25); }
#pwa-install-sheet::backdrop { background: rgba(15,23,42,.45); }
@media (min-width: 600px) { #pwa-install-sheet { margin: auto; border-radius: 16px; } }
.pwa-sheet { padding: 20px 20px calc(18px + env(safe-area-inset-bottom, 0px)); font: 14px/1.5 var(--font, system-ui, sans-serif); }
.pwa-sheet-h { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.pwa-sheet-h img { border-radius: 11px; flex: none; }
.pwa-sheet h2 { margin: 0 0 2px; font: 600 20px/1.2 var(--font-d, Georgia, serif); }
.pwa-sheet p { margin: 0; color: var(--ink-2, #475467); font-size: 13.5px; }
.pwa-sheet .pwa-or { margin: 4px 0 8px; font-weight: 600; color: var(--ink, #0f172a); }
.pwa-sheet ol { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: pwa; display: flex; flex-direction: column; gap: 10px; }
.pwa-sheet li { counter-increment: pwa; position: relative; padding-left: 38px; min-height: 26px; font-size: 14.5px; }
.pwa-sheet li::before { content: counter(pwa); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft, #eaf1fc); color: var(--accent, #2456a6); font-weight: 700; font-size: 13px; }
.pwa-sheet .pwa-note { font-size: 12.5px; color: var(--ink-3, #8a94a6); margin-bottom: 8px; }
.pwa-sheet .pwa-go, .pwa-sheet .pwa-close { width: 100%; height: 44px; border-radius: 11px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.pwa-sheet .pwa-go { border: 0; background: var(--accent, #2456a6); color: var(--accent-ink, #fff); margin-bottom: 14px; }
.pwa-sheet .pwa-close { border: 1px solid var(--line-2, #d6dae1); background: var(--surface, #fff); color: var(--ink, #0f172a); margin-top: 6px; }
