/* r10 (John, Q6 A): the bell and its notifications. In the app only. HIG: light weights, hairlines, 44px targets;
   the bell is a plain outline icon in the text color (black / white, like the logo); magenta only for the unread count
   and the unread dots. Phones: a sheet, nothing wider than the screen (r4.1). */

/* the bell in the header: 44 x 44, a small magenta count on its shoulder */
.bell-btn { position: relative; color: var(--text); }
.bell-btn svg { width: 22px; height: 22px; stroke-width: 1.6; }
.bell-badge { position: absolute; top: 6px; left: 24px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; box-sizing: border-box;
  background: var(--accent); color: var(--accent-ink); font: 600 11px/18px var(--font-ui); text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--header); pointer-events: none; }
.bell-badge[hidden] { display: none; }

/* desktop: a popover under the bell */
.notif-pop { position: fixed; z-index: 45; width: 400px; max-width: calc(100vw - 16px); max-height: min(600px, calc(100vh - 88px));
  display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; outline: none; }
.notif-head { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 8px 4px 16px; border-bottom: 1px solid var(--hairline); flex: none; }
.notif-head h2, .notif-sheet .sheet-head h2 { flex: 1; min-width: 0; font: 600 17px/22px var(--font-ui); margin: 0; color: var(--text); letter-spacing: 0; text-transform: none; }
.notif-all { flex: none; height: 32px; min-height: 32px; padding: 0 10px; border: 0; background: transparent; color: var(--text); font: 400 15px/20px var(--font-ui); border-radius: 8px; position: relative; cursor: pointer; }
.notif-all::after { content: ''; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.notif-all:hover:not([disabled]) { background: var(--soft); }
.notif-all[hidden] { display: none; }
/* r10c: more unread than the list shows: a second, quieter line says the older ones are included */
.notif-all { display: inline-flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.notif-all.two { height: 44px; min-height: 44px; padding: 2px 10px; }
.notif-all-main { font: 400 15px/20px var(--font-ui); }
.notif-all-sub { font: 400 12px/16px var(--font-ui); color: var(--text-2); white-space: nowrap; }
.notif-more { display: grid; justify-items: center; gap: 4px; }
.notif-more p { margin: 0; }
.notif-shown { min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--text); font: 400 15px/20px var(--font-ui); border-radius: 8px; cursor: pointer; }
.notif-shown:hover { background: var(--soft); }
.notif-shown:focus-visible, .notif-all:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; } /* r10b: hidden (not greyed) when nothing is unread */
.notif-pop .notif-wrap { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

/* the list: avatar (or a calendar for due today), what happened, the task, the project and when; the unread dot */
.notif-list { list-style: none; margin: 0; padding: 4px 0; }
.notif { display: flex; align-items: stretch; min-width: 0; border-bottom: 1px solid var(--hairline); }
.notif:last-child { border-bottom: 0; }
.notif-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px 12px 16px; border: 0; background: transparent;
  color: inherit; text-align: left; font: inherit; cursor: pointer; border-radius: 0; }
.notif-main:hover { background: var(--soft); }
.notif-main:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.notif-av { flex: none; width: 32px; height: 32px; font-size: 12px; }
.notif-av.due { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline); }
.notif-av.due svg { width: 16px; height: 16px; }
.notif-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.notif-line { font: 400 15px/20px var(--font-ui); color: var(--text); overflow-wrap: anywhere; }
.notif-line strong { font-weight: 500; }
.notif-title { font: 400 15px/20px var(--font-ui); color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.notif.unread .notif-title { font-weight: 500; }
.notif-excerpt { font: 400 14px/19px var(--font-ui); color: var(--text-2); overflow: hidden; display: block; max-height: 38px; overflow-wrap: anywhere; } /* 2 lines; app.js fits the text so the closing ” always shows */
.notif-meta { font: 400 13px/18px var(--font-ui); color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; margin-top: 1px; }
.notif:not(.unread) .notif-line, .notif:not(.unread) .notif-title { color: var(--text-2); }
/* the unread dot is the "mark as read" button (44 wide; the dot is 8px magenta) */
.notif-dot { flex: none; width: 44px; border: 0; background: transparent; display: flex; align-items: flex-start; justify-content: center; padding-top: 20px; cursor: pointer; border-radius: 0; }
.notif-dot > span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.notif-dot:hover > span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.notif-dot:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.notif:not(.unread) .notif-main { padding-right: 48px; }
.notif-empty { padding: 40px 24px; text-align: center; color: var(--text-2); font: 400 15px/20px var(--font-ui); margin: 0; }
.notif-empty p { margin: 4px 0 0; }
.notif-empty .small { color: var(--text-3); font-size: 13px; line-height: 18px; }
.notif-empty-icon { display: inline-flex; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; background: var(--soft); color: var(--text-2); margin-bottom: 8px; }
.notif-empty-icon svg { width: 22px; height: 22px; }
.notif-more { color: var(--text-3); text-align: center; padding: 8px 16px 12px; margin: 0; }

/* phone: the sheet (the r7 sheet component), full width, nothing scrolls sideways */
.notif-sheet .sheet-head { gap: 4px; }
.notif-sheet .sheet-body { padding: 0; }
.notif-sheet .notif-main { padding-left: max(16px, env(safe-area-inset-left)); }
@media (max-width: 600px) {
  .notif-sheet { min-height: 60vh; }
  /* header: back | (logo, centered) | bell | ⋯ | account */
  .topbar-inner { grid-template-columns: 44px 1fr auto auto auto; }
  .topbar-inner > .bell-btn { grid-column: 3; grid-row: 1; height: 44px; }
  .topbar-inner > [data-test=project-menu] { grid-column: 4; }
  .topbar-inner > [aria-label^="Account"] { grid-column: 5; }
}
/* r10b (Kirby): on PROJECT pages at 600px and below the account avatar leaves the header (the account menu is on the
   home screen). The wordmark stays centered at 20px at every width; the right cluster is bell, then ⋯ (44px each),
   16px from the edge. At 320: the cluster starts at 216, the wordmark ends at about 202. Home keeps logo, bell, avatar. */
@media (max-width: 600px) {
  .topbar-inner:has(> .topbar-id) { grid-template-columns: 44px 1fr 44px 44px; padding-right: max(16px, env(safe-area-inset-right)); }
  .topbar-inner:has(> .topbar-id) > [aria-label^="Account"] { display: none; }
  .topbar-inner:has(> .topbar-id) > .bell-btn { grid-column: 3; width: 44px; min-width: 44px; }
  .topbar-inner:has(> .topbar-id) > [data-test=project-menu] { grid-column: 4; width: 44px; min-width: 44px; margin-right: 0; }
  .topbar-inner:has(> .topbar-id) .topbar-id .title-row, .topbar-inner:has(> .topbar-id) .topbar-id > h1 { margin-right: calc(-1 * max(16px, env(safe-area-inset-right))); }
}
