:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #171b24;
  --panel-2: #1f2430;
  --line: rgba(255,255,255,0.09);
  --text: #f5f6f8;
  --muted: #99a4b4;
  --gold: #c9a84c;
  --gold-2: #f0d987;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --shadow: 0 22px 70px rgba(0,0,0,0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(201,168,76,0.18), transparent 30rem),
    radial-gradient(circle at 100% 18%, rgba(72,95,145,0.14), transparent 24rem),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
}

.screen {
  min-height: 100vh;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

.auth-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 17px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(201,168,76,0.18));
}

.brand-kicker, .eyebrow {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

.brand-lockup h1,
.app-header h1 {
  margin-top: 0.22rem;
  font-size: clamp(1.55rem, 8vw, 2.25rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.login-card,
.hero-card,
.section-card,
.loading-card,
.metric-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(31,36,48,0.94), rgba(23,27,36,0.94));
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 1.1rem;
  display: grid;
  gap: 0.95rem;
}

label { display: grid; gap: 0.45rem; }
label span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(5,8,14,0.52);
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
}
textarea { resize: none; line-height: 1.35; }
input:focus,
textarea:focus { border-color: rgba(201,168,76,0.7); box-shadow: 0 0 0 4px rgba(201,168,76,0.12); }

.primary-btn,
.icon-btn {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 900;
}

.primary-btn {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #11131a;
  box-shadow: 0 14px 32px rgba(201,168,76,0.22);
}
.primary-btn:disabled { opacity: 0.7; cursor: wait; }
.primary-btn.compact {
  width: auto;
  min-height: 2.6rem;
  padding: 0.65rem 1rem;
  white-space: nowrap;
}

.form-error {
  min-height: 1.1rem;
  color: var(--red);
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-note {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  padding: 0 0.25rem;
}

.app-store-card {
  border: 1px solid rgba(201,168,76,0.24);
  background: rgba(201,168,76,0.08);
  border-radius: 20px;
  padding: 1rem;
  text-align: center;
}

.app-store-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.app-store-card img {
  display: block;
  width: 160px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 0;
}

.main-screen {
  padding-bottom: calc(5.4rem + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.25rem 0 1rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  color: var(--muted);
}

.content { display: grid; gap: 1rem; }

.loading-card {
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(201,168,76,0.25);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-card {
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-copy { min-width: 0; }
.hero-copy h2 {
  margin-top: 0.35rem;
  font-size: 1.35rem;
  line-height: 1.06;
  letter-spacing: -0.035em;
}
.hero-copy p {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.metric-card {
  cursor: pointer;
  text-align: left;
  padding: 1rem;
  color: var(--text);
}
.metric-icon { font-size: 1.35rem; }
.metric-card strong {
  display: block;
  margin-top: 0.55rem;
  font-size: 1.75rem;
  letter-spacing: -0.05em;
}
.metric-card span:last-child {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.section-card { padding: 1.05rem; }
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.section-heading h2 { font-size: 1rem; }
.section-heading span { color: var(--muted); font-size: 0.78rem; }

.task-list { display: grid; gap: 0.65rem; }
.task-row {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.045);
  color: var(--text);
  padding: 0.9rem;
}
.task-row strong { display: block; font-size: 0.95rem; }
.task-row span { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.78rem; }
.empty-copy { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.empty-state {
  min-height: 15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  color: var(--muted);
}
.empty-state h2 { color: var(--text); font-size: 1.2rem; }
.empty-state p { max-width: 22rem; line-height: 1.5; font-size: 0.9rem; }
.empty-icon { font-size: 2.6rem; }

.text-btn {
  border: 0;
  background: transparent;
  color: var(--gold-2);
  font-size: 0.8rem;
  font-weight: 900;
  padding: 0.35rem 0;
  cursor: pointer;
}

.messages-shell,
.review-shell {
  display: grid;
  gap: 1rem;
}

.messages-panel {
  min-height: calc(100vh - 9.2rem - env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(31,36,48,0.94), rgba(23,27,36,0.94));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.messages-heading {
  padding: 1rem 1rem 0;
}

.mini-loading {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.contact-list {
  display: grid;
  gap: 0.15rem;
  padding: 0 0.65rem 0.8rem;
}

.contact-row {
  width: 100%;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
  padding: 0.8rem 0.65rem;
  cursor: pointer;
}
.contact-row:active { background: rgba(255,255,255,0.045); }

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(255,255,255,0.08));
  border: 1px solid rgba(201,168,76,0.18);
  color: var(--gold-2);
  font-weight: 900;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.contact-main { min-width: 0; }
.contact-name {
  font-weight: 900;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-preview {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-meta {
  display: grid;
  justify-items: end;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
}
.unread-pill {
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.42rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #11131a;
  font-size: 0.72rem;
  font-weight: 900;
}

.thread-panel {
  display: flex;
  flex-direction: column;
}

.thread-header {
  display: grid;
  grid-template-columns: 36px 46px 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
}
.back-btn,
.attach-btn,
.send-btn {
  border: 0;
  cursor: pointer;
  font-weight: 900;
}
.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: var(--gold-2);
  font-size: 1.8rem;
  line-height: 1;
}
.thread-title-wrap { min-width: 0; }
.thread-title-wrap h2 {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-title-wrap p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-messages {
  flex: 1;
  min-height: 16rem;
  max-height: calc(100vh - 18.5rem - env(safe-area-inset-bottom));
  overflow-y: auto;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.bubble {
  max-width: 86%;
  border-radius: 20px;
  padding: 0.78rem 0.9rem;
  line-height: 1.42;
  font-size: 0.92rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.client {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #11131a;
  border-bottom-right-radius: 7px;
}
.bubble.staff,
.bubble.agent {
  align-self: flex-start;
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom-left-radius: 7px;
}
.bubble-meta {
  margin-top: 0.38rem;
  font-size: 0.68rem;
  opacity: 0.68;
}
.attachment-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.attachment-link {
  display: block;
  width: 100%;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.message-composer {
  border-top: 1px solid var(--line);
  padding: 0.65rem;
  background: rgba(15,17,23,0.72);
}
.composer-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0.5rem;
  align-items: end;
}
.attach-btn {
  height: 40px;
  border-radius: 15px;
  background: rgba(255,255,255,0.08);
  color: var(--gold-2);
  font-size: 1.2rem;
}
.send-btn {
  min-height: 40px;
  border-radius: 15px;
  padding: 0 0.85rem;
  background: var(--gold);
  color: #11131a;
}
.send-btn:disabled { opacity: 0.7; cursor: wait; }
.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.file-chip {
  border-radius: 999px;
  background: rgba(201,168,76,0.12);
  color: var(--gold-2);
  border: 1px solid rgba(201,168,76,0.2);
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  max-width: 100%;
}

.review-list {
  display: grid;
  gap: 0.65rem;
  padding: 0 0.85rem 0.9rem;
}

.review-card {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.045);
  color: var(--text);
  text-align: left;
  padding: 1rem;
  cursor: pointer;
}
.review-card strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.review-card p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 0.7rem;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  background: rgba(201,168,76,0.12);
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 900;
}
.status-chip.green { background: rgba(62,207,142,0.12); color: var(--green); }
.status-chip.red { background: rgba(255,107,107,0.12); color: var(--red); }

.review-detail-panel {
  display: flex;
  flex-direction: column;
}
.review-detail-scroll {
  flex: 1;
  max-height: calc(100vh - 14rem - env(safe-area-inset-bottom));
  overflow-y: auto;
  padding: 1rem;
}
.detail-stack { display: grid; gap: 0.9rem; }
.detail-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.045);
  padding: 1rem;
}
.detail-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}
.detail-card p,
.consent-copy {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.summary-grid {
  display: grid;
  gap: 0.5rem;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.summary-row strong { color: var(--text); }
.action-stack {
  display: grid;
  gap: 0.6rem;
}
.secondary-btn,
.danger-btn {
  width: 100%;
  min-height: 2.8rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 900;
  cursor: pointer;
}
.secondary-btn {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}
.danger-btn {
  background: rgba(255,107,107,0.1);
  color: #ffb4b4;
  border-color: rgba(255,107,107,0.24);
}
.secondary-btn:disabled,
.danger-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
.signature-box {
  display: grid;
  gap: 0.7rem;
}
.signature-box input {
  font-family: "Brush Script MT", "Snell Roundhand", cursive;
  font-size: 1.55rem;
  letter-spacing: 0.01em;
}
.review-note {
  min-height: 7rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.9rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  width: min(calc(100% - 2rem), 470px);
  border: 1px solid rgba(201,168,76,0.28);
  border-radius: 18px;
  background: rgba(25, 29, 39, 0.96);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
  color: var(--text);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(18px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.62);
}

.modal-card {
  width: min(100%, 500px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(31,36,48,0.98), rgba(23,27,36,0.98));
  box-shadow: 0 24px 80px rgba(0,0,0,0.56);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}
.modal-card h2 { font-size: 1.2rem; }
.modal-card p { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 1.5rem), 500px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.45rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  background: rgba(17,20,29,0.88);
  box-shadow: 0 18px 60px rgba(0,0,0,0.48);
  backdrop-filter: blur(18px);
}

.nav-btn {
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  padding: 0.62rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.nav-btn span { display: block; font-size: 1rem; margin-bottom: 0.16rem; }
.nav-btn.active {
  background: rgba(201,168,76,0.14);
  color: var(--gold-2);
}

@media (min-width: 700px) {
  body { background-color: #0b0d12; }
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* Phone-native secure messages */
#view-messages.content {
  gap: 0;
}

#view-messages .messages-shell {
  min-height: calc(100vh - 10.2rem - env(safe-area-inset-bottom));
}

.messages-inbox,
.chat-screen {
  min-height: calc(100vh - 10.2rem - env(safe-area-inset-bottom));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 30px;
  background:
    radial-gradient(circle at 18% 0%, rgba(201,168,76,0.12), transparent 16rem),
    linear-gradient(180deg, rgba(22,26,36,0.96), rgba(13,16,23,0.98));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.messages-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1rem 0.7rem;
}
.messages-topbar h2 {
  margin-top: 0.25rem;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.055em;
}
.refresh-circle {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  background: rgba(255,255,255,0.075);
  color: var(--gold-2);
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}
.message-search-shell {
  min-height: 2.55rem;
  margin: 0 0.85rem 0.7rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  background: rgba(255,255,255,0.065);
  color: rgba(245,246,248,0.48);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
}
.message-search-shell span {
  color: rgba(245,246,248,0.35);
  font-size: 1.15rem;
}

.imessage-list {
  padding: 0 0.45rem 0.9rem;
  gap: 0;
}
.imessage-contact {
  position: relative;
  grid-template-columns: 52px 1fr auto;
  gap: 0.72rem;
  border-radius: 0;
  padding: 0.82rem 0.55rem 0.82rem 0.6rem;
}
.imessage-contact + .imessage-contact::before {
  content: '';
  position: absolute;
  left: 4.65rem;
  right: 0.45rem;
  top: 0;
  height: 1px;
  background: rgba(255,255,255,0.075);
}
.imessage-contact:active {
  background: rgba(255,255,255,0.052);
  border-radius: 18px;
}
.imessage-contact .avatar,
.chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 0.95rem;
}
.imessage-contact.has-unread .contact-name {
  color: #fff;
}
.imessage-contact.has-unread .contact-preview {
  color: rgba(245,246,248,0.82);
  font-weight: 800;
}
.contact-line,
.contact-preview-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}
.contact-line {
  justify-content: space-between;
}
.contact-time {
  flex: 0 0 auto;
  color: rgba(153,164,180,0.82);
  font-size: 0.72rem;
  font-weight: 800;
}
.contact-preview-line {
  margin-top: 0.2rem;
  color: var(--muted);
}
.contact-preview-line .contact-preview {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.chevron {
  flex: 0 0 auto;
  color: rgba(153,164,180,0.55);
  font-size: 1.25rem;
  line-height: 1;
}
.imessage-contact > .unread-pill {
  align-self: center;
  justify-self: end;
  box-shadow: 0 0 0 4px rgba(201,168,76,0.12);
}

.chat-screen {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% -8%, rgba(201,168,76,0.13), transparent 13rem),
    linear-gradient(180deg, rgba(17,20,29,0.98), rgba(8,10,15,0.99));
}
.chat-header {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.075);
  background: rgba(17,20,29,0.84);
  backdrop-filter: blur(18px);
}
.chat-back {
  background: transparent;
  color: var(--gold-2);
  font-size: 2.05rem;
}
.chat-person {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.72rem;
}
.chat-person .thread-title-wrap h2 {
  font-size: 1.02rem;
}
.chat-person .thread-title-wrap p {
  color: rgba(153,164,180,0.82);
}

.chat-transcript {
  min-height: 0;
  max-height: none;
  padding: 0.9rem 0.75rem 0.95rem;
  gap: 0.36rem;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    transparent;
  background-size: 100% 44px;
}
.message-day-divider {
  display: flex;
  justify-content: center;
  margin: 0.45rem 0 0.7rem;
}
.message-day-divider span {
  border-radius: 999px;
  background: rgba(255,255,255,0.075);
  color: rgba(245,246,248,0.58);
  padding: 0.25rem 0.58rem;
  font-size: 0.68rem;
  font-weight: 900;
}
.message-row {
  display: grid;
  gap: 0.18rem;
}
.message-row.client {
  justify-items: end;
}
.message-row.staff,
.message-row.agent {
  justify-items: start;
}
.message-row .bubble {
  max-width: min(82%, 22rem);
  border-radius: 21px;
  padding: 0.66rem 0.86rem;
  font-size: 0.95rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}
.message-row.client .bubble {
  background: linear-gradient(135deg, #c9a84c, #f1dd90);
  color: #11131a;
  border-bottom-right-radius: 6px;
}
.message-row.staff .bubble,
.message-row.agent .bubble {
  background: rgba(255,255,255,0.105);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.message-row .bubble-meta {
  margin: 0 0.42rem 0.34rem;
  color: rgba(153,164,180,0.72);
  font-size: 0.66rem;
}
.bubble-body:empty {
  display: none;
}
.chat-empty {
  min-height: 100%;
}

.chat-composer {
  border-top: 1px solid rgba(255,255,255,0.075);
  padding: 0.58rem 0.68rem max(0.58rem, env(safe-area-inset-bottom));
  background: rgba(17,20,29,0.92);
  backdrop-filter: blur(18px);
}
.imessage-composer-row {
  grid-template-columns: 38px 1fr 38px;
  gap: 0.48rem;
  align-items: end;
}
.imessage-composer-row textarea {
  min-height: 38px;
  max-height: 120px;
  padding: 0.58rem 0.86rem;
  border-radius: 19px;
  border-color: rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.07);
}
.imessage-composer-row .attach-btn,
.imessage-composer-row .send-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
}
.imessage-composer-row .send-btn {
  font-size: 1.2rem;
  line-height: 1;
}
.chat-composer .form-error {
  min-height: 0;
  margin-top: 0.28rem;
}
.chat-composer .composer-attachments {
  padding: 0 0.2rem;
}
.chat-composer .file-chip,
.attachment-link {
  backdrop-filter: blur(10px);
}
.attachment-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.attachment-link strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
