/* Connected phone presentation. Desktop styles and media owners stay separate. */
:root[data-web-mode="phone"] {
  zoom: 1 !important;
  --ui-zoom: 1 !important;
  --ink: #253831;
  --muted: #65736a;
  --accent: #086e62;
  --accent-text: #fff;
  --lime: #e0eee5;
  --line: #e5eae2;
  --surface: #fff;
  --canvas: #f2f4ec;
  --rail: #f7f8f4;
  --hover: #f1f4ef;
  --out: #dceee0;
  --danger: #ae403b;
  --phone-bg: #f7f8f4;
  --phone-bottom-space: calc(104px + env(safe-area-inset-bottom));
}
:root[data-web-mode="phone"][data-theme="dark"] {
  --ink: #edf0f2;
  --muted: #aeb7bf;
  --accent: #84d8c9;
  --accent-text: #122c28;
  --lime: #304c48;
  --line: #3a3f44;
  --surface: #25282c;
  --canvas: #191b1e;
  --rail: #191b1e;
  --hover: #31353a;
  --out: #304c48;
  --danger: #ffaaa1;
  --phone-bg: #191b1e;
}
:root[data-web-mode="phone"][data-theme="azure"] {
  --ink: #202e3b;
  --muted: #677582;
  --accent: #087ab5;
  --accent-text: #fff;
  --lime: #dceff9;
  --line: #dce4e9;
  --surface: #fff;
  --canvas: #edf3f7;
  --rail: #f7fafc;
  --hover: #eaf3f9;
  --out: #dceff9;
  --phone-bg: #f7fafc;
}
:root[data-web-mode="phone"] body { width: 100%; background: var(--phone-bg); }
:root[data-web-mode="phone"] #workspace {
  position: fixed;
  inset: var(--phone-vv-top, 0px) 0 auto;
  display: block;
  width: 100%;
  max-width: none;
  height: var(--phone-vv-height, 100dvh);
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  overflow: hidden;
  background: var(--phone-bg);
}
:root[data-web-mode="phone"] body.has-minimized-call #workspace {
  top: calc(var(--phone-vv-top, 0px) + 48px + env(safe-area-inset-top));
  height: calc(var(--phone-vv-height, 100dvh) - 48px - env(safe-area-inset-top));
  padding-top: 0;
}
:root[data-web-mode="phone"] #workspace .rail { display: none; }
:root[data-web-mode="phone"] #workspace .sidebar {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  overflow: hidden;
  background: var(--phone-bg);
}
:root[data-web-mode="phone"] #workspace:not(.open) .conversation { display: none; }
:root[data-web-mode="phone"] #workspace.open .sidebar { display: none; }
:root[data-web-mode="phone"] #workspace .sidebar-head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  padding: 10px 14px;
}
:root[data-web-mode="phone"] #workspace .sidebar-head > div { display: none; }
:root[data-web-mode="phone"] #workspace .phone-header-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
:root[data-web-mode="phone"] #workspace .phone-header-edit {
  flex: 0 0 56px;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
:root[data-web-mode="phone"] #workspace .sidebar-head > .icon-button {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 12px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--accent);
}
:root[data-web-mode="phone"] #workspace .sidebar-head > .icon-button span { display: none; }
:root[data-web-mode="phone"] #workspace .search-field {
  flex-shrink: 0;
  min-height: 44px;
  margin: 0 14px 8px;
  padding-left: 12px;
  border-radius: 14px;
  background: var(--hover);
}
:root[data-web-mode="phone"] #workspace .search-field input { font-size: 16px; padding: 10px 0; }
:root[data-web-mode="phone"] #workspace .search-field .icon-button { width: 44px; min-width: 44px; min-height: 44px; }
:root[data-web-mode="phone"] #workspace .sidebar[data-phone-section="calls"]:not(.phone-search-open) #search { display: none; }
:root[data-web-mode="phone"] #workspace .chat-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 14px 8px;
  border: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
:root[data-web-mode="phone"] #workspace .chat-tabs .list-section-label { display: none; }
:root[data-web-mode="phone"] #workspace .chat-filter-buttons,
:root[data-web-mode="phone"] #workspace .chat-folder-buttons,
:root[data-web-mode="phone"] #workspace #folder-tabs { display: contents; }
:root[data-web-mode="phone"] #workspace .chat-tabs .folder-tab-wrap { display: flex; flex: 0 0 auto; width: auto; }
:root[data-web-mode="phone"] #workspace .chat-tabs button:not(.list-row-more) {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 17px;
  white-space: nowrap;
}
:root[data-web-mode="phone"] #workspace .chat-tabs button.selected { background: var(--accent); color: var(--accent-text); }
:root[data-web-mode="phone"] #workspace .chat-tabs .folder-label { display: inline; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
:root[data-web-mode="phone"] #workspace .chat-tabs .folder-icon .icon { width: 15px; height: 15px; }
:root[data-web-mode="phone"] #workspace #filter-all .folder-icon,
:root[data-web-mode="phone"] #workspace #filter-unread .folder-icon { display: none; }
:root[data-web-mode="phone"] #workspace .chat-tabs .list-count,
:root[data-web-mode="phone"] #workspace #chat-count,
:root[data-web-mode="phone"] #workspace #unread-count { position: static; margin: 0; padding: 0; background: transparent; color: inherit; font: inherit; }
:root[data-web-mode="phone"] #workspace .chat-scroll {
  padding: 0 14px var(--phone-bottom-space);
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}
:root[data-web-mode="phone"] #workspace .chat-list-row,
:root[data-web-mode="phone"] #workspace .contact-list-row,
:root[data-web-mode="phone"] #workspace .call-list-row { border-bottom: 1px solid var(--line); }
:root[data-web-mode="phone"] #workspace .chat-button {
  min-height: 78px;
  gap: 12px;
  padding: 10px 0;
  border-radius: 0;
  background: transparent;
}
:root[data-web-mode="phone"] #workspace .chat-button.active { background: var(--hover); }
:root[data-web-mode="phone"] #workspace .chat-button strong { font-size: 15px; line-height: 21px; font-weight: 800; }
:root[data-web-mode="phone"] #workspace .chat-button small { margin-top: 4px; font-size: 13px; line-height: 19px; }
:root[data-web-mode="phone"] #workspace .chat-button .avatar { width: 52px; min-width: 52px; height: 52px; font-size: 16px; }
:root[data-web-mode="phone"] #workspace .list-row-more { display: none; }
:root[data-web-mode="phone"] #workspace .phone-list-editing .list-row-more {
  position: relative;
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 10px;
  opacity: 1;
  background: var(--surface);
}
:root[data-web-mode="phone"] #workspace .contact-row-info { min-width: 44px; min-height: 44px; }
:root[data-web-mode="phone"] #workspace .sidebar-footer { display: none; }
:root[data-web-mode="phone"] #workspace .phone-tabbar {
  position: absolute;
  z-index: 12;
  left: calc(14px + env(safe-area-inset-left));
  right: calc(78px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 4px 6px;
  border-radius: 29px;
  background: var(--surface);
  box-shadow: 0 8px 20px #0000001f;
}
:root[data-web-mode="phone"] #workspace .phone-tab {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: auto;
  min-width: 44px;
  height: 50px;
  min-height: 50px;
  padding: 4px 0;
  border-radius: 24px;
  background: transparent;
  color: var(--muted);
}
:root[data-web-mode="phone"] #workspace .phone-tab[aria-selected="true"] { color: var(--accent); }
:root[data-web-mode="phone"] #workspace .phone-tab > .icon { width: 21px; height: 21px; }
:root[data-web-mode="phone"] #workspace .phone-tab-label { display: block; font-size: 9px; line-height: 13px; font-weight: 600; }
:root[data-web-mode="phone"] #workspace .phone-tab[aria-selected="true"] .phone-tab-label { font-weight: 800; }
:root[data-web-mode="phone"] #workspace .phone-tab-badge {
  position: absolute;
  top: 0;
  left: calc(50% + 3px);
  min-width: 20px;
  min-height: 20px;
  padding: 2px 5px;
  border: 2px solid var(--surface);
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  line-height: 12px;
}
:root[data-web-mode="phone"] #workspace .phone-search {
  position: absolute;
  z-index: 12;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 17px;
  border-radius: 28px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 8px 20px #0000001f;
}
:root[data-web-mode="phone"] #workspace.open .phone-tabbar,
:root[data-web-mode="phone"] #workspace.open .phone-search,
:root[data-web-mode="phone"][data-phone-keyboard="true"] #workspace .phone-tabbar,
:root[data-web-mode="phone"][data-phone-keyboard="true"] #workspace .phone-search { display: none; }
:root[data-web-mode="phone"] #workspace .sidebar.phone-settings-active > :not(.phone-settings) { display: none; }
:root[data-web-mode="phone"] #workspace .phone-settings { display: flex; flex-direction: column; min-height: 0; height: 100%; }
:root[data-web-mode="phone"] #workspace .phone-settings-header { flex-shrink: 0; min-height: 64px; padding: 18px 14px; margin: 0; text-align: center; }
:root[data-web-mode="phone"] #workspace .phone-settings-header h1 { margin: 0; font-size: 17px; line-height: 24px; font-weight: 800; }
:root[data-web-mode="phone"] #workspace .phone-settings-body { flex: 1; min-height: 0; padding: 0 16px var(--phone-bottom-space); overflow: auto; overscroll-behavior: contain; }
:root[data-web-mode="phone"] #workspace .phone-settings-body .profile-card { padding: 8px 0 20px; }
:root[data-web-mode="phone"] #workspace .phone-settings-body .profile-card h3 { margin: 8px 0 4px; }
:root[data-web-mode="phone"] #workspace .phone-settings-body .settings-actions { gap: 0; overflow: hidden; border-radius: 16px; background: var(--surface); }
:root[data-web-mode="phone"] #workspace .phone-settings-body .menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 14px 16px; border-radius: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; text-align: left; }
:root[data-web-mode="phone"] #workspace .phone-settings-body .menu-item > .icon { flex: 0 0 22px; }
:root[data-web-mode="phone"] #workspace .phone-settings-body .menu-item.danger { color: var(--danger); }
:root[data-web-mode="phone"] #workspace .phone-settings-body .menu-item:last-child { border-bottom: 0; }
:root[data-web-mode="phone"] #workspace.open .conversation { display: flex; height: 100%; width: 100%; overflow: hidden; background: var(--canvas); }
:root[data-web-mode="phone"] #workspace.open #back:not([hidden]) { display: inline-flex !important; }
:root[data-web-mode="phone"] #workspace .chat-head { flex-shrink: 0; height: auto; min-height: 64px; padding: 8px; gap: 4px; border: 0; background: var(--canvas); }
:root[data-web-mode="phone"] #workspace .chat-head > .icon-button,
:root[data-web-mode="phone"] #workspace .chat-actions .icon-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 12px; border-radius: 22px; }
:root[data-web-mode="phone"] #workspace .chat-head > .icon-button,
:root[data-web-mode="phone"] #workspace .chat-actions .icon-button { background: var(--surface); }
:root[data-web-mode="phone"] #workspace .contact-heading { flex: 1; min-width: 0; min-height: 44px; gap: 6px; padding: 4px 8px; border-radius: 20px; background: var(--surface); }
:root[data-web-mode="phone"] #workspace .contact-heading > span:last-child { flex: 1; min-width: 0; }
:root[data-web-mode="phone"] #workspace .contact-heading strong { font-size: 15px; }
:root[data-web-mode="phone"] #workspace .contact-heading small { display: block; overflow: hidden; font-size: 11px; line-height: 14px; white-space: nowrap; text-overflow: ellipsis; }
:root[data-web-mode="phone"] #workspace .chat-head .avatar { width: 36px; min-width: 36px; height: 36px; font-size: 13px; }
:root[data-web-mode="phone"] #workspace .chat-actions { gap: 0; }
/* The existing contact heading invokes the same action as contact-info. */
:root[data-web-mode="phone"] #workspace #contact-info { display: none; }
:root[data-web-mode="phone"] #workspace .group-call-indicator { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; padding: 12px; }
:root[data-web-mode="phone"] #workspace .group-call-indicator > span:last-child { display: none; }
:root[data-web-mode="phone"] #workspace #timeline { flex: 1; min-height: 0; padding: 12px 34px calc(var(--composer-height, 76px) + 16px); overscroll-behavior-y: contain; }
:root[data-web-mode="phone"] #workspace .bubble { font-size: 15px; line-height: 22px; max-width: 94%; }
:root[data-web-mode="phone"] #workspace #pinned-bar { flex-shrink: 0; width: 100%; margin: 0 0 8px; padding: 5px 8px; border: 0; }
:root[data-web-mode="phone"] #workspace .composer-area {
  position: absolute;
  z-index: 8;
  inset: auto 0 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 8px max(8px, env(safe-area-inset-bottom));
  background: var(--canvas);
}
:root[data-web-mode="phone"][data-phone-keyboard="true"] #workspace .composer-area { padding-bottom: 8px; }
:root[data-web-mode="phone"] #workspace #compose { gap: 0; padding: 5px; border-radius: 22px; border: 0; box-shadow: none; }
:root[data-web-mode="phone"] #workspace #compose .icon-button { width: 44px; min-width: 44px; min-height: 44px; padding: 12px; }
:root[data-web-mode="phone"] #workspace #draft { min-width: 0; min-height: 44px; max-height: min(140px, 30dvh); padding: 10px 5px; font-size: 16px; line-height: 24px; }
:root[data-web-mode="phone"] #workspace #send { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 12px; border-radius: 22px; background: var(--accent); color: var(--accent-text); }
:root[data-web-mode="phone"] #workspace #emoji-toggle,
:root[data-web-mode="phone"] #workspace #compose-hint { display: none; }
:root[data-web-mode="phone"] #workspace .to-bottom { bottom: calc(var(--composer-height, 76px) + 12px); }
:root[data-web-mode="phone"] #panel.side-panel {
  inset: var(--phone-vv-top, 0px) 0 auto;
  width: 100%;
  max-width: 100%;
  height: var(--phone-vv-height, 100dvh);
  max-height: var(--phone-vv-height, 100dvh);
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: var(--phone-bg);
}
:root[data-web-mode="phone"] #panel.side-panel > header { min-height: 52px; gap: 8px; }
:root[data-web-mode="phone"] #panel.side-panel > header h2 { font-size: 17px; line-height: 24px; }
:root[data-web-mode="phone"] #panel.side-panel > header button { width: 44px; min-width: 44px; min-height: 44px; padding: 12px; }
:root[data-web-mode="phone"] #panel-body { scrollbar-gutter: auto; padding-bottom: 16px; }
:root[data-web-mode="phone"] .call-dialog,
:root[data-web-mode="phone"] .group-call-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
:root[data-web-mode="phone"] #auth { position: fixed; inset: var(--phone-vv-top, 0px) 0 auto; width: 100%; max-width: 480px; height: var(--phone-vv-height, 100dvh); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior-y: contain; border: 0; border-radius: 0; background: var(--phone-bg); }
:root[data-web-mode="phone"] #auth h1 { font-size: 27px; line-height: 34px; }
:root[data-web-mode="phone"] #auth input { min-height: 44px; font-size: 16px; }
:root[data-web-mode="phone"] #auth .auth-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 20px; margin-bottom: 16px; }
:root[data-web-mode="phone"] #auth .auth-brand img { width: 88px; height: 88px; }
:root[data-web-mode="phone"] #auth .auth-brand span { font-size: 36px; font-weight: 800; }
:root[data-web-mode="phone"] #auth > h1 { margin: 0 0 32px; font-size: 17px; line-height: 24px; font-weight: 400; text-align: center; color: var(--muted); }
:root[data-web-mode="phone"] #auth > p.muted { display: none; }
@media (max-height: 520px) {
  :root[data-web-mode="phone"] #workspace .sidebar-head { min-height: 52px; padding-top: 4px; padding-bottom: 4px; }
  :root[data-web-mode="phone"] #workspace .phone-settings-header { min-height: 52px; padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 359px) {
  :root[data-web-mode="phone"] #workspace .contact-heading .avatar { display: none; }
}
