/* ===================== ASH V1312 — Ash theme ===================== */
:root {
  --ash-950: #1d1f22;
  --ash-900: #25282c;
  --ash-850: #2b2e33;
  --ash-800: #33373c;
  --ash-700: #43484f;
  --ash-600: #5a6068;
  --ash-500: #747a83;
  --ash-400: #9499a1;
  --ash-300: #b7bbc1;
  --ash-200: #d4d7db;
  --ash-150: #e1e3e6;
  --ash-100: #ebecee;
  --ash-50:  #f5f6f7;
  --white: #ffffff;
  --ink: #1f2226;
  --muted: #6b7078;
  --line: #dcdfe3;
  --accent: #4d5660;
  --accent-2: #3d454e;
  --read: #3a96dd;
  --ok: #2f8f5b;
  --warn: #c48a1a;
  --danger: #c0433a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 16px rgba(20, 22, 26, .06);
  --nav-w: 232px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --card: #ffffff;
  --surface: var(--ash-50);
  --field: #ffffff;
  --chat-bg: #dfe1e4;
  --bubble-me: var(--ash-600);
  --bubble-me-ink: #ffffff;
  --bubble-them: #ffffff;
  --dock: var(--ash-850);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", "Hind Siliguri", "Nirmala UI", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ash-100); }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; font-size: 17px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 600; background: var(--ash-150); color: var(--ink); transition: background .15s, transform .05s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--ash-100); }
.btn.ghost.light { color: #fff; border-color: rgba(255,255,255,.25); }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.danger-text { color: var(--danger) !important; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ash-600); cursor: pointer; }
.icon-btn:hover { background: var(--ash-100); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.12); }
.link-btn { background: none; border: 0; color: var(--ash-300); text-decoration: underline; margin-top: 14px; }

/* ---------- Auth pages ---------- */
.auth-body { background: radial-gradient(1200px 600px at 20% -10%, #4a5058 0%, transparent 60%), linear-gradient(160deg, var(--ash-800), var(--ash-950)); min-height: 100%; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; background: var(--ash-50); border-radius: 20px; padding: 32px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.auth-card.wide { max-width: 680px; }
.brand-mark img { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark.big img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.auth-title { margin: 14px 0 2px; font-size: 26px; letter-spacing: .5px; font-weight: 800; }
.auth-title span { color: var(--ash-500); font-weight: 600; }
.auth-sub { margin: 0 0 22px; color: var(--muted); }
.auth-form { text-align: left; display: grid; gap: 14px; }
.auth-form label, .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ash-700); }
input, textarea, select { width: 100%; border: 1px solid var(--line); background: var(--field); color: var(--ink); border-radius: 10px; padding: 11px 12px; outline: none; transition: border .15s, box-shadow .15s; font-weight: 400; }
input:focus, textarea:focus, select:focus { border-color: var(--ash-500); box-shadow: 0 0 0 3px rgba(90,96,104,.15); }
.auth-foot { margin: 20px 0 0; font-size: 12px; color: var(--muted); }
.alert { background: #fbeceb; color: #8d2a23; border: 1px solid #f0c9c5; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; text-align: left; }
.alert.ok { background: #e8f4ed; color: #1f6b42; border-color: #c4e3d0; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setup-grid fieldset { border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; padding: 12px; }
.setup-grid legend { font-weight: 700; padding: 0 6px; }
.steps { display: flex; justify-content: center; gap: 6px; margin: 6px 0 18px; flex-wrap: wrap; }
.steps span { font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 20px; background: var(--ash-150); color: var(--muted); }
.steps span.on { background: var(--accent); color: #fff; }
.steps span.ok { background: #e3f2e9; color: #1f6b42; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; text-align: left; }
.login-list { text-align: left; background: var(--ash-100); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; display: grid; gap: 6px; font-size: 14px; }
.login-list code { background: var(--card); padding: 1px 6px; border-radius: 5px; }
@media (max-width: 600px) { .setup-grid { grid-template-columns: 1fr; } }

/* ---------- App layout: one column + bottom dock (all devices) ---------- */
body:has(.app) { background: var(--ash-850); }
html:has(.app), body:has(.app) { overflow: hidden; overscroll-behavior: none; }
.app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; background: var(--ash-100); box-shadow: 0 0 40px rgba(0,0,0,.25); }
.dock { flex: none; display: flex; justify-content: space-around; align-items: center; background: var(--dock); padding: 6px 6px calc(6px + var(--safe-b)); border-top: 1px solid rgba(255,255,255,.06); }
.nav-btn { position: relative; flex: 1; max-width: 120px; height: 52px; display: grid; place-items: center; background: none; border: 0; color: var(--ash-400); border-radius: 14px; }
.nav-btn svg { width: 27px; height: 27px; }
.nav-btn:hover { color: #fff; }
.nav-btn.active { color: #fff; background: rgba(255,255,255,.1); }
.badge { position: absolute; top: 4px; left: calc(50% + 7px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #e2e4e7; color: var(--ash-900); font-style: normal; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; }
.main { position: relative; flex: 1; min-height: 0; min-width: 0; overflow: hidden; background: var(--ash-100); }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.view.active { display: flex; }
.topbar { position: relative; z-index: 6; flex: none; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: calc(10px + var(--safe-t)) 14px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 19px; }
.top-sub { margin-left: auto; color: var(--muted); font-size: 13px; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 18px; }
.pad > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.h-ic { width: 18px; height: 18px; color: var(--ash-600); }

/* ---------- Avatars ---------- */
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--ash-400) center/cover no-repeat; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; font-size: 16px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.avatar.xl { width: 84px; height: 84px; font-size: 30px; }
.avatar.editable { cursor: pointer; position: relative; }
.avatar.editable::after { content: "পরিবর্তন"; position: absolute; inset: auto 0 0 0; background: rgba(0,0,0,.45); font-size: 11px; text-align: center; padding: 3px 0; }

/* ---------- Chat ---------- */
.chat-top .who { flex: 1; min-width: 0; }
.who-name { font-weight: 700; font-size: 18px; }
.who-status { font-size: 13.5px; color: var(--muted); }
.who-status.online { color: var(--ok); }
.secure-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ash-600); background: var(--ash-100); border: 1px solid var(--line); padding: 4px 9px; border-radius: 20px; }
.secure-tag svg { width: 14px; height: 14px; }
.messages { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 8px; background-color: var(--chat-bg); background-image: radial-gradient(rgba(60,64,70,.07) 1px, transparent 1px); background-size: 18px 18px; }
#msg-list { display: flex; flex-direction: column; gap: 3px; max-width: 900px; margin: 0 auto; }
.day-sep { align-self: center; margin: 12px 0 8px; background: rgba(255,255,255,.85); color: var(--ash-700); font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.msg + .msg.gap { margin-top: 6px; }
.bubble { position: relative; max-width: min(80%, 560px); padding: 8px 12px 7px; font-size: 17px; border-radius: 12px; background: var(--bubble-them); box-shadow: 0 1px 1px rgba(0,0,0,.08); word-wrap: break-word; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.msg.me .bubble { background: var(--bubble-me); color: var(--bubble-me-ink); }
.msg.first.them .bubble { border-top-left-radius: 4px; }
.msg.first.me .bubble { border-top-right-radius: 4px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text a { color: inherit; }
.bubble .meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: 12px; opacity: .75; margin-top: 2px; float: right; margin-left: 10px; position: relative; top: 4px; }
.bubble .meta svg { width: 16px; height: 16px; }
.bubble .meta .read { color: #8fd0ff; opacity: 1; }
.msg.them .bubble .meta { color: var(--muted); }
.bubble::after { content: ""; display: block; clear: both; }
.bubble:has(.reacts) { padding-bottom: 12px; }
.bubble .msg-img { display: block; border-radius: 8px; max-height: 300px; min-width: 120px; min-height: 80px; object-fit: cover; background: var(--ash-200); cursor: zoom-in; margin: -1px -4px 5px; max-width: calc(100% + 8px); }
.bubble.deleted .text { font-style: italic; opacity: .7; }
.quote { border-left: 3px solid var(--ash-400); background: rgba(0,0,0,.05); border-radius: 6px; padding: 4px 8px; margin-bottom: 5px; font-size: 13px; cursor: pointer; }
.msg.me .quote { background: rgba(255,255,255,.12); border-left-color: var(--ash-200); }
.quote b { display: block; font-size: 12px; }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.msg.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 0%, 100% { box-shadow: 0 1px 1px rgba(0,0,0,.08); } 30% { box-shadow: 0 0 0 4px rgba(58,150,221,.45); } }
.load-older { display: block; margin: 0 auto 10px; border: 0; background: rgba(255,255,255,.85); padding: 6px 14px; border-radius: 16px; font-size: 13px; color: var(--ash-700); }
.typing-row { display: inline-flex; gap: 4px; background: var(--card); padding: 10px 12px; border-radius: 12px; margin: 4px auto 0; max-width: 900px; }
.typing-row span { width: 7px; height: 7px; border-radius: 50%; background: var(--ash-400); animation: blink 1.2s infinite; }
.typing-row span:nth-child(2) { animation-delay: .2s; } .typing-row span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.jump-down { position: absolute; right: 18px; bottom: calc(86px + var(--safe-b)); width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ash-700); z-index: 3; }
.composer-wrap { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-b)); }
.composer { display: flex; align-items: flex-end; gap: 6px; max-width: 900px; margin: 0 auto; }
.composer textarea { flex: 1; resize: none; max-height: 140px; border-radius: 22px; padding: 11px 16px; line-height: 1.4; background: var(--field); font-size: 17px; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send-btn:hover { background: var(--accent-2); }
.reply-bar, .attach-preview { display: flex; align-items: center; gap: 8px; max-width: 900px; margin: 0 auto 8px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ash-500); border-radius: 10px; padding: 6px 6px 6px 10px; }
.reply-text { flex: 1; min-width: 0; font-size: 13px; }
.reply-text b { display: block; font-size: 12px; color: var(--ash-700); }
.reply-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.attach-preview img { height: 64px; border-radius: 8px; }
.attach-preview { justify-content: space-between; }

/* ---------- Feed ---------- */
.post-composer textarea { border: 0; resize: vertical; padding: 8px 4px; min-height: 52px; box-shadow: none !important; }
.pc-row { display: flex; gap: 10px; align-items: flex-start; }
.pc-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.pc-preview { position: relative; margin: 8px 0; }
.pc-preview img { max-height: 220px; border-radius: 10px; }
.pc-preview .icon-btn { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.5); color: #fff; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-head .nm { font-weight: 700; }
.post-head .tm { font-size: 12px; color: var(--muted); }
.post-head .icon-btn { margin-left: auto; width: 34px; height: 34px; }
.post-head .icon-btn svg { width: 17px; height: 17px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 10px; }
.post-img { display: block; max-width: none; width: calc(100% + 32px); margin: 0 -16px 10px; max-height: 520px; object-fit: cover; cursor: zoom-in; background: var(--ash-150); }
.post-stats { font-size: 13px; color: var(--muted); padding: 6px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.post-stats svg { width: 16px; height: 16px; }
.comments { display: grid; gap: 8px; margin-top: 6px; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment .cb { background: var(--ash-100); border-radius: 12px; padding: 7px 11px; min-width: 0; }
.comment .cb b { font-size: 13px; display: block; }
.comment .cb p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.comment .cm { font-size: 11.5px; color: var(--muted); margin: 2px 0 0 10px; }
.comment .cm button { background: none; border: 0; color: var(--muted); font-size: 11.5px; padding: 0 0 0 8px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { border-radius: 20px; padding: 8px 14px; }
.comment-form .send-btn { width: 38px; height: 38px; }
.comment-form .send-btn svg { width: 17px; height: 17px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty svg { width: 40px; height: 40px; color: var(--ash-300); display: block; margin: 0 auto 10px; }

/* ---------- Dashboard ---------- */
.pad > .stats, .pad > .dash-grid, .pad > .tg-actions { max-width: 820px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: linear-gradient(150deg, var(--ash-700), var(--ash-850)); color: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--ash-300); }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 2px; letter-spacing: .3px; }
.stat .s { font-size: 12px; color: var(--ash-300); }
.stat:nth-child(2) { background: linear-gradient(150deg, #5d646c, #3b4047); }
.stat:nth-child(3) { background: linear-gradient(150deg, #6c727a, #484d54); }
.stat:nth-child(4) { background: linear-gradient(150deg, #7c8189, #555a61); }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; margin-right: auto; }
.seg { display: inline-flex; background: var(--ash-100); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.target { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--ash-50); }
.t-top { display: flex; align-items: flex-start; gap: 8px; }
.t-title { font-weight: 700; flex: 1; min-width: 0; }
.t-desc { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--ash-150); color: var(--ash-700); white-space: nowrap; }
.chip.active { background: #e6eef6; color: #2c5d86; }
.chip.done { background: #e3f2e9; color: #1f6b42; }
.chip.paused { background: #f6efe0; color: #8a6413; }
.chip.late { background: #fbeceb; color: #9a2f27; }
.bar { height: 9px; border-radius: 6px; background: var(--ash-200); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--ash-500), var(--ash-700)); transition: width .4s; }
.bar.done i { background: linear-gradient(90deg, #4aa676, #2f8f5b); }
.t-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); gap: 8px; flex-wrap: wrap; }
.t-meta b { color: var(--ink); }
.t-actions { display: flex; gap: 2px; }
.t-actions .icon-btn { width: 32px; height: 32px; }
.t-actions .icon-btn svg { width: 16px; height: 16px; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--ash-200); }
.lm { position: relative; padding: 0 0 14px; }
.lm .dot { position: absolute; left: -22px; top: 2px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ash-400); background: var(--card); display: grid; place-items: center; cursor: pointer; padding: 0; }
.lm .dot svg { width: 11px; height: 11px; color: #fff; }
.lm.achieved .dot { background: var(--ok); border-color: var(--ok); }
.lm-box { display: flex; gap: 8px; align-items: flex-start; }
.lm-title { font-weight: 700; }
.lm.achieved .lm-title { color: var(--ash-600); }
.lm-date { font-size: 12px; color: var(--muted); }
.lm-desc { font-size: 13px; color: var(--muted); white-space: pre-wrap; }

/* ---------- Settings ---------- */
.profile-row { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hint { font-size: 12.5px; background: var(--ash-100); border-radius: 8px; padding: 8px 10px; color: var(--ash-700); }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; }
.list { display: grid; gap: 8px; margin-bottom: 10px; }
.list-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--ash-50); font-size: 14px; }
.list-item .grow small { display: block; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings .card p { margin: 0 0 10px; font-size: 15px; }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 100; background: radial-gradient(900px 500px at 50% -10%, #4a5058 0%, transparent 60%), linear-gradient(160deg, var(--ash-800), var(--ash-950)); color: #fff; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)); }
.lock-inner { text-align: center; width: 100%; max-width: 320px; display: flex; flex-direction: column; align-items: center; }
.lock .auth-title span { color: var(--ash-400); }
.lock-sub { color: var(--ash-300); margin: 4px 0 18px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; height: 16px; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ash-400); }
.pin-dots i.on { background: var(--card); border-color: #fff; }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.lock-err { min-height: 20px; color: #ffb4ad; font-size: 13px; margin: 10px 0 6px; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 22px; justify-content: center; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: rgba(255,255,255,.09); color: #fff; font-size: 26px; font-weight: 500; display: grid; place-items: center; }
.keypad button:active { background: rgba(255,255,255,.22); }
.keypad button svg { width: 30px; height: 30px; }
.keypad.no-pin button:not(.k-finger) { visibility: hidden; }
.keypad .k-finger.off { visibility: hidden; }

/* ---------- Sheet / modal / viewer / toast ---------- */
.sheet-bg, .modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20,22,26,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal-bg { align-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px 16px 0 0; padding: 8px 8px calc(8px + var(--safe-b)); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; border: 0; background: none; border-radius: 10px; font-weight: 600; text-align: left; }
.sheet button:hover { background: var(--ash-100); }
.sheet .sheet-preview { padding: 8px 14px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal { width: 100%; max-width: 460px; background: var(--card); border-radius: 16px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90dvh; overflow-y: auto; display: grid; gap: 12px; }
.modal h3 { margin: 0; }
#modal-fields { display: grid; gap: 12px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex !important; align-items: center; gap: 8px; grid-template-columns: none !important; }
.check input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(10,11,13,.94); display: grid; place-items: center; padding: 20px; }
.viewer img { max-width: 100%; max-height: 92dvh; border-radius: 6px; }
.viewer .icon-btn { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 120; background: var(--ash-900); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw; text-align: center; }
.toast.err { background: #8d2a23; }

/* ---------- Responsive (phones) ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { min-height: 56px; padding-left: 14px; padding-right: 14px; }
  .pad { padding: 12px; }
  .messages { padding: 10px 8px 6px; }
  .bubble { max-width: 85%; }
  .secure-tag { display: none; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .post-img { width: calc(100% + 32px); }
  .jump-down { bottom: calc(76px + var(--safe-b)); }
}
@media (max-width: 380px) {
  .keypad { grid-template-columns: repeat(3, 64px); gap: 12px 18px; }
  .keypad button { width: 64px; height: 64px; }
  .stat .v { font-size: 22px; }
}

/* ---------- Emoji panel ---------- */
.emoji-panel { max-width: 900px; margin: 0 auto 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { border: 0; background: none; font-size: 22px; padding: 4px 10px; border-radius: 8px; flex: none; }
.emoji-tabs button.on { background: var(--ash-150); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-height: 220px; overflow-y: auto; padding: 6px; }
.emoji-grid button { border: 0; background: none; font-size: 27px; height: 44px; border-radius: 8px; line-height: 1; }
.emoji-grid button:hover, .emoji-grid button:active { background: var(--ash-100); }
.bubble .text.jumbo { font-size: 40px; line-height: 1.15; }

/* ---------- Together (coffee & trips) ---------- */
.tg-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tg-actions .btn { flex: 1; min-width: 150px; }
.big-btn { padding: 14px 16px; font-size: 17px; }
.stat .v small { font-size: 15px; font-weight: 600; color: var(--ash-300); margin-left: 4px; }
.trip { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.trip:last-child { border-bottom: 0; }
.trip-no { flex: none; width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(150deg, var(--ash-600), var(--ash-850)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; line-height: 1.1; text-align: center; }
.trip-no b { display: block; font-size: 19px; }
.trip-title { font-weight: 700; }
.trip-meta { font-size: 14px; color: var(--muted); }
.trip-note { font-size: 15px; color: var(--ash-700); white-space: pre-wrap; margin-top: 2px; }
.cf { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cf:last-child { border-bottom: 0; }
.cf-cups { flex: none; min-width: 52px; text-align: center; font-weight: 800; background: var(--ash-100); border-radius: 10px; padding: 6px 4px; font-size: 15px; }
.cf-meta { font-size: 14px; color: var(--muted); }
.stat .v.small-v { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 6px; }
.bubble:has(.msg-img) { max-width: min(80%, 320px); }

/* Desktop-site mode on phones: scale up to real phone size (set by fit.js) */
html.zfix { zoom: var(--z); }
html.zfix .app { height: var(--vvh, calc(100dvh / var(--z))); max-width: none; box-shadow: none; }
html.zfix .auth-wrap, html.zfix .lock { min-height: calc(100dvh / var(--z)); }
html.zfix .secure-tag { display: none; }
@media (max-width: 760px) { body:has(.app) { background: var(--ash-100); } .app { box-shadow: none; } }
body:has(.app) { background: var(--dock); }

/* ================= Themes (from the ASH logo colours) ================= */
html[data-theme="mocha"] {
  --ash-950:#1a1617; --ash-900:#231f20; --ash-850:#2c2626; --ash-800:#38302e; --ash-700:#463c38; --ash-600:#534642; --ash-500:#75675f;
  --ash-400:#968a82; --ash-300:#b9aea6; --ash-200:#d9d1c7; --ash-150:#e5dfd7; --ash-100:#ece7e1; --ash-50:#f4f1ec;
  --accent:#534642; --accent-2:#3d332f; --line:#ddd5cc; --muted:#776c66; --ink:#231f20;
  --chat-bg:#e6dfd6; --bubble-me:#534642; --bubble-them:#fffdfa; --card:#fffdfa; --dock:#231f20;
}
html[data-theme="sand"] {
  --ash-950:#141112; --ash-900:#231f20; --ash-850:#231f20; --ash-800:#2f2a2a; --ash-700:#4a4140; --ash-600:#534642; --ash-500:#7d716a;
  --ash-400:#a39890; --ash-300:#c9bfb7; --ash-200:#e0d8cf; --ash-150:#eae4dd; --ash-100:#f1eee9; --ash-50:#f8f6f2;
  --accent:#231f20; --accent-2:#000000; --line:#e3dcd3; --muted:#7a706a; --ink:#231f20;
  --chat-bg:#f1eee9; --bubble-me:#231f20; --bubble-them:#ffffff; --card:#ffffff; --dock:#231f20;
}
html[data-theme="charcoal"] {
  --ash-950:#0e0c0c; --ash-900:#151313; --ash-850:#1b1818; --ash-800:#2a2525; --ash-700:#3a3331; --ash-600:#534642; --ash-500:#8a7d76;
  --ash-400:#a2968f; --ash-300:#bdb2ab; --ash-200:#3d3634; --ash-150:#342e2d; --ash-100:#1f1b1b; --ash-50:#262222;
  --accent:#6a5b55; --accent-2:#7b6b64; --line:#3a3331; --muted:#a89e98; --ink:#f1eee9;
  --chat-bg:#171414; --bubble-me:#534642; --bubble-them:#2c2727; --card:#262121; --field:#2c2727; --surface:#211d1d; --dock:#0f0d0d;
  color-scheme: dark;
}
html[data-theme="charcoal"] .msg.them .bubble .meta, html[data-theme="charcoal"] .day-sep { color: var(--ash-400); }
html[data-theme="charcoal"] .day-sep, html[data-theme="charcoal"] .load-older { background: rgba(60,52,50,.9); color: var(--ash-300); }
html[data-theme="charcoal"] .comment .cb, html[data-theme="charcoal"] .cf-cups { background: var(--ash-150); }
html[data-theme="charcoal"] .hint { background: var(--ash-150); color: var(--ash-300); }
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-opt { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px; text-align: left; font-weight: 600; color: var(--ink); }
.theme-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83,70,66,.15); }
.swatch { display: flex; flex: none; border-radius: 8px; overflow: hidden; border: 1px solid rgba(0,0,0,.12); }
.swatch i { width: 14px; height: 30px; }
.theme-opt small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.toggle { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15.5px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ================= Chat extras ================= */
.dropdown { position: absolute; right: 10px; top: calc(100% - 6px); z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; min-width: 230px; animation: fade .12s; }
.dropdown button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 12px; border-radius: 10px; font-weight: 600; color: var(--ink); text-align: left; }
.dropdown button:hover { background: var(--ash-100); }
.search-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); position: relative; z-index: 5; }
.search-bar input { border-radius: 20px; padding: 9px 14px; }
.search-results { position: absolute; left: 0; right: 0; top: 120px; bottom: 0; z-index: 8; background: var(--card); overflow-y: auto; }
.sr-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px 16px; color: var(--ink); }
.sr-item small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.sr-item mark { background: #f3dfa2; color: inherit; border-radius: 3px; padding: 0 1px; }
.pin-bar { flex: none; position: relative; z-index: 4; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 8px 16px; text-align: left; color: var(--ink); }
.pin-bar svg { color: var(--accent); width: 18px; height: 18px; }
.pin-text { min-width: 0; flex: 1; font-size: 14.5px; }
.pin-text b { display: block; font-size: 12.5px; color: var(--muted); }
.pin-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .pin-mark { font-size: 12px; margin-right: 3px; }
.msg { position: relative; transition: transform .18s; }
.msg.swiping { transition: none; }
.swipe-ic { position: absolute; left: -36px; top: 50%; margin-top: -15px; width: 30px; height: 30px; border-radius: 50%; background: var(--card); color: var(--ash-600); display: grid; place-items: center; opacity: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.swipe-ic svg { width: 17px; height: 17px; }
.msg.has-react { margin-bottom: 18px; }
.reacts { position: absolute; bottom: -19px; display: inline-flex; align-items: center; gap: 1px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1px 6px; font-size: 15px; line-height: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--ink); cursor: pointer; }
.msg.me .reacts { left: 8px; }
.msg.them .reacts { left: 8px; }
.reacts b { font-size: 11.5px; margin-left: 2px; color: var(--muted); }
.react-row { display: flex; justify-content: space-around; padding: 10px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.react-row button { width: 54px !important; height: 54px; padding: 0 !important; border-radius: 50% !important; font-size: 30px; justify-content: center; transition: transform .12s; }
.react-row button:active { transform: scale(1.25); }
.react-row button.mine { background: var(--ash-150) !important; }
.doc-card { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 280px; padding: 9px 10px; margin: -2px -4px 5px; border-radius: 9px; background: rgba(0,0,0,.06); color: inherit; text-decoration: none; }
.msg.me .doc-card { background: rgba(255,255,255,.12); }
.doc-ic { flex: none; width: 40px; height: 44px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; }
.msg.me .doc-ic { background: rgba(255,255,255,.22); }
.doc-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.doc-size { font-size: 12.5px; opacity: .75; }
.attach-doc { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
@media (pointer: coarse) { .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }

/* media panel */
.media-panel { position: fixed; inset: 0; z-index: 60; background: var(--ash-100); display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; }
html.zfix .media-panel { max-width: none; }
.media-tabs { margin: 10px auto; }
.media-tabs button { padding: 8px 20px; font-size: 15px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 3px; padding: 3px; }
.media-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: var(--ash-200); display: block; }
.media-list a, .media-list .ml { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--card); }
.media-list .grow small { display: block; color: var(--muted); font-size: 13px; }
.media-list .lk { word-break: break-all; color: #2f6fa8; font-size: 15px; }
html[data-theme="charcoal"] .media-list .lk { color: #8fc1ec; }
.sheet-themes { padding: 6px 4px 8px; } .sheet .theme-opt { padding: 10px; }

/* ================= Multi-chat: list + conversation ================= */
.app:not(.is-core) .core-only { display: none !important; }
.app.in-chat .dock { display: none; }
.list-top { gap: 10px; }
.list-logo { width: 34px; height: 34px; border-radius: 9px; }
.list-search { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); }
.list-search input { border-radius: 22px; padding: 9px 14px; background: var(--ash-100); border-color: transparent; }
#chat-list { background: var(--card); }
.chat-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 11px 16px; text-align: left; color: var(--ink); border-bottom: 1px solid var(--line); }
.chat-item:hover, .chat-item:active { background: var(--ash-100); }
.chat-item .avatar { width: 52px; height: 52px; font-size: 18px; position: relative; overflow: visible; }
.chat-item .avatar img { border-radius: 50%; }
.chat-item .avatar.on::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: #3fb36b; border: 2px solid var(--card); }
.ci-mid { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: baseline; gap: 8px; }
.ci-name { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12.5px; color: var(--muted); flex: none; }
.ci-time.new { color: var(--accent); font-weight: 700; }
.ci-bot { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.ci-last { flex: 1; min-width: 0; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.ci-last svg { width: 16px; height: 16px; flex: none; }
.ci-last .read { color: var(--read); }
.ci-last.typing { color: #2f8f5b; font-style: italic; }
.ci-last.unread { color: var(--ink); font-weight: 600; }
.ci-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; display: grid; place-items: center; }
.ci-tag { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.back-btn { margin-left: -8px; margin-right: -4px; }
.user-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; background: var(--ash-50); }
.user-row.off { opacity: .55; }
.user-row .grow b { display: block; font-size: 15.5px; }
.user-row .grow small { color: var(--muted); font-size: 13px; }
.user-row .btn { padding: 6px 10px; font-size: 13px; }
