:root {
  color-scheme: light;
  --app-bg: #cfd7dc;
  --panel-bg: rgba(240, 244, 247, 0.82);
  --panel-strong: rgba(246, 248, 250, 0.78);
  --surface: #ffffff;
  --surface-raised: #f7f8fa;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.66);
  --line: #d9dee3;
  --text: #111b21;
  --muted: #667781;
  --muted-soft: #8696a0;
  --brand: #00a884;
  --brand-dark: #008069;
  --chat-bg: #efeae2;
  --sent: #d9fdd3;
  --received: #ffffff;
  --notice: rgba(255, 255, 255, 0.78);
  --danger: #b42318;
  --shadow-soft: 0 1px 2px rgba(17, 27, 33, 0.12);
  --shadow-panel: 0 22px 58px rgba(17, 27, 33, 0.22);
  --glass-shadow: 0 18px 44px rgba(17, 27, 33, 0.14);
  --header-h: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

html {
  height: -webkit-fill-available;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 168, 132, 0.11), transparent 34%),
    linear-gradient(315deg, rgba(72, 134, 247, 0.12), transparent 42%),
    var(--app-bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(0, 168, 132, 0.12), transparent 36%),
    var(--panel-bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.login-brand {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  background: #e7fce3;
  color: var(--brand-dark);
}

.login-brand svg {
  width: 34px;
  height: 34px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.password-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.password-field input,
.date-field input,
.sidebar-search input,
.panel-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
}

.password-field input {
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 16px;
}

.password-field input:focus,
.date-field input:focus,
.sidebar-search:focus-within,
.panel-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.16);
}

.primary-button {
  width: 100%;
  height: 46px;
  border-radius: 7px;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.wa-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: clamp(300px, 30vw, 390px) minmax(0, 1fr) 0;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.wa-shell.is-chat-preparing {
  opacity: 0;
  pointer-events: none;
}

.wa-shell.tools-open {
  grid-template-columns: clamp(300px, 28vw, 380px) minmax(0, 1fr) clamp(360px, 32vw, 560px);
}

.single-chat-shell,
.single-chat-shell.tools-open {
  grid-template-columns: minmax(0, 1fr) 0;
}

.single-chat-shell.tools-open {
  grid-template-columns: minmax(0, 1fr) clamp(360px, 32vw, 560px);
}

.single-chat-shell .chat-list-pane {
  display: none;
}

.chat-list-pane,
.tools-panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(24px) saturate(1.18);
}

.chat-list-pane {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  border-right: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.62);
  z-index: 4;
}

.tools-panel {
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: -18px 0 42px rgba(17, 27, 33, 0.12);
}

.pane-header,
.chat-header,
.tools-head {
  min-height: var(--header-h);
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel-strong);
  border-color: rgba(255, 255, 255, 0.58);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.58), 0 12px 34px rgba(17, 27, 33, 0.08);
  backdrop-filter: blur(22px) saturate(1.18);
}

.chat-header,
.tools-head {
  display: flex;
  align-items: center;
}

.pane-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title actions";
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.list-top-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

.list-action-spacer {
  flex: 1;
}

.soft-button {
  background: transparent;
  color: var(--muted);
}

.add-button {
  background: transparent;
  color: var(--muted);
}

.pane-title {
  grid-area: title;
  min-width: 0;
}

.pane-title h1,
.tools-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.pane-title h1 {
  font-size: 20px;
  font-weight: 720;
  letter-spacing: 0;
}

.pane-title p,
.tools-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover,
.quick-action:hover,
.archive-toolbar button:hover {
  background: rgba(17, 27, 33, 0.07);
  color: var(--text);
}

.sidebar-search,
.panel-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--muted);
}

.sidebar-search {
  height: 40px;
  margin: 10px 12px 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f0f2f5;
}

.sidebar-search input {
  height: 100%;
  font-size: 14px;
}

.conversation-list {
  min-height: 0;
  overflow: auto;
}

.conversation-list,
.chat-scroller,
.tool-section {
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 105, 112, 0.24) transparent;
}

.conversation-list::-webkit-scrollbar,
.chat-scroller::-webkit-scrollbar,
.tool-section::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.conversation-list::-webkit-scrollbar-track,
.chat-scroller::-webkit-scrollbar-track,
.tool-section::-webkit-scrollbar-track {
  background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat-scroller::-webkit-scrollbar-thumb,
.tool-section::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(91, 105, 112, 0.22);
  background-clip: padding-box;
}

.conversation-card {
  position: relative;
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.conversation-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 76px;
  height: 1px;
  background: var(--line);
}

.conversation-card.is-active,
.conversation-card:hover {
  background: #f5f6f6;
}

.conversation-avatar,
.chat-avatar,
.details-avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #dfe5e7;
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(25, 206, 117, 0.7);
  padding: 1px;
  box-shadow: inset 0 0 0 2px #fff;
}

.conversation-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.conversation-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.conversation-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
}

.conversation-row time {
  flex: 0 0 auto;
  color: var(--muted-soft);
  font-size: 12px;
}

.conversation-preview {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.conversation-badge {
  min-width: 22px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.quick-actions {
  display: flex;
  gap: 8px;
  padding: 4px 12px 9px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action {
  height: 32px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.quick-action.is-active {
  background: #d9fdd3;
  color: #087a43;
}

.quick-action svg {
  width: 17px;
  height: 17px;
}

.chat-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--chat-bg);
}

.chat-header {
  border-bottom: 1px solid var(--line);
  z-index: 3;
}

.profile-button {
  min-width: 0;
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chat-avatar {
  width: 42px;
  height: 42px;
}

.profile-button span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  letter-spacing: 0;
}

.profile-button small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.chat-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px) saturate(1.14);
}

.chat-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--chat-bg);
}

.chat-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(17, 27, 33, 0.045) 1px, transparent 1.4px),
    radial-gradient(circle at 34px 31px, rgba(17, 27, 33, 0.04) 1px, transparent 1.4px);
  background-size: 56px 56px;
}

.chat-inline-panel {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  width: min(560px, calc(100% - 28px));
  max-height: min(620px, calc(100% - 28px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.82);
  box-shadow: 0 18px 46px rgba(49, 64, 71, 0.2);
  transform: translateX(-50%);
  backdrop-filter: blur(20px) saturate(1.12);
}

.chat-search-panel {
  width: min(760px, calc(100% - 28px));
  max-height: min(560px, calc(100% - 28px));
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-search-panel .chat-inline-form {
  min-height: 56px;
  padding: 7px 10px 7px 16px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 38px rgba(49, 64, 71, 0.16);
  backdrop-filter: blur(20px) saturate(1.14);
}

.chat-search-panel .chat-inline-meta:empty,
.chat-search-panel .chat-inline-results:empty {
  display: none;
}

.chat-search-panel .chat-inline-meta,
.chat-search-panel .chat-inline-results {
  margin-inline: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.82);
  box-shadow: 0 12px 34px rgba(49, 64, 71, 0.12);
  backdrop-filter: blur(18px) saturate(1.1);
}

.chat-date-panel {
  width: min(620px, calc(100% - 28px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 10px;
  background: rgba(255, 252, 245, 0.76);
}

.chat-inline-form {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(207, 216, 221, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.chat-inline-form:focus-within {
  border-color: rgba(0, 128, 105, 0.36);
  box-shadow: 0 0 0 3px rgba(0, 128, 105, 0.08);
}

.chat-inline-form > svg {
  color: var(--brand-dark);
}

.chat-inline-form input {
  min-width: 0;
  flex: 1;
  height: 34px;
  border: 0;
  background: transparent;
  font-size: 14px;
  outline: 0;
}

.chat-inline-form button[type="submit"] {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.chat-inline-form .icon-button {
  width: 34px;
  height: 34px;
}

.chat-inline-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chat-inline-results {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 105, 112, 0.22) transparent;
}

.chat-inline-results::-webkit-scrollbar,
.chat-date-quick-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.chat-inline-results::-webkit-scrollbar-track,
.chat-date-quick-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-inline-results::-webkit-scrollbar-thumb,
.chat-date-quick-list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(91, 105, 112, 0.2);
  background-clip: padding-box;
}

.chat-date-field {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.chat-date-field input {
  width: 100%;
  height: 28px;
  border: 0;
  background: transparent;
  outline: 0;
}

.chat-date-quick-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 105, 112, 0.22) transparent;
}

.chat-date-chip {
  min-width: 0;
  min-height: 46px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  cursor: pointer;
}

.chat-date-chip:hover {
  background: #d9fdd3;
}

.chat-date-chip span {
  font-size: 13px;
  font-weight: 750;
}

.chat-date-chip small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.chat-date-panel {
  top: auto;
  bottom: max(26px, env(safe-area-inset-bottom));
  width: min(720px, calc(100vw - 220px));
  max-height: min(78dvh, 640px);
  gap: 16px;
  padding: 22px 30px 24px;
  border-color: rgba(255, 255, 255, 0.74);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.52) 42%, rgba(232, 239, 245, 0.64)),
    rgba(255, 255, 255, 0.68);
  color: #17212b;
  box-shadow: 0 34px 92px rgba(58, 72, 82, 0.28);
  backdrop-filter: blur(34px) saturate(1.22);
}

.chat-date-panel .chat-inline-form {
  min-height: 62px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.chat-date-panel .chat-inline-form > svg {
  display: none;
}

.chat-date-panel #closeChatDateButton {
  grid-column: 1;
  grid-row: 1;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.62);
  color: #314047;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 12px 26px rgba(58, 72, 82, 0.14);
}

.chat-date-panel .chat-date-field {
  grid-column: 2;
  grid-row: 1;
  justify-items: center;
  gap: 0;
  color: rgba(49, 64, 71, 0.64);
}

.chat-date-panel .chat-date-field span {
  color: #17212b;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
}

.chat-date-panel .chat-date-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chat-date-panel .chat-inline-form:focus-within {
  box-shadow: none;
}

.chat-date-panel .chat-date-quick-list {
  display: block;
  min-height: 0;
  overflow: auto;
}

.chat-date-calendar {
  display: grid;
  gap: 16px;
}

.chat-date-monthbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 46px;
  align-items: center;
  gap: 8px;
}

.chat-date-month-select {
  min-width: 0;
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  padding: 0;
  background: transparent;
  color: #3f7df0;
  cursor: pointer;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.chat-date-month-select span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-date-month-select svg {
  width: 26px;
  height: 26px;
  transition: transform 160ms ease;
}

.chat-date-panel.is-picker-open .chat-date-month-select svg {
  transform: rotate(180deg);
}

.chat-date-month-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
  color: #3f7df0;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 10px 24px rgba(58, 72, 82, 0.1);
}

.chat-date-month-button:disabled {
  opacity: 0.28;
  cursor: default;
}

.chat-date-panel.is-picker-open .chat-date-month-button {
  visibility: hidden;
}

.chat-date-picker {
  position: relative;
  min-height: 260px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 18px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #fff 18%, #fff 82%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #fff 18%, #fff 82%, transparent 100%);
}

.chat-date-picker-highlight {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 58px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 14px 34px rgba(58, 72, 82, 0.12);
  transform: translateY(-50%);
  pointer-events: none;
}

.chat-date-picker-column {
  position: relative;
  z-index: 1;
  height: 250px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
  padding: 96px 0;
}

.chat-date-picker-column::-webkit-scrollbar {
  display: none;
}

.chat-date-picker-item {
  min-height: 54px;
  scroll-snap-align: center;
  border-radius: 999px;
  background: transparent;
  color: rgba(49, 64, 71, 0.4);
  font-size: 28px;
  font-weight: 650;
  cursor: pointer;
}

.chat-date-picker-item.is-selected {
  color: #17212b;
  font-size: 31px;
  font-weight: 800;
}

.chat-date-weekdays,
.chat-date-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  text-align: center;
}

.chat-date-weekdays {
  gap: 8px;
}

.chat-date-weekdays span {
  min-width: 0;
  overflow: hidden;
  color: rgba(49, 64, 71, 0.56);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-overflow: ellipsis;
}

.chat-date-days {
  gap: 6px 10px;
}

.chat-date-day {
  min-width: 0;
  width: 48px;
  height: 48px;
  min-height: 0;
  justify-self: center;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 4px;
  border-radius: 50%;
  background: transparent;
  color: rgba(49, 64, 71, 0.28);
  box-shadow: none;
}

.chat-date-day.has-record {
  border: 1px solid transparent;
  background: transparent;
  color: #17212b;
  cursor: pointer;
  box-shadow: none;
}

.chat-date-day.has-record:hover {
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.chat-date-day.is-selected {
  border-color: rgba(66, 130, 245, 0.72);
  background: #5a8df7;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(90, 141, 247, 0.38);
}

.chat-date-day:disabled {
  cursor: default;
}

.chat-date-day span {
  font-size: 23px;
  font-weight: 760;
  line-height: 1;
}

.chat-date-day small {
  display: none;
}

.chat-date-day.is-empty {
  width: 48px;
  height: 48px;
}

.chat-date-done {
  width: 100%;
  min-height: 56px;
  margin-top: 0;
  border-radius: 999px;
  background: #5a8df7;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(90, 141, 247, 0.32);
}

.chat-date-done:disabled {
  opacity: 0.46;
  cursor: default;
}

.chat-scroller {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  scrollbar-gutter: stable both-edges;
  transform: translateZ(0);
}

.message-items {
  max-width: 900px;
  margin: 0 auto;
}

.message-item {
  width: 100%;
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: 82px;
  overflow-anchor: none;
}

.message-item.placeholder {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.date-divider {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
}

.date-divider span,
.current-date-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--notice);
  color: #54656f;
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  font-weight: 650;
}

.current-date-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
}

.scroll-edge-notice {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.82);
  color: #54656f;
  box-shadow: 0 12px 34px rgba(49, 64, 71, 0.16);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(18px) saturate(1.14);
}

.scroll-edge-notice.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.message-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 2px 0;
}

.message-row.right {
  justify-content: flex-end;
}

.bubble {
  position: relative;
  max-width: min(680px, 72%);
  min-width: 74px;
  padding: 6px 8px 5px;
  border-radius: 8px;
  background: var(--received);
  box-shadow: var(--shadow-soft);
}

.message-row.left .bubble {
  border-top-left-radius: 2px;
}

.message-row.right .bubble {
  border-top-right-radius: 2px;
  background: var(--sent);
}

.message-row.left .bubble::before,
.message-row.right .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  background: inherit;
}

.message-row.left .bubble::before {
  left: -6px;
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.message-row.right .bubble::before {
  right: -6px;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.sender-name {
  display: block;
  margin: 0 0 3px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.42;
}

.message-text a {
  color: #0b6fa4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wxemoji {
  width: 24px;
  height: 24px;
  vertical-align: -6px;
}

.message-text.is-emoji-only .wxemoji {
  width: 40px;
  height: 40px;
  vertical-align: -12px;
}

.emoji-placeholder {
  width: 88px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.68);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(12px) saturate(1.08);
}

.bubble-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 16px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.message-row.right .ticks {
  color: #53bdeb;
  font-size: 13px;
  letter-spacing: -2px;
  transform: translateY(-1px);
}

.media-frame {
  position: relative;
  width: min(300px, 62vw);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 7px;
  background: #d7dde0;
  contain: layout paint size;
  cursor: zoom-in;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.message-image,
.message-video,
.message-video-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #d7dde0;
}

.message-video {
  object-fit: contain;
}

.message-image {
  cursor: zoom-in;
}

.message-video-thumb {
  display: block;
  border: 0;
  padding: 0;
  color: #314047;
  cursor: pointer;
  text-align: left;
}

.message-video-thumb:disabled {
  cursor: default;
}

.message-video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0), rgba(49, 64, 71, 0.24));
  pointer-events: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(135deg, #68767d, #303a40);
  color: rgba(255, 255, 255, 0.86);
  font-size: 15px;
  font-weight: 750;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 252, 245, 0.82);
  color: #314047;
  box-shadow: 0 6px 20px rgba(49, 64, 71, 0.2);
  backdrop-filter: blur(12px) saturate(1.14);
}

.video-play svg {
  width: 28px;
  height: 28px;
  margin-left: 3px;
}

.video-label {
  position: absolute;
  left: 9px;
  bottom: 8px;
  z-index: 2;
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.78);
  color: #314047;
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(10px) saturate(1.1);
}

.media-frame .bubble-foot {
  position: absolute;
  right: 8px;
  bottom: 7px;
  margin: 0;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.78);
  color: #314047;
  backdrop-filter: blur(10px) saturate(1.1);
}

.voice-message {
  --voice-progress: 0%;
  width: min(290px, 62vw);
  min-width: 210px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.voice-play {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-dark);
  color: #fff;
}

.message-row.right .voice-play {
  background: #fff;
  color: var(--brand-dark);
}

.voice-play svg {
  width: 18px;
  height: 18px;
}

.voice-wave {
  flex: 1;
  position: relative;
  height: 22px;
  border-radius: 999px;
  color: rgba(0, 128, 105, 0.58);
  background:
    linear-gradient(90deg, currentColor 2px, transparent 2px) 0 50% / 8px 9px repeat-x;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
}

.voice-wave::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--voice-progress);
  height: 4px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: var(--brand-dark);
}

.voice-wave::after {
  content: "";
  position: absolute;
  left: clamp(0px, var(--voice-progress), calc(100% - 8px));
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--brand-dark);
  opacity: 0;
}

.voice-message.is-playing .voice-wave {
  animation: voiceWave 0.9s linear infinite;
}

.voice-message.is-playing .voice-wave::after {
  opacity: 1;
}

.voice-duration {
  width: 58px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.voice-message.has-error .voice-play {
  background: #f04438;
  color: #fff;
}

.voice-message.has-error .voice-wave {
  color: rgba(240, 68, 56, 0.45);
}

.voice-message.has-error .voice-duration {
  width: 64px;
  color: #b42318;
}

@keyframes voiceWave {
  from {
    background-position-x: 0;
  }
  to {
    background-position-x: 16px;
  }
}

.attachment-card {
  display: grid;
  gap: 4px;
  min-width: min(280px, 62vw);
  padding: 8px;
  border-radius: 7px;
  background: rgba(17, 27, 33, 0.06);
}

.attachment-card strong {
  font-size: 13px;
}

.attachment-card span {
  color: var(--muted);
  font-size: 12px;
}

.notice-row {
  display: flex;
  justify-content: center;
  padding: 5px 0;
}

.notice-pill {
  max-width: min(580px, calc(100vw - 72px));
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--notice);
  color: #54656f;
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.is-highlighted .bubble,
.is-highlighted .notice-pill {
  outline: 3px solid rgba(255, 193, 7, 0.82);
  outline-offset: 2px;
}

.floating-latest {
  position: absolute;
  right: 24px;
  bottom: 22px;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-panel);
  cursor: pointer;
}

.archive-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--panel-strong);
  border-top: 1px solid var(--line);
}

.archive-toolbar button {
  height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.composer-round {
  flex: 0 0 38px;
  width: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.composer-round svg {
  width: 20px;
  height: 20px;
}

.composer-field {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
  color: var(--muted);
}

.tools-panel {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 1px solid var(--line);
  background: rgba(240, 242, 245, 0.86);
  transform: translate3d(100%, 0, 0);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 5;
  contain: layout paint style;
  backface-visibility: hidden;
  will-change: transform;
  backdrop-filter: blur(18px) saturate(1.12);
}

.wa-shell.tools-open .tools-panel {
  transform: translate3d(0, 0, 0);
}

.wa-shell.is-chat-preparing .tools-panel {
  transition: none;
}

.tools-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(1.14);
}

.tool-section {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.profile-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(240, 242, 245, 0.58) 260px),
    rgba(240, 242, 245, 0.86);
}

.profile-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 0 10px;
  text-align: center;
}

.details-avatar {
  width: 108px;
  height: 108px;
}

.profile-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 4px;
  margin: 12px 0 12px;
  padding: 4px;
  border: 1px solid rgba(207, 216, 221, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.1);
}

.profile-actions::-webkit-scrollbar {
  display: none;
}

.profile-actions button {
  min-width: 0;
  height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  box-shadow: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.profile-actions button:active {
  transform: scale(0.98);
}

.profile-actions button.is-active {
  background: rgba(231, 252, 243, 0.94);
  box-shadow: 0 2px 8px rgba(0, 128, 105, 0.12);
}

.profile-actions button.is-active span {
  color: var(--brand-dark);
}

.profile-actions svg {
  width: 18px;
  height: 18px;
}

.profile-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stats-panel {
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.stats-grid div,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(1.1);
}

.stats-grid div {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 4px 12px;
}

.stats-grid strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(18px, 2.1vw, 26px);
  line-height: 1.05;
}

.stats-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.tool-card {
  padding: 14px;
}

.profile-tab-panel {
  min-width: 0;
  margin-top: 12px;
}

.date-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.date-field input {
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
}

.date-quick-list {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.date-month {
  display: grid;
  gap: 8px;
}

.date-month h4 {
  position: sticky;
  top: -16px;
  z-index: 1;
  margin: 0;
  padding: 7px 0;
  background: var(--panel-bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.date-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 6px;
}

.date-day {
  min-width: 0;
  height: 42px;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
}

.date-day:hover {
  background: #d8fdd2;
}

.date-day span {
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
}

.date-day small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.panel-search {
  height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.panel-search input {
  height: 100%;
}

.panel-search button {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.results-list {
  display: grid;
  gap: 8px;
}

.result-empty {
  padding: 18px 10px;
  color: var(--muted);
  line-height: 1.5;
}

.result-item {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.result-item:hover {
  background: #f5f6f6;
}

.result-media,
.result-icon {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  object-fit: cover;
  background: #dfe5e7;
}

.result-icon {
  display: grid;
  place-items: center;
  color: var(--brand-dark);
}

.result-content {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.result-time {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.result-snippet {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.media-results .result-item {
  grid-template-columns: 70px minmax(0, 1fr);
}

.media-results .result-media,
.media-results .result-icon {
  width: 70px;
  height: 70px;
}

.media-audio-result {
  display: block;
  cursor: default;
}

.media-voice-content {
  display: grid;
  gap: 8px;
}

.media-voice-player {
  width: 100%;
}

.media-jump-button {
  justify-self: end;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.media-jump-button:hover {
  background: #d9fdd3;
  color: var(--brand-dark);
}

.media-load-more {
  min-height: 42px;
  display: grid;
  place-items: center;
  grid-column: 1 / -1;
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.82);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.media-load-more:hover {
  background: #d9fdd3;
}

.media-scroll-date {
  position: sticky;
  top: 12px;
  z-index: 3;
  justify-self: center;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 2px auto -44px;
  padding: 0 26px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.1)),
    rgba(49, 64, 71, 0.48);
  color: rgba(255, 255, 255, 0.94);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 14px 34px rgba(49, 64, 71, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(22px) saturate(1.22);
}

.media-scroll-date[hidden] {
  display: none;
}

.media-scroll-date.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tools-panel[data-media-type="image"] .media-results,
.tools-panel[data-media-type="video"] .media-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.tools-panel[data-media-type="image"] .media-results .result-item,
.tools-panel[data-media-type="video"] .media-results .result-item {
  position: relative;
  display: block;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #d7dde0;
}

.media-result-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(255, 252, 245, 0.3));
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.media-result-card:hover::after,
.media-result-card:focus-visible::after {
  opacity: 1;
}

.result-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #314047;
  pointer-events: none;
}

.result-play svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.82);
  backdrop-filter: blur(8px);
}

.tools-panel[data-media-type="image"] .media-results .result-media,
.tools-panel[data-media-type="image"] .media-results .result-icon,
.tools-panel[data-media-type="video"] .media-results .result-media,
.tools-panel[data-media-type="video"] .media-results .result-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tools-panel[data-media-type="image"] .media-results .result-content,
.tools-panel[data-media-type="video"] .media-results .result-content {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: rgba(247, 242, 232, 0.62);
  backdrop-filter: blur(22px) saturate(1.12);
}

.lightbox-close,
.lightbox-jump {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 252, 245, 0.78);
  color: #314047;
  box-shadow: 0 10px 28px rgba(49, 64, 71, 0.18);
  backdrop-filter: blur(18px) saturate(1.16);
}

.lightbox-jump {
  right: calc(max(18px, env(safe-area-inset-right)) + 56px);
}

.lightbox-jump:disabled {
  opacity: 0.46;
  cursor: default;
}

.lightbox-body {
  width: min(1160px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  height: min(760px, calc(100dvh - 36px));
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.76);
  box-shadow: 0 22px 56px rgba(49, 64, 71, 0.2);
  backdrop-filter: blur(18px) saturate(1.12);
}

.lightbox-body img,
.lightbox-body video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.lightbox[data-preview="image"] .lightbox-body {
  cursor: zoom-out;
  width: min(1160px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 36px));
  height: min(820px, calc(100dvh - 36px));
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.lightbox[data-preview="image"] .lightbox-body img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: none;
  pointer-events: auto;
  touch-action: pinch-zoom;
}

.lightbox[data-preview="video"] .lightbox-body {
  width: min(1120px, calc(100vw - 36px));
  height: min(720px, calc(100vh - 36px));
  height: min(720px, calc(100dvh - 36px));
}

.lightbox-body video {
  width: 100%;
  height: 100%;
  background: #fbf7ee;
}

.chat-header,
.pane-header,
.tools-head,
.archive-toolbar,
.chat-inline-form,
.profile-actions,
.stats-grid div,
.date-day,
.chat-date-chip,
.tool-card,
.result-item,
.lightbox-body {
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.12) 38%, rgba(255, 255, 255, 0.34));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2),
    0 10px 28px rgba(49, 64, 71, 0.09);
  backdrop-filter: blur(18px) saturate(1.18);
}

.tools-panel,
.chat-inline-panel,
.lightbox {
  backdrop-filter: blur(24px) saturate(1.2);
}

.lightbox-error {
  max-width: min(320px, 86vw);
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.86);
  color: #314047;
  font-size: 14px;
  text-align: center;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .wa-shell,
  .wa-shell.tools-open {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }

  .single-chat-shell,
  .single-chat-shell.tools-open {
    grid-template-columns: 1fr;
  }

  .tools-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 94vw);
    box-shadow: var(--shadow-panel);
  }

  .wa-shell.tools-open .tools-panel {
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  :root {
    --header-h: 58px;
  }

  .wa-shell,
  .wa-shell.tools-open {
    position: relative;
    width: 100vw;
    grid-template-columns: 1fr;
    overflow: hidden;
    transform: none;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  .chat-stage::before {
    display: none;
  }

  .chat-list-pane,
  .chat-pane,
  .tools-panel,
  .tools-head,
  .pane-header,
  .chat-header,
  .chat-actions,
  .chat-inline-panel,
  .chat-inline-form,
  .chat-date-panel,
  .profile-actions,
  .stats-grid div,
  .tool-card,
  .result-item,
  .lightbox,
  .lightbox-body,
  .lightbox-close,
  .lightbox-jump,
  .media-scroll-date {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .profile-button,
  .icon-button,
  .quick-action,
  .media-tab,
  .tools-close,
  .media-load-more {
    touch-action: manipulation;
  }

  .single-chat-shell .chat-list-pane {
    display: none;
  }

  .chat-list-pane,
  .chat-pane {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease;
  }

  .chat-pane {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .chat-list-pane {
    z-index: 1;
    transform: translateX(0);
  }

  .chat-pane {
    z-index: 2;
    transform: translateX(100%);
  }

  .single-chat-shell .chat-pane {
    transform: translateX(0);
    opacity: 1;
  }

  .wa-shell.chat-open .chat-list-pane {
    pointer-events: none;
    transform: translateX(-18%);
    opacity: 0.82;
  }

  .wa-shell.chat-open .chat-pane {
    transform: translateX(0);
    opacity: 1;
  }

  .single-chat-shell .mobile-only {
    display: none;
  }

  .mobile-only {
    display: inline-grid;
  }

  .pane-header,
  .chat-header {
    padding: 8px 10px;
  }

  .pane-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "actions"
      "title";
    padding: max(10px, env(safe-area-inset-top)) 10px 6px;
  }

  .list-top-actions {
    width: 100%;
    justify-self: stretch;
  }

  .list-top-actions .icon-button {
    width: 34px;
    height: 34px;
  }

  .pane-title h1 {
    font-size: 32px;
  }

  .chat-actions {
    gap: 1px;
    padding: 1px;
  }

  .chat-actions .icon-button {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .chat-actions .icon-button svg {
    width: 19px;
    height: 19px;
  }

  .chat-scroller {
    padding-inline: 10px;
    scrollbar-gutter: auto;
    transform: none;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .message-item {
    contain: layout style;
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }

  .wa-shell.tools-open .chat-pane {
    visibility: hidden;
  }

  .wa-shell.tools-open .tools-panel {
    visibility: visible;
  }

  .conversation-list,
  .tool-section,
  .chat-inline-results,
  .chat-date-quick-list,
  .chat-date-picker-column,
  .profile-actions {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .chat-inline-panel {
    top: 8px;
    width: calc(100% - 16px);
    max-height: min(68%, 560px);
    padding: 10px;
  }

  .chat-search-panel {
    top: 10px;
    z-index: 12;
    width: calc(100% - 18px);
    max-height: min(62%, 520px);
    padding: 0;
  }

  .chat-search-panel .chat-inline-form {
    min-height: 50px;
  }

  .sidebar-search input,
  .panel-search input,
  .chat-inline-form input,
  .chat-search-panel .chat-inline-form input {
    font-size: 16px;
    line-height: 1.25;
  }

  .chat-date-panel {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 12;
    width: calc(100% - 18px);
    max-height: min(82dvh, 640px);
    padding: 16px 16px 18px;
    border: 1px solid rgba(225, 230, 233, 0.96);
    border-radius: 26px;
    background: rgba(255, 252, 245, 0.98);
    color: #17212b;
    box-shadow: 0 18px 52px rgba(49, 64, 71, 0.24);
  }

  .chat-date-panel .chat-inline-form {
    min-height: 58px;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    padding: 4px;
    border-radius: 20px;
  }

  .chat-date-panel #closeChatDateButton {
    width: 48px;
    height: 48px;
  }

  .chat-date-panel .chat-date-field span {
    font-size: 22px;
  }

  .chat-date-panel .chat-date-field {
    position: relative;
    min-height: 48px;
    cursor: pointer;
  }

  .chat-date-panel .chat-date-field input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.01;
    pointer-events: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color-scheme: light;
  }

  .chat-date-calendar {
    gap: 16px;
  }

  .chat-date-monthbar {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 8px;
  }

  .chat-date-month-select {
    font-size: 24px;
  }

  .chat-date-month-select svg {
    width: 23px;
    height: 23px;
  }

  .chat-date-month-button {
    width: 44px;
    height: 44px;
  }

  .chat-date-picker {
    min-height: 260px;
    gap: 10px;
  }

  .chat-date-picker-highlight {
    left: 7%;
    right: 7%;
    height: 54px;
  }

  .chat-date-picker-column {
    height: 250px;
    padding-block: 96px;
  }

  .chat-date-picker-item {
    min-height: 52px;
    font-size: 27px;
  }

  .chat-date-picker-item.is-selected {
    font-size: 30px;
  }

  .chat-date-weekdays {
    gap: 6px;
  }

  .chat-date-weekdays span {
    font-size: 13px;
  }

  .chat-date-days {
    gap: 7px;
  }

  .chat-date-day,
  .chat-date-day.is-empty {
    width: 44px;
    height: 44px;
    min-height: 0;
  }

  .chat-date-day span {
    font-size: 19px;
  }

  .chat-date-day small {
    font-size: 9px;
  }

  .chat-date-done {
    min-height: 54px;
    font-size: 17px;
  }

  .chat-date-month-select,
  .chat-date-month-button,
  .chat-date-day,
  .chat-date-picker-item,
  .chat-date-done,
  .chat-date-panel #closeChatDateButton {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .chat-date-quick-list,
  .chat-date-picker-column {
    touch-action: pan-y;
  }

  .scroll-edge-notice {
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 10;
    min-height: 34px;
    background: rgba(255, 252, 245, 0.96);
    color: #314047;
    transition: opacity 120ms ease, transform 120ms ease;
  }

  .chat-inline-form {
    min-height: 42px;
  }

  .chat-date-quick-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-inline-results,
  .chat-date-quick-list {
    scrollbar-width: none;
  }

  .chat-inline-results::-webkit-scrollbar,
  .chat-date-quick-list::-webkit-scrollbar {
    display: none;
  }

  .conversation-list,
  .chat-scroller,
  .tool-section {
    scrollbar-width: none;
  }

  .conversation-list::-webkit-scrollbar,
  .chat-scroller::-webkit-scrollbar,
  .tool-section::-webkit-scrollbar {
    display: none;
  }

  .bubble {
    max-width: min(86%, 620px);
  }

  .message-image,
  .message-video,
  .message-video-poster,
  .media-frame,
  .voice-message {
    width: min(270px, 74vw);
  }

  .archive-toolbar {
    display: none;
  }

  .tools-panel {
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-left: 0;
    background: #f0f2f5;
    box-shadow: none;
    transition: none;
    will-change: auto;
  }

  .wa-shell.is-tools-hydrating .profile-card,
  .wa-shell.is-tools-hydrating .stats-panel,
  .wa-shell.is-tools-hydrating .profile-tab-panel {
    display: none;
  }

  .lightbox {
    padding:
      max(62px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .lightbox-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }

  .lightbox-jump {
    top: max(12px, env(safe-area-inset-top));
    right: calc(max(12px, env(safe-area-inset-right)) + 52px);
  }

  .lightbox-body,
  .lightbox[data-preview="image"] .lightbox-body,
  .lightbox[data-preview="video"] .lightbox-body {
    width: calc(100vw - 20px);
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    padding: 8px;
  }

}

@media (max-width: 420px) {
  .login-card {
    padding: 24px;
  }

  .conversation-card {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 10px;
    padding-inline: 12px;
  }

  .conversation-avatar {
    width: 54px;
    height: 54px;
  }

  .quick-actions {
    padding-inline: 10px;
  }

  .quick-action {
    font-size: 12px;
  }

  .profile-button {
    gap: 9px;
  }

  .chat-actions .icon-button {
    width: 32px;
    height: 34px;
    flex-basis: 32px;
  }

  .chat-actions .icon-button svg {
    width: 18px;
    height: 18px;
  }

  .chat-avatar {
    width: 38px;
    height: 38px;
  }

  .profile-button strong {
    font-size: 15px;
  }

  .profile-button small {
    display: none;
  }

  .chat-date-panel .chat-date-field span {
    font-size: 20px;
  }

  .chat-date-monthbar {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
  }

  .chat-date-month-select {
    font-size: 22px;
  }

  .chat-date-month-button {
    width: 42px;
    height: 42px;
  }

  .chat-date-weekdays span {
    font-size: 12px;
  }

  .chat-date-days {
    gap: 6px;
  }

  .chat-date-day {
    min-height: 40px;
  }

  .chat-date-day span {
    font-size: 18px;
  }

  .bubble {
    max-width: 88%;
  }

  .message-text {
    font-size: 14px;
  }

  .tool-section {
    padding: 12px;
  }

  .details-avatar {
    width: 92px;
    height: 92px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .stats-grid div {
    padding: 16px 6px 14px;
  }

  .stats-grid strong {
    font-size: clamp(16px, 5vw, 22px);
  }

  .stats-grid span {
    font-size: 12px;
  }

  .profile-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }

  .profile-actions button {
    height: 42px;
    gap: 3px;
    padding: 0 3px;
  }

  .profile-actions svg {
    width: 16px;
    height: 16px;
  }

  .profile-actions span {
    font-size: 12px;
  }
}
