.tickets-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.ticket-form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 32px; }
.ticket-form-card h2 { font-family: 'WeissenhofGrotesk', 'Inter', sans-serif; font-size: 20px; font-weight: 600; margin-bottom: 24px; }
.tickets-list { display: flex; flex-direction: column; gap: 12px; }
.ticket-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  cursor: pointer; transition: all var(--t); text-decoration: none; display: block; color: inherit;
}
.ticket-item:hover {
  background: var(--card-hover); border-color: var(--border-blue); transform: translateX(3px);
}
.ticket-item__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ticket-item__subject { font-size: 14px; font-weight: 600; color: white; }
.ticket-item__meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.ticket-item__num { font-size: 12px; color: var(--blue-light); font-weight: 600; }
/* ── Ticket detail — full-panel chat ── */
#s-ticket-detail {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--header-h) - 126px); /* 80px app-main padding + ~46px back button row */
}
.ticket-detail {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.ticket-detail__header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0;
  flex-wrap: wrap;
}
.ticket-detail__header h2 {
  font-family: 'WeissenhofGrotesk', 'Inter', sans-serif; font-size: 17px; font-weight: 700;
  margin: 0; color: white;
}
.ticket-detail__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* ── Messages scroll area ── */
.messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 10px; min-height: 0;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ── Message bubbles ──
   YOU (user/customer) = RIGHT  →  row-reverse by default
   THEM (admin)        = LEFT   →  row (normal)
── */
.message {
  display: flex; gap: 10px; align-items: flex-end;
  flex-direction: row-reverse; /* user messages on right */
}
.message--admin {
  flex-direction: row; /* admin messages on left */
}
.message__avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.message--admin .message__avatar { background: linear-gradient(135deg, #6d28d9, #4f46e5); }
.message__body { max-width: 72%; display: flex; flex-direction: column; align-items: flex-end; }
.message--admin .message__body { align-items: flex-start; }
.message__meta { font-size: 10px; color: var(--text-dim); margin-bottom: 4px; padding: 0 4px; }
.message__content {
  background: var(--blue-dim); border: 1px solid var(--border-blue);
  border-radius: 16px 16px 4px 16px; /* flat bottom-right = your side */
  padding: 10px 14px; font-size: 13px; line-height: 1.6; color: var(--text);
  word-break: break-word;
}
.message--admin .message__content {
  background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.08);
  border-radius: 16px 16px 16px 4px; /* flat bottom-left = their side */
}

/* ── Reply footer ── */
.reply-form {
  border-top: 1px solid var(--border); padding: 14px 16px;
  display: flex; align-items: flex-end; gap: 10px; flex-shrink: 0;
  background: rgba(255,255,255,0.01);
}
.reply-form .textarea {
  flex: 1; min-height: 40px; max-height: 120px; resize: none;
  padding: 10px 14px; line-height: 1.5; border-radius: 12px;
  font-size: 13px; overflow-y: auto;
}
.reply-send-btn {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--blue); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: white;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
  align-self: flex-end;
}
.reply-send-btn:hover:not(:disabled) { background: var(--blue-mid); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,0.45); }
.reply-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.closed-bar {
  padding: 12px 16px; text-align: center; flex-shrink: 0;
  font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
}
.auth-required-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 60px 40px;
  text-align: center; max-width: 480px; margin: 0 auto;
}
.auth-required-card .lock-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 20px;
}
.auth-required-card h2 { font-family: 'WeissenhofGrotesk', 'Inter', sans-serif; font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.auth-required-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn {
  padding: 6px 14px; border-radius: 100px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--t); font-family: inherit;
}
.filter-btn:hover { border-color: var(--border-blue); color: white; }
.filter-btn.active { background: var(--blue-dim); border-color: var(--border-blue); color: var(--blue-light); }
@media (max-width: 1000px) { .tickets-layout { grid-template-columns: 1fr; } }
