:root {
  --sidebar: #10243d;
  --sidebar-2: #163456;
  --panel: #ffffff;
  --line: #cfd9e6;
  --muted: #64748b;
  --text: #0f172a;
  --bg: #dfe7f1;
  --chat-bg: #eee6d8;
  --grid: rgba(102, 88, 64, .08);
  --green: #0f8f55;
  --green-soft: #dff5e8;
  --in: #ffffff;
  --out: #dcf8c6;
  --warning: #f59e0b;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(15, 23, 42, .12);
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell {
  height: 100vh;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  width: 248px;
  min-width: 248px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  color: #fff;
  background: linear-gradient(180deg, var(--sidebar), #0b1b2f);
  border-right: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.brand-icon, .brand-mark {
  width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center;
  background: #19c37d; color: #062a1a; font-weight: 800; font-size: 22px; border: 1px solid rgba(255,255,255,.35);
}
.brand h1 { margin: 0; font-size: 20px; line-height: 1.1; }
.brand p { margin: 3px 0 0; font-size: 12px; color: #cbd5e1; }
.menu { display: grid; gap: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px;
  color: #eff6ff; background: transparent; border: 1px solid transparent; border-radius: 7px; text-align: left; font-weight: 700;
}
.menu-item span { width: 18px; text-align: center; color: #c9dcff; }
.menu-item:hover, .menu-item.active { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.08); }
.menu-item b { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 999px; background: #19c37d; color: #052e1b; text-align: center; font-size: 12px; }
.device-card, .user-card {
  margin-top: auto; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); border-radius: 10px; padding: 13px; box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.device-card { margin-top: auto; margin-bottom: 12px; }
.device-top, .user-card { display: flex; align-items: center; gap: 10px; }
.device-top p, .device-card small, .user-card small { margin: 0; color: #cbd5e1; font-size: 12px; }
.device-top strong { color: #22c55e; font-size: 13px; }
.wa-dot { color: #22c55e; }
.user-card .avatar { flex: 0 0 auto; }
.user-card button { margin-left: auto; background: transparent; border: 0; color: #fff; }

.main-panel { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: 0 0 auto; min-height: 66px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #f8fafc; border-bottom: 1px solid var(--line);
}
.search-box {
  width: min(560px, 100%); display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
}
.search-box input { border: 0; outline: 0; flex: 1; min-width: 0; }
.search-box kbd { padding: 3px 6px; border: 1px solid #dbe3ef; border-radius: 5px; color: #64748b; background: #f1f5f9; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.icon-btn, .ghost-btn, .native-btn, .small-btn, .close-btn, .send-btn {
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 7px; min-height: 38px; padding: 0 12px; font-weight: 700;
}
.icon-btn { width: 38px; padding: 0; display: grid; place-items: center; }
.native-btn.active, .native-btn { background: #087f4d; color: #fff; border-color: #076b42; }
.ghost-btn { color: #067a49; background: #eefdf5; border-color: #b8ead0; }
.demo-only { display: none !important; }
.close-btn { background: #087f4d; color: #fff; border-color: #087f4d; }
.send-btn { width: 46px; height: 42px; border-radius: 8px; background: #10b981; border-color: #0ea56f; color: #fff; font-size: 18px; }
.online-pill { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; }
.online-pill span { width: 8px; height: 8px; border-radius: 50%; background: #10b981; }
.demo-banner { flex: 0 0 auto; margin: 10px 14px 0; padding: 10px 12px; border-radius: 8px; background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; }

.workspace {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 350px minmax(0, 1fr) 300px; gap: 12px; padding: 12px; overflow: hidden;
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }

.inbox-panel { min-height: 0; display: flex; flex-direction: column; }
.panel-heading { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: flex-start; padding: 16px; border-bottom: 1px solid #edf2f7; }
.panel-heading h2 { margin: 0 0 4px; font-size: 22px; }
.panel-heading p { margin: 0; color: #008f56; font-weight: 700; font-size: 13px; }
.chips { display: flex; gap: 8px; padding: 0 16px 12px; border-bottom: 1px solid #edf2f7; }
.chip { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-weight: 800; }
.chip.active { background: #e5f8ef; color: #087f4d; border-color: #a9dfc2; }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.conversation-item {
  width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left;
}
.conversation-item:hover { background: #f6f9fc; }
.conversation-item.active { background: #e5f8ef; border-color: #aee5c9; }
.conversation-item h3 { margin: 0 0 4px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item p { margin: 0; color: #64748b; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: #64748b; font-size: 12px; }
.badge { min-width: 21px; height: 21px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: #10b981; color: #fff; font-weight: 800; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #d7e6fb; color: #0f2d54; font-weight: 800; }
.avatar.big { width: 56px; height: 56px; }

.chat-panel { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { flex: 0 0 auto; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.contact-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-summary > div:last-child { min-width: 0; }
.contact-summary h2 { margin: 0 0 2px; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-summary p, .contact-summary small { margin: 0; color: #64748b; font-size: 13px; }
.chat-assigned { display: block; margin-top: 2px !important; }
.chat-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mobile-back { display: none; border: 0; background: transparent; color: #0f4f85; font-weight: 800; font-size: 16px; }

.message-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px;
  background-color: var(--chat-bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.day-pill { width: fit-content; margin: 0 auto 16px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: #64748b; font-size: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.message-row { display: flex; margin: 0 0 12px; }
.message-row.incoming { justify-content: flex-start; }
.message-row.outgoing { justify-content: flex-end; }
.message-bubble { max-width: min(620px, 76%); padding: 9px 11px 7px; border-radius: 8px; border: 1px solid #d8e0ea; box-shadow: 0 1px 2px rgba(15,23,42,.08); line-height: 1.48; word-break: break-word; }
.message-row.incoming .message-bubble { background: var(--in); border-top-left-radius: 3px; }
.message-row.outgoing .message-bubble { background: var(--out); border-color: #b7dea7; border-top-right-radius: 3px; }
.message-role { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .35px; color: #475569; }
.message-role .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #64748b; }
.message-row.outgoing .dot { background: #0f8f55; }
.message-text { white-space: normal; }
.message-media { margin: 2px 0 8px; }
.message-media-image { max-width: 340px; }
.message-media-image a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid rgba(15,23,42,.10); background: #e2e8f0; }
.message-media-image img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.message-media-image figcaption { margin-top: 4px; font-size: 11px; color: #64748b; }
.message-media-image.media-error a::after { content: 'Gambar tidak dapat dimuat. Klik untuk membuka.'; display: block; padding: 12px; color: #334155; }
.message-media-video video { width: min(360px, 100%); max-height: 360px; border-radius: 8px; background: #111827; display: block; }
.message-media-audio audio { width: min(360px, 100%); display: block; }
.message-media-video a, .message-media-audio a { display: inline-block; margin-top: 6px; font-weight: 700; color: #0f4f85; }
.message-file-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 2px 0 8px; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: rgba(255,255,255,.64); color: #0f2747; text-decoration: none; max-width: 360px; }
.message-file-card:hover { background: #fff; }
.message-file-card .file-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: #e2e8f0; }
.message-file-card strong { display: block; font-size: 13px; }
.message-file-card small { display: block; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.message-file-card em { font-style: normal; color: #0f8f55; font-weight: 800; font-size: 12px; }
.message-meta { margin-top: 7px; display: flex; gap: 8px; align-items: center; justify-content: flex-end; color: #64748b; font-size: 11px; }
.message-meta .status-read { color: #0284c7; }
.message-meta .status-failed, .message-meta .status-rejected { color: var(--danger); }
.message-meta .status-pending { color: var(--warning); }
.composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #f8fafc; }
.composer textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 130px; resize: none; outline: 0; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; padding: 10px 12px; line-height: 1.4; }
.composer textarea:focus { border-color: #0f8f55; box-shadow: 0 0 0 3px rgba(16,185,129,.14); }

.details-panel { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.info-card, .stats-card { padding-bottom: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #e2e8f0; }
.tabs button { border: 0; background: #f8fafc; padding: 12px; font-weight: 800; color: #64748b; }
.tabs button.active { color: #087f4d; background: #fff; border-bottom: 2px solid #10b981; }
.customer-block { display: flex; align-items: center; gap: 12px; padding: 18px 16px; }
.customer-block h3 { margin: 0 0 4px; font-size: 17px; }
.customer-block p { margin: 0; color: #64748b; font-size: 12px; }
.info-list { display: grid; gap: 11px; padding: 0 16px; }
.info-list div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.info-list span { color: #64748b; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; }
.tag { background: #e5f8ef; border: 1px solid #aee5c9; color: #087f4d; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.stats-card h3 { margin: 0; padding: 16px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px; }
.stats-grid div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8fafc; }
.stats-grid strong { display: block; font-size: 22px; }
.stats-grid span { color: #64748b; font-size: 12px; }

.empty-state { display: grid; place-items: center; align-content: center; height: 100%; color: #64748b; text-align: center; padding: 30px; }
.empty-state h3 { margin: 8px 0 4px; color: #0f172a; }
.empty-state p { margin: 0; }
.login-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(15,23,42,.42); backdrop-filter: blur(4px); }
.login-card { width: min(420px, calc(100vw - 28px)); padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(15,23,42,.35); }
.login-card h1 { margin: 12px 0 4px; }
.login-card p { color: #64748b; }
.login-card form { display: grid; gap: 10px; }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
.login-card button { height: 44px; border: 0; border-radius: 8px; background: #087f4d; color: #fff; font-weight: 800; }
.login-card small { display: block; margin-top: 12px; color: #64748b; }
.setup-dialog { border: 1px solid var(--line); border-radius: 10px; max-width: 760px; width: calc(100vw - 30px); padding: 0; }
.setup-dialog::backdrop { background: rgba(15,23,42,.45); }
.setup-dialog form { padding: 18px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.modal-head h2 { margin: 0 0 4px; }
.modal-head p, .muted { color: #64748b; margin: 0; }
.webhook-grid { display: grid; gap: 10px; }
.webhook-grid label { display: grid; gap: 6px; font-weight: 700; }
.webhook-grid input { height: 40px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; }
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast-item { width: 100%; border: 1px solid #9ed8bc; border-left: 5px solid #10b981; border-radius: 8px; background: #fff; padding: 12px; text-align: left; box-shadow: var(--shadow); }
.toast-item strong { display: block; margin-bottom: 4px; }
.toast-item span { display: block; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1280px) {
  .workspace { grid-template-columns: 320px minmax(0, 1fr); }
  .details-panel { display: none; }
}
@media (max-width: 920px) {
  .sidebar { width: 72px; min-width: 72px; padding: 10px; }
  .brand div:not(.brand-icon), .menu-item:not(.active) b, .menu-item { font-size: 0; }
  .brand { justify-content: center; }
  .brand-icon { width: 44px; height: 44px; }
  .menu-item { justify-content: center; padding: 12px 0; }
  .menu-item span { font-size: 17px; }
  .device-card, .user-card { display: none; }
  .workspace { grid-template-columns: 300px minmax(0, 1fr); padding: 8px; gap: 8px; }
  .topbar { padding: 10px; }
  .search-box kbd { display: none; }
}
@media (max-width: 720px) {
  body { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-panel { height: 100vh; }
  .topbar { min-height: auto; align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; height: 40px; }
  .top-actions { justify-content: space-between; }
  .online-pill { display: none; }
  .workspace { flex: 1; grid-template-columns: 1fr; padding: 0; gap: 0; }
  .inbox-panel, .chat-panel { border-radius: 0; box-shadow: none; border-left: 0; border-right: 0; }
  .chat-panel { display: none; }
  body.chat-open .inbox-panel { display: none; }
  body.chat-open .chat-panel { display: flex; height: 100%; }
  .mobile-back { display: block; }
  .chat-header { min-height: 66px; padding: 9px 10px; }
  .contact-summary h2 { font-size: 17px; }
  .close-btn { display: none; }
  .message-list { padding: 10px; }
  .message-bubble { max-width: 86%; }
  .composer { padding: 8px; }
}

/* v1.4.0: sidebar period statistics */
.sidebar-stats {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.sidebar-stats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.sidebar-stats-head strong { font-size: 13px; }
.sidebar-stats-head small { color: #bdd0e9; font-size: 11px; white-space: nowrap; }
.period-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid rgba(255,255,255,.10);
}
.period-stat:first-of-type { border-top: 0; }
.period-stat span { color: #d9e6f7; font-size: 12px; }
.period-stat b { color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; }
.period-stat i { font-style: normal; }
.notif-btn { order: 20; margin-left: 2px; }
.period-table {
  display: grid;
  gap: 0;
  margin: 14px 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.period-table > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 58px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-top: 1px solid #edf2f7;
  font-size: 12px;
}
.period-table > div:first-child {
  border-top: 0;
  background: #f8fafc;
  color: #64748b;
  font-weight: 800;
}
.period-table b { font-size: 12px; }
.period-table strong { text-align: right; font-variant-numeric: tabular-nums; }
/* Move popup notification to right-top corner */
.toast-host { top: 16px; right: 16px; bottom: auto; }

@media (max-width: 920px) {
  .sidebar-stats { display: none; }
}

@media (max-width: 720px) {
  .top-actions { justify-content: flex-end; }
  .notif-btn { margin-left: auto; }
  .toast-host { top: 10px; right: 10px; width: min(340px, calc(100vw - 20px)); }
}

/* v1.7.0: PWA + mobile footer + fixed mobile composer */
.mobile-tabbar { display: none; }

@media (display-mode: standalone) {
  body { background: var(--bg); }
}

@media (max-width: 720px) {
  :root { --mobile-tabbar-height: 62px; }
  html, body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .app-shell {
    display: flex;
    height: calc(100dvh - var(--mobile-tabbar-height));
    min-height: 0;
    overflow: hidden;
  }

  .main-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .topbar {
    flex: 0 0 auto;
    padding: 8px;
    gap: 7px;
    background: #eef4fb;
    border-bottom: 1px solid #cbd5e1;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    align-items: center;
  }

  .top-actions .icon-btn,
  .top-actions .native-btn {
    min-height: 36px;
  }

  .search-box {
    height: 38px;
    border-radius: 7px;
  }

  .workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    padding: 0;
  }

  .inbox-panel,
  .chat-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .inbox-panel {
    display: flex;
  }

  .chat-panel {
    display: none;
  }

  body.chat-open .inbox-panel {
    display: none;
  }

  body.chat-open .chat-panel {
    display: flex;
    height: 100%;
    min-height: 0;
  }

  .panel-heading {
    padding: 12px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .chips {
    padding: 0 12px 10px;
    overflow-x: auto;
  }

  .conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }

  .chat-header {
    flex: 0 0 auto;
    min-height: 58px;
    padding: 8px;
    gap: 8px;
  }

  .mobile-back {
    flex: 0 0 auto;
    padding: 7px 2px;
  }

  .contact-summary {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .contact-summary .avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .chat-actions {
    flex: 0 0 auto;
    gap: 5px;
  }

  .chat-actions .icon-btn {
    width: 34px;
    min-height: 34px;
  }

  .message-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 8px;
  }

  .message-bubble {
    max-width: 88%;
  }

  .message-media-image {
    max-width: min(280px, 76vw);
  }

  .message-file-card {
    max-width: min(300px, 78vw);
  }

  .composer {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
    align-items: flex-end;
  }

  .composer .icon-btn {
    width: 34px;
    min-width: 34px;
    min-height: 40px;
  }

  .composer textarea {
    min-height: 40px;
    max-height: 96px;
    font-size: 16px;
    line-height: 1.32;
    padding: 9px 10px;
  }

  .send-btn {
    width: 42px;
    min-width: 42px;
    height: 40px;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    height: var(--mobile-tabbar-height);
    padding: 5px 5px max(5px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    background: #ffffff;
    border-top: 1px solid #cbd5e1;
    box-shadow: 0 -2px 10px rgba(15,23,42,.10);
  }

  .mobile-tab {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    padding: 4px 2px;
    font-weight: 800;
  }

  .mobile-tab span {
    font-size: 17px;
    line-height: 1;
  }

  .mobile-tab b {
    font-size: 10px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mobile-tab.active {
    background: #e5f8ef;
    color: #087f4d;
  }

  .mobile-tab em {
    position: absolute;
    top: 3px;
    right: 9px;
    min-width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-style: normal;
    font-size: 10px;
    font-weight: 900;
  }

  .toast-host {
    top: 8px;
    right: 8px;
    width: min(330px, calc(100vw - 16px));
  }

  .setup-dialog {
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}


/* v1.8.0: Android native app skin */
:root {
  --android-primary: #075e54;
  --android-primary-dark: #064c44;
  --android-primary-soft: #e0f2ef;
  --android-accent: #25d366;
  --android-bg: #f1f5f4;
  --android-surface: #ffffff;
  --android-line: #dde7e4;
  --android-text: #111827;
  --android-muted: #6b7280;
  --android-tabbar-height: 68px;
}

body {
  -webkit-tap-highlight-color: transparent;
}

.mobile-app-title { display: none; }

/* Give desktop a cleaner native material feeling without changing workflow */
.card,
.search-box,
.login-card,
.setup-dialog,
.toast-item {
  border-color: var(--android-line);
}

.conversation-item.active,
.chip.active,
.mobile-tab.active {
  background: var(--android-primary-soft);
  color: var(--android-primary);
  border-color: rgba(7, 94, 84, .18);
}

.close-btn,
.send-btn,
.native-btn.active,
.native-btn {
  background: var(--android-primary);
  border-color: var(--android-primary);
}

.send-btn { box-shadow: 0 4px 12px rgba(7, 94, 84, .18); }

@media (max-width: 720px) {
  :root {
    --mobile-tabbar-height: calc(var(--android-tabbar-height) + env(safe-area-inset-bottom));
  }

  html,
  body {
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--android-bg);
    touch-action: manipulation;
  }

  body {
    font-family: Roboto, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .app-shell {
    height: calc(100dvh - var(--mobile-tabbar-height));
    min-height: 0;
    display: flex;
    overflow: hidden;
    background: var(--android-bg);
  }

  .main-panel {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--android-bg);
  }

  .topbar {
    min-height: 112px;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title actions"
      "search search";
    align-items: center;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    background: var(--android-primary);
    color: #fff;
    border-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }

  .mobile-app-title {
    grid-area: title;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 19px;
    letter-spacing: .1px;
  }

  .mobile-brand-dot {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }

  .topbar .search-box {
    grid-area: search;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 1px 3px rgba(0,0,0,.16);
  }

  .topbar .search-box span { color: var(--android-muted); }
  .topbar .search-box input { font-size: 15px; background: transparent; }

  .top-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .top-actions .icon-btn,
  .top-actions .native-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    box-shadow: none;
  }

  .top-actions .native-btn {
    width: auto;
    min-width: 72px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
  }

  body.chat-open .topbar {
    display: none;
  }

  .workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    padding: 0;
    background: var(--android-bg);
  }

  .inbox-panel,
  .chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--android-surface);
    overflow: hidden;
  }

  .panel-heading {
    min-height: 62px;
    padding: 13px 16px;
    background: #fff;
    border-bottom: 1px solid var(--android-line);
  }

  .panel-heading h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--android-text);
  }

  .panel-heading p {
    color: var(--android-primary);
  }

  .small-btn,
  #resetDemoBtn {
    display: none;
  }

  .chips {
    padding: 10px 12px;
    gap: 8px;
    overflow-x: auto;
    background: #fff;
    border-bottom: 1px solid var(--android-line);
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar { display: none; }

  .chip {
    min-height: 34px;
    border-radius: 999px;
    border-color: var(--android-line);
    background: #f7faf9;
    color: #3f4b57;
    white-space: nowrap;
  }

  .conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
  }

  .conversation-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 72px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #eef3f1;
    border-radius: 0;
    background: #fff;
  }

  .conversation-item:hover,
  .conversation-item.active {
    background: #edf8f5;
  }

  .conversation-item .avatar,
  .avatar {
    width: 44px;
    height: 44px;
    background: #d6f1e7;
    color: var(--android-primary);
  }

  .conversation-item h3 {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
  }

  .conversation-item p {
    font-size: 13px;
    color: #6b7280;
  }

  .badge,
  .menu-item b,
  .mobile-tab em {
    background: #ef4444;
    color: #fff;
  }

  .chat-panel {
    display: none;
    flex-direction: column;
  }

  body.chat-open .chat-panel {
    display: flex;
    height: 100%;
    min-height: 0;
  }

  body.chat-open .inbox-panel { display: none; }

  .chat-header {
    flex: 0 0 auto;
    min-height: 62px;
    padding: max(8px, env(safe-area-inset-top)) 8px 8px;
    gap: 8px;
    color: #fff;
    background: var(--android-primary);
    border-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }

  .mobile-back {
    display: grid;
    place-items: center;
    width: 36px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    color: #fff;
    font-size: 0;
  }

  .mobile-back::before {
    content: '‹';
    font-size: 32px;
    line-height: 1;
    font-weight: 500;
  }

  .contact-summary {
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
  }

  .contact-summary .avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 13px;
  }

  .contact-summary h2 {
    font-size: 16px;
    color: #fff;
  }

  .contact-summary p,
  .contact-summary small {
    color: rgba(255,255,255,.78);
    font-size: 12px;
  }

  .chat-actions {
    gap: 4px;
  }

  .chat-actions .icon-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.14);
  }

  .close-btn { display: none; }

  .message-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 8px 10px;
    background-color: #efe7d7;
    background-image: radial-gradient(rgba(7,94,84,.05) 1px, transparent 1px);
    background-size: 18px 18px;
  }

  .message-row { margin-bottom: 8px; }

  .message-bubble {
    max-width: 84%;
    padding: 7px 9px 5px;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 1px 1.5px rgba(0,0,0,.18);
    font-size: 14px;
    line-height: 1.42;
  }

  .message-row.incoming .message-bubble {
    background: #fff;
    border-top-left-radius: 3px;
  }

  .message-row.outgoing .message-bubble {
    background: #dcf8c6;
    border-top-right-radius: 3px;
  }

  .message-role {
    margin-bottom: 3px;
    font-size: 10px;
    letter-spacing: .2px;
    opacity: .74;
  }

  .message-meta {
    margin-top: 4px;
    font-size: 10px;
    color: #6b7280;
  }

  .message-media-image { max-width: min(260px, 78vw); }
  .message-media-image a,
  .message-file-card,
  .message-media-video video {
    border-radius: 8px;
  }

  .message-media-image img {
    max-height: 300px;
  }

  .message-file-card {
    max-width: min(292px, 80vw);
    grid-template-columns: 34px minmax(0, 1fr) auto;
    background: rgba(255,255,255,.72);
  }

  .composer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    min-height: 56px;
    padding: 7px 8px 8px;
    background: #efe7d7;
    border-top: 0;
    position: relative;
    z-index: 4;
  }

  .composer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
    pointer-events: none;
    background: linear-gradient(to top, rgba(239,231,215,.95), rgba(239,231,215,0));
  }

  .composer .icon-btn {
    width: 38px;
    min-width: 38px;
    height: 42px;
    min-height: 42px;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: var(--android-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
  }

  .composer textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 104px;
    padding: 10px 13px;
    border: 0;
    border-radius: 22px;
    background: #fff;
    color: var(--android-text);
    font-size: 16px;
    line-height: 1.35;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
  }

  .composer textarea:focus {
    border: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 2px rgba(37,211,102,.24);
  }

  .send-btn {
    width: 44px;
    min-width: 44px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--android-primary);
    color: #fff;
    box-shadow: 0 2px 7px rgba(7,94,84,.28);
  }

  .mobile-tabbar {
    height: var(--mobile-tabbar-height);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,.98);
    border-top: 1px solid var(--android-line);
    box-shadow: 0 -6px 20px rgba(0,0,0,.10);
    backdrop-filter: blur(14px);
  }

  .mobile-tab {
    min-height: 54px;
    border-radius: 16px;
    color: #64706f;
    font-size: 11px;
    font-weight: 700;
    transition: background .12s ease, color .12s ease, transform .12s ease;
  }

  .mobile-tab:active { transform: scale(.96); }

  .mobile-tab span {
    font-size: 22px;
    line-height: 1;
    font-weight: 900;
  }

  .mobile-tab b {
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-tab.active {
    background: var(--android-primary-soft);
    color: var(--android-primary);
  }

  .mobile-tab em {
    top: 4px;
    right: 13px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.18);
  }

  .toast-host {
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    width: min(330px, calc(100vw - 16px));
  }

  .toast-item {
    border-radius: 14px;
    border-left-width: 0;
    background: rgba(255,255,255,.97);
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
  }

  .login-overlay {
    background: var(--android-primary);
  }

  .login-card {
    border-radius: 22px;
    border: 0;
  }

  .login-card button {
    border-radius: 999px;
    background: var(--android-primary);
  }

  .setup-dialog {
    border-radius: 18px 18px 0 0;
    width: 100vw;
    max-width: none;
    margin: auto 0 0;
    max-height: calc(92dvh - env(safe-area-inset-bottom));
  }
}


/* v1.9.0 settings and direct message */
.settings-dialog {
  width: min(920px, calc(100vw - 22px));
}
.settings-dialog .modal-shell,
.new-chat-dialog .modal-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: min(72vh, 720px);
  overflow: auto;
  padding-right: 4px;
}
.settings-card {
  border: 1px solid var(--line, #d9e2ec);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.settings-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.settings-form label,
.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.settings-form input,
.settings-form textarea,
.settings-form select,
.settings-grid input,
.settings-grid select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
}
.settings-form textarea {
  resize: vertical;
  min-height: 120px;
}
.check-row {
  margin-top: 10px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.check-row input { width: auto !important; }
.settings-status,
.mini-log {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  white-space: pre-wrap;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.danger-btn {
  border: 1px solid #fecaca;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  font-weight: 800;
  padding: 10px 12px;
  cursor: pointer;
}
.danger-lite {
  background: #fffafa;
}
.new-chat-dialog {
  width: min(520px, calc(100vw - 22px));
}
@media (max-width: 720px) {
  .settings-dialog,
  .new-chat-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    inset: auto 0 0 0;
    border-radius: 18px 18px 0 0;
  }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-sections { max-height: calc(100dvh - 120px); }
  #openNewChatBtn { display: none; }
}

/* v2.1.0 native Android polish, emoji, attachment, install gate */
.hidden-file { display: none !important; }
.composer-tool {
  color: #075e54;
  background: #e8f5ef;
  border-color: #b7d7cc;
}
.composer-tool:hover { background: #d9f0e8; }
.emoji-picker {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(4, 42px);
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .24);
}
.emoji-picker.hidden { display: none; }
.emoji-picker button {
  width: 42px;
  height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 22px;
  cursor: pointer;
}
.emoji-picker button:active { transform: scale(.94); }
.mobile-tabbar {
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, .10);
}
.mobile-tab span {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
}
.mobile-tab:nth-child(1) span { background: #dcfce7; color: #15803d; }
.mobile-tab:nth-child(2) span { background: #dbeafe; color: #1d4ed8; }
.mobile-tab:nth-child(3) span { background: #ccfbf1; color: #0f766e; }
.mobile-tab:nth-child(4) span { background: #fef3c7; color: #b45309; }
.mobile-tab:nth-child(5) span { background: #f3e8ff; color: #7e22ce; }
.mobile-tab.active span { background: #075e54; color: #ffffff; }
.install-gate {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 12, 20, .72);
  backdrop-filter: blur(8px);
}
.install-gate.hidden { display: none; }
.install-card {
  width: min(420px, 100%);
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 30px 90px rgba(0,0,0,.36);
  text-align: center;
}
.install-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #075e54, #22c55e);
  color: #ffffff;
  font-size: 38px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(7, 94, 84, .34);
}
.install-card h2 { margin: 0 0 8px; font-size: 24px; }
.install-card p { margin: 0; color: #475569; line-height: 1.5; }
.install-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 18px 0 10px;
}
.install-card small { display: block; color: #64748b; line-height: 1.45; }
.settings-card .send-btn { width: auto; }
@media (max-width: 720px) {
  .emoji-picker {
    left: 12px;
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(8, 1fr);
  }
  .emoji-picker button { width: 100%; }
  .install-card { border-radius: 20px; }
  .install-actions { flex-direction: column; }
}

/* v2.1.0 group chat support */
.mini-kind {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
}
.mini-kind.group {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
}


/* v2.2.0 simple native Android design refresh */
:root {
  --native-green: #007a4d;
  --native-green-dark: #006241;
  --native-green-soft: #e6f6ef;
  --native-blue: #1d66d1;
  --native-bg: #f3f6f8;
  --native-line: #e5ecef;
  --native-text: #14202b;
  --native-muted: #64727d;
}

.mobile-dashboard { display: none; }

@media (min-width: 721px) {
  .topbar {
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .05);
  }
  .card {
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  }
  .message-bubble {
    border-radius: 14px;
  }
  .message-row.incoming .message-bubble { border-top-left-radius: 5px; }
  .message-row.outgoing .message-bubble { border-top-right-radius: 5px; }
}

@media (max-width: 720px) {
  html,
  body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--native-bg);
    overscroll-behavior: none;
  }

  body {
    font-family: Inter, Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--native-text);
  }

  .app-shell {
    height: 100dvh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    background: var(--native-bg);
  }

  .sidebar,
  .details-panel,
  .demo-banner,
  .online-pill,
  #openNewChatBtn,
  #demoInboundBtn,
  #resetDemoBtn,
  .topbar .search-box kbd {
    display: none !important;
  }

  .main-panel {
    height: calc(100dvh - var(--mobile-tabbar-height));
    min-height: 0;
    overflow: hidden;
    background: var(--native-bg);
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "title actions" "search search";
    gap: 12px;
    min-height: 132px;
    padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
    border: 0;
    color: #fff;
    background: linear-gradient(145deg, #006241, #00855a);
    box-shadow: 0 8px 26px rgba(0, 98, 65, .25);
  }

  .mobile-app-title {
    grid-area: title;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    letter-spacing: -.3px;
  }

  .mobile-brand-dot {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: rgba(255,255,255,.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }

  .top-actions {
    grid-area: actions;
    gap: 8px;
  }

  .top-actions .icon-btn,
  .top-actions .notif-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 0;
  }
  .top-actions .icon-btn::before { content: '⚙'; font-size: 18px; }
  .top-actions .notif-btn::before { content: '🔔'; font-size: 18px; }

  .topbar .search-box {
    grid-area: search;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 0;
    border-radius: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 3px 10px rgba(0,0,0,.14);
  }

  .topbar .search-box input {
    background: transparent;
    font-size: 15px;
  }

  .workspace {
    flex: 1;
    min-height: 0;
    height: auto;
    display: block;
    padding: 0;
    overflow: hidden;
    background: var(--native-bg);
  }

  .mobile-dashboard,
  .inbox-panel,
  .chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--native-bg);
    overflow: hidden;
  }

  body.dashboard-open .mobile-dashboard {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 18px;
  }

  body.dashboard-open .inbox-panel,
  body.dashboard-open .chat-panel {
    display: none !important;
  }

  body:not(.dashboard-open):not(.chat-open) .mobile-dashboard {
    display: none;
  }

  .android-hero {
    margin-top: -12px;
    padding: 18px 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: #fff;
    border-radius: 0 0 24px 24px;
    background: linear-gradient(145deg, #006241, #00945f);
    box-shadow: 0 12px 26px rgba(0, 98, 65, .24);
  }

  .android-hero h1 {
    margin: 7px 0 3px;
    font-size: 26px;
    letter-spacing: -.5px;
  }
  .android-hero p,
  .android-hero small {
    margin: 0;
    color: rgba(255,255,255,.82);
  }
  .status-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    margin-right: 6px;
    border-radius: 50%;
    background: #4ade80;
  }
  .hero-icon {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.15);
  }

  .android-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0 16px;
  }

  .android-stat-card {
    min-height: 106px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--native-line);
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
  }
  .android-stat-card.primary,
  .android-stat-card.blue {
    color: #fff;
    border: 0;
  }
  .android-stat-card.primary { background: linear-gradient(145deg, #007a4d, #00a96b); }
  .android-stat-card.blue { background: linear-gradient(145deg, #185abc, #2f80ed); }
  .android-stat-card span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    opacity: .82;
  }
  .android-stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 30px;
    line-height: 1;
  }
  .android-stat-card small {
    display: block;
    margin-top: 7px;
    color: inherit;
    opacity: .78;
  }
  .android-stat-card:not(.primary):not(.blue) strong { color: var(--native-green); }

  .android-section-head {
    margin: 14px 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .android-section-head h2 {
    margin: 0;
    font-size: 16px;
  }
  .android-section-head span,
  .android-section-head button {
    border: 0;
    background: transparent;
    color: var(--native-green);
    font-size: 12px;
    font-weight: 800;
  }

  .android-period-list,
  .android-recent-list {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--native-line);
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  }
  .android-period-list div,
  .android-recent-item {
    min-height: 52px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid #edf2f4;
    background: #fff;
  }
  .android-period-list div:last-child,
  .android-recent-item:last-child { border-bottom: 0; }
  .android-period-list b { flex: 1; }
  .android-period-list span { font-weight: 900; color: var(--native-green); }
  .android-recent-item {
    width: 100%;
    text-align: left;
    position: relative;
  }
  .android-recent-item > div:nth-child(2) {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 3px;
  }
  .android-recent-item strong,
  .android-recent-item span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .android-recent-item span { color: var(--native-muted); font-size: 12px; }
  .android-recent-item time { color: var(--native-muted); font-size: 11px; }
  .android-recent-item em {
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
  }
  .android-empty { padding: 16px; color: var(--native-muted); text-align: center; }

  .inbox-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
  }
  body.chat-open .inbox-panel { display: none !important; }

  .panel-heading {
    min-height: 58px;
    padding: 14px 16px 10px;
    background: #fff;
    border-bottom: 1px solid var(--native-line);
  }
  .panel-heading h2 { font-size: 22px; letter-spacing: -.3px; }
  .panel-heading p { color: var(--native-green); }

  .chips {
    padding: 10px 14px 12px;
    background: #fff;
    border-bottom: 1px solid var(--native-line);
  }
  .chip {
    border: 0;
    border-radius: 999px;
    color: #4b5b66;
    background: #f2f5f6;
  }
  .chip.active {
    color: var(--native-green);
    background: var(--native-green-soft);
  }

  .conversation-list {
    flex: 1;
    min-height: 0;
    padding: 0;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .conversation-item {
    grid-template-columns: 50px minmax(0,1fr) auto;
    min-height: 76px;
    padding: 11px 16px;
    border: 0;
    border-bottom: 1px solid #eef3f1;
    border-radius: 0;
    background: #fff;
  }
  .conversation-item.active,
  .conversation-item:active { background: #eefaf5; }
  .conversation-item .avatar,
  .avatar {
    width: 46px;
    height: 46px;
    color: var(--native-green);
    background: #dff4ec;
  }
  .conversation-item h3 { font-size: 15px; color: #111827; }
  .conversation-item p { font-size: 13px; color: var(--native-muted); }

  body.chat-open .main-panel {
    height: calc(100dvh - var(--mobile-tabbar-height));
  }
  body.chat-open .topbar { display: none !important; }
  body.chat-open .workspace { height: 100%; }
  body.chat-open .chat-panel {
    display: flex;
    height: 100%;
    min-height: 0;
    background: #efe7d7;
  }

  .chat-header {
    min-height: 74px;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
    border: 0;
    color: #fff;
    background: #006b4a;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
  }
  .mobile-back {
    display: grid;
    place-items: center;
    min-width: 40px;
    width: 40px;
    height: 44px;
    color: #fff;
    font-size: 0;
  }
  .mobile-back::before { content: '‹'; font-size: 34px; font-weight: 500; }
  .contact-summary .avatar {
    width: 42px;
    height: 42px;
    color: #fff;
    background: rgba(255,255,255,.16);
  }
  .contact-summary h2 { font-size: 17px; color: #fff; }
  .contact-summary p,
  .contact-summary small { color: rgba(255,255,255,.78); }
  .chat-actions .icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.14);
  }

  .message-list {
    flex: 1;
    min-height: 0;
    padding: 12px 10px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #efe7d7;
    background-image: radial-gradient(rgba(7, 94, 84, .055) 1px, transparent 1px);
    background-size: 18px 18px;
  }
  .message-bubble {
    max-width: 84%;
    border: 0;
    border-radius: 13px;
    box-shadow: 0 1px 1.5px rgba(0,0,0,.16);
    font-size: 15px;
  }
  .message-row.incoming .message-bubble { border-top-left-radius: 4px; }
  .message-row.outgoing .message-bubble { border-top-right-radius: 4px; }
  .message-role { text-transform: none; font-size: 11px; letter-spacing: 0; }
  .message-text { white-space: pre-wrap; }

  .composer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    min-height: 62px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border: 0;
    background: #efe7d7;
    position: relative;
    z-index: 5;
  }
  .composer .icon-btn {
    width: 42px;
    min-width: 42px;
    height: 46px;
    min-height: 46px;
    border: 0;
    border-radius: 50%;
    color: var(--native-green);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.14);
  }
  .composer textarea {
    min-height: 46px;
    max-height: 110px;
    padding: 12px 14px;
    border: 0;
    border-radius: 23px;
    background: #fff;
    font-size: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.14);
  }
  .composer .send-btn {
    width: 48px;
    min-width: 48px;
    height: 46px;
    min-height: 46px;
    border-radius: 50%;
    background: var(--native-green);
  }

  .mobile-tabbar {
    height: var(--mobile-tabbar-height);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    background: rgba(255,255,255,.98);
    border-top: 1px solid var(--native-line);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .10);
  }
  .mobile-tab {
    min-height: 54px;
    border: 0;
    border-radius: 18px;
    color: #596873;
    background: transparent;
  }
  .mobile-tab span {
    width: 28px;
    height: 28px;
    margin: 0 auto 1px;
    border-radius: 10px;
    font-size: 19px;
  }
  .mobile-tab b { font-size: 10px; }
  .mobile-tab.active {
    color: var(--native-green);
    background: var(--native-green-soft);
  }
  .mobile-tab.active span {
    color: #fff;
    background: var(--native-green);
  }
}
