/* The bell and its panel (bell.js), "Notifications on this device" (push.js mount) and the two nudges (push.js). Colours come
   from the app's tokens; each falls back to a light/dark value here so the kit looks right in an app that has none yet.
   Tokens it reads: --bg --surface --surface-2 --line --fg --muted --accent --accent-soft --accent-fg (and --bar/--bar-fg). */
:root { --kn-surface: var(--surface, #fff); --kn-surface2: var(--surface-2, #f1efe9); --kn-line: var(--line, #e3ded5); --kn-fg: var(--fg, #221f1a);
  --kn-muted: var(--muted, #6f6a60); --kn-accent: var(--accent, #1f6f5c); --kn-soft: var(--accent-soft, #e3f1ec); --kn-onaccent: var(--accent-fg, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --kn-surface: var(--surface, #1c2022); --kn-surface2: var(--surface-2, #262b2e); --kn-line: var(--line, #343a3e);
  --kn-fg: var(--fg, #eceae4); --kn-muted: var(--muted, #a09a8e); --kn-accent: var(--accent, #5cc3a6); --kn-soft: var(--accent-soft, #1d3a32); --kn-onaccent: var(--accent-fg, #0b1f19); } }
:root[data-theme="dark"] { --kn-surface: var(--surface, #1c2022); --kn-surface2: var(--surface-2, #262b2e); --kn-line: var(--line, #343a3e);
  --kn-fg: var(--fg, #eceae4); --kn-muted: var(--muted, #a09a8e); --kn-accent: var(--accent, #5cc3a6); --kn-soft: var(--accent-soft, #1d3a32); --kn-onaccent: var(--accent-fg, #0b1f19); }

/* Text fields are at least 16px on touch screens: iPhone Safari zooms into a smaller one and stays zoomed. Never fixed by blocking
   zoom (maximum-scale=1 or user-scalable=no). Owner, 18 Oct 2026, global rule. */
@media (pointer: coarse) { .np-switch input:not([type="checkbox"]), .bell-panel input, .bell-panel textarea { font-size: max(16px, 1em); } }

/* The bell */
.bell { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; color: inherit; text-decoration: none; }
.bell-n { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e0245e; color: #fff;
  font: 700 11px/18px system-ui, sans-serif; text-align: center; box-sizing: border-box; }
.bell-n[hidden] { display: none; }
.bell-panel { position: fixed; z-index: 60; width: 380px; max-width: calc(100vw - 16px); max-height: min(70dvh, 560px); display: flex; flex-direction: column;
  background: var(--kn-surface); color: var(--kn-fg); border-radius: 16px; box-shadow: 0 0 0 1px var(--kn-line), 0 16px 44px rgba(0,0,0,.25); overflow: hidden; }
.bp-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--kn-line); }
.bp-all { color: var(--kn-accent); font-weight: 600; text-decoration: none; }
.bp-body { overflow-y: auto; overscroll-behavior: contain; }
.notifs { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--kn-line); }
.notif:last-child { border-bottom: 0; }
.notif.new { background: var(--kn-soft); }
.notif-av { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--kn-surface2); color: var(--kn-accent); font: 700 13px/1 system-ui, sans-serif; }
.notif-txt { flex: 1; min-width: 0; }
.notif-txt p { margin: 0 0 2px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.notif-when { font-size: 13px; color: var(--kn-muted); }
.notif-open { flex: none; padding: 8px 12px; border-radius: 999px; background: var(--kn-surface2); color: var(--kn-fg); text-decoration: none; font-size: 14px; font-weight: 600; }
.notif-none { margin: 0; padding: 18px 16px; color: var(--kn-muted); }
@media (max-width: 760px) {                       /* a sheet from the bottom on a phone */
  .bell-panel { left: 0; right: 0 !important; top: auto !important; bottom: 0; width: auto; max-width: none; border-radius: 18px 18px 0 0; max-height: 72dvh; padding-bottom: env(safe-area-inset-bottom); }
}

/* Settings: notifications on this device */
.np-head { margin: 0 0 8px; font-size: 16px; }
.np-switch { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; min-height: 44px; }
.np-switch input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.np-muted, .np-note { margin: 6px 2px 0; font-size: 14px; color: var(--kn-muted); line-height: 1.45; }
.np-note { padding: 10px 12px; border-radius: 10px; background: var(--kn-surface2); }
.np-test { margin-top: 10px; }
.np-test button { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--kn-line); background: var(--kn-surface); color: var(--kn-fg); font: inherit; }

/* The nudges (push.js): a panel at the foot of the screen, above any tab bar, with the page dimmed behind it. */
.np-nudge { position: fixed; z-index: 69; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto;
  display: flex; gap: 12px; padding: 14px 14px 12px; background: var(--kn-surface); color: var(--kn-fg); border-radius: 18px;
  box-shadow: 0 0 0 1px var(--kn-line), 0 16px 44px rgba(0,0,0,.28); animation: npIn .25s ease-out; }
.np-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bar, var(--kn-accent)); color: var(--bar-fg, var(--kn-onaccent)); }
.np-nudge h2 { margin: 1px 0 4px; font: 650 15.5px/1.3 system-ui, sans-serif; }
.np-nudge p { margin: 0 0 10px; font-size: 13.5px; color: var(--kn-muted); line-height: 1.4; }
.np-acts { display: flex; justify-content: flex-end; gap: 8px; }
.np-acts button { min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--kn-line); background: var(--kn-surface2); color: var(--kn-fg); font: inherit; font-weight: 600; cursor: pointer; }
.np-acts button.primary { background: var(--kn-accent); border-color: transparent; color: var(--kn-onaccent); }
@media (min-width: 641px) { .np-nudge { bottom: 24px; } }
@keyframes npIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.np-app { font: 800 12px/1 system-ui, sans-serif; letter-spacing: .02em; border-radius: 11px; text-transform: none; }
.np-steps { margin: 0 0 10px; padding: 0 0 0 20px; font-size: 13.5px; line-height: 1.45; }
.np-steps li { margin: 4px 0; }
.np-sic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--kn-surface2); color: #0a84ff; vertical-align: -6px; margin: 0 2px; }   /* Safari's own blue, so they look like the buttons they stand for */
.np-scrim { position: fixed; inset: 0; z-index: 68; background: rgba(8, 12, 10, .62); touch-action: none; animation: npFade .25s ease-out; }
@keyframes npFade { from { opacity: 0; } to { opacity: 1; } }
html:has(.np-scrim) { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .np-nudge, .np-scrim { animation: none; } }

.np-app img { width: 100%; height: 100%; border-radius: inherit; display: block; object-fit: cover; }
.np-ic.np-app:has(img) { background: none; padding: 0; overflow: hidden; }
