/* ---------- EGW notice (a kit proposal for its next version; thread "Old notification card", 2026-10-16) ----------
   The one notification of the whole site, at the foot of the screen, centred (R53). It replaces the old theme's top-right card
   (egwToast), the kit's one-line note and Setup's toast. Markup (the chrome's foot; egw-notice.js builds it inside an old
   one-line note): div.note#note > p.nt-say[role=status] + p.nt-say[role=alert] + ol.nt-list. Each notice: li.nt[data-kind]
   > .nt-chip, .nt-words (b.nt-title with .nt-count, span.nt-text), .nt-acts (.nt-act), button.nt-x (svg.nt-ring).
   Kinds: done, problem, info, warn, working, live. Tokens only: the kit's inverse pair (--inv-bg, --inv-fg, --inv-fg-2) and the
   two status colours drawn on it (--inv-ok, --inv-live: the other theme's ok and live values, 5.8:1 or more on the pair). */
:root { --inv-ok: #81C995; --inv-live: #F28B82; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --inv-ok: #157038; --inv-live: #B42318; } }
:root[data-theme="dark"] { --inv-ok: #157038; --inv-live: #B42318; }

/* the stack: fixed to the foot, centred, above every dialog and panel (under the caption viewer, 3000); --nt-up (set by the
   script) lifts it over a part that holds the foot under it (cookie banner, Ask EGW button, a save bar) or the on-screen keyboard */
.note { --nt-base: var(--s-5); position: fixed; z-index: 2900; left: 0; right: 0; bottom: calc(var(--nt-base) + env(safe-area-inset-bottom, 0px) + var(--nt-up, 0px));
  padding-left: max(var(--s-4), env(safe-area-inset-left, 0px)); padding-right: max(var(--s-4), env(safe-area-inset-right, 0px)); pointer-events: none; transition: bottom .32s var(--ease-out); }
@media (max-width: 640px) { .note { --nt-base: var(--s-4); } }
.nt-probe { position: fixed; left: 0; bottom: 0; width: 1px; height: calc(var(--nt-base, 24px) + env(safe-area-inset-bottom, 0px)); visibility: hidden; pointer-events: none; }
.nt-say { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nt-list { position: relative; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.nt-list:empty { display: none; }

/* one notice: chip | words | (action) | close; as wide as its words; a pill on one line (radius --r-xl clamps to half its height) */
.nt { position: relative; box-sizing: border-box; display: grid; grid-template-columns: 28px minmax(0, 1fr) 32px; grid-template-areas: "chip words x"; align-items: center; column-gap: 10px;
  width: max-content; max-width: min(480px, 100%); min-height: 44px; margin: 0; padding: 6px 6px 6px 8px; border-radius: var(--r-xl); background: var(--inv-bg); color: var(--inv-fg);
  box-shadow: var(--shadow-float); font: 500 var(--t-sm)/20px var(--font); letter-spacing: 0; text-align: start; pointer-events: auto; touch-action: none; }
.nt.has-act { grid-template-columns: 28px minmax(0, 1fr) auto 32px; grid-template-areas: "chip words acts x"; }
.nt.is-drag { -webkit-user-select: none; user-select: none; }
.nt.is-left { position: absolute; top: auto; z-index: 0; pointer-events: none; }
/* 3.43.0: while a header pop (appearance, language, account) or the phone menu is open, the notices stay in view over it but a tap
   on a card passes through to the item under it; only the notice's own buttons (action, close) still take taps. Swipe and hover
   pause work again once it closes. */
:root:has(.egw-chrome .tool-pop.open, .egw-chrome .sheet.open) .nt { pointer-events: none; }
:root:has(.egw-chrome .tool-pop.open, .egw-chrome .sheet.open) .nt:not(.is-left) :is(.nt-act, .nt-x) { pointer-events: auto; }
.nt-chip { grid-area: chip; position: relative; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--inv-fg);
  background: rgba(128, 128, 128, .2); background: color-mix(in srgb, var(--inv-fg) 13%, transparent); }
.nt-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; display: block; }
.nt[data-kind="warn"] .nt-chip svg { stroke-width: 1.9; }
.nt[data-kind="done"] .nt-chip { color: var(--inv-ok); background: color-mix(in srgb, var(--inv-ok) 20%, transparent); }
.nt[data-kind="problem"] .nt-chip, .nt[data-kind="live"] .nt-chip { color: var(--inv-live); background: color-mix(in srgb, var(--inv-live) 20%, transparent); }
.nt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--inv-live); }
.nt-words { grid-area: words; min-width: 0; padding-block: 6px; overflow-wrap: break-word; } /* addresses break at their <wbr>s first */
.nt-title { display: block; font-weight: 600; }
.nt.is-one .nt-title { font-weight: 500; }
.nt-text { display: block; font-weight: 400; color: var(--inv-fg-2); }
.nt-text[hidden] { display: none; }
.nt-count { display: inline-block; margin-inline-start: 8px; padding: 0 7px; border-radius: var(--r-pill); vertical-align: 1px; font: 700 var(--t-xs)/18px var(--font); font-variant-numeric: tabular-nums;
  color: var(--inv-fg); background: color-mix(in srgb, var(--inv-fg) 15%, transparent); }
.nt-count[hidden] { display: none; }
.nt-acts { grid-area: acts; display: flex; flex-wrap: wrap; gap: 6px; }
.nt-act { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid color-mix(in srgb, var(--inv-fg) 36%, transparent); border-radius: var(--r-pill);
  background: none; color: var(--inv-fg); font: 600 var(--t-sm)/20px var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .12s ease, color .12s ease, border-color .12s ease; }
.nt-act:hover { background: var(--inv-fg); border-color: var(--inv-fg); color: var(--inv-bg); }
.nt-act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nt-x { grid-area: x; position: relative; width: 32px; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--inv-fg-2); cursor: pointer;
  transition: background-color .12s ease, color .12s ease; }
.nt-x::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; } /* a 44px touch area (R18) */
.nt-x:hover { color: var(--inv-fg); background: color-mix(in srgb, var(--inv-fg) 14%, transparent); }
.nt-xi { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nt-ring { position: absolute; inset: 0; width: 32px; height: 32px; rotate: -90deg; pointer-events: none; overflow: visible; }
.nt-ring circle { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
.nt:not(.is-timed) .nt-ring { display: none; }
.nt-x:focus-visible, .nt-act:focus-visible { outline: 2px solid var(--inv-fg); outline-offset: 2px; }
/* phones: an action goes under the words, so the words keep the width */
@media (max-width: 560px) {
  .nt.has-act { grid-template-columns: 28px minmax(0, 1fr) 32px; grid-template-areas: "chip words x" ". acts x"; row-gap: 2px; padding-bottom: 10px; }
  .nt.has-act .nt-chip { align-self: start; margin-top: 2px; }
}
.nt:lang(zh) { line-height: 22px; }

/* motion: the tick draws itself, the working arc turns, the live dot breathes; the rise, glide and swipe are in egw-notice.js */
@keyframes nt-draw { from { stroke-dashoffset: 1; } }
@keyframes nt-turn { to { rotate: 360deg; } }
@keyframes nt-breathe { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--inv-live) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--inv-live) 0%, transparent); } }
.nt-tick { stroke-dasharray: 1; stroke-dashoffset: 0; }
html.js-armed .nt[data-kind="done"] .nt-tick { animation: nt-draw .5s var(--ease-out) .14s backwards; }
.nt[data-kind="working"] .nt-chip svg { animation: nt-turn .9s linear infinite; }
.nt[data-kind="live"] .nt-dot { animation: nt-breathe 1.8s var(--ease-out) infinite; }

/* back to top (and any part marked data-nt-away) steps aside while a notice covers it, as in Setup; it comes back when the notice goes */
.btt.show.nt-away, [data-nt-away].nt-away { opacity: 0; visibility: hidden; translate: 0 16px; pointer-events: none; transition: opacity .2s var(--ease-out), translate .2s var(--ease-out), visibility 0s linear .2s; }

@media (prefers-reduced-motion: reduce) {
  .note, .nt-act, .nt-x { transition: none; }
  html.js-armed .nt[data-kind="done"] .nt-tick, .nt[data-kind="working"] .nt-chip svg, .nt[data-kind="live"] .nt-dot { animation: none; }
  .nt-ring { display: none; }
}
@media (forced-colors: active) { .nt { border: 1px solid CanvasText; } }
