/* Announcements — the pieces that must look the same in BOTH layouts: the loud
   popup (Books' app layout and the POS shell), the bottom sheets (recorder,
   people picker, confirm), the voice chip and the photo thumbs. Neither
   Tailwind nor pos_shell.css is guaranteed to be on the page, so this sheet
   carries its own tokens (the same Flowbite values as pos_shell.css) under an
   --an- prefix, light on :root and dark under .dark — the class both layouts
   set on <html> before paint. Loaded by shared/_loud_announcements. */
:root {
  --an-bg: #f9fafb; --an-surface: #ffffff; --an-alt: #f3f4f6; --an-text: #111827; --an-sub: #4b5563;
  --an-line: #e5e7eb; --an-acc: #1a56db; --an-accfill: #1a56db; --an-accsoft: #e1effe;
  --an-warn: #e02424; --an-warnfill: #e02424; --an-warnsoft: #fde8e8; --an-warnline: #f8b4b4;
  --an-ok: #046c4e; --an-oksoft: #def7ec;
  --an-font: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.dark {
  --an-bg: #000000; --an-surface: #171717; --an-alt: #262626; --an-text: #fafafa; --an-sub: #a3a3a3;
  --an-line: #262626; --an-acc: #76a9fa; --an-accfill: #1c64f2; --an-accsoft: #1a2c5e;
  --an-warn: #f98080; --an-warnfill: #e02424; --an-warnsoft: #4a1515; --an-warnline: #7f1d1d;
  --an-ok: #84e1bc; --an-oksoft: #0f2f24;
}

/* ---- dialogs: the loud popup (centred) and the sheets (bottom) ---------- */
.an-loud, .an-sheet {
  box-sizing: border-box; border: 0; padding: 0; color: var(--an-text); background: var(--an-surface);
  font-family: var(--an-font); font-size: 14px; line-height: 1.4; box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.an-loud *, .an-sheet * { box-sizing: border-box; }
/* The controllers toggle state with `hidden`; a class's display must not win. */
.an-loud [hidden], .an-sheet [hidden], .an-media [hidden] { display: none !important; }
.an-loud::backdrop, .an-sheet::backdrop { background: rgba(15, 23, 42, .6); }
.an-loud {
  position: fixed; inset: 0; margin: auto; width: min(400px, calc(100vw - 32px)); height: fit-content; max-height: 88dvh;
  overflow-y: auto; border-radius: 22px; border-top: 6px solid var(--an-warnfill); padding: 22px 20px 18px;
}
.an-sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(430px, 100vw); max-width: 100vw;
  max-height: 82dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 18px;
}
.an-sheet--center { inset: 0; margin: auto; border-radius: 22px; width: min(400px, calc(100vw - 32px)); height: fit-content; }
.an-sheet--loud { border-top: 6px solid var(--an-warnfill); }
.an-grip { width: 40px; height: 6px; border-radius: 99px; background: var(--an-line); margin: 0 auto 14px; }
.an-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.an-sheet__title { font-weight: 800; font-size: 17px; }

/* ---- shared bits ---------------------------------------------------------- */
.an-ico { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--an-accsoft); color: var(--an-acc); }
.an-ico--warn { background: var(--an-warnsoft); color: var(--an-warn); }
.an-cap { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--an-acc); }
.an-cap--warn { color: var(--an-warn); }
.an-muted { color: var(--an-sub); font-size: 12.5px; }
.an-note { color: var(--an-sub); font-size: 12px; line-height: 1.5; }
.an-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.an-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--an-alt); color: var(--an-sub); }
.an-chip--warn { background: var(--an-warnsoft); color: var(--an-warn); }
.an-chip--acc { background: var(--an-accsoft); color: var(--an-acc); }
.an-btn {
  border: 0; border-radius: 14px; font: 700 15px/1 var(--an-font); padding: 14px; width: 100%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  background: var(--an-alt); color: var(--an-text);
}
.an-btn:active { transform: scale(.98); }
.an-btn[disabled] { opacity: .45; pointer-events: none; }
.an-btn--primary { background: var(--an-accfill); color: #fff; }
.an-btn--danger { background: var(--an-warnfill); color: #fff; }
.an-btnrow { display: flex; gap: 10px; margin-top: 16px; }
.an-btnrow > :first-child { flex: 1; }
.an-btnrow > :last-child { flex: 1.4; }
.an-iconbtn {
  width: 38px; height: 38px; border-radius: 99px; border: 0; flex: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: var(--an-alt); color: var(--an-text);
}
.an-iconbtn--acc { background: var(--an-accfill); color: #fff; }
.an-iconbtn--on { background: var(--an-warnsoft); color: var(--an-warn); }
.an-alert { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--an-warnsoft); color: var(--an-warn); font-size: 13px; }

/* ---- the loud popup ------------------------------------------------------- */
.an-loud__head { display: flex; align-items: center; gap: 12px; }
.an-loud__title { margin-top: 16px; font-size: 20px; font-weight: 800; line-height: 1.2; }
.an-loud__body { margin-top: 8px; font-size: 14.5px; line-height: 1.55; }
.an-loud__reply { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.an-field {
  flex: 1; min-width: 0; border: 1px solid transparent; outline: none; border-radius: 99px; padding: 10px 14px;
  font: 500 14px var(--an-font); background: var(--an-alt); color: var(--an-text);
}
.an-field:focus { border-color: var(--an-acc); }

/* ---- media: voice chip, photo thumbs ------------------------------------- */
.an-media { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.an-audio { display: flex; align-items: center; gap: 10px; background: var(--an-alt); border-radius: 12px; padding: 8px 10px; min-width: 190px; flex: 1; }
.an-audio__play { width: 30px; height: 30px; border-radius: 99px; border: 0; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; background: var(--an-accfill); color: #fff; }
.an-audio--warn .an-audio__play { background: var(--an-warnfill); }
.an-audio__time { font-size: 12px; font-weight: 700; color: var(--an-sub); }
.an-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 22px; overflow: hidden; }
.an-wave i { display: block; width: 3px; border-radius: 2px; background: var(--an-sub); opacity: .55; }
.an-wave i:nth-child(4n+1) { height: 8px; } .an-wave i:nth-child(4n+2) { height: 16px; }
.an-wave i:nth-child(4n+3) { height: 12px; } .an-wave i:nth-child(4n) { height: 20px; }
.an-wave--on i { background: var(--an-acc); opacity: .9; animation: an-wv 1s ease-in-out infinite alternate; }
.an-wave--live i { background: var(--an-warn); }
.an-wave i:nth-child(odd) { animation-delay: .25s; }
@keyframes an-wv { from { transform: scaleY(.4); } to { transform: scaleY(1); } }
.an-thumb { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; flex: none; background: var(--an-alt); display: block; }
.an-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.an-thumb--wide { width: 100%; height: 160px; }
.an-thumb__kb { position: absolute; left: 4px; bottom: 4px; background: rgba(17, 24, 39, .75); color: #fff; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 6px; }
.an-thumb--file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 6px 20px; color: inherit; text-decoration: none; }
.an-thumb__name { max-width: 100%; font-size: 10.5px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-thumb__x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 99px; background: rgba(17, 24, 39, .8); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
/* Photos and documents in a thread are buttons that open the preview below. */
button.an-thumb { border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: center; }
button.an-thumb--file { padding: 8px 6px 20px; }

/* ---- the attachment preview (announcements/_viewer) ---------------------- */
.an-viewer { width: min(56rem, calc(100vw - 32px)); max-height: 90dvh; padding: 0; }
.an-viewer__head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--an-line); }
.an-viewer__title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-viewer__stage { display: grid; place-items: center; min-height: 16rem; padding: 12px; background: var(--an-alt); }
.an-viewer__stage img { display: block; max-width: 100%; max-height: 72dvh; object-fit: contain; border-radius: 8px; }
.an-viewer__stage iframe { display: block; width: 100%; height: 72dvh; border: 0; border-radius: 8px; background: #fff; }
.an-viewer__stage p { margin: 0; text-align: center; }

/* ---- the recorder sheet --------------------------------------------------- */
.an-rec__stage { height: 60px; margin: 20px 0; display: flex; align-items: center; justify-content: center; }
.an-rec__stage .an-wave { flex: none; width: 200px; height: 40px; }
.an-rec__controls { display: flex; align-items: flex-start; justify-content: center; gap: 24px; }
.an-rec__control { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--an-sub); }
.an-rec__control .an-iconbtn { width: 52px; height: 52px; }
.an-rec__stop .an-iconbtn { width: 72px; height: 72px; background: var(--an-warnfill); color: #fff; }
.an-rec__stop { color: var(--an-warn); }
.an-rec__dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--an-warn); }
.an-rec audio { width: 100%; margin-top: 14px; }
