/* Inter (SIL OFL 1.1, lihat /fonts/Inter-LICENSE.txt) — huruf yang paling mirip San Francisco macOS,
   dipakai di Windows/Android/Linux. Di Mac & iPhone tetap memakai San Francisco asli. */
@font-face {
  font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2-variations'), url(/fonts/inter-latin-wght-normal.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;
}
@font-face {
  font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations'), url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Jekardah Chat — tata letak terinspirasi WhatsApp Web */
/* Palet biru Jekardah: primary #2556BC · interactive #467DDB · highlight #85C3E5 · surface #E7F1F9 · neutral #515151 */
:root {
  --green: #2556BC;        /* primary: tombol utama, header (nama variabel lama dipertahankan) */
  --green-dark: #1F4CA8;   /* teks/label beraksen di atas latar terang */
  --badge: #467DDB;        /* interactive: badge belum dibaca */
  --highlight: #85C3E5;
  --rail: #E7F1F9;
  --panel: #ffffff;
  --head: #E7F1F9;
  --border: #DCE6EF;
  --text: #1E2329;
  --text-2: #515151;
  --text-3: #8A9097;
  --icon: #515151;
  --hover: #F1F7FC;
  --active: #E7F1F9;
  --search: #E7F1F9;
  --chat-bg: #EEF4FA;
  --in: #ffffff;
  --out: #D3E6F8;
  --chip: #E7F1F9;
  --chip-active: #D3E6F8;
  --chip-active-text: #2556BC;
  --day-chip: #ffffff;
  --tick: #8A9097;
  --tick-read: #467DDB;
  --danger: #d93025;
  --shadow: 0 1px .5px rgba(20, 40, 70, .13);
  --menu-shadow: 0 2px 5px 0 rgba(20, 40, 70, .22), 0 2px 10px 0 rgba(20, 40, 70, .14);
  --intro-bg: #E7F1F9;
  --intro-screen: #C9DFF2;
  --login-bg: #E7F1F9;
  --overlay: rgba(255, 255, 255, .85);
  /* Gaya tulisan macOS: San Francisco di Mac/iPhone; Inter (kembaran SF) di Windows, Android & Linux */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Variable", "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, "Noto Sans", Ubuntu, Cantarell, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #467DDB;
    --green-dark: #85C3E5;
    --badge: #467DDB;
    --rail: #1B222B;
    --panel: #12161C;
    --head: #1B222B;
    --border: #232C36;
    --text: #E6EDF3;
    --text-2: #9AA6B2;
    --text-3: #8A96A3;
    --icon: #AEB8C4;
    --hover: #1B222B;
    --active: #243040;
    --search: #1B222B;
    --chat-bg: #0D1218;
    --in: #1F2731;
    --out: #1E3A64;
    --chip: #1B222B;
    --chip-active: #1C3157;
    --chip-active-text: #85C3E5;
    --day-chip: #161C24;
    --tick: #8A96A3;
    --tick-read: #85C3E5;
    --shadow: 0 1px .5px rgba(0, 0, 0, .3);
    --menu-shadow: 0 2px 5px 0 rgba(0, 0, 0, .4), 0 2px 10px 0 rgba(0, 0, 0, .3);
    --intro-bg: #161C24;
    --intro-screen: #243040;
    --login-bg: #12161C;
    --overlay: rgba(13, 18, 24, .85);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--text);
  background: var(--panel);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
svg { display: block; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--icon); flex-shrink: 0;
  transition: background-color .15s;
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn:hover, .icon-btn.active { background: rgba(11, 20, 26, .08); }
@media (prefers-color-scheme: dark) { .icon-btn:hover, .icon-btn.active { background: rgba(255, 255, 255, .1); } }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg { width: 20px; height: 20px; }

/* ---------- Loading ---------- */
.loading-screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--intro-bg); gap: 18px; color: var(--text-2);
}
.loading-logo { width: 72px; height: 72px; opacity: .55; }
.loading-bar { width: 320px; max-width: 70vw; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.loading-bar span { display: block; height: 100%; width: 40%; background: var(--green); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.loading-title { font-size: 17px; color: var(--text); }
.loading-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; background: var(--login-bg); overflow: auto; }
.login-band { height: 222px; background: var(--green); }
@media (prefers-color-scheme: dark) { .login-band { background: #2556BC; } }
.login-brand {
  max-width: 1000px; margin: 0 auto; padding: 28px 16px 0;
  display: flex; align-items: center; gap: 14px; color: #fff; font-size: 14px; font-weight: 500; letter-spacing: .4px;
}
.login-brand img { filter: brightness(0) invert(1); }
.login-card {
  position: relative; max-width: 1000px; margin: -130px auto 40px; background: var(--panel);
  border-radius: 3px; box-shadow: 0 17px 50px 0 rgba(11, 20, 26, .19), 0 12px 15px 0 rgba(11, 20, 26, .24);
}
.login-main { display: flex; gap: 40px; padding: 64px 60px 56px; }
.login-text { flex: 1; }
.login-text h1 { font-size: 28px; font-weight: 300; margin: 0 0 40px; color: var(--text); }
.login-text ol { margin: 0; padding-left: 22px; color: var(--text); font-size: 18px; line-height: 28px; }
.login-text li { margin-bottom: 18px; padding-left: 6px; }
.login-text b { font-weight: 500; }
.login-action { width: 300px; display: flex; flex-direction: column; gap: 20px; }
.login-google-box {
  border: 1px solid var(--border); border-radius: 12px; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; margin: 0; }
.login-note { color: var(--text-2); font-size: 13px; text-align: center; margin: 0; line-height: 1.5; }
.login-note code { background: var(--search); padding: 1px 5px; border-radius: 4px; }
.login-foot {
  border-top: 1px solid var(--border); background: var(--rail); padding: 26px 60px; color: var(--text-2);
  display: flex; align-items: center; gap: 10px; font-size: 14px; border-radius: 0 0 3px 3px;
}
.dev-login { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--text-3); border-radius: 12px; padding: 14px; }
.dev-title { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.dev-login input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); outline: none; }
.dev-login input:focus { border-color: var(--green); }
.dev-login button { padding: 9px; border-radius: 20px; background: var(--green); color: #fff; font-weight: 500; }
@media (max-width: 860px) {
  .login-band { height: 160px; }
  .login-card { margin: -80px 12px 24px; }
  .login-main { flex-direction: column; padding: 32px 22px; gap: 28px; }
  .login-text h1 { font-size: 22px; margin-bottom: 20px; }
  .login-text ol { font-size: 15px; line-height: 22px; }
  .login-action { width: 100%; }
  .login-foot { padding: 18px 22px; }
}

/* ---------- Layout ---------- */
.app { position: fixed; inset: 0; display: flex; background: var(--panel);
  /* iPhone berponi / home indicator & Android gesture bar saat dipasang sebagai aplikasi */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.rail {
  width: 64px; flex-shrink: 0; background: var(--rail); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 8px;
}
.rail-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--icon);
}
.rail-btn svg { width: 24px; height: 24px; fill: currentColor; }
.rail-btn:hover { background: rgba(11, 20, 26, .08); }
.rail-btn.active { background: rgba(11, 20, 26, .1); }
@media (prefers-color-scheme: dark) { .rail-btn:hover, .rail-btn.active { background: rgba(255, 255, 255, .1); } }
.rail-badge {
  position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--badge); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--rail);
}
.rail-spacer { flex: 1; }
.rail-avatar { overflow: hidden; }
.rail-avatar .avatar { width: 32px; height: 32px; }

.side {
  position: relative; width: 30%; min-width: 340px; max-width: 460px; flex-shrink: 0;
  border-right: 1px solid var(--border); background: var(--panel); overflow: hidden;
}
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; }
.side-head { height: 64px; padding: 10px 12px 0 20px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.side-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.head-actions { display: flex; gap: 6px; align-items: center; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; z-index: 50; min-width: 200px; padding: 9px 0; border-radius: 3px;
  background: var(--panel); box-shadow: var(--menu-shadow); transform-origin: top right; animation: pop .12s ease-out;
}
@media (prefers-color-scheme: dark) { .menu { background: #232B36; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.menu button { display: block; width: 100%; text-align: left; padding: 0 24px; height: 40px; font-size: 14.5px; color: var(--text); }
.menu button:hover { background: var(--hover); }
@media (prefers-color-scheme: dark) { .menu button:hover { background: #161C24; } }

.search { padding: 6px 12px 8px; flex-shrink: 0; }
.search-box {
  display: flex; align-items: center; gap: 14px; height: 38px; background: var(--search); border-radius: 8px; padding: 0 14px; cursor: text;
}
.search-box svg { width: 20px; height: 20px; fill: var(--icon); flex-shrink: 0; }
.search-box input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; min-width: 0; }
.search-box input::placeholder { color: var(--text-2); }
.search-box input::-webkit-search-cancel-button { filter: grayscale(1); }

.chips { display: flex; gap: 8px; padding: 0 14px 8px; flex-shrink: 0; }
.chip { height: 32px; padding: 0 13px; border-radius: 16px; background: var(--chip); color: var(--text-2); font-size: 14.5px; }
.chip:hover { filter: brightness(.97); }
.chip.active { background: var(--chip-active); color: var(--chip-active-text); }

.notif-banner {
  display: flex; gap: 14px; align-items: center; margin: 0 0 4px; padding: 14px 16px; background: #467DDB;
  color: #fff; flex-shrink: 0;
}
@media (prefers-color-scheme: dark) { .notif-banner { background: #161C24; color: var(--text); } }
.notif-icon { width: 46px; height: 46px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon svg { width: 24px; height: 24px; fill: #467DDB; }
.notif-title { font-size: 16px; }
.link { color: inherit; font-size: 14px; opacity: .9; padding: 2px 0; }
.link:hover { text-decoration: underline; }

/* ---------- Daftar chat ---------- */
.chat-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
.chat-item {
  display: flex; align-items: center; width: 100%; height: 72px; padding: 0 0 0 13px; text-align: left; position: relative;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item .avatar-wrap { padding-right: 13px; }
.chat-item .body {
  flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center;
  border-top: 1px solid var(--border); padding-right: 15px;
}
.chat-item:first-child .body { border-top-color: transparent; }
.chat-item:hover .body, .chat-item.active .body, .chat-item:hover + .chat-item .body, .chat-item.active + .chat-item .body { border-top-color: transparent; }
.row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row + .row { margin-top: 2px; }
.chat-name { flex: 1; font-size: 16px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.chat-item.unread .chat-time { color: var(--badge); }
.chat-preview {
  flex: 1; display: flex; align-items: center; gap: 3px; font-size: 14.5px; color: var(--text-2); min-width: 0;
}
.chat-preview .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-preview .typing { color: var(--green); }
.chat-preview .tick { flex-shrink: 0; }
.unread-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
@media (prefers-color-scheme: dark) { .unread-badge { color: #12161C; } }
.pill-pending { font-size: 11px; color: var(--text-2); border: 1px solid var(--border); border-radius: 10px; padding: 1px 7px; flex-shrink: 0; }
.list-empty { padding: 40px 30px; text-align: center; color: var(--text-2); line-height: 1.6; font-size: 14px; }
.list-empty .btn-primary { margin-top: 16px; }
.start-email .avatar { background: var(--green); }
.start-email .avatar svg { fill: #fff; }

.avatar {
  width: 49px; height: 49px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #D6E3EF;
  display: flex; align-items: center; justify-content: center; position: relative;
}
@media (prefers-color-scheme: dark) { .avatar { background: #4E5D6E; } }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 72%; height: 72%; fill: #fff; margin-top: 18%; }
@media (prefers-color-scheme: dark) { .avatar svg { fill: #C7D2DE; } }
.avatar .initial { color: #fff; font-weight: 500; font-size: 40%; }
.avatar-wrap { position: relative; }
.online-dot {
  position: absolute; right: 13px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--badge);
  border: 2px solid var(--panel);
}

/* ---------- Drawer ---------- */
.drawer {
  position: absolute; inset: 0; background: var(--panel); display: flex; flex-direction: column; z-index: 10;
  transform: translateX(-100%); transition: transform .25s cubic-bezier(.1, .82, .25, 1); visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head {
  height: 108px; display: flex; align-items: flex-end; gap: 22px; padding: 0 20px 14px; flex-shrink: 0;
  background: var(--panel); color: var(--text);
}
.drawer-head h2 { margin: 0 0 8px; font-size: 19px; font-weight: 500; }
.drawer-head.flat { height: 60px; align-items: center; background: var(--head); padding: 0 16px; }
.drawer-head.flat h2 { margin: 0; font-size: 16px; font-weight: 400; }
.new-chat-form { padding: 6px 28px 22px; border-bottom: 1px solid var(--border); }
.field-label { font-size: 14px; color: var(--green-dark); margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .field-label { color: var(--green); } }
.email-field { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--green); padding: 6px 0; }
.email-field svg { width: 20px; height: 20px; fill: var(--icon); }
.email-field input { flex: 1; border: 0; outline: none; background: none; font-size: 16px; padding: 4px 0; }
.field-hint { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 12px 0 0; }
.field-error { font-size: 13px; color: var(--danger); margin: 10px 0 0; }
.btn-primary {
  margin-top: 18px; height: 40px; padding: 0 22px; border-radius: 20px; background: var(--green); color: #fff; font-weight: 500;
}
.btn-primary:hover { background: var(--green-dark); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #fff; } .btn-primary:hover { background: #2556BC; } }
.btn-primary:disabled { opacity: .6; cursor: default; }
.section-title { padding: 24px 28px 12px; color: var(--green-dark); font-size: 15px; }
@media (prefers-color-scheme: dark) { .section-title { color: var(--green); } }

.profile-body { flex: 1; overflow-y: auto; background: var(--rail); }
@media (prefers-color-scheme: dark) { .profile-body { background: var(--panel); } }
.profile-photo { display: flex; justify-content: center; padding: 28px 0; }
.profile-photo .avatar { width: 200px; height: 200px; }
.profile-field { background: var(--panel); padding: 14px 30px 10px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11, 20, 26, .08); }
.editable { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid transparent; }
.editable:focus-within { border-bottom-color: var(--green); }
.editable input { flex: 1; border: 0; outline: none; background: none; font-size: 16px; padding: 8px 0; }
.profile-email { font-size: 16px; padding: 8px 0; word-break: break-all; }
.btn-danger { display: block; margin: 24px auto; color: var(--danger); padding: 10px 26px; border-radius: 20px; border: 1px solid var(--border); background: var(--panel); }
.btn-danger:hover { background: var(--hover); }

/* ---------- Area utama ---------- */
.main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.intro {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--intro-bg); border-bottom: 6px solid var(--green); padding: 28px; color: var(--text-2);
}
.intro-art svg { width: 320px; max-width: 70vw; height: auto; }
.intro h1 { font-size: 32px; font-weight: 300; color: var(--text); margin: 28px 0 12px; }
.intro p { font-size: 14px; line-height: 20px; margin: 0; max-width: 520px; }
.intro-foot { margin-top: 60px; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--text-3); }

.conv { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.conv-head {
  height: 60px; background: var(--head); display: flex; align-items: center; padding: 0 16px; gap: 6px; flex-shrink: 0;
  border-left: 1px solid var(--border); z-index: 2;
}
.back-btn { display: none; margin-left: -8px; }
.conv-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 15px; text-align: left; height: 100%; }
.conv-peer .avatar { width: 40px; height: 40px; }
.conv-peer-text { display: flex; flex-direction: column; min-width: 0; }
.conv-name { font-size: 16px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-status { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.conv-status.typing { color: var(--green); }

.messages {
  flex: 1; overflow-y: auto; position: relative;
  background: var(--chat-bg) url('/img/pattern-light.svg') repeat; background-size: 360px;
}
@media (prefers-color-scheme: dark) { .messages { background-image: url('/img/pattern-dark.svg'); } }
.messages-inner { position: relative; padding: 12px 6% 8px; display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }
.load-more { align-self: center; margin: 4px 0 10px; font-size: 12.5px; color: var(--text-2); }

.day-sep { align-self: center; margin: 10px 0 8px; position: sticky; top: 8px; z-index: 1; }
.day-sep span {
  display: inline-block; padding: 5px 12px 6px; border-radius: 7.5px; background: var(--day-chip); color: var(--text-2);
  font-size: 12.5px; box-shadow: var(--shadow); text-transform: uppercase;
}
.sys-note {
  align-self: center; max-width: 90%; text-align: center; margin: 4px 0 10px; padding: 6px 12px; border-radius: 7.5px;
  background: #DCEEF9; color: #1F4CA8; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) { .sys-note { background: #161C24; color: #85C3E5; } }
.sys-note svg { display: inline-block; vertical-align: -2px; width: 12px; height: 12px; fill: currentColor; margin-right: 4px; }
.sys-note button { color: var(--green-dark); font-weight: 600; margin-left: 4px; }
@media (prefers-color-scheme: dark) { .sys-note button { color: var(--green); } }

.msg-row { display: flex; margin-bottom: 2px; padding: 0 9px; }
.msg-row.first { margin-top: 10px; }
.msg-row.out { justify-content: flex-end; }
.bubble {
  position: relative; max-width: 65%; padding: 6px 7px 8px 9px; border-radius: 7.5px; box-shadow: var(--shadow);
  background: var(--in); color: var(--text); font-size: 15px; line-height: 21px; letter-spacing: -.003em; word-wrap: break-word; overflow-wrap: anywhere;
}
.msg-row.out .bubble { background: var(--out); }
.msg-row.in.first .bubble { border-top-left-radius: 0; }
.msg-row.out.first .bubble { border-top-right-radius: 0; }
.msg-row.first .bubble::before {
  content: ''; position: absolute; top: 0; width: 8px; height: 13px;
}
.msg-row.in.first .bubble::before { left: -8px; background: var(--in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg-row.out.first .bubble::before { right: -8px; background: var(--out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble .text { white-space: pre-wrap; }
.bubble .text::after { content: ''; display: inline-block; width: 52px; height: 1px; }
.msg-row.out .bubble .text::after { width: 72px; }
.bubble a { color: #2556BC; text-decoration: none; }
.bubble a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .bubble a { color: #467DDB; } }
.bubble .big-emoji { font-size: 40px; line-height: 48px; }
.meta {
  position: absolute; right: 7px; bottom: 3px; display: flex; align-items: center; gap: 3px;
  font-size: 11px; line-height: 15px; color: var(--text-2); white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .msg-row.out .meta { color: rgba(233, 237, 239, .6); } }
.tick { width: 16px; height: 16px; fill: var(--tick); flex-shrink: 0; }
.tick.read { fill: var(--tick-read); }
.tick.clock { width: 14px; height: 14px; }
.tick.fail { fill: var(--danger); width: 15px; height: 15px; }
.bubble.failed { cursor: pointer; }
.bubble.has-img { padding: 3px 3px 5px; }
.bubble.has-img .text { display: block; padding: 6px 4px 0 6px; }
.msg-img { display: block; max-width: 330px; width: 100%; max-height: 340px; min-height: 80px; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: rgba(0, 0, 0, .05); }
.bubble.has-img.no-caption .meta {
  right: 9px; bottom: 9px; color: #fff; padding: 1px 6px; border-radius: 10px;
  background: linear-gradient(to top, rgba(11, 20, 26, .5), rgba(11, 20, 26, .3));
}
.bubble.has-img.no-caption .tick { fill: #fff; }
.bubble.has-img.no-caption .tick.read { fill: var(--tick-read); }

.scroll-down {
  position: absolute; right: 18px; bottom: 76px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--panel); box-shadow: var(--menu-shadow); display: flex; align-items: center; justify-content: center; z-index: 3;
}
.scroll-down svg { width: 26px; height: 26px; fill: var(--icon); }
.scroll-down .badge {
  position: absolute; top: -6px; left: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--badge); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}

.composer {
  min-height: 62px; background: var(--head); display: flex; align-items: flex-end; gap: 4px; padding: 10px 16px; flex-shrink: 0; z-index: 2;
}
.composer .icon-btn { margin-bottom: 1px; }
.composer-input { flex: 1; min-width: 0; background: var(--panel); border-radius: 8px; padding: 9px 12px; margin: 0 6px; }
@media (prefers-color-scheme: dark) { .composer-input { background: #243040; } }
.composer-input textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: none; font-size: 15px; line-height: 20px;
  max-height: 120px; overflow-y: auto; padding: 0;
}
.composer-input textarea::placeholder { color: var(--text-2); }
.send-btn { color: var(--icon); }
.send-btn.ready { color: var(--green); }

.emoji-panel {
  height: 280px; background: var(--head); border-top: 1px solid var(--border); overflow-y: auto; padding: 10px 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); align-content: start; gap: 2px; z-index: 2;
}

.emoji-panel button:hover { background: rgba(11, 20, 26, .08); }

.media-preview {
  position: absolute; inset: 0; z-index: 20; background: var(--rail); display: flex; flex-direction: column;
}
.mp-head { height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 16px; font-size: 16px; }
.mp-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mp-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: var(--menu-shadow); }
.mp-foot { display: flex; align-items: center; gap: 16px; padding: 16px 6% 28px; }
.mp-foot input { flex: 1; height: 42px; border: 0; outline: none; border-radius: 8px; padding: 0 14px; background: var(--panel); font-size: 15px; }
.mp-send { width: 60px; height: 60px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; box-shadow: var(--menu-shadow); }
.mp-send svg { width: 26px; height: 26px; fill: #fff; margin-left: 3px; }
.mp-send:disabled { opacity: .6; }

/* ---------- Info kontak ---------- */
.info-panel { width: 30%; min-width: 320px; max-width: 440px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--rail); display: flex; flex-direction: column; }
@media (prefers-color-scheme: dark) { .info-panel { background: var(--panel); } }
.info-body { flex: 1; overflow-y: auto; }
.info-card { background: var(--panel); padding: 28px 30px 20px; text-align: center; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11, 20, 26, .08); }
.info-card .avatar { width: 200px; height: 200px; margin: 0 auto 16px; }
.info-card h3 { margin: 0; font-size: 24px; font-weight: 400; word-break: break-word; }
.info-card .sub { color: var(--text-2); font-size: 16px; margin-top: 4px; word-break: break-all; }
.info-section { background: var(--panel); padding: 16px 30px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11, 20, 26, .08); }
.info-section .label { color: var(--text-2); font-size: 14px; margin-bottom: 8px; }
.info-section .value { font-size: 15px; line-height: 1.5; word-break: break-word; }
.info-section .btn-primary { margin-top: 12px; }

/* ---------- Overlay ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 60px 20px 20px; backdrop-filter: blur(2px); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: var(--menu-shadow); }
.lightbox-actions { position: absolute; top: 12px; right: 16px; display: flex; gap: 6px; }
.lightbox-actions .icon-btn { background: var(--panel); box-shadow: var(--shadow); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; background: #2B3440; color: #fff;
  padding: 12px 22px; border-radius: 6px; font-size: 14px; box-shadow: var(--menu-shadow); max-width: calc(100vw - 32px);
}

/* Scrollbar tipis seperti WA */
.chat-list::-webkit-scrollbar, .messages::-webkit-scrollbar, .emoji-panel::-webkit-scrollbar, .info-body::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .emoji-panel::-webkit-scrollbar-thumb, .info-body::-webkit-scrollbar-thumb { background: rgba(11, 20, 26, .2); }
@media (prefers-color-scheme: dark) {
  .chat-list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .emoji-panel::-webkit-scrollbar-thumb, .info-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); }
}

/* ---------- Responsif ---------- */
@media (max-width: 1100px) {
  .info-panel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 30; box-shadow: var(--menu-shadow); }
}
@media (max-width: 760px) {
  .rail { display: none; }
  .side { width: 100%; max-width: none; min-width: 0; border-right: 0; }
  .main { display: none; }
  .app.show-conv .side { display: none; }
  .app.show-conv .main { display: flex; }
  .back-btn { display: inline-flex; }
  .conv-head { padding: 0 8px; border-left: 0; }
  .composer { padding: 8px; }
  .messages-inner { padding: 10px 2% 8px; }
  .bubble { max-width: 85%; }
  .info-panel { width: 100%; min-width: 0; max-width: none; }
  .scroll-down { right: 12px; }
}

/* ---------- Lampiran & dokumen ---------- */
.attach-wrap { position: relative; }
.attach-menu {
  position: absolute; left: 0; bottom: 52px; z-index: 30; min-width: 190px; padding: 8px 0; border-radius: 16px;
  background: var(--panel); box-shadow: var(--menu-shadow); transform-origin: bottom left; animation: pop .12s ease-out;
}
@media (prefers-color-scheme: dark) { .attach-menu { background: #232B36; } }
.attach-menu button { display: flex; align-items: center; gap: 14px; width: 100%; height: 44px; padding: 0 18px; font-size: 15px; color: var(--text); }
.attach-menu button:hover { background: var(--hover); }
@media (prefers-color-scheme: dark) { .attach-menu button:hover { background: #161C24; } }
.am-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.am-icon svg { width: 22px; height: 22px; }
.am-icon.doc svg { fill: #7f66ff; }
.am-icon.img svg { fill: #007bfc; }

.doc-icon {
  width: 30px; height: 38px; border-radius: 4px; flex-shrink: 0; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 5px; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .3px; position: relative;
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
}
.doc-icon::after { content: ''; position: absolute; top: 0; right: 0; width: 30%; height: 24%; background: rgba(255, 255, 255, .35); }

.bubble.has-doc { padding: 3px 3px 7px; }
.bubble.has-doc.no-caption { padding-bottom: 22px; }
.bubble.has-doc .text { display: block; padding: 6px 4px 0 6px; }
.doc-card {
  display: flex; align-items: center; gap: 12px; width: 300px; max-width: 100%; padding: 12px; border-radius: 6px;
  background: rgba(11, 20, 26, .05); color: inherit; text-decoration: none !important;
}
.msg-row.out .doc-card { background: rgba(11, 20, 26, .06); }
@media (prefers-color-scheme: dark) { .doc-card, .msg-row.out .doc-card { background: rgba(0, 0, 0, .18); } }
a.doc-card:hover { background: rgba(11, 20, 26, .09); }
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-name { font-size: 14.2px; color: var(--text); line-height: 19px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.doc-sub { font-size: 12px; color: var(--text-2); }
.doc-dl {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--text-3); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-dl svg { width: 18px; height: 18px; fill: var(--icon); }
.doc-dl:hover { background: rgba(11, 20, 26, .06); }

.mp-doc {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 48px; border-radius: 12px;
  background: var(--panel); box-shadow: var(--menu-shadow); max-width: 420px; text-align: center;
}
.mp-doc .doc-icon { width: 64px; height: 80px; font-size: 15px; padding-bottom: 10px; }
.mp-doc-name { font-size: 17px; color: var(--text); word-break: break-word; }
.mp-doc-meta { font-size: 13px; color: var(--text-2); }

/* ---------- Balas pesan ---------- */
:root { --q-own: #2556BC; --q-peer: #7f66ff; }
@media (prefers-color-scheme: dark) { :root { --q-own: #85C3E5; --q-peer: #a791ff; } }

.quote {
  display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 6px 10px 7px 10px; border-radius: 7.5px;
  border-left: 4px solid var(--q-color, var(--q-own)); background: rgba(11, 20, 26, .05); overflow: hidden;
}
@media (prefers-color-scheme: dark) { .quote { background: rgba(0, 0, 0, .2); } }
.quote.own { --q-color: var(--q-own); }
.quote.peer { --q-color: var(--q-peer); }
.quote.deleted { --q-color: var(--text-3); font-style: italic; }
.q-name { font-size: 12.8px; font-weight: 600; color: var(--q-color); line-height: 18px; }
.q-text {
  font-size: 13.2px; color: var(--text-2); line-height: 18px; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.q-ic { display: inline-block; width: 15px; height: 15px; fill: currentColor; vertical-align: -3px; margin-right: 3px; }

.bubble .quote { margin: -2px -3px 5px -5px; cursor: pointer; }
.bubble .quote.deleted { cursor: default; }
.bubble .quote:hover { filter: brightness(.97); }
.bubble.has-reply { min-width: 180px; }
.bubble.has-img .quote, .bubble.has-doc .quote { margin: 0 0 3px; }

.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px 0 70px; background: var(--head); z-index: 2; }
.reply-bar .reply-slot { flex: 1; min-width: 0; }
.reply-bar .quote { background: var(--panel); }
@media (prefers-color-scheme: dark) { .reply-bar .quote { background: #1B222B; } }
.reply-bar + .composer { padding-top: 6px; }
@media (max-width: 760px) { .reply-bar { padding-left: 10px; } }

.msg-more {
  position: absolute; top: 2px; right: 2px; width: 28px; height: 24px; border-radius: 0 6px 0 12px;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; z-index: 1;
  background: radial-gradient(at top right, var(--in) 60%, transparent 100%);
}
.msg-row.out .msg-more { background: radial-gradient(at top right, var(--out) 60%, transparent 100%); }
.msg-more svg { width: 20px; height: 20px; fill: var(--text-3); }
.bubble:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
@media (hover: none) { .msg-more { display: none; } }
.bubble.has-img .msg-more { background: radial-gradient(at top right, rgba(11, 20, 26, .45), transparent 70%); }
.bubble.has-img .msg-more svg { fill: #fff; }

.msg-menu {
  position: fixed; z-index: 60; min-width: 150px; padding: 8px 0; border-radius: 3px; background: var(--panel);
  box-shadow: var(--menu-shadow); animation: pop .12s ease-out;
}
@media (prefers-color-scheme: dark) { .msg-menu { background: #232B36; } }
.msg-menu button { display: block; width: 100%; height: 40px; padding: 0 24px; text-align: left; font-size: 14.5px; color: var(--text); }
.msg-menu button:hover { background: var(--hover); }
@media (prefers-color-scheme: dark) { .msg-menu button:hover { background: #161C24; } }

.msg-row { position: relative; }
.msg-row.swipe-ready::before {
  content: ''; position: absolute; left: -26px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  background: rgba(11, 20, 26, .12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2354656f' d='M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z'/%3E%3C/svg%3E") center/16px no-repeat;
}
@keyframes flash { 0%, 60% { background: rgba(0, 168, 132, .18); } 100% { background: transparent; } }
.msg-row.flash { animation: flash 1.6s ease-out; border-radius: 8px; }

/* ---------- Menu chat & dialog konfirmasi ---------- */
.menu button.danger { color: var(--danger); }
.modal {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(11, 20, 26, .45);
}
@media (prefers-color-scheme: dark) { .modal { background: rgba(0, 0, 0, .6); } }
.modal-box {
  width: 100%; max-width: 480px; background: var(--panel); border-radius: 8px; padding: 22px 24px 18px;
  box-shadow: 0 17px 50px 0 rgba(11, 20, 26, .19), 0 12px 15px 0 rgba(11, 20, 26, .24); animation: pop .15s ease-out;
}
@media (prefers-color-scheme: dark) { .modal-box { background: #2C3744; } }
.modal-box h3 { margin: 0 0 12px; font-size: 20px; font-weight: 400; color: var(--text); line-height: 1.35; word-break: break-word; }
.modal-box p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text-2); white-space: pre-line; }
@media (prefers-color-scheme: dark) { .modal-box p { color: #C9D3DD; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.modal-actions .btn-primary { margin-top: 0; }
.btn-ghost {
  height: 40px; padding: 0 22px; border-radius: 20px; border: 1px solid var(--border); color: var(--green-dark); font-weight: 500;
}
.btn-ghost:hover { background: var(--hover); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: var(--green); border-color: #8A96A3; } .btn-ghost:hover { background: rgba(255, 255, 255, .06); } }

/* ---------- Grup ---------- */
.avatar.group, .avatar.group-new { background: #A9C3DE; }
.avatar.group svg, .avatar.group-new svg { width: 62%; height: 62%; margin-top: 0; fill: #fff; }
@media (prefers-color-scheme: dark) { .avatar.group { background: #3E4D5E; } }
.avatar.group-new { background: var(--green); }
.new-group-row { margin: 4px 0 6px; }
.new-group-row .body { border-top: 0; }
.avatar.group.big { width: 120px; height: 120px; margin: 8px auto 22px; }

.prev-sender { flex-shrink: 0; }
.bubble .sender-name { display: block; font-size: 12.8px; font-weight: 600; line-height: 19px; margin-bottom: 1px; }
.bubble.has-img .sender-name, .bubble.has-doc .sender-name { padding: 3px 6px 2px; }
.sys-row { align-self: center; margin: 8px 0; max-width: 85%; text-align: center; }
.sys-row span {
  display: inline-block; padding: 5px 12px 6px; border-radius: 7.5px; background: var(--day-chip); color: var(--text-2);
  font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow);
}

.chips-field {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 24px 6px; padding: 6px 0 8px;
  border-bottom: 2px solid var(--green);
}
.chips-field input { flex: 1; min-width: 180px; border: 0; outline: none; background: none; font-size: 15px; padding: 6px 2px; }
.chip-member {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 12px; border-radius: 14px;
  background: var(--chip); color: var(--text); font-size: 13.5px; max-width: 100%;
}
.chip-member span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-member button { width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 18px; color: var(--text-2); }
.chip-member button:hover { background: rgba(11, 20, 26, .1); }
#drawerGroup .field-error { margin: 6px 24px 0; }
#groupStep1 { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
#groupStep1.hidden, #groupStep2.hidden { display: none; }
#groupStep2 { flex: 1; position: relative; }
.group-name-box { padding: 10px 28px; text-align: center; }
.group-name-box .email-field input { text-align: left; }
.chat-item.picked { background: var(--active); }
.pick-check {
  position: absolute; right: 10px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--panel);
}
.fab {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: 56px; height: 56px; border-radius: 50%;
  background: var(--green); display: flex; align-items: center; justify-content: center; box-shadow: var(--menu-shadow); z-index: 2;
}
.fab svg { width: 26px; height: 26px; fill: #fff; }
.fab:hover { background: var(--green-dark); }
.fab:disabled { opacity: .6; }

.group-title-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.group-title-row .title-input { font-size: 22px; text-align: center; border: 0; border-bottom: 2px solid var(--green); outline: none; background: none; width: 100%; padding: 4px 0; }
.info-section.members { padding-left: 0; padding-right: 0; }
.info-section.members > .label { padding: 0 30px; }
.add-member { display: flex; gap: 8px; padding: 4px 30px 12px; }
.add-member input { flex: 1; min-width: 0; border: 0; border-bottom: 2px solid var(--border); outline: none; background: none; font-size: 14.5px; padding: 6px 2px; }
.add-member input:focus { border-bottom-color: var(--green); }
.add-member .btn-primary { margin-top: 0; height: 34px; padding: 0 16px; }
.member-row { display: flex; align-items: center; gap: 14px; padding: 9px 20px 9px 30px; }
.member-row:hover { background: var(--hover); }
.member-row .avatar { width: 40px; height: 40px; }
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-name { font-size: 15.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-tag { font-size: 11.5px; color: var(--green-dark); background: var(--chip-active); padding: 2px 8px; border-radius: 4px; flex-shrink: 0; }
@media (prefers-color-scheme: dark) { .admin-tag { color: var(--green); } }
.member-more { opacity: .7; }
.msg-menu button.danger { color: var(--danger); }

/* ---------- Video, kamera & stiker ---------- */
.am-icon.cam svg { fill: #ff2e74; }
.am-icon.rec svg { fill: #ff8a00; }
.am-icon.stk svg { fill: #467DDB; }
@media (pointer: fine) { .touch-only { display: none !important; } }

.msg-video { display: block; width: 330px; max-width: 100%; max-height: 360px; border-radius: 6px; background: #000; }
.bubble.has-video { position: relative; }
.upload-progress {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 14px; border-radius: 16px;
  background: rgba(11, 20, 26, .65); color: #fff; font-size: 13px; pointer-events: none;
}
.mp-body video { max-width: 100%; max-height: 100%; border-radius: 4px; background: #000; box-shadow: var(--menu-shadow); }

.msg-row.sticker-row .bubble.sticker { background: transparent; box-shadow: none; padding: 0 0 18px; }
.msg-row.sticker-row.first .bubble::before { display: none; }
.sticker-img { display: block; width: 150px; height: 150px; user-select: none; -webkit-user-drag: none; }
.bubble.sticker .meta {
  right: 4px; bottom: 0; padding: 1px 7px; border-radius: 10px; background: var(--day-chip); box-shadow: var(--shadow);
}
.bubble.sticker .quote { margin: 0 0 6px; background: var(--in); box-shadow: var(--shadow); }
.msg-row.out .bubble.sticker .quote { background: var(--out); }
.bubble.sticker .msg-more { background: none; }

.emoji-panel { display: flex; flex-direction: column; padding: 0; grid-template-columns: none; }
.ep-tabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ep-tab { padding: 8px 16px; font-size: 14.5px; height: auto; color: var(--text-2); border-bottom: 3px solid transparent; }
.ep-tab.active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 600; }
@media (prefers-color-scheme: dark) { .ep-tab.active { color: var(--green); } }
.ep-body { flex: 1; overflow-y: auto; padding: 10px 14px; display: grid; align-content: start; gap: 2px; }
.ep-body.emoji { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ep-body.sticker { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.sticker-btn { border-radius: 10px; padding: 4px; height: auto; }
.sticker-btn img { width: 100%; aspect-ratio: 1; display: block; }
.ep-body button:hover { background: rgba(11, 20, 26, .08); }
@media (prefers-color-scheme: dark) { .ep-body button:hover { background: rgba(255, 255, 255, .08); } }

.camera-modal { position: absolute; inset: 0; z-index: 25; background: #0D1218; display: flex; flex-direction: column; color: #fff; }
.camera-modal .mp-head .icon-btn { color: #fff; }
.cam-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; position: relative; }
.cam-body video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.cam-body video.mirror { transform: scaleX(-1); }
.cam-msg { position: absolute; max-width: 360px; text-align: center; color: #E6EDF3; line-height: 1.5; }
.cam-actions { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px 26px; }
.cam-actions .icon-btn { color: #fff; }
.cam-spacer { width: 40px; }
.cam-shot { width: 66px; height: 66px; border-radius: 50%; background: #fff; border: 5px solid rgba(255, 255, 255, .35); background-clip: padding-box; }
.cam-shot:hover { transform: scale(1.05); }
/* Jam & centang video di bawah video supaya tidak menutupi tombol kontrol */
.bubble.has-video.no-caption { padding-bottom: 20px; }
.bubble.has-video.no-caption .meta { right: 7px; bottom: 3px; padding: 0; background: none; color: var(--text-2); }
.bubble.has-video.no-caption .tick { fill: var(--tick); }
.bubble.has-video.no-caption .tick.read { fill: var(--tick-read); }

/* Versi baru tersedia */
.update-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 12px 8px; padding: 10px 14px;
  border-radius: 8px; background: var(--chip-active); color: var(--chip-active-text); font-size: 14px; flex-shrink: 0;
}
.update-banner button { font-weight: 600; padding: 4px 10px; border-radius: 14px; background: var(--green); color: #fff; }

/* Link unduh aplikasi Mac di halaman login */
.login-foot .desktop-download { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--green-dark); font-weight: 600; text-decoration: none; white-space: nowrap; }
.login-foot .desktop-download:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .login-foot .desktop-download { color: var(--green); } }
@media (max-width: 860px) { .login-foot { flex-wrap: wrap; } }

/* ---------- Pemilih emoji lengkap ---------- */
.emoji-panel { height: 340px; }
.ep-picker { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ep-search {
  display: flex; align-items: center; gap: 10px; margin: 8px 12px 4px; padding: 0 12px; height: 36px; border-radius: 8px;
  background: var(--panel); flex-shrink: 0; cursor: text;
}
@media (prefers-color-scheme: dark) { .ep-search { background: #243040; } }
.ep-search svg { width: 18px; height: 18px; fill: var(--icon); flex-shrink: 0; }
.ep-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 14.5px; }
.ep-cats { display: flex; justify-content: space-between; padding: 2px 10px; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.ep-cats.dim { opacity: .45; }
.ep-cat { flex: 1; height: 34px; font-size: 19px; border-bottom: 3px solid transparent; filter: grayscale(.6); opacity: .75; }
.ep-cat:hover { opacity: 1; filter: none; }
.ep-cat.active { border-bottom-color: var(--green); filter: none; opacity: 1; }
.ep-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 10px; position: relative; }
.ep-title { position: sticky; top: 0; z-index: 1; padding: 8px 4px 4px; font-size: 12.5px; color: var(--text-2); background: var(--head); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; }
.ep-grid button {
  height: 42px; border-radius: 6px; font-size: 27px; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.ep-grid button:hover { background: rgba(11, 20, 26, .08); }
@media (prefers-color-scheme: dark) { .ep-grid button:hover { background: rgba(255, 255, 255, .08); } }
.ep-empty, .ep-loading { grid-column: 1 / -1; padding: 24px 8px; text-align: center; color: var(--text-2); font-size: 14px; }
@media (max-width: 760px) { .emoji-panel { height: 320px; } .ep-cat { font-size: 17px; } }

/* ---------- Reaksi emoji (seperti WhatsApp) ---------- */
.msg-row.has-react { margin-bottom: 20px; }
.msg-row { align-items: center; }
.reactions {
  position: absolute; bottom: -17px; z-index: 1; display: inline-flex; align-items: center; gap: 3px;
  height: 24px; padding: 0 7px; border-radius: 12px; background: var(--panel); box-shadow: 0 1px 3px rgba(11, 20, 26, .2);
  border: 1px solid var(--border); font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
}
.msg-row.in .reactions { left: 8px; }
.msg-row.out .reactions { right: 8px; }
.reactions.mine { border-color: var(--highlight); }
.reactions .r-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; letter-spacing: 1px; }
.reactions .r-count { font-size: 12px; color: var(--text-2); }
.reactions:hover { filter: brightness(.97); }
@media (prefers-color-scheme: dark) { .reactions { background: #232B36; } }
.bubble.sticker .reactions { bottom: -4px; }

/* Tombol senyum di samping bubble saat kursor di atas pesan */
.react-btn {
  flex-shrink: 0; width: 28px; height: 28px; margin: 0 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s; background: rgba(11, 20, 26, .06);
}
.react-btn svg { width: 18px; height: 18px; fill: var(--icon); }
.msg-row:hover .react-btn, .react-btn:focus-visible { opacity: 1; }
.react-btn:hover { background: rgba(11, 20, 26, .12); }
@media (prefers-color-scheme: dark) { .react-btn { background: rgba(255, 255, 255, .08); } .react-btn:hover { background: rgba(255, 255, 255, .14); } }
@media (hover: none) {
  .react-btn { display: none; }
  /* Tekan lama membuka menu reaksi, bukan menu salin bawaan HP */
  .msg-row .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* Baris emoji cepat: melayang di atas pesan, juga di bagian atas menu pesan */
.react-bar {
  position: fixed; z-index: 61; display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-radius: 28px;
  background: var(--panel); box-shadow: var(--menu-shadow); animation: pop .12s ease-out;
}
@media (prefers-color-scheme: dark) { .react-bar { background: #232B36; } }
.react-row { display: flex; align-items: center; gap: 2px; padding: 0 8px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.msg-menu .react-row button, .react-bar button {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 25px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: transform .1s;
}
.msg-menu .react-row button:hover, .react-bar button:hover { background: var(--hover); transform: scale(1.15); }
.react-row button.active, .react-bar button.active { background: var(--chip-active); }
.react-row .r-more, .react-bar .r-more { background: rgba(11, 20, 26, .06); }
.react-row .r-more svg, .react-bar .r-more svg { width: 22px; height: 22px; fill: var(--icon); }
@media (prefers-color-scheme: dark) { .react-row .r-more, .react-bar .r-more { background: rgba(255, 255, 255, .08); } }
@media (max-width: 400px) { .msg-menu .react-row button, .react-bar button { width: 36px; height: 36px; font-size: 22px; } }

/* Pemilih emoji lengkap untuk reaksi */
.react-picker { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(11, 20, 26, .35); }
.react-picker-card {
  width: min(380px, calc(100vw - 24px)); height: min(440px, calc(100vh - 80px)); border-radius: 14px; overflow: hidden;
  background: var(--head); box-shadow: var(--menu-shadow); animation: pop .12s ease-out;
}
@media (max-width: 760px) {
  .react-picker { align-items: flex-end; }
  .react-picker-card { width: 100%; height: 60vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
