/* Class groups — WhatsApp-style chat. Colours come from --wa-* tokens so light / dim / dark and the user's accent
   apply; the university logo sits blurred behind every chat. Desktop: list + chat side by side. Phone: the list
   fills the screen, an open chat goes full-screen with the composer fixed at the bottom (safe-area aware). */

:root {
  --wa-bg: #EFEAE2; --wa-panel: #F0F2F5; --wa-in: #FFFFFF; --wa-out: #D9FDD3; --wa-text: #111B21; --wa-meta: #667781;
  --wa-sub: #54656F; --wa-sys: #E1F2FB; --wa-day: #FFFFFF; --wa-enc: #FFEECD; --wa-accent: #00A884; --wa-accent-hover: #008F6F;
  --wa-green: #25D366; --wa-link: #027EB5; --wa-tick: #53BDEB; --wa-hover: #F5F6F6; --wa-active: #E9EDEF; --wa-dots: rgba(0, 0, 0, .035);
  --wa-shadow: 0 1px .5px rgba(11, 20, 26, .13); --wa-logo-opacity: .11; --wa-unread: #FFFFFFE6;
}
:root[data-tone="dark"] {
  --wa-bg: #0B141A; --wa-panel: #202C33; --wa-in: #202C33; --wa-out: #005C4B; --wa-text: #E9EDEF; --wa-meta: #8FA0AB;
  --wa-sub: #AEBAC1; --wa-sys: #182229; --wa-day: #182229; --wa-enc: #182229; --wa-hover: #2A3942; --wa-active: #2A3942;
  --wa-link: #53BDEB; --wa-dots: rgba(255, 255, 255, .03); --wa-shadow: 0 1px .5px rgba(0, 0, 0, .35); --wa-logo-opacity: .07; --wa-unread: #182229E6;
}
:root[data-tone="dark"][data-mode="dim"] { --wa-bg: #19232B; --wa-panel: #26333B; --wa-in: #2A3740; --wa-out: #0B5F51; --wa-day: #22303A; --wa-sys: #22303A; --wa-enc: #22303A; }
/* "My bubbles: accent colour" */
:root[data-bubbles="accent"] { --wa-out: color-mix(in srgb, var(--primary) 16%, #FFFFFF); --wa-accent: var(--primary); --wa-accent-hover: var(--primary-hover); }
:root[data-bubbles="accent"][data-tone="dark"] { --wa-out: color-mix(in srgb, var(--primary) 46%, #0B141A); }

.nav .count.green { background: var(--wa-green); color: #fff; }

/* ---------------------------------------------------------------- frame */
.wa { display: grid; grid-template-columns: 370px minmax(0, 1fr); height: calc((100dvh - 64px - 56px) / var(--zoom, 1)); min-height: 520px;
  border: 1px solid var(--gray-200); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-card); }
@media (max-width: 1200px) { .wa { grid-template-columns: 320px minmax(0, 1fr); } }

/* ---------------------------------------------------------------- list */
.wa-list { display: flex; flex-direction: column; border-right: 1px solid var(--gray-200); min-width: 0; background: var(--surface); }
.wa-list-h { display: flex; align-items: center; gap: 8px; padding: 16px 16px 10px; }
.wa-list-h b { font-size: 21px; letter-spacing: -.01em; }
.wa-live { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); margin-right: auto; }
.wa-live.on { background: var(--wa-green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa-green) 22%, transparent); }
.wa-icon { width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--wa-sub); cursor: pointer; flex: none; }
.wa-icon:hover { background: var(--wa-hover); color: var(--ink); }
.wa-icon.on { color: var(--wa-accent); }
.wa-icon.wa-muted { color: var(--error-600, #D92D20); }
.wa-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 0 12px; height: 38px; border-radius: 10px; background: var(--wa-panel); color: var(--wa-meta); }
.wa-search input { border: 0; background: none; outline: none; font: inherit; font-size: 14px; flex: 1; color: var(--ink); min-width: 0; }
.wa-filters { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.wa-filters::-webkit-scrollbar { display: none; }
.wa-filters button { border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; background: var(--wa-panel); color: var(--wa-sub); cursor: pointer; white-space: nowrap; }
.wa-filters button.on { background: color-mix(in srgb, var(--wa-accent) 16%, var(--surface)); color: color-mix(in srgb, var(--wa-accent) 75%, var(--ink)); }
.wa-filters button .n { margin-left: 4px; font-size: 11px; }
.wa-items { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.wa-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 0 0 14px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; min-height: 72px; }
.wa-item:hover { background: var(--wa-hover); }
.wa-item.on { background: var(--wa-active); }
.wa-item-m { flex: 1; min-width: 0; border-bottom: 1px solid var(--gray-100); align-self: stretch; padding: 12px 14px 12px 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.wa-name { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.wa-time { font-size: 12px; color: var(--wa-meta); flex: none; margin-left: 8px; }
.wa-time.new { color: var(--wa-green); font-weight: 600; }
.wa-last { font-size: 13.5px; color: var(--wa-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wa-last b { font-weight: 600; color: var(--wa-sub); }
.wa-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--wa-green); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; margin-left: 8px; }
.wa-tagline { font-size: 11px; color: var(--wa-meta); border: 1px solid var(--gray-200); border-radius: 999px; padding: 0 7px; flex: none; margin-left: 8px; }
.wa-av { width: 48px; height: 48px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.wa-av.sm { width: 34px; height: 34px; font-size: 12px; } .wa-av.xs { width: 28px; height: 28px; font-size: 11px; } .wa-av.lg { width: 84px; height: 84px; font-size: 26px; }
.wa-empty-list { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 24px; text-align: center; color: var(--wa-meta); }
.wa-empty-list > svg { width: 40px; height: 40px; color: var(--gray-300); }

/* ---------------------------------------------------------------- chat pane + logo wallpaper */
.wa-chat { min-width: 0; display: flex; flex-direction: column; background: var(--wa-bg); position: relative; overflow: hidden; isolation: isolate; }
.wa-chat::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("/assets/img/logo.png") center 55% / min(52%, 380px) no-repeat; opacity: var(--wa-logo-opacity); filter: blur(3px) saturate(.7); }
:root[data-wall="plain"] .wa-chat::before, :root[data-wall="dots"] .wa-chat::before { display: none; }
.wa-chat-in, .wa-placeholder { position: relative; z-index: 1; }
.wa-chat-in { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wa-placeholder { margin: auto; text-align: center; max-width: 440px; padding: 24px; color: var(--wa-sub); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wa-ph-ic { width: 96px; height: 96px; border-radius: 50%; background: var(--wa-in); display: grid; place-items: center; color: var(--wa-green); box-shadow: var(--wa-shadow); }
.wa-ph-ic svg { width: 46px; height: 46px; }
.wa-placeholder h2 { font-size: 22px; font-weight: 600; color: var(--ink); }

.wa-chat-h { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: var(--wa-panel); border-bottom: 1px solid var(--gray-200); min-height: 60px; }
.wa-back { display: none; }
.wa-chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 0; }
.wa-chat-title b { font-size: 16px; color: var(--ink); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-title span { font-size: 12.5px; color: var(--wa-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wa-typing-t { color: var(--wa-accent) !important; font-style: italic; }

.wa-msgs { flex: 1; overflow-y: auto; padding: 14px 7% 16px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain;
  background-image: radial-gradient(var(--wa-dots) 1px, transparent 1px); background-size: 18px 18px; }
:root[data-wall="plain"] .wa-msgs { background-image: none; }
.wa-loading { margin: auto; }
.wa-older { align-self: center; padding: 6px; }
.wa-enc { align-self: center; max-width: 520px; text-align: center; font-size: 12px; color: var(--wa-sub); background: var(--wa-enc); padding: 6px 12px; border-radius: 8px; margin: 4px 0 10px; box-shadow: var(--wa-shadow); }
.wa-day { align-self: center; margin: 10px 0 6px; }
.wa-day span { font-size: 12px; color: var(--wa-sub); background: var(--wa-day); padding: 5px 12px; border-radius: 8px; box-shadow: var(--wa-shadow); }
.wa-sys { align-self: center; margin: 6px 0; } .wa-sys span { font-size: 12.5px; color: var(--wa-sub); background: var(--wa-sys); padding: 5px 12px; border-radius: 8px; display: inline-block; max-width: 560px; text-align: center; box-shadow: var(--wa-shadow); }
.wa-unread { align-self: stretch; text-align: center; margin: 10px -7%; padding: 5px 0; background: var(--wa-unread); color: var(--wa-sub); font-size: 12.5px; font-weight: 600; }

/* ---------------------------------------------------------------- bubbles */
.wa-row { display: flex; align-items: flex-end; gap: 6px; } .wa-row.me { justify-content: flex-end; }
.wa-row.first { margin-top: 8px; }
.wa-row .wa-av.xs { visibility: hidden; align-self: flex-start; }
.wa-row.first .wa-av.xs { visibility: visible; }
.wa-b { position: relative; max-width: min(65%, 560px); background: var(--wa-in); border-radius: 8px; padding: 6px 8px 8px 9px; box-shadow: var(--wa-shadow); min-width: 96px; color: var(--wa-text); }
.wa-row.me .wa-b { background: var(--wa-out); }
.wa-row.first .wa-b { border-top-left-radius: 0; }
.wa-row.me.first .wa-b { border-top-left-radius: 8px; border-top-right-radius: 0; }
.wa-row.first .wa-b::before { content: ""; position: absolute; top: 0; left: -8px; width: 8px; height: 13px; background: var(--wa-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.wa-row.me.first .wa-b::before { left: auto; right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa-sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.wa-text { font-size: 14.2px; line-height: 19px; white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 66px; }
.wa-text.big { font-size: 34px; line-height: 40px; padding-right: 0; padding-bottom: 14px; }
.wa-text a { color: var(--wa-link); }
.wa-meta { position: absolute; right: 8px; bottom: 4px; font-size: 11px; color: var(--wa-meta); display: inline-flex; align-items: center; gap: 3px; }
.wa-ticks { font-size: 12px; letter-spacing: -3px; color: var(--wa-meta); margin-left: 2px; } .wa-ticks.all { color: var(--wa-tick); }
.wa-removed { font-size: 13.5px; font-style: italic; color: var(--wa-meta); padding-right: 60px; display: block; }
.wa-fwd { font-size: 12px; color: var(--wa-meta); font-style: italic; display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.wa-quote { display: flex; flex-direction: column; gap: 1px; border-left: 4px solid var(--primary); background: color-mix(in srgb, var(--wa-text) 6%, transparent); border-radius: 6px; padding: 5px 8px; text-align: left; font: inherit; width: 100%; border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; color: inherit; }
.wa-quote.in { margin-bottom: 4px; }
.wa-quote b { font-size: 12.5px; color: var(--primary-700); } .wa-quote span { font-size: 13px; color: var(--wa-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-img { display: block; max-width: 100%; width: 300px; max-height: 340px; object-fit: cover; border-radius: 6px; margin-bottom: 18px; cursor: zoom-in; background: color-mix(in srgb, var(--wa-text) 8%, transparent); min-height: 140px; }
.wa-doc { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--wa-text) 6%, transparent); border-radius: 8px; padding: 10px; border: 0; width: 100%; min-width: 230px; text-align: left; font: inherit; cursor: pointer; color: inherit; margin-bottom: 16px; }
.wa-doc b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-doc.small { margin: 0; min-width: 0; flex: 1; }
.wa-ext { width: 38px; height: 44px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; flex: none; letter-spacing: .02em; }
.wa-menu-btn { position: absolute; top: 2px; right: 2px; width: 26px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--wa-meta); opacity: 0; cursor: pointer; display: grid; place-items: center; }
.wa-b:hover .wa-menu-btn, .wa-menu-btn:focus-visible { opacity: 1; background: color-mix(in srgb, var(--wa-in) 85%, transparent); }
.wa-row.me .wa-b:hover .wa-menu-btn { background: color-mix(in srgb, var(--wa-out) 85%, transparent); }
.wa-row.flash .wa-b { animation: wa-flash 1.2s ease; }
@keyframes wa-flash { 0%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); } 100% { box-shadow: var(--wa-shadow); } }

/* message menu (desktop pop-over) and action sheet (touch) */
.wa-pop { position: absolute; top: 24px; right: 4px; z-index: 30; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px 0; min-width: 200px; display: flex; flex-direction: column; border: 1px solid var(--gray-200); }
.wa-row:not(.me) .wa-pop { right: auto; left: 4px; }
.wa-pop button, .wa-sheet button { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border: 0; background: none; font: inherit; font-size: 14.5px; cursor: pointer; color: var(--ink); text-align: left; }
.wa-pop button:hover, .wa-sheet button:hover { background: var(--wa-hover); }
.wa-pop button.danger, .wa-sheet button.danger { color: var(--error-700); }
.wa-sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 90; display: flex; align-items: flex-end; }
.wa-sheet { width: 100%; background: var(--surface); border-radius: 16px 16px 0 0; padding: 8px 0 calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; animation: wa-up .18s ease-out; }
.wa-sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--gray-300); margin: 4px auto 8px; }
.wa-sheet .pv { padding: 4px 16px 10px; font-size: 13px; color: var(--wa-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--gray-100); margin-bottom: 4px; }
.wa-sheet button { padding: 13px 20px; font-size: 15.5px; }
@keyframes wa-up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- composer */
.wa-replybar, .wa-filebar { display: flex; align-items: center; gap: 8px; padding: 8px 14px 0; background: var(--wa-panel); }
.wa-replybar.hidden, .wa-filebar.hidden { display: none; }
.wa-composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px; background: var(--wa-panel); position: relative; }
.wa-composer.hidden, .wa-noPost.hidden { display: none; }
.wa-field { flex: 1; display: flex; align-items: flex-end; background: var(--wa-in); border-radius: 22px; padding: 0 4px; min-width: 0; }
.wa-input { flex: 1; resize: none; border: 0; padding: 11px 6px; font: inherit; font-size: 15px; line-height: 20px; max-height: 140px; background: transparent; outline: none; color: var(--wa-text); min-width: 0; }
.wa-input::placeholder { color: var(--wa-meta); }
.wa-send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--wa-accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .1s; }
.wa-send:hover { background: var(--wa-accent-hover); } .wa-send:active { transform: scale(.94); } .wa-send:disabled { opacity: .6; }
.wa-noPost { padding: 16px; text-align: center; font-size: 14px; color: var(--wa-sub); background: var(--wa-panel); }
.wa-panel-pop { position: absolute; left: 10px; bottom: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--gray-200); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 10px; }
.wa-emojis { display: grid; grid-template-columns: repeat(8, 38px); gap: 2px; max-height: 240px; overflow-y: auto; }
.wa-emojis button { width: 38px; height: 38px; border: 0; background: none; border-radius: 8px; font-size: 22px; cursor: pointer; line-height: 1; }
.wa-emojis button:hover { background: var(--wa-hover); }
.wa-attach { display: flex; flex-direction: column; min-width: 210px; }
.wa-attach button { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 10px 10px; border-radius: 8px; font: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer; text-align: left; }
.wa-attach button:hover { background: var(--wa-hover); }
.wa-attach .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }

.wa-jump { position: absolute; right: 18px; bottom: 80px; z-index: 3; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--wa-in); color: var(--wa-sub);
  box-shadow: 0 2px 8px rgba(11, 20, 26, .2); display: grid; place-items: center; cursor: pointer; }
.wa-jump.hidden { display: none; }
.wa-jump-n { position: absolute; top: -6px; right: -4px; background: var(--wa-green); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; line-height: 18px; }
.wa-jump-n:empty { display: none; }

/* ---------------------------------------------------------------- photo viewer */
.wa-viewer { position: fixed; inset: 0; z-index: 150; background: rgba(8, 12, 16, .92); display: flex; flex-direction: column; color: #fff; }
.wa-viewer header { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.wa-viewer header .t { flex: 1; min-width: 0; } .wa-viewer header .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-viewer header .t span { font-size: 12px; opacity: .7; }
.wa-viewer header button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.wa-viewer .img { flex: 1; display: grid; place-items: center; min-height: 0; padding: 12px; }
.wa-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.wa-viewer .cap { text-align: center; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px)); font-size: 14px; opacity: .9; }

/* ---------------------------------------------------------------- group info */
.wa-info-top { display: flex; gap: 18px; align-items: flex-start; }
.wa-people { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.wa-person { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.wa-person:hover { background: var(--gray-50); }
.wa-pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid var(--gray-100); }
.wa-pick:hover { background: var(--gray-50); }
.wa-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.wa-media button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--gray-100); }
.wa-media img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 860px) {
  .wa { grid-template-columns: 1fr; height: calc((100dvh - 64px - var(--bottom-nav, 0px)) / var(--zoom, 1)); border-radius: 0; margin: -16px; border: 0; min-height: 0; }
  .wa-chat { display: none; }
  .wa.open .wa-list { display: none; }
  /* an open chat takes the whole screen, like the WhatsApp app */
  .wa.open .wa-chat { display: flex; position: fixed; left: 0; right: 0; z-index: 80;
    /* the visible part of the screen: shrinks when the keyboard opens, so the typing box stays above it */
    top: calc(var(--vvt, 0px) / var(--zoom, 1)); height: calc(var(--vvh, 100dvh) / var(--zoom, 1)); }
  .wa.open .wa-chat-h { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
  .wa.open .wa-composer { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .wa-back { display: grid; }
  .wa-msgs { padding: 10px 10px 14px; }
  .wa-unread { margin: 10px -10px; }
  .wa-b { max-width: 84%; }
  .wa-row .wa-av.xs { display: none; }
  .wa-menu-btn { display: none; }
  .wa-jump { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); right: 12px; }
  .wa-emojis { grid-template-columns: repeat(7, 40px); }
  .wa-item { min-height: 76px; }
}

/* an open chat on a phone uses the whole screen: no bottom bar behind it */
@media (max-width: 860px) { body:has(.wa.open) .bnav { display: none; } }
/* the filter row wraps (nothing hidden off the edge); departments are a drop-down */
.wa-filters { flex-wrap: wrap; overflow: visible; }
.wa-dept { flex: 1 1 100%; border: 1px solid var(--gray-200); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px; background: var(--surface); color: var(--ink); }
