:root { color-scheme: light; --line: #e5e7eb; --text: #1f2937; --muted: #7b8494; --primary: #397ff1; --soft: #f0f1f4; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: #f5f6f8;
  color: var(--text);
}

.support-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.support-panel {
  width: min(760px, 100%);
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  box-shadow: 0 0 36px rgba(31, 41, 55, 0.08);
}

.chat-header { height: 64px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; border-bottom: 1px solid var(--line); padding: 0 12px; text-align: center; font-size: 18px; }
.back-button { border: 0; background: transparent; font-size: 42px; line-height: 1; text-align: left; cursor: pointer; color: #111827; padding: 0; }
.service-bar { min-height: 72px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; background: var(--primary); color: white; }
.service-bar div { display: grid; gap: 4px; }
.service-bar strong { font-size: 16px; }
.service-bar span { font-size: 14px; }
.service-icon { font-size: 26px !important; }

.messages { overflow: auto; padding: 18px 18px 28px; background: #fff; }
.message-row { margin-bottom: 18px; display: flex; flex-direction: column; align-items: flex-start; }
.message-row.customer { align-items: flex-end; }
.sender-name { font-size: 11px; color: var(--muted); margin: 0 4px 5px; }

.message { max-width: min(82%, 540px); padding: 11px 14px; border-radius: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.message.agent { background: var(--soft); color: #20242c; }

.message.customer { background: #76b69e; color: #fff; }
.attachment-image, .attachment-video { display: block; max-width: min(100%, 480px); max-height: 420px; border-radius: 10px; object-fit: contain; background: #111; }
.attachment-link { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 180px; }
.attachment-link strong { font-size: 26px; }
.attachment-caption { margin-top: 8px; }

.chat-form { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; position: relative; }
.tool-row { display: flex; align-items: center; gap: 12px; color: #697386; }
.tool-button { border: 0; background: transparent; padding: 2px; font-size: 24px; line-height: 1; color: #697386; cursor: pointer; }
.character-count { margin-left: auto; font-size: 13px; color: var(--muted); }
.composer-row { display: grid; grid-template-columns: 1fr 48px; gap: 10px; align-items: end; }

.chat-form textarea { width: 100%; border: 0; outline: 0; resize: none; min-height: 52px; max-height: 130px; padding: 11px 6px 4px; font: inherit; line-height: 1.5; }

.send-button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--primary); color: #fff; font-size: 22px; cursor: pointer; }
.send-button:disabled { opacity: .55; cursor: wait; }
.send-state { min-height: 16px; color: #c23b4a; font-size: 12px; }
.emoji-panel { position: absolute; left: 14px; bottom: calc(100% - 4px); width: min(360px, calc(100vw - 28px)); padding: 12px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 12px 36px rgba(15, 23, 42, .16); }
.emoji-panel button { border: 0; background: transparent; font-size: 22px; padding: 4px; cursor: pointer; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .support-panel { width: 100%; box-shadow: none; }
  .message { max-width: 88%; }
  .chat-header { height: 58px; font-size: 17px; }
}
