/* Notification Center: bell in the top bar + panel (popover on desktop / tablet, full-width sheet under the top bar on a phone).
   Tokens from admin.css only; logical properties for RTL; light and dark through the same tokens. */

/* ------------------------------------------------------------ top bar button */
.ntf-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.ntf-btn { position: relative; }
.ntf-btn.has-pending { color: var(--danger-ink); }
.ntf-badge { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
:root[data-theme="dark"] .ntf-badge { color: #1a0b0a; }
.ntf-dot { position: absolute; inset-block-start: 8px; inset-inline-end: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.ntf-btn[aria-expanded="true"] { background: var(--panel-3); }

/* touch: a bigger count (readable at arm's length), still inside the 44 px target */
@media (pointer: coarse), (max-width: 900px) {
  .ntf-badge { min-width: 19px; height: 19px; line-height: 19px; font-size: 11.5px; inset-block-start: 1px; inset-inline-end: 1px; }
  .ntf-dot { inset-block-start: 9px; inset-inline-end: 10px; width: 10px; height: 10px; }
}

/* the bell makes the top bar one button longer: on a phone the search shortcut (also in the bottom bar's Apps) gives way to it */
@media (max-width: 440px) {
  .topbar:has(.ntf-wrap) .gsearch { display: none; }
  .topbar:has(.ntf-wrap) > .sub-chip { margin-inline-start: auto; }
}

/* ------------------------------------------------------------ panel */
.ntf-root { position: static; }
.ntf-scrim { position: fixed; inset: 0; z-index: 58; background: transparent; }
.ntf-panel { position: fixed; z-index: 60; inset-block-start: var(--ntf-top, 64px); display: flex; flex-direction: column; width: min(420px, calc(100vw - 16px)); max-height: min(640px, calc(100dvh - var(--ntf-top, 64px) - 16px));
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 70px rgba(30, 18, 8, .3), 0 2px 8px rgba(30, 18, 8, .08); overflow: hidden; animation: ntf-in .16s ease-out; }
.ntf-panel[hidden] { display: none; }
.ntf-panel:focus { outline: none; }
.ntf-panel, .ntf-panel a, .ntf-panel button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@keyframes ntf-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ntf-panel { animation: none; } }

.ntf-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.ntf-head h2 { flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 800; }
.ntf-readall:disabled { opacity: .45; }
.ntf-close { display: none; }

.ntf-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.ntf-tab { appearance: none; background: none; border: 0; border-block-end: 3px solid transparent; padding: 8px 10px 7px; margin-block-end: -1px; font-weight: 700; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; border-radius: 8px 8px 0 0; }
.ntf-tab:hover { color: var(--ink); background: var(--panel-2); }
.ntf-tab.on { color: var(--ink); border-block-end-color: var(--accent-solid); }
.ntf-tab-n { color: var(--danger-ink); font-variant-numeric: tabular-nums; }

.ntf-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; scrollbar-width: thin; }
.ntf-list { list-style: none; margin: 0; padding: 0; }
.ntf-empty { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; text-align: center; color: var(--muted); }
.ntf-empty b { color: var(--ink); font-weight: 700; }

.ntf-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
.ntf-item:last-child { border-bottom: 0; }
.ntf-item.unread { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.ntf-item.pending { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.ntf-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.ntf-item.pending .ntf-ico { background: var(--danger-soft); color: var(--danger-ink); }
.ntf-item.warn .ntf-ico { background: var(--warn-soft); color: var(--warn-ink); }
.ntf-main { min-width: 0; display: grid; gap: 3px; }
.ntf-line { display: flex; align-items: flex-start; gap: 8px; }
.ntf-title { flex: 1 1 auto; min-width: 0; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; color: var(--ink); }
a.ntf-title:hover { text-decoration: underline; }
.ntf-new { flex: 0 0 auto; width: 9px; height: 9px; margin-block-start: 6px; border-radius: 50%; background: var(--accent-solid); }
.ntf-meta { overflow-wrap: anywhere; }
.ntf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 6px; }
.ntf-reason { display: grid; gap: 6px; margin-block-start: 6px; }
.ntf-reason textarea { width: 100%; min-height: 56px; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); }
.ntf-reason textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ntf-reason-row { display: flex; justify-content: flex-end; gap: 6px; }

/* ------------------------------------------------------------ phones: a full-width sheet under the top bar, above the bottom bar */
@media (max-width: 600px) {
  html:has(.ntf-root.open) { overflow: hidden; overscroll-behavior: none; }   /* the page behind the sheet does not scroll; only the list inside does */
  .ntf-scrim { background: rgba(25, 15, 8, .35); touch-action: none; }
  body:has(.ntf-root.open) .toasts, body:has(.ntf-root.open) .toast { pointer-events: none; }   /* a toast above the bottom bar never swallows the next Approve / Refuse tap under it */
  .ntf-panel { inset-inline: 0; inset-block-start: var(--ntf-top, 62px); inset-block-end: var(--bn-h, 56px); width: auto; max-height: none; border-inline: 0; border-radius: 0 0 16px 16px; animation: none; }
  .ntf-close { display: inline-grid; }
  .ntf-head { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .ntf-item { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .ntf-actions .btn { min-height: 40px; padding-inline: 14px; }
  .ntf-tab { min-height: 44px; }
  .ntf-reason textarea { font-size: 16px; }                    /* no zoom-in on iOS when the field gets focus */
}
@media (max-width: 900px) and (max-height: 520px) { .ntf-panel { inset-block-end: 0; } }
/* a phone held sideways (wider than 600 px, so the popover): the page behind it still does not scroll, there is a close button, the toast cannot cover the buttons */
@media (max-width: 900px) and (max-height: 520px) and (pointer: coarse) {
  html:has(.ntf-root.open) { overflow: hidden; overscroll-behavior: none; }
  .ntf-scrim { touch-action: none; }
  .ntf-close { display: inline-grid; }
  body:has(.ntf-root.open) .toasts, body:has(.ntf-root.open) .toast { pointer-events: none; }
}
