/* OmviSpace. Violet, frosted glass, pitch dark. Same design language as OmviMail. No external assets. */
@font-face { font-family: "Google Sans Flex"; font-style: normal; font-display: swap; font-weight: 100 1000; src: url(/fonts/gsf-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Google Sans Flex"; font-style: normal; font-display: swap; font-weight: 100 1000; src: url(/fonts/gsf-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f4f3f9; --sheet: rgba(255, 255, 255, .6); --sheet-line: rgba(255, 255, 255, .92);
  --panel: rgba(255, 255, 255, .66); --panel2: rgba(22, 16, 40, .055); --float: rgba(255, 255, 255, .95); --solid: #ffffff;
  --line: rgba(22, 16, 40, .1); --text: #15131c; --muted: #555162; --faint: #625e70;
  --accent: #7c3aed; --accent-text: #ffffff; --accent-soft: rgba(124, 58, 237, .13); --ink: #5b21b6; --sel: rgba(124, 58, 237, .09);
  --mine: rgba(124, 58, 237, .14); --theirs: rgba(255, 255, 255, .8);
  --danger: #b93127; --ok: #0f8a5a; --online: #12a56b;
  --shadow: 0 30px 80px rgba(22, 16, 40, .12); --shadow2: 0 18px 50px rgba(22, 16, 40, .18); --scrim: rgba(22, 16, 40, .3);
  --blob: .3; --radius: 14px; --ease: cubic-bezier(.2, .7, .2, 1);
  --blur: blur(26px) saturate(1.5);
  --font: "Google Sans", "Google Sans Flex", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --sheet: rgba(24, 22, 30, .58); --sheet-line: rgba(255, 255, 255, .09);
  --panel: rgba(255, 255, 255, .05); --panel2: rgba(255, 255, 255, .08); --float: rgba(18, 16, 24, .94); --solid: #0e0d12;
  --line: rgba(255, 255, 255, .09); --text: #f3f2f7; --muted: #a8a5b4; --faint: #918e9e;
  --accent: #7c3aed; --accent-text: #ffffff; --accent-soft: rgba(124, 58, 237, .26); --ink: #bca6ff; --sel: rgba(124, 58, 237, .16);
  --mine: rgba(124, 58, 237, .3); --theirs: rgba(255, 255, 255, .07);
  --danger: #ff8a80; --ok: #63e2b3; --online: #2bd698;
  --shadow: 0 30px 90px rgba(0, 0, 0, .9); --shadow2: 0 18px 60px rgba(0, 0, 0, .8); --scrim: rgba(0, 0, 0, .62);
  --blob: .3;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--ink); }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes dots { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Background: two soft glows */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg .blob { position: absolute; border-radius: 50%; filter: blur(130px); background: var(--accent); }
.bg .b1 { left: -160px; bottom: -220px; width: 560px; height: 560px; opacity: var(--blob); }
.bg .b2 { right: 12%; top: -280px; width: 460px; height: 460px; opacity: calc(var(--blob) * .6); }
#app { position: relative; z-index: 1; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; transition: background .2s ease, border-color .2s ease, filter .2s ease; }
.btn:hover { background: var(--panel2); }
a.btn { text-decoration: none; color: var(--text); }
a.btn.primary { color: var(--accent-text); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.12); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.icon { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.input { width: 100%; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); outline: none; transition: border-color .2s ease, box-shadow .2s ease; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.err { color: var(--danger); font-size: 13px; }
.empty { margin: auto; padding: 40px 24px; text-align: center; color: var(--muted); max-width: 380px; }
.empty b { display: block; font-size: 18px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* Avatars and presence */
.av { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; }
.av.grp { border-radius: 13px; }
.av.sm { width: 28px; height: 28px; font-size: 10px; }
.av.lg { width: 44px; height: 44px; }
.av svg.ic { width: 18px; height: 18px; }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--online); border: 2px solid var(--bg); }

/* Sign in */
.login { height: 100%; display: grid; place-items: center; padding: 20px; overflow: auto; animation: fade .5s ease both; }
.login .card { width: 100%; max-width: 380px; background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: pop .5s var(--ease) both; }
.login h1 { font-size: 24px; font-weight: 500; letter-spacing: -.02em; margin: 22px 0 4px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login .btn { width: 100%; justify-content: center; height: 46px; }
.login .err { margin-bottom: 14px; }
.brandrow { display: flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: -.01em; }
.brandrow img { width: 36px; height: 36px; display: block; }
.brandrow b { font-weight: 600; }
.brandrow span { font-weight: 500; color: var(--muted); }

/* Shell: rail, list column, pane */
.shell { height: 100%; display: flex; animation: fade .5s ease both; }
.rail { flex: 0 0 84px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; }
.rail .mark { width: 42px; height: 42px; margin-bottom: 14px; display: block; }
.rail .tab { position: relative; width: 64px; height: 58px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; transition: background .2s ease, color .2s ease; }
.rail .tab:hover { background: var(--panel2); color: var(--text); }
.rail .tab.on { background: var(--accent-soft); color: var(--ink); }
.rail .tab .n { position: absolute; top: 5px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.rail .sp { flex: 1; }
.rail .btn.icon { width: 48px; height: 48px; }
.rail .me { width: 44px; height: 44px; margin-top: 6px; cursor: pointer; }
.rail .me .dot { background: var(--faint); }
.rail .me.live .dot { background: var(--online); }

.listcol { flex: 0 0 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px 8px 0 4px; }
.listcol .top { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.listcol h1 { margin: 0; flex: 1; font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.listcol .org { font-size: 12px; color: var(--muted); padding: 0 10px; margin-top: -8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; margin: 0 8px; padding: 0 14px; border: 1px solid var(--sheet-line); border-radius: 999px; background: var(--sheet); color: var(--muted); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: box-shadow .2s ease, border-color .2s ease; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); height: 100%; }
.search input::-webkit-search-cancel-button { display: none; }
.pills { display: flex; gap: 6px; padding: 0 8px; }
.pills button { height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); transition: background .2s ease, color .2s ease; }
.pills button.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; border-color: transparent; }
.rows { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-bottom: 18px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 8px 12px; border: 0; border-radius: 16px; background: transparent; text-align: left; flex: none; transition: background .2s ease; }
.row:hover { background: var(--panel2); }
.row.on { background: var(--accent-soft); }
.row .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .l1, .row .l2 { display: flex; gap: 8px; align-items: center; }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .when { font-size: 12px; color: var(--muted); flex: none; }
.row .last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.row .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; display: grid; place-items: center; flex: none; }
.row.unread .name { font-weight: 600; }
.row.unread .last { color: var(--text); }
.row.unread .when { color: var(--ink); font-weight: 600; }
.row.off { opacity: .55; }
.rows .note { padding: 28px 16px; text-align: center; color: var(--muted); }
.rows .grp { padding: 14px 14px 4px; font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; margin: 18px 18px 18px 6px; background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 24px; box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); overflow: hidden; }
.pane.anim > * { animation: slide .35s var(--ease) both; }
.phead { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); flex: none; }
.phead .who { flex: 1; min-width: 0; }
.phead h2 { margin: 0; font-size: 17px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phead .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phead .backbtn { display: none; }
.banner { padding: 8px 20px; font-size: 13px; color: var(--muted); background: var(--panel2); border-bottom: 1px solid var(--line); flex: none; }

/* Messages */
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 8px; display: flex; flex-direction: column; }
.msgs .fill { flex: 1; }
.msgs .older { align-self: center; margin-bottom: 12px; }
.day { align-self: center; font-size: 12px; color: var(--muted); padding: 2px 12px; border: 1px solid var(--line); border-radius: 999px; margin: 14px 0 10px; }
.sys { align-self: center; font-size: 12px; color: var(--muted); margin: 6px 0; text-align: center; }
.m { display: flex; gap: 10px; max-width: min(72%, 640px); margin-top: 2px; align-items: flex-end; }
.m.first { margin-top: 12px; }
.m.mine { align-self: flex-end; flex-direction: row-reverse; }
.m .gap { width: 28px; flex: none; }
.m .col { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.m.mine .col { align-items: flex-end; }
.m .from { font-size: 12px; color: var(--muted); margin: 0 12px 3px; }
.m .bub { position: relative; padding: 9px 14px; border-radius: 18px; background: var(--theirs); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.m.mine .bub { background: var(--mine); }
.m.pending .bub { opacity: .6; }
.m.failed .bub { border-color: var(--danger); }
.m.gone .bub { color: var(--muted); font-style: italic; background: transparent; }
.m .meta { font-size: 11px; color: var(--muted); margin: 3px 8px 0; display: flex; gap: 8px; align-items: center; }
.m .meta button { border: 0; background: none; padding: 0; color: var(--danger); font-size: 11px; text-decoration: underline; }
.m .del { opacity: 0; align-self: flex-start; margin-top: 3px; width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; transition: opacity .15s ease; }
.m .del svg.ic { width: 16px; height: 16px; }
.m:hover .del, .m.sel .del, .m .del:focus-visible { opacity: 1; }
.m .del:hover { color: var(--danger); background: var(--panel2); }
.typing { height: 22px; padding: 0 28px; font-size: 12px; color: var(--muted); flex: none; display: flex; align-items: center; gap: 6px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dots 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.jump { position: absolute; right: 28px; bottom: 104px; z-index: 2; box-shadow: var(--shadow2); background: var(--float); }
.pane { position: relative; }

/* Composer */
.composer { padding: 0 18px 18px; flex: none; }
.composer .box { display: flex; align-items: flex-end; gap: 6px; min-height: 56px; padding: 6px 6px 6px 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); transition: border-color .2s ease, box-shadow .2s ease; }
.composer .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; resize: none; font-size: 15px; line-height: 1.4; padding: 11px 0; max-height: 160px; }
.composer .btn.icon { border-radius: 16px; }

/* Dialogs, menus, toasts */
.overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .2s ease both; }
.sheet { background: var(--float); border: 1px solid var(--sheet-line); border-radius: 22px; box-shadow: var(--shadow2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); width: 100%; max-width: 460px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; animation: pop .3s var(--ease) both; }
.sheet .hd { display: flex; align-items: center; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); gap: 8px; }
.sheet .hd h3 { margin: 0; font-size: 16px; font-weight: 500; flex: 1; }
.sheet .bd { padding: 16px 20px; overflow-y: auto; }
.sheet .bd p { margin: 0; }
.sheet .ft { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.sheet .ft .sp { flex: 1; }
.picker { display: flex; flex-direction: column; gap: 2px; max-height: 44vh; overflow-y: auto; margin: 12px -8px 0; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 14px; cursor: pointer; }
.pick:hover { background: var(--panel2); }
.pick input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--faint); border-radius: 6px; display: grid; place-items: center; flex: none; cursor: pointer; }
.pick input:checked { background: var(--accent); border-color: var(--accent); }
.pick input:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.pick .mid { flex: 1; min-width: 0; }
.pick .mid b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .mid span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sect { margin: 18px 0 8px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.inline { display: flex; gap: 8px; align-items: center; }
.pop { position: fixed; z-index: 80; min-width: 240px; max-width: 90vw; padding: 6px; background: var(--float); border: 1px solid var(--sheet-line); border-radius: 16px; box-shadow: var(--shadow2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: pop .2s var(--ease) both; }
.pop .me { padding: 10px 14px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop .me b { display: block; font-weight: 600; }
.pop .me span { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.pop .mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; text-align: left; }
.pop .mi:hover { background: var(--panel2); }
.pop .mi svg.ic { color: var(--muted); }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow2); max-width: 420px; animation: pop .3s var(--ease) both; }
.toast.bad { background: var(--danger); color: var(--solid); border-radius: 16px; }
.offline { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; z-index: 90; padding: 6px 14px; border-radius: 999px; background: var(--float); border: 1px solid var(--line); font-size: 12px; color: var(--muted); box-shadow: var(--shadow2); }

@media (max-width: 1100px) { .listcol { flex-basis: 290px; } .m { max-width: 82%; } }
@media (max-width: 860px) {
  /* Phones: solid panels, no blur. The rail becomes a bottom bar; a chat opens over the list. */
  :root { --sheet: #ffffff; --sheet-line: #e6e3ee; --float: #ffffff; --panel: #ffffff; --panel2: #f0eef6; --line: #e6e3ee; --accent-soft: #ece4fd; --theirs: #f0eef6; --mine: #e6dbfd; --blur: none; }
  :root[data-theme="dark"] { --sheet: #000000; --sheet-line: #1c1a22; --float: #0e0d12; --panel: #0b0a0e; --panel2: #15131b; --line: #1c1a22; --accent-soft: #24134a; --theirs: #15131b; --mine: #2c1763; }
  .shell { flex-direction: column-reverse; }
  .rail { flex: none; flex-direction: row; justify-content: space-around; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--solid); gap: 0; }
  .rail .mark, .rail .sp { display: none; }
  .rail .tab { height: 52px; }
  .rail .btn.icon { border-color: transparent; background: transparent; }
  .rail .me { margin-top: 0; align-self: center; }
  .listcol { flex: 1; min-height: 0; padding: max(14px, env(safe-area-inset-top)) 4px 0; }
  .pane { display: none; margin: 0; border-radius: 0; border: 0; box-shadow: none; }
  .shell[data-view="chat"] .pane { display: flex; position: fixed; inset: 0; z-index: 20; background: var(--solid); padding-top: env(safe-area-inset-top); }
  .phead { padding: 8px 8px 8px 4px; }
  .phead .backbtn { display: inline-flex; }
  .msgs { padding: 12px 12px 8px; }
  .m { max-width: 86%; }
  .m .del { display: none; }
  .m.sel .del { display: grid; opacity: 1; }
  .composer { padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
  .composer textarea, .input, .search input { font-size: 16px; }
  .jump { right: 14px; bottom: 92px; }
  .overlay { padding: 0; place-items: end stretch; }
  .sheet { max-width: none; border-radius: 22px 22px 0 0; border-width: 1px 0 0; max-height: 92%; }
  .sheet .ft { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #toasts { left: 12px; right: 12px; transform: none; bottom: max(84px, env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
