:root {
  --cup-blue: #0d6efd;
  --cup-bg: #f4f7fb;
  --cup-text: #172033;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--cup-bg);
  color: var(--cup-text);
}
.chat-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.chat-header {
  background: var(--cup-blue);
  color: #fff;
  padding: 16px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.chat-header h1 { font-size: 1.15rem; margin: 0; }
.chat-header .sub { opacity:.85; font-size:.82rem; }
.chat-main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 24px 16px;
  overflow-y:auto;
}
.chat-welcome {
  background:#fff;
  border-radius:16px;
  padding:18px;
  margin-bottom:16px;
  box-shadow:0 2px 10px rgba(23,32,51,.06);
}
.messages { display:flex; flex-direction:column; gap:12px; }
.message {
  max-width: 78%;
  border-radius:16px;
  padding:12px 14px;
  white-space:pre-wrap;
  line-height:1.45;
  box-shadow:0 1px 5px rgba(0,0,0,.05);
}
.message.assistant, .message.operator { align-self:flex-start; background:#fff; }
.message.user { align-self:flex-end; background:#0d6efd; color:#fff; }
.message.operator { border-left:4px solid #198754; }
.message .meta { display:block; margin-top:6px; font-size:.72rem; opacity:.6; }
.chat-footer {
  background:#fff;
  border-top:1px solid #dee2e6;
  padding:12px 16px;
}
.chat-form {
  width:min(860px, 100%);
  margin:0 auto;
  display:flex;
  gap:8px;
}
.chat-form input {
  flex:1;
  border:1px solid #ced4da;
  border-radius:999px;
  padding:12px 16px;
  font-size:1rem;
}
.chat-form button {
  border:0;
  border-radius:999px;
  background:#0d6efd;
  color:#fff;
  padding:0 20px;
  font-weight:600;
}
.chat-form button:disabled { opacity:.5; }
.chat-actions {
  width:min(860px, 100%);
  margin:8px auto 0;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.quick-btn {
  border:1px solid #0d6efd;
  background:#fff;
  color:#0d6efd;
  border-radius:999px;
  padding:7px 12px;
}
.status-pill {
  padding:5px 9px;
  border-radius:999px;
  background:rgba(255,255,255,.18);
  font-size:.78rem;
}
.privacy-note {
  width:min(860px, 100%);
  margin:8px auto 0;
  color:#6c757d;
  font-size:.75rem;
}
@media (max-width:640px) {
  .message { max-width:90%; }
  .chat-header { padding:13px 14px; }
}

.attach-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  border: 1px solid #ced4da !important;
  background: #fff !important;
  color: #0d6efd !important;
  padding: 0 !important;
  font-size: 1.2rem;
}
.attach-button:disabled { opacity: .5; }
.upload-status {
  width: min(860px, 100%);
  min-height: 18px;
  margin: 6px auto 0;
  color: #6c757d;
  font-size: .78rem;
}
.attachment-card {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 78%;
  background: #e9f2ff;
  border: 1px solid #b6d4fe;
  border-radius: 14px;
  padding: 10px 12px;
}
.attachment-icon {
  font-size: 1.45rem;
  color: #0d6efd;
}
.attachment-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.attachment-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-info span { font-size: .74rem; color: #6c757d; }
.attachment-download {
  margin-left: auto;
  color: #0d6efd;
  text-decoration: none;
  font-size: 1.1rem;
}
@media (max-width:640px) {
  .attachment-card { max-width: 92%; }
  .chat-form button[type="submit"] { padding: 0 14px; }
}
