/* Aegis by Artemis Gaia — obsidian monochrome, motion-first. */
/* Fonts are served by Aegis itself: no third party ever sees who opens the app. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); }

:root {
  --bg: #050505; --surface: #0b0b0b; --raised: #131313; --raised-2: #1a1a1a;
  --tint: 255,255,255; /* the colour hovers, lines and glows are mixed from */
  --line: rgba(var(--tint),.07); --line-2: rgba(var(--tint),.13); --line-3: rgba(var(--tint),.22);
  --text: #f4f4f2; --mute: #9a9a96; --dim: #5d5d5a; --paper: #f4f4f2; --ink: #050505;
  --danger: #ff5a52; --ok: #d8f5d0;
  --f-display: 'Instrument Serif', Georgia, serif;
  --f-text: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Motion system */
  --e-out: cubic-bezier(.16, 1, .3, 1);
  --e-in-out: cubic-bezier(.65, 0, .35, 1);
  --e-soft: cubic-bezier(.25, .8, .25, 1);
  --spring: linear(0, .009, .035 2.1%, .141 4.4%, .723 12.9%, .938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.104 27.9%, 1.077 31.6%, 1.033 37.1%, 1.008 42.1%, .993 47.9%, .991 54.7%, 1.002 72.6%, 1);
  --spring-soft: linear(0, .013 1.4%, .053 2.9%, .221 6.5%, .618 14.7%, .801 19.5%, .921 24.6%, .994 30.5%, 1.024 36.3%, 1.03 41.9%, 1.009 59.2%, 1);
  --t-1: 140ms; --t-2: 260ms; --t-3: 420ms; --t-4: 680ms;
  --r-1: 10px; --r-2: 16px; --r-3: 22px; --r-pill: 999px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
/* Light theme: warm paper, ink-black accents. Chosen in Settings → Appearance. */
:root[data-theme="light"] {
  --tint: 0,0,0;
  --bg: #f5f4f0; --surface: #ffffff; --raised: #eeede8; --raised-2: #e6e5df;
  --text: #0c0c0b; --mute: #66665f; --dim: #a09f98; --paper: #0c0c0b; --ink: #f5f4f0;
  --danger: #d43a31; --ok: #2f7a3b;
  color-scheme: light;
}
:root[data-theme="light"] .btn:hover { box-shadow: 0 10px 40px -12px rgba(0,0,0,.35); }
/* The viewer and calls stay dark: media reads best on black. */
.viewer, .call { --tint: 255,255,255; --bg: #050505; --surface: #0b0b0b; --raised: #131313; --text: #f4f4f2; --mute: #9a9a96; --paper: #f4f4f2; --ink: #050505; color: var(--text); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--f-text); -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 1.5px solid var(--paper); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--paper); color: var(--ink); }
.serif { font-family: var(--f-display); font-weight: 400; letter-spacing: -.01em; }
.eyebrow { font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { display: block; }
/* Icons never render at full width by default; specific contexts size them up. */
svg[viewBox="0 0 24 24"] { width: 1.3em; height: 1.3em; flex: none; }
.grain { position: fixed; inset: -50%; pointer-events: none; z-index: 100; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: grain 1.2s steps(6) infinite; }
@keyframes grain { 0%{transform:translate(0,0)} 33%{transform:translate(-3%,2%)} 66%{transform:translate(2%,-3%)} 100%{transform:translate(0,0)} }

/* ───────── Buttons & micro-interactions ───────── */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 26px; border-radius: var(--r-pill); background: var(--paper); color: var(--ink); font-weight: 500; letter-spacing: .01em; overflow: hidden; isolation: isolate;
  transition: transform var(--t-3) var(--spring), box-shadow var(--t-3) var(--e-out), opacity var(--t-2); box-shadow: 0 0 0 0 rgba(var(--tint),0); }
.btn::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 30%, rgba(0,0,0,.09) 45%, transparent 60%); transform: translateX(-120%); transition: transform var(--t-4) var(--e-out); }
.btn:hover { box-shadow: 0 10px 40px -10px rgba(var(--tint),.35); }
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: scale(.965); transition-duration: var(--t-1); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn--ghost::after { background: linear-gradient(105deg, transparent 30%, rgba(var(--tint),.08) 45%, transparent 60%); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--line-3); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { height: 40px; padding: 0 18px; font-size: 13.5px; }
.btn--block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; transition: transform var(--t-3) var(--spring); }
.btn:hover svg { transform: translateX(3px); }
.btn--sm svg { width: 16px; height: 16px; }
.btn .spin { width: 18px; height: 18px; border: 1.6px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn .spin { display: none; }
.btn.is-busy > :not(.spin) { opacity: 0; } .btn.is-busy .spin { display: block; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }

.ib { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); flex: none; transition: transform var(--t-3) var(--spring), background var(--t-2) var(--e-out), color var(--t-2); }
.ib::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--paper); opacity: 0; transform: scale(.6); transition: opacity var(--t-2) var(--e-out), transform var(--t-3) var(--spring); }
.ib:hover::before { opacity: .07; transform: scale(1); }
.ib:active { transform: scale(.88); transition-duration: var(--t-1); }
.ib svg { width: 20px; height: 20px; position: relative; }
.ib--solid { background: var(--paper); color: var(--ink); }
.ib--solid::before { display: none; }
.ib--danger { background: var(--danger); color: #fff; } .ib--danger::before { display: none; }

/* ───────── Inputs ───────── */
.field { position: relative; display: block; margin: 0 0 18px; }
.field input, .field textarea, .field select { width: 100%; height: 56px; padding: 22px 0 8px; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); outline: none; font-size: 16px; border-radius: 0; transition: border-color var(--t-2); }
.field label { position: absolute; left: 0; top: 18px; color: var(--mute); pointer-events: none; transform-origin: left top; transition: transform var(--t-3) var(--e-out), color var(--t-2); }
.field input:focus + label, .field input:not(:placeholder-shown) + label { transform: translateY(-14px) scale(.74); color: var(--text); }
.field::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--paper); transform: scaleX(0); transform-origin: left; transition: transform var(--t-3) var(--e-out); }
.field:focus-within::after { transform: scaleX(1); }
.field .hint { font-size: 12.5px; color: var(--mute); margin-top: 8px; }
.seg { display: inline-flex; padding: 4px; border-radius: var(--r-pill); background: var(--raised); position: relative; }
.seg button { position: relative; z-index: 1; height: 34px; padding: 0 16px; border-radius: var(--r-pill); font-size: 13px; color: var(--mute); transition: color var(--t-2); }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; border-radius: var(--r-pill); background: var(--paper); transition: left var(--t-3) var(--spring), width var(--t-3) var(--spring); }

/* ───────── Screens & transitions ───────── */
#app { position: fixed; inset: 0; display: flex; }
.screen { position: absolute; inset: 0; display: flex; animation: screen-in var(--t-4) var(--e-out) both; }
@keyframes screen-in { from { opacity: 0; transform: scale(1.015); filter: blur(6px); } }
.screen.leaving { animation: screen-out var(--t-3) var(--e-in-out) both; pointer-events: none; }
@keyframes screen-out { to { opacity: 0; transform: scale(.985); filter: blur(4px); } }
::view-transition-old(root) { animation: screen-out var(--t-3) var(--e-in-out) both; }
::view-transition-new(root) { animation: screen-in var(--t-4) var(--e-out) both; }

.stagger > * { animation: rise var(--t-4) var(--e-out) both; animation-delay: calc(var(--i, 0) * 55ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* Auth / onboarding */
.auth { margin: auto; width: min(420px, 100% - 48px); padding: 40px 0 calc(40px + var(--safe-b)); }
.auth .mark { width: 54px; height: 54px; margin-bottom: 44px; }
.auth h1 { font: 400 46px/1.02 var(--f-display); margin: 14px 0 14px; letter-spacing: -.02em; }
.auth h1 em { color: var(--mute); }
.auth p.lede { color: var(--mute); margin: 0 0 36px; max-width: 34ch; }
.auth .foot { margin-top: 28px; font-size: 12.5px; color: var(--dim); display: flex; gap: 8px; align-items: center; }
.auth .foot svg { width: 14px; height: 14px; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 6px 0 24px; max-width: 420px; }
.otp input { width: 100%; min-width: 0; padding: 0; }
.otp input { height: 64px; text-align: center; font: 400 30px var(--f-display); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-2); outline: none; caret-color: var(--paper); transition: border-color var(--t-2), transform var(--t-3) var(--spring), background var(--t-2); }
.otp input:focus { border-color: var(--line-3); background: var(--raised-2); }
.otp input.filled { animation: pop var(--t-3) var(--spring); border-color: var(--line-2); }
@keyframes pop { 40% { transform: scale(1.08); } }
.shake { animation: shake 420ms var(--e-out); }
@keyframes shake { 15%,55% { transform: translateX(-8px); } 35%,75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }
.meter { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin: -8px 0 8px; }
.meter i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--paper); transition: width var(--t-3) var(--e-out), opacity var(--t-2); opacity: calc(.35 + var(--v, 0) * .65); }
.phrase { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: var(--r-2); background: var(--raised); font: 500 14px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .02em; word-break: break-all; margin-bottom: 18px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--mute); margin: 4px 0 26px; cursor: pointer; }
.check input { appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-3); display: grid; place-items: center; transition: background var(--t-2), box-shadow var(--t-2); cursor: pointer; }
.check input:checked { background: var(--paper); box-shadow: none; }
.check input:checked::after { content: ''; width: 9px; height: 5px; border: 1.8px solid var(--ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); animation: pop var(--t-3) var(--spring); }

/* Key forging ritual */
.forge { position: relative; width: 132px; height: 132px; margin: 8px 0 34px; }
.forge circle { fill: none; stroke: var(--paper); stroke-width: .8; transform-origin: center; }
.forge .r1 { stroke-dasharray: 2 6; animation: spin 9s linear infinite; }
.forge .r2 { stroke-dasharray: 60 300; stroke-width: 1.4; animation: spin 1.6s var(--e-in-out) infinite; }
.forge .r3 { opacity: .25; }
.forge .core { fill: var(--paper); stroke: none; animation: breathe 1.6s var(--e-in-out) infinite; transform-origin: center; }
@keyframes breathe { 50% { transform: scale(.7); opacity: .6; } }
.forge.done .r2 { animation: none; stroke-dasharray: 400 0; transition: stroke-dasharray var(--t-4) var(--e-out); }

/* Aegis mark: the two arcs close in around the message */
.mark-draw .arc-l, .mark-draw .arc-r { opacity: 0; animation: arc-close 1.1s var(--spring-soft) forwards; }
.mark-draw .arc-l { --from: -9px; }
.mark-draw .arc-r { --from: 9px; animation-delay: .06s; }
.mark-draw .core { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: core-pop .7s .5s var(--spring) forwards; }
@keyframes arc-close { from { opacity: 0; transform: translateX(var(--from)); } 35% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes core-pop { to { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

/* ───────── Main layout ───────── */
.shell { position: absolute; inset: 0; display: grid; grid-template-columns: 360px 1fr; }
.pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.pane--list { border-right: 1px solid var(--line); background: var(--surface); }
.bar { flex: none; display: flex; align-items: center; gap: 10px; height: calc(64px + var(--safe-t)); padding: var(--safe-t) 14px 0 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(140%) blur(18px); -webkit-backdrop-filter: saturate(140%) blur(18px); z-index: 5; }
.bar .grow { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; font-weight: 500; }
.brand svg { width: 26px; height: 26px; }
.search { margin: 14px 16px 8px; position: relative; }
.search input { width: 100%; height: 42px; border-radius: var(--r-pill); background: var(--raised); border: 1px solid transparent; padding: 0 16px 0 40px; outline: none; font-size: 14px; transition: border-color var(--t-2), background var(--t-2); }
.search input:focus { border-color: var(--line-2); background: var(--raised-2); }
.search svg { position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; color: var(--dim); }
.list { flex: 1; overflow-y: auto; padding: 4px 8px calc(96px + var(--safe-b)); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.row { position: relative; width: 100%; display: flex; align-items: center; gap: 13px; padding: 12px; border-radius: var(--r-2); text-align: left; transition: background var(--t-2) var(--e-out), transform var(--t-3) var(--spring); animation: rise var(--t-4) var(--e-out) both; animation-delay: calc(var(--i, 0) * 28ms); }
.row:hover { background: rgba(var(--tint),.035); }
.row:active { transform: scale(.985); }
.row[aria-current="true"] { background: var(--raised-2); }
.row[aria-current="true"]::before { content: ''; position: absolute; left: -8px; top: 18px; bottom: 18px; width: 2px; border-radius: 2px; background: var(--paper); animation: grow-y var(--t-3) var(--spring); }
@keyframes grow-y { from { transform: scaleY(0); } }
.row .meta { flex: 1; min-width: 0; }
.row .top { display: flex; align-items: baseline; gap: 8px; }
.row .name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.row .prev { font-size: 13.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.row .prev svg { width: 13px; height: 13px; flex: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 600; display: grid; place-items: center; animation: pop var(--t-3) var(--spring); }
.av { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--raised-2); font: 400 19px var(--f-display); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.av--sm { width: 32px; height: 32px; font-size: 14px; } .av--lg { width: 88px; height: 88px; font-size: 36px; }
.av--team { background: var(--paper); color: var(--ink); }
.av .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2.5px var(--surface); animation: pop var(--t-3) var(--spring); }
.av--group svg { width: 20px; height: 20px; }
.fab { position: absolute; right: 22px; bottom: calc(22px + var(--safe-b)); width: 58px; height: 58px; border-radius: 20px; background: var(--paper); color: var(--ink); display: grid; place-items: center; box-shadow: 0 16px 40px -12px rgba(var(--tint),.35); transition: transform var(--t-3) var(--spring), border-radius var(--t-3) var(--spring); z-index: 6; animation: fab-in var(--t-4) .3s var(--spring) both; }
.fab:hover { transform: translateY(-2px) rotate(90deg); border-radius: 29px; }
.fab:active { transform: scale(.9) rotate(90deg); }
.fab svg { width: 24px; height: 24px; }
@keyframes fab-in { from { transform: scale(0) rotate(-90deg); } }
.empty { margin: auto; text-align: center; padding: 40px 32px; max-width: 380px; animation: rise var(--t-4) var(--e-out) both; }
.empty h2 { font: 400 34px/1.1 var(--f-display); margin: 22px 0 10px; }
.empty p { color: var(--mute); margin: 0; }
.empty .orb { width: 120px; height: 120px; margin: 0 auto; }
.empty .orb circle { fill: none; stroke: var(--line-3); stroke-width: .6; transform-origin: center; animation: spin 40s linear infinite; }
.empty .orb circle:nth-child(2) { stroke-dasharray: 3 7; animation-duration: 26s; animation-direction: reverse; }
.skeleton { height: 70px; margin: 2px 0; border-radius: var(--r-2); background: linear-gradient(90deg, var(--raised) 0, var(--raised-2) 40%, var(--raised) 80%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── Thread ───────── */
.thread-head .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.thread-head .sub { font-size: 12px; color: var(--mute); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--t-2); }
.thread-head .sub svg { display: inline-block; vertical-align: -2px; margin: 0 2px; }
.thread-head .sub svg, .thread-head .title svg { width: 13px; height: 13px; }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 24px clamp(14px, 4vw, 48px) 12px; display: flex; flex-direction: column; gap: 2px; scroll-behavior: smooth; overscroll-behavior: contain; }
.day { align-self: center; margin: 22px 0 14px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.e2e-note { align-self: center; max-width: 440px; text-align: center; font-size: 12.5px; color: var(--mute); padding: 14px 18px; border-radius: var(--r-2); border: 1px solid var(--line); margin: 8px 0 18px; display: flex; gap: 10px; align-items: flex-start; }
.e2e-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.m { position: relative; display: flex; flex-direction: column; max-width: min(78%, 560px); align-self: flex-start; margin-top: 10px; }
.m.cont { margin-top: 2px; }
.m.mine { align-self: flex-end; align-items: flex-end; }
.m .who { font-size: 12px; color: var(--mute); margin: 0 0 4px 14px; }
.m .b { position: relative; padding: 10px 14px 9px; border-radius: 20px; background: var(--raised-2); line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; font-size: 15px; box-shadow: inset 0 0 0 1px var(--line); transform-origin: left bottom; transition: transform var(--t-3) var(--spring), filter var(--t-2); }
.m.mine .b { background: var(--paper); color: var(--ink); box-shadow: none; transform-origin: right bottom; }
.m:not(.mine).cont .b { border-top-left-radius: 7px; } .m:not(.mine):has(+ .m:not(.mine).cont) .b { border-bottom-left-radius: 7px; }
.m.mine.cont .b { border-top-right-radius: 7px; } .m.mine:has(+ .m.mine.cont) .b { border-bottom-right-radius: 7px; }
.m.enter .b { animation: bubble-in 520ms var(--spring) both; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(14px) scale(.92); } }
.m.mine.enter .b { animation: bubble-send 560ms var(--spring) both; }
@keyframes bubble-send { from { opacity: 0; transform: translate(10px, 22px) scale(.85); filter: blur(2px); } }
.m.pending .b { opacity: .55; }
.m.failed .b { box-shadow: inset 0 0 0 1px var(--danger); }
.m .t { display: inline-flex; gap: 4px; align-items: center; float: right; margin: 6px 0 -3px 12px; font-size: 10.5px; opacity: .55; font-variant-numeric: tabular-nums; }
.m .t svg { width: 14px; height: 14px; }
.m .b a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.m.deleted .b { background: transparent; color: var(--dim); font-style: italic; box-shadow: inset 0 0 0 1px var(--line); }
.m .reply-to { display: block; font-size: 12.5px; padding: 6px 10px; margin: -2px -6px 7px; border-radius: 12px; background: rgba(127,127,127,.12); border-left: 2px solid currentColor; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; cursor: pointer; }
.m .reacts { display: flex; gap: 4px; margin-top: -6px; padding: 0 8px; position: relative; z-index: 1; }
.m .reacts button { height: 24px; padding: 0 8px; border-radius: 12px; background: var(--raised); box-shadow: 0 0 0 2px var(--bg); font-size: 13px; display: flex; gap: 4px; align-items: center; animation: pop var(--t-3) var(--spring); transition: transform var(--t-3) var(--spring); }
.m .reacts button.mine { background: var(--raised-2); box-shadow: 0 0 0 2px var(--bg), inset 0 0 0 1px var(--line-3); }
.m .reacts button:active { transform: scale(.85); }
.m .reacts span { font-size: 11px; color: var(--mute); }
.m .acts { position: absolute; top: 50%; right: calc(100% + 6px); transform: translateY(-50%) scale(.9); display: flex; gap: 2px; opacity: 0; pointer-events: none; transition: opacity var(--t-2), transform var(--t-3) var(--spring); }
.m:not(.mine) .acts { right: auto; left: calc(100% + 6px); }
.m:hover .acts, .m.show-acts .acts { opacity: 1; transform: translateY(-50%) scale(1); pointer-events: auto; }
.m .acts .ib { width: 32px; height: 32px; } .m .acts .ib svg { width: 16px; height: 16px; }
.m.flash .b { animation: flash 1.1s var(--e-out); }
@keyframes flash { 20% { transform: scale(1.03); filter: brightness(1.4); } }
.m .exp { display: inline-flex; vertical-align: -2px; }
.m .exp svg { width: 12px; height: 12px; }
.file { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 2px 0; text-align: left; }
.file .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(127,127,127,.16); flex: none; transition: transform var(--t-3) var(--spring); }
.file:hover .ic { transform: scale(1.06) rotate(-4deg); }
.file .ic svg { width: 20px; height: 20px; }
.file .fn { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: block; }
.file .fs { font-size: 12px; opacity: .6; }
.img-msg { display: block; max-width: 320px; max-height: 360px; border-radius: 14px; margin: -4px -8px 4px; object-fit: cover; animation: fade-in .5s var(--e-out) both; cursor: zoom-in; }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px; border-radius: 20px; background: var(--raised-2); margin-top: 10px; animation: bubble-in 420ms var(--spring) both; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: wave 1.1s var(--e-in-out) infinite; }
.typing i:nth-child(2) { animation-delay: .14s; } .typing i:nth-child(3) { animation-delay: .28s; }
@keyframes wave { 30% { transform: translateY(-5px); opacity: 1; } 0%, 60%, 100% { opacity: .4; } }
.jump { position: absolute; right: 24px; bottom: 96px; z-index: 4; opacity: 0; transform: translateY(12px) scale(.8); pointer-events: none; transition: opacity var(--t-2), transform var(--t-3) var(--spring); background: var(--raised-2); box-shadow: 0 10px 30px -8px #000, inset 0 0 0 1px var(--line-2); }
.jump.on { opacity: 1; transform: none; pointer-events: auto; }

/* Composer */
.composer { flex: none; padding: 10px clamp(12px, 3vw, 40px) calc(14px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer .ctx { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px; border-radius: var(--r-2); background: var(--raised); font-size: 13px; color: var(--mute); animation: rise var(--t-3) var(--e-out) both; }
.composer .ctx b { color: var(--text); font-weight: 500; }
.composer .ctx .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .box { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 26px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--t-2), background var(--t-2); }
.composer .box:focus-within { box-shadow: inset 0 0 0 1px var(--line-3); background: var(--raised-2); }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: transparent; padding: 9px 4px; max-height: 180px; line-height: 1.45; font-size: 15.5px; }
.send { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; flex: none; transform: scale(0) rotate(-45deg); opacity: 0; transition: transform var(--t-3) var(--spring), opacity var(--t-2); }
.send.on { transform: none; opacity: 1; }
.send:active { transform: scale(.86); }
.send svg { width: 18px; height: 18px; }
.send.fly svg { animation: fly 520ms var(--e-out); }
@keyframes fly { 45% { transform: translate(14px, -14px); opacity: 0; } 46% { transform: translate(-14px, 14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.upl { height: 3px; background: var(--line); border-radius: 3px; margin: 0 8px 8px; overflow: hidden; }
.upl i { display: block; height: 100%; background: var(--paper); width: 30%; animation: indet 1.1s var(--e-in-out) infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ───────── Sheets / dialogs ───────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in var(--t-3) var(--e-out) both; opacity: 0; }
.scrim.out { animation: fade-out var(--t-2) var(--e-in-out) forwards; }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
.sheet { position: fixed; z-index: 41; left: 50%; top: 50%; width: min(520px, calc(100% - 32px)); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--surface); border-radius: 28px; box-shadow: 0 40px 120px -20px #000, inset 0 0 0 1px var(--line-2); transform: translate(-50%, -50%); animation: dialog-in 560ms var(--spring) both; overflow: hidden; }
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } }
.sheet.out { animation: dialog-out var(--t-2) var(--e-in-out) forwards; }
@keyframes dialog-out { to { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
.sheet .grab { display: none; }
.sheet .sh-head { display: flex; align-items: center; gap: 12px; padding: 22px 18px 10px 28px; }
.sheet .sh-head h2 { flex: 1; margin: 0; font: 400 30px/1.1 var(--f-display); }
.sheet .sh-body { padding: 8px 28px 28px; overflow-y: auto; }
.sheet .sh-foot { padding: 14px 28px calc(22px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border-radius: 14px; text-align: left; transition: background var(--t-2); }
.pick:hover { background: rgba(var(--tint),.04); }
.pick .meta { flex: 1; min-width: 0; } .pick .meta small { display: block; color: var(--mute); font-size: 12.5px; }
.pick .tick { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-3); display: grid; place-items: center; transition: background var(--t-2), box-shadow var(--t-2), transform var(--t-3) var(--spring); }
.pick[aria-pressed="true"] .tick { background: var(--paper); box-shadow: none; transform: scale(1.08); }
.pick[aria-pressed="true"] .tick::after { content: ''; width: 9px; height: 5px; border: 1.8px solid var(--ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; min-height: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 15px; background: var(--raised-2); font-size: 13px; animation: pop var(--t-3) var(--spring); }
.chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; opacity: .6; } .chip button:hover { opacity: 1; } .chip svg { width: 12px; height: 12px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { font-weight: 500; } .kv .k small { display: block; font-weight: 400; color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.section-t { margin: 26px 0 6px; display: flex; align-items: center; gap: 8px; }
.safety { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; padding: 20px; border-radius: var(--r-2); background: var(--raised); font: 500 17px ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .06em; text-align: center; margin: 14px 0; }
.safety span { animation: rise var(--t-4) var(--e-out) both; animation-delay: calc(var(--i) * 30ms); }
.verified { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); }
.verified svg { width: 14px; height: 14px; }
.warn { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-2); background: rgba(255,90,82,.08); box-shadow: inset 0 0 0 1px rgba(255,90,82,.3); color: #ffcfcc; font-size: 13.5px; margin: 0 0 16px; animation: rise var(--t-3) var(--e-out) both; }
.warn svg { width: 18px; height: 18px; flex: none; color: var(--danger); }
.menu { position: fixed; z-index: 50; min-width: 200px; padding: 6px; border-radius: 18px; background: var(--raised); box-shadow: 0 24px 60px -10px #000, inset 0 0 0 1px var(--line-2); transform-origin: var(--ox, top right); animation: menu-in 380ms var(--spring) both; }
@keyframes menu-in { from { opacity: 0; transform: scale(.85); } }
.menu.out { animation: fade-out 140ms forwards; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px; border-radius: 12px; font-size: 14px; text-align: left; transition: background var(--t-1); }
.menu button:hover { background: rgba(var(--tint),.06); }
.menu button svg { width: 17px; height: 17px; color: var(--mute); }
.menu button.danger { color: var(--danger); } .menu button.danger svg { color: var(--danger); }
.menu .emojis { display: flex; gap: 2px; padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .emojis button { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 20px; border-radius: 50%; transition: transform var(--t-3) var(--spring), background var(--t-1); }
.menu .emojis button:hover { transform: scale(1.25) translateY(-2px); background: transparent; }

/* Toasts */
.toasts { position: fixed; z-index: 90; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill); background: var(--paper); color: var(--ink); font-size: 13.5px; font-weight: 500; box-shadow: 0 20px 50px -12px rgba(0,0,0,.8); animation: toast-in 520ms var(--spring) both; pointer-events: auto; }
.toast.err { background: var(--danger); color: #fff; }
.toast.out { animation: toast-out 260ms var(--e-in-out) forwards; }
.toast svg { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-24px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* Lock overlay */
.locked-veil { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; animation: fade-in var(--t-3) both; }

/* ───────── Calls ───────── */
.call { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; animation: call-in 640ms var(--e-out) both; }
@keyframes call-in { from { opacity: 0; transform: scale(1.04); filter: blur(10px); } }
.call.out { animation: dialog-out var(--t-3) var(--e-in-out) forwards; }
.call .stage { flex: 1; position: relative; display: grid; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.call .tile { position: relative; border-radius: 22px; overflow: hidden; background: var(--surface); display: grid; place-items: center; animation: tile-in 620ms var(--spring) both; }
@keyframes tile-in { from { opacity: 0; transform: scale(.9); } }
.call video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call .tile .label { position: absolute; left: 14px; bottom: 12px; font-size: 13px; padding: 5px 10px; border-radius: 10px; background: rgba(0,0,0,.5); backdrop-filter: blur(10px); }
.call .self { position: absolute; right: 18px; top: calc(18px + var(--safe-t)); width: min(26vw, 180px); aspect-ratio: 3/4; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px -10px #000, 0 0 0 1px var(--line-2); z-index: 2; cursor: grab; transition: transform var(--t-3) var(--spring); animation: tile-in 700ms .15s var(--spring) both; }
.call .self video { transform: scaleX(-1); }
.call .pulse { position: relative; display: grid; place-items: center; }
.call .pulse::before, .call .pulse::after { content: ''; position: absolute; inset: -18px; border-radius: 50%; border: 1px solid var(--line-3); animation: ring 2.4s var(--e-out) infinite; }
.call .pulse::after { animation-delay: 1.2s; }
@keyframes ring { from { transform: scale(.85); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.call .info { text-align: center; } .call .info h2 { font: 400 40px var(--f-display); margin: 26px 0 6px; } .call .info p { color: var(--mute); margin: 0; font-variant-numeric: tabular-nums; }
.call .controls { display: flex; justify-content: center; gap: 14px; padding: 18px 0 calc(28px + var(--safe-b)); }
.call .controls .ib { width: 60px; height: 60px; background: rgba(var(--tint),.1); backdrop-filter: blur(20px); }
.call .controls .ib svg { width: 24px; height: 24px; }
.call .controls .ib[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.call .controls .ib--danger { background: var(--danger); }
.call .enc { position: absolute; left: 50%; top: calc(18px + var(--safe-t)); transform: translateX(-50%); font-size: 11.5px; color: var(--mute); display: flex; gap: 6px; align-items: center; letter-spacing: .04em; z-index: 3; }
.call .enc svg { width: 13px; height: 13px; }
.ringer { position: fixed; z-index: 75; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); width: min(420px, calc(100% - 24px)); display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 18px; border-radius: 26px; background: var(--raised); box-shadow: 0 30px 80px -10px #000, inset 0 0 0 1px var(--line-2); animation: toast-in 640ms var(--spring) both; }
.ringer .meta { flex: 1; min-width: 0; } .ringer small { color: var(--mute); display: block; font-size: 12.5px; }
.ringer .ib--solid { background: var(--ok); color: var(--ink); }
.ringer .av { animation: breathe-av 1.4s var(--e-in-out) infinite; }
@keyframes breathe-av { 50% { box-shadow: 0 0 0 8px rgba(var(--tint),.06); } }

/* ───────── Mobile ───────── */
@media (max-width: 759px) {
  .shell { grid-template-columns: 1fr; overflow: hidden; }
  .pane { grid-area: 1 / 1; transition: transform 560ms var(--e-out), filter 560ms var(--e-out), opacity 560ms; will-change: transform; }
  .pane--thread { transform: translateX(100%); box-shadow: -30px 0 60px -20px #000; z-index: 2; }
  .shell.in-thread .pane--thread { transform: none; }
  .shell.in-thread .pane--list { transform: translateX(-24%); filter: brightness(.55); }
  .back { display: grid; }
  .m { max-width: 86%; }
  .m .acts { display: none; }
  .sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 92vh; border-radius: 28px 28px 0 0; transform: none; animation: sheet-up 620ms var(--spring-soft) both; touch-action: none; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet.out { animation: sheet-down 320ms var(--e-in-out) forwards; }
  @keyframes sheet-down { to { transform: translateY(100%); } }
  .sheet .grab { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-3); margin: 10px auto 0; flex: none; }
  .auth h1 { font-size: 40px; }
  .jump { bottom: 90px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .grain { display: none; }
}
.ringer.out { animation: toast-out 260ms var(--e-in-out) forwards; }

/* ───────── Secure viewer: view only, watermarked, shielded ───────── */
.file-wrap { display: grid; gap: 6px; }
.img-ph { width: 260px; height: 170px; border-radius: 14px; margin: -4px -8px 4px; background: linear-gradient(100deg, rgba(127,127,127,.10) 30%, rgba(127,127,127,.22) 50%, rgba(127,127,127,.10) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
canvas.img-msg { width: min(320px, 100%); height: auto; max-height: none; }
.img-msg, .file, .viewer { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.file .fd { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--mute); margin-bottom: 2px; }
.file .fd svg { width: 12px; height: 12px; }
.file .open { margin-left: auto; opacity: .55; transition: opacity var(--t-2), transform var(--t-3) var(--spring); }
.file .open svg { width: 18px; height: 18px; }
.file:hover .open { opacity: 1; transform: scale(1.08); }

.viewer { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto 1fr; background: rgba(5,5,5,.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); opacity: 0; transform: scale(.985); transition: opacity var(--t-3) var(--e-out), transform var(--t-4) var(--spring-soft); }
.viewer.in { opacity: 1; transform: none; }
.viewer.out { opacity: 0; transform: scale(.985); transition-duration: 220ms; }
.vw-bar { display: flex; align-items: center; gap: 14px; padding: max(12px, env(safe-area-inset-top)) 18px 12px; border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.vw-title { min-width: 0; flex: 1; display: grid; }
.vw-title b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-title small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--mute); }
.vw-title small svg { width: 12px; height: 12px; }
.vw-count { font-size: 12px; color: var(--mute); white-space: nowrap; }
.vw-stage { overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 16px 60px; position: relative; z-index: 1; overscroll-behavior: contain; }
.vw-stage > * { flex-shrink: 0; }
.vw-loading { margin: auto; display: flex; align-items: center; gap: 12px; color: var(--mute); }
.vw-loading .spin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); border-top-color: var(--paper); animation: spin .8s linear infinite; }
.vw-img { max-width: 100%; height: auto; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: rise var(--t-4) var(--e-out) both; }
.vw-media { max-width: min(100%, 1100px); max-height: calc(100vh - 140px); border-radius: 14px; background: #000; margin: auto; }
.vw-audio { margin: auto; display: grid; justify-items: center; gap: 14px; padding: 34px; border-radius: 22px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.vw-audio svg { width: 34px; height: 34px; }
.vw-page { background: #fff; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.45); max-width: 100%; overflow: hidden; }
.vw-page canvas { width: 100%; height: 100%; display: block; }
.vw-doc { width: min(820px, 100%); background: #fbfbf9; color: #111; border-radius: 8px; padding: clamp(28px, 6vw, 72px); line-height: 1.65; font-size: 15px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.vw-doc h1, .vw-doc h2, .vw-doc h3 { font-family: 'Instrument Serif', serif; font-weight: 400; line-height: 1.15; margin: 1.2em 0 .5em; }
.vw-doc table { border-collapse: collapse; margin: 1em 0; } .vw-doc td, .vw-doc th { border: 1px solid #ddd; padding: 6px 10px; }
.vw-doc img { max-width: 100%; height: auto; pointer-events: none; }
.vw-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-self: stretch; max-width: 1100px; margin: 0 auto; width: 100%; }
.vw-tabs button { padding: 7px 14px; border-radius: var(--r-pill); font-size: 13px; color: var(--mute); box-shadow: inset 0 0 0 1px var(--line); transition: background var(--t-2), color var(--t-2); }
.vw-tabs button[aria-pressed=true] { background: var(--paper); color: var(--ink); }
.vw-sheet { width: 100%; max-width: 1100px; overflow: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.vw-sheet table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.vw-sheet td { border: 1px solid var(--line); padding: 6px 10px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.vw-sheet tr:first-child td { background: var(--raised); font-weight: 500; position: sticky; top: 0; }
.vw-note { padding: 10px 12px; font-size: 12px; color: var(--mute); }
.vw-text { width: min(900px, 100%); white-space: pre-wrap; word-break: break-word; font: 13.5px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; padding: 24px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.vw-mark { position: fixed; inset: 0; z-index: 2; pointer-events: none; background-repeat: repeat; mix-blend-mode: difference; opacity: .9; }
.vw-shield { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: var(--bg); }
.vw-shield-in { display: grid; justify-items: center; gap: 12px; text-align: center; max-width: 320px; padding: 24px; animation: rise var(--t-4) var(--e-out) both; }
.vw-shield-in svg.aegis-mark { width: 44px; height: 44px; margin-bottom: 8px; }
.vw-shield-in p { font-size: 28px; margin: 0; } .vw-shield-in small { color: var(--mute); line-height: 1.5; }
.viewer.is-shielded .vw-stage, .viewer.is-shielded .vw-mark { visibility: hidden; }
.app-shield { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); }
.app-shield svg { width: 56px; height: 56px; color: var(--paper); }
html.viewing, html.viewing body { overflow: hidden; }

/* Printing is disabled: the page prints blank. */
@media print { body * { display: none !important; } body::after { content: 'Printing is disabled in Aegis.'; display: block; font: 16px sans-serif; padding: 40px; } }

/* Department label next to team members */
.who .dept { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-pill); font-size: 10.5px; letter-spacing: .04em; color: var(--mute); box-shadow: inset 0 0 0 1px var(--line-2); vertical-align: 1px; }
.who:has(> .dept:only-child) .dept { margin-left: 0; }
.as-pill { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px 6px; padding: 5px 12px; border-radius: var(--r-pill); font-size: 12px; color: var(--mute); box-shadow: inset 0 0 0 1px var(--line-2); transition: color var(--t-2), box-shadow var(--t-2), transform var(--t-3) var(--spring); }
.as-pill:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-3); }
.as-pill:active { transform: scale(.96); }
.as-pill b { font-weight: 500; color: var(--text); }
.dept-groups { display: grid; gap: 18px; max-height: min(60vh, 520px); overflow: auto; margin: 0 -4px; padding: 0 4px; }
.dept-groups .eyebrow { margin-bottom: 8px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { padding: 8px 14px; border-radius: var(--r-pill); font-size: 13px; box-shadow: inset 0 0 0 1px var(--line-2); transition: background var(--t-2), color var(--t-2), transform var(--t-3) var(--spring); }
.chip-btn:hover { box-shadow: inset 0 0 0 1px var(--line-3); }
.chip-btn:active { transform: scale(.95); }
.chip-btn[aria-pressed=true] { background: var(--paper); color: var(--ink); box-shadow: none; }
.kv--stack { flex-wrap: wrap; }
@media (max-width: 520px) { .kv { flex-wrap: wrap; } .kv > .k { flex: 1 1 100%; } }

/* Policies */
.pledge { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; }
.pledge li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--mute); }
.pledge li svg { width: 18px; height: 18px; margin-top: 2px; color: var(--text); }
.pledge b { color: var(--text); font-weight: 500; }
.policy-links { display: grid; gap: 8px; margin: 0 0 22px; }
.pl { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: var(--r-2); box-shadow: inset 0 0 0 1px var(--line); transition: background var(--t-2), box-shadow var(--t-2), transform var(--t-3) var(--spring); }
.pl:hover { background: rgba(var(--tint),.035); box-shadow: inset 0 0 0 1px var(--line-2); }
.pl:active { transform: scale(.985); }
.pl span { flex: 1; min-width: 0; } .pl b { display: block; font-weight: 500; font-size: 14px; } .pl small { display: block; color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.pl svg { width: 16px; height: 16px; color: var(--mute); transition: transform var(--t-3) var(--spring); }
.pl:hover svg { transform: translateX(3px) rotate(-90deg) !important; }
.policy { font-size: 14px; line-height: 1.65; color: var(--text); max-width: 680px; }
.policy .meta { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--mute); margin: 0 0 14px; }
.policy .lead { font-size: 15.5px; color: var(--text); margin: 0 0 8px; }
.policy h3 { font-family: var(--f-display); font-weight: 400; font-size: 22px; margin: 26px 0 8px; }
.policy p, .policy li { color: var(--mute); } .policy b { color: var(--text); font-weight: 500; }
.policy ul { padding-left: 20px; margin: 8px 0; display: grid; gap: 6px; }

/* Client focus bar (team) */
.client-bar { display: flex; align-items: center; gap: 6px; padding: 0 14px 10px; }
.client-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-2); font-size: 13px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--t-2), background var(--t-2), transform var(--t-3) var(--spring); }
.client-pick:hover { box-shadow: inset 0 0 0 1px var(--line-2); background: rgba(var(--tint),.03); }
.client-pick:active { transform: scale(.985); }
.client-pick span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.client-pick svg { width: 15px; height: 15px; color: var(--mute); }
.client-clear { width: 34px; height: 34px; }
.av--team svg.aegis-mark { width: 60%; height: 60%; }

/* Voice messages */
.mic { transition: transform var(--t-3) var(--spring), opacity var(--t-2), width var(--t-3) var(--e-out); }
.mic.off { transform: scale(0); opacity: 0; width: 0; padding: 0; margin: 0; pointer-events: none; }
.send:not(.on) { width: 0; margin: 0; }
.box.recording > :not(.rec) { visibility: hidden; }
.box { position: relative; }
.rec { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: inherit; background: var(--raised-2); animation: rise var(--t-3) var(--e-out) both; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; animation: rec-pulse 1.2s var(--e-in-out) infinite; }
@keyframes rec-pulse { 50% { opacity: .35; transform: scale(.8); } }
.rec-t { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 36px; }
.rec-wave { flex: 1; min-width: 0; height: 30px; color: var(--text); }
.voice { display: flex; align-items: center; gap: 10px; min-width: min(260px, 62vw); padding: 2px 0; }
.voice .vp { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: currentColor; transition: transform var(--t-3) var(--spring); }
.voice .vp svg { width: 16px; height: 16px; color: var(--ink); }
.m.mine .voice .vp svg { color: var(--paper); }
.voice .vp:active { transform: scale(.9); }
.voice.is-loading .vp { animation: rec-pulse 1s var(--e-in-out) infinite; }
.voice .vbars { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; }
.voice .vbars i { flex: 1; min-width: 2px; max-width: 4px; height: calc(var(--h) * 100%); border-radius: 2px; background: currentColor; opacity: .32; transition: opacity var(--t-1), transform var(--t-2) var(--spring); }
.voice .vbars i.on { opacity: 1; }
.voice.is-playing .vbars i.on:last-of-type { transform: scaleY(1.1); }
.voice .vt { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; min-width: 32px; }
.voice .vs { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px currentColor; opacity: .7; transition: opacity var(--t-2); }
.voice .vs:hover { opacity: 1; }

/* Logo moments: opening, signing in, signing out */
.splash { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); color: var(--text); transition: opacity 560ms var(--e-out), visibility 0s linear 560ms; }
.splash.leave { opacity: 0; visibility: hidden; }
.splash.leave .sp-in { transform: scale(1.06); filter: blur(2px); }
.sp-in { position: relative; display: grid; justify-items: center; gap: 22px; transition: transform 600ms var(--e-out), filter 600ms var(--e-out); }
.sp-mark { width: 84px; height: 84px; overflow: visible; }
.sp-word { font-family: var(--f-display); font-size: 30px; letter-spacing: .02em; opacity: 0; }
.sp-ring { position: absolute; top: 42px; left: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-3); opacity: 0; }
/* in: arcs travel in and close, the point lands, a ring breathes out, the name rises */
.splash.in .arc-l { animation: sp-arc-l 900ms var(--spring-soft) both; }
.splash.in .arc-r { animation: sp-arc-r 900ms 60ms var(--spring-soft) both; }
.splash.in .core { transform-box: fill-box; transform-origin: center; animation: sp-core 640ms 520ms var(--spring) both; }
.splash.in .sp-ring { animation: sp-ring 1100ms 640ms var(--e-out) both; }
.splash.in .sp-word { animation: sp-word 700ms 760ms var(--e-out) both; }
@keyframes sp-arc-l { from { transform: translateX(-26px) rotate(-14deg); opacity: 0; } 40% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes sp-arc-r { from { transform: translateX(26px) rotate(14deg); opacity: 0; } 40% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes sp-core { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes sp-ring { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(2.1); } }
@keyframes sp-word { from { opacity: 0; transform: translateY(10px); letter-spacing: .2em; } to { opacity: 1; transform: none; letter-spacing: .02em; } }
/* out: the point lets go, the arcs open and drift apart */
.splash.bye .core { transform-box: fill-box; transform-origin: center; animation: sp-core-out 520ms 120ms var(--e-in-out) both; }
.splash.bye .arc-l { animation: sp-open-l 900ms 260ms var(--e-in-out) both; }
.splash.bye .arc-r { animation: sp-open-r 900ms 260ms var(--e-in-out) both; }
.splash.bye .sp-word { animation: sp-word 600ms 200ms var(--e-out) both; font-size: 22px; color: var(--mute); }
@keyframes sp-core-out { 0% { transform: scale(1); } 30% { transform: scale(1.25); } 100% { transform: scale(0); opacity: 0; } }
@keyframes sp-open-l { to { transform: translateX(-22px) rotate(-12deg); opacity: 0; } }
@keyframes sp-open-r { to { transform: translateX(22px) rotate(12deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .splash *, .splash { animation: none !important; transition-duration: 1ms !important; } .sp-word { opacity: 1; } }
/* Tablets: side-by-side, with a slimmer list */
@media (min-width: 760px) and (max-width: 1023px) { .shell { grid-template-columns: 300px 1fr; } }

/* Faces: photos and designed avatars */
.av > img.face { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; -webkit-user-drag: none; }
.av > svg.face { width: 92%; height: 92%; }
.face-hero { display: grid; place-items: center; margin: 4px 0 18px; }
.face-hero .av { width: 96px; height: 96px; font-size: 40px; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.face-opt { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r-2); transition: background var(--t-2), transform var(--t-3) var(--spring); }
.face-opt .av { width: 52px; height: 52px; transition: transform var(--t-3) var(--spring), box-shadow var(--t-2); }
.face-opt:hover { background: rgba(var(--tint),.04); }
.face-opt:hover .av { transform: scale(1.06); }
.face-opt:active { transform: scale(.95); }
.face-opt[aria-pressed=true] .av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--paper); }
.face-opt small { font-size: 11.5px; color: var(--mute); }
