/* Support centre + ticket thread (views/support.ejs, views/support-ticket.ejs, partials/support-upload.ejs) */
.sp-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.sp-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; }
.sp-card + .sp-card { margin-top: 20px; }
.sp-card h2 { font-size: 1.5rem; margin: 0 0 6px; }
.sp-card h3 { font-size: 1.1rem; margin: 0 0 8px; }
.sp-lead { color: var(--text-secondary); margin: 0 0 24px; line-height: 1.6; }
.sp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sp-card .form-group textarea { resize: vertical; min-height: 140px; }
.sp-card .form-group .sp-err { display: block; color: #F87171; font-size: 13px; margin-top: 6px; }
.sp-card .form-group.has-error input, .sp-card .form-group.has-error textarea { border-color: rgba(248, 113, 113, 0.6); }
.sp-note { color: var(--text-muted); font-size: 13px; margin: 12px 0 0; }
.sp-alert { border-radius: var(--radius); padding: 14px 18px; margin: 0 0 20px; font-size: 15px; line-height: 1.5; display: flex; gap: 10px; align-items: flex-start; }
.sp-alert i { margin-top: 3px; }
.sp-alert-ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.35); color: #34D399; }
.sp-alert-err { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); color: #F87171; }
.sp-alert[hidden] { display: none; }
.sp-btn-wide { width: 100%; justify-content: center; padding: 16px; }
.sp-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Upload */
.sp-drop { border: 1.5px dashed rgba(96, 165, 250, 0.45); border-radius: var(--radius); padding: 18px; text-align: center; background: rgba(59, 130, 246, 0.04); transition: var(--transition); }
.sp-drop.is-over { background: rgba(59, 130, 246, 0.12); border-color: var(--primary-light); }
.sp-drop-btn { display: inline-flex; align-items: center; gap: 8px; background: rgba(59, 130, 246, 0.15); color: var(--primary-light); border: 1px solid rgba(59, 130, 246, 0.4); border-radius: 10px; padding: 10px 18px; font: 600 14px var(--font); cursor: pointer; }
.sp-drop-btn:hover { background: rgba(59, 130, 246, 0.25); }
.sp-drop-or { color: var(--text-muted); font-size: 14px; margin-left: 8px; }
.sp-drop-hint { color: var(--text-muted); font-size: 12.5px; margin: 10px 0 0; line-height: 1.5; }
.form-group label.sp-drop-btn { display: inline-flex; width: auto; margin: 0; color: var(--primary-light); font-size: 14px; font-weight: 600; position: relative; }
.form-group .sp-drop input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0; }
.sp-drop-btn { cursor: pointer; }
.sp-drop-btn:focus-within { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.sp-files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.sp-file { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; text-align: left; }
.sp-file-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: rgba(255, 255, 255, 0.06); display: flex; align-items: center; justify-content: center; color: #F87171; font-size: 20px; }
.sp-file-thumb.is-img { color: var(--primary-light); }
.sp-file-meta { flex: 1; min-width: 0; }
.sp-file-name { display: block; color: var(--text-primary); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-file-size { color: var(--text-muted); font-size: 12px; }
.sp-file-rm { background: none; border: 0; color: var(--text-secondary); cursor: pointer; padding: 8px; border-radius: 8px; font-size: 16px; }
.sp-file-rm:hover { color: #F87171; background: rgba(239, 68, 68, 0.1); }

/* Sidebar */
.sp-side-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.sp-side-list a { color: var(--text-primary); text-decoration: none; }
.sp-side-list i { color: var(--primary-light); width: 20px; }
.sp-faq details { border-top: 1px solid var(--border); padding: 12px 0; }
.sp-faq details:first-of-type { border-top: 0; }
.sp-faq summary { cursor: pointer; color: var(--text-primary); font-weight: 500; font-size: 15px; line-height: 1.45; list-style: none; display: flex; gap: 10px; justify-content: space-between; }
.sp-faq summary::-webkit-details-marker { display: none; }
.sp-faq summary::after { content: '+'; color: var(--primary-light); font-weight: 700; }
.sp-faq details[open] summary::after { content: '−'; }
.sp-faq .sp-faq-a { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin-top: 8px; }
.sp-faq .sp-faq-a img { max-width: 100%; height: auto; }
.sp-link { color: var(--primary-light); text-decoration: none; font-weight: 600; }
.sp-link:hover { text-decoration: underline; }

/* Ticket thread */
.sp-ticket-head { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sp-ticket-head h1 { font-size: 1.6rem; margin: 0; word-break: break-word; }
.sp-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 100px; padding: 6px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sp-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sp-st-open, .sp-st-waiting_staff { background: rgba(59, 130, 246, 0.14); color: #60A5FA; }
.sp-st-waiting_customer { background: rgba(245, 158, 11, 0.14); color: #FBBF24; }
.sp-st-resolved { background: rgba(16, 185, 129, 0.14); color: #34D399; }
.sp-st-closed { background: rgba(156, 163, 175, 0.16); color: #D1D5DB; }
.sp-ticket-num { color: var(--text-muted); font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-thread { display: grid; gap: 16px; margin: 24px 0; }
.sp-msg { border-radius: 16px; padding: 18px 20px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); max-width: 88%; }
.sp-msg-customer { margin-left: auto; background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.25); }
.sp-msg-staff { background: rgba(16, 185, 129, 0.07); border-color: rgba(16, 185, 129, 0.22); }
.sp-msg-system { max-width: 100%; text-align: center; background: transparent; border-style: dashed; color: var(--text-secondary); font-size: 14px; }
.sp-msg-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; flex-wrap: wrap; }
.sp-msg-head strong { color: var(--text-primary); font-weight: 600; }
.sp-msg-body { color: var(--text-primary); line-height: 1.65; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-att { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.sp-att-img { display: block; width: 132px; height: 100px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-light); background: rgba(0, 0, 0, 0.3); }
.sp-att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-att-doc { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-light); background: rgba(0, 0, 0, 0.25); text-decoration: none; }
.sp-att-doc i { font-size: 26px; color: #F87171; flex: none; }
.sp-att-doc.is-heic i { color: var(--primary-light); }
.sp-att-doc span { min-width: 0; }
.sp-att-doc b { display: block; color: var(--text-primary); font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-att-doc small { color: var(--text-muted); font-size: 12px; }
.sp-details { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.sp-details dt { color: var(--text-muted); }
.sp-details dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.sp-btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: #34D399; border: 1px solid rgba(16, 185, 129, 0.45); border-radius: 10px; padding: 12px 18px; font: 600 14px var(--font); cursor: pointer; }
.sp-btn-ghost:hover { background: rgba(16, 185, 129, 0.1); }

/* Contact page card */
.sp-contact-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(6, 182, 212, 0.08)); border: 1px solid rgba(59, 130, 246, 0.4); border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 28px; }
.sp-contact-card .sp-cc-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(59, 130, 246, 0.2); color: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.sp-contact-card .sp-cc-text { flex: 1; min-width: 220px; }
.sp-contact-card h2 { font-size: 1.3rem; margin: 0 0 4px; }
.sp-contact-card p { margin: 0; color: var(--text-secondary); line-height: 1.55; }
.sp-contact-card .sp-cc-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

@media (max-width: 900px) {
  .sp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sp-card { padding: 22px 18px; }
  .sp-row { grid-template-columns: 1fr; }
  .sp-msg { max-width: 100%; padding: 14px 16px; }
  .sp-drop-or { display: block; margin: 8px 0 0; }
  .sp-contact-card { padding: 20px; gap: 14px; }
  .sp-contact-card .sp-cc-icon { display: none; }
  .sp-contact-card .sp-cc-text { min-width: 0; }
  .sp-contact-card .sp-cc-actions, .sp-contact-card .sp-cc-actions .btn-primary { width: 100%; justify-content: center; }
  .sp-att-img { width: calc(50% - 5px); }
  .sp-att-doc { min-width: 0; max-width: 100%; width: 100%; }
  .sp-details { grid-template-columns: 1fr; gap: 2px; }
  .sp-details dd { margin-bottom: 8px; }
}
