:root {
  --bg: #f3f0ea;
  --bg-accent: #f3f0ea;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --panel-2: #efeae2;
  --border: #e7e9ee;
  --border-soft: #e2e5ea;
  --text: #111827;
  --muted: #6b7280;
  --primary: #00a884;
  --primary-contrast: #ffffff;
  --bubble-in: #144d37;
  --bubble-out: transparent;
  --danger: #6b7280;
  --success: #00a884;
  --shadow-soft: 0 10px 28px rgba(17, 24, 39, 0.05);
  --shadow-card: 0 10px 24px rgba(17, 24, 39, 0.05);
  --overlay: rgba(8, 15, 25, 0.78);
  --icon-bg: rgba(255, 255, 255, 0.72);
  --icon-border: rgba(214, 221, 232, 0.9);
  --input-bg: #ffffff;
  --input-text: #111827;
  --input-placeholder: #6b7280;
  --composer-height: 132px;
  --font-scale: 1;
}

:root.font-scale-0 {
  --font-scale: 0.9;
}

:root.font-scale-1 {
  --font-scale: 0.96;
}

:root.font-scale-2 {
  --font-scale: 1;
}

:root.font-scale-3 {
  --font-scale: 1.08;
}

:root.font-scale-4 {
  --font-scale: 1.16;
}

:root.font-scale-5 {
  --font-scale: 1.28;
}

:root.font-scale-6 {
  --font-scale: 1.4;
}

:root[data-theme="dark"] {
  --bg: #0b141a;
  --bg-accent: #0b141a;
  --panel: rgba(20, 25, 31, 0.94);
  --panel-strong: #171d24;
  --panel-2: #0b141a;
  --border: rgba(68, 79, 93, 0.54);
  --border-soft: rgba(60, 70, 83, 0.74);
  --text: #edf2f7;
  --muted: #99a6b8;
  --primary: #00a884;
  --primary-contrast: #ffffff;
  --bubble-in: #144d37;
  --bubble-out: transparent;
  --danger: #9ca3af;
  --success: #00a884;
  --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.32);
  --overlay: rgba(0, 0, 0, 0.84);
  --icon-bg: rgba(28, 37, 48, 0.92);
  --icon-border: rgba(62, 76, 95, 0.72);
  --input-bg: #202c33;
  --input-text: #e9edef;
  --input-placeholder: #8696a0;
}

:root.design-theme-whatsapp-dark {
  --bg: #0b141a;
  --bg-accent: #0b141a;
  --panel: rgba(17, 27, 33, 0.96);
  --panel-strong: #111b21;
  --panel-2: #0b141a;
  --border: rgba(68, 79, 93, 0.54);
  --border-soft: rgba(60, 70, 83, 0.74);
  --text: #e9edef;
  --muted: #8696a0;
  --primary: #00a884;
  --primary-contrast: #ffffff;
  --bubble-in: #144d37;
  --bubble-out: transparent;
  --success: #00a884;
  --icon-bg: #202c33;
  --icon-border: rgba(62, 76, 95, 0.72);
  --input-bg: #202c33;
  --input-text: #e9edef;
  --input-placeholder: #8696a0;
}

:root.design-theme-messenger-blue {
  --bg: #061426;
  --bg-accent: #061426;
  --panel: rgba(7, 20, 38, 0.96);
  --panel-strong: #091a31;
  --panel-2: #061426;
  --border: rgba(82, 118, 168, 0.44);
  --border-soft: rgba(82, 118, 168, 0.34);
  --text: #f4f8ff;
  --muted: #8f9db3;
  --primary: #2f7dff;
  --primary-contrast: #ffffff;
  --bubble-in: #1e5dcc;
  --bubble-out: transparent;
  --success: #2f7dff;
  --icon-bg: rgba(20, 39, 68, 0.94);
  --icon-border: rgba(93, 129, 184, 0.52);
  --input-bg: #16253a;
  --input-text: #f4f8ff;
  --input-placeholder: #8f9db3;
}

:root.design-theme-messenger-blue .msg.left .bubble,
:root.design-theme-messenger-blue[data-theme="dark"] .msg.left .bubble {
  background: linear-gradient(135deg, #2f7dff 0%, #1e5dcc 52%, #174aa8 100%);
  color: #ffffff;
}

:root.design-theme-blue-gold {
  --bg: #020408;
  --bg-accent: #020408;
  --panel: rgba(4, 8, 14, 0.96);
  --panel-strong: #05090f;
  --panel-2: #020408;
  --border: rgba(62, 82, 112, 0.46);
  --border-soft: rgba(62, 82, 112, 0.34);
  --text: #f5f8ff;
  --muted: #9aa6b8;
  --primary: #1e90ff;
  --primary-contrast: #ffffff;
  --accent-gold: #ffd400;
  --accent-gold-contrast: #05090f;
  --bubble-in: #041a34;
  --bubble-out: transparent;
  --success: #1e90ff;
  --icon-bg: rgba(8, 12, 20, 0.94);
  --icon-border: rgba(82, 101, 132, 0.54);
  --input-bg: #070b12;
  --input-text: #f5f8ff;
  --input-placeholder: #9aa6b8;
}

:root.design-theme-blue-gold .msg.left .bubble,
:root.design-theme-blue-gold[data-theme="dark"] .msg.left .bubble {
  background: linear-gradient(135deg, #071c38 0%, #062a58 100%);
  border: 1px solid rgba(30, 144, 255, 0.62);
  box-shadow: inset 4px 0 0 #1e90ff;
  color: #ffffff;
}

:root.design-theme-blue-gold .manager-reply-divider {
  color: var(--accent-gold);
}

:root.design-theme-blue-gold .manager-reply-divider::before,
:root.design-theme-blue-gold .manager-reply-divider::after {
  background: var(--accent-gold);
}

:root.design-theme-blue-gold .composer-plus-button {
  background: var(--accent-gold);
  color: var(--accent-gold-contrast);
  border-color: transparent;
}

:root.design-theme-blue-gold .composer-plus-button.active,
:root.design-theme-blue-gold .composer-actions-menu-button.active {
  background: rgba(255, 212, 0, 0.16);
  color: var(--accent-gold);
}

:root.design-theme-blue-gold .scroll-bottom-button {
  background: var(--accent-gold);
  color: var(--accent-gold-contrast);
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(255, 212, 0, 0.22);
}

:root.design-theme-graphite {
  --bg: #111111;
  --bg-accent: #111111;
  --panel: rgba(26, 26, 26, 0.96);
  --panel-strong: #1f1f1f;
  --panel-2: #111111;
  --border: rgba(92, 92, 92, 0.45);
  --border-soft: rgba(82, 82, 82, 0.38);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --primary: #71717a;
  --primary-contrast: #ffffff;
  --bubble-in: #2f3437;
  --bubble-out: transparent;
  --success: #a1a1aa;
  --icon-bg: rgba(38, 38, 38, 0.94);
  --icon-border: rgba(97, 97, 97, 0.62);
  --input-bg: #262626;
  --input-text: #f4f4f5;
  --input-placeholder: #a1a1aa;
}

:root.design-theme-graphite .msg.left .bubble,
:root.design-theme-graphite[data-theme="dark"] .msg.left .bubble {
  background: var(--bubble-in);
  color: #ffffff;
}

:root.design-theme-pure-dark {
  --bg: #050505;
  --bg-accent: #050505;
  --panel: rgba(12, 12, 12, 0.96);
  --panel-strong: #0d0d0d;
  --panel-2: #050505;
  --border: rgba(70, 70, 70, 0.42);
  --border-soft: rgba(58, 58, 58, 0.38);
  --text: #f2f2f2;
  --muted: #8b949e;
  --primary: #8b949e;
  --primary-contrast: #ffffff;
  --bubble-in: #1f2933;
  --bubble-out: transparent;
  --success: #8b949e;
  --icon-bg: rgba(20, 20, 20, 0.96);
  --icon-border: rgba(82, 82, 82, 0.58);
  --input-bg: #151515;
  --input-text: #f2f2f2;
  --input-placeholder: #8b949e;
}

:root.design-theme-pure-dark .msg.left .bubble,
:root.design-theme-pure-dark[data-theme="dark"] .msg.left .bubble {
  background: var(--bubble-in);
  color: #ffffff;
}

:root.design-theme-mono {
  --bg: #181818;
  --bg-accent: #181818;
  --panel: rgba(32, 32, 32, 0.96);
  --panel-strong: #202020;
  --panel-2: #181818;
  --border: rgba(110, 110, 110, 0.42);
  --border-soft: rgba(95, 95, 95, 0.36);
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --primary: #737373;
  --primary-contrast: #ffffff;
  --bubble-in: #2a2a2a;
  --bubble-out: transparent;
  --success: #a3a3a3;
  --icon-bg: rgba(45, 45, 45, 0.94);
  --icon-border: rgba(115, 115, 115, 0.58);
  --input-bg: #262626;
  --input-text: #f5f5f5;
  --input-placeholder: #a3a3a3;
}

:root.design-theme-mono .msg.left .bubble,
:root.design-theme-mono[data-theme="dark"] .msg.left .bubble {
  background: var(--bubble-in);
  color: #ffffff;
}

:root.design-theme-minimal-light {
  --bg: #f7f8fa;
  --bg-accent: #f7f8fa;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --panel-2: #f7f8fa;
  --border: #e2e8f0;
  --border-soft: #e5e7eb;
  --text: #111827;
  --muted: #64748b;
  --primary: #00a884;
  --primary-contrast: #ffffff;
  --bubble-in: #d9fdd3;
  --bubble-out: transparent;
  --success: #00a884;
  --icon-bg: rgba(255, 255, 255, 0.9);
  --icon-border: rgba(203, 213, 225, 0.9);
  --input-bg: #ffffff;
  --input-text: #111827;
  --input-placeholder: #64748b;
}

:root.design-theme-minimal-light .msg.left .bubble,
:root.design-theme-minimal-light[data-theme="dark"] .msg.left .bubble {
  background: var(--bubble-in);
  color: #111827;
}

:root.design-theme-whatsapp-dark,
:root.design-theme-messenger-blue,
:root.design-theme-blue-gold,
:root.design-theme-graphite,
:root.design-theme-pure-dark,
:root.design-theme-mono {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  color-scheme: light dark;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg-accent);
  color: var(--text);
  backdrop-filter: saturate(1.1);
}

body.modal-open {
  overflow: hidden;
}

.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px;
  min-height: 100vh;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.auth-card {
  max-width: 430px;
  margin: 48px auto;
  padding: 18px;
}

.cover-card {
  --cover-blue: #0072ff;
  --cover-blue-deep: #004bd8;
  --cover-yellow: #ffe100;
  --cover-black: #000205;
  min-height: calc(100vh - 36px);
  height: calc(100vh - 36px);
  display: grid;
  align-content: start;
  gap: 12px;
  max-width: 448px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
  color: #ffffff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cover-card::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 24%, rgba(0, 114, 255, 0.2), transparent 32%),
    radial-gradient(circle at 84% 48%, rgba(255, 225, 0, 0.18), transparent 30%),
    linear-gradient(180deg, #000000 0%, #010101 42%, #000000 100%);
}

.password-generator {
  display: grid;
  gap: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.password-generator-header {
  display: grid;
  gap: 6px;
  justify-items: center;
  margin: 2px 0 4px;
  text-align: center;
}

.password-generator-title-image {
  width: 100%;
  max-width: 390px;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(0, 114, 255, 0.12));
}

.password-generator-subtitle {
  margin-top: 0;
  color: #bcc9dc;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 650;
  line-height: 1.4;
}

.generated-password-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.generated-password-field {
  position: relative;
}

.generated-password-box input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0;
  width: 100%;
  min-height: 72px;
  padding: 0 66px 0 20px;
  border: 1px solid rgba(0, 114, 255, 0.88);
  border-right-color: rgba(255, 225, 0, 0.7);
  border-radius: 16px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(0, 114, 255, 0.12), rgba(255, 225, 0, 0.04)),
    rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 0 26px rgba(0, 114, 255, 0.08),
    0 0 24px rgba(0, 114, 255, 0.12);
  font-size: clamp(17px, 4.5vw, 20px);
}

.generated-password-copy-button {
  position: absolute;
  top: 50%;
  right: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.34);
  cursor: pointer;
}

.generated-password-copy-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}

.password-strength {
  display: grid;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid rgba(86, 107, 136, 0.62);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 0 18px rgba(0, 114, 255, 0.04);
}

.password-strength-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(13px, 3.4vw, 15px);
  font-weight: 750;
}

.password-strength-top strong {
  color: var(--cover-yellow);
  font-weight: 900;
}

.password-strength-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(86, 107, 136, 0.32);
}

.password-strength-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.password-strength[data-level="weak"] .password-strength-track span {
  background: #ff4d4d;
  box-shadow: 0 0 14px rgba(255, 77, 77, 0.38);
}

.password-strength[data-level="medium"] .password-strength-track span {
  background: #ffb020;
  box-shadow: 0 0 14px rgba(255, 176, 32, 0.38);
}

.password-strength[data-level="strong"] .password-strength-track span {
  background: linear-gradient(90deg, var(--cover-blue), var(--cover-yellow));
  box-shadow: 0 0 14px rgba(0, 114, 255, 0.34);
}

.password-strength[data-level="excellent"] .password-strength-track span {
  background: linear-gradient(90deg, var(--cover-blue), #30d158, var(--cover-yellow));
  box-shadow: 0 0 16px rgba(48, 209, 88, 0.34);
}

.cover-generate-button {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  align-items: center;
  border: 2px solid var(--cover-blue);
  border-right-color: var(--cover-yellow);
  border-radius: 16px;
  color: var(--cover-yellow);
  background: rgba(0, 0, 0, 0.38);
  box-shadow:
    inset 0 0 22px rgba(0, 114, 255, 0.08),
    0 0 28px rgba(0, 114, 255, 0.16);
  padding: 0;
}

.generator-controls {
  display: grid;
  gap: 10px;
  margin: 0;
}

.generator-preset {
  display: grid;
  gap: 9px;
  padding: 13px 20px;
  border: 1px solid rgba(0, 114, 255, 0.74);
  border-right-color: rgba(255, 225, 0, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(0, 114, 255, 0.1), rgba(255, 225, 0, 0.04)),
    rgba(0, 0, 0, 0.42);
  color: #ffffff;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 800;
}

.generator-preset select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(86, 107, 136, 0.82);
  border-radius: 12px;
  color: #ffffff;
  background: #03070d;
  font: inherit;
  outline: none;
}

.generator-preset select:focus {
  border-color: var(--cover-yellow);
  box-shadow: 0 0 0 3px rgba(255, 225, 0, 0.14);
}

.generator-length,
.generator-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border: 1px solid rgba(86, 107, 136, 0.82);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;
  font-size: clamp(17px, 4.2vw, 20px);
  font-weight: 720;
  box-shadow: inset 0 0 26px rgba(0, 114, 255, 0.04);
}

.generator-length {
  grid-template-columns: 1fr;
  gap: 14px;
}

.generator-length-title strong {
  color: var(--cover-blue);
}

.generator-range-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  color: var(--cover-yellow);
  font-weight: 850;
}

.generator-range-row span:first-child {
  color: var(--cover-blue);
}

.generator-length input[type="range"] {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(90deg, var(--cover-blue), var(--cover-yellow));
}

.generator-length input[type="range"]::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(135deg, var(--cover-blue), var(--cover-yellow));
  box-shadow: 0 0 20px rgba(0, 114, 255, 0.45);
}

.generator-length input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cover-blue), var(--cover-yellow));
  box-shadow: 0 0 20px rgba(0, 114, 255, 0.45);
}

.generator-option input {
  width: 40px;
  height: 40px;
  accent-color: var(--primary);
}

.generator-option input[type="checkbox"] {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cover-blue), var(--cover-blue-deep));
  box-shadow: 0 0 22px rgba(0, 114, 255, 0.42);
}

.generator-option input[type="checkbox"]::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 30px;
  font-weight: 900;
}

.generator-option input[type="checkbox"]:not(:checked) {
  background: rgba(86, 107, 136, 0.28);
  box-shadow: none;
}

.generator-option input[type="checkbox"]:not(:checked)::after {
  content: '';
}

#passwordSymbols {
  background: linear-gradient(135deg, var(--cover-yellow), #d4b800);
  box-shadow: 0 0 22px rgba(255, 225, 0, 0.36);
}

.generator-option strong {
  color: var(--cover-yellow);
  font-size: clamp(32px, 7vw, 42px);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

#passwordNumbers ~ strong {
  color: var(--cover-blue);
}

#passwordNoSimilar ~ strong {
  color: #ffffff;
  font-size: clamp(18px, 4.8vw, 24px);
  font-weight: 850;
}

#passwordSpeakable ~ strong {
  color: var(--cover-blue);
  font-size: clamp(18px, 4.8vw, 24px);
  font-weight: 900;
}

.cover-generate-button {
  min-height: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.cover-generate-button img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(255, 225, 0, 0.18));
}

.cover-ad-banner {
  width: min(188px, calc(100% - 120px));
  aspect-ratio: 347 / 229;
  min-height: 0;
  display: block;
  justify-self: center;
  margin-top: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.cover-ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 12px 24px rgba(0, 114, 255, 0.16));
}

.generated-password-copy-button.copied::after {
  content: 'Скопійовано';
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  place-items: center;
  min-width: 112px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 225, 0, 0.42);
  border-radius: 12px;
  color: var(--cover-yellow);
  background: rgba(0, 0, 0, 0.82);
  font-size: 13px;
  font-weight: 850;
  z-index: 3;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.auth-content {
  padding: 8px 8px 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  height: calc(100vh - 36px);
  min-height: calc(100vh - 36px);
}

.sidebar,
.chat-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  position: relative;
  background: var(--panel-2);
  border: 0;
  border-radius: 0;
}

.sidebar-header,
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-header {
  background: var(--panel-strong);
}

.chat-search {
  padding: 10px 12px 4px;
  background: var(--panel-strong);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.chat-search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 16px;
  outline: none;
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
}

.chat-search-clear {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 3px;
  cursor: pointer;
}

:root[data-theme="dark"] .chat-search input {
  background: var(--input-bg);
}

:root[data-theme="dark"] .chat-search-clear {
  background: var(--input-bg);
}

.chat-search input:focus {
  border-color: var(--primary);
}

.chat-search-clear:active {
  transform: scale(0.96);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-panel-header {
  justify-content: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.chat-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-assistant-button {
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
}

.chat-list {
  overflow-y: auto;
  padding: 10px;
  min-height: 0;
}

.chat-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

:root[data-theme="dark"] .chat-item {
  background: rgba(255, 255, 255, 0.03);
}

:root.design-theme-whatsapp-dark .chat-item,
:root.design-theme-messenger-blue .chat-item,
:root.design-theme-blue-gold .chat-item,
:root.design-theme-graphite .chat-item,
:root.design-theme-pure-dark .chat-item,
:root.design-theme-mono .chat-item {
  background: rgba(255, 255, 255, 0.03);
}

.chat-item:active {
  transform: scale(0.99);
}

.chat-item.active {
  background: rgba(10, 132, 255, 0.14);
  border-color: rgba(10, 132, 255, 0.22);
}

:root[data-theme="dark"] .chat-item.active {
  background: rgba(90, 200, 250, 0.15);
  border-color: rgba(90, 200, 250, 0.24);
}

:root.design-theme-whatsapp-dark .chat-item.active,
:root.design-theme-messenger-blue .chat-item.active,
:root.design-theme-graphite .chat-item.active {
  background: rgba(0, 168, 132, 0.16);
  border-color: rgba(0, 168, 132, 0.28);
}

:root.design-theme-blue-gold .chat-item.active {
  background: rgba(30, 144, 255, 0.14);
  border-color: rgba(255, 212, 0, 0.34);
}

:root.design-theme-pure-dark .chat-item.active {
  background: rgba(139, 148, 158, 0.16);
  border-color: rgba(139, 148, 158, 0.28);
}

:root.design-theme-mono .chat-item.active {
  background: rgba(115, 115, 115, 0.16);
  border-color: rgba(115, 115, 115, 0.28);
}

.chat-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.chat-item-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.chat-item-search-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.chat-item-search-snippet {
  margin-top: 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.chat-item-search-label {
  color: var(--primary);
  font-weight: 700;
}

.unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--text);
  color: var(--panel-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: none;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px calc(var(--composer-height) + 24px);
  background: var(--panel-2);
  -webkit-overflow-scrolling: touch;
}

.msg {
  max-width: min(78%, 540px);
  margin-bottom: 8px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.msg *,
.message-context-menu,
.message-context-menu * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.manager-reply-divider {
  width: min(72%, 460px);
  margin: 8px auto 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 700;
  text-align: center;
}

.manager-reply-divider::before,
.manager-reply-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border-soft);
}

.msg.left {
  margin-right: auto;
}

.msg.right {
  margin-left: auto;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
  padding: 0 8px;
  word-break: break-word;
}

.bubble {
  position: relative;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.45;
  background: var(--bubble-in);
  border: 0;
  box-shadow: none;
  word-break: break-word;
}

.msg.right .bubble {
  background: var(--bubble-out);
  border-top-right-radius: 2px;
}

.msg.left .bubble {
  border-top-left-radius: 2px;
  color: #ffffff;
}

:root[data-theme="dark"] .msg.left .bubble {
  color: #ffffff;
}

:root[data-theme="dark"] .msg.right .bubble {
  color: var(--text);
}

:root.design-theme-minimal-light .msg.left .bubble,
:root.design-theme-minimal-light[data-theme="dark"] .msg.left .bubble {
  color: #111827;
}

.bubble-text {
  white-space: pre-wrap;
}

.msg.search-highlight .bubble,
.service-message.search-highlight {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  animation: search-highlight-pulse 2.4s ease;
}

@keyframes search-highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 168, 132, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 168, 132, 0);
  }
  100% {
    box-shadow: none;
  }
}

.client-seen-indicator {
  margin-top: 3px;
  color: #00a884;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: right;
  user-select: none;
}

.stored-reaction-indicator {
  width: fit-content;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  user-select: none;
}

.bookmark-indicator {
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.message-markers-row {
  width: 100%;
  margin-top: 4px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bookmark-filter-button.active {
  background: rgba(0, 168, 132, 0.16);
  color: var(--primary);
  border-color: rgba(0, 168, 132, 0.28);
}

.message-reply-quote {
  margin-bottom: 8px;
  padding: 7px 9px 7px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  line-height: 1.35;
  white-space: pre-wrap;
}

.bubble-text a,
.message-reply-quote a,
.service-message-text a {
  color: var(--primary);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

:root[data-theme="dark"] .bubble-text a,
:root[data-theme="dark"] .message-reply-quote a,
:root[data-theme="dark"] .service-message-text a {
  color: #8bdfff;
}

.attachment {
  margin-top: 10px;
}

.image-preview-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  width: 100%;
  text-align: left;
}

.chat-image {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.chat-video {
  display: block;
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  background: #000;
}

.chat-audio {
  display: block;
  width: 100%;
  max-width: 320px;
}

.file-box {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
}

:root[data-theme="dark"] .file-box {
  background: rgba(255, 255, 255, 0.03);
}

.file-name {
  font-weight: 600;
  margin-bottom: 8px;
  word-break: break-word;
}

.attachment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

:root[data-theme="dark"] .attachment-link {
  background: rgba(90, 200, 250, 0.14);
  color: #8bdfff;
}

.swipe-delete-container {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  margin-bottom: 14px;
  background: transparent;
}

.swipe-delete-background {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 18px;
  background: transparent;
  pointer-events: none;
}

.swipe-delete-background-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.swipe-surface {
  position: relative;
  z-index: 1;
  transform: translateX(0);
  will-change: transform;
  touch-action: pan-y;
}

.swipe-delete-ready .swipe-delete-background {
  background: rgba(107, 114, 128, 0.22);
}

.swipe-delete-ready .swipe-delete-background-icon {
  opacity: 1;
  transform: scale(1);
}

.service-message {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 178px 12px 14px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

.service-message-links {
  background: transparent;
  border-color: var(--border-soft);
}

.service-message-payment {
  background: transparent;
  border-color: var(--border-soft);
}

.service-message-system {
  background: transparent;
  border-color: var(--border-soft);
}

:root[data-theme="dark"] .service-message-links {
  background: transparent;
  border-color: var(--border-soft);
  box-shadow: none;
}

:root[data-theme="dark"] .service-message-payment {
  background: transparent;
  border-color: var(--border-soft);
  box-shadow: none;
}

:root[data-theme="dark"] .service-message-system {
  background: transparent;
  border-color: var(--border-soft);
  box-shadow: none;
}

.service-message-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-message-icon-links {
  background: var(--panel-2);
  color: var(--muted);
}

.service-message-icon-payment {
  background: var(--panel-2);
  color: var(--muted);
}

.service-message-icon-system {
  background: var(--panel-2);
  color: var(--muted);
}

:root[data-theme="dark"] .service-message-icon-links {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

:root[data-theme="dark"] .service-message-icon-payment {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

:root[data-theme="dark"] .service-message-icon-system {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.service-message-content {
  min-width: 0;
}

.command-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.command-badge-links {
  background: var(--panel-2);
  color: var(--muted);
}

.command-badge-payment {
  background: var(--panel-2);
  color: var(--muted);
}

.command-badge-system {
  background: var(--panel-2);
  color: var(--muted);
}

:root[data-theme="dark"] .command-badge-links {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

:root[data-theme="dark"] .command-badge-payment {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

:root[data-theme="dark"] .command-badge-system {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.service-message-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}

.service-message-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.service-message-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.88;
}

.message-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 20;
}

.message-reactions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.message-reaction-button {
  width: 30px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.message-reaction-button:hover {
  transform: scale(1.04);
}

.message-reaction-button.active {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-contrast);
  box-shadow: 0 10px 20px rgba(10, 132, 255, 0.22);
}

.message-reaction-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.attached-message-reaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 32px;
  height: 26px;
  margin-top: 8px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  font-size: calc(16px * var(--font-scale));
  line-height: 1;
}

.message-action-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s ease, background 0.14s ease;
}

.message-quote-button {
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.message-delete-button {
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  color: var(--muted);
  box-shadow: none;
}

.message-action-button .icon-svg {
  width: 16px;
  height: 16px;
}

.message-action-button:hover {
  transform: scale(1.04);
}

.message-delete-button:hover {
  background: var(--panel-2);
  color: var(--text);
}

:root[data-theme="dark"] .message-delete-button {
  background: var(--icon-bg);
  color: var(--muted);
  border-color: var(--icon-border);
}

.message-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.message-context-reactions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.message-context-reaction {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel-2);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.message-context-reaction.active {
  background: var(--primary);
  border-color: transparent;
}

.message-context-menu-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: calc(14px * var(--font-scale));
  text-align: left;
}

.message-context-menu-button:hover {
  background: var(--panel-2);
}

.message-context-menu-button.danger {
  color: #dc2626;
}

.message-context-menu-button .icon-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.message-form {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft);
  background: var(--panel-strong);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
}

.reply-preview {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: rgba(18, 140, 126, 0.08);
}

.edit-preview {
  border-left-color: var(--muted);
}

.edit-preview .reply-preview-label {
  color: var(--muted);
}

.reply-preview-content {
  min-width: 0;
  flex: 1;
}

.reply-preview-label {
  color: var(--primary);
  font-size: calc(12px * var(--font-scale));
  font-weight: 800;
  margin-bottom: 2px;
}

.reply-preview-text {
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  line-height: 1.3;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.reply-preview-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

.file-preview {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.file-preview.file-preview-multiple {
  grid-template-columns: minmax(0, 1fr) 30px;
}

.file-preview.file-preview-multiple .file-preview-details {
  grid-column: 1 / -1;
  grid-row: 2;
}

.file-preview.file-preview-multiple .file-preview-remove {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.text-improve-panel {
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

.text-improve-panel.hidden {
  display: none;
}

.text-improve-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: calc(13px * var(--font-scale));
  font-weight: 800;
}

.text-improve-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.text-improve-action {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--icon-border);
  border-radius: 999px;
  background: var(--icon-bg);
  color: var(--text);
  font-size: calc(13px * var(--font-scale));
  font-weight: 700;
}

.text-improve-action:disabled {
  opacity: 0.65;
  cursor: wait;
}

.text-improve-status {
  min-height: 16px;
  margin-top: 6px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.file-preview-media {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 140, 126, 0.08);
  color: var(--primary);
  font-size: calc(11px * var(--font-scale));
  font-weight: 800;
  text-transform: uppercase;
}

.file-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  min-width: 0;
}

.file-preview-thumb {
  position: relative;
  aspect-ratio: 1;
  min-height: 58px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(18, 140, 126, 0.08);
  cursor: pointer;
  padding: 0;
}

.file-preview-thumb::after {
  content: '×';
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.file-preview-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.file-preview-more {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px dashed var(--border-soft);
  border-radius: 10px;
  color: var(--muted);
  font-size: calc(14px * var(--font-scale));
  font-weight: 800;
}

.file-preview-audio {
  text-transform: none;
}

.file-preview-audio-player {
  width: 100%;
  height: 34px;
  margin-top: 6px;
}

.file-preview-details {
  min-width: 0;
}

.file-preview-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 700;
}

.file-preview-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.file-preview-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

.scroll-bottom-button {
  position: absolute;
  right: 22px;
  bottom: calc(var(--composer-height) + 20px);
  z-index: 35;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  background: var(--primary);
  color: var(--primary-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 14px 30px rgba(10, 132, 255, 0.28);
}

.scroll-bottom-button.hidden {
  display: none;
}

.scroll-bottom-button .icon-svg {
  width: 22px;
  height: 22px;
}

.templates-dropdown {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 10px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  max-height: min(62vh, 560px);
  overflow: hidden;
  z-index: 40;
}

.templates-dropdown.hidden {
  display: none;
}

.templates-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.templates-dropdown-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.template-plus-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  background: rgba(10, 132, 255, 0.14);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

:root[data-theme="dark"] .template-plus-button {
  background: rgba(90, 200, 250, 0.14);
  color: #8bdfff;
  border-color: rgba(90, 200, 250, 0.18);
}

.template-plus-button .icon-svg {
  width: 18px;
  height: 18px;
}

.templates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.templates-empty-state {
  padding: 12px 6px;
}

.template-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--input-bg);
  color: var(--input-text);
}

.template-item-main {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  background: transparent;
  color: inherit;
}

.template-item-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.template-item-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.template-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.template-icon-button-danger {
  color: var(--muted);
  background: var(--icon-bg);
  border-color: var(--icon-border);
}

:root[data-theme="dark"] .template-icon-button-danger {
  background: var(--icon-bg);
  border-color: var(--icon-border);
}

.template-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.template-modal.hidden,
.settings-modal.hidden {
  display: none;
}

.template-modal-backdrop,
.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 25, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.template-modal-card,
.settings-modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 560px);
  max-height: 86vh;
  margin: 8vh auto 0;
  padding: 18px;
  border-radius: 28px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  overflow-y: auto;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.ai-modal {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: grid;
  place-items: center;
  padding: 18px;
}

.ai-modal.hidden {
  display: none;
}

.ai-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 15, 25, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ai-modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 720px);
  max-height: min(760px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.credentials-modal {
  position: fixed;
  inset: 0;
  z-index: 2350;
  display: grid;
  place-items: center;
  padding: 18px;
}

.credentials-modal.hidden {
  display: none;
}

.credentials-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 15, 25, 0.62);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.credentials-modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 760px);
  max-height: min(780px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(120px, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.credentials-modal-header,
.credential-item-top,
.credential-row,
.credential-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.credentials-modal-header {
  justify-content: space-between;
}

.credentials-modal-title {
  font-size: calc(20px * var(--font-scale));
  font-weight: 900;
}

.credentials-modal-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 800;
}

.credentials-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.credentials-toolbar input,
.credential-form input,
.credential-form textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 12px 14px;
  font-size: calc(15px * var(--font-scale));
  outline: none;
}

.credentials-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.credential-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: color-mix(in srgb, var(--input-bg) 88%, transparent);
}

.credential-item-top {
  justify-content: space-between;
}

.credential-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.credential-title {
  color: var(--text);
  font-size: calc(16px * var(--font-scale));
  font-weight: 900;
}

.credential-url {
  color: var(--primary);
  font-size: calc(12px * var(--font-scale));
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credential-row {
  justify-content: space-between;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  font-weight: 750;
}

.credential-notes {
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  line-height: 1.35;
  white-space: pre-wrap;
}

.credential-actions {
  display: flex;
  justify-content: flex-end;
}

.credential-small-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: calc(12px * var(--font-scale));
  white-space: nowrap;
}

.credential-delete-button {
  color: #ff453a;
}

.credential-form {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.credential-form.hidden {
  display: none;
}

.credential-form-title {
  color: var(--text);
  font-size: calc(16px * var(--font-scale));
  font-weight: 900;
}

.credential-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 850;
}

.credential-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.credential-form-actions {
  justify-content: flex-end;
}

.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-modal-title {
  font-size: 20px;
  font-weight: 850;
}

.ai-modal-subtitle,
.ai-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ai-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--panel-2);
}

.ai-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel-2);
}

.ai-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  font-weight: 850;
  cursor: pointer;
}

.ai-tab.active {
  background: var(--primary);
  color: var(--primary-contrast);
}

.ai-panel {
  display: grid;
  min-height: 0;
  gap: 12px;
}

.ai-panel-text {
  grid-template-rows: minmax(160px, 1fr) auto;
}

.ai-panel-image {
  grid-template-rows: auto minmax(0, 1fr);
  overflow-y: auto;
  padding-right: 2px;
}

.ai-empty {
  margin: auto;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.ai-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.45;
  transition: transform 160ms ease, opacity 160ms ease;
  touch-action: pan-y;
  position: relative;
}

.ai-message.swiping-delete {
  opacity: 0.72;
}

.ai-message.swiping-delete::after {
  content: 'Видалити';
  position: absolute;
  top: 50%;
  right: -92px;
  transform: translateY(-50%);
  color: #ff453a;
  font-size: 12px;
  font-weight: 850;
}

.ai-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.ai-message-user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-contrast);
}

.ai-message-assistant {
  align-self: flex-start;
  border: 1px solid var(--border-soft);
  background: var(--input-bg);
  color: var(--input-text);
}

.ai-copy-button {
  margin-top: 8px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-copy-button:active {
  transform: scale(0.96);
}

.ai-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-favorites {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
}

.ai-favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 900;
}

.ai-favorites-header span {
  min-width: 0;
}

.ai-favorites-toggle {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--icon-bg);
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 850;
}

.ai-favorites-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.ai-archive-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
}

.ai-archive-category-select,
.ai-archive-item-category {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 0 12px;
  font-size: calc(13px * var(--font-scale));
  font-weight: 800;
  outline: none;
}

.ai-archive-tool-button {
  min-width: 42px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: calc(12px * var(--font-scale));
}

.ai-archive-empty {
  padding: 12px;
  border: 1px dashed var(--border-soft);
  border-radius: 14px;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  line-height: 1.35;
}

.ai-favorite-item {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: color-mix(in srgb, var(--input-bg) 88%, transparent);
}

.ai-favorite-item.editing {
  border-color: color-mix(in srgb, var(--primary) 64%, var(--border-soft));
}

.ai-favorite-body {
  min-width: 0;
}

.ai-favorite-preview {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--input-text);
  padding: 0;
  font-size: calc(14px * var(--font-scale));
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-favorite-edit {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: calc(15px * var(--font-scale));
  line-height: 1.4;
  outline: none;
}

.ai-favorite-body {
  display: grid;
  gap: 8px;
}

.ai-favorite-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ai-favorite-actions .template-secondary-button {
  min-height: 36px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: calc(12px * var(--font-scale));
}

.ai-favorite-delete {
  color: #ff453a;
}

.ai-form {
  display: grid;
  gap: 10px;
}

.ai-form textarea,
.ai-image-form textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 12px;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 16px;
  outline: none;
}

.ai-form textarea:focus,
.ai-image-form textarea:focus {
  border-color: var(--primary);
}

.ai-quick-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-quick-actions select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 0 12px;
  font-size: 16px;
  font-weight: 800;
  outline: none;
}

.ai-quick-actions .template-secondary-button {
  min-height: 42px;
  padding-inline: 18px;
}

.ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ai-image-form {
  display: grid;
  gap: 10px;
}

.ai-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ai-source-image {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--panel-2);
}

.ai-source-image input[type="file"] {
  display: none;
}

.ai-source-buttons,
.ai-source-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-source-upload-button {
  min-height: 42px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--icon-bg);
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 850;
}

.ai-source-upload-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ai-source-prompt-button {
  color: var(--accent);
}

.ai-source-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--input-bg);
}

.ai-source-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.ai-source-preview img {
  width: 100%;
  max-height: 180px;
  display: block;
  object-fit: contain;
}

.ai-source-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.ai-source-hint {
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 700;
}

.ai-image-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  font-weight: 800;
}

.ai-image-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 0 12px;
  font-size: 16px;
  outline: none;
}

.ai-image-preview {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.ai-image-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--panel-2);
  cursor: zoom-in;
}

.ai-image-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ai-image-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.delete-message-dialog {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 18px;
}

.delete-message-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(8, 15, 25, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: default;
}

.delete-message-dialog-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 440px);
  padding: 18px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
}

.dictation-draft-modal {
  position: fixed;
  inset: 0;
  z-index: 2450;
  display: grid;
  place-items: end center;
  padding: 18px;
}

.dictation-draft-modal.hidden {
  display: none;
}

.dictation-draft-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(8, 15, 25, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dictation-draft-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 520px);
  padding: 16px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.dictation-draft-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: calc(17px * var(--font-scale));
  font-weight: 800;
}

.dictation-draft-text {
  width: 100%;
  min-height: 126px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--input-bg);
  color: var(--input-text);
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}

.dictation-draft-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dictation-draft-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  line-height: 1.4;
}

.delete-message-dialog-title {
  font-weight: 800;
  font-size: calc(18px * var(--font-scale));
  margin-bottom: 8px;
}

.delete-message-dialog-text {
  color: var(--muted);
  font-size: calc(14px * var(--font-scale));
  line-height: 1.45;
  margin-bottom: 16px;
}

.delete-message-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-action-button {
  background: var(--text);
  color: var(--panel-strong);
}

.template-modal-header,
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.template-modal-title,
.settings-modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.template-modal-close,
.settings-modal-close {
  flex-shrink: 0;
}

.template-editor,
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border-soft);
}

.settings-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.settings-section-title {
  position: relative;
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 46px 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--input-bg);
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  outline: none;
}

.settings-section-title::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  opacity: 0.72;
  transition: transform 0.16s ease;
}

.settings-section-title:focus-visible {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.settings-section-open .settings-section-title {
  background: rgba(10, 132, 255, 0.10);
  border-color: rgba(10, 132, 255, 0.20);
}

:root[data-theme="dark"] .settings-section-open .settings-section-title {
  background: rgba(90, 200, 250, 0.10);
  border-color: rgba(90, 200, 250, 0.20);
}

.settings-section-open .settings-section-title::after {
  transform: translateY(-35%) rotate(225deg);
}

.settings-section:not(.settings-section-open) > :not(.settings-section-title) {
  display: none;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.system-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--input-bg);
}

.settings-info-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.settings-info-value {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.settings-pill {
  align-self: flex-start;
  min-height: 24px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(102, 112, 133, 0.14);
}

.settings-pill-success {
  color: #169c3a;
  background: rgba(52, 199, 89, 0.16);
}

.settings-pill-danger {
  color: var(--danger);
  background: rgba(107, 114, 128, 0.14);
}

.template-editor-field,
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-editor-field label,
.settings-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.template-editor-field input[type="text"],
.template-editor-field input[type="number"],
.template-editor-field textarea,
.settings-field input[type="text"],
.settings-field input[type="number"],
.settings-field input[type="password"],
.settings-field select,
.settings-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
}

:root[data-theme="dark"] .template-editor-field input[type="text"],
:root[data-theme="dark"] .template-editor-field input[type="number"],
:root[data-theme="dark"] .template-editor-field textarea,
:root[data-theme="dark"] .settings-field input[type="text"],
:root[data-theme="dark"] .settings-field input[type="number"],
:root[data-theme="dark"] .settings-field input[type="password"],
:root[data-theme="dark"] .settings-field select,
:root[data-theme="dark"] .settings-field textarea {
  background: var(--input-bg);
}

.template-editor-field textarea,
.settings-field textarea {
  min-height: 120px;
  height: auto;
  resize: vertical;
}

.settings-field textarea {
  min-height: 190px;
}

.switch-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--input-bg);
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(102, 112, 133, 0.28);
  transition: background 0.16s ease;
}

.switch-control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
  transition: transform 0.16s ease;
}

.switch-field input:checked + .switch-control {
  background: var(--primary);
}

.switch-field input:checked + .switch-control::after {
  transform: translateX(20px);
}

.switch-label {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.settings-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-cleanup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-test-row,
.settings-search-row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-search-field {
  flex: 1 1 220px;
}

.settings-status {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.settings-result {
  min-height: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.settings-result-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--input-bg);
}

.settings-result-title {
  color: var(--text);
  font-weight: 700;
}

.settings-result a {
  color: var(--primary);
  text-decoration: none;
}

.settings-result-missing {
  margin-top: 8px;
}

.blacklist-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blacklist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--input-bg);
}

.blacklist-item-main {
  min-width: 0;
}

.blacklist-item-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}

.blacklist-item-meta,
.blacklist-item-reason {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.blacklist-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.blacklist-delete-button {
  color: var(--muted);
}

.template-editor-actions,
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.template-primary-button,
.template-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.template-primary-button {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 10px 24px rgba(10, 132, 255, 0.22);
}

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

.template-secondary-button {
  background: var(--icon-bg);
  color: var(--text);
  border: 1px solid var(--icon-border);
}

.template-secondary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.settings-download-link.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: auto;
}

.danger-text-button {
  color: var(--muted);
}

.developer-credit {
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.range-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.quick-reactions-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-reaction-option {
  cursor: pointer;
}

.quick-reaction-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quick-reaction-option-mark {
  min-width: 42px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--input-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.quick-reaction-option input:checked + .quick-reaction-option-mark {
  background: rgba(10, 132, 255, 0.14);
  border-color: rgba(10, 132, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.08);
}

.chat-title,
.chat-item-name,
.templates-dropdown-title,
.template-modal-title,
.settings-modal-title,
.settings-section-title {
  font-size: calc(16px * var(--font-scale));
}

.chat-item-text,
.bubble,
.service-message-title,
.service-message-text,
.template-item-title,
.template-item-text,
.settings-field label,
.settings-hint,
.settings-status,
.settings-info-value,
.blacklist-item-title,
.blacklist-item-meta,
.blacklist-item-reason,
.developer-credit {
  font-size: calc(14px * var(--font-scale));
}

.meta,
.service-message-meta,
.settings-info-label,
.settings-pill,
.command-badge,
.range-labels {
  font-size: calc(12px * var(--font-scale));
}

textarea,
input[type="password"],
input[type="text"],
input[type="number"],
.primary-button,
.template-primary-button,
.template-secondary-button,
.switch-label,
.attachment-link,
.file-name,
.empty-state,
.error {
  font-size: calc(15px * var(--font-scale));
}

.composer-shell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: end;
  gap: 10px;
}

.composer-plus-wrap {
  position: relative;
  width: 46px;
  height: 46px;
}

.composer-actions-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 60;
  min-width: 260px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-card);
}

.composer-actions-menu-button {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: calc(18px * var(--font-scale));
  font-weight: 650;
  text-align: left;
}

.composer-actions-menu-button:hover {
  background: var(--panel-2);
}

.composer-actions-menu-button.recording {
  color: #dc2626;
  font-weight: 700;
}

.dictation-stop-overlay {
  position: fixed;
  left: 50%;
  bottom: calc(var(--composer-height) + 22px + env(safe-area-inset-bottom));
  z-index: 1400;
  transform: translateX(-50%);
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(220, 38, 38, 0.35);
  animation: recordingPulse 1s ease-in-out infinite;
}

.password-field {
  position: relative;
  margin-bottom: 14px;
}

.password-field input[type="password"],
.password-field input[type="text"] {
  padding-right: 56px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

textarea {
  width: 100%;
  min-height: 44px;
  height: 44px;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  padding: 11px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  font-size: 16px;
  line-height: 1.35;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  -webkit-overflow-scrolling: touch;
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
}

:root[data-theme="dark"] textarea {
  background: var(--input-bg);
}

textarea::placeholder,
input::placeholder {
  color: var(--input-placeholder);
  -webkit-text-fill-color: var(--input-placeholder);
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  font-size: 16px;
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
}

:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="text"] {
  background: var(--input-bg);
}

input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  font-size: 16px;
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  -webkit-text-fill-color: var(--input-text);
  caret-color: var(--primary);
}

:root[data-theme="dark"] input[type="number"] {
  background: var(--input-bg);
}

select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  font-size: 16px;
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
}

:root[data-theme="dark"] select {
  background: var(--input-bg);
}

input[type="file"] {
  display: none;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 24px rgba(10, 132, 255, 0.22);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--icon-bg);
  color: var(--text);
  border: 1px solid var(--icon-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0;
}

.icon-svg {
  width: 20px;
  height: 20px;
  display: block;
}

.copy-chat-id-button.copied {
  background: rgba(22, 163, 74, 0.16);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.24);
}

.send-button,
.composer-plus-button {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--icon-border);
  background: var(--icon-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0;
}

.send-button,
.composer-plus-button {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-contrast);
}

.send-button.recording {
  background: #dc2626;
  color: #ffffff;
  border-color: transparent;
  animation: recordingPulse 1s ease-in-out infinite;
}

.composer-actions-menu-button.transcribing {
  opacity: 0.65;
  cursor: wait;
}

.send-button:disabled,
.message-form-sending .send-button {
  opacity: 0.65;
  cursor: wait;
}

@keyframes recordingPulse {
  0%,
  100% {
    box-shadow: 0 8px 22px rgba(220, 38, 38, 0.22);
  }

  50% {
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.38);
  }
}

.composer-plus-button.active,
.composer-actions-menu-button.active {
  background: rgba(10, 132, 255, 0.14);
  color: var(--primary);
}

:root[data-theme="dark"] .composer-plus-button.active,
:root[data-theme="dark"] .composer-actions-menu-button.active {
  background: rgba(90, 200, 250, 0.14);
  color: #8bdfff;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.lightbox.hidden {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  width: min(96vw, 1200px);
  max-height: 92vh;
  margin: 4vh auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-image {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.lightbox-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hidden {
  display: none;
}

.empty-state {
  color: var(--muted);
  padding: 24px 12px;
  text-align: center;
  font-size: 15px;
}

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

@media (max-width: 900px) {
  .shell {
    padding: 0;
    height: 100svh;
  }

  .workspace {
    display: block;
    height: 100svh;
    min-height: 100svh;
  }

  .sidebar,
  .chat-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    height: 100svh;
    min-height: 100svh;
  }

  .sidebar-header,
  .chat-panel-header {
    min-height: 86px;
    padding-top: 26px;
  }

  .chat-panel-header {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 42px 42px 42px;
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
    overflow: hidden;
  }

  .chat-panel-header .icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .chat-title {
    min-width: 0;
    font-size: 18px;
    letter-spacing: 0;
  }

  .chat-item-name,
  .chat-item-search-snippet {
    font-size: 16px;
  }

  .chat-item-search-meta {
    font-size: 14px;
  }

  .mobile-hidden {
    display: none;
  }

  .msg {
    max-width: 88%;
  }

  .manager-reply-divider {
    width: 88%;
  }

  .bubble {
    padding: 8px 10px;
    border-radius: 8px;
  }

  .msg.left .bubble {
    background: var(--bubble-in);
    color: #ffffff;
  }

  .msg.right .bubble {
    background: transparent;
    color: var(--text);
  }

  .messages {
    padding: 12px 10px calc(var(--composer-height) + 22px);
  }

  .swipe-delete-container {
    border-radius: 0;
    background: transparent;
  }

  .swipe-surface {
    background: transparent;
  }

  .service-message {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    background: transparent;
  }

  .message-actions {
    top: auto;
    right: 8px;
    bottom: 8px;
  }

  .service-message-icon {
    width: 34px;
    height: 34px;
  }

  .service-message-title,
  .service-message-text {
    font-size: 13px;
  }

  .service-message-meta {
    font-size: 11px;
  }

  .message-form {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  #messageInput {
    min-height: 56px;
    height: 56px;
    padding: 12px 17px;
    font-size: 22px;
    line-height: 1.4;
  }

  .scroll-bottom-button {
    right: 16px;
    bottom: calc(var(--composer-height) + 18px);
    width: 40px;
    height: 40px;
  }

  .templates-dropdown {
    left: 12px;
    right: 12px;
    bottom: calc(100% + 8px);
    padding: 12px;
    border-radius: 20px;
    max-height: min(66vh, 520px);
  }

  .template-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .template-item-actions {
    justify-content: flex-end;
  }

  .template-modal-card,
  .settings-modal-card {
    width: calc(100vw - 24px);
    margin-top: 5vh;
    max-height: 90vh;
    padding: 16px;
    border-radius: 22px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-info-grid {
    grid-template-columns: 1fr;
  }

  .system-status-grid {
    grid-template-columns: 1fr;
  }

  .blacklist-item {
    grid-template-columns: 1fr;
  }

  .blacklist-item-actions {
    justify-content: stretch;
  }

  .blacklist-item-actions .template-secondary-button {
    flex: 1 1 0;
  }

  .template-editor-actions,
  .settings-actions {
    justify-content: stretch;
  }

  .template-primary-button,
  .template-secondary-button {
    flex: 1 1 0;
  }

  .dictation-draft-modal {
    padding: 12px;
  }

  .dictation-draft-card {
    width: calc(100vw - 24px);
    border-radius: 20px;
  }

  .dictation-draft-actions {
    grid-template-columns: 1fr;
  }

  .ai-modal {
    padding: 10px;
  }

  .ai-modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .credentials-modal {
    padding: 10px;
  }

  .credentials-modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
    padding: 14px;
  }

  .credentials-toolbar,
  .credential-password-row {
    grid-template-columns: 1fr;
  }

  .credential-item-top,
  .credential-row {
    align-items: flex-start;
  }

  .ai-actions {
    grid-template-columns: 1fr;
  }

  .ai-archive-tools {
    grid-template-columns: 1fr 42px 58px 68px;
  }

  .ai-archive-category-select {
    min-width: 0;
  }

  .ai-favorite-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-image-grid,
  .ai-image-actions,
  .ai-source-buttons,
  .ai-source-preview-grid {
    grid-template-columns: 1fr;
  }

  .ai-image-preview img {
    max-height: 34dvh;
  }

  .ai-quick-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .text-improve-actions {
    grid-template-columns: 1fr;
  }

  .cover-card {
    min-height: calc(100vh - 24px);
    height: calc(100vh - 24px);
    padding: max(8px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
    align-content: start;
    gap: 18px;
  }

  .password-generator {
    padding: 0 14px;
    gap: 18px;
  }

  .generated-password-box input {
    min-height: 76px;
    padding: 0 58px 0 18px;
    border-radius: 18px;
  }

  .generator-length,
  .generator-option {
    padding: 16px 20px;
    border-radius: 18px;
  }

  .generator-option input {
    width: 42px;
    height: 42px;
  }

  .generator-option input[type="checkbox"]::after {
    font-size: 30px;
  }

  .cover-generate-button {
    min-height: 0;
    border-radius: 0;
  }

  .cover-ad-banner {
    width: min(188px, calc(100% - 120px));
    min-height: 0;
    margin: 0 auto;
    border-radius: 0;
  }

  .composer-plus-button,
  .send-button {
    width: 44px;
    height: 44px;
  }

  .composer-plus-wrap {
    width: 44px;
    height: 44px;
  }

  .composer-actions-menu {
    min-width: min(82vw, 340px);
    padding: 14px;
    border-radius: 22px;
  }

  .composer-actions-menu-button {
    min-height: 64px;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 21px;
  }

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

  .dictation-stop-overlay {
    width: calc(100vw - 32px);
    max-width: 360px;
    bottom: calc(var(--composer-height) + 14px + env(safe-area-inset-bottom));
  }

  .chat-image,
  .chat-video,
  .chat-audio {
    max-width: 100%;
  }

  .message-delete-button {
    display: none;
  }

  .lightbox-content {
    width: 100vw;
    margin: 0;
    min-height: 100vh;
    justify-content: center;
    padding: 16px;
  }

  .lightbox-image {
    max-height: 72vh;
  }
}

@media (display-mode: standalone) {
  html,
  body {
    background: #0b141a;
  }

  .shell,
  .workspace,
  .sidebar,
  .chat-panel {
    height: 100dvh;
    min-height: 100dvh;
  }

  @supports (padding-top: env(safe-area-inset-top)) {
    .sidebar-header,
    .chat-panel-header {
      min-height: calc(74px + env(safe-area-inset-top));
      padding-top: calc(14px + env(safe-area-inset-top));
    }
  }

  :root[data-theme="dark"] .messages,
  :root[data-theme="dark"] .chat-panel {
    background: #0b141a;
  }

  :root[data-theme="dark"] .swipe-delete-container,
  :root[data-theme="dark"] .swipe-surface,
  :root[data-theme="dark"] .msg {
    background: transparent;
  }

  :root[data-theme="dark"] .msg.left .bubble {
    background: var(--bubble-in);
    color: #ffffff;
  }

  :root.design-theme-minimal-light[data-theme="dark"] .msg.left .bubble {
    color: #111827;
  }

  :root[data-theme="dark"] .msg.right .bubble {
    background: transparent;
    color: var(--text);
  }
}

.pwa-standalone,
.pwa-standalone body {
  background: #0b141a;
}

.pwa-standalone .shell,
.pwa-standalone .workspace,
.pwa-standalone .sidebar,
.pwa-standalone .chat-panel {
  height: 100dvh;
  min-height: 100dvh;
}

@supports (padding-top: env(safe-area-inset-top)) {
  .pwa-standalone .sidebar-header,
  .pwa-standalone .chat-panel-header {
    min-height: calc(74px + env(safe-area-inset-top));
    padding-top: calc(14px + env(safe-area-inset-top));
  }
}

.pwa-standalone[data-theme="dark"] .messages,
.pwa-standalone[data-theme="dark"] .chat-panel {
  background: #0b141a;
}

:root.design-theme-whatsapp-dark .template-item,
:root.design-theme-messenger-blue .template-item,
:root.design-theme-blue-gold .template-item,
:root.design-theme-graphite .template-item,
:root.design-theme-pure-dark .template-item,
:root.design-theme-mono .template-item,
:root.design-theme-minimal-light .template-item,
:root.design-theme-whatsapp-dark .settings-section-title,
:root.design-theme-messenger-blue .settings-section-title,
:root.design-theme-blue-gold .settings-section-title,
:root.design-theme-graphite .settings-section-title,
:root.design-theme-pure-dark .settings-section-title,
:root.design-theme-mono .settings-section-title,
:root.design-theme-minimal-light .settings-section-title,
:root.design-theme-whatsapp-dark .settings-info-item,
:root.design-theme-messenger-blue .settings-info-item,
:root.design-theme-blue-gold .settings-info-item,
:root.design-theme-graphite .settings-info-item,
:root.design-theme-pure-dark .settings-info-item,
:root.design-theme-mono .settings-info-item,
:root.design-theme-minimal-light .settings-info-item,
:root.design-theme-whatsapp-dark .switch-field,
:root.design-theme-messenger-blue .switch-field,
:root.design-theme-blue-gold .switch-field,
:root.design-theme-graphite .switch-field,
:root.design-theme-pure-dark .switch-field,
:root.design-theme-mono .switch-field,
:root.design-theme-minimal-light .switch-field,
:root.design-theme-whatsapp-dark .settings-result-group,
:root.design-theme-messenger-blue .settings-result-group,
:root.design-theme-blue-gold .settings-result-group,
:root.design-theme-graphite .settings-result-group,
:root.design-theme-pure-dark .settings-result-group,
:root.design-theme-mono .settings-result-group,
:root.design-theme-minimal-light .settings-result-group,
:root.design-theme-whatsapp-dark .blacklist-item,
:root.design-theme-messenger-blue .blacklist-item,
:root.design-theme-blue-gold .blacklist-item,
:root.design-theme-graphite .blacklist-item,
:root.design-theme-pure-dark .blacklist-item,
:root.design-theme-mono .blacklist-item,
:root.design-theme-minimal-light .blacklist-item,
:root.design-theme-whatsapp-dark .quick-reaction-option-mark,
:root.design-theme-messenger-blue .quick-reaction-option-mark,
:root.design-theme-blue-gold .quick-reaction-option-mark,
:root.design-theme-graphite .quick-reaction-option-mark,
:root.design-theme-pure-dark .quick-reaction-option-mark,
:root.design-theme-mono .quick-reaction-option-mark,
:root.design-theme-minimal-light .quick-reaction-option-mark {
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
}

:root.design-theme-whatsapp-dark .template-item-title,
:root.design-theme-messenger-blue .template-item-title,
:root.design-theme-blue-gold .template-item-title,
:root.design-theme-graphite .template-item-title,
:root.design-theme-pure-dark .template-item-title,
:root.design-theme-mono .template-item-title,
:root.design-theme-minimal-light .template-item-title {
  color: var(--text) !important;
}

:root.design-theme-whatsapp-dark .template-item-text,
:root.design-theme-messenger-blue .template-item-text,
:root.design-theme-blue-gold .template-item-text,
:root.design-theme-graphite .template-item-text,
:root.design-theme-pure-dark .template-item-text,
:root.design-theme-mono .template-item-text,
:root.design-theme-minimal-light .template-item-text {
  color: var(--muted) !important;
}
