:root {
  /* Deep midnight: near-black with a faint cool-neutral tint */
  --bg: #040406;
  --bg-2: #070709;
  --panel: #0b0b0f;
  --panel-2: #131318;
  --border: #202028;
  --border-soft: #161619;
  --text: #edeef2;
  --muted: #9192a1;
  --accent: #5b8dff;
  --accent-2: #8b6bff;
  --accent-hover: #78a2ff;
  --accent-glow: rgba(91, 141, 255, 0.28);
  --online: #3ba55d;
  --offline: #5a5d6b;
  --danger: #f0525b;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.96); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes bgFloat { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(3%, 4%); } }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 760px at 14% -10%, rgba(91, 141, 255, 0.05), transparent 60%),
    radial-gradient(1000px 620px at 100% 0%, rgba(139, 107, 255, 0.05), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Dark, slim scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: #2a2a34 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #23232d; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #32323f; background-clip: content-box; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent-hover); }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: transform 0.14s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
button:hover { background: #1a2236; border-color: #2a3552; transform: translateY(-1px); }
button:active { transform: translateY(0) scale(0.98); }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 4px 16px -6px var(--accent-glow);
}
button.primary:hover { filter: brightness(1.08); box-shadow: 0 8px 24px -6px var(--accent-glow); transform: translateY(-1px); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: rgba(248, 81, 73, 0.12); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* `input[type="text"]` does NOT match an input with no type attribute — the
   selector needs the attribute to literally be there. Several inputs across the
   site omit it and were rendering as unstyled white boxes; `:not([type])` picks
   those up, and the rest of the text-like family is listed for the same reason. */
input[type="password"], input[type="text"], input[type="search"],
input[type="email"], input[type="url"], input[type="tel"],
input[type="number"], input:not([type]) {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
input {
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: #0f1626; }
input::placeholder, textarea::placeholder { color: #5c6478; }
input[type="time"] { color-scheme: dark; }
textarea {
  font: inherit; width: 100%; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px; resize: vertical; line-height: 1.5;
}

/* ---- login ---- */
.center-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 70px -24px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.02) inset;
  animation: popIn 0.55s var(--ease) both;
}
.center-wrap .card { position: relative; }
.center-wrap .card::before {
  content: ""; position: absolute; inset: -1px; border-radius: 17px; padding: 1px; z-index: -1;
  background: linear-gradient(135deg, var(--accent-glow), transparent 40%, rgba(124,92,255,0.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.7;
}
.card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.01em; }
.card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.gbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border-radius: var(--radius); cursor: pointer;
  background: #fff; color: #1f2430; font-weight: 600; font-size: 15px; margin-top: 6px;
  transition: transform 0.14s var(--ease), box-shadow 0.18s var(--ease);
  box-shadow: 0 6px 20px -8px rgba(0,0,0,0.6);
}
.gbtn:hover { color: #1f2430; transform: translateY(-1px); box-shadow: 0 10px 28px -8px rgba(0,0,0,0.7); }
.gbtn:active { transform: translateY(0); }

/* account menu in top bar */
.acct { display: flex; align-items: center; gap: 10px; }
.acct .avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; background: var(--panel-2); }
.acct .who { text-align: right; line-height: 1.15; }
.acct .who .nm { font-size: 13px; font-weight: 600; }
.acct .who .em { font-size: 11.5px; color: var(--muted); }
.badge-owner { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #ffd479; background: rgba(255,196,64,0.14); border: 1px solid rgba(255,196,64,0.3); padding: 2px 7px; border-radius: 999px; }
.lock-wrap { max-width: 420px; margin: 40px auto; }

/* ---- dashboard ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: rgba(8, 11, 20, 0.72); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  position: sticky; top: 0; z-index: 10;
  animation: fadeIn 0.4s var(--ease) both;
}
.topbar h1 { font-size: 17px; margin: 0; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav .brand {
  font-weight: 700; font-size: 15px; margin-right: 12px;
  background: linear-gradient(120deg, var(--text), #9fc0ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.navlink {
  padding: 7px 13px; border-radius: 8px; font-size: 14px; color: var(--muted);
  border: 1px solid transparent; transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.navlink:hover { background: var(--panel-2); color: var(--text); }
.navlink.active { background: linear-gradient(135deg, rgba(79,139,255,0.16), rgba(124,92,255,0.12)); color: #fff; border-color: rgba(79,139,255,0.4); box-shadow: 0 0 0 1px rgba(79,139,255,0.12) inset; }

/* ---- user database ---- */
.udb-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.udb-toolbar .grow { flex: 1 1 240px; }
.udb-search { position: relative; flex: 1 1 260px; }
.udb-search input { padding-left: 34px; }
.udb-search::before { content: ""; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; background-color: var(--muted); -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/></svg>") center/contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/></svg>") center/contain no-repeat; }
.udb-stats { color: var(--muted); font-size: 13px; margin: 6px 2px 14px; }
.udb-stats b { color: var(--text); }
.card.pad { padding: 18px; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.udb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.udb th, table.udb td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.udb th {
  position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none;
  background: rgba(11, 15, 26, 0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  transition: color 0.15s var(--ease);
}
table.udb th:hover { color: var(--text); }
table.udb th .arrow { color: var(--accent); margin-left: 5px; }
table.udb tbody tr { transition: background 0.12s var(--ease); }
table.udb tbody tr:hover { background: var(--panel-2); }
table.udb td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
table.udb mark { background: rgba(79,139,255,0.34); color: #fff; border-radius: 3px; padding: 0 2px; }
.copy-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.copy-btn:hover { background: var(--border); color: var(--text); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 13px; }
.dropzone { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); transition: border-color 0.15s, background 0.15s; }
.dropzone { transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease); }
.dropzone:hover { border-color: #2e3a5a; }
.dropzone.drag { border-color: var(--accent); background: rgba(79,139,255,0.1); color: var(--text); box-shadow: 0 0 0 3px var(--accent-glow) inset; }
.import-result { font-size: 13px; margin-top: 10px; }
.import-result.ok { color: var(--online); }
.import-result.err { color: var(--danger); }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted-sm { color: var(--muted); font-size: 12.5px; }
table.udb td.check, table.udb th.check { width: 34px; text-align: center; padding-right: 0; }
table.udb tbody tr.sel { background: rgba(79,139,255,0.14); }
table.udb tbody tr { cursor: pointer; }
.bulkbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(79,139,255,0.1), rgba(124,92,255,0.06)), var(--panel);
  border: 1px solid rgba(79,139,255,0.5); border-radius: var(--radius);
  padding: 10px 14px; font-size: 14px; animation: fadeInUp 0.25s var(--ease) both;
}
.bulkbar b { color: var(--text); }
.bulkbar .spacer { flex: 1; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2,4,9,0.66);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 30; padding: 20px;
  animation: fadeIn 0.2s var(--ease) both;
}
.modal {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--panel);
  border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 440px; padding: 24px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,0.8);
  animation: popIn 0.3s var(--ease) both;
}
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .field { margin-bottom: 13px; }
.modal label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.modal .actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.modal .actions .spacer { flex: 1; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 14px; margin-bottom: 6px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-weight: 500; word-break: break-word; }
.kv .v.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.container { max-width: 900px; margin: 0 auto; padding: 26px 20px; animation: fadeInUp 0.5s var(--ease) both; }
.device-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.device {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; cursor: pointer; position: relative; overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: fadeInUp 0.45s var(--ease) both;
}
.device::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0; transition: opacity 0.25s var(--ease);
  background: radial-gradient(400px 140px at 50% -20%, rgba(79,139,255,0.14), transparent 70%); pointer-events: none;
}
.device:hover { border-color: rgba(79,139,255,0.55); transform: translateY(-3px); box-shadow: 0 14px 34px -18px rgba(0,0,0,0.85), 0 0 0 1px rgba(79,139,255,0.15); }
.device:hover::after { opacity: 1; }
.device:active { transform: translateY(-1px) scale(0.995); }
.device.offline { cursor: default; opacity: 0.68; }
.device.offline:hover { border-color: var(--border); transform: none; box-shadow: none; }
.device.offline:hover::after { opacity: 0; }
.device-grid .device:nth-child(1) { animation-delay: 0.02s; }
.device-grid .device:nth-child(2) { animation-delay: 0.07s; }
.device-grid .device:nth-child(3) { animation-delay: 0.12s; }
.device-grid .device:nth-child(4) { animation-delay: 0.17s; }
.device-grid .device:nth-child(n+5) { animation-delay: 0.2s; }
.device .name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.device .meta { color: var(--muted); font-size: 13px; margin-top: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.online { background: var(--online); box-shadow: 0 0 0 3px rgba(53,221,136,0.18); animation: pulseDot 2s var(--ease) infinite; }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 3px rgba(53,221,136,0.18); } 50% { box-shadow: 0 0 0 5px rgba(53,221,136,0.05); } }
.dot.offline { background: var(--offline); }
.empty { color: var(--muted); text-align: center; padding: 60px 0; animation: fadeIn 0.5s var(--ease) both; }

/* ---- viewer ---- */
.viewer-root { display: flex; flex-direction: column; height: 100vh; }
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.viewer-bar .spacer { flex: 1; }
.viewer-bar .status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.bar-select {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 9px; cursor: pointer;
}
.viewer-bar button { padding: 7px 11px; font-size: 13px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 20;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.stage { flex: 1; background: #000; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
/* Show the local system cursor over the video. Because each mouse move is sent
   to the host as an absolute position, the local cursor sits exactly where the
   remote cursor is - an always-visible, lag-free pointer. */
#remote { max-width: 100%; max-height: 100%; outline: none; cursor: default; }
.stage.disconnected #remote { display: none; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; text-align: center; padding: 20px; pointer-events: none;
}
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.hud {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: #d6f5df;
  background: rgba(0,0,0,0.62); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 8px 11px; pointer-events: none; white-space: pre;
}

/* ---- finishing touches ---- */
.card.pad { animation: fadeInUp 0.5s var(--ease) both; }
.bar-select { transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.bar-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.pill { transition: background 0.18s var(--ease), color 0.18s var(--ease); }
.copy-btn { transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.toast { box-shadow: 0 12px 40px -12px rgba(0,0,0,0.7); }
.viewer-bar { background: rgba(8,11,20,0.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* view-only User Database (non-owner): hide selection checkboxes */
body.viewonly table.udb .check { display: none; }

/* ---- schedule ---- */
.hero { background: linear-gradient(135deg, rgba(79,139,255,0.12), rgba(124,92,255,0.08)), var(--panel); }
.hero-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.hero-main { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.hero-sub { color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.progress { height: 8px; background: var(--panel-2); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; transition: width 0.5s linear; }
.daytabs { display: flex; gap: 6px; margin: 18px 0 14px; }
.daytab { width: 40px; padding: 8px 0; text-align: center; font-weight: 600; }
.daytab.today { border-color: rgba(79,139,255,0.4); }
.daytab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.tl-item { display: grid; grid-template-columns: 78px 4px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--panel); transition: opacity 0.2s, border-color 0.2s, transform 0.2s var(--ease); }
.tl-item .tl-time { font-size: 13px; font-weight: 600; text-align: right; line-height: 1.25; }
.tl-item .tl-bar { align-self: stretch; background: var(--c); border-radius: 3px; }
.tl-item .tl-name { font-weight: 600; font-size: 15px; }
.tl-item.past { opacity: 0.42; }
.tl-item.now { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 10px 30px -14px var(--c); transform: translateY(-1px); }
.tl-badge { font-size: 12px; font-weight: 600; color: #04060b; background: var(--c); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.daypick { display: flex; gap: 6px; }
.daypick-btn { width: 38px; padding: 8px 0; font-weight: 600; }
.daypick-btn.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* countdown digit tween */
@keyframes cdIn { from { opacity: 0; transform: translateY(-0.35em); filter: blur(1px); } to { opacity: 1; transform: none; filter: none; } }
.hero-main .cd { display: inline-block; animation: cdIn 0.42s var(--ease) both; }
.daytab, .daypick-btn { transition: transform 0.14s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease); }
textarea { transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease); }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ---- login page polish ---- */
.login-hero { position: relative; min-height: 100vh; overflow: hidden; }
.login-orb { position: fixed; border-radius: 50%; filter: blur(70px); opacity: 0.5; z-index: 0; pointer-events: none; }
.login-orb.orb-a { width: 460px; height: 460px; background: radial-gradient(circle, #4f8bff, transparent 70%); top: -120px; left: -100px; animation: orbFloatA 16s ease-in-out infinite; }
.login-orb.orb-b { width: 520px; height: 520px; background: radial-gradient(circle, #7c5cff, transparent 70%); bottom: -160px; right: -120px; animation: orbFloatB 20s ease-in-out infinite; }
@keyframes orbFloatA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(60px,50px) scale(1.1); } }
@keyframes orbFloatB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-50px,-40px) scale(1.08); } }
.login-hero .center-wrap { position: relative; z-index: 1; }
.login-card { max-width: 400px; text-align: center; }
.login-logo { font-size: 44px; margin-bottom: 8px; animation: fadeInUp 0.6s var(--ease) both; }
.login-card h1 { font-size: 24px; background: linear-gradient(120deg, #fff, #9fc0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- chat ---- */
.chat-body { overflow: hidden; }
.chat-root { display: flex; flex-direction: column; height: 100dvh; }
.chat-topbar { flex: 0 0 auto; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 7px 12px; }
.chat-conn { flex: 0 0 auto; text-align: center; font-size: 12.5px; padding: 5px; background: rgba(255,196,64,0.14); color: #ffd479; border-bottom: 1px solid var(--border); }
.chat-main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 8px; overscroll-behavior: contain; }
.chat-loadmore { text-align: center; padding: 6px 0 14px; }
.msg { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 4px 12px; border-radius: 6px; transition: background 0.1s var(--ease); }
.msg:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.msg.mentioned:hover { background: rgba(255,196,64,0.14); }
/* Newly-arrived messages spring in (iMessage-style); history/re-renders don't re-animate. */
.msg.msg-in { animation: msgIn 0.42s cubic-bezier(0.22, 1.2, 0.36, 1) both; transform-origin: left bottom; }
.msg.msg-in.mine { animation: msgInMine 0.42s cubic-bezier(0.22, 1.2, 0.36, 1) both; transform-origin: right bottom; }
.msg.msg-in .msg-content { animation: msgBubble 0.42s cubic-bezier(0.22, 1.2, 0.36, 1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes msgInMine { from { opacity: 0; transform: translateY(12px) scale(0.9); } 60% { transform: translateY(-1px) scale(1.01); } to { opacity: 1; transform: none; } }
@keyframes msgBubble { from { transform: scale(0.96); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg.msg-in, .msg.msg-in.mine, .msg.msg-in .msg-content { animation: none; } }
.msg-gutter { width: 46px; display: flex; justify-content: center; align-items: flex-start; padding-top: 2px; }
.msg-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.av-fallback { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 15px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-name { font-weight: 600; font-size: 14.5px; }
.msg-time { color: var(--muted); font-size: 11px; }
.msg-body { line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg-reply { color: var(--muted); font-size: 12.5px; border-left: 2px solid var(--accent); padding-left: 8px; margin-bottom: 3px; opacity: 0.9; }
.msg.grouped { padding-top: 0; }
.hovertime { visibility: hidden; font-size: 10px; color: var(--muted); }
.msg.grouped:hover .hovertime { visibility: visible; }
.msg.pending { opacity: 0.5; }
.deleted { color: var(--muted); }
.typing-row { color: var(--muted); font-size: 12.5px; height: 18px; padding: 2px 6px; }
.composer { flex: 0 0 auto; border-top: 1px solid var(--border-soft); background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(10px); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 44px; border-radius: 22px; padding: 11px 16px; }
.send-btn { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-size: 17px; box-shadow: 0 4px 14px -4px var(--accent-glow); transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), filter 0.14s var(--ease); }
.send-btn:hover { filter: brightness(1.1); transform: translateY(-2px) scale(1.05); box-shadow: 0 8px 22px -5px var(--accent-glow); }
.send-btn:active { transform: scale(0.92); }
.reply-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 6px 4px; }
.reply-chip button { padding: 2px 8px; font-size: 12px; }
.slow-note { padding: 5px 4px 0; }
.jump-pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 5; background: var(--accent); color: #fff; border: none; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px -6px var(--accent-glow); animation: fadeInUp 0.2s var(--ease); }

.drawer-scrim, .sheet-scrim { position: fixed; inset: 0; background: rgba(2,4,9,0.5); z-index: 40; animation: fadeIn 0.2s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 280px; max-width: 82vw; background: var(--panel); border-left: 1px solid var(--border); z-index: 41; transform: translateX(100%); transition: transform 0.28s var(--ease); padding: 16px; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.online-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.online-item .msg-av { width: 30px; height: 30px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 42; background: var(--panel); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); animation: sheetUp 0.24s var(--ease); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet button { display: block; width: 100%; text-align: left; padding: 14px 16px; margin: 4px 0; font-size: 15px; border: none; background: var(--panel-2); }
.sheet button.danger-act { color: var(--danger); }
.sheet button.cancel-act { text-align: center; color: var(--muted); background: transparent; }

@media (max-width: 640px) {
  .chat-topbar .navlink { display: none; }
  .chat-topbar .brand { margin-right: 0; }
  .chat-topbar { padding: 10px 12px; }
}

/* ---- chat: reactions, mentions ---- */
.msg.mentioned { background: rgba(255,196,64,0.10); box-shadow: inset 3px 0 0 #ffc440; border-radius: 6px; }
.mention { color: #9fc0ff; background: rgba(79,139,255,0.18); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.reacts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.react-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); }
.react-pill.mine { background: rgba(79,139,255,0.2); border-color: rgba(79,139,255,0.5); }
.react-add { padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--muted); opacity: 0; transition: opacity 0.15s; }
.msg:hover .react-add { opacity: 1; }
.react-row { display: flex; gap: 4px; padding: 4px; margin-bottom: 6px; overflow-x: auto; }
.react-row .qr { font-size: 20px; padding: 8px; border-radius: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 6px; max-height: 240px; overflow-y: auto; }
.emoji-grid .qr { font-size: 22px; padding: 6px; border-radius: 8px; background: transparent; }
.emoji-grid .qr:hover { background: var(--panel-2); }
.mention-menu { position: absolute; bottom: calc(100% + 6px); left: 12px; right: 12px; max-width: 340px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px -12px rgba(0,0,0,0.7); overflow: hidden; z-index: 8; }
.mention-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.mention-opt .msg-av { width: 26px; height: 26px; }
.mention-opt.sel, .mention-opt:hover { background: var(--panel-2); }
.composer { position: relative; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 5px; font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; vertical-align: middle; }

/* ---- report form / moderation ---- */
.report-form { padding: 6px 8px 4px; }
.report-form h3 { margin: 0 0 10px; font-size: 16px; }
.report-quote { background: var(--panel-2); border-left: 3px solid var(--danger); border-radius: 6px; padding: 8px 10px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.report-reason { display: block; padding: 8px 6px; font-size: 14px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.report-reason input { margin-right: 8px; }
/* admin reports */
.rep-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--panel); }
.rep-card.escalated { border-color: var(--danger); box-shadow: 0 0 0 1px rgba(255,93,103,0.3); }
.rep-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.rep-reason { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; background: rgba(255,93,103,0.14); color: #ff9ba1; }
.rep-body { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.rep-ctx { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--border); padding-left: 10px; margin: 6px 0; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.subtabs { display: flex; gap: 6px; margin: 4px 0 18px; }

/* ---- icons ---- */
.ic { vertical-align: -0.15em; flex: 0 0 auto; }
.nav .brand { display: inline-flex; align-items: center; gap: 7px; }
.brand-ic { width: 18px; height: 18px; flex: 0 0 auto; }
.sheet #sheetBody > button[data-act] { display: flex; align-items: center; gap: 12px; }
.sheet #sheetBody > button.cancel-act { justify-content: center; }

/* ---- pins ---- */
.pin-bar { flex: 0 0 auto; background: rgba(255,196,64,0.07); border-bottom: 1px solid var(--border); font-size: 13px; }
.pin-head { display: flex; align-items: center; gap: 6px; padding: 8px 16px; cursor: pointer; color: #ffd479; font-weight: 600; }
.pin-list { padding: 0 16px 8px; max-height: 160px; overflow-y: auto; }
.pin-item { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--border-soft); cursor: pointer; }
.pin-item b { color: var(--text); }
.pin-item .copy-btn { margin-left: auto; }
.msg.flash { animation: flashMsg 1.4s var(--ease); }
@keyframes flashMsg { 0%, 40% { background: rgba(79,139,255,0.22); } 100% { background: transparent; } }

/* ---- polls ---- */
.poll { margin-top: 4px; max-width: 440px; }
.poll-q { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.poll-opt { position: relative; display: flex; align-items: center; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.poll-opt.mine { border-color: var(--accent); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(79,139,255,0.28), rgba(124,92,255,0.22)); transition: width 0.5s var(--ease); z-index: 0; }
.poll-label { position: relative; z-index: 1; }
.poll-pct { position: relative; z-index: 1; margin-left: auto; font-weight: 600; color: var(--muted); }
.poll-total { margin-top: 2px; }
.poll-btn { flex: 0 0 auto; width: 40px; height: 44px; border-radius: 12px; background: var(--panel-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; transition: color 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease); }
.poll-btn:hover { color: var(--text); background: linear-gradient(135deg, rgba(79,139,255,0.14), rgba(124,92,255,0.10)); transform: translateY(-2px); }
.poll-btn:active { transform: translateY(0) scale(0.94); }
#cameraBtn:hover { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.send-btn .ic { vertical-align: 0; }

/* ---- search overlay ---- */
.search-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(2,4,9,0.6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 60px 16px; animation: fadeIn 0.2s var(--ease); }
.search-box { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 70px -24px rgba(0,0,0,0.8); }
.search-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.search-head input { flex: 1; }
.search-head button { flex: 0 0 auto; }
.search-results { max-height: 60vh; overflow-y: auto; }
.search-item { display: flex; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.search-item:hover { background: var(--panel-2); }
.search-item .msg-av { width: 30px; height: 30px; }
.os-ic { vertical-align: -0.18em; margin-right: 5px; }

/* ---- PWA install pill ---- */
.pwa-install {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 60; display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-weight: 600; font-size: 14px; box-shadow: 0 12px 34px -10px rgba(79,139,255,0.7);
  cursor: pointer; animation: popIn 0.35s var(--ease);
}
.pwa-install:hover { filter: brightness(1.07); }
.pwa-install.hide { animation: fadeOut 0.5s var(--ease) forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; } }
.pill-btn.active { color: var(--accent); border-color: var(--accent); }

/* ---- Direct messages ---- */
.e2ee-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--online); padding: 5px 10px; border-radius: 999px; background: rgba(63,208,125,0.1); border: 1px solid rgba(63,208,125,0.25); }
.dm-layout { flex: 1 1 auto; display: flex; min-height: 0; }
.dm-list { width: 320px; flex: 0 0 auto; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.dm-list-head { flex: 0 0 auto; padding: 14px 16px; font-size: 16px; border-bottom: 1px solid var(--border-soft); }
#threadList { overflow-y: auto; flex: 1 1 auto; }
.dm-thread { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 11px 14px; border: none; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; position: relative; }
.dm-thread:hover { background: var(--panel-2); }
.dm-thread.active { background: var(--panel-2); }
.dm-thread-main { flex: 1 1 auto; min-width: 0; }
.dm-thread-top { display: flex; justify-content: space-between; gap: 8px; }
.dm-thread-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-thread-time { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.dm-thread-sub { font-size: 12.5px; margin-top: 1px; }
.dm-unread { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.dm-req-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent-2); border: 1px solid var(--accent-2); border-radius: 6px; padding: 1px 6px; }
.dm-convo { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.dm-convo-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; color: var(--muted); padding: 30px; }
.dm-convo-empty svg { color: var(--accent); opacity: 0.7; }
.dm-convo-empty p { margin: 0; max-width: 320px; }
.dm-convo-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dm-convo-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.dm-convo-head .msg-av { width: 36px; height: 36px; }
.dm-peer-name { font-weight: 600; }
.dm-back { display: none; flex: 0 0 auto; background: transparent; border: none; padding: 4px; color: var(--text); }
.dm-request-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: rgba(124,92,255,0.08); border-bottom: 1px solid var(--border); font-size: 13.5px; }
.dm-scroll { display: flex; flex-direction: column; }
#convoMessages { display: flex; flex-direction: column; gap: 3px; }
.dm-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.dm-msg.mine { align-self: flex-end; align-items: flex-end; }
.dm-bubble { padding: 9px 13px; border-radius: 16px; background: var(--panel-2); line-height: 1.35; word-break: break-word; white-space: pre-wrap; border-bottom-left-radius: 5px; }
.dm-msg.mine .dm-bubble { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.dm-bubble.locked { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; font-size: 13px; background: transparent; border: 1px dashed var(--border); }
.dm-meta { font-size: 11px; color: var(--muted); margin: 1px 4px 5px; }
.dm-seen { font-size: 11px; color: var(--accent); margin: 0 4px 4px; }
@media (max-width: 767px) {
  .dm-list { width: 100%; }
  .dm-convo { display: none; }
  body.show-convo .dm-list { display: none; }
  body.show-convo .dm-convo { display: flex; }
  .dm-back { display: inline-flex; }
  .dm-msg { max-width: 86%; }
}
.online-link { text-decoration: none; color: var(--text); border-radius: 10px; }
.online-link:hover { background: var(--panel-2); }
.online-msg { margin-left: auto; color: var(--muted); display: inline-flex; }
.online-link:hover .online-msg { color: var(--accent); }

/* ---- chat image attachments ---- */
.msg-img-wrap { margin-top: 4px; }
.msg-img { max-width: min(320px, 72vw); max-height: 340px; border-radius: 12px; cursor: zoom-in; display: block; background: var(--panel-2); border: 1px solid var(--border); }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 4px 2px 10px; }
.attach-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.86); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: fadeIn 0.15s var(--ease); }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px -12px rgba(0,0,0,0.7); }

/* ---- custom emoji ---- */
.c-emoji { height: 1.4em; width: auto; vertical-align: -0.3em; margin: 0 1px; }
.c-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto; padding: 4px 0; }
.c-emoji-pick { padding: 6px; border-radius: 8px; background: var(--panel-2); border: 1px solid transparent; }
.c-emoji-pick:hover { border-color: var(--accent); }
.c-emoji-pick img { width: 28px; height: 28px; object-fit: contain; display: block; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 2px 8px; flex-wrap: wrap; }
.tray-head code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.emoji-admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); }
.emoji-admin-row img { width: 34px; height: 34px; object-fit: contain; background: var(--panel-2); border-radius: 6px; }
.emoji-admin-row .ea-name { font-weight: 600; }
.emoji-admin-row .ea-actions { margin-left: auto; display: flex; gap: 6px; }

/* ---- profile card, badges, countdown strip ---- */
.profile-modal { position: fixed; inset: 0; z-index: 70; background: rgba(2,4,9,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.2s var(--ease); }
.profile-card { position: relative; width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 24px 70px -24px rgba(0,0,0,0.8); animation: popIn 0.25s var(--ease); }
.pc-close { position: absolute; top: 12px; right: 12px; background: transparent; border: none; color: var(--muted); }
.pc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pc-av { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.pc-name { font-size: 19px; font-weight: 700; }
.pc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: var(--bc); background: color-mix(in srgb, var(--bc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bc) 40%, transparent); }
.pc-streak { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.pc-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.pc-stats > div { flex: 1; background: var(--panel-2); border-radius: 10px; padding: 10px; text-align: center; }
.pc-stats b { display: block; font-size: 20px; }
.pc-stats span { font-size: 12px; color: var(--muted); }
.pc-msg { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.msg-name { cursor: pointer; }
.msg-name:hover { text-decoration: underline; }
.avatar { cursor: pointer; }
.cd-strip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; background: rgba(255,107,61,0.08); border-bottom: 1px solid var(--border); color: #ffb59c; }
.cd-strip .cd-label { color: var(--text); font-weight: 600; }
.cd-strip .cd-time { margin-left: auto; font-variant-numeric: tabular-nums; color: #ff8a63; font-weight: 700; }

/* ---- animated section dropdown (admin) ---- */
.tabdrop { position: relative; margin: 6px 0 18px; max-width: 300px; }
.tabdrop-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); font-weight: 600; font-size: 15px; color: var(--text); transition: border-color 0.2s var(--ease), background 0.2s var(--ease); }
.tabdrop-btn:hover, .tabdrop.open .tabdrop-btn { border-color: var(--accent); }
.tabdrop-chev { margin-left: auto; transition: transform 0.25s var(--ease); color: var(--muted); }
.tabdrop.open .tabdrop-chev { transform: rotate(180deg); }
.tabdrop-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: 0 0 auto; }
.tabdrop-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 18px 50px -18px rgba(0,0,0,0.7); opacity: 0; transform: translateY(-8px) scale(0.98); transform-origin: top center; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.22s var(--ease); }
.tabdrop.open .tabdrop-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.tabdrop-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; background: transparent; border: none; color: var(--muted); font-weight: 500; font-size: 14px; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.tabdrop-opt:hover { background: var(--panel-2); color: var(--text); }
.tabdrop-opt.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); font-weight: 600; }

/* ---- main nav dropdown (all pages, all users) ---- */
.navdrop { position: relative; }
.navdrop-btn { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 14px; transition: border-color 0.2s var(--ease); }
.navdrop-btn:hover, .navdrop.open .navdrop-btn { border-color: var(--accent); }
.navdrop-chev { transition: transform 0.25s var(--ease); color: var(--muted); }
.navdrop.open .navdrop-chev { transform: rotate(180deg); }
.navdrop-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; z-index: 50; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 18px 50px -18px rgba(0,0,0,0.7); display: flex; flex-direction: column; gap: 2px; opacity: 0; transform: translateY(-8px) scale(0.98); transform-origin: top left; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.22s var(--ease); }
.navdrop.open .navdrop-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.navdrop-menu .navlink { display: block; width: 100%; padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.navdrop-menu .navlink[style*="display:none"], .navdrop-menu .navlink[style*="display: none"] { display: none !important; }
.navdrop-menu .navlink:hover { background: var(--panel-2); }
.navdrop-menu .navlink.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); font-weight: 600; }

/* ---- mobile refinements ---- */
@media (max-width: 600px) {
  .topbar { padding: 9px 12px; }
  .nav { gap: 6px; min-width: 0; }
  .container { padding: 20px 14px; }
  .card { padding: 18px 16px; }
  .card h1 { font-size: 19px; }
  .device-grid { grid-template-columns: 1fr; }
  .navdrop-btn { padding: 8px 11px; font-size: 13px; }
  .navdrop-menu { min-width: 190px; }
  #logout { padding: 8px 11px; font-size: 13px; }
  .acct { gap: 6px; }
  /* Chat/DMs bar packs the most controls - trim it down. */
  .chat-topbar .brand { font-size: 0; margin-right: 2px; }
  .chat-topbar .brand .brand-ic { width: 22px; height: 22px; }
  .chat-topbar .acct { gap: 5px; }
  .chat-topbar .pill-btn { padding: 8px 9px; font-size: 12px; }
  .chat-topbar #logout { padding: 8px 10px; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer-row { gap: 5px; }
  .poll-btn, .send-btn { width: 40px; height: 42px; }
  .msg-img { max-width: 78vw; }
  .profile-card, .modal, .search-box { max-width: 92vw; }
  .tabdrop { max-width: none; }
}
/* Touch targets: never let interactive controls get too small to tap. */
@media (hover: none) {
  .pill-btn, .navlink, button { min-height: 38px; }
  .navdrop-menu .navlink, .tabdrop-opt { min-height: 42px; }
}

/* ---- form select ---- */
select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.report-label { display: block; font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.report-select { width: 100%; padding: 11px 12px; border-radius: 10px; }
.file-input { width: 100%; font: inherit; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.file-input::file-selector-button { font: inherit; margin-right: 10px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; }
.pdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.pdot.online { background: var(--online); box-shadow: 0 0 6px var(--online); }
.pdot.offline { background: var(--offline); }
.pdot.active { background: #22d3a5; box-shadow: 0 0 0 0 rgba(34, 211, 165, 0.7); animation: activePulse 1.8s ease-out infinite; }
@keyframes activePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 165, 0.65); }
  70% { box-shadow: 0 0 0 6px rgba(34, 211, 165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 165, 0); }
}
.pr-name { display: inline-flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.active-tag { font-size: 10.5px; color: #22d3a5; font-weight: 600; letter-spacing: 0.02em; }
.active-tag.recent { color: var(--muted); font-weight: 500; }
.people-sec { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 12px 14px 4px; font-weight: 700; }
#peopleSearch { display: block; width: calc(100% - 24px); }

/* ---- groups + new-conversation picker ---- */
.dm-list-head { display: flex; align-items: center; justify-content: space-between; }
.dm-new { padding: 6px 12px; font-size: 13px; }
.grp-av { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.dm-author { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 4px 0 2px; }
.dm-author-av { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.picker { max-width: 440px; display: flex; flex-direction: column; gap: 10px; }
.picker-tabs { display: flex; gap: 6px; }
.picker-tab { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; font-size: 13px; }
.picker-tab.active { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--text); }
.picker-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.picker-item { width: 100%; text-align: left; border: none; background: transparent; border-radius: 10px; }
.picker-item:hover { background: var(--panel-2); }
.pick-check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; flex: 0 0 auto; }
.pick-check.on { background: var(--accent); border-color: var(--accent); }

/* ================= LIGHT THEME ================= */
:root[data-theme="light"] {
  --bg: #eef2f9; --bg-2: #f7f9fd; --panel: #ffffff; --panel-2: #eef2f8;
  --border: #d3dae8; --border-soft: #e6ebf3; --text: #101828; --muted: #5a6478;
  --accent: #2f6be0; --accent-2: #6d4cff; --accent-hover: #2159c8; --accent-glow: rgba(47,107,224,0.28);
  --online: #12a150; --offline: #9aa3b5; --danger: #e5484d;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 700px at 12% -8%, rgba(47,107,224,0.08), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(109,76,255,0.07), transparent 55%),
    linear-gradient(180deg, #f7f9fd, #eef2f9);
}
:root[data-theme="light"] * { scrollbar-color: #c9d2e2 transparent; }
:root[data-theme="light"] *::-webkit-scrollbar-thumb { background: #cdd6e6; }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,0.82); }
:root[data-theme="light"] button:not(.primary) { background: #f3f6fb; }
:root[data-theme="light"] button:not(.primary):hover { background: #e7ecf5; border-color: #c2cbdd; }
:root[data-theme="light"] input, :root[data-theme="light"] textarea, :root[data-theme="light"] select { background: #f6f8fc; }
:root[data-theme="light"] input:focus { background: #ffffff; }
:root[data-theme="light"] .nav .brand,
:root[data-theme="light"] .card h1,
:root[data-theme="light"] .login-card h1 { background: linear-gradient(120deg, #16233f, #2f6be0); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .card { box-shadow: 0 20px 50px -28px rgba(20,40,90,0.35), 0 0 0 1px rgba(20,40,90,0.03) inset; }
:root[data-theme="light"] .gbtn { background: #fff; border: 1px solid var(--border); }
:root[data-theme="light"] .dm-msg.mine .dm-bubble,
:root[data-theme="light"] .msg.mentioned { color: inherit; }
:root[data-theme="light"] .composer { background: rgba(255,255,255,0.92); }
:root[data-theme="light"] .sheet, :root[data-theme="light"] .drawer { background: var(--panel); }

/* ---- account menu (top-right) ---- */
.acctmenu { position: relative; }
.acctmenu-trigger { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.acctmenu-trigger:hover, .acctmenu.open .acctmenu-trigger { border-color: var(--accent); }
.acctmenu-av, .acctmenu-av-lg { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; flex: 0 0 auto; }
.acctmenu-av { width: 26px; height: 26px; font-size: 12px; }
.acctmenu-av-lg { width: 44px; height: 44px; font-size: 18px; }
.acctmenu-av img, .acctmenu-av-lg img { width: 100%; height: 100%; object-fit: cover; }
.acctmenu-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctmenu-pop { position: absolute; top: calc(100% + 8px); right: 0; min-width: 250px; z-index: 60; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: 0 20px 55px -20px rgba(0,0,0,0.6); opacity: 0; transform: translateY(-8px) scale(0.98); transform-origin: top right; pointer-events: none; transition: opacity 0.18s var(--ease), transform 0.2s var(--ease); }
.acctmenu.open .acctmenu-pop { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.acctmenu-head { display: flex; align-items: center; gap: 11px; padding: 8px 8px 10px; }
.acctmenu-id { min-width: 0; }
.acctmenu-fullname { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acctmenu-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-badge { display: inline-block; margin-top: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); }
.role-badge.owner { color: #ffce55; background: rgba(255,196,64,0.14); border-color: rgba(255,196,64,0.35); }
.acctmenu-theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; font-size: 13px; }
.theme-switch { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.theme-switch button { padding: 5px 12px; border-radius: 999px; border: none; background: transparent; font-size: 12px; font-weight: 600; color: var(--muted); }
.theme-switch button.on { background: var(--accent); color: #fff; }
.acctmenu-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.acctmenu-item { display: block; padding: 10px 12px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: 14px; }
.acctmenu-item:hover { background: var(--panel-2); color: var(--text); }
.acctmenu-item.danger { color: var(--danger); }

/* ---- settings page ---- */
.set-row { display: flex; align-items: center; gap: 14px; }
.set-avatar { width: 68px; height: 68px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 26px; }
.set-avatar img { width: 100%; height: 100%; object-fit: cover; }
.card.pad h3 { font-size: 16px; margin: 0 0 12px; }
.grp-edit { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.grp-edit .set-avatar { width: 52px; height: 52px; font-size: 20px; }
.grp-edit input[type="text"] { width: 100%; }
.dm-open-btn { display: block; margin: 0 12px 10px; padding: 10px 12px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; text-align: center; }
.dm-open-btn:hover { color: #fff; filter: brightness(1.07); }

/* ---- schedule rolling countdown (odometer) ---- */
.cd-num { display: inline-flex; align-items: baseline; font-variant-numeric: tabular-nums; }
.cd-digit { display: inline-block; height: 1em; overflow: hidden; line-height: 1; position: relative; top: 0.02em; }
.cd-reel { display: flex; flex-direction: column; transition: transform 0.5s cubic-bezier(0.3, 1.2, 0.4, 1); will-change: transform; }
.cd-cell { height: 1em; line-height: 1; text-align: center; }
.cd-static { display: inline-block; white-space: pre; }
.ps-steps { margin: 0; padding-left: 20px; line-height: 1.75; }
.ps-steps li { margin-bottom: 9px; }
.ps-bm { display: inline-block; padding: 6px 12px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; cursor: grab; text-decoration: none; }
.ps-bm:hover { color: #fff; filter: brightness(1.07); }
/* The account menu supersedes the old inline name/email/avatar in the top bar. */
.topbar .acct .who { display: none; }
.topbar .acct > img.avatar { display: none; }

/* ---- PowerSchool import tabs ---- */
.ps-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ps-tab { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; font-size: 13px; }
.ps-tab.active { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--text); }

/* ---- settings layout polish ---- */
.container.settings-wrap { max-width: 720px; }
.set-profile-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.set-profile-id { min-width: 0; }
.set-name { font-size: 18px; font-weight: 700; }
.set-field { margin-top: 4px; }
.set-field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.set-field-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.card.pad { padding: 20px 22px; }

/* ================= Discord-style chat shell ================= */
.chat-shell { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.chat-sidebar { width: 236px; flex: 0 0 auto; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: rgba(0,0,0,0.12); }
:root[data-theme="light"] .chat-sidebar { background: rgba(0,0,0,0.02); }
.chat-center { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-members { width: 224px; flex: 0 0 auto; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.cs-head, .cm-head { padding: 14px 16px 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cm-head { display: flex; gap: 8px; align-items: baseline; }
.chat-members #peopleSearch { margin: 0 12px 8px; width: calc(100% - 24px); }
.chat-members #onlineList { overflow-y: auto; flex: 1 1 auto; }
.cs-channel { position: relative; display: flex; align-items: center; gap: 8px; margin: 2px 8px; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.cs-channel:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.cs-channel.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.cs-channel.active::before, .cs-thread.active::before { content: ""; position: absolute; left: -4px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2)); }
.cs-thread.active { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.cs-thread.active .cs-tn { color: var(--text); font-weight: 600; }
.cs-hash { color: var(--muted); font-weight: 700; }
.cs-section { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cs-new { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--panel-2); color: var(--text); font-size: 16px; line-height: 1; }
.cs-new:hover { color: #fff; background: var(--accent); }
.cs-thread { position: relative; display: flex; align-items: center; gap: 9px; margin: 1px 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); }
.cs-thread:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.cs-thread .msg-av { width: 30px; height: 30px; }
.cs-thread .cs-tn { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-scrim { position: absolute; inset: 0; z-index: 29; background: rgba(0,0,0,0.5); }
.only-mobile { display: none !important; }
@media (max-width: 900px) {
  .chat-members { position: absolute; right: 0; top: 0; bottom: 0; z-index: 30; width: 262px; background: var(--panel); transform: translateX(100%); transition: transform 0.25s var(--ease); }
  .chat-members.open { transform: translateX(0); box-shadow: -14px 0 44px -14px rgba(0,0,0,0.6); }
}
@media (max-width: 760px) {
  .only-mobile { display: inline-flex !important; }
  .chat-sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 31; width: 262px; transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .chat-sidebar.open { transform: translateX(0); box-shadow: 14px 0 44px -14px rgba(0,0,0,0.6); }
}

/* ---- members panel spacing polish ---- */
.chat-members .cm-head { flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px 16px 6px; }
.chat-members #drawerCounts { text-transform: none; font-weight: 500; font-size: 12px; }
.chat-members #onlineList { padding: 0 6px 12px; }
.chat-members .people-sec { padding: 12px 8px 4px; }
.chat-members .online-item { padding: 6px 8px; margin: 1px 0; border-radius: 8px; gap: 9px; }
.chat-members .online-item .msg-av { width: 30px; height: 30px; flex: 0 0 auto; }
.chat-members .online-item > span:not(.pdot):not(.online-msg) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-members .online-msg { flex: 0 0 auto; margin-left: auto; padding-left: 4px; }
.chat-members .online-link:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }

/* ---- schedule import review table ---- */
.rv-wrap { max-height: 52vh; overflow: auto; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rv-table th { text-align: left; padding: 6px 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.rv-table td { padding: 4px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
.rv-table input { width: 100%; padding: 6px 8px; font-size: 13px; }
.rv-table input[type="time"] { padding: 5px 6px; min-width: 96px; }
.rv-day { text-align: center; }
.rv-day label { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); cursor: pointer; }
.rv-day input { width: auto; margin: 0; }
.rv-del { padding: 5px 9px; color: var(--danger); background: transparent; border: none; }
.modal:has(.rv-table) { max-width: min(840px, 95vw); }

/* ---- camera / snap ---- */
.cam-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.82); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn 0.18s ease; }
.cam-box { position: relative; width: min(440px, 96vw); background: var(--panel); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.cam-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,0.45); color: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cam-stage { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #000; display: flex; align-items: center; justify-content: center; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-stage img { width: 100%; height: 100%; object-fit: cover; }
.cam-controls { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; gap: 12px; }
.cam-flip { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.15s ease; }
.cam-flip:active { transform: rotate(-180deg); }
.cam-shoot { width: 66px; height: 66px; border-radius: 50%; border: 4px solid var(--brand, #6c8cff); background: transparent; padding: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.12s ease; }
.cam-shoot:active { transform: scale(0.92); }
.cam-shoot span { width: 100%; height: 100%; border-radius: 50%; background: linear-gradient(135deg, #6c8cff, #9d6cff); display: block; }
.cam-review { display: flex; gap: 10px; padding: 14px 18px; }
.cam-review button { flex: 1; padding: 11px; border-radius: 12px; font-size: 14px; font-weight: 600; }

/* ---- interaction polish ---- */
.online-link .msg-av, .msg-av { transition: transform 0.15s var(--ease); }
.online-link:hover .msg-av { transform: scale(1.08); }
.online-item { transition: background 0.14s var(--ease); }
.react-chip { transition: transform 0.12s var(--ease), background 0.14s var(--ease), border-color 0.14s var(--ease); }
.react-chip:hover { transform: translateY(-1px); }
.cs-thread, .navlink, .daytab, .daypick-btn { transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.12s var(--ease); }
.cs-thread:active, .navlink:active { transform: scale(0.98); }

/* ---- per-conversation presence ---- */
.dm-status-row { display: flex; align-items: center; gap: 6px; }
.dm-status-row .pdot { width: 7px; height: 7px; }
.pdot.recent { background: var(--muted); box-shadow: none; animation: none; }
#peerStatus.is-active { color: #22d3a5; font-weight: 600; }
#peerStatus.is-recent { color: var(--muted); font-weight: 500; transition: color 0.3s var(--ease); }

/* ---- DM block button + blocked state ---- */
.dm-block-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; background: rgba(229,72,77,0.12); color: #ff6b6f; border: 1px solid rgba(229,72,77,0.35); transition: background 0.15s var(--ease), transform 0.12s var(--ease); }
.dm-block-btn:hover { background: rgba(229,72,77,0.2); transform: translateY(-1px); }
.dm-block-btn:active { transform: scale(0.96); }
.dm-block-btn svg { flex: 0 0 auto; }
.dm-block-btn.is-blocked { background: var(--danger, #e5484d); color: #fff; border-color: transparent; }
.dm-blocked-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: rgba(229,72,77,0.1); border-bottom: 1px solid rgba(229,72,77,0.25); font-size: 13.5px; color: var(--text); }
.dm-blocked-bar button { flex: 0 0 auto; }

/* ---- DM / group message entrance (iMessage-style) ---- */
.dm-msg.dm-in { animation: dmIn 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both; transform-origin: left bottom; }
.dm-msg.mine.dm-in { animation: dmInMine 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both; transform-origin: right bottom; }
@keyframes dmIn { from { opacity: 0; transform: translateY(10px) translateX(-6px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes dmInMine { from { opacity: 0; transform: translateY(10px) translateX(8px) scale(0.88); } 60% { transform: translateY(-1px) scale(1.02); } to { opacity: 1; transform: none; } }

/* ---- send-button "whoosh" on tap ---- */
.send-btn.sending, .poll-btn.sending { animation: sendPop 0.4s var(--ease); }
@keyframes sendPop { 0% { transform: scale(1); } 35% { transform: scale(0.82) rotate(-8deg); } 70% { transform: scale(1.12) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }

/* ---- global tactile feedback: everything springs a touch on press ---- */
button { transition: transform 0.12s var(--ease), filter 0.14s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease); }
button:active:not(:disabled) { transform: scale(0.97); }
.dm-thread, .cs-thread, .online-item, .navlink, a.card { transition: background 0.16s var(--ease), transform 0.12s var(--ease), box-shadow 0.16s var(--ease); }
.dm-thread:active, .cs-thread:active { transform: scale(0.985); }

@media (prefers-reduced-motion: reduce) {
  .dm-msg.dm-in, .dm-msg.mine.dm-in, .send-btn.sending, .poll-btn.sending, button:active:not(:disabled) { animation: none; transform: none; }
}

/* ---- Snapchat-style view-once snaps ---- */
.snap-chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 600; cursor: default; margin-top: 2px; }
.snap-chip .ic { width: 15px; height: 15px; }
.snap-chip.tap { cursor: pointer; color: #fff; background: linear-gradient(135deg, #a855f7, #6c5cff); box-shadow: 0 6px 18px -8px rgba(124,92,255,0.7); animation: snapPulse 2s ease-in-out infinite; }
.snap-chip.tap:hover { filter: brightness(1.08); transform: translateY(-1px); }
.snap-chip.tap:active { transform: scale(0.97); }
.snap-chip.me { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border-soft); }
.snap-chip.opened { background: transparent; color: var(--muted); border: 1px solid var(--border-soft); }
@keyframes snapPulse { 0%,100% { box-shadow: 0 6px 18px -8px rgba(124,92,255,0.7); } 50% { box-shadow: 0 6px 24px -6px rgba(168,85,247,0.9); } }
.snap-view { position: fixed; inset: 0; z-index: 300; background: #000; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; animation: fadeIn 0.15s ease; cursor: pointer; }
.snap-view img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.snap-view-hint { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); color: rgba(255,255,255,0.7); font-size: 12.5px; }

/* ---- streak badge + snap save ---- */
.dm-name-row { display: flex; align-items: center; gap: 8px; }
.dm-streak { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: #ff8a3d; background: rgba(255,138,61,0.12); border: 1px solid rgba(255,138,61,0.3); border-radius: 999px; padding: 1px 8px; }
.snap-view-bar { position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.snap-save-btn { background: linear-gradient(135deg, #a855f7, #6c5cff); color: #fff; border: none; border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px -8px rgba(124,92,255,0.7); transition: transform 0.12s var(--ease), filter 0.12s var(--ease); }
.snap-save-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.snap-save-btn:active { transform: scale(0.95); }

.dm-seen.is-seen { color: var(--accent); }

/* ---- DM/group replies ---- */
.dm-msg { position: relative; }
.dm-reply-btn { position: absolute; top: -8px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-soft); background: var(--panel-2); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity 0.12s var(--ease), color 0.12s var(--ease); }
.dm-msg:hover .dm-reply-btn { opacity: 1; }
.dm-reply-btn:hover { color: var(--text); background: var(--panel); }
.dm-reply-quote { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--accent); padding: 2px 8px; margin-bottom: 4px; opacity: 0.85; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-msg.mine .dm-reply-quote { margin-left: auto; }
.dm-reply-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; }
.dm-reply-chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-reply-chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; padding: 4px; }
.dm-reply-chip button:hover { color: var(--text); }

/* ---- conversation-list status (Snapchat colors) ---- */
.dm-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
/* FILLED = still sealed (nobody has looked yet). HOLLOW = opened.
   Colour says whose side it is: RED = your outgoing message, BLUE = incoming. */
.dm-st-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; box-sizing: border-box;
  background: transparent; border: 1.6px solid transparent;
  transition: background-color .14s ease, border-color .14s ease; }
.dm-status.st-delivered { color: #ff5d67; }           /* Delivered = red, FILLED */
.dm-status.st-delivered .dm-st-dot { background: #ff5d67; border-color: #ff5d67; }
.dm-status.st-opened { color: #ff5d67; }              /* your msg they opened = red, HOLLOW */
.dm-status.st-opened .dm-st-dot { background: transparent; border-color: #ff5d67; }
.dm-status.st-received { color: #4f8bff; }            /* their msg you opened = blue, HOLLOW */
.dm-status.st-received .dm-st-dot { background: transparent; border-color: #4f8bff; }
.dm-status.st-chat { color: #4f8bff; }                /* new incoming chat = FILLED */
.dm-status.st-chat .dm-st-dot { background: #4f8bff; border-color: #4f8bff; }
.dm-status.st-snap { color: #ff5d67; }                /* new incoming snap = FILLED */
.dm-status.st-snap .dm-st-dot { background: #ff5d67; border-color: #ff5d67; }
.dm-status.st-muted { color: var(--muted); }
.dm-status.st-muted .dm-st-dot { background: var(--muted); border-color: var(--muted); }
.dm-streak-mini { flex: 0 0 auto; align-self: center; font-size: 12px; font-weight: 700; color: #ff8a3d; margin-left: 4px; }

/* ---- message context menu + saved highlight ---- */
.msg-menu { position: fixed; z-index: 400; min-width: 150px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 5px; box-shadow: 0 14px 40px -12px rgba(0,0,0,0.6); }
.msg-menu button { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.msg-menu button:hover { background: var(--panel-2); }
.dm-msg.saved-msg .dm-bubble { box-shadow: inset 0 0 0 1.5px rgba(79,139,255,0.5); }
.dm-msg.saved-msg { background: rgba(79,139,255,0.06); border-radius: 12px; }

/* ---- presence popup ("Bitmoji"-style, uses profile picture) ---- */
.presence-pop { align-items: center; gap: 8px; padding: 6px 14px 2px; animation: fadeInUp 0.28s var(--ease); }
.pp-av { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid #22d3a5; box-shadow: 0 0 0 0 rgba(34,211,165,0.6); animation: activePulse 1.9s ease-out infinite; display: inline-flex; align-items: center; justify-content: center; margin-left: -8px; background: var(--panel-2); }
.pp-av:first-child { margin-left: 0; }
.pp-av img { width: 100%; height: 100%; object-fit: cover; }
.pp-init { font-weight: 700; font-size: 14px; color: var(--text); }
.pp-label { font-size: 12px; font-weight: 600; color: #22d3a5; }

/* ---- float presence + typing popups (no full-width bar) ---- */
.dm-convo-main { position: relative; }
.presence-pop, .typing-pop { position: absolute; left: 12px; z-index: 6; padding: 0; margin: 0; background: transparent; pointer-events: none; }
.presence-pop { bottom: 78px; }
.typing-pop { bottom: 78px; display: none; align-items: center; gap: 9px; }
.typing-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.presence-pop .typing-dots { margin-left: -2px; }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 8px 11px; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typeDot 1.3s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typeDot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* Leave room at the bottom of the message list so the floating presence/typing popup never covers the last message */
#convoMessages { padding-bottom: 56px; }

/* ---- cooler streak badge (glowing, bigger, pulsing fire) ---- */
.dm-thread-sub { margin-top: 3px; }
.dm-streak-mini { flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: 3px; font-size: 15px; font-weight: 800; color: #ffb057; margin-left: 8px; text-shadow: 0 0 8px rgba(255,140,50,0.45); }
.streak-fire { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; line-height: 1; color: #ff7a1e; animation: fireGlow 1.6s ease-in-out infinite; transform-origin: center bottom; }
.streak-fire svg { width: 100%; height: 100%; display: block; }
@keyframes fireGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255,110,20,0.7)); transform: scale(1) rotate(-2deg); }
  50% { filter: drop-shadow(0 0 10px rgba(255,175,60,1)); transform: scale(1.12) rotate(2deg); }
}

/* ---- /browser : neko (real Chromium streamed over WebRTC) ---- */
.br-wrap { height: calc(100vh - 56px); height: calc(100dvh - 56px); }
.br-stage { position: relative; width: 100%; height: 100%; background: var(--bg-2); }
.br-frame { display: none; width: 100%; height: 100%; border: 0; background: #000; }
.br-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.br-spin { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--border);
  border-top-color: var(--accent); animation: brSpin .7s linear infinite; }
@keyframes brSpin { to { transform: rotate(360deg); } }
.br-setup { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; padding: 28px; text-align: center; overflow: auto; }
.br-setup h2 { margin: 0; }
.br-setup p { max-width: 480px; margin: 0; }
.br-steps { text-align: left; max-width: 480px; margin: 8px 0; padding-left: 20px;
  color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.br-steps code { font-size: 12.5px; }
.br-pw { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 9px; font-size: 12.5px; color: var(--muted);
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--border); }
.br-copy { padding: 3px 9px; border-radius: 7px; font-size: 12px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--text); }

/* Fullscreen toggle on the Browser page — sits over the stream, fades until hover
   so it doesn't intrude on "just the browser". */
.br-full { position: absolute; right: 10px; bottom: 10px; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border-radius: 8px; color: var(--text); opacity: .25;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--border); transition: opacity .15s ease; }
.br-full:hover { opacity: 1; }
.br-stage:fullscreen { background: #000; }
.br-stage:fullscreen .br-frame { height: 100%; }

/* ---- /browser : invite-only gate ---- */
.gate { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto; opacity: 0; transition: opacity .32s ease; }
.gate.in { opacity: 1; }

/* Slow drifting colour behind the card. Sits under everything and never
   intercepts clicks. */
.gate-glow { position: absolute; inset: -30%; pointer-events: none; z-index: 0; filter: blur(70px); opacity: .5;
  background:
    radial-gradient(38% 38% at 22% 28%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    radial-gradient(34% 34% at 76% 66%, color-mix(in srgb, var(--accent-2) 50%, transparent), transparent 70%),
    radial-gradient(30% 30% at 62% 20%, color-mix(in srgb, #ff6b9d 34%, transparent), transparent 70%);
  animation: gateDrift 22s ease-in-out infinite alternate; }
@keyframes gateDrift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.03); }
}

.gate-card { position: relative; z-index: 1; width: 100%; max-width: 430px; padding: 30px 28px 26px;
  border-radius: 20px; text-align: center; backdrop-filter: blur(14px);
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--panel) 92%, transparent),
    color-mix(in srgb, var(--panel-2) 88%, transparent));
  border: 1px solid color-mix(in srgb, var(--border) 90%, var(--accent));
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.06);
  transform: translateY(14px) scale(.985);
  transition: transform .42s cubic-bezier(.2,.8,.25,1), opacity .32s ease; }
.gate.in .gate-card { transform: none; }
.gate-card.flip { transform: translateY(-10px) scale(.97); opacity: 0; }

.gate-badge { display: inline-block; margin-bottom: 16px; padding: 5px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #fff; background: linear-gradient(100deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.gate-badge.waiting { background: linear-gradient(100deg, #f0a13c, #ff6b9d); }
.gate-badge.daily { background: linear-gradient(100deg, #ffb020, #ff5d67); }
.gate-cd { font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .02em; }

.gate-icon { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--accent);
  animation: gateFloat 5s ease-in-out infinite; }
.gate-icon svg { width: 100%; height: 100%; }
@keyframes gateFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.gate-title { margin: 0 0 8px; font-size: 25px; line-height: 1.2; letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--text), color-mix(in srgb, var(--text) 62%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate-sub { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--muted); }

.gate-meter { margin: 0 0 18px; text-align: left; }
.gate-meter-head { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.gate-meter-count { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.gate-bar { height: 7px; border-radius: 99px; overflow: hidden; background: var(--bg-2);
  border: 1px solid var(--border); }
.gate-bar-fill { height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s cubic-bezier(.2,.8,.25,1); }
.gate-bar-fill.full { background: linear-gradient(90deg, #f0a13c, #ff5d67); }

.gate-why { margin: 0 0 22px; font-size: 12.8px; line-height: 1.65; color: var(--muted); }

.gate-btn { position: relative; overflow: hidden; width: 100%; height: 46px; border: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--accent) 85%, transparent);
  transition: transform .18s cubic-bezier(.2,.8,.25,1), box-shadow .18s ease, filter .18s ease; }
.gate-btn:hover:not(:disabled) { transform: translateY(-2px);
  box-shadow: 0 16px 34px -12px color-mix(in srgb, var(--accent) 95%, transparent); }
.gate-btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.gate-btn:disabled { cursor: default; filter: saturate(.35) brightness(.85); box-shadow: none; }
.gate-btn-ic { transition: transform .22s cubic-bezier(.2,.8,.25,1); }
.gate-btn:hover:not(:disabled) .gate-btn-ic { transform: translateX(4px); }
/* Sheen sweep on hover */
.gate-btn::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); }
.gate-btn:hover:not(:disabled)::after { animation: gateSheen .8s ease; }
@keyframes gateSheen { to { transform: translateX(100%); } }
.gate-btn.busy .gate-btn-label { opacity: .7; }
.gate-btn.done { background: linear-gradient(100deg, #3d8b5f, #4f8bff); }

.gate-note { margin-top: 13px; font-size: 12px; color: var(--muted); min-height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .gate, .gate-card, .gate-bar-fill, .gate-btn, .gate-btn-ic { transition: none; }
  .gate-glow, .gate-icon { animation: none; }
}

/* ---- /browser : seat it into the page rather than a raw full-bleed frame ---- */
.br-wrap { padding: 10px 12px 12px; box-sizing: border-box; }
.br-stage { border-radius: 14px; overflow: hidden; border: 1px solid var(--border);
  box-shadow: 0 18px 44px -22px rgba(0,0,0,.8); }
.br-stage:fullscreen { border-radius: 0; border: 0; }
@media (max-width: 640px) { .br-wrap { padding: 0; } .br-stage { border-radius: 0; border: 0; } }

/* ---- in-page notifications (see pages/notify.js) ----
   Push is blocked on district Chromebooks, so these are the only notification
   a student actually gets. Top-right on desktop, top on mobile. */
.nt-host { position: fixed; top: 66px; right: 14px; z-index: 9999;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
  width: min(330px, calc(100vw - 28px)); }
.nt { pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border-radius: 13px; text-decoration: none; color: var(--text);
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--panel) 96%, transparent),
    color-mix(in srgb, var(--panel-2) 94%, transparent));
  border: 1px solid var(--border);
  box-shadow: 0 16px 38px -14px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(12px);
  /* Enter: expo-out with a touch of overshoot, so it settles rather than
     stopping dead. Blur clears slightly behind the motion. Height/margin are
     animated too, so cards below slide up smoothly instead of snapping when
     one is dismissed. */
  opacity: 0; transform: translateX(115%) scale(.94); filter: blur(6px);
  transition:
    opacity .34s cubic-bezier(.22,1,.36,1),
    transform .58s cubic-bezier(.16,1.02,.28,1),
    filter .34s ease,
    margin-top .3s cubic-bezier(.4,0,.2,1); }
.nt.in { opacity: 1; transform: none; filter: none; }
.nt.out { opacity: 0; transform: translateX(115%) scale(.94); filter: blur(4px);
  margin-top: calc(-1 * var(--nt-h, 0px) - 9px);
  transition:
    opacity .24s ease,
    transform .38s cubic-bezier(.5,0,.75,0),
    filter .24s ease,
    margin-top .34s cubic-bezier(.4,0,.2,1) .06s; }
.nt:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--accent)); }

.nt-av, .nt-ic { width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto; }
.nt-av { object-fit: cover; border-radius: 50%; }
.nt-ic { display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
.nt-ic svg { width: 18px; height: 18px; }
.nt-snap .nt-ic { background: linear-gradient(140deg, #ff5d67, #ff8a3d); }
.nt-mention .nt-ic { background: linear-gradient(140deg, #f0a13c, #ff6b9d); }
.nt-access .nt-ic { background: linear-gradient(140deg, #3d9b6a, #4f8bff); }

.nt-main { flex: 1; min-width: 0; padding-top: 1px; }
.nt-title { font-size: 13.5px; font-weight: 700; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-body { margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.nt-x { flex: 0 0 auto; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); opacity: 0; transition: opacity .15s ease; }
.nt-x svg { width: 12px; height: 12px; }
.nt:hover .nt-x { opacity: 1; }
.nt-x:hover { background: var(--panel-2); color: var(--text); }

/* Thin bar that drains as the card's time runs out. */
.nt-life { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: ntLife 5.2s linear forwards; }
.nt.hold .nt-life { animation-play-state: paused; }
@keyframes ntLife { to { transform: scaleX(0); } }

@media (max-width: 640px) {
  .nt-host { top: 8px; right: 8px; left: 8px; width: auto; }
  .nt { transform: translateY(-16px) scale(.97); }
  .nt.out { transform: translateY(-16px) scale(.97); }
}
@media (prefers-reduced-motion: reduce) {
  .nt { transition: opacity .2s ease; transform: none; filter: none; }
  .nt.in { transform: none; filter: none; }
  .nt.out { transform: none; filter: none; margin-top: 0; transition: opacity .2s ease; }
  .nt-life { animation: none; display: none; }
}

/* Boot cover for the Browser page: opaque, so neko's own connecting screen and
   login form never flash through before the stream is up. */
.br-boot { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; background: #07070b;
  opacity: 0; transition: opacity .4s ease; }
.br-boot.on { opacity: 1; }
.br-boot-orb { display: flex; gap: 7px; }
.br-boot-orb span { width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  animation: brBounce 1.15s ease-in-out infinite; }
.br-boot-orb span:nth-child(2) { animation-delay: .14s; }
.br-boot-orb span:nth-child(3) { animation-delay: .28s; }
@keyframes brBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-9px); opacity: 1; }
}
.br-boot-txt { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
@media (prefers-reduced-motion: reduce) {
  .br-boot { transition: none; }
  .br-boot-orb span { animation: none; opacity: .8; }
}

/* ---- global poll banner (top of chat) ---- */
.gp { padding: 8px 12px 0; opacity: 0; transform: translateY(-8px);
  transition: opacity .3s ease, transform .42s cubic-bezier(.16,1,.3,1); }
.gp.in { opacity: 1; transform: none; }

.gp-card { position: relative; overflow: hidden; padding: 12px 14px 11px; border-radius: 14px;
  background: linear-gradient(140deg,
    color-mix(in srgb, var(--panel) 94%, transparent),
    color-mix(in srgb, var(--panel-2) 92%, transparent));
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent));
  box-shadow: 0 12px 30px -16px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05); }
/* Slow sheen across the card so a live poll reads as live. */
.gp-card::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%,
    color-mix(in srgb, var(--accent) 9%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: gpSheen 7s ease-in-out infinite; }
@keyframes gpSheen { 0%, 65% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.gp-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.gp-badge { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px -3px color-mix(in srgb, var(--accent) 75%, transparent); }
.gp-badge.done { background: linear-gradient(100deg, #6b6b78, #8b8b96); box-shadow: none; }
.gp-q { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.gp-time { flex: 0 0 auto; font-size: 11.5px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; }

.gp-opts { display: flex; flex-direction: column; gap: 6px; }
.gp-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px; border-radius: 10px; text-align: left; font-size: 13.5px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  /* Staggered entrance, one option after another. */
  opacity: 0; transform: translateY(6px);
  animation: gpIn .42s cubic-bezier(.16,1,.3,1) forwards; animation-delay: var(--d, 0ms);
  transition: border-color .16s ease, transform .14s cubic-bezier(.2,.8,.25,1); }
@keyframes gpIn { to { opacity: 1; transform: none; } }
.gp-opt:not(:disabled):hover { border-color: color-mix(in srgb, var(--border) 40%, var(--accent));
  transform: translateX(2px); }
.gp-opt:not(:disabled):active { transform: translateX(0) scale(.995); }
.gp-opt:disabled { cursor: default; }
.gp-opt.mine { border-color: var(--accent); }

.gp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; z-index: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 30%, transparent),
    color-mix(in srgb, var(--accent-2) 24%, transparent));
  transition: width .85s cubic-bezier(.16,1,.3,1); }
.gp-opt.mine .gp-fill { background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 46%, transparent),
    color-mix(in srgb, var(--accent-2) 36%, transparent)); }

.gp-tick { position: relative; z-index: 1; flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff;
  border: 1.5px solid var(--border); background: transparent;
  transition: background .22s ease, border-color .22s ease, transform .28s cubic-bezier(.2,1.5,.4,1); }
.gp-opt.mine .gp-tick { background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent; transform: scale(1.12); }
.gp-label { position: relative; z-index: 1; flex: 1; min-width: 0; }
.gp-pct { position: relative; z-index: 1; flex: 0 0 auto; font-weight: 700; font-size: 12.5px;
  color: var(--muted); font-variant-numeric: tabular-nums; }
.gp-opt.mine .gp-pct { color: var(--text); }

.gp-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

@media (max-width: 640px) { .gp { padding: 6px 8px 0; } .gp-q { font-size: 13.5px; } }
@media (prefers-reduced-motion: reduce) {
  .gp, .gp-opt, .gp-fill, .gp-tick { transition: none; animation: none; opacity: 1; transform: none; }
  .gp-card::before { animation: none; }
}

/* ---- global announcement (top of chat, above the poll) ---- */
.an { padding: 8px 12px 0; opacity: 0; transform: translateY(-10px) scale(.99);
  transition: opacity .3s ease, transform .46s cubic-bezier(.16,1,.3,1); }
.an.in { opacity: 1; transform: none; }

.an-card { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(140deg,
    color-mix(in srgb, var(--panel) 94%, transparent),
    color-mix(in srgb, var(--panel-2) 92%, transparent));
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px -16px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05); }
/* Tone lives on a left edge and the icon, so the card itself stays readable. */
.an-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--an-a), var(--an-b)); }
.an-card { --an-a: var(--accent); --an-b: var(--accent-2); }
.an-good   { --an-a: #3d9b6a; --an-b: #4f8bff; }
.an-warn   { --an-a: #f0a13c; --an-b: #ff8a3d; }
.an-urgent { --an-a: #ff5d67; --an-b: #ff8a3d; }
.an-info   { border-color: color-mix(in srgb, var(--border) 82%, var(--accent)); }
.an-warn, .an-urgent { border-color: color-mix(in srgb, var(--border) 70%, var(--an-a)); }

/* Urgent gets a slow breath so it reads as different without flashing. */
.an-urgent::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 0% 50%, color-mix(in srgb, #ff5d67 12%, transparent), transparent 60%);
  animation: anBreath 3.4s ease-in-out infinite; }
@keyframes anBreath { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.an-ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(140deg, var(--an-a), var(--an-b));
  box-shadow: 0 4px 14px -5px var(--an-a); }
.an-ic svg { width: 17px; height: 17px; }

.an-main { flex: 1; min-width: 0; }
.an-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.an-body { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--muted);
  white-space: pre-wrap; word-break: break-word; }
.an-body a { color: var(--accent); }

.an-x { flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); opacity: .55;
  transition: opacity .15s ease, background .15s ease, transform .15s cubic-bezier(.2,.8,.25,1); }
.an-x svg { width: 13px; height: 13px; }
.an-card:hover .an-x { opacity: 1; }
.an-x:hover { background: var(--panel-2); color: var(--text); transform: rotate(90deg); }

@media (max-width: 640px) { .an { padding: 6px 8px 0; } .an-title { font-size: 13.5px; } }
@media (prefers-reduced-motion: reduce) {
  .an { transition: none; opacity: 1; transform: none; }
  .an-urgent::before { animation: none; opacity: .6; }
  .an-x { transition: none; }
}

/* "(edited)" marker — sits with the text so grouped messages show it too. */
.msg-edited { margin-left: 6px; font-size: 11px; color: var(--muted); opacity: .75; vertical-align: baseline; }

/* Pinned conversations sit at the top with a small marker before the name. */
.dm-pin { display: inline-flex; width: 11px; height: 11px; margin-right: 5px; color: var(--accent);
  vertical-align: -1px; }
.dm-pin svg { width: 100%; height: 100%; }
.dm-thread.pinned { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.dm-thread.pinned:hover { background: color-mix(in srgb, var(--accent) 11%, transparent); }

/* ============================================================
   App launcher (command palette) — replaces the nav dropdown.
   Behaviour lives in /nav.js; this is the look.
   ============================================================ */
.applaunch-btn { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px 8px 11px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 14px;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .12s var(--ease); }
.applaunch-btn:hover { border-color: var(--accent); background: var(--panel-2); }
.applaunch-btn:active { transform: scale(.97); }
.applaunch-btn .al-grid { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }
.applaunch-btn .al-cur { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.applaunch-btn .al-kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; margin-left: 2px; }
.applaunch-btn .al-badge { min-width: 16px; height: 16px; padding: 0 4px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }

.applaunch-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; background: rgba(4,4,8,.62); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
.applaunch-overlay.open { opacity: 1; pointer-events: auto; }
.applaunch-panel { width: min(720px, 96vw); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.02) inset;
  transform: translateY(14px) scale(.97); opacity: 0; transition: transform .26s var(--ease), opacity .2s var(--ease); }
.applaunch-overlay.open .applaunch-panel { transform: translateY(0) scale(1); opacity: 1; }
.applaunch-searchwrap { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.applaunch-searchwrap svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.applaunch-search { flex: 1; border: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.applaunch-search::placeholder { color: var(--muted); }
.applaunch-esc { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.applaunch-groups { overflow-y: auto; padding: 10px 12px 14px; }
.applaunch-group-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 8px 8px; }
.applaunch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.applaunch-tile { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 13px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer;
  opacity: 0; transform: translateY(8px); animation: alTileIn .34s var(--ease) forwards;
  transition: border-color .14s var(--ease), background .14s var(--ease), transform .12s var(--ease); }
.applaunch-tile:hover, .applaunch-tile.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)); transform: translateY(-2px); }
.applaunch-tile.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.applaunch-tile .at-top { display: flex; align-items: center; gap: 8px; }
.applaunch-tile .at-ic { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.applaunch-tile .at-ic svg { width: 17px; height: 17px; }
.applaunch-tile .at-name { font-weight: 600; font-size: 14px; flex: 1; }
.applaunch-tile .at-badge { min-width: 17px; height: 17px; padding: 0 5px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.applaunch-tile .at-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.applaunch-tile .at-dot { position: absolute; top: 11px; right: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.applaunch-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
@keyframes alTileIn { to { opacity: 1; transform: translateY(0); } }
@media (max-width: 560px) { .applaunch-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } .applaunch-panel { max-height: 86vh; } .applaunch-overlay { padding-top: 6vh; } }

/* ============================================================
   Onboarding tour — spotlight + coach marks. Behaviour in /tour.js.
   ============================================================ */
.tour-overlay { position: fixed; inset: 0; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.tour-overlay.on { opacity: 1; pointer-events: auto; }
.tour-spot { position: absolute; border-radius: 14px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 60%, transparent), 0 0 0 9999px rgba(4,4,8,.72);
  transition: top .4s var(--ease), left .4s var(--ease), width .4s var(--ease), height .4s var(--ease), opacity .3s var(--ease); pointer-events: none; }
.tour-pop { position: absolute; width: min(330px, 90vw); background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 17px; box-shadow: 0 30px 70px -24px rgba(0,0,0,.7); z-index: 301;
  opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .28s var(--ease) .1s, transform .28s var(--ease) .1s; }
.tour-pop.show { opacity: 1; transform: translateY(0) scale(1); }
.tour-pop .tp-step { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.tour-pop .tp-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
.tour-pop .tp-text { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.tour-pop .tp-actions { display: flex; align-items: center; gap: 8px; }
.tour-pop .tp-dots { display: flex; gap: 5px; flex: 1; }
.tour-pop .tp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background .2s var(--ease), transform .2s var(--ease); }
.tour-pop .tp-dot.on { background: var(--accent); transform: scale(1.3); }
.tour-pop button { border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.tour-pop .tp-skip { background: transparent; border: none; color: var(--muted); padding: 8px 6px; }
.tour-pop .tp-skip:hover { color: var(--text); }
.tour-pop .tp-next { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; }
.tour-pop .tp-back { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.tour-welcome { position: fixed; inset: 0; z-index: 305; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(4,4,8,.7); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.tour-welcome.on { opacity: 1; pointer-events: auto; }
.tour-welcome-card { width: min(440px, 94vw); text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 30px 26px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.75); transform: translateY(16px) scale(.96); transition: transform .35s var(--ease), opacity .3s var(--ease); opacity: 0; }
.tour-welcome.on .tour-welcome-card { transform: translateY(0) scale(1); opacity: 1; }
.tour-welcome-logo { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; animation: tourFloat 4s ease-in-out infinite; }
.tour-welcome-logo svg { width: 30px; height: 30px; }
.tour-welcome h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.02em; }
.tour-welcome p { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.tour-welcome .tw-actions { display: flex; flex-direction: column; gap: 9px; }
.tour-welcome .tw-start { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; border-radius: 11px; padding: 13px; font-weight: 700; font-size: 15px; }
.tour-welcome .tw-skip { background: transparent; border: none; color: var(--muted); font-size: 13px; padding: 6px; }
@keyframes tourFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ================= /teachers ================= */
.tc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.tc-title { margin: 0; font-size: 30px; letter-spacing: -.025em;
  background: linear-gradient(100deg, var(--text), color-mix(in srgb, var(--text) 55%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.tc-sub { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }

.tc-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tc-search { position: relative; flex: 1 1 260px; }
.tc-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.tc-search input { width: 100%; padding-left: 35px; }

/* ---- grid ---- */
.tc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.tc-card { position: relative; display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 14px; border-radius: 15px; text-align: left; overflow: hidden;
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--panel) 94%, transparent),
    color-mix(in srgb, var(--panel-2) 92%, transparent));
  border: 1px solid var(--border);
  /* Staggered entrance, capped in JS so a long list does not crawl in. */
  opacity: 0; transform: translateY(10px) scale(.985);
  animation: tcIn .5s cubic-bezier(.16,1,.3,1) forwards; animation-delay: calc(var(--i, 0) * 26ms);
  transition: transform .2s cubic-bezier(.2,.8,.25,1), border-color .2s ease, box-shadow .2s ease; }
@keyframes tcIn { to { opacity: 1; transform: none; } }
.tc-card:hover { transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--border) 45%, var(--accent));
  box-shadow: 0 16px 34px -18px rgba(0,0,0,.85); }
.tc-card:active { transform: translateY(-1px) scale(.995); }
/* Light sweep across the card on hover. */
.tc-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--accent) 10%, transparent), transparent); }
.tc-card:hover::after { animation: tcSweep .75s ease; }
@keyframes tcSweep { to { transform: translateX(100%); } }

.tc-photo { width: 54px; height: 54px; border-radius: 13px; object-fit: cover; flex: 0 0 auto;
  background: var(--panel-2); }
.tc-photo-fb { display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
.tc-card-main { flex: 1; min-width: 0; }
.tc-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-dept { font-size: 12.5px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-rate { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.tc-avg { font-weight: 700; font-size: 12.5px; }
.tc-count { font-size: 11.5px; color: var(--muted); }
.tc-yours { position: absolute; top: 10px; right: 10px; font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; color: #fff;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); }

.tc-empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* ---- stars: a clipped overlay, so 4.3 actually looks like 4.3 ---- */
.tc-stars { position: relative; display: inline-block; white-space: nowrap; line-height: 0; }
.tc-stars svg { width: 15px; height: 15px; }
.tc-stars.sm svg { width: 13px; height: 13px; }
.tc-stars.xs svg { width: 11px; height: 11px; }
.tc-stars-bg { display: inline-block; color: color-mix(in srgb, var(--muted) 40%, transparent); }
.tc-stars-fg { position: absolute; left: 0; top: 0; overflow: hidden; display: inline-block;
  color: #f5b544; transition: width .7s cubic-bezier(.16,1,.3,1); }
.tc-stars-fg svg, .tc-stars-bg svg { fill: currentColor; }

/* ---- detail panel ---- */
.tc-scrim { display: none; position: fixed; inset: 0; z-index: 60; opacity: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px); transition: opacity .3s ease; }
.tc-scrim.in { opacity: 1; }
.tc-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(560px, 100vw);
  overflow-y: auto; padding: 24px 24px 40px;
  background: linear-gradient(170deg, var(--panel), var(--bg-2));
  border-left: 1px solid var(--border); box-shadow: -30px 0 70px -30px rgba(0,0,0,.9);
  transform: translateX(100%); transition: transform .38s cubic-bezier(.16,1,.3,1);
  visibility: hidden; }
.tc-panel.in { transform: none; visibility: visible; }
.tc-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  transition: color .15s ease, transform .18s cubic-bezier(.2,.8,.25,1); }
.tc-close svg { width: 14px; height: 14px; }
.tc-close:hover { color: var(--text); transform: rotate(90deg); }

.tc-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-right: 40px; }
.tc-hero-photo { width: 68px; height: 68px; border-radius: 16px; object-fit: cover; flex: 0 0 auto;
  background: var(--panel-2); font-size: 21px; }
.tc-hero-name { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.tc-hero-dept { color: var(--muted); font-size: 13px; margin-top: 2px; }

.tc-summary { display: flex; gap: 20px; align-items: center; padding: 16px; border-radius: 14px;
  background: var(--bg-2); border: 1px solid var(--border); }
.tc-big { text-align: center; flex: 0 0 auto; }
.tc-big-n { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.tc-big-c { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.tc-bars { flex: 1; min-width: 0; }
.tc-bar-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.tc-bar-n { width: 8px; }
.tc-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.tc-bar-fill { display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, #f5b544, var(--accent));
  transition: width .8s cubic-bezier(.16,1,.3,1); }
.tc-bar-fill.go { width: var(--w, 0%); }
.tc-bar-c { width: 18px; text-align: right; font-variant-numeric: tabular-nums; }

.tc-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tc-tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.tc-tag.stat b { color: var(--text); }
.tc-tag.pick { cursor: pointer; transition: border-color .16s ease, color .16s ease, transform .14s cubic-bezier(.2,.8,.25,1); }
.tc-tag.pick:hover { color: var(--text); transform: translateY(-1px); }
.tc-tag.pick.on { color: #fff; border-color: transparent;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); }

/* ---- writer ---- */
.tc-writer { margin-top: 20px; padding: 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 70%, transparent); border: 1px solid var(--border); }
.tc-writer-head { font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.tc-pick { display: flex; align-items: center; gap: 3px; margin-bottom: 12px; }
.tc-pick-s { width: 34px; height: 34px; padding: 0; border: 0; background: transparent;
  color: color-mix(in srgb, var(--muted) 45%, transparent); cursor: pointer;
  transition: color .14s ease, transform .2s cubic-bezier(.2,1.6,.4,1); }
.tc-pick-s svg { width: 26px; height: 26px; fill: currentColor; }
.tc-pick-s.on { color: #f5b544; transform: scale(1.12); }
.tc-pick-lbl { margin-left: 8px; font-size: 12.5px; color: var(--muted); min-width: 62px; }
.tc-tagpick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.tc-writer textarea { width: 100%; resize: vertical; }
.tc-writer-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.tc-writer-foot .muted-sm { flex: 1; min-width: 0; }
.tc-save { padding: 9px 18px; border: 0; border-radius: 10px; font-weight: 700; font-size: 13.5px; color: #fff;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -9px color-mix(in srgb, var(--accent) 90%, transparent);
  transition: transform .16s cubic-bezier(.2,.8,.25,1), box-shadow .16s ease, filter .16s ease; }
.tc-save:hover:not(:disabled) { transform: translateY(-2px); }
.tc-save:disabled { filter: saturate(.4) brightness(.85); }
.tc-del { padding: 9px 14px; border-radius: 10px; background: transparent;
  border: 1px solid var(--border); color: #ff5d67; font-size: 13px; }
.tc-del:hover { border-color: #ff5d67; }

.tc-pending { margin-top: 14px; padding: 10px 13px; border-radius: 11px; font-size: 12.5px;
  color: #f0a13c; background: color-mix(in srgb, #f0a13c 12%, transparent);
  border: 1px solid color-mix(in srgb, #f0a13c 30%, transparent); }

/* ---- reviews ---- */
.tc-reviews { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.tc-review { display: flex; gap: 11px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft);
  opacity: 0; transform: translateY(8px);
  animation: tcIn .45s cubic-bezier(.16,1,.3,1) forwards; animation-delay: calc(var(--i, 0) * 45ms); }
.tc-review:last-child { border-bottom: 0; }
.tc-rv-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  background: var(--panel-2); font-size: 12px; }
.tc-rv-main { flex: 1; min-width: 0; }
.tc-rv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc-rv-name { font-weight: 650; font-size: 13.5px; }
.tc-you { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  color: #fff; background: linear-gradient(100deg, var(--accent), var(--accent-2)); }
.tc-rv-when { font-size: 11px; color: var(--muted); margin-left: auto; }
.tc-rv-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tc-rv-text { margin-top: 6px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.tc-flag { margin-top: 7px; padding: 0; border: 0; background: transparent; font-size: 11px;
  color: var(--muted); opacity: .6; transition: opacity .15s ease, color .15s ease; }
.tc-review:hover .tc-flag { opacity: 1; }
.tc-flag:hover { color: #ff5d67; }
.tc-none { padding: 26px 0; text-align: center; color: var(--muted); font-size: 13px; }

.tc-loading { display: flex; gap: 6px; justify-content: center; padding: 60px 0; color: var(--muted); }
.tc-loading span { width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); animation: tcBounce 1.1s ease-in-out infinite; }
.tc-loading span:nth-child(2) { animation-delay: .14s; }
.tc-loading span:nth-child(3) { animation-delay: .28s; }
@keyframes tcBounce { 0%,80%,100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-8px); opacity: 1; } }

@media (max-width: 640px) {
  .tc-title { font-size: 24px; }
  .tc-panel { width: 100vw; padding: 20px 16px 36px; }
  .tc-summary { flex-direction: column; gap: 14px; }
  .tc-bars { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tc-card, .tc-review { animation: none; opacity: 1; transform: none; }
  .tc-card:hover { transform: none; }
  .tc-card::after { animation: none; }
  .tc-panel, .tc-scrim, .tc-bar-fill, .tc-stars-fg, .tc-pick-s, .tc-close { transition: none; }
  .tc-loading span { animation: none; }
}

/* ================= site lock (full page) ================= */
.lk { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: 24px; overflow: hidden; }
/* Slow colour drift behind the card — the page is otherwise very still. */
.lk-glow { position: absolute; inset: -30%; pointer-events: none; filter: blur(80px); opacity: .42;
  background:
    radial-gradient(38% 38% at 24% 30%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 70%),
    radial-gradient(34% 34% at 74% 66%, color-mix(in srgb, var(--accent-2) 55%, transparent), transparent 70%),
    radial-gradient(30% 30% at 60% 22%, color-mix(in srgb, #ff6b9d 30%, transparent), transparent 70%);
  animation: lkDrift 24s ease-in-out infinite alternate; }
@keyframes lkDrift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.03); }
}

.lk-card { position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 38px 32px 32px;
  border-radius: 22px; text-align: center; backdrop-filter: blur(16px);
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--panel) 92%, transparent),
    color-mix(in srgb, var(--panel-2) 88%, transparent));
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--accent));
  box-shadow: 0 30px 70px -22px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06);
  animation: lkIn .55s cubic-bezier(.16,1,.3,1) both; }
@keyframes lkIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.lk-ic { width: 68px; height: 68px; margin: 0 auto 20px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--accent) 85%, transparent);
  animation: lkFloat 5.5s ease-in-out infinite; }
.lk-ic svg { width: 32px; height: 32px; }
@keyframes lkFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.lk-title { margin: 0 0 10px; font-size: 25px; line-height: 1.25; letter-spacing: -.025em;
  background: linear-gradient(100deg, var(--text), color-mix(in srgb, var(--text) 60%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.lk-body { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--muted); white-space: pre-wrap; }
.lk-until { margin-top: 20px; display: inline-block; padding: 8px 15px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); background: var(--bg-2); border: 1px solid var(--border); }

@media (max-width: 640px) { .lk-card { padding: 30px 22px 26px; } .lk-title { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) {
  .lk-glow, .lk-ic { animation: none; }
  .lk-card { animation: none; }
}

/* ---- admin: lock preview + preset chips ---- */
.lkp { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.lkp button { padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  transition: color .15s ease, border-color .15s ease, transform .14s cubic-bezier(.2,.8,.25,1); }
.lkp button:hover { color: var(--text); transform: translateY(-1px); }
.lkp button.on { color: #fff; border-color: transparent;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); }

.lki { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lki button { width: 42px; height: 42px; padding: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  transition: color .15s ease, border-color .15s ease, transform .16s cubic-bezier(.2,.8,.25,1); }
.lki button svg { width: 20px; height: 20px; }
.lki button:hover { color: var(--text); transform: translateY(-2px); }
.lki button.on { color: #fff; border-color: transparent;
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
