:root {
  color-scheme: light;
  --bg: #d1d7db;
  --panel: #ffffff;
  --header: #f0f2f5;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --line: #e9edef;
  --text: #111b21;
  --muted: #54656f;
  --accent: #00a884;
  --accent-deep: #008069;
  --accent-hover: #008f6f;
  --accent-ink: #ffffff;
  --wallpaper: #efeae2;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --danger: #c44636;
  --ok: #017561;
  --wait: #8a6116;
  --info: #0271a6;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --card-shadow: 0 18px 50px rgba(11, 20, 26, 0.16);
  --tab: #ffffff;
  --phone-header: #008069;
  --phone-header-text: #ffffff;
  font-family: "Segoe UI", system-ui, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b141a;
  --panel: #111b21;
  --header: #202c33;
  --hover: #202c33;
  --active: #2a3942;
  --line: #222d34;
  --text: #e9edef;
  --muted: #9aa8b0;
  --accent: #00a884;
  --accent-deep: #00a884;
  --accent-hover: #06cf9c;
  --accent-ink: #111b21;
  --wallpaper: #0b141a;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --danger: #f15c6d;
  --ok: #1fbf95;
  --wait: #f0c36a;
  --info: #53bdeb;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.4);
  --card-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --tab: #111b21;
  --phone-header: #202c33;
  --phone-header-text: #e9edef;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.6; cursor: default; }
img, video { max-width: 100%; }

.login-wrap {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 12px;
  padding: 28px 24px 24px;
  box-shadow: var(--card-shadow);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
}
.mark {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 12px;
  margin-top: 1px;
}
.list-head .sub { font-weight: 600; color: var(--text); }
.login-card h1 { margin: 16px 0 8px; font-size: 28px; line-height: 1.15; }
.login-card p { margin: 0 0 18px; color: var(--muted); }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%;
  border: 0;
  background: var(--header);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
  font-size: 16px;
}
textarea { min-height: 44px; max-height: 120px; resize: none; }
input:focus, textarea:focus { box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.35); }
.primary, .ghost, .soft, .send {
  border: 0;
  border-radius: 24px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 700;
}
.primary, .send { background: var(--accent); color: #fff; }
.primary:hover, .send:hover { background: var(--accent-hover); }
html[data-theme="dark"] .primary,
html[data-theme="dark"] .send { color: #111b21; }
.ghost, .soft { background: transparent; color: var(--muted); }
.soft {
  background: var(--panel);
  border-radius: 999px;
  min-height: 32px;
  padding: 6px 12px;
  color: var(--muted);
}
.soft.is-on { background: #d9fdd3; color: #017561; }
html[data-theme="dark"] .soft.is-on { background: #0a332c; color: #1fbf95; }
.icon-btn, .back, .details-btn {
  border: 0;
  background: transparent;
  color: inherit;
  min-height: 44px;
  min-width: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 14px; }

.app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}
.app.is-settings .shell { grid-template-columns: 340px minmax(0, 1fr); }
.list, .thread, .settings { min-height: 0; min-width: 0; }
.list, .settings { background: var(--panel); display: flex; flex-direction: column; }
.list { border-right: 1px solid var(--line); }
.settings { display: none; overflow: auto; }
.app.is-settings .thread { display: none; }
.app.is-settings .settings { display: flex; }

.list-head, .thread-head, .settings-head {
  background: var(--header);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.list-head h1, .settings-head h1 { margin: 0; font-size: 20px; }
.thread-head { flex-direction: row; align-items: center; gap: 8px; }
.who-block { min-width: 0; flex: 1; }
.who-block strong, .who-block span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-block span, .sub { color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.list-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.list-head .brand-lockup { flex: 1; min-width: 0; }
.back { display: none; padding: 0 8px; }
.search-wrap {
  padding: 8px 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-wrap > input { flex: 1; min-width: 0; }
.filter-wrap { flex: 0 0 auto; }
.filter-btn { color: var(--muted); }
.menu-pop button.is-on {
  background: var(--hover);
  font-weight: 600;
}
.menu-pop button .icon:last-child {
  margin-left: auto;
}
.tickets, .messages, .settings-body, .log { overflow: auto; }
.tickets { padding: 8px 0 12px; overflow-x: hidden; }
.ticket {
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-radius: 0;
  min-height: 72px;
  cursor: pointer;
  position: relative;
}
.ticket:hover { background: var(--hover); }
.ticket.is-active { background: var(--active); }
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  overflow: hidden;
  flex: 0 0 auto;
  position: relative;
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #dfe5e7;
}
.avatar.has-photo {
  background: #dfe5e7;
  color: transparent;
  padding: 0;
}
.avatar-letter { line-height: 1; }
.me-avatar { width: 44px; height: 44px; font-size: 17px; }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; }
.avatar.hero { width: 120px; height: 120px; font-size: 42px; margin: 8px auto 0; }
.ticket-main { min-width: 0; overflow: hidden; }
.ticket-top, .ticket-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; min-width: 0; }
.ticket-top strong {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ticket-top strong .icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--accent-deep, var(--accent));
}
.ticket.is-pinned { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.when { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.who, .preview {
  display: block;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.who { color: var(--accent-deep); font-size: 12px; margin-top: 2px; }
.ticket-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  align-self: stretch;
  justify-content: space-between;
  padding-top: 2px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.menu-wrap { position: relative; }
.menu-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.menu-btn:hover, .menu-wrap.is-open .menu-btn { background: var(--hover); color: var(--text); }
.menu-btn .icon { width: 18px; height: 18px; }
.menu-pop {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 20;
  min-width: 190px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-pop-fixed {
  position: fixed;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 60;
  max-width: min(260px, calc(100vw - 16px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.attach-wrap {
  position: relative;
  z-index: 30;
}
.menu-pop-attach {
  position: absolute !important;
  top: auto !important;
  bottom: calc(100% + 8px) !important;
  left: 0 !important;
  right: auto !important;
  z-index: 70;
  min-width: 220px;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(340px, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.composer {
  position: relative;
  z-index: 40;
  overflow: visible;
}
.composer-row {
  overflow: visible;
}
.voice-btn.is-on { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.voice-note { width: min(280px, 100%); margin-top: 6px; }
.call-actions { display: flex; gap: 2px; align-items: center; }
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
}
.call-card {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.call-media {
  position: relative;
  background: #111;
  border-radius: 12px;
  min-height: 220px;
  overflow: hidden;
}
.call-media:fullscreen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  min-height: 100%;
  background: #000;
  display: grid;
  place-items: center;
}
.call-media:fullscreen .call-remote {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}
.call-remote, .call-local {
  display: block;
  width: 100%;
  max-height: 420px;
  background: #111;
  object-fit: contain;
}
.call-local {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 140px;
  max-height: 100px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,.35);
}
.call-controls { display: flex; gap: 8px; justify-content: flex-end; }
.menu-pop-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu-pop-actions .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}
.menu-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}
.attach-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #54656f;
}
.attach-btn .icon { width: 22px; height: 22px; }
.hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.list { overflow: hidden; }
.tickets { flex: 1; min-height: 0; }
.menu-pop button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.menu-pop button:hover { background: var(--hover); }
.who-open {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.profile-edit { display: flex; gap: 14px; align-items: center; }
.file-label { position: relative; overflow: hidden; display: inline-flex; align-items: center; cursor: pointer; margin-top: 8px; }
.file-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.profile-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--chat);
  text-align: center;
}
.profile-pane .fact { text-align: left; }
.profile-name { font-size: 22px; margin-top: 8px; }
.profile-sub { color: var(--muted); margin-bottom: 8px; }
.profile-pane h3 {
  margin: 16px 0 4px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}
.thread { display: flex; flex-direction: column; background: var(--wallpaper); }
.messages {
  flex: 1;
  padding: 16px 6% 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--wallpaper);
  background-image: radial-gradient(rgba(84, 72, 56, 0.16) 0.7px, transparent 0.8px);
  background-size: 16px 16px;
}
html[data-theme="dark"] .messages {
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 0.7px, transparent 0.8px);
}
.subject-pill, .day-pill {
  align-self: center;
  background: var(--header);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  margin: 6px 0 10px;
  box-shadow: var(--shadow);
  max-width: 90%;
  text-align: center;
}
.bubble {
  max-width: min(680px, 86%);
  padding: 6px 8px 4px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  line-height: 1.35;
}
.bubble.admin { background: var(--bubble-in); border-top-left-radius: 0; align-self: flex-start; }
.bubble.desk { background: var(--bubble-out); border-top-right-radius: 0; align-self: flex-end; }
.bubble-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bubble .name { font-size: 12px; font-weight: 700; color: var(--accent-deep); min-width: 0; }
.bubble.desk .name { color: var(--ok); }
.bubble .time { color: var(--muted); font-size: 11px; text-align: right; margin-top: 2px; }
.bubble .body.deleted { font-style: italic; color: var(--muted); }
.bubble.is-deleted { opacity: 0.85; }
.menu-wrap.on-bubble .menu-btn { width: 28px; height: 28px; opacity: 0.7; }
.menu-wrap.on-bubble .menu-pop { right: 0; left: auto; }
.file {
  display: inline-flex;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(11, 20, 26, 0.06);
  color: var(--info);
  text-decoration: none;
  font-weight: 650;
}
.media { margin-top: 6px; }
.shot {
  display: block;
  width: auto;
  max-width: min(320px, 100%);
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  background: #111b21;
  cursor: zoom-in;
}
video.shot { cursor: auto; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(11, 20, 26, 0.88);
}
.lightbox img, .lightbox video {
  max-width: min(1100px, 100%);
  max-height: 90vh;
  max-height: 90dvh;
  border-radius: 8px;
  background: #000;
}
.composer {
  background: var(--header);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.composer-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  background: var(--panel);
  border-radius: 24px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.composer-input,
.composer-pill textarea {
  width: 100%;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0;
  min-height: 24px;
  max-height: 120px;
  padding: 0;
  line-height: 1.35;
  resize: none;
  overflow-y: auto;
}
.clip {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
  background: transparent;
}
.clip:hover { color: var(--accent-deep); }
.clip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  padding: 0;
}
.send {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.send .icon { width: 22px; height: 22px; margin-left: 2px; }
.send.is-ready { background: var(--accent-deep); }
html[data-theme="dark"] .send { color: #111b21; }
.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--panel);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}
.file-chip.has-preview {
  flex-direction: column;
  align-items: stretch;
}
.file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.staged {
  display: block;
  width: auto;
  max-width: min(280px, 100%);
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  background: #111b21;
}
.file-name { color: var(--muted); font-size: 12px; padding-left: 52px; }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; }
.status-row .ghost { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 320px;
  padding: 24px;
}
.pane-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  flex: 0 0 auto;
}
.pane-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.pane-tab.is-on {
  background: var(--header);
  color: var(--text);
}
.thread-search-wrap { padding-top: 4px; }
.thread-search {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--header);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}
.bubble.is-dim { opacity: 0.34; filter: grayscale(0.15); }
.bubble.is-hit {
  box-shadow: 0 0 0 2px #ffe082, var(--shadow);
}
.search-hit {
  background: #fff59d;
  color: #111;
  border-radius: 2px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.ticket .search-hit,
.subject-pill .search-hit {
  background: #fff59d;
  color: #111;
}
.danger-text { color: #d32f2f !important; }
.tracking-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--chat);
}
.tracking-pane h3 {
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fact { background: var(--header); border-radius: 8px; padding: 10px 12px; }
.fact span { display: block; color: var(--muted); font-size: 12px; }
.log { display: flex; flex-direction: column; gap: 8px; }
.log div { font-size: 13px; color: var(--muted); }

.settings-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toggle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.toggle small { display: block; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #cfd6db;
  border-radius: 999px;
}
.slider::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.status-pill {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  background: var(--header);
  color: var(--muted);
}
.status-pill.on { background: #d9fdd3; color: #017561; }
html[data-theme="dark"] .status-pill.on { background: #0a332c; color: #1fbf95; }
.example {
  background: var(--header);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.tabbar { display: none; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  position: relative;
}
.tab.is-on { color: var(--accent-deep); }
.tab .dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 22px);
  width: 8px;
  height: 8px;
}
.icon { width: 22px; height: 22px; display: block; }
.toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 35;
  background: var(--accent);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: var(--card-shadow);
  max-width: min(360px, calc(100% - 32px));
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 300px minmax(0, 1fr); }
  .app.is-settings .shell { grid-template-columns: 1fr; }
  .nav-settings { display: none; }
  .tabbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--tab);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    flex: 0 0 auto;
  }
  .app.is-settings .list,
  .app.is-settings .thread { display: none; }
}

@media (min-width: 1101px) {
  .details-btn { display: none; }
}

@media (max-width: 860px) {
  .shell { display: block; position: relative; }
  .head-actions { flex-wrap: wrap; }
  .head-actions .ghost { min-height: 36px; padding: 4px 8px; font-size: 13px; }
  .list, .thread, .settings { position: absolute; inset: 0; }
  .thread, .settings { display: none; }
  .app.is-chat .list { display: none; }
  .app.is-chat .thread { display: flex; }
  .app.is-chat .tabbar { display: none; }
  .app.is-settings .settings { display: flex; }
  .back { display: inline-flex; color: var(--phone-header-text); }
  .list-head, .thread-head, .settings-head {
    background: var(--phone-header);
    color: var(--phone-header-text);
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .list-head .mark,
  .settings-head .mark,
  .who-block span,
  .head-actions .ghost,
  .details-btn { color: var(--phone-header-text); }
  .list-head h1, .settings-head h1, .who-block strong { color: var(--phone-header-text); }
  .messages { padding: 12px 10px; }
  .composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .toast { left: 16px; right: 16px; }
}

@media (min-width: 861px) and (max-width: 1100px) {
  .app.is-chat .tabbar { display: grid; }
  .list, .thread, .settings { position: static; }
  .thread { display: flex; }
  .app.is-settings .settings { position: static; }
}
