/*
 * OryqO Web chat app.
 * Visual language follows the OryqO iOS app (outputs/messaging-app): light
 * teal/mint chrome, filter chips, warm chat canvas, mint outgoing bubbles and a
 * round send button. Everything is scoped to .web-app-section / .web-app-shell
 * so the dark marketing site styles in styles.css are unaffected.
 */

.web-app-section {
  width: min(1360px, calc(100% - 36px));
  margin: 0 auto 54px;
  padding: 76px 0 66px;
}

.web-app-section .section-heading {
  max-width: 760px;
  margin-bottom: 26px;
}

.web-app-shell {
  --ow-bg: #eaf7f9;
  --ow-surface: #ffffff;
  --ow-surface-2: #f3fafb;
  --ow-tint: #eef9fb;
  --ow-line: #dceff2;
  --ow-line-strong: #b9dfe5;
  --ow-text: #10242a;
  --ow-muted: #5f7480;
  --ow-soft: #7e97a3;
  --ow-teal: #41d7bd;
  --ow-teal-dark: #168fae;
  --ow-ink-accent: #0b6378;
  --ow-chip: #e8f3f5;
  --ow-chip-active: #d9f7f0;
  --ow-bubble-out: #d8fbef;
  --ow-bubble-in: #ffffff;
  --ow-canvas: #efece6;
  --ow-tick-read: #2aa8e0;
  --ow-danger: #d93f3f;
  --ow-success: #16925f;
  --ow-warn-bg: #fff6d8;
  --ow-radius: 14px;
  --ow-top-offset: 64px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(16, 36, 42, 0.1);
  border-radius: 20px;
  background: var(--ow-bg);
  box-shadow: 0 24px 70px rgba(16, 36, 42, 0.16);
  color: var(--ow-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  text-align: left;
}

.web-app-shell *,
.web-app-shell *::before,
.web-app-shell *::after {
  box-sizing: border-box;
}

.web-app-shell :is(h3, h4, p, ul) {
  margin: 0;
}

.web-app-shell p {
  font-size: inherit;
  line-height: 1.45;
}

.web-app-shell :is(button, input, textarea, select) {
  font: inherit;
  letter-spacing: 0;
}

.web-app-shell button {
  cursor: pointer;
}

.web-app-shell button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.web-app-shell :is(button, input, textarea, select, a):focus-visible {
  outline: 2px solid var(--ow-teal-dark);
  outline-offset: 2px;
}

.web-app-shell [hidden] {
  display: none !important;
}

.web-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.web-i {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ */
/* Shared controls                                                     */
/* ------------------------------------------------------------------ */

.web-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #36515a;
  padding: 0;
  transition: background 140ms ease, color 140ms ease;
}

.web-icon:hover:not(:disabled) {
  background: rgba(22, 143, 174, 0.1);
  color: var(--ow-ink-accent);
}

.web-icon.accent {
  color: var(--ow-teal-dark);
}

.web-icon.active,
.web-icon[aria-expanded="true"] {
  background: var(--ow-chip-active);
  color: var(--ow-ink-accent);
}

.web-icon-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.web-primary,
.web-secondary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.web-primary {
  border: 0;
  background: linear-gradient(135deg, #5cd6ea, var(--ow-teal));
  color: #06313a;
  box-shadow: 0 8px 20px rgba(22, 143, 174, 0.22);
}

.web-primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.web-secondary {
  border: 1px solid var(--ow-line-strong);
  background: var(--ow-surface);
  color: var(--ow-ink-accent);
}

.web-secondary:hover:not(:disabled) {
  border-color: var(--ow-teal-dark);
  background: var(--ow-surface-2);
}

.web-secondary.small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.web-secondary.danger,
.web-settings-list .danger {
  color: var(--ow-danger);
}

.web-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--ow-teal-dark);
  padding: 4px 0;
  font-weight: 600;
}

.web-link:hover {
  text-decoration: underline;
}

.web-link .web-i {
  width: 16px;
  height: 16px;
}

.web-round {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.web-round .web-i {
  width: 24px;
  height: 24px;
}

.web-round.accept {
  background: #1fbf75;
}

.web-round.decline {
  background: var(--ow-danger);
}

.web-round[aria-pressed="true"] {
  background: #fff;
  color: var(--ow-text);
}

.web-avatar {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #bff1f7, #c6f6e6);
  color: var(--ow-ink-accent);
  font-size: 15px;
  font-weight: 700;
}

.web-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.web-avatar.group {
  background: linear-gradient(135deg, #d6e7ff, #cdeff8);
  color: #2d5a9c;
}

.web-avatar.large {
  width: 88px;
  height: 88px;
  font-size: 28px;
}

.web-app-shell label {
  display: grid;
  gap: 6px;
}

.web-app-shell label > span {
  color: #36515a;
  font-size: 13px;
  font-weight: 600;
}

.web-app-shell label > span em {
  color: var(--ow-soft);
  font-style: normal;
  font-weight: 400;
}

.web-app-shell label small {
  color: var(--ow-muted);
  font-size: 12px;
}

.web-app-shell :is(input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"], textarea, select) {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--ow-line-strong);
  border-radius: 12px;
  background: var(--ow-surface);
  color: var(--ow-text);
  padding: 10px 12px;
  font-size: 16px;
}

.web-app-shell textarea {
  resize: vertical;
}

.web-app-shell :is(input, textarea, select):focus {
  border-color: var(--ow-teal-dark);
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 143, 174, 0.14);
}

.web-form-stack {
  display: grid;
  gap: 14px;
}

.web-form-note {
  color: var(--ow-muted);
  font-size: 13px;
}

.web-inline-error {
  border-radius: 10px;
  background: #fdecec;
  color: #9b2226;
  padding: 10px 12px;
  font-size: 14px;
}

.web-callout {
  border-radius: 12px;
  background: var(--ow-chip-active);
  color: var(--ow-ink-accent);
  padding: 12px 14px;
  font-size: 14px;
}

.web-profile-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  margin: 0 12px 10px;
  font-size: 13px;
}

.web-app-shell .web-age-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
}

.web-app-shell .web-age-consent input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--ow-teal-dark);
}

.web-app-shell .web-age-consent span {
  color: var(--ow-muted);
  font-weight: 400;
  line-height: 1.45;
}

.web-app-shell .web-age-consent a {
  color: var(--ow-teal-dark);
}

.web-message-sync-error {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
  border-radius: 12px;
  background: #fdecec;
  color: #8c1d22;
  padding: 10px 12px;
  font-size: 14px;
}

.web-message-sync-error button,
.web-message-pagination button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--ow-surface);
  color: inherit;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

.web-message-pagination {
  align-self: center;
  margin: 2px 0 8px;
  color: var(--ow-ink-accent);
}

.web-typing-bubble {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 11px 14px;
}

.web-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ow-soft);
  animation: web-typing 1.2s ease-in-out infinite;
}

.web-typing-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.web-typing-bubble span:nth-child(3) {
  animation-delay: 0.3s;
}

.web-app-shell.is-offline .web-composer {
  opacity: 0.6;
}

/* ------------------------------------------------------------------ */
/* Status toast and connection indicator                               */
/* ------------------------------------------------------------------ */

.web-status {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 60;
  width: max-content;
  max-width: min(560px, calc(100% - 28px));
  transform: translateX(-50%);
  border-radius: 999px;
  background: #10242a;
  color: #fff;
  padding: 10px 18px;
  box-shadow: 0 10px 30px rgba(16, 36, 42, 0.28);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.web-status:empty {
  display: none;
}

.web-status[data-type="success"] {
  background: #0f5c4a;
}

.web-status[data-type="error"] {
  border-radius: 14px;
  background: #8c1d22;
}

.web-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ow-muted);
  font-size: 12px;
}

.web-connection::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0b429;
}

.web-connection[data-state="live"]::before {
  background: #1fbf75;
}

.web-connection[data-state="offline"]::before,
.web-connection[data-state="error"]::before {
  background: var(--ow-danger);
}

/* ------------------------------------------------------------------ */
/* Signed-out: authentication                                          */
/* ------------------------------------------------------------------ */

.web-auth {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  min-height: 600px;
}

.web-auth-intro {
  display: grid;
  align-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(145deg, #8de8f3 0%, #7df0c9 100%);
  color: #06313a;
  padding: clamp(28px, 5vw, 56px);
}

.web-auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(6, 49, 58, 0.18);
}

.web-auth-intro h3 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.web-auth-intro > p {
  max-width: 34ch;
  font-size: 17px;
}

.web-auth-points {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.web-auth-points li {
  position: relative;
  padding-left: 28px;
  font-size: 15px;
}

.web-auth-points li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23168fae' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.web-auth-privacy {
  display: flex;
  gap: 10px;
  max-width: 44ch;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  padding: 12px 14px;
  font-size: 13px;
}

.web-auth-privacy .web-i {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.web-auth-card {
  display: grid;
  align-content: center;
  gap: 14px;
  background: var(--ow-surface);
  padding: clamp(24px, 5vw, 56px);
}

.web-auth-form {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  justify-self: center;
}

.web-auth-form h4 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.web-auth-copy {
  color: var(--ow-muted);
}

.web-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 999px;
  background: var(--ow-chip);
  padding: 4px;
}

.web-auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ow-muted);
  font-weight: 600;
}

.web-auth-tabs button.active {
  background: var(--ow-surface);
  color: var(--ow-text);
  box-shadow: 0 2px 8px rgba(16, 36, 42, 0.1);
}

.web-password {
  position: relative;
  display: block;
}

.web-password input {
  padding-right: 70px;
}

.web-reveal {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: var(--ow-chip);
  color: var(--ow-ink-accent);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
}

.web-auth-form .web-link {
  justify-self: center;
}

.web-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--ow-soft);
  font-size: 13px;
}

.web-divider::before,
.web-divider::after {
  content: "";
  height: 1px;
  background: var(--ow-line);
}

.web-check-email {
  justify-items: center;
  text-align: center;
}

.web-check-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ow-chip-active);
  color: var(--ow-teal-dark);
}

.web-check-icon .web-i {
  width: 30px;
  height: 30px;
}

.web-check-email .web-secondary {
  width: 100%;
}

.web-local-badge {
  width: min(100%, 420px);
  justify-self: center;
  border-radius: 12px;
  background: var(--ow-warn-bg);
  color: #6b4d00;
  padding: 10px 14px;
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Signed-in grid                                                      */
/* ------------------------------------------------------------------ */

.web-app-grid {
  height: clamp(560px, calc(100svh - 150px), 880px);
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  position: relative;
}

.web-app-grid.drawer-open {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(320px, 380px);
}

/* Sidebar ------------------------------------------------------------ */

.web-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ow-line);
  background: var(--ow-surface);
}

.web-sidebar-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ow-tint);
  padding: 10px 10px 10px 14px;
}

.web-avatar-button {
  border: 0;
  border-radius: 50%;
  background: none;
  padding: 0;
}

.web-sidebar-title {
  min-width: 0;
  flex: 1;
  display: grid;
}

.web-sidebar-title h3 {
  font-size: 20px;
  font-weight: 800;
}

.web-sidebar-title span {
  overflow: hidden;
  color: var(--ow-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-search {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 6px;
  border-radius: 12px;
  background: var(--ow-surface-2);
  padding: 0 12px;
  color: var(--ow-soft);
}

.web-app-shell .web-search input {
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.web-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 12px 10px;
  scrollbar-width: none;
}

.web-chips button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--ow-chip);
  color: #36515a;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
}

.web-chips button.active {
  background: var(--ow-chip-active);
  color: var(--ow-ink-accent);
  font-weight: 700;
}

.web-chat-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--ow-line);
}

.web-chat-row {
  width: 100%;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--ow-line);
  background: var(--ow-surface);
  color: inherit;
  padding: 11px 14px;
  text-align: left;
}

.web-chat-row:hover {
  background: #f6fbfc;
}

.web-chat-row.active {
  background: #eaf4f6;
}

.web-chat-row .web-avatar {
  width: 50px;
  height: 50px;
}

.web-chat-row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.web-chat-row-main strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-chat-row-main small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ow-muted);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.web-chat-row-main small.typing {
  color: var(--ow-teal-dark);
  font-style: italic;
}

.web-chat-row-meta {
  align-self: start;
  display: grid;
  justify-items: end;
  gap: 6px;
  padding-top: 2px;
}

.web-chat-row-meta time {
  color: var(--ow-soft);
  font-size: 12px;
  white-space: nowrap;
}

.web-chat-row.unread .web-chat-row-meta time {
  color: var(--ow-teal-dark);
  font-weight: 600;
}

.web-badge {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #3fcddc;
  color: #fff;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
}

.web-row-link {
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  text-align: left;
}

.web-sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--ow-line);
  padding: 8px 14px;
}

.web-sidebar-footer .web-link {
  font-size: 13px;
}

/* Empty states ------------------------------------------------------- */

.web-empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 36px 24px;
  color: var(--ow-muted);
  text-align: center;
}

.web-empty-state .web-empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ow-chip-active);
  color: var(--ow-teal-dark);
}

.web-empty-state .web-empty-icon .web-i {
  width: 26px;
  height: 26px;
}

.web-empty-state strong {
  color: var(--ow-text);
  font-size: 16px;
}

.web-empty-state span {
  max-width: 34ch;
  font-size: 14px;
}

.web-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.web-empty {
  color: var(--ow-muted);
  font-size: 14px;
}

.web-call-status-card {
  display: grid;
  gap: 6px;
  margin: 12px;
  border: 1px solid var(--ow-line);
  border-radius: 14px;
  background: var(--ow-surface-2);
  padding: 14px;
}

.web-call-status-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.web-call-status-card[data-ok="false"] strong {
  color: var(--ow-danger);
}

.web-call-status-card span {
  color: var(--ow-muted);
  font-size: 14px;
}

/* Chat panel --------------------------------------------------------- */

.web-chat-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--ow-canvas);
}

.web-chat-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ow-line);
  background: var(--ow-tint);
  padding: 10px 10px 10px 14px;
}

.web-mobile-back {
  display: none;
}

.web-chat-heading {
  min-width: 0;
  flex: 1;
  display: grid;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  text-align: left;
}

.web-chat-heading strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-chat-heading span {
  overflow: hidden;
  color: var(--ow-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-chat-heading span.typing {
  color: var(--ow-teal-dark);
  font-style: italic;
}

.web-chat-panel.no-chat :is(.web-chat-header, .web-privacy-note, .web-translate-bar, .web-composer) {
  display: none !important;
}

.web-privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f1e3b0;
  background: var(--ow-warn-bg);
  color: #5d4a12;
  padding: 7px 14px;
  font-size: 12.5px;
}

.web-privacy-note .web-i {
  width: 15px;
  height: 15px;
}

.web-translate-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--ow-line);
  background: var(--ow-surface);
  padding: 8px 12px;
}

.web-app-shell .web-translate-bar select {
  width: auto;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 14px;
}

.web-translate-bar button {
  min-height: 36px;
  border: 1px solid var(--ow-line-strong);
  border-radius: 999px;
  background: var(--ow-surface);
  color: var(--ow-ink-accent);
  padding: 0 14px;
  font-weight: 600;
}

.web-translate-bar output {
  flex-basis: 100%;
  color: var(--ow-text);
  font-size: 14px;
}

.web-translate-bar output:empty {
  display: none;
}

.web-messages {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  background-color: var(--ow-canvas);
  background-image: radial-gradient(rgba(16, 36, 42, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  padding: 16px clamp(12px, 3vw, 28px) 18px;
  overscroll-behavior: contain;
}

.web-day {
  align-self: center;
  margin: 10px 0 6px;
  border-radius: 10px;
  background: var(--ow-surface);
  color: #45606a;
  padding: 4px 12px;
  box-shadow: 0 1px 2px rgba(16, 36, 42, 0.08);
  font-size: 12.5px;
  font-weight: 500;
}

.web-message {
  display: flex;
  margin-top: 2px;
}

.web-message.mine {
  justify-content: flex-end;
}

.web-message.gap {
  margin-top: 8px;
}

.web-message-bubble {
  max-width: min(560px, 78%);
  min-width: 84px;
  display: grid;
  gap: 4px;
  border-radius: 12px;
  background: var(--ow-bubble-in);
  padding: 7px 10px 5px 12px;
  box-shadow: 0 1px 1.5px rgba(16, 36, 42, 0.1);
  overflow-wrap: anywhere;
}

.web-message.mine .web-message-bubble {
  background: var(--ow-bubble-out);
}

.web-message.pending .web-message-bubble {
  opacity: 0.8;
}

.web-message.failed .web-message-bubble {
  box-shadow: inset 0 0 0 1px rgba(217, 63, 63, 0.45);
}

.web-message-sender {
  color: var(--ow-teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.web-message-text {
  font-size: 15px;
  line-height: 1.42;
  white-space: pre-wrap;
}

.web-message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: var(--ow-soft);
  font-size: 11.5px;
}

.web-ticks {
  color: var(--ow-soft);
  font-size: 12px;
  letter-spacing: -0.2em;
  padding-right: 0.2em;
}

.web-ticks.read {
  color: var(--ow-tick-read);
}

.web-message-failed {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ow-danger);
  font-size: 12.5px;
}

.web-message-failed button {
  border: 0;
  background: none;
  color: var(--ow-danger);
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
}

.web-attachment-image {
  display: block;
  width: min(320px, 100%);
  max-height: 320px;
  border: 0;
  border-radius: 9px;
  background: rgba(16, 36, 42, 0.06);
  padding: 0;
  overflow: hidden;
}

.web-attachment-image img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.web-attachment-image.loading {
  aspect-ratio: 4 / 3;
}

.web-attachment-card {
  width: min(320px, 100%);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(16, 36, 42, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 10px;
}

.web-attachment-card .web-file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ow-chip-active);
  color: var(--ow-teal-dark);
}

.web-attachment-card > div {
  min-width: 0;
  display: grid;
}

.web-attachment-card strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.web-attachment-card button {
  border: 0;
  border-radius: 999px;
  background: var(--ow-surface);
  color: var(--ow-ink-accent);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.web-attachment-card audio,
.web-attachment-card video,
.web-attachment-media {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
}

.web-call-log {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: #45606a;
  padding: 5px 12px;
  font-size: 13px;
}

.web-call-log .web-i {
  width: 15px;
  height: 15px;
}

/* Composer ---------------------------------------------------------- */

.web-composer {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--ow-line);
  background: #f4f7f8;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}

.web-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.web-file-button {
  position: relative;
  display: inline-grid !important;
  cursor: pointer;
}

.web-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.web-file-button:focus-within {
  outline: 2px solid var(--ow-teal-dark);
  outline-offset: 2px;
}

.web-app-shell .web-composer textarea {
  min-height: 42px;
  max-height: 150px;
  flex: 1;
  border: 1px solid transparent;
  border-radius: 21px;
  background: var(--ow-surface);
  padding: 10px 16px;
  line-height: 1.35;
  resize: none;
}

#webVoiceButton.recording {
  background: var(--ow-danger);
  color: #fff;
  animation: web-pulse 1.2s ease-in-out infinite;
}

.web-send {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--ow-teal);
  color: #fff;
  box-shadow: 0 6px 14px rgba(65, 215, 189, 0.35);
}

.web-send .web-i {
  width: 21px;
  height: 21px;
  transform: translateX(-1px);
}

.web-attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--ow-surface);
  padding: 6px 6px 6px 12px;
  color: var(--ow-ink-accent);
  font-size: 14px;
}

.web-attachment-preview span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-attachment-preview .web-icon {
  width: 30px;
  height: 30px;
}

/* No chat selected (desktop) ---------------------------------------- */

.web-chat-panel.no-chat .web-messages {
  justify-content: center;
}

/* Incoming call ------------------------------------------------------ */

.web-incoming-call {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 1100;
  width: min(440px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  border-radius: 18px;
  background: #10242a;
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 18px 44px rgba(16, 36, 42, 0.4);
}

.web-incoming-copy {
  min-width: 0;
  flex: 1;
  display: grid;
}

.web-incoming-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-incoming-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.web-incoming-call .web-round {
  width: 46px;
  height: 46px;
}

.web-ring {
  animation: web-ring 1.4s ease-out infinite;
}

/* Call screen -------------------------------------------------------- */

.web-call-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  background: radial-gradient(circle at 50% 30%, #1b3b44 0%, #0e1f24 70%);
  color: #fff;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom, 0px));
}

.web-call-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
}

.web-media-slot.remote {
  position: absolute;
  inset: 0;
}

.web-media-slot.remote video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.web-media-slot.local {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: clamp(96px, 22%, 170px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.web-media-slot.local:empty,
.web-media-slot.local:has(audio) {
  display: none;
}

.web-media-slot.local video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.web-media-slot audio {
  display: none;
}

.web-call-identity {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.web-call-screen.has-remote-video .web-call-identity {
  align-content: start;
  justify-items: start;
  padding: 14px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.web-call-screen.has-remote-video .web-call-identity .web-avatar {
  display: none;
}

.web-call-identity strong {
  font-size: 22px;
}

.web-call-identity span {
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
}

.web-call-note {
  justify-self: center;
  max-width: 520px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  text-align: center;
}

.web-call-note[data-level="error"] {
  background: rgba(217, 63, 63, 0.3);
}

.web-call-controls {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.web-call-screen:not([data-call-type="video"]) #webCallCamera {
  display: none;
}

/* Drawer ------------------------------------------------------------- */

.web-drawer {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ow-line);
  background: var(--ow-surface);
}

.web-drawer-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--ow-line);
  background: var(--ow-tint);
  padding: 10px 14px 10px 8px;
}

.web-drawer-header div {
  display: grid;
}

.web-drawer-header strong {
  font-size: 17px;
}

.web-drawer-header span {
  color: var(--ow-muted);
  font-size: 13px;
}

.web-drawer-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.web-drawer-panel {
  display: grid;
  gap: 16px;
}

.web-panel-copy {
  color: var(--ow-muted);
  font-size: 14px;
}

.web-avatar-edit {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.web-avatar-edit label {
  position: relative;
  display: inline-flex !important;
}

.web-avatar-edit input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.web-avatar-edit small {
  color: var(--ow-muted);
  font-size: 12px;
}

.web-settings-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--ow-line);
  border-radius: 14px;
}

.web-settings-list button {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--ow-line);
  background: var(--ow-surface);
  color: var(--ow-text);
  padding: 0 14px;
  text-align: left;
}

.web-settings-list button:last-child {
  border-bottom: 0;
}

.web-settings-list button:hover {
  background: var(--ow-surface-2);
}

.web-list-heading {
  color: var(--ow-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.web-list {
  display: grid;
  gap: 2px;
}

.web-list-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 8px;
}

.web-list-item:hover {
  background: var(--ow-surface-2);
}

.web-list-item .web-avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.web-list-item div {
  min-width: 0;
  display: grid;
}

.web-list-item strong,
.web-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-list-item span {
  color: var(--ow-muted);
  font-size: 13px;
}

.web-list-item button {
  min-height: 32px;
  border: 1px solid var(--ow-line-strong);
  border-radius: 999px;
  background: var(--ow-surface);
  color: var(--ow-ink-accent);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.web-list-item button.primary {
  border-color: transparent;
  background: var(--ow-chip-active);
}

.web-check-list {
  display: grid;
  gap: 4px;
}

.web-app-shell .web-check-row,
.web-app-shell .web-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 12px;
  padding: 8px;
  font-size: 14px;
  cursor: pointer;
}

.web-app-shell .web-consent {
  border: 1px solid var(--ow-line-strong);
  background: var(--ow-surface-2);
  padding: 12px;
}

.web-app-shell .web-consent.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.web-app-shell :is(.web-check-row, .web-consent) input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--ow-teal-dark);
  flex: 0 0 auto;
}

.web-app-shell .web-consent span,
.web-app-shell .web-check-row span {
  color: var(--ow-text);
  font-size: 14px;
  font-weight: 500;
}

.web-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.web-ai-quick button {
  min-height: 32px;
  border: 1px solid var(--ow-line-strong);
  border-radius: 999px;
  background: var(--ow-surface);
  color: var(--ow-ink-accent);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.web-ai-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ow-muted);
  font-size: 13px;
}

.web-ai-meta[data-used="true"] {
  color: var(--ow-ink-accent);
}

.web-ai-output {
  display: block;
  border-radius: 14px;
  background: var(--ow-surface-2);
  padding: 14px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.web-ai-output:empty {
  display: none;
}

.web-chat-info {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.web-chat-info strong {
  font-size: 18px;
}

.web-chat-info span {
  color: var(--ow-muted);
  font-size: 14px;
}

.web-chat-info .web-list {
  width: 100%;
  margin-top: 8px;
  text-align: left;
}

body.ow-app-fullscreen {
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Animation                                                           */
/* ------------------------------------------------------------------ */

@keyframes web-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 63, 63, 0.45);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(217, 63, 63, 0);
  }
}

@keyframes web-typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes web-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(65, 215, 189, 0.6);
  }

  100% {
    box-shadow: 0 0 0 14px rgba(65, 215, 189, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .web-app-shell *,
  .web-app-shell *::before,
  .web-app-shell *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

/* Medium widths: the drawer slides over the chat instead of adding a column. */
@media (max-width: 1180px) {
  .web-app-grid.drawer-open {
    grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  }

  .web-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(400px, 100%);
    box-shadow: -18px 0 40px rgba(16, 36, 42, 0.18);
  }
}

@media (max-width: 860px) {
  .web-auth {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .web-auth-intro {
    gap: 12px;
    padding: 24px;
  }

  .web-auth-intro h3 {
    font-size: 24px;
  }

  .web-auth-points,
  .web-auth-logo {
    display: none;
  }
}

/* Phones: iOS-style list-to-chat navigation. */
@media (max-width: 760px) {
  .web-app-section {
    width: 100%;
    margin-bottom: 0;
    padding: 48px 0 0;
  }

  .web-app-section .section-heading {
    padding: 0 16px;
  }

  .web-app-shell {
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: none;
  }

  .web-app-grid,
  .web-app-grid.drawer-open {
    height: calc(100svh - var(--ow-top-offset));
    min-height: 480px;
    grid-template-columns: minmax(0, 1fr);
  }

  .web-app-grid.chat-focused .web-sidebar,
  .web-app-grid:not(.chat-focused) .web-chat-panel {
    display: none;
  }

  .web-sidebar {
    border-right: 0;
  }

  .web-mobile-back {
    display: inline-grid;
    margin-left: -6px;
  }

  .web-chat-header {
    gap: 6px;
    padding: 8px 6px;
  }

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

  .web-call-actions [data-web-panel="ai"] {
    display: none;
  }

  body:has(.web-app-grid.chat-focused) .site-header,
  body:has(.web-drawer:not([hidden])) .site-header {
    display: none;
  }

  /* Opening a chat (or the drawer) pushes a full-screen view, like the iOS app,
     so the sticky site header never squeezes the conversation or composer. */
  .web-app-grid.chat-focused .web-chat-panel,
  .web-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: none;
  }

  .web-message-bubble {
    max-width: 86%;
  }

  .web-status {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 1100;
  }

  .web-call-screen {
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 380px) {
  .web-sidebar-header .web-icon {
    width: 34px;
    height: 34px;
  }

  .web-icon-row {
    gap: 0;
  }
}
