/* ==========================================================================
   Support, help centre and messaging
   ========================================================================== */

/* Small utilities used by these pages (safe if also defined elsewhere) */
.mt-sm { margin-top: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
label.check select { margin-left: 4px; }
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.crumbs { color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { color: var(--faint); }

/* ---- Help centre ----------------------------------------------------------- */
.help-hero { border-bottom: 1px solid var(--line); padding: 56px 0 40px; text-align: center;
  background: var(--bg); }
.help-hero .kicker { justify-content: center; }
.help-title { font-size: clamp(1.8rem, 4.5vw, 3rem); letter-spacing: -0.04em; }
.help-search { display: flex; gap: 8px; max-width: 620px; margin: 18px auto 0; }
.help-search input { flex: 1; border-radius: 999px; padding: 14px 20px; font-size: 1.02rem; }
.help-audience { justify-content: center; margin-top: 18px; }
.mid .help-search { margin-left: 0; }

.help-sellers { border-color: rgba(162, 62, 97, 0.3); background: linear-gradient(120deg, var(--accent-soft), var(--bg-2) 55%); }
.help-sellers h2 { font-size: clamp(1.1rem, 2.4vw, 1.5rem); }
.help-guides { list-style: none; counter-reset: guide; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.help-guides li { counter-increment: guide; }
.help-guides a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 14px 52px; position: relative; border: 1px solid var(--line-2); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: rgba(var(--veil-rgb), 0.4); height: 100%; transition: border-color 0.15s; }
.help-guides a::before { content: counter(guide, decimal-leading-zero); position: absolute; left: 14px; top: 14px; font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 700; color: var(--accent-ink); background: var(--accent); width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; }
.help-guides a:hover { border-color: var(--accent); }

.help-popular { display: flex; flex-wrap: wrap; gap: 8px; }
.help-pop { padding: 9px 16px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font-size: 0.92rem; }
.help-pop:hover { border-color: var(--accent); color: var(--accent); }

.help-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.help-cat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.help-cat h3 { font-size: 1.05rem; margin-bottom: 4px; }
.help-cat h3 a { color: var(--ink); text-decoration: none; }
.help-cat h3 a:hover { color: var(--accent); }
.help-cat ul { list-style: none; padding: 0; margin: 10px 0; }
.help-cat li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 0.93rem; }
.help-cat li a { color: var(--ink); text-decoration: none; }
.help-cat li a:hover { color: var(--accent); }

.help-results { display: grid; gap: 10px; margin-top: 16px; }
.help-result { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); text-decoration: none; color: var(--ink); }
.help-result:hover { border-color: var(--accent); }

.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } }
.help-side { position: sticky; top: 88px; display: grid; gap: 16px; }
.help-side .panel + .panel { margin-top: 0; }
.help-related { list-style: none; padding: 0; margin: 0; }
.help-related li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.help-related li:first-child { border-top: 0; padding-top: 0; }
.help-related a { text-decoration: none; }
.help-related[hidden] { display: none; }
.lede-sm { font-size: 1.05rem; }
.help-feedback { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.help-feedback form { margin: 0; }

/* Article typography */
.prose { color: var(--ink-2); font-size: 1rem; line-height: 1.7; max-width: 72ch; }
.prose h2 { font-size: 1.2rem; margin: 1.8em 0 0.6em; color: var(--ink); }
.prose h3 { font-size: 1rem; margin: 1.5em 0 0.5em; color: var(--ink); }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent); }
.prose blockquote { margin: 0 0 1.2em; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote p { margin: 0; color: var(--ink); }
.prose code { font-size: 0.88em; }

/* ---- Contact form & tickets -------------------------------------------------- */
.support-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .support-layout { grid-template-columns: 1fr; } }
.support-side { display: grid; gap: 16px; }
.support-side .panel + .panel { margin-top: 0; }
.support-nudge strong { display: block; margin-bottom: 4px; }
.support-context { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 12px 14px; margin-bottom: 18px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.support-context .muted { width: 100%; }

.ticket-list { display: grid; gap: 10px; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.ticket-row:hover { border-color: var(--line-2); color: var(--ink); }
.ticket-row.needs-you { border-color: var(--warn-line); }

.tstatus { display: inline-block; padding: 3px 10px; border-radius: 999px; font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-2); }
.tstatus-open { color: var(--info); border-color: var(--info-line); background: var(--info-bg); }
.tstatus-awaiting_customer { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.tstatus-resolved { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }

.prio { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.8rem; padding: 3px 8px; border-radius: 6px; background: var(--bg-3); color: var(--muted); }
.prio-urgent { background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.prio-high { background: var(--danger-bg); color: var(--hot); font-weight: 700; }
.prio-low { opacity: 0.7; }

/* ---- Threads (tickets & messages) ------------------------------------------------ */
.thread { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.bubble { max-width: min(560px, 88%); padding: 12px 16px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent-soft); border-color: rgba(162, 62, 97, 0.28); border-bottom-left-radius: 16px; border-bottom-right-radius: 6px; }
.bubble.staff { border-color: var(--info-line); background: var(--info-bg); }
.bubble.staff.mine { align-self: flex-end; }
.bubble.internal { align-self: stretch; max-width: none; background: repeating-linear-gradient(-45deg, var(--warn-bg) 0 10px, transparent 10px 20px), var(--warn-bg); border: 1px dashed var(--warn-line); border-radius: 10px; }
.bubble-meta { display: flex; gap: 10px; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.bubble-meta strong { color: var(--ink); font-weight: 600; }
.bubble.internal .bubble-meta strong { color: var(--warn); }
.bubble-body { overflow-wrap: anywhere; line-height: 1.55; }
.bubble-body a { color: var(--accent); }
.thread-system { text-align: center; padding: 4px 0; }

.safety-notice { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--danger-line); background: var(--danger-bg); color: var(--ink-2); font-size: 0.93rem; }
.safety-notice strong { display: block; color: var(--danger); margin-bottom: 2px; }

.reply-box textarea { min-height: 110px; }

/* ---- Inbox --------------------------------------------------------------------- */
.inbox { display: grid; gap: 8px; }
.inbox-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); position: relative; }
.inbox-row:hover { border-color: var(--line-2); color: var(--ink); }
.inbox-row.unread { border-color: rgba(162, 62, 97, 0.4); background: linear-gradient(90deg, var(--accent-soft), var(--bg-2) 40%); }
.inbox-row.unread .inbox-subject { color: var(--ink); font-weight: 600; }
.inbox-avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: var(--accent); flex-shrink: 0; overflow: hidden; }
.inbox-avatar img { width: 100%; height: 100%; object-fit: cover; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-top { display: flex; justify-content: space-between; gap: 10px; }
.inbox-subject { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 0 4px var(--accent-soft); }
.msg-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 700; margin-left: 4px; }
.chip.active .msg-count { background: var(--accent-ink); color: var(--accent); }

.msg-context { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.msg-context-main { flex: 1; min-width: 0; }

/* ---- Admin: support ------------------------------------------------------------- */
a.stat-link { text-decoration: none; color: var(--ink); transition: border-color 0.15s; }
a.stat-link:hover { border-color: var(--line-2); color: var(--ink); }
a.stat-link.on { border-color: var(--accent); }
.warn-text { color: var(--warn); }
table.data tr.row-overdue td { background: var(--danger-bg); }
table.data tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

.admin-ticket { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .admin-ticket { grid-template-columns: 1fr; } }
.ticket-subject { font-size: 1.3rem; margin: 0; }
.admin-ticket-side { display: grid; gap: 14px; position: sticky; top: 88px; }
.admin-ticket-side .panel { padding: 18px; }
.admin-ticket-side .panel + .panel { margin-top: 0; }
.ctx h3 { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.ctx p { margin: 0 0 8px; }
.ctx-list { list-style: none; padding: 0; margin: 0; }
.ctx-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.ctx-list li:first-child { border-top: 0; padding-top: 0; }
.internal-form { border-style: dashed; border-color: var(--warn-line); }

/* ---- Admin: emails --------------------------------------------------------------- */
.email-meta td:first-child { color: var(--muted); width: 140px; }
.email-meta td:last-child { text-align: left; font-family: var(--font-body); }
.email-preview { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
.email-preview .panel + .panel { margin-top: 0; }
@media (max-width: 980px) { .email-preview { grid-template-columns: 1fr; } }
.email-frame { width: 100%; height: 640px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #f4f2ed; }
.email-text { white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.86rem; color: var(--ink-2); margin: 0; max-height: 640px; overflow: auto; }
