/* Zahrava — deep blue + sea teal on cool pearl */
:root {
  --bg: #F5F7F8; --card: #ffffff; --ink: #1B2433; --ink2: #2E3A4D; --muted: #5B6576; --line: #DDE2E7; --hover: #EEF2F6;
  --brand: #14467E; --brand-ink: #ffffff; --brand-soft: #E4ECF6; --brand-2: #2A72C5;
  --accent: #2E8C83; --accent-soft: #DDEFEC; --danger: #B3372E; --ok: #2E8C83;
  --shadow: 0 0 0 1px rgba(27,36,51,.06), 0 2px 4px rgba(27,36,51,.05);
  --shadow-lg: 0 8px 28px rgba(27,36,51,.16), 0 0 0 1px rgba(27,36,51,.05);
  --radius: 12px; --top: 60px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "IBM Plex Sans Arabic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #10151E; --card: #171E2A; --ink: #E8ECF2; --ink2: #C9D1DD; --muted: #A3ADBD; --line: #2A3342; --hover: #1E2735;
    --brand: #7DB2F0; --brand-ink: #0B1A2E; --brand-soft: #16243A; --brand-2: #8FC0F5; --accent: #4FB8AC; --accent-soft: #14302D;
    --danger: #FF8A80; --ok: #4FB8AC; --shadow: 0 0 0 1px rgba(255,255,255,.06); --shadow-lg: 0 8px 28px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
    color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top); background: var(--card); box-shadow: var(--shadow); }
.topbar-in { max-width: 1128px; height: 100%; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; color: var(--brand); }
.logo-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 15px; }
.logo small { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
.search { flex: 0 1 280px; display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: 6px; padding: 0 10px; height: 36px; color: var(--muted); }
.search input { border: 0 !important; box-shadow: none !important; background: transparent; outline: none; width: 100%; color: var(--ink); padding: 0; }
.topnav { margin-inline-start: auto; display: flex; height: 100%; }
.topnav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 76px; padding: 0 6px; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--ink); }
.topnav a.on { color: var(--ink); border-bottom-color: var(--ink); }
.dotcount { position: absolute; top: 5px; inset-inline-start: calc(50% + 4px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.tabbar { display: none; }

/* ---------- layout ---------- */
.layout { max-width: 1128px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 24px;
  grid-template-columns: 225px minmax(0, 1fr) 300px; align-items: start; }
.layout.wide { grid-template-columns: 225px minmax(0, 1fr); }
.layout.single { grid-template-columns: minmax(0, 760px); justify-content: center; }
.side { position: sticky; top: calc(var(--top) + 24px); display: grid; gap: 8px; }
.main { display: grid; gap: 8px; min-width: 0; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pad { padding: 12px 16px; } .pad-lg { padding: 20px 24px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .b { font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; } .hr { height: 1px; background: var(--line); margin: 8px 0; }
.stack { display: grid; gap: 12px; }

/* profile mini card */
.cover { height: 56px; background: linear-gradient(120deg, hsl(var(--h,212) 62% 26%), hsl(calc(var(--h,212) - 22) 52% 38%)); }
.cover.lg { height: 160px; }
.mini { text-align: center; padding: 0 12px 14px; }
.mini .avatar { margin: -36px auto 8px; border: 2px solid var(--card); }
.mini h4 { margin: 0; font-size: 16px; }
.statline { display: flex; justify-content: space-between; padding: 8px 16px; font-size: 13px; color: var(--muted); }
.statline b { color: var(--brand); }
.navlist a { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 14px; color: var(--ink2); font-weight: 600; }
.navlist a:hover { background: var(--hover); }
.navlist .avatar { width: 28px; height: 28px; font-size: 12px; border-radius: 6px; }
.sect-title { padding: 12px 16px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* avatars */
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 18px;
  color: #fff; background: hsl(var(--h, 205) 52% 36%); user-select: none; }
.avatar.xs { width: 32px; height: 32px; font-size: 13px; } .avatar.s { width: 40px; height: 40px; font-size: 15px; }
.avatar.m { width: 72px; height: 72px; font-size: 28px; } .avatar.xl { width: 152px; height: 152px; font-size: 56px; border: 4px solid var(--card); }
.avatar.sq { border-radius: 10px; }

/* badges & chips */
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 6px; vertical-align: 1px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.grey { background: var(--hover); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 5px 12px; font-size: 14px; font-weight: 600; color: var(--ink2); cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
label.chip { display: inline-flex; align-items: center; gap: 6px; }
label.chip input { display: none; }
label.chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* buttons */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 18px; padding: 7px 16px;
  font-weight: 600; font-size: 15px; cursor: pointer; background: var(--brand); color: var(--brand-ink); }
.btn:hover { background: var(--brand-2); }
.btn.outline { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.btn.outline:hover { background: var(--brand-soft); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { padding: 4px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.iconbtn:hover { background: var(--hover); color: var(--ink); }

/* forms */
form.f { display: grid; gap: 12px; }
.f label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.f label.row { display: flex; align-items: center; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=tel], input[type=date], input:not([type]), textarea, select {
  width: 100%; background: var(--card); border: 1px solid #8c8c8c88; border-radius: 6px; padding: 9px 11px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* composer */
.composer { padding: 12px 16px 6px; }
.composer .start { flex: 1; text-align: start; border: 1px solid #8c8c8c88; border-radius: 28px; padding: 12px 16px; background: var(--card);
  color: var(--muted); font-weight: 600; cursor: pointer; }
.composer .start:hover { background: var(--hover); }
.composer .quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; padding-top: 6px; }
@media (max-width: 600px) { .composer .quick button { padding: 8px 6px; gap: 5px; font-size: 13px; } }
.composer .quick button { border: 0; background: none; display: flex; align-items: center; gap: 8px; padding: 10px 8px; border-radius: 6px;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.composer .quick button:hover { background: var(--hover); }
.composer textarea.big { border: 0; box-shadow: none; padding: 4px 0; font-size: 17px; min-height: 120px; }

/* posts */
.post-head { display: flex; gap: 8px; padding: 12px 16px 0; }
.post-head .who { flex: 1; min-width: 0; line-height: 1.3; }
.post-head .name { font-weight: 600; font-size: 14px; }
.post-head .name:hover { color: var(--brand); text-decoration: underline; }
.post-body { padding: 8px 16px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.more { border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 0 16px 6px; }
.more:hover { color: var(--brand); text-decoration: underline; }
.post.edu { box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }
.edu-tag { margin: 8px 16px 0; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 3px 8px; }
.counts { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; font-size: 13px; color: var(--muted); }
.counts button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.counts button:hover { color: var(--brand); text-decoration: underline; }
.emo { display: inline-flex; }
.emo span { width: 18px; height: 18px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 12px;
  margin-inline-end: -4px; box-shadow: 0 0 0 1.5px var(--card); }
.actions { display: flex; margin: 0 12px; border-top: 1px solid var(--line); padding: 4px 0; }
.act { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; padding: 10px 4px; border-radius: 6px;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.act:hover { background: var(--hover); color: var(--ink); }
.act.on { color: var(--brand); }
.react-wrap { position: relative; flex: 1; display: flex; }
.react-wrap .act { flex: 1; }
.picker { position: absolute; bottom: calc(100% - 4px); inset-inline-start: 0; display: none; gap: 2px; padding: 6px 8px; background: var(--card); border-radius: 28px;
  box-shadow: var(--shadow-lg); z-index: 20; }
.react-wrap:hover .picker, .picker.open { display: flex; }
.picker button { border: 0; background: none; font-size: 28px; line-height: 1; padding: 4px; border-radius: 50%; cursor: pointer; transition: transform .12s; }
.picker button:hover { transform: scale(1.3) translateY(-4px); }
.picker button[title]::after { content: none; }

.comments { padding: 4px 16px 12px; display: grid; gap: 8px; }
.cbox { display: flex; gap: 8px; align-items: flex-start; }
.cbox input { border-radius: 20px; padding: 9px 14px; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.bubble { background: var(--hover); border-radius: 0 10px 10px 10px; padding: 8px 12px; flex: 1; min-width: 0; }
.bubble .ctext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-top: 2px; }

/* dropdown menu */
.menu-wrap { position: relative; }
.menu { position: absolute; inset-inline-end: 0; top: 100%; min-width: 200px; background: var(--card); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px 0; z-index: 30; display: none; }
.menu.open { display: block; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 16px; text-align: start; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink2); }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }

/* group header */
.ghead .cover.lg { height: 180px; }
.ghead .info { padding: 16px 24px 0; }
.ghead h1 { margin: 0; font-size: 26px; }
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-top: 1px solid var(--line); margin-top: 14px; overflow-x: auto; }
.tabs a { padding: 12px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-size: 15px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }

/* profile header */
.phead .avatar.xl { margin: -88px 0 0; margin-inline-start: 24px; }
.phead .info { padding: 8px 24px 20px; }
.phead h1 { margin: 0; font-size: 24px; }

/* library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tile .thumb { height: 104px; display: grid; place-items: center; font-size: 44px;
  background: linear-gradient(135deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) - 25) 45% 84%)); }
@media (prefers-color-scheme: dark) { .tile .thumb { background: linear-gradient(135deg, hsl(var(--h) 35% 20%), hsl(calc(var(--h) - 25) 30% 26%)); } }
.tile .tbody { padding: 10px 12px; flex: 1; display: grid; gap: 4px; align-content: start; }
.tile .title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.tile .sum { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tfoot { padding: 8px 12px 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.libmini { display: flex; gap: 10px; padding: 8px 16px; align-items: center; }
.libmini:hover { background: var(--hover); }
.libmini .ic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 20px; flex: none;
  background: linear-gradient(135deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) - 25) 45% 84%)); }
.viewer { width: 100%; height: min(75vh, 720px); border: 0; background: var(--hover); display: block; }
.article { white-space: pre-wrap; font-size: 16px; line-height: 1.6; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .n { font-size: 28px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }

/* lists */
.li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
a.li:hover { background: var(--hover); }
.notif.unread { background: var(--brand-soft); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--card); border-radius: 10px; box-shadow: var(--shadow-lg); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-h h2 { margin: 0; font-size: 19px; }
.modal-b { padding: 16px 24px 20px; }

/* misc */
.notice { background: var(--brand-soft); color: var(--ink2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 40px; }
.auth { min-height: calc(100vh - var(--top)); display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: min(420px, 100%); }
.auth h1 { font-size: 30px; font-weight: 400; margin: 0 0 6px; }
#toast { position: fixed; inset-inline-start: 16px; bottom: 24px; background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; z-index: 200; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: none; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--hover), var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .layout { grid-template-columns: 225px minmax(0, 1fr); }
  .layout > .side.right { display: none; }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .layout, .layout.wide { grid-template-columns: minmax(0, 1fr); padding: 8px 0 24px; gap: 8px; }
  .layout > .side { display: none; }
  .card, .tile, .stat { border-radius: 0; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 8px; }
  .lib-grid .tile { border-radius: 10px; }
  .stats { padding: 0 8px; } .stats .stat { border-radius: 10px; }
  .topnav, .search { display: none; }
  .topbar-in .mob-right { display: flex; margin-inline-start: auto; }
  .tabbar { display: flex; position: fixed; bottom: 0; inset-inline-start: 0; inset-inline-end: 0; z-index: 40; background: var(--card); box-shadow: 0 -1px 0 var(--line);
    padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on::before { content: ""; position: absolute; top: 0; inset-inline-start: 30%; inset-inline-end: 30%; height: 2px; background: var(--ink); }
  .ghead .cover.lg { height: 120px; } .ghead .info { padding: 12px 16px 0; } .ghead h1 { font-size: 22px; }
  .phead .avatar.xl { width: 112px; height: 112px; font-size: 42px; margin: -60px 0 0; margin-inline-start: 16px; } .phead .info { padding: 8px 16px 16px; }
  .cover.lg { height: 110px; }
  .modal-bg { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-b { padding: 16px; }
  #toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .picker button { font-size: 26px; }
}
@media (min-width: 761px) { .mob-right { display: none !important; } }

/* ---------- v0.3: builders, players, trust, settings, admin ---------- */
.h1 { margin: 0; font-size: 22px; }
.link { color: var(--brand); }
.stack-8 { display: grid; gap: 8px; }
.pad-x { padding: 0 24px; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.nowrap { white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--ok); }
.badge.danger { background: var(--danger); color: #fff; }
.trust-auth { background: var(--brand); color: var(--brand-ink); }
.trust-end { background: var(--accent-soft); color: var(--accent); }
.badge svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.notice.ok { background: var(--accent-soft); } .notice.bad { background: #fdecea; }
@media (prefers-color-scheme: dark) { .notice.ok, .trust-end, .badge.ok { background: #183526; } .notice.bad { background: #3a1d1b; } }
.layout.single.wide-single { grid-template-columns: minmax(0, 1100px); }
.layout.single.editor { grid-template-columns: minmax(0, 1128px); }
.modal.wide { width: min(760px, 100%); }
.qlink { display: flex; align-items: center; gap: 8px; padding: 10px 8px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 14px; }
.qlink:hover { background: var(--hover); }
.ellipsis2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* shared content card in the feed */
.share-card { display: flex; gap: 12px; margin: 6px 16px 4px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
a.share-card:hover { background: var(--hover); }
.share-card .thumb { width: 92px; min-height: 84px; flex: none; display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(135deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) - 25) 45% 84%)); }
.share-card .sc-body { display: grid; gap: 3px; padding: 10px 12px 10px 0; align-content: center; min-width: 0; }
.share-card.static { margin: 0; }
.modnote { margin: 8px 16px 0; padding: 6px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--ink2); font-size: 12px; }
.modnote.bad { background: #fdecea; }
.bubble .modnote { margin: 4px 0; }
.avatar.bot { background: var(--brand-soft); font-size: 16px; }
.bubble.botb { background: var(--brand-soft); }

/* create & editor */
.type-grid, .tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-card { display: grid; gap: 6px; justify-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.type-card:hover { background: var(--hover); border-color: var(--brand); }
.type-card.off { opacity: .5; cursor: not-allowed; }
.type-card .ic, .libmini .ic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) - 25) 45% 84%)); }
.tpl { display: grid; gap: 4px; text-align: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.tpl:hover, .tpl:focus { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.preview-pane { position: sticky; top: calc(var(--top) + 16px); max-height: calc(100vh - var(--top) - 32px); overflow: auto; border-radius: var(--radius); }
.pv { border-top: 1px solid var(--line); }
.seg { display: none; background: var(--hover); border-radius: 18px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 16px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.blk { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; background: var(--card); }
.blk-h { display: flex; align-items: center; gap: 6px; }
.blk-h select { width: auto; padding: 4px 8px; }
.blk-h .iconbtn { width: 30px; height: 30px; }
.iconbtn:disabled { opacity: .3; }
.qn { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.block-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.block-grid .chip { font-size: 13px; padding: 4px 10px; }

/* page player */
.page-body { display: grid; gap: 14px; font-size: 16px; line-height: 1.6; }
.pb-h { font-size: 20px; margin: 8px 0 0; }
.pb-p { margin: 0; }
.pb-fig { margin: 0; } .pb-fig img { border-radius: 10px; display: block; width: 100%; }
.pb-fig figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.pb-video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; background: var(--hover); }
.pb-box { border-radius: 10px; padding: 12px 14px; background: var(--hover); }
.pb-box p { margin: 4px 0 0; }
.pb-box.tip { background: var(--accent-soft); } .pb-box.warn { background: #fdf0e1; } .pb-box.fact { background: var(--brand-soft); }
@media (prefers-color-scheme: dark) { .pb-box.tip { background: #183526; } .pb-box.warn { background: #3a2c18; } }
.pb-bt { font-weight: 700; }
.pb-list { display: grid; gap: 6px; }
.pb-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.pb-check input { width: 18px; height: 18px; margin-top: 3px; }
.pb-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; }
.pb-quote { margin: 0; padding: 10px 16px; border-inline-start: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; font-style: italic; }
.pb-quote cite { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 4px; }
.pb-hr { border: 0; border-top: 1px solid var(--line); width: 100%; }

/* quiz player */
.card-in { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 12px; margin-top: 16px; }
.quiz-h { font-weight: 800; font-size: 17px; }
.qq { border: 0; margin: 0; padding: 10px 0 0; display: grid; gap: 6px; border-top: 1px solid var(--line); }
.qq legend { font-weight: 600; display: flex; gap: 8px; align-items: center; padding: 0; margin-bottom: 4px; }
.opt { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 15px; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.opt input { width: 18px; height: 18px; }
.opt.is-right { border-color: var(--ok); background: var(--accent-soft); }
.qq.wrong .opt:has(input:checked):not(.is-right) { border-color: var(--danger); background: #fdecea; }
@media (prefers-color-scheme: dark) { .opt.is-right { background: #183526; } .qq.wrong .opt:has(input:checked):not(.is-right) { background: #3a1d1b; } }
.qres { font-size: 13px; color: var(--ink2); }
.scale { display: flex; gap: 6px; }
.scale label { flex: 1; } .scale input { display: none; }
.scale span { display: block; text-align: center; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; cursor: pointer; }
.scale input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* games */
.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.flash { position: relative; min-height: 120px; border: 0; background: none; perspective: 800px; cursor: pointer; padding: 0; }
.flash span { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 600;
  backface-visibility: hidden; transition: transform .45s; text-align: center; }
.flash .front { background: var(--brand); color: var(--brand-ink); }
.flash .back { background: var(--accent-soft); color: var(--ink); transform: rotateY(180deg); font-weight: 500; }
.flash.flipped .front { transform: rotateY(180deg); } .flash.flipped .back { transform: rotateY(360deg); }
.sort-list { display: grid; gap: 8px; }
.sort-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.sort-item.right { border-color: var(--ok); } .sort-item.wrong { border-color: var(--danger); }
.mf-card { border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; text-align: center; }
.mf-st { font-size: 19px; font-weight: 600; margin: 0; }
.mf-card .big { font-size: 48px; }

/* content page */
.ic-lg { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; font-size: 30px; flex: none;
  background: linear-gradient(135deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) - 25) 45% 84%)); }
.trust-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.feedback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.stats.mini { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); padding: 0 !important; }
.stat.sm { box-shadow: none; border: 1px solid var(--line); padding: 10px 12px; }
.stat.sm .n { font-size: 22px; }
.qbar { display: grid; grid-template-columns: 1fr 120px 90px; gap: 10px; align-items: center; padding: 4px 0; }
.bar { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; display: block; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar.hot span { background: var(--danger); }
.tile .thumb { position: relative; }
.draft-tag { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 11px; font-weight: 700; background: var(--ink); color: var(--card); border-radius: 4px; padding: 1px 6px; }
.tabs.flat { border-top: 0; padding: 0; margin-top: 12px; border-bottom: 1px solid var(--line); }
.tabs .badge { margin-inline-start: 2px; }

/* settings */
.set-row { display: flex; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.set-ctl select { width: auto; max-width: 260px; } .set-ctl .num { width: 110px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #b9c0c3; border-radius: 13px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; inset-inline-start: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--brand); } .switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.lockbox { color: var(--muted); cursor: pointer; }
.sticky-save { position: sticky; bottom: 12px; z-index: 5; }

/* admin */
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 8px; }
.meter .bar { margin-top: 4px; }
.org-row { padding: 12px 16px; border-top: 1px solid var(--line); }
.org-row.inactive { opacity: .6; }
.org-row select { width: auto; padding: 4px 8px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--hover); font-weight: 700; }
.mod-item.urgent { box-shadow: var(--shadow), inset 4px 0 0 var(--danger); }
.mod-quote { margin: 8px 0 0; padding: 8px 12px; background: var(--hover); border-radius: 8px; font-size: 14px; white-space: pre-wrap; }

@media (max-width: 900px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .seg { display: inline-flex; }
  .editor-grid .preview-pane { display: none; position: static; max-height: none; }
  .editor-grid[data-pane="preview"] .preview-pane { display: block; }
  .editor-grid[data-pane="preview"] #ed { display: none; }
}
@media (max-width: 760px) {
  .set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .qbar { grid-template-columns: 1fr; gap: 2px; }
  .share-card .thumb { width: 72px; font-size: 28px; }
  .pad-x { padding: 0 16px; }
}
.edu-tag.ann { background: var(--brand-soft); color: var(--brand); }
.sect-h { display: grid; gap: 2px; padding: 12px 4px 2px; } .sect-h h2 { margin: 0; font-size: 17px; }
@media (max-width: 760px) { .sect-h { padding: 12px 16px 2px; } }
.poll { display: grid; gap: 6px; padding: 8px 16px 2px; }
.poll-opt { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: start;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--card); cursor: pointer; font-weight: 600; }
.poll-opt:hover { border-color: var(--brand); }
.poll-opt.mine { border-color: var(--brand); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); z-index: 0; transition: width .3s; }
.poll-t, .poll-n { position: relative; z-index: 1; }
.set-ctl .txt { width: 240px; }

/* Zahrava mark and name */
.brand-logo { display: block; height: 34px; width: 34px; flex: none; }
.logo { gap: 9px; }
.logo-sub { font-family: "El Messiri", var(--font, sans-serif); font-weight: 700; font-size: 22px; color: var(--brand); letter-spacing: .2px; }
@media (prefers-color-scheme: dark) { .logo-sub { color: #7DB2F0; } }
@media (max-width: 760px) { .brand-logo { height: 30px; width: 30px; } .logo-sub { font-size: 19px; } }

/* care team messages */
.chat { display: grid; gap: 10px; padding: 12px 16px; max-height: 60vh; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 85%; }
.msg.mine { margin-inline-start: auto; flex-direction: row-reverse; }
.bubble2 { background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.msg.mine .bubble2 { background: var(--brand-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.cbox textarea { border-radius: 12px; }

/* ---- Simplification pass ---- */
[hidden] { display: none !important; }
.ghead .cover.lg, .cover.lg { height: 72px; }
@media (max-width: 720px) { .ghead .cover.lg, .cover.lg { height: 48px; } }
/* Compact library cards: a small type icon instead of a large empty picture */
.tile { flex-direction: row; align-items: stretch; }
.tile .thumb { height: auto; width: 64px; min-width: 64px; font-size: 28px; position: relative; }
.tile .thumb .draft-tag { position: absolute; bottom: 4px; inset-inline-start: 4px; inset-inline-end: 4px; font-size: 10px; text-align: center; }
.tile .tbody { padding: 10px 12px; }
.tile .tfoot { padding: 8px 12px; align-items: center; }
.tile { flex-wrap: wrap; }
.tile .tfoot { flex-basis: 100%; border-top: 1px solid var(--line, rgba(0,0,0,.06)); }
.lib-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 720px) { .lib-grid { grid-template-columns: 1fr; } }
details.more-settings > summary { list-style: none; cursor: pointer; }
details.more-settings > summary::-webkit-details-marker { display: none; }
details.more-settings > summary::after { content: ' ▾'; color: var(--muted); }
details.more-settings[open] > summary::after { content: ' ▴'; }
details.past > summary { cursor: pointer; padding: 10px 16px; color: var(--muted); font-size: 13px; }

/* ---- Certificates ---- */
.certificate { background: #fff; color: #1d2733; max-width: 820px; margin: 0 auto; padding: 48px 56px; text-align: center; border-radius: 12px;
  border: 10px double #14467E; box-shadow: var(--shadow); font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.cert-mark { font-size: 40px; }
.cert-kicker { color: #2E8C83; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
.cert-title { font-family: 'El Messiri', serif; color: #14467E; font-size: 34px; margin: 8px 0 18px; }
.cert-name { font-size: 30px; font-weight: 700; color: #14467E; border-bottom: 2px solid #2E8C83; display: inline-block; padding: 0 24px 4px; margin: 4px 0 6px; }
.cert-small { color: #5b6773; margin: 4px 0; font-size: 14px; }
.cert-body { margin: 18px 0 6px; font-size: 16px; }
.cert-list { list-style: none; padding: 0; margin: 6px 0 14px; font-size: 16px; line-height: 1.7; }
.cert-foot { display: flex; justify-content: space-between; margin-top: 28px; font-size: 12px; color: #5b6773; border-top: 1px solid #dfe5ea; padding-top: 10px; }
.cert-verify { margin-top: 6px; font-size: 11px; color: #8a949e; word-break: break-all; }
@media (max-width: 720px) { .certificate { padding: 28px 18px; border-width: 6px; } .cert-title { font-size: 24px; } .cert-name { font-size: 22px; } }
@media print {
  .topbar, .tabbar, .side, .no-print, #toast { display: none !important; }
  body { background: #fff !important; }
  .layout, .main { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .certificate { box-shadow: none; margin: 0 auto; page-break-inside: avoid; }
}

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-inline-end: 40px; }
.pw-eye { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 16px; opacity: .6; }
.pw-eye:hover { opacity: 1; }
.archived-banner { background: var(--hover); }
.filters > input, .filters > select { width: auto; flex: 0 1 auto; }

/* Language: Arabic reads right to left in an Arabic typeface; the switch sits at the end of the top bar. */
[dir=rtl] { --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif; }
[dir=rtl] body, [dir=rtl] input, [dir=rtl] textarea, [dir=rtl] select, [dir=rtl] button { font-family: var(--font); }
[dir=rtl] .pb-quote { border-radius: 10px 0 0 10px; }
.switch { direction: ltr; }
.langbtn { order: 10; flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink2); border-radius: 16px; padding: 3px 12px;
  font: 600 13px/1.5 "IBM Plex Sans Arabic", "IBM Plex Sans", sans-serif; cursor: pointer; }
.langbtn:hover { background: var(--hover); }
img.avatar { object-fit: cover; background: var(--line); }

.install-steps { margin: 4px 0 0; padding-inline-start: 22px; display: grid; gap: 6px; }

/* Forms never grow wider than the screen: drop-downs and boxes may shrink below their longest option. */
:where(form.f > *, .f .row > *, .modal-b > *) { min-width: 0; }
:where(input, textarea, select) { max-width: 100%; min-width: 0; }
.f .row > label.grow { flex: 1 1 140px; }

/* Tick boxes and choices large enough to tap on a phone, in the brand colour. */
input[type=checkbox], input[type=radio] { min-width: 22px; min-height: 22px; accent-color: var(--brand); flex: none; cursor: pointer; }
.switch input[type=checkbox], label.chip input { min-width: 0; min-height: 0; }
input.big-check { width: 26px !important; height: 26px; margin: 2px 0 0; }
@media (max-width: 760px) { .notice { padding: 12px 16px; } }

/* ---------- Layout safety on small screens ----------
   A heading row with buttons wraps instead of squeezing its text; list rows put their buttons
   on a second line when there is no room; long words (emails, links) break instead of overflowing. */
.row.between { flex-wrap: wrap; row-gap: 10px; }
.row.between > div:first-child { flex: 1 1 220px; min-width: 0; }
.li .grow, .li > div { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .li { flex-wrap: wrap; row-gap: 8px; }
  .li > .grow { flex: 1 1 170px; }
  .filters > input, .filters > select, .lib-filters select, .lib-filters input { flex: 1 1 140px; width: auto; }
}
/* Tabs that only make sense on phones (on wider screens the same content sits in the side column). */
@media (min-width: 761px) { .phone-only { display: none !important; } }
.trust-panel .who { flex: 1 1 200px; min-width: 0; }
/* Upper-case labels by style (so they can still be translated), and numbers like "<5" kept left-to-right in Arabic. */
.caps { text-transform: uppercase; letter-spacing: .3px; }
[dir=rtl] .caps { text-transform: none; letter-spacing: 0; }
.stat .n, .stat.sm .n { direction: ltr; unicode-bidi: isolate; }

/* ---- clearer posts and comments ---- */
/* Each post stands apart; its comments sit inside it, indented on a light band under the post. */
#feed.stack-8 { gap: 14px; }
.post { border: 1px solid var(--line); }
.comments { background: color-mix(in srgb, var(--hover) 55%, var(--card)); border-top: 1px solid var(--line);
  padding: 10px 16px 12px; padding-inline-start: 28px; margin-top: 2px; }
.comments .comment { border-inline-start: 2px solid var(--line); padding-inline-start: 10px; }
.comments .bubble { background: var(--card); }
/* Menus are never cut off by the card they open from. */
.card:has(.menu.open), .post:has(.menu.open), .li:has(.menu.open) { overflow: visible; }
.menu { max-width: calc(100vw - 24px); }
.menu button, .menu a { white-space: nowrap; }

/* ---- group description: a short preview with Read more ---- */
.gdesc { margin-top: 8px; }
.gdesc .clamp { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.gdesc .clamp.open { display: block; -webkit-line-clamp: unset; }
.gdesc .link { border: 0; background: none; padding: 2px 0; cursor: pointer; color: var(--brand); }
.group-about summary { cursor: pointer; }
.group-about > div { margin-top: 10px; }

/* ---- people: employees' rights ---- */
.rights { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.right-sw { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink2); cursor: pointer; }
.right-sw input { width: 22px; height: 22px; min-width: 22px; margin: 0; }
.right-sw:has(input:disabled) { opacity: .7; cursor: default; }

/* ---- review progress for authors ---- */
.review-track { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.review-track span { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: var(--hover); color: var(--muted); }
.review-track span.on { background: var(--brand-soft); color: var(--brand-ink); }
.review-track span.on.stop { background: var(--accent-soft); color: var(--ink2); }
.set-row .lockbox { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.set-row .lockbox input { width: 18px; height: 18px; margin: 0; }
.li.person { color: inherit; }

/* Me page: short sections that open when tapped */
.me-sec > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.me-sec > summary::-webkit-details-marker { display: none; }
.me-sec > summary::after { content: '›'; font-size: 20px; color: var(--muted); transition: transform .15s; }
.me-sec[open] > summary::after { transform: rotate(90deg); }
.me-sec h3, .me-sec .card > h3 { display: none; }
.me-sec .card { box-shadow: none; padding: 0 !important; background: none; }
.me-photo { cursor: pointer; display: inline-block; }

/* Buttons, tabs, menu and section titles: each word starts with a capital letter */
.btn, .tabs a, .topnav span, .bottomnav span, .menu button, .menu a, .card > .pad > h3, .card.pad > h3, .card.pad-lg > h3, .me-sec > summary, .sect-h h2, summary.b { text-transform: capitalize; }
.ta { position: relative; display: grid; gap: 6px; margin-top: 6px; }
.ta-list { position: absolute; top: 100%; inset-inline: 0; z-index: 40; background: var(--card); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; }
.ta-list button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 10px 14px; cursor: pointer; font-size: 14px; }
.ta-list button:hover { background: var(--hover); }
.ta-chips .chip button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 0 0 4px; color: inherit; }

/* Tools on posts: tasks, events, challenges, questions */
.xbox { margin: 6px 16px 4px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand-soft) 60%, var(--card)); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.xbox > div { width: 100%; }
.xsel { width: auto; padding: 4px 8px; font-size: 13px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } }

/* Feature packs: one card per kind of group */
.packs{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px}
.pack{display:grid;gap:3px;border:1px solid var(--line);border-radius:12px;padding:10px 12px;cursor:pointer;position:relative;background:var(--card,#fff)}
.pack input{position:absolute;top:10px;right:10px;width:auto}
.pack:has(input:checked){border-color:var(--brand);box-shadow:0 0 0 1px var(--brand) inset}
.pack.off{opacity:.65;cursor:not-allowed}
.pack-h{display:flex;align-items:center;gap:8px;padding-right:24px}.pack-i{font-size:20px}

/* ---------- Feature pack tools ---------- */
.vtabs{display:flex;gap:6px;flex-wrap:wrap}
.vtabs .chip{font-size:13px;padding:4px 12px}
.pbar{height:8px;border-radius:6px;background:var(--hover);overflow:hidden;margin:6px 0 2px}
.pbar>span{display:block;height:100%;background:var(--accent);border-radius:6px;transition:width .3s}
.danger-t{color:var(--danger)} .ok-t{color:var(--ok)} .struck{text-decoration:line-through;opacity:.6}
.badge.warn{background:#fff1d6;color:#8a5a00}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .badge.warn{background:#4a3a12;color:#ffd27a}}
:root[data-theme="dark"] .badge.warn{background:#4a3a12;color:#ffd27a}
.label{font-size:11px;font-weight:600;border-radius:4px;padding:1px 6px;background:var(--brand-soft);color:var(--brand)}
.faces{display:inline-flex;align-items:center}.faces .avatar{margin-inline-start:-6px;box-shadow:0 0 0 2px var(--card)}.faces .avatar:first-child{margin-inline-start:0}
.iconbtn.sm{width:26px;height:26px;font-size:13px}
.panel{margin-top:10px;padding-top:10px;border-top:1px solid var(--line)}
.panel:empty{display:none}
.filters select,.filters input{font-size:13px;padding:6px 8px}
.proj-head{display:flex;gap:10px;align-items:flex-start;margin-top:10px;padding-top:10px;border-top:1px solid var(--line)}.proj-head .grow{flex:1;min-width:0}
/* board */
.kanban{display:flex;gap:10px;overflow-x:auto;padding:2px 2px 10px;scroll-snap-type:x proximity}
.kcol{flex:0 0 260px;background:var(--hover);border-radius:12px;padding:8px;scroll-snap-align:start;display:flex;flex-direction:column;max-height:75vh}
.kcol.over{outline:2px dashed var(--brand);outline-offset:-2px}
.kcol-h{padding:4px 6px 8px;font-size:14px}
.kcol-b{display:grid;gap:8px;overflow-y:auto;min-height:40px;align-content:start}
.kempty{padding:12px;text-align:center}
.tcard{background:var(--card);border-radius:10px;padding:10px;box-shadow:var(--shadow);cursor:pointer}
.tcard:hover{box-shadow:var(--shadow-lg)}.tcard.dragging{opacity:.5}.tcard.done .b{text-decoration:line-through;opacity:.7}
.trow{cursor:pointer}.trow:hover{background:var(--hover)}
.ms-row{padding:8px 0;border-top:1px solid var(--line)}
.task-modal{display:grid;gap:10px}
/* people picker, checklists, files */
.picker-box{border:1px solid var(--line);border-radius:10px;padding:6px}
.pick-list{display:grid;gap:2px;max-height:160px;overflow-y:auto}
.pick{display:flex!important;align-items:center;gap:8px;font-weight:500!important;color:var(--ink)!important;padding:3px 4px;border-radius:6px}.pick:hover{background:var(--hover)}
.pick input,.check-row input,.quiz-o input{width:auto}
.pick-filter{margin-bottom:6px;width:100%}
.check-row{display:flex;align-items:center;gap:6px;padding:3px 0;font-size:14px}
.file-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:3px 0;font-size:14px}
/* calendar */
.cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}
.cal-h{font-size:12px;font-weight:700;color:var(--muted);text-align:center;padding:4px 0}
.cal-d{min-height:92px;background:var(--hover);border-radius:6px;padding:4px;display:flex;flex-direction:column;gap:2px;overflow:hidden}
.cal-d.other{opacity:.45}.cal-d.today{outline:2px solid var(--brand);outline-offset:-2px}
.cal-n{font-size:12px;font-weight:700;color:var(--muted)}
.cal-entry{display:block;font-size:11.5px;line-height:1.3;padding:2px 5px;border-radius:4px;background:var(--brand-soft);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cal-entry.t-task,.cal-entry.t-milestone{background:var(--accent-soft)}.cal-entry.t-assignment,.cal-entry.t-lesson{background:#efe6ff}
.cal-entry.t-challenge{background:#fff1d6}.cal-entry.t-booking{background:#e3f2fd}
.cal-entry.done{opacity:.55;text-decoration:line-through}.cal-entry.cancelled{text-decoration:line-through;opacity:.6}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .cal-entry.t-assignment,:root:not([data-theme="light"]) .cal-entry.t-lesson{background:#3a2d55}:root:not([data-theme="light"]) .cal-entry.t-challenge{background:#4a3a12}:root:not([data-theme="light"]) .cal-entry.t-booking{background:#173a55}}
:root[data-theme="dark"] .cal-entry.t-assignment,:root[data-theme="dark"] .cal-entry.t-lesson{background:#3a2d55}:root[data-theme="dark"] .cal-entry.t-challenge{background:#4a3a12}:root[data-theme="dark"] .cal-entry.t-booking{background:#173a55}
.agenda-day{padding:8px 0;border-top:1px solid var(--line);display:grid;gap:4px}.agenda-day:first-child{border-top:0}
.agenda-day .cal-entry{white-space:normal;font-size:14px;padding:6px 8px}
.agenda-day.today>.small{color:var(--brand)}
/* events */
.datebox{flex:0 0 46px;text-align:center;border-radius:10px;overflow:hidden;box-shadow:var(--shadow);background:var(--card)}
.datebox .m{background:var(--brand);color:var(--brand-ink);font-size:11px;font-weight:700;text-transform:uppercase;padding:2px 0}
.datebox .d{font-size:20px;font-weight:800;padding:2px 0}
.ev-row{color:inherit}.ev-row:hover{background:var(--hover)}
.cancelled .b,.ev-row.cancelled .b{text-decoration:line-through}
.xbox.cancelled{opacity:.7}
.code{font-family:ui-monospace,monospace;font-size:18px;letter-spacing:.15em;background:var(--hover);padding:2px 8px;border-radius:6px}
.stars{display:flex;gap:4px;direction:ltr}.stars label{cursor:pointer;font-size:26px;color:var(--line)}.stars input{display:none}
.stars label:has(input:checked) span,.stars label:has(~ label input:checked) span{color:#f5a623}
.stars:has(input:checked) label:has(input:checked) ~ label span{color:var(--line)}
/* challenges */
.spark{display:flex;align-items:flex-end;gap:2px;height:70px;margin-top:10px}
.sbar{flex:1;height:100%;display:flex;align-items:flex-end}.sbar span{display:block;width:100%;background:var(--line);border-radius:2px 2px 0 0}.sbar.met span{background:var(--accent)}
.lb-row{padding:6px 0;border-top:1px solid var(--line)}.lb-row.mine{color:var(--brand);font-weight:700}
.big-emoji{font-size:24px}
/* questions */
.q-row{color:inherit}.q-row:hover{background:var(--hover)}
.q-count{flex:0 0 56px;text-align:center;border:1px solid var(--line);border-radius:8px;padding:4px 0;display:grid;line-height:1.1}.q-count.has{border-color:var(--brand)}.q-count.solved{background:var(--accent);border-color:var(--accent);color:#fff}
.hintbox{display:grid;gap:4px;background:var(--brand-soft);border-radius:8px;padding:8px 10px}
.xbox.mustread{background:#fff7e0}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .xbox.mustread{background:#3d3418}}
:root[data-theme="dark"] .xbox.mustread{background:#3d3418}
/* courses */
.course-card{display:block;color:inherit}.course-card:hover{box-shadow:var(--shadow-lg)}
.course-wrap{display:grid;grid-template-columns:260px minmax(0,1fr);gap:12px;align-items:start}
.course-ol{position:sticky;top:70px;display:grid;gap:10px}
.ol-mod{display:grid;gap:2px}
.ol-item{display:flex;gap:8px;align-items:center;padding:6px 8px;border-radius:8px;color:inherit}.ol-item:hover{background:var(--hover)}.ol-item.on{background:var(--brand-soft)}.ol-item.locked{opacity:.55}
.lesson-text{white-space:pre-wrap;font-size:15px;line-height:1.6}
.quiz-q{padding:10px 0;border-top:1px solid var(--line);display:grid;gap:4px}
.quiz-o{padding:2px 0;font-weight:500!important;color:var(--ink)!important}
.qb{margin-top:8px}
.certificate{border:6px double var(--accent);border-radius:12px;padding:32px 20px;text-align:center}
.cert-logo{font-weight:700;color:var(--brand);letter-spacing:.05em}.cert-t{font-size:26px;font-weight:800;margin:10px 0}
.cert-name{font-size:28px;font-weight:800;color:var(--brand);margin:8px 0}.cert-course{font-size:20px;font-weight:700;margin:6px 0}
@media (max-width:760px){.course-wrap{grid-template-columns:1fr}.course-ol{position:static}}
/* support */
.goal{padding:8px 0;border-top:1px solid var(--line)}.goal.done,.goal.dropped{opacity:.7}
.note{padding:6px 0;border-top:1px solid var(--line)}
@media (max-width:700px){.kcol{flex-basis:78vw}.cal-d{min-height:64px}}
.main > *, #toolroot, #toolroot > *, .stack-8 > * { min-width: 0; }
/* timeline (Gantt) */
.gantt{display:flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;margin-top:10px;background:var(--card)}
.g-names{flex:0 0 170px;border-right:1px solid var(--line);background:var(--card);z-index:1}
.g-scroll{flex:1;overflow-x:auto;position:relative}
.g-canvas{position:relative;min-height:100%}
.g-hrow{height:40px;position:relative;border-bottom:1px solid var(--line);background:var(--hover)}
.g-month{position:absolute;top:2px;font-size:11px;font-weight:700;color:var(--muted);padding-left:4px;white-space:nowrap}
.g-day{position:absolute;bottom:2px;font-size:10px;text-align:center;color:var(--muted)}.g-day.we{color:var(--line)}
.g-row{height:34px;position:relative;border-bottom:1px solid var(--line)}
.g-name{display:flex;align-items:center;padding:0 8px;font-size:13px;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.g-name:hover{background:var(--hover)}
.g-name span{overflow:hidden;text-overflow:ellipsis}
.g-msrow{display:flex;align-items:center;padding:0 8px;color:var(--muted)}
.g-ms{position:absolute;top:10px;width:14px;height:14px;background:#e0a100;transform:rotate(45deg);border-radius:2px}.g-ms.done{background:var(--ok)}
.g-today{position:absolute;top:0;bottom:0;width:2px;background:var(--danger);opacity:.6;z-index:2;pointer-events:none}
.g-bar{position:absolute;top:6px;height:22px;border-radius:6px;background:var(--brand);color:var(--brand-ink);cursor:grab;display:flex;align-items:center;touch-action:none;user-select:none;min-width:10px}
.g-bar.p-high{background:#c27a00}.g-bar.p-urgent{background:var(--danger)}.g-bar.p-low{background:#7b8794}
.g-bar.done{background:var(--accent);opacity:.6}.g-bar.over{box-shadow:0 0 0 2px var(--danger)}
.g-label{font-size:11px;padding:0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.g-handle{position:absolute;right:0;top:0;bottom:0;width:8px;cursor:ew-resize;border-radius:0 6px 6px 0;background:rgba(255,255,255,.25)}
@media (max-width:700px){.g-names{flex-basis:110px}}
/* post box: opens in place */
.composer2{padding:12px 16px}
.c2-start{display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;padding:0;cursor:text;text-align:start;font:inherit}
.c2-start span{flex:1;border:1px solid #8c8c8c88;border-radius:28px;padding:12px 16px;color:var(--muted);font-weight:600;transition:background .15s}
.c2-start:hover span{background:var(--hover)}
.c2-form{display:grid;gap:10px;animation:c2in .18s ease-out}
@keyframes c2in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.c2-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.c2-kinds{display:inline-flex;background:var(--hover);border-radius:20px;padding:3px;gap:2px}
.c2-kind{border:0;background:none;border-radius:16px;padding:5px 12px;font:inherit;font-size:13px;font-weight:600;color:var(--muted);cursor:pointer;display:inline-flex;gap:5px;align-items:center}
.c2-kind.on{background:var(--card);color:var(--ink);box-shadow:var(--shadow)}
.c2-text{border:0!important;box-shadow:none!important;outline:none;resize:none;font-size:17px;line-height:1.5;min-height:96px;padding:4px 0!important;background:transparent;width:100%}
.c2-poll{display:grid;gap:6px}
.c2-opts{display:grid;gap:4px;border:1px solid var(--line);border-radius:12px;padding:8px}
.c2-opt{display:flex!important;align-items:center;gap:10px;padding:6px 6px;border-radius:8px;cursor:pointer;font-weight:500!important;color:var(--ink)!important}
.c2-opt:hover{background:var(--hover)}
.c2-opt>span{display:grid;flex:1}.c2-opt input[type=checkbox]{width:auto}.c2-opt input[type=datetime-local]{width:auto}
.c2-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:10px}
#c2optbtn.on{background:var(--brand-soft);color:var(--brand)}
@media (max-width:600px){.c2-bar>.tiny{display:none}.c2-bar{justify-content:flex-end}}
.c2-head .grow{min-width:0}
@media (max-width:600px){.c2-kinds{flex-basis:100%;justify-content:space-between}.c2-kind{flex:1;justify-content:center}.c2-opt input[type=datetime-local]{width:100%}.c2-opt:has(input[type=datetime-local]){flex-wrap:wrap}}
/* closed post box: like the familiar social apps */
.c2-top{display:flex;align-items:center;gap:10px}
.c2-top .avatar{flex:0 0 auto}
.c2-pill{flex:1;min-width:0;text-align:start;border:1px solid #8c8c8c88;border-radius:28px;padding:12px 18px;background:var(--card);color:var(--muted);font:inherit;font-size:15px;font-weight:600;cursor:pointer;transition:background .15s}
.c2-pill:hover{background:var(--hover)}
.c2-actions{display:flex;justify-content:space-around;gap:4px;margin-top:8px;flex-wrap:wrap}
.c2-act{display:inline-flex;align-items:center;gap:8px;border:0;background:none;border-radius:8px;padding:10px 12px;font:inherit;font-size:14px;font-weight:600;color:var(--ink2);cursor:pointer}
.c2-act:hover{background:var(--hover)}
.c2-ico{font-size:20px;line-height:1}
@media (max-width:600px){.c2-act{padding:8px 6px;font-size:13px;gap:5px}.c2-ico{font-size:17px}}

/* Group page (design A): header with people and actions, one row of tool buttons, "Happening now" cards. */
.gh2 { padding-bottom: 0; overflow: visible; }
.gh2 .cover { height: 88px; border-radius: var(--radius) var(--radius) 0 0; }
.gh-main { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 14px 20px 12px; flex-wrap: wrap; }
.gh-text { flex: 1 1 320px; min-width: 0; display: grid; gap: 4px; }
.gh-text h1 { margin: 0; font-size: 24px; line-height: 1.25; }
.gh-people { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; width: fit-content; }
.gh-people .small { display: inline-flex; align-items: center; gap: 4px; }
.gh-people:hover .small { color: var(--ink); }
.gh-faces { display: inline-flex; }
.gh-faces > * { box-shadow: 0 0 0 2px var(--card); border-radius: 50%; }
.gh-faces > * + * { margin-inline-start: -8px; }
.gh-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gdock { display: flex; gap: 8px; padding: 12px 20px 14px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.gdock::-webkit-scrollbar { display: none; }
.gd { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 26px; background: var(--hover); color: var(--ink2); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; flex: none; }
.gd:hover { background: var(--brand-soft); color: var(--brand); }
.gd.on { background: var(--brand); color: var(--brand-ink); }
.gd-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--card); color: var(--brand); display: grid; place-items: center; }
.gd-ico svg.i { width: 18px; height: 18px; }
.gd-b { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.gd.on .gd-b { background: var(--card); color: var(--brand); }
.gd-b.danger { background: var(--danger); color: #fff; }
.gd-b.accent, .gd-b.ok { background: var(--accent); color: #fff; }
.gnow { display: grid; gap: 8px; }
.gn-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.gn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.gn { display: flex; flex-direction: column; gap: 8px; padding: 14px; text-decoration: none; color: inherit; min-width: 0; }
.gn:hover { box-shadow: var(--shadow-lg); }
.gn .ellipsis { min-width: 0; }
.gn-cta { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--brand); }
.c2-act svg.i { color: var(--brand); }
.c2-kind svg.i { width: 16px; height: 16px; }
@media (max-width: 720px) {
  .gh2 .cover { height: 56px; }
  .gh-main { padding: 12px 14px 10px; }
  .gh-text h1 { font-size: 20px; }
  .gdock { padding: 10px 14px 12px; }
  .gn-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -2px; padding: 2px; scrollbar-width: none; }
  .gn-row::-webkit-scrollbar { display: none; }
  .gn { flex: 0 0 78%; scroll-snap-align: start; }
  .c2-actions { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .c2-act { flex: none; }
}
@media (min-width: 721px) {
  .gdock { flex-wrap: wrap; overflow: visible; }
  .c2-actions { justify-content: flex-start; }
}
.gh-main { position: relative; }
.gh-acts:has(> .menu-wrap:only-child) { position: absolute; top: 10px; inset-inline-end: 10px; }
/* The group's description and rules: an About card on the right where there is a right column, in the header otherwise. */
.gh-about { display: none; }
@media (max-width: 1060px) { .gh-about { display: grid; gap: 4px; } }
/* Phones zoom in when a box with text smaller than 16px is tapped (and stay zoomed after signing in). */
@media (max-width: 760px), (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input:not([type]), textarea, select { font-size: 16px; }
}
.gh2 { overflow: visible; }
/* The group's "⋯" menu as a sheet on phones: large, easy-to-tap rows. */
.sheet-list { display: grid; margin: -4px 0 calc(4px + env(safe-area-inset-bottom)); }
.sheet-list a, .sheet-list button { display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: none;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; text-align: start; cursor: pointer; }
.sheet-list > :last-child { border-bottom: 0; }
.sheet-list .danger { color: var(--danger); }
/* @mention suggestions under the post or comment box. */
.mention-host { position: relative; }
.mention-list { position: absolute; z-index: 40; min-width: 240px; max-width: 100%; background: var(--card); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; margin-top: 4px; }
.mention-list button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); text-align: start; cursor: pointer; }
.mention-list button.on, .mention-list button:hover { background: var(--brand-soft); }
/* Navigation progress bar (shown only when a screen takes more than a moment). */
.navbar-progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: linear-gradient(90deg, transparent, var(--brand) 40%, var(--accent) 60%, transparent); background-size: 200% 100%; }
.navbar-progress.on { opacity: 1; animation: navbar-move 1s linear infinite; }
@keyframes navbar-move { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .navbar-progress.on { animation: none; background: var(--brand); } }
/* Comments: Like and Reply under each one; replies indented under the comment they answer. */
.cmain { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cacts { display: flex; align-items: center; gap: 14px; padding: 2px 6px 0; font-size: 13px; }
.clink { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.clink:hover, .clink.on { color: var(--brand); }
.ccount { color: var(--muted); font-size: 12px; margin-inline-start: auto; }
.react-wrap.cr { flex: none; display: inline-flex; }
.react-wrap.cr .picker { bottom: calc(100% + 2px); }
.react-wrap.cr .picker button { font-size: 24px; }
.replies { display: grid; gap: 8px; margin-top: 6px; }
.replies:empty { display: none; }
.comment.reply .avatar { width: 26px; height: 26px; font-size: 11px; }
.clink.more { justify-self: start; }
.rbox input { font-size: 14px; }
/* Photos and files: previews in the post box, the photo grid on posts, file cards and the full-screen viewer. */
.c2-files { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.c2-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--hover); flex: none; }
.c2-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c2-thumb.file { width: 160px; display: flex; align-items: center; gap: 6px; padding: 0 28px 0 10px; font-size: 12px; font-weight: 600; }
.c2-thumb button { position: absolute; top: 4px; inset-inline-end: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; cursor: pointer; }
.c2-form.drop { outline: 2px dashed var(--brand); outline-offset: 4px; }
.pimgs { display: grid; gap: 2px; margin: 8px 0 4px; grid-template-columns: 1fr 1fr; }
.pimgs.n1 { grid-template-columns: 1fr; }
.pimgs.n3 .pimg:first-child { grid-row: span 2; }
.pimg { position: relative; border: 0; padding: 0; background: var(--hover); cursor: zoom-in; aspect-ratio: 1; overflow: hidden; }
.pimgs.n1 .pimg { aspect-ratio: auto; max-height: 520px; }
.pimgs.n3 .pimg:first-child { aspect-ratio: auto; }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pimgs.n1 .pimg img { object-fit: contain; max-height: 520px; background: var(--hover); }
.pmore { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-size: 26px; font-weight: 700; }
.pfile { display: flex; align-items: center; gap: 10px; margin: 6px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.pfile:hover { background: var(--hover); }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.92); display: grid; place-items: center; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.lb-x { top: calc(12px + env(safe-area-inset-top)); inset-inline-end: 12px; }
.lb-p { inset-inline-start: 10px; top: 50%; } .lb-n { inset-inline-end: 10px; top: 50%; }
.lb-c { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); color: #fff; font-size: 14px; }
/* Voice notes: the recorder window, the player in posts, comments and messages, and the mic buttons. */
.vrec { display: grid; gap: 12px; justify-items: center; padding: 8px 0 4px; }
.vrec-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--danger); animation: vrec-pulse 1.2s ease-in-out infinite; }
.vrec-t { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vrec audio { width: 100%; }
@keyframes vrec-pulse { 50% { opacity: .35; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { .vrec-dot { animation: none; } }
.vnote { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0; }
.vnote audio { height: 40px; width: min(100%, 300px); }
.vtr { flex-basis: 100%; }
.vtr summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.vtr > div { margin-top: 4px; white-space: pre-wrap; }
.pvoices { padding: 0 16px; }
.cmic { flex: none; color: var(--brand); }
.c2-thumb.file svg.i { flex: none; }
.pbar.full>span{background:var(--danger)}
/* "A new version is ready" (shown only when something is being typed; otherwise the app refreshes itself). */
.update-bar { position: fixed; inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 250; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--card); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); }
@media (min-width: 761px) { .update-bar { inset-inline: auto 24px; bottom: 24px; } }
/* Member rows with several buttons: the buttons move to a second line instead of squeezing the name. */
.li.mrow { flex-wrap: wrap; }
.li.mrow > .grow { min-width: min(220px, 60%); }
/* Radio choices shown as cards (e.g. "Who can join?"). */
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 3px; }
.f label.choice { display: flex; flex-direction: row; align-items: flex-start; font-weight: 400; }
.f label.choice input { width: auto; flex: none; }
.f label.choice b { font-weight: 700; }
.f label.choice .tiny { font-weight: 400; }

/* App cards (other services connected to a group) */
.avatar.app { display: inline-grid; place-items: center; background: var(--soft, #eef3f6); font-size: 20px; }
.appcard { display: grid; gap: 8px; }
.appcard.good { border-left: 3px solid var(--ok, #1a7f37); }
.appcard.warn { border-left: 3px solid var(--warn, #9a6700); }
.appbar { height: 8px; border-radius: 4px; background: var(--line, #e3e8ee); overflow: hidden; }
.appbar span { display: block; height: 100%; background: var(--brand, #1f6f8b); }
.appfields { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 13px; }
.appfields dt { color: var(--muted); } .appfields dd { margin: 0; font-weight: 600; }

/* An app's page inside a group */
.apppage { overflow: hidden; } .apppage iframe { display: block; width: 100%; height: min(78vh, 900px); border: 0; background: #fff; }

/* The compact group page shown inside an app (Evidence Review's Team chat): only the group, with a slim bar on top. */
body.embedded { background: var(--bg); }
body.embedded .topbar, body.embedded .tabbar, body.embedded .side, body.embedded .update-bar { display: none !important; }
body.embedded .layout, body.embedded .layout.wide, body.embedded .layout.single { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 24px; gap: 10px; max-width: none; }
.embedbar { display: none; }
body.embedded .embedbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40; padding: 8px 10px; background: var(--card); box-shadow: var(--shadow); }
body.embedded .embedbar .grow { flex: 1; }

/* Rich app cards: journey of steps, big numbers, what needs attention, latest activity. */
.appsteps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; gap: 3px; }
.appsteps li { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 3px; position: relative; }
.appsteps li::before { content: ''; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line, #dfe3e8); z-index: 0; }
.appsteps li:first-child::before { display: none; }
.appsteps li.done::before, .appsteps li.now::before { background: var(--ok, #1a7f37); }
.appsteps .dot { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--card, #fff); border: 2px solid var(--line, #dfe3e8); color: var(--muted, #667); }
.appsteps li.done .dot { background: var(--ok, #1a7f37); border-color: var(--ok, #1a7f37); color: #fff; }
.appsteps li.now .dot { background: var(--brand, #14467E); border-color: var(--brand, #14467E); color: #fff; box-shadow: 0 0 0 4px rgba(20, 70, 126, .15); }
.appsteps .lbl { font-size: 10.5px; line-height: 1.2; text-align: center; color: var(--muted, #667); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.appsteps li.now .lbl { color: var(--ink, #1d2226); font-weight: 600; }
.appstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
.appstats div { display: grid; padding: 8px 10px; border-radius: 10px; background: var(--bg, #f4f2ee); }
.appstats b { font-size: 20px; line-height: 1.2; }
.appstats span { font-size: 12px; color: var(--muted, #667); }
.appstats i { font-size: 11px; font-style: normal; color: var(--muted, #667); }
.appalert { padding: 8px 10px; border-radius: 10px; background: #fff4e5; color: #8a4b00; font-size: 13.5px; font-weight: 600; }
.appact { display: grid; gap: 3px; border-top: 1px solid var(--line, #dfe3e8); padding-top: 6px; }
@media (max-width: 520px) { .appsteps .lbl { display: none; } }

/* "Continue to <app>": choose an account (one row each, tap to continue). */
.acct-head { font-weight: 600; font-size: 14px; margin: 18px 2px 8px; }
.acct-list { display: grid; gap: 8px; }
.acct { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px 14px; border: 1px solid var(--line, #dfe3e8); border-radius: 14px; background: var(--card, #fff); color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.acct:hover:not(:disabled) { border-color: var(--brand, #14467E); box-shadow: 0 2px 10px rgba(20, 70, 126, .12); }
.acct:active:not(:disabled) { transform: scale(.99); }
.acct.off { opacity: .55; cursor: default; }
.acct.busy { border-color: var(--brand, #14467E); }
.acct-av { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; background: var(--brand, #14467E); color: #fff; }
.acct-main { flex: 1; min-width: 0; display: grid; }
.acct-name { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-sub { font-size: 12.5px; color: var(--muted, #667); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-side { display: grid; justify-items: end; gap: 4px; flex: none; max-width: 42%; text-align: end; }
.acct-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg, #f4f2ee); color: var(--muted, #667); }
.acct-tag.good { background: #e3f4ea; color: #1a7f37; }
.acct-groups { font-size: 12px; font-weight: 600; color: var(--ok, #1a7f37); }
.acct-groups.none { color: var(--muted, #667); font-weight: 500; }
.acct-go { flex: none; font-size: 22px; color: var(--muted, #667); }
.linkbtn { background: none; border: 0; padding: 6px 2px; color: var(--brand, #14467E); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
@media (max-width: 420px) { .acct-side { max-width: 38%; } .acct { padding: 12px; gap: 10px; } }

/* Team chat inside an app: the group's posts and a box to write, nothing else */
body.embedded .embedbar[hidden] { display: none; }
body.embedded .ghead .cover, body.embedded .ghead .gh-people, body.embedded .ghead .gh-about, body.embedded .ghead .gh-acts, body.embedded .ghead .gdock, body.embedded .gabout { display: none !important; }
body.embedded .ghead .gh-main { padding: 10px 14px; }
body.embedded .ghead h1 { font-size: 1.05rem; margin: 0; }
