/* ── Messages page ── */
.messages-panel {
  background: #fff;
  border: 1px solid #e3e3e8;
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.5rem;
  min-height: 520px;
}

.messages-panel-title {
  margin: 0 0 1.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #23254e;
  padding-bottom: .65rem;
  border-bottom: 3px solid #23254e;
  display: inline-block;
}

.messages-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1.5rem;
  border: 1px solid #c8d4f0;
  border-radius: 12px;
  overflow: hidden;
}

.messages-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-width: 140px;
  padding: .85rem 1.75rem;
  font-size: .95rem;
  font-weight: 700;
  color: #3b5bdb;
  background: #fff;
  text-decoration: none;
  border-left: 1px solid #c8d4f0;
  transition: background .15s ease, color .15s ease;
}

.messages-tab:last-child {
  border-left: none;
}

.messages-tab.is-active {
  background: #23254e;
  color: #fff;
  border-color: #23254e;
}

.messages-tab.is-active + .messages-tab {
  border-right: 1px solid #c8d4f0;
}

.messages-tab:hover:not(.is-active) {
  background: #f5f7ff;
  color: #23254e;
}

.messages-tab-label {
  line-height: 1.4;
}

.messages-tab-count {
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.2;
}

.messages-panel-body {
  background: #f3f3f6;
  border: 1px solid #ececf0;
  border-radius: 12px;
  min-height: 360px;
}

.messages-empty {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.messages-empty-text {
  margin: 0 0 1.75rem;
  font-size: 1rem;
  font-weight: 800;
  color: #23254e;
}

.messages-empty-illustration {
  max-width: 280px;
  width: 100%;
  height: auto;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: 1.25rem;
}

.message-card {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.15rem;
}

.message-card-title {
  margin: 0 0 .45rem;
  font-size: .95rem;
  font-weight: 800;
  color: #23254e;
}

.message-card-text {
  margin: 0 0 .5rem;
  font-size: .9rem;
  color: #6b6d86;
  line-height: 1.7;
}

.message-card-date {
  font-size: .8rem;
  color: #8a8a9a;
}

.ticket-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.ticket-panel-lead {
  margin: .35rem 0 1.1rem;
  color: #6b6d86;
  font-size: .9rem;
}

.ticket-new-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #ea580c;
  color: #fff;
  border-radius: 999px;
  padding: .55rem 1rem;
  font-weight: 800;
  text-decoration: none;
  border: 0;
  font-size: .88rem;
}

.ticket-new-btn:hover { background: #c2410c; color: #fff; }

.ticket-list { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; }

.ticket-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: #fff;
  border-radius: 12px;
  padding: .9rem 1rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid #ececf0;
}

.ticket-card.is-unread { border-color: #fdba74; background: #fff7ed; }
.ticket-card-main { flex: 1; min-width: 0; }
.ticket-card-main h3 { margin: 0 0 .25rem; font-size: .95rem; font-weight: 800; color: #23254e; }
.ticket-card-main p { margin: 0 0 .3rem; font-size: .85rem; color: #6b6d86; }
.ticket-card-main small { color: #8a8a9a; font-size: .78rem; }
.ticket-card-status {
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: .25rem .6rem;
  background: #eef2ff;
  color: #3730a3;
}
.ticket-card-status--waiting { background: #fff7ed; color: #c2410c; }
.ticket-card-status--answered { background: #ecfdf5; color: #047857; }
.ticket-card-status--closed { background: #f5f5f4; color: #57534e; }

.ticket-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #6b6d86;
  text-decoration: none;
  font-size: .88rem;
  margin-bottom: .75rem;
}
.ticket-thread-head { margin-bottom: 1rem; }
.ticket-thread-meta { margin: .25rem 0 0; color: #8a8a9a; font-size: .85rem; }
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  background: #f3f3f6;
  border-radius: 12px;
  padding: 1rem;
  min-height: 220px;
}
.ticket-bubble {
  max-width: min(92%, 36rem);
  border-radius: 16px;
  padding: .75rem .9rem;
}
.ticket-bubble p { margin: 0; line-height: 1.75; font-size: .92rem; }
.ticket-bubble-meta { font-size: .72rem; color: #8a8a9a; margin-bottom: .3rem; }
.ticket-bubble--me { align-self: flex-start; background: #fff; border: 1px solid #ececf0; }
.ticket-bubble--staff { align-self: flex-end; background: #23254e; color: #fff; }
.ticket-bubble--staff .ticket-bubble-meta { color: #c7d2fe; }
.ticket-reply {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-top: 1rem;
}
.ticket-closed-note { margin: 1rem 0 0; color: #78716c; }
.ticket-form .form-control, .ticket-reply .form-control, .ticket-compose-input { border-radius: 12px; }

.ticket-hub-alert {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  padding: .7rem 1rem;
  border-radius: 12px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 700;
  font-size: .88rem;
}

.ticket-hub-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #fff7ed;
  color: #ea580c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.ticket-hub-empty-lead {
  margin: 0 0 1.25rem;
  color: #6b6d86;
  font-size: .9rem;
}

.ticket-card-category {
  font-size: .78rem !important;
  color: #ea580c !important;
  font-weight: 700;
}

.ticket-card-preview {
  color: #8a8a9a !important;
}

.ticket-thread-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}

.ticket-status-badge {
  font-size: .75rem;
  font-weight: 800;
  border-radius: 999px;
  padding: .3rem .7rem;
  background: #eef2ff;
  color: #3730a3;
}

.ticket-status-badge--waiting { background: #fff7ed; color: #c2410c; }
.ticket-status-badge--answered { background: #ecfdf5; color: #047857; }
.ticket-status-badge--closed { background: #f5f5f4; color: #57534e; }

.ticket-thread {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  scroll-behavior: smooth;
}

.ticket-bubble-text { line-height: 1.8; font-size: .92rem; }

.ticket-spec-card {
  margin: .35rem 0 .6rem;
  padding: .7rem .8rem;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
}

.ticket-bubble--me .ticket-spec-card {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #7c2d12;
}

.ticket-spec-card-title {
  font-size: .8rem;
  font-weight: 800;
  margin-bottom: .45rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.ticket-spec-list {
  margin: 0;
  display: grid;
  gap: .35rem;
}

.ticket-spec-list div {
  display: flex;
  gap: .5rem;
  font-size: .84rem;
}

.ticket-spec-list dt {
  min-width: 5.5rem;
  font-weight: 700;
  margin: 0;
}

.ticket-spec-list dd {
  margin: 0;
  flex: 1;
}

.ticket-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .55rem;
}

.ticket-attachment {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.2);
}

.ticket-bubble--me .ticket-attachment { border-color: #e7e5e4; }

.ticket-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ticket-compose { margin-top: 1rem; }

.ticket-chat-compose { margin: 0; }

.ticket-chat-compose-inner {
  border: 1px solid #e3e3e8;
  border-radius: 18px;
  background: #f8fafc;
  padding: .65rem .75rem .55rem;
}

.ticket-chat-input {
  width: 100%;
  border: 0;
  background: transparent;
  resize: vertical;
  min-height: 88px;
  font: inherit;
  color: #23254e;
  line-height: 1.75;
  padding: .35rem .15rem;
}

.ticket-chat-input:focus {
  outline: none;
}

.ticket-chat-compose-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .35rem;
  padding-top: .45rem;
  border-top: 1px solid #ececf0;
}

.ticket-chat-attach {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e3e3e8;
  color: #23254e;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}

.ticket-chat-send {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
}

.ticket-chat-send:hover { filter: brightness(1.05); }

.ticket-compose-box {
  border: 1px solid #e3e3e8;
  border-radius: 16px;
  background: #fff;
  padding: .75rem;
}

.ticket-compose-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}

.ticket-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  background: #f5f5f8;
  color: #23254e;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}

.ticket-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.ticket-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .6rem;
}

.ticket-file-preview-item {
  width: 72px;
  text-align: center;
}

.ticket-file-preview-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ececf0;
}

.ticket-file-preview-item span {
  display: block;
  margin-top: .2rem;
  font-size: .68rem;
  color: #8a8a9a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-logged-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed, #fff);
  border: 1px solid #fed7aa;
}

.ticket-logged-banner p {
  margin: .25rem 0 0;
  color: #78716c;
  font-size: .86rem;
}

.ac-cta--ghost {
  background: #fff;
  color: #ea580c;
  border: 1px solid #fdba74;
  white-space: nowrap;
}

.ac-cta--ghost:hover { background: #fff7ed; color: #c2410c; }

.ac-guest-login-hint {
  margin: 0 0 .75rem;
  font-size: .86rem;
  color: #78716c;
}

.ticket-bubble--system {
  align-self: center;
  max-width: 92%;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
}

.ticket-bubble--system .ticket-bubble-meta { color: #2563eb; }

.ticket-pro-fields { margin-bottom: .85rem; }

.ticket-pro-row {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: .65rem;
  margin-bottom: .65rem;
}

.ticket-pro-field label {
  font-size: .82rem;
  font-weight: 700;
  color: #23254e;
  margin-bottom: .25rem;
}

.ticket-form-body {
  padding: 1.25rem;
  background: #fff;
  border-radius: 12px;
}

@media (max-width: 575.98px) {
  .ticket-pro-row { grid-template-columns: 1fr; }
  .ticket-card { align-items: flex-start; }
  .ticket-thread { padding: .75rem; max-height: 50vh; }
  .ticket-bubble { max-width: 100%; }
  .ticket-panel-head { flex-direction: column; align-items: stretch; }
  .ticket-logged-banner { flex-direction: column; align-items: flex-start; }
  .ticket-compose-actions .ticket-new-btn { margin-inline-start: auto; }
}
