:root {
  color-scheme: dark;
  --bg: #071326;
  --panel: #0d1d35;
  --line: #1e3857;
  --text: #f4fbff;
  --muted: #94acc4;
  --mine: #c9f7ff;
  --mine-text: #082239;
  --assistant: #f3f8fc;
  --assistant-text: #102640;
  --assistant-border: #c7dae8;
  --accent: #21d4f5;
  --accent-strong: #147cf3;
  --shadow: 0 22px 70px rgba(0, 8, 24, 0.42);
  --app-width: 920px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(20, 124, 243, 0.28), transparent 32%),
    radial-gradient(circle at 90% 100%, rgba(33, 212, 245, 0.15), transparent 35%),
    var(--bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

body.auth-loading .app-shell {
  visibility: hidden;
}

.install-guide {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 8, 7, 0.82);
  backdrop-filter: blur(12px);
  touch-action: manipulation;
}

.install-guide-panel {
  position: relative;
  width: min(100%, 390px);
  padding: 28px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.install-guide-panel img {
  width: 70px;
  height: 70px;
  border-radius: 18px;
}

.install-guide-panel h2 {
  margin: 14px 0 8px;
  font-size: 1.25rem;
}

.install-guide-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.install-guide-panel ol {
  margin: 18px 0;
  padding-inline-start: 28px;
  text-align: start;
  line-height: 1.8;
}

.install-guide-close {
  position: absolute;
  inset-inline-end: 12px;
  top: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  font-size: 1.5rem;
}

.install-now-button,
.install-guide-later {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
}

.install-now-button {
  color: #111;
  background: var(--accent);
  font-weight: 800;
}

.install-guide-later {
  margin-top: 8px;
  color: var(--muted);
  background: transparent;
}

button,
textarea,
.message-input {
  font: inherit;
}

.pairing-gate {
  position: fixed;
  inset: 0;
  width: 100vw;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: rgba(4, 13, 29, 0.93);
  backdrop-filter: blur(14px);
  touch-action: pan-y;
}

.pairing-panel {
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
  max-width: calc(100vw - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #102846, #09172b);
  box-shadow: var(--shadow);
  margin: auto 0;
  justify-self: center;
  align-self: center;
  overflow: hidden;
}

.pairing-panel img {
  width: 76px;
  height: 76px;
  margin: 0 auto 4px;
  object-fit: contain;
  border-radius: 18px;
  background: #f8fcff;
}

.pairing-panel h2,
.pairing-panel p {
  margin: 0;
  text-align: center;
}

.public-home-intro {
  display: grid;
  gap: 8px;
  margin: 2px 0 4px;
  text-align: start;
}

.public-home-intro h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.2rem, 5vw, 1.65rem);
  line-height: 1.2;
}

.public-home-intro p {
  color: var(--muted);
  line-height: 1.45;
  text-align: start;
}

.public-home-intro ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-inline-start: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.public-privacy-link {
  justify-self: start;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.pairing-panel p,
.pairing-panel small {
  color: var(--muted);
}

.pairing-panel input,
.pairing-panel button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font: inherit;
}

.pairing-panel input {
  padding: 0 12px;
  color: #171815;
  background: #f7f3ee;
  outline: 0;
}

.pairing-panel button {
  color: #03172c;
  background: linear-gradient(100deg, var(--accent), #5de7ff);
  font-weight: 800;
  touch-action: manipulation;
}

.pairing-panel button:disabled {
  opacity: 0.65;
}

.pairing-panel small {
  min-height: 1.2em;
  text-align: center;
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  unicode-bidi: plaintext;
}

.onboarding-welcome {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 50% 15%, rgba(33, 212, 245, 0.18), transparent 35%),
    rgba(4, 13, 29, 0.95);
  backdrop-filter: blur(16px);
  touch-action: pan-y;
}

.onboarding-welcome-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 620px);
  max-height: min(92dvh, 820px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(16, 40, 70, 0.98), rgba(7, 20, 39, 0.98));
  box-shadow: var(--shadow);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  text-align: start;
  margin: auto 0;
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.onboarding-brand img {
  flex: 0 0 auto;
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 20px;
  background: #f8fcff;
}

.onboarding-brand .onboarding-logo {
  width: 190px;
  height: 108px;
  border-radius: 14px;
  object-fit: contain;
  background: #ffffff;
}

.onboarding-brand span {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.onboarding-brand h2 {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.onboarding-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

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

.onboarding-examples article {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.onboarding-examples span {
  font-size: 1.35rem;
  line-height: 1.2;
}

.onboarding-examples p {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.onboarding-promise {
  padding: 16px;
  border-inline-start: 4px solid var(--accent);
  border-radius: 10px;
  background: rgba(33, 212, 245, 0.08);
}

.onboarding-promise strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.08rem;
}

.onboarding-promise p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.onboarding-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.onboarding-features li {
  padding: 7px 11px;
  border: 1px solid #2d6684;
  border-radius: 999px;
  color: #d9fbff;
  background: #123653;
  font-size: 0.84rem;
  font-weight: 700;
}

.onboarding-welcome-panel button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  color: #111;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.onboarding-welcome-panel button:disabled {
  opacity: 0.65;
}

@media (max-width: 560px) {
  .onboarding-welcome {
    padding: 12px;
  }

  .onboarding-welcome-panel {
    gap: 14px;
    max-height: calc(100dvh - 24px);
    padding: 20px 16px;
    border-radius: 16px;
  }

  .onboarding-brand {
    gap: 12px;
  }

  .onboarding-brand img {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .onboarding-examples {
    grid-template-columns: 1fr;
  }

  .onboarding-examples article {
    min-height: 0;
    padding: 12px;
  }
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100vw, var(--app-width));
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  background: rgba(7, 19, 38, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.topbar {
  grid-row: 1;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 35, 63, 0.98), rgba(8, 23, 44, 0.96));
  z-index: 5;
  touch-action: manipulation;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  background: #f8fcff;
  padding: 3px;
}

.brand-menu-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.brand-menu-button span {
  position: absolute;
  inset-inline-start: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(33, 212, 245, 0.35);
  border-radius: 50%;
  background: #0d2948;
  font-size: 1rem;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.brand-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.icon-button,
.send-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #123252;
  color: var(--text);
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-button {
  width: auto;
  min-width: 72px;
  padding: 0 14px;
  border-radius: 999px;
  color: #111;
  background: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.messages {
  grid-row: 2;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  display: block;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: none;
  padding: 18px 12px;
  background:
    radial-gradient(circle at 75% 10%, rgba(20, 124, 243, 0.1), transparent 28%),
    radial-gradient(circle at 10% 85%, rgba(33, 212, 245, 0.08), transparent 30%),
    #091a31;
}

.bubble {
  width: fit-content;
  max-width: min(78%, 640px);
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: grid;
  gap: 4px;
}

.bubble-text {
  display: block;
}

.bubble-link {
  color: #047c9f;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bubble-link:hover {
  color: #005f7d;
}

.bubble.user .bubble-link {
  color: #05394d;
}

.bubble-image {
  display: block;
  width: min(260px, 100%);
  max-height: 320px;
  border-radius: 8px;
  object-fit: cover;
}

.bubble-audio {
  display: block;
  width: min(260px, 100%);
}

.bubble-file {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
  font-size: 0.88rem;
}

.whatsapp-onboarding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.whatsapp-onboarding-actions .text-button,
.whatsapp-link-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #19b7df;
  color: #071326;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.whatsapp-onboarding-actions .text-button.secondary {
  background: rgba(7, 19, 38, 0.12);
}

.whatsapp-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
}

.bubble-time {
  display: block;
  min-width: 42px;
  justify-self: end;
  color: rgba(36, 35, 31, 0.58);
  font-size: 0.72rem;
  line-height: 1;
}

.bubble.user {
  margin-right: 0;
  margin-left: auto;
  background: var(--mine);
  color: var(--mine-text);
}

.bubble.user .bubble-time {
  color: rgba(23, 32, 22, 0.58);
}

.bubble.assistant {
  margin-right: auto;
  margin-left: 0;
  background: var(--assistant);
  color: var(--assistant-text);
  border: 1px solid var(--assistant-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.bubble.pending {
  color: #6d675f;
}

.date-separator {
  width: fit-content;
  margin: 10px auto;
  position: sticky;
  top: 8px;
  z-index: 1;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(17, 47, 80, 0.92);
  color: #d9f8ff;
  font-size: 0.78rem;
  line-height: 1.2;
  backdrop-filter: blur(10px);
}

.composer {
  grid-row: 3;
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: end;
  gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #0c213c, #08172c);
  z-index: 5;
  touch-action: manipulation;
}

.hidden-input,
.attach-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.camera-button {
  position: relative;
  overflow: hidden;
}

.camera-button input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  cursor: pointer;
}

.attach-button span {
  font-size: 1.55rem;
  line-height: 1;
}

.input-wrap {
  position: relative;
  min-height: 42px;
  border-radius: 22px;
  background: #f5fbff;
  color: #102640;
  padding: 7px 14px;
}

.message-input {
  display: block;
  width: 100%;
  height: 28px;
  max-height: 92px;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  line-height: 1.45;
  padding: 0;
  overflow-y: auto;
  resize: none;
  white-space: pre-wrap;
  word-break: break-word;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

.message-input::placeholder {
  color: #6a829a;
  opacity: 1;
}

.recording-indicator {
  display: none;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  color: #514b45;
  font-weight: 700;
}

.recording-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  direction: ltr;
}

.recording-wave i {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  animation: wave 0.8s ease-in-out infinite;
}

.recording-wave i:nth-child(2) { animation-delay: 0.08s; }
.recording-wave i:nth-child(3) { animation-delay: 0.16s; }
.recording-wave i:nth-child(4) { animation-delay: 0.24s; }
.recording-wave i:nth-child(5) { animation-delay: 0.32s; }
.recording-wave i:nth-child(6) { animation-delay: 0.4s; }
.recording-wave i:nth-child(7) { animation-delay: 0.48s; }

.composer.is-recording .message-input,
.composer.is-recording .file-list {
  display: none;
}

.composer.is-recording .recording-indicator {
  display: flex;
}

@keyframes wave {
  0%,
  100% {
    height: 7px;
    opacity: 0.55;
  }
  50% {
    height: 22px;
    opacity: 1;
  }
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  color: #413d38;
  font-size: 0.78rem;
  line-height: 1;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(100%, 240px);
  min-height: 24px;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  background: #e8dfd6;
}

.file-pill img {
  width: 34px;
  height: 34px;
  margin: -1px 0;
  border-radius: 50%;
  object-fit: cover;
}

.file-pill audio {
  width: 150px;
  height: 28px;
}

.file-pill.image-preview {
  min-height: 36px;
  padding-inline-start: 4px;
}

.file-pill.audio-preview {
  max-width: min(100%, 230px);
  border-radius: 16px;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pill.audio-preview .file-name {
  display: none;
}

.file-remove {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  color: #f7f3ee;
  background: #6e665f;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.composer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 92px;
}

.send-button {
  display: none;
}

.composer.has-content .quick-action {
  display: none;
}

.composer.has-content .composer-actions {
  min-width: 44px;
}

.composer.has-content .send-button {
  display: inline-grid;
}

.quick-action.recording {
  color: #03172c;
  background: #ffb44d;
}

.send-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #03172c;
}

.send-button span {
  transform: rotate(180deg);
  font-size: 1.2rem;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: block;
  padding: 0;
  background: rgba(4, 13, 29, 0.78);
  backdrop-filter: blur(10px);
  touch-action: none;
}

.menu-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: min(100%, var(--app-width));
  height: min(100%, 100dvh);
  margin: 0 auto;
  border-inline: 1px solid #1e3857;
  border-radius: 0;
  overflow: hidden;
  background: #0d1d35;
  color: var(--text);
  direction: rtl;
}

.menu-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #102846, #0a192e);
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.menu-head .icon-button {
  width: 34px;
  height: 34px;
  color: var(--text);
  background: #193653;
  font-size: 1.4rem;
}

.menu-signout {
  width: 100%;
  min-height: 38px;
  margin: auto 0 0;
  border: 1px solid #2d5272;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.menu-signout:hover {
  color: #0b4c85;
  border-color: var(--accent);
}

.menu-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 0;
}

.menu-tab {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
}

.menu-tab.active {
  color: #03172c;
  background: linear-gradient(135deg, var(--accent), #69e4f6);
  border-color: transparent;
  box-shadow: 0 5px 18px rgba(20, 124, 243, 0.12);
}

.menu-content {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0d1d35;
}

.menu-section {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 56px) clamp(18px, 5vw, 72px);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.menu-section > * {
  width: min(100%, 980px);
  margin-right: auto;
  margin-left: auto;
}

.menu-empty,
.menu-status {
  margin: 18px 4px;
  color: var(--muted);
  text-align: center;
}

.account-connections {
  display: grid;
  gap: 12px;
}

.account-connection-row,
.account-connection-accordion {
  border: 1px solid rgba(80, 205, 230, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.account-connection-row {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.account-connection-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: inherit;
}

.account-connection-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.account-connection-arrow {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.18s ease;
}

.account-connection-accordion[data-expanded="true"] .account-connection-arrow {
  transform: rotate(180deg);
}

.account-connection-body {
  display: none;
  padding: 0 12px 12px;
}

.account-connection-accordion[data-expanded="true"] .account-connection-body {
  display: grid;
  gap: 10px;
}

.account-connection-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.account-connection-copy strong {
  color: var(--text);
  font-size: 0.96rem;
}

.account-connection-copy span {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  text-align: left;
}

.account-connection-controls {
  display: grid;
  gap: 8px;
}

.account-connection-controls .menu-empty,
.account-connection-controls .menu-status {
  margin: 2px 0 0;
  text-align: right;
}

.account-connection-controls .menu-signout {
  margin: 8px 0 0;
}

.reminder-default-settings {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(80, 205, 230, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.reminder-default-settings .list-title,
.reminder-default-settings p {
  margin: 0;
}

.account-connection-body .reminder-default-settings {
  padding: 0;
  border: 0;
  background: transparent;
}

.list-card,
.reminder-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #102846;
}

.list-card + .list-card,
.reminder-card + .reminder-card {
  margin-top: 10px;
}

.list-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.list-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.list-card-actions button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 0 9px;
  color: #fff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.list-action-clear {
  background: #526f8e;
}

.list-action-delete {
  background: #8f3d4d;
}

.list-card-actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.reminder-settings-card,
.reminders-table-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #ddd4ca;
  border-radius: 12px;
  background: #fffaf4;
  direction: rtl;
  text-align: right;
  color: #17233b;
}

.reminder-settings-card .list-title,
.reminders-table-card .list-title,
.reminder-settings-card .reminder-settings-hint,
.reminders-table-card .menu-status,
.reminder-settings-card .reminder-settings-status {
  color: #17233b;
}

.reminder-settings-card + .reminders-table-card {
  margin-top: 14px;
}

.reminder-settings-hint,
.reminder-settings-status {
  margin: 0;
  color: #686158;
}

.reminder-channel-list {
  display: grid;
  gap: 10px;
}

.reminder-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #e2d8ce;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
}

.reminder-channel-row.saving {
  opacity: 0.72;
}

.reminder-channel-copy {
  display: grid;
  gap: 4px;
}

.reminder-channel-copy strong {
  color: #17233b;
}

.reminder-channel-copy small {
  color: #686158;
}

.reminders-table-card th,
.reminders-table-card td,
.reminders-table-card .reminders-sort {
  color: #17233b;
}

.reminders-table-card th {
  font-weight: 800;
}

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

.reminder-switch {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #c5ced7;
  background: #cfd7de;
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 0.16);
  transition: background 160ms ease, border-color 160ms ease;
}

.reminder-switch::before {
  content: "OFF";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.reminder-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #e9eef3);
  box-shadow: 0 2px 8px rgb(10 23 42 / 0.26);
  transition: inset-inline-start 160ms ease;
}

.reminder-switch-input:checked + .reminder-switch {
  border-color: #21bfe0;
  background: linear-gradient(90deg, #47cfe5, #12b4d8);
}

.reminder-switch-input:checked + .reminder-switch::before {
  content: "ON";
  left: auto;
  right: 13px;
}

.reminder-switch-input:checked + .reminder-switch .reminder-switch-knob {
  left: 39px;
}

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

.reminders-sort {
  min-height: 38px;
  border: 1px solid #d5ccc2;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.reminders-table-wrap {
  overflow-x: auto;
}

.reminders-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

.reminders-table th,
.reminders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eadfd5;
  text-align: right;
  white-space: nowrap;
}

.reminders-table th {
  color: #536276;
  background: #f4fbfd;
  font-size: 0.88rem;
}

.reminders-table tr:last-child td {
  border-bottom: 0;
}

.reminders-table td:last-child,
.reminders-table th:last-child {
  text-align: left;
}

.reminder-delete {
  min-width: 64px;
}

#groupsPanel {
  direction: rtl;
  text-align: right;
}

#groupsPanel .list-card {
  gap: 12px;
  padding: 18px;
}

#groupsPanel .list-title,
#groupsPanel .menu-empty {
  text-align: right;
}

#groupsPanel > .menu-save,
#groupsPanel .list-card > .menu-save,
#groupsPanel .list-card > .item-delete {
  width: 100%;
  justify-self: stretch;
}

#groupsPanel .member-card {
  width: 100%;
  box-sizing: border-box;
  text-align: right;
}

.list-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.list-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.list-item-copy {
  display: grid;
  flex: 1;
  gap: 2px;
}

.list-item-copy .is-done {
  color: #8b847c;
  text-decoration: line-through;
}

.item-audit,
.member-card small {
  color: #777067;
  font-size: 0.75rem;
}

.item-delete {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 0 9px;
  color: #fff;
  background: #8f3d4d;
  font: inherit;
  font-size: 0.8rem;
}

.field-label {
  color: #514b45;
  font-size: 0.85rem;
  font-weight: 700;
}

.menu-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d5ccc2;
  border-radius: 8px;
  padding: 0 10px;
  color: #201f1c;
  background: white;
  font: inherit;
}

.member-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #e5ddd4;
  border-radius: 8px;
  background: #fff;
}

.permission-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.permission-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

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

.plan-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px auto 8px;
}

.plan-summary-card {
  display: grid;
  gap: 7px;
  min-height: 122px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, #102846, #0d203a);
  color: var(--text);
}

.plan-summary-card.current-plan {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong), 0 8px 24px rgba(20, 124, 243, 0.14);
}

.plan-summary-card h4,
.plan-summary-card p {
  margin: 0;
}

.plan-summary-card h4 {
  color: var(--accent);
  font-size: 1.05rem;
}

.plan-summary-card p {
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.45;
}

.plan-summary-card strong {
  margin-top: auto;
  color: var(--text);
}

.plan-comparison-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #ddd3c8;
  border-radius: 14px;
  background: #fff;
}

.plan-comparison-button {
  width: 100%;
  max-width: 280px;
  display: block;
  margin: 12px auto 18px;
}

.plan-comparison-modal[hidden] {
  display: none;
}

.plan-comparison-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(18 35 61 / 42%);
}

.plan-comparison-dialog {
  width: min(960px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  padding: 18px;
  border: 1px solid #ddd3c8;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(18 35 61 / 25%);
}

.plan-comparison-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plan-comparison-head h3 {
  margin: 0;
  color: #12233d;
}

.plan-comparison {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  direction: rtl;
  text-align: right;
}

.plan-comparison th,
.plan-comparison td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee7df;
  vertical-align: middle;
}

.plan-comparison thead th {
  min-width: 145px;
  background: #f8f4ef;
  color: #12233d;
}

.plan-comparison thead th:first-child {
  min-width: 220px;
}

.plan-comparison thead th strong,
.plan-comparison thead th small {
  display: block;
}

.plan-comparison thead th small {
  margin-top: 3px;
  color: #655f58;
  font-size: .82rem;
}

.plan-comparison tbody th {
  color: #403b36;
  font-weight: 700;
}

.plan-comparison tbody tr:last-child th,
.plan-comparison tbody tr:last-child td {
  border-bottom: 0;
}

.plan-comparison .current-plan {
  box-shadow: inset 0 0 0 2px var(--accent-strong);
}

.plan-select {
  width: 100%;
  margin-top: 9px;
  padding: 7px 9px;
  font-size: .78rem;
}

.plan-check {
  color: #168363;
  font-size: 1.15rem;
  font-weight: 800;
}

.plan-card,
.usage-report {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #102846;
}

.plan-card.selected {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.plan-card h4,
.plan-card p,
.usage-report h3,
.usage-heading h3 {
  margin: 0;
}

.plan-price {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.2rem;
}

.plan-card p {
  min-height: 42px;
  color: #655f58;
  font-size: 0.86rem;
}

.plan-limit {
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.plan-development-note,
.usage-privacy {
  margin: 0;
  padding-inline: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.usage-report {
  margin-top: 12px;
}

.usage-meter {
  display: grid;
  gap: 6px;
}

.usage-meter progress {
  width: 100%;
  height: 12px;
  accent-color: var(--accent-strong);
}

.usage-top {
  margin: 0;
  padding: 9px;
  border-radius: 8px;
  background: #193653;
}

.usage-members {
  display: grid;
  gap: 5px;
}

.usage-members > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 6px;
  border-bottom: 1px solid #eee7df;
}

.usage-cost-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.usage-cost-grid > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #193653;
}

.usage-cost-grid span {
  color: var(--muted);
  font-size: 0.85rem;
}

.usage-cost-grid strong,
.usage-members strong,
.usage-report h3 {
  color: var(--text);
}

.usage-cost-grid strong {
  font-size: 1.1rem;
}

@media (max-width: 520px) {
  .menu-panel {
    grid-template-columns: 142px minmax(0, 1fr);
  }

  .menu-sidebar {
    padding-inline: 8px;
  }

  .menu-head {
    padding-inline: 6px;
  }

  .menu-head strong {
    font-size: 0.9rem;
  }

  .menu-tab {
    padding-inline: 8px;
    font-size: 0.82rem;
    text-align: center;
  }

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

  .plan-summary-grid {
    grid-template-columns: 1fr;
  }

  .plan-card p {
    min-height: 0;
  }

  .usage-cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Settings are a full page on phones; the desktop split layout is too narrow
   for both navigation and the active panel to remain comfortable. */
@media (max-width: 700px) {
  .menu-overlay {
    background: #0d1d35;
    backdrop-filter: none;
    touch-action: pan-y;
  }

  .menu-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .menu-sidebar {
    flex: 0 0 auto;
    padding: max(12px, env(safe-area-inset-top)) 14px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .menu-head {
    min-height: 42px;
    padding: 0;
  }

  .menu-head strong {
    font-size: 1.05rem;
  }

  .menu-tabs {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 12px 0 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .menu-tabs::after {
    content: "←";
    position: absolute;
    inset-inline-start: 0;
    top: 12px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 42px;
    color: var(--accent);
    background: linear-gradient(90deg, #102846 35%, rgba(16, 40, 70, 0));
    font-size: 1.25rem;
    font-weight: 800;
    pointer-events: none;
  }

  .menu-tabs::-webkit-scrollbar {
    display: none;
  }

  .menu-tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 14px;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
  }

  .menu-signout {
    width: auto;
    min-height: 34px;
    margin: 10px 0 0;
    padding: 0 12px;
    align-self: flex-start;
    font-size: 0.82rem;
  }

  .menu-content {
    flex: 1 1 auto;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .menu-section {
    min-height: 100%;
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
  }
}

.list-item-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

.menu-save,
.reminder-actions button {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: #111;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
}

.menu-save:disabled {
  opacity: 0.55;
}

.reminder-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.reminder-form input,
.reminder-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d5ccc2;
  border-radius: 8px;
  padding: 0 10px;
  color: #201f1c;
  background: white;
  font: inherit;
}

.reminder-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.reminder-actions .delete {
  color: #fff;
  background: #8f3d4d;
}

@media (max-width: 560px) {
  .app-shell {
    max-width: none;
  }

  .bubble {
    max-width: 86%;
  }

  .text-button {
    min-width: 64px;
    padding: 0 10px;
    font-size: 0.82rem;
  }
}
/* Google Calendar selection */
.calendar-settings-card {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(80, 205, 230, 0.14);
  border-radius: 12px;
}

.calendar-connection-status {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(80, 205, 230, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.calendar-connection-status .list-title,
.calendar-connection-status p {
  margin: 0;
}

.calendar-settings-card .list-title {
  margin: 0;
  font-size: 0.95rem;
}

.calendar-settings-card .menu-empty,
.calendar-settings-card .menu-status {
  color: var(--muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row span {
  color: var(--text);
  font-weight: 600;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #19bde8);
}
