:root {
  --brand: #0b6b5f; --brand-d: #084f46; --brand-l: #d9f2ec;
  --bg: #eef1f4; --panel: #ffffff; --panel2: #f6f8fa; --line: #e3e7ec;
  --text: #111b21; --muted: #5a6a74; --mine: #d9fdd3; --theirs: #ffffff;
  --wall: #e9e4da; --danger: #dc2626; --tick: #2f9cf4; --shadow: 0 1px 2px rgba(0,0,0,.12);
  --radius: 12px; --vh: 100dvh;
}
:root[data-theme=dark] {
  --brand: #1fa08f; --brand-d: #14766a; --brand-l: #12332e;
  --bg: #0b141a; --panel: #111b21; --panel2: #1a262d; --line: #26343c;
  --text: #e9edef; --muted: #8696a0; --mine: #005c4b; --theirs: #1f2c34;
  --wall: #0b141a; --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }
.hidden { display: none !important; }
svg { display: block; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ibtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.ibtn:hover { background: var(--panel2); }
.ibtn:active { background: var(--line); }

/* ───────── auth */
.auth { height: var(--vh); display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand-d), var(--brand)); overflow: auto; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 18px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-card img { width: 72px; height: 72px; margin: 0 auto 10px; display: block; border-radius: 16px; }
.auth-card h1 { margin: 0; text-align: center; font-size: 22px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 0 18px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); background: var(--panel); }
.btn { padding: 11px 16px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600; text-align: center; }
.btn:hover { background: var(--brand-d); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 8px; text-align: center; }

/* ───────── layout */
.app { height: var(--vh); display: flex; position: relative; overflow: hidden; }
.side { width: 380px; max-width: 100%; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; flex: none; min-height: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wall); position: relative; min-height: 0; }
@media (min-width: 801px) and (max-width: 1100px) { .side { width: 320px; } }
@media (max-width: 800px) {
  .side { width: 100%; border: 0; }
  .main { position: absolute; inset: 0; transform: translateX(100%); transition: transform .22s ease; z-index: 5; }
  .app.open .main { transform: none; }
  .only-wide { display: none !important; }
}
@media (min-width: 801px) { .only-narrow { display: none !important; } }

.side-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--brand); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.side-head .title { flex: 1; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.side-head .ibtn { color: #fff; }
.side-head .ibtn:hover { background: rgba(255,255,255,.14); }
.search { padding: 8px 10px; background: var(--panel); }
.search input { width: 100%; padding: 9px 14px; border-radius: 10px; border: 0; background: var(--panel2); outline: none; }
.chips { display: flex; gap: 6px; padding: 2px 10px 8px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 5px 11px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.sect { padding: 8px 14px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.row { display: flex; gap: 12px; padding: 10px 14px; align-items: center; cursor: pointer; border-bottom: 1px solid var(--line); position: relative; }
.row:hover { background: var(--panel2); }
.row.on { background: var(--brand-l); }
.row .mid { flex: 1; min-width: 0; }
.row .top { display: flex; align-items: baseline; gap: 8px; }
.row .nm { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tm { font-size: 11.5px; color: var(--muted); flex: none; }
.row .bot { display: flex; align-items: center; gap: 6px; }
.row .pv { flex: 1; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .pv.typing { color: var(--brand); font-style: italic; }
.badge { background: var(--brand); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.badge.muted { background: var(--muted); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; position: relative; font-size: 16px; user-select: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--panel); }
.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--c, var(--muted)); line-height: 18px; }
.feed-item .cat-line { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.feed-item .tx { font-size: 13.5px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.feed-item .who { font-size: 12px; color: var(--muted); }
.feed-item.res .tx { text-decoration: line-through; opacity: .6; }

/* ───────── chat */
.placeholder { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.placeholder img { width: 84px; opacity: .85; border-radius: 18px; margin-bottom: 12px; }
.head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); padding-top: max(8px, env(safe-area-inset-top)); flex: none; }
.head .info { flex: 1; min-width: 0; cursor: pointer; }
.head .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head .st { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head .st.live { color: var(--brand); }
.banner { background: var(--brand-l); color: var(--text); padding: 6px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; flex: none; border-bottom: 1px solid var(--line); }
.banner b { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 6% 8px; overscroll-behavior: contain; scroll-behavior: auto; }
@media (max-width: 800px) { .msgs { padding: 8px 8px; } }
.load-old { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px auto 12px; }
.load-old button { background: var(--panel); border: 1px solid var(--line); padding: 7px 16px; border-radius: 99px; font-size: 13px; box-shadow: var(--shadow); color: var(--brand); font-weight: 600; }
.load-old small { color: var(--muted); font-size: 11.5px; text-align: center; }
.day { text-align: center; margin: 10px 0; }
.day span { background: var(--panel); color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 8px; box-shadow: var(--shadow); }
.sys { text-align: center; margin: 8px 0; }
.sys span { background: rgba(120,130,140,.22); color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 8px; }
.m { display: flex; margin: 2px 0; }
.m.mine { justify-content: flex-end; }
.m.first { margin-top: 8px; }
.bub { max-width: min(78%, 560px); background: var(--theirs); border-radius: 10px; padding: 5px 8px 4px; box-shadow: var(--shadow); position: relative; min-width: 72px; }
@media (max-width: 800px) { .bub { max-width: 86%; } }
.mine .bub { background: var(--mine); }
.bub.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%,60% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: var(--shadow); } }
.sender { font-size: 12.5px; font-weight: 700; margin-bottom: 1px; }
.bub .pill { margin: 1px 0 3px; }
.quote { border-left: 4px solid var(--c, var(--brand)); background: rgba(120,130,140,.14); border-radius: 6px; padding: 3px 8px; margin: 2px 0 4px; font-size: 13px; cursor: pointer; }
.quote b { display: block; font-size: 12px; color: var(--c, var(--brand)); }
.quote div { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.txt { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.txt a { word-break: break-all; }
.del { color: var(--muted); font-style: italic; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 1px; float: right; padding-left: 10px; position: relative; top: 3px; }
.bub::after { content: ""; display: block; clear: both; }
.tick { width: 16px; height: 16px; }
.tick.read { color: var(--tick); }
.tick.fail { color: var(--danger); }
.chev { position: absolute; top: 2px; right: 3px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; color: var(--muted); background: inherit; }
.bub:hover .chev { display: grid; }
@media (hover: none) { .bub .chev { display: none !important; } }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin: 3px 0 1px; clear: both; }
.react { background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; font-size: 13px; line-height: 22px; display: flex; gap: 4px; align-items: center; }
.react.me { border-color: var(--brand); background: var(--brand-l); }
.react small { font-size: 11px; color: var(--muted); }
.resolved-tag { color: #16a34a; font-weight: 700; display: inline-flex; gap: 2px; align-items: center; }
.media img.thumb { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; cursor: zoom-in; margin: 2px 0; background: var(--panel2); min-width: 120px; min-height: 60px; object-fit: cover; }
.filecard { display: flex; gap: 10px; align-items: center; background: rgba(120,130,140,.14); border-radius: 8px; padding: 8px 10px; margin: 2px 0; text-decoration: none; color: inherit; min-width: 220px; }
.filecard .fi { width: 36px; height: 40px; border-radius: 6px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.filecard .fn { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.filecard .fs { font-size: 11.5px; color: var(--muted); }
.voice { display: flex; align-items: center; gap: 8px; min-width: 230px; padding: 2px 0; }
.voice audio { height: 34px; max-width: 100%; flex: 1; min-width: 0; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 4px 0; }
.progress div { height: 100%; background: var(--brand); width: 0; }

/* ───────── composer */
.composer { background: var(--panel2); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
.ctx { display: flex; align-items: center; gap: 8px; background: var(--panel); border-left: 4px solid var(--brand); border-radius: 8px; padding: 5px 8px; margin: 0 2px 6px; font-size: 13px; }
.ctx div { flex: 1; min-width: 0; }
.ctx b { display: block; font-size: 12px; color: var(--brand); }
.ctx span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.crow { display: flex; align-items: flex-end; gap: 4px; }
.box { flex: 1; background: var(--panel); border-radius: 22px; display: flex; align-items: flex-end; padding: 2px 6px; border: 1px solid var(--line); min-width: 0; }
.box textarea { flex: 1; border: 0; outline: none; background: none; resize: none; max-height: 140px; padding: 9px 4px; line-height: 1.35; min-width: 0; }
.catbtn { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 40px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); flex: none; }
.catbtn.on { color: #fff; background: var(--c); height: 28px; margin: 6px 2px; padding: 0 10px; }
.sendbtn { background: var(--brand); color: #fff; border-radius: 50%; }
.sendbtn:hover { background: var(--brand-d); }
.rec { display: flex; align-items: center; gap: 10px; flex: 1; padding: 0 12px; color: var(--danger); font-weight: 600; background: var(--panel); border-radius: 22px; height: 44px; }
.rec .reddot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.hint { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 8px 6px; }
.dropzone { position: absolute; inset: 0; background: rgba(11,107,95,.85); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; z-index: 20; }

/* ───────── popups */
.menu { position: fixed; z-index: 100; background: var(--panel); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); border: 1px solid var(--line); min-width: 190px; max-width: 92vw; padding: 6px 0; max-height: 70vh; overflow-y: auto; }
.menu button { display: flex; width: 100%; text-align: left; padding: 9px 16px; gap: 12px; align-items: center; font-size: 14.5px; }
.menu button:hover { background: var(--panel2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .qr { display: flex; justify-content: space-around; padding: 4px 8px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .qr button { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 21px; border-radius: 50%; }
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; width: min(340px, 92vw); max-height: 260px; overflow-y: auto; }
.emojis button { font-size: 22px; padding: 4px 0; justify-content: center; border-radius: 8px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; display: grid; place-items: center; padding: 14px; }
.modal { background: var(--panel); border-radius: 16px; width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-b { padding: 14px 18px; overflow-y: auto; }
.modal-f { padding: 10px 18px 14px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td, .tbl th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat div { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
.note { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.note.bad { border-color: var(--danger); color: var(--danger); }
.note.ok { border-color: #16a34a; color: #16a34a; }
.picklist { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.picklist label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picklist label:last-child { border: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 200; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 150; display: flex; flex-direction: column; }
.lightbox .bar { display: flex; justify-content: flex-end; gap: 6px; padding: 10px; color: #fff; }
.lightbox .bar .ibtn { color: #fff; }
.lightbox img { margin: auto; max-width: 96vw; max-height: 86vh; object-fit: contain; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.conn { background: #f59e0b; color: #000; text-align: center; font-size: 12.5px; padding: 3px; flex: none; }

/* ───────── categories in the sidebar */
.cat-dot { width: 36px; height: 36px; border-radius: 10px; background: var(--c, var(--brand)); display: grid; place-items: center; flex: none; color: #fff; }
.cat-dot:empty { width: 14px; height: 14px; border-radius: 50%; }
.cat-head { background: var(--panel2); padding: 8px 10px 8px 14px; gap: 10px; }
.cat-head .nm { font-weight: 700; }
.cat-head .ibtn.sm { width: 32px; height: 32px; }
.cat-head .ibtn.sm .icon { width: 18px; height: 18px; }
.cat-head .chev { display: grid; place-items: center; color: var(--muted); transition: transform .15s; }
.cat-head .chev.open { transform: rotate(90deg); }
.row.nested { padding-left: 26px; }
.row.nested .avatar { width: 38px; height: 38px; font-size: 14px; }
.row.slim { padding: 8px 14px; }
.row.back { padding: 4px 8px; }
.icon.muted { color: var(--muted); width: 18px; height: 18px; }
.asg { color: var(--brand); font-weight: 600; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ───────── display options */
:root[data-size=s] body { font-size: 13.5px; }
:root[data-size=l] body { font-size: 17px; }
.m { contain: layout style; }
/* Card style: flat full-width cards, no wallpaper */
:root[data-style=card] .main { background: var(--bg); }
:root[data-style=card] .bub { max-width: 100%; width: 100%; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; box-shadow: none; background: var(--panel); }
:root[data-style=card] .mine .bub { border-left-color: var(--brand); background: var(--panel); }
:root[data-style=card] .m, :root[data-style=card] .m.mine { justify-content: stretch; }
:root[data-style=card] .m.first { margin-top: 10px; }
.cat-head .cchev { display: grid; place-items: center; color: var(--muted); transition: transform .15s; width: 24px; height: 24px; line-height: 0; flex: none; align-self: center; }
.cat-head .chev .icon { width: 20px; height: 20px; }
.tagcnt { display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 7px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--text); flex: none; font-size: 13px; }
.tagcnt .icon { width: 16px; height: 16px; color: var(--muted); }
.tagcnt:hover { border-color: var(--brand); }

/* ═════════ UI v2 polish ═════════ */
:root { --brand-2: #0f8a78; --radius: 14px; --ring: 0 0 0 3px rgba(15,138,120,.28); --ease: cubic-bezier(.2,.7,.2,1); }
:root[data-theme=dark] { --ring: 0 0 0 3px rgba(31,160,143,.4); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, .row, .ibtn { touch-action: manipulation; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }
.busy { opacity: .55; pointer-events: none; cursor: progress; }
* { scrollbar-width: thin; scrollbar-color: rgba(120,130,140,.35) transparent; }
::selection { background: rgba(15,138,120,.25); }

/* sidebar */
.side { width: clamp(310px, 31vw, 400px); background: var(--panel); }
@media (max-width: 800px) { .side { width: 100%; } }
.side-head { background: linear-gradient(135deg, var(--brand-d), var(--brand-2)); box-shadow: 0 2px 10px rgba(0,0,0,.12); position: relative; z-index: 2; }
.side-head .title { font-size: 19px; letter-spacing: .3px; }
.search { padding: 10px 12px 6px; }
.search input { padding: 11px 14px 11px 40px; border-radius: 12px; background: var(--panel2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") 13px 50% / 18px no-repeat; border: 1px solid transparent; transition: border-color .15s, background-color .15s; }
.search input:focus { border-color: var(--brand); background-color: var(--panel); box-shadow: var(--ring); }
.list { padding: 2px 8px 24px; }
.sect { position: sticky; top: 0; z-index: 1; background: var(--panel); padding: 12px 8px 6px; font-weight: 700; font-size: 11.5px; letter-spacing: .9px; }
.row { border: 0; border-radius: 14px; margin: 2px 0; padding: 10px 10px; transition: background .12s, transform .08s; }
.row:active { transform: scale(.995); }
.row:hover { background: var(--panel2); }
.row.on { background: var(--brand-l); box-shadow: inset 3px 0 0 var(--brand); }
.row .nm { font-size: 15px; }
.row .pv { font-size: 13px; }
.avatar { box-shadow: inset 0 -10px 20px rgba(0,0,0,.12); }
.badge { box-shadow: 0 1px 3px rgba(11,107,95,.35); }
.cat-head { background: var(--panel2); margin-top: 6px; padding: 8px 6px 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand)); border-radius: 12px; }
.cat-head:hover { background: var(--brand-l); }
.cat-head .cat-dot { display: none; }
.cat-head .nm { font-size: 14.5px; }
.cat-head .ibtn.sm { width: 30px; height: 30px; }
.row.nested { margin-left: 14px; padding-left: 8px; border-left: 2px solid var(--line); border-radius: 0 12px 12px 0; }
.row.nested.on { border-left-color: var(--brand); }
.row.slim { padding: 8px 10px; }
.cat-dot { border-radius: 12px; }
.row.slim .cat-dot { width: 32px; height: 32px; }
.drive-banner { margin: 8px 0 4px; padding: 10px 14px; border-radius: 12px; background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
:root[data-theme=dark] .drive-banner { background: #3a2412; border-color: #9a5a22; color: #fdba74; }
.drive-banner span { font-size: 12.5px; opacity: .85; }
.empty { padding: 36px 20px; font-size: 14px; line-height: 1.5; }

/* chat header & messages */
.head { box-shadow: 0 1px 0 var(--line), 0 4px 12px rgba(0,0,0,.04); position: relative; z-index: 2; }
.head .nm { font-size: 16px; }
.main { background-color: var(--wall); }
:root[data-style=whatsapp] .main, :root:not([data-style]) .main { background-image: radial-gradient(rgba(120,110,90,.10) 1px, transparent 1px); background-size: 22px 22px; }
:root[data-theme=dark] .main { background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); }
.msgs { padding-top: 14px; scroll-behavior: auto; overflow-anchor: auto; } /* was 'smooth': it made a new chat visibly slide down from the top */
.bub { border-radius: 14px 14px 14px 4px; padding: 6px 10px 5px; box-shadow: 0 1px 2px rgba(0,0,0,.10); }
.mine .bub { border-radius: 14px 14px 4px 14px; }
.m.first .bub { }
.txt { font-size: 15px; line-height: 1.42; }
.day span, .sys span { backdrop-filter: blur(6px); }
.pill { box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.asg { background: var(--brand-l); padding: 0 6px; border-radius: 99px; }
.react { transition: transform .1s; } .react:active { transform: scale(.92); }

/* composer */
.composer { background: transparent; border-top: 0; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
.box { border-radius: 26px; box-shadow: 0 2px 10px rgba(0,0,0,.08); padding: 3px 6px; transition: box-shadow .15s, border-color .15s; }
.box:focus-within { border-color: var(--brand); box-shadow: 0 2px 12px rgba(0,0,0,.1), var(--ring); }
.sendbtn { width: 46px; height: 46px; box-shadow: 0 3px 10px rgba(11,107,95,.4); transition: transform .1s, background .15s; }
.sendbtn:active { transform: scale(.92); }
.catbtn { transition: background .15s; } .catbtn:hover { background: var(--panel2); } .catbtn.on:hover { background: var(--c); }

/* popups */
.overlay { backdrop-filter: blur(3px); animation: fadein .15s ease; }
.modal { border-radius: 20px; animation: popin .2s var(--ease); }
.modal-h h3 { font-size: 18px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (max-width: 600px) {
  .overlay { align-items: end; padding: 0; }
  .modal, .modal.wide { max-width: 100%; border-radius: 22px 22px 0 0; max-height: 90vh; animation: sheet .25s var(--ease); }
  .modal-b { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
.menu { border-radius: 14px; animation: popin .14s var(--ease); padding: 6px; }
.menu button { border-radius: 9px; padding: 10px 12px; }
.menu hr { margin: 4px 6px; }
.toast { animation: toastin .2s var(--ease); background: #111827; border-radius: 12px; padding: 11px 18px; bottom: calc(24px + env(safe-area-inset-bottom)); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } }
.btn { transition: background .15s, transform .08s, box-shadow .15s; box-shadow: 0 1px 2px rgba(0,0,0,.12); } .btn:active { transform: scale(.97); }
.btn.ghost { box-shadow: none; }
.btn.sm.on, .seg .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs button { transition: color .15s; }

/* Drive setup guide */
.guide { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.gstep { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); }
.gnum { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; }
.gbody { flex: 1; min-width: 0; }
.gbody p { margin: 4px 0 8px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.gbody a.btn { display: inline-block; text-decoration: none; }
.gdet > summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--brand); }

/* skeleton loading */
.skel { display: flex; flex-direction: column; gap: 10px; padding: 10px 6%; }
.skel i { display: block; height: 38px; width: 55%; border-radius: 14px; background: linear-gradient(90deg, var(--panel) 25%, var(--panel2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; opacity: .8; }
.skel i:nth-child(even) { align-self: flex-end; width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* welcome panel */
.placeholder h2 { font-size: 22px; }
.placeholder .tips { margin: 16px auto 0; max-width: 340px; text-align: left; display: grid; gap: 8px; font-size: 13.5px; }
.placeholder .tips div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.cat-head .cchev.open { transform: rotate(90deg); }
.cat-head .cchev .icon { width: 20px; height: 20px; }
.row.slim .cat-dot .icon { width: 18px; height: 18px; }
.meta .tick { color: #8a9aa3; } .meta .tick.read { color: var(--tick); } .meta .tick.fail { color: var(--danger); }
.box textarea:focus-visible { box-shadow: none; }

.tick { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* assigned tabs + notification banner */
.seg { display: flex; gap: 6px; margin: 4px 12px 6px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.drive-banner.nb { position: relative; background: #ecfdf5; border-color: #6ee7b7; color: #065f46; padding-right: 34px; }
:root[data-theme=dark] .drive-banner.nb { background: #12332b; border-color: #2f7d68; color: #86efac; }
.drive-banner .x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px; }

/* ═════════ Vibrant accent themes (pick in ⋮ → Display) ═════════ */
:root[data-accent=ocean] { --brand: #4f46e5; --brand-d: #3730a3; --brand-2: #0ea5e9; --brand-l: #e0e7ff; --mine: #dbe4ff; --wall: #e8ecf8; --ring: 0 0 0 3px rgba(79,70,229,.3); }
:root[data-accent=ocean][data-theme=dark] { --brand: #818cf8; --brand-l: #232a5c; --mine: #3b3f9e; --wall: #0b141a; }
:root[data-accent=teal] { --brand: #0b6b5f; --brand-d: #084f46; --brand-2: #0f8a78; --brand-l: #d9f2ec; --mine: #d9fdd3; --wall: #e9e4da; --ring: 0 0 0 3px rgba(15,138,120,.28); }
:root[data-accent=teal][data-theme=dark] { --brand: #1fa08f; --brand-l: #12332e; --mine: #005c4b; --wall: #0b141a; }
:root[data-accent=violet] { --brand: #7c3aed; --brand-d: #5b21b6; --brand-2: #d946ef; --brand-l: #f3e8ff; --mine: #ede4ff; --wall: #f1eaf9; --ring: 0 0 0 3px rgba(124,58,237,.3); }
:root[data-accent=violet][data-theme=dark] { --brand: #a78bfa; --brand-l: #2e1f52; --mine: #5b2fb8; --wall: #0b141a; }
:root[data-accent=sunset] { --brand: #ea580c; --brand-d: #c2410c; --brand-2: #f43f5e; --brand-l: #ffedd5; --mine: #ffe8d1; --wall: #f7ece4; --ring: 0 0 0 3px rgba(234,88,12,.3); }
:root[data-accent=sunset][data-theme=dark] { --brand: #fb923c; --brand-l: #3d2314; --mine: #9a3d10; --wall: #0b141a; }
:root[data-accent=rose] { --brand: #e11d48; --brand-d: #be123c; --brand-2: #f97316; --brand-l: #ffe4e6; --mine: #ffe1e6; --wall: #f8e9ec; --ring: 0 0 0 3px rgba(225,29,72,.3); }
:root[data-accent=rose][data-theme=dark] { --brand: #fb7185; --brand-l: #40161f; --mine: #9f1239; --wall: #0b141a; }

:root[data-accent] ::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }
:root[data-accent] .side-head, :root[data-accent] .auth { background: linear-gradient(135deg, var(--brand-d), var(--brand) 55%, var(--brand-2)); }
:root[data-accent] .btn:not(.ghost):not(.danger) { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 35%, transparent); }
:root[data-accent] .btn.ghost.on, :root[data-accent] .seg button.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
:root[data-accent] .row.on { background: var(--brand-l); box-shadow: inset 3px 0 0 var(--brand-2); }
:root[data-accent] .badge:not(.muted) { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
:root[data-accent] .mine .bub { background: var(--mine); }
:root[data-accent] .sect { color: var(--brand); }
:root[data-accent] .cat-dot { box-shadow: 0 2px 6px color-mix(in srgb, var(--c, var(--brand)) 40%, transparent); }
:root[data-accent] .drive-banner.nb { background: var(--brand-l); border-color: var(--brand); color: var(--brand-d); }
:root[data-accent][data-theme=dark] .drive-banner.nb { color: #e0e7ff; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { border-color: var(--panel); box-shadow: 0 0 0 3px var(--brand); }

/* in-chat search */
.csearch { background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.08); position: relative; z-index: 3; }
.cs-bar { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; }
.cs-bar input { flex: 1; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); }
.cs-bar input:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.cs-list { max-height: 46vh; overflow: auto; padding: 0 8px 8px; }

.or { text-align: center; color: var(--muted); margin: 12px 0 8px; font-size: 13px; }
.pbar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2, var(--brand))); transition: width .3s; }

/* avatars: people = circle, groups = rounded square with badge, category threads = hexagon */
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; margin: 0 auto; }
.avatar.grp { border-radius: 30%; }
.avatar.cat { border-radius: 0; clip-path: polygon(25% 4%, 75% 4%, 98% 50%, 75% 96%, 25% 96%, 2% 50%); }
.avatar .gbadge { position: absolute; right: -3px; bottom: -3px; width: 42%; height: 42%; min-width: 14px; min-height: 14px; border-radius: 50%; background: var(--panel); color: var(--brand); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }
.avatar.cat .gbadge { display: none; }
.avatar .gbadge .icon { width: 70%; height: 70%; stroke-width: 2.4; }
.avatar.xl .gbadge { right: 2px; bottom: 2px; }
.avatar .ini { position: relative; }
.avatar img + .ini { display: none; }
button.edited { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; text-decoration: underline dotted; cursor: pointer; opacity: .9; }
.hist { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--panel2); }
.hist.cur { border-color: var(--brand); background: var(--brand-l); }
.hist .hl { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.hist .hl b { color: var(--text); }
.hist .ht { white-space: pre-wrap; word-break: break-word; }

/* ── device history */
.dvp { position: fixed; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 8px; background: var(--card, #fff); color: var(--text, #111); border: 1px solid var(--line); box-shadow: 0 6px 22px rgba(0,0,0,.18); border-radius: 99px; padding: 7px 8px 7px 12px; font-size: 12.5px; cursor: pointer; max-width: calc(100vw - 24px); }
.dvp .spin { width: 14px; height: 14px; flex: none; }
.dvp .dvt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dvp button { border: 0; background: var(--line); color: inherit; border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.devbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card, transparent); }
.devbox .big { font-weight: 700; font-size: 17px; }
.dev .btn.sm { padding: 5px 10px; font-size: 12.5px; }

/* ── file viewer */
.viewer { position: fixed; inset: 0; z-index: 90; background: var(--bg, #f4f6f8); display: flex; flex-direction: column; }
.vbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px calc(8px) 14px; padding-top: calc(8px + env(safe-area-inset-top)); background: var(--card, #fff); border-bottom: 1px solid var(--line); }
.vname { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtools { display: flex; align-items: center; gap: 4px; }
.vpg { font-size: 12px; color: var(--muted); margin-right: 4px; }
.vbody { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: #e4e9ee; }
html[data-theme="dark"] .vbody { background: #11181d; }
.vmsg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 60%; padding: 24px; text-align: center; }
.vimgwrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 8px; }
.vimg { max-width: 100%; max-height: calc(100vh - 80px); object-fit: contain; cursor: zoom-in; border-radius: 4px; }
.vimg.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.vpdf { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 40px; }
.vcv { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); max-width: none; }
.vdoc { max-width: 820px; margin: 12px auto; background: #fff; color: #111; padding: 32px 36px; min-height: 60vh; box-shadow: 0 2px 10px rgba(0,0,0,.15); line-height: 1.55; overflow-wrap: anywhere; }
.vdoc table { border-collapse: collapse; margin: 10px 0; } .vdoc td, .vdoc th { border: 1px solid #ccc; padding: 4px 8px; } .vdoc img { max-width: 100%; }
.vtext { margin: 0; padding: 16px; white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--card, #fff); min-height: 100%; }
.vtabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px; background: var(--card, #fff); border-bottom: 1px solid var(--line); }
.vtabs button { border: 0; background: var(--line); color: inherit; border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.vtabs button.on { background: var(--brand); color: #fff; }
.vsheet { overflow: auto; background: var(--card, #fff); }
.vsheet table { border-collapse: collapse; font-size: 13px; }
.vsheet td, .vsheet th { border: 1px solid #d6dde2; padding: 4px 9px; white-space: pre; max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: var(--text, #111); }
.vsheet th { position: sticky; left: 0; background: #eef2f5; color: #667; font-weight: 500; text-align: right; min-width: 38px; }
html[data-theme="dark"] .vsheet th { background: #1a242b; } html[data-theme="dark"] .vsheet td { border-color: #2a3740; }
/* ── mailbox */
.mailform .field { margin-bottom: 10px; } .mailform textarea { width: 100%; }
.mailform .lnk { float: right; font-size: 12px; color: var(--brand); }
.mchips { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mchip { display: flex; align-items: center; gap: 8px; background: var(--line); border-radius: 10px; padding: 6px 8px; cursor: pointer; }
.mchip .fi { background: var(--brand); color: #fff; border-radius: 6px; font-size: 10px; font-weight: 700; padding: 4px 6px; }
.mchip .mn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mchip small { color: var(--muted); } .mchip button { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; }
.msug { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; } .msug button { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 99px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.sharelist { max-height: 50vh; overflow: auto; margin-top: 8px; } .row.shr { cursor: pointer; } .row.shr input { margin-right: 8px; }
.msteps { margin: 8px 0 10px; padding-left: 20px; font-size: 13.5px; line-height: 1.55; } .msteps code { background: var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.row.unread .nm { font-weight: 700; } .mhead .ms { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.mview { margin-top: 10px; padding: 12px; background: #fff; color: #111; border-radius: 10px; border: 1px solid var(--line); overflow-wrap: anywhere; max-height: 55vh; overflow: auto; } .mview img { max-width: 100%; } .mview .vtext { background: transparent; color: #111; padding: 0; }

.connbar { position: fixed; top: 0; left: 0; right: 0; z-index: 99998; background: #b45309; color: #fff; font: 600 12px/1.3 system-ui, sans-serif; text-align: center; padding: calc(4px + env(safe-area-inset-top)) 10px 4px; pointer-events: none; }

.updbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 99997; background: #4f46e5; color: #fff; text-align: center; font: 600 13px/1.3 system-ui, sans-serif; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); cursor: pointer; }
.vpg1 { display: block; }
