/* ==========================================================================
   Support tickets (support.html) — uses the theme.css tokens.
   ========================================================================== */
.sp{max-width:1180px;margin:0 auto;padding:150px 4.5% 80px}
.sp svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sp [hidden]{display:none!important}
.sp-loading{padding:60px 0;text-align:center;color:var(--muted)}
.sp h1,.sp h2{color:var(--ink)}
.sp h2:focus,.sp h1:focus{outline:0}
.sp :is(h1,h2)[tabindex="-1"]:focus-visible{outline:0}
.sp :is(input,select,textarea):focus-visible{outline:0}
.sp .primary svg,.sp .btn-outline svg{width:18px;height:18px;margin-right:8px;flex:none}
.sp .btn-outline{text-decoration:none;color:var(--ink)}
.sp .primary{text-decoration:none}

/* ---------- Logged out ---------- */
.sp-guest-card{max-width:720px;margin:0 auto;padding:48px 52px;background:var(--paper);border:1px solid var(--line);border-radius:24px;text-align:center}
.sp-guest-card h1{font-size:clamp(36px,5vw,56px);line-height:1;margin:6px 0 14px}
.sp-eyebrow{margin:18px 0 0;font-size:13px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.sp-guest-lead{max-width:520px;margin:0 auto;font-size:16px;line-height:1.6;color:var(--ink-2)}
.sp-guest-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;margin:26px 0 34px}
.sp-guest-actions>*{min-width:160px}
.sp-guest-points{list-style:none;margin:0;padding:26px 0 0;border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(3,1fr);gap:18px;text-align:left}
.sp-guest-points li{display:flex;gap:12px;font-size:14px;line-height:1.5;color:var(--muted)}
.sp-guest-points svg{width:22px;height:22px;flex:none;color:var(--ink);margin-top:1px}
.sp-guest-points strong{display:block;color:var(--ink);font-weight:600}

/* Brand avatar (the "J" logo) */
.sp-brand-avatar{display:inline-grid;place-items:center;width:32px;height:32px;border-radius:50%;background:var(--brand);overflow:hidden;flex:none;box-shadow:0 0 0 1px #17181c1f}
.sp-brand-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.sp-brand-avatar-lg{width:64px;height:64px;box-shadow:0 0 0 4px var(--paper),0 0 0 5px var(--line-2)}

/* ---------- Page head ---------- */
.sp-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:22px}
.sp-head h1{font-size:clamp(32px,4vw,48px);line-height:1;margin:0 0 6px}
.sp-head p{margin:0;font-size:15px;color:var(--ink-2)}
.sp-new-btn{flex:none}

/* ---------- Two panes ---------- */
.sp-grid{display:grid;grid-template-columns:minmax(300px,370px) minmax(0,1fr);gap:16px;height:clamp(560px,calc(100vh - 290px),860px)}
.sp-list-pane,.sp-detail-pane{min-height:0;background:var(--paper);border:1px solid var(--line);border-radius:20px;display:flex;flex-direction:column;overflow:hidden}
.sp-none .sp-grid{grid-template-columns:minmax(0,1fr)}
.sp-none .sp-list-pane{display:none}
.sp-grid:has(.sp-form){height:auto;min-height:clamp(560px,calc(100vh - 290px),860px)}
.sp-grid:has(.sp-form) .sp-list-pane{max-height:860px}
.sp-detail-pane:has(.sp-form) .sp-form{overflow:visible}

/* Filters */
.sp-filters{display:flex;flex-wrap:wrap;gap:6px;padding:12px;border-bottom:1px solid var(--line);flex:none}
.sp-filters button{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:6px 12px;border:1px solid var(--line-2);border-radius:999px;background:var(--paper);color:var(--ink-2);font:inherit;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}
.sp-filters button:hover{border-color:var(--ink);color:var(--ink)}
.sp-filters button[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:#fff}
.sp-count:empty{display:none}
.sp-count{min-width:18px;padding:0 6px;border-radius:999px;background:#17181c12;font-size:11px;line-height:18px;text-align:center;font-variant-numeric:tabular-nums}
.sp-filters button[aria-pressed="true"] .sp-count{background:#ffffff2e}

/* Ticket list */
.sp-list{list-style:none;margin:0;padding:6px;overflow-y:auto;flex:1;min-height:0}
.sp-list li+li{border-top:1px solid var(--line)}
.sp-item{display:grid;gap:5px;padding:14px 12px;border-radius:12px;color:var(--ink);text-decoration:none;position:relative}
.sp-list li:has(+ li .sp-item[aria-current]) ,.sp-list li:has(.sp-item[aria-current]) + li{border-top-color:transparent}
.sp-item:hover{background:#f1f0ec}
.sp-item[aria-current="true"]{background:var(--brand-wash)}
.sp-item[aria-current="true"]:before{content:'';position:absolute;left:0;top:14px;bottom:14px;width:3px;border-radius:3px;background:var(--brand)}
.sp-item:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
.sp-item-top{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.sp-item-subject{display:block;min-width:0;font-weight:600;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sp-item.is-unread .sp-item-subject{font-weight:700}
.sp-dot{display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:50%;background:var(--brand);vertical-align:2px;box-shadow:0 0 0 3px #17181c1a}
.sp-item-time{flex:none;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.sp-item.is-unread .sp-item-time{color:var(--ink);font-weight:600}
.sp-item-meta{font-size:12px;color:var(--muted)}
.sp-item-preview{font-size:13px;line-height:1.45;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.sp-item-who{color:var(--muted)}
.sp-item-foot{display:flex;margin-top:3px}
.sp-list-empty{padding:28px 20px;text-align:center;color:var(--muted);font-size:14px}
.sp-list-empty p{margin:0 0 8px}
.sp-list-empty .link-button{background:none;border:0;font:inherit;font-weight:600;text-decoration:underline;cursor:pointer;color:var(--ink)}

/* Status pills */
.sp-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:600;line-height:1.3;white-space:nowrap}
.sp-pill:before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}
.sp-pill-open{background:#17181c0d;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--line-2)}
.sp-pill-answered{background:var(--ink);color:#fff}
.sp-pill-closed{background:#17181c0a;color:var(--muted)}
.sp-pill-closed:before{background:none;box-shadow:inset 0 0 0 1.5px currentColor}

/* ---------- Detail pane ---------- */
.sp-detail-pane{position:relative}
.sp-empty{margin:auto;max-width:420px;padding:40px 28px;text-align:center}
.sp-empty h2{font-size:26px;margin:14px 0 8px}
.sp-empty p{margin:0 0 22px;color:var(--ink-2);line-height:1.6}
.sp-empty-soft p{color:var(--muted)}
.sp-empty-icon{display:inline-grid;place-items:center;width:64px;height:64px;border-radius:20px;background:var(--brand-wash);color:var(--ink)}
.sp-empty-icon svg{width:28px;height:28px}
.sp-none .sp-empty{padding:72px 28px}

.sp-pane-head{display:flex;align-items:flex-start;gap:14px;padding:20px 24px;border-bottom:1px solid var(--line);flex:none}
.sp-pane-title{flex:1;min-width:0}
.sp-pane-head h2{font-size:22px;line-height:1.2;margin:0;overflow-wrap:anywhere}
.sp-pane-sub{margin:4px 0 0;font-size:14px;color:var(--muted)}
.sp-back{display:none;align-items:center;gap:2px;min-height:36px;padding:6px 12px 6px 6px;border:1px solid var(--line-2);border-radius:999px;background:var(--paper);font:inherit;font-size:14px;font-weight:600;color:var(--ink);cursor:pointer;flex:none}
.sp-back svg{width:18px;height:18px}
.sp-back:hover{border-color:var(--ink)}
/* Each item starts with a dot; the negative margin + overflow clip hides the dot that begins a line. */
.sp-conv-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 0;margin:6px 0 0 -19px;font-size:13px;color:var(--muted)}
.sp-conv-meta>*:before{content:'';display:inline-block;width:3px;height:3px;margin:0 8px;border-radius:50%;background:var(--muted);opacity:.6;vertical-align:middle}
.sp-conv-meta>*{white-space:nowrap}
.sp-order-link{display:inline-flex;align-items:center;gap:4px;color:var(--ink);font-weight:600;text-decoration:underline;text-underline-offset:3px;text-decoration-color:var(--line-2)}
.sp-order-link:hover{text-decoration-color:var(--ink)}
.sp-order-link svg{width:15px;height:15px}
.sp-conv-status{flex:none;padding-top:2px}
.sp-conv-head .sp-pane-title{overflow:hidden}

/* Thread */
.sp-thread{list-style:none;margin:0;padding:22px 24px 10px;overflow-y:auto;flex:1;min-height:0;display:flex;flex-direction:column;gap:14px;background:linear-gradient(var(--paper),#f6f5f2)}
.sp-day{align-self:center;display:flex;align-items:center;gap:12px;width:100%;font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.sp-day:before,.sp-day:after{content:'';flex:1;height:1px;background:var(--line)}
.sp-msg{display:flex;gap:10px;max-width:min(78%,620px);align-items:flex-end}
.sp-msg.from-me{align-self:flex-end;flex-direction:row-reverse}
.sp-msg-body{min-width:0;display:grid;gap:4px}
.sp-msg-head{margin:0 4px;font-size:12px;color:var(--muted)}
.sp-msg-head strong{color:var(--ink-2);font-weight:600;margin-right:4px}
.sp-msg.from-me .sp-msg-head{text-align:right}
.sp-bubble{padding:12px 16px;border-radius:18px;font-size:15px;line-height:1.55;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
.sp-msg.from-me .sp-bubble code{background:#ffffff26}
.sp-composer .rt{border-radius:14px}
.sp-composer .rt textarea{border-radius:0}
.sp-msg.from-me .sp-bubble{background:var(--ink);color:#f4f4f2;border-bottom-right-radius:6px}
.sp-msg.from-staff .sp-bubble{background:#fff;color:var(--ink);border:1px solid var(--line);border-bottom-left-radius:6px;box-shadow:0 1px 2px #17181c0d}
.sp-msg.from-staff .sp-brand-avatar{margin-bottom:2px}

/* Composer */
.sp-composer-wrap{flex:none;border-top:1px solid var(--line);background:var(--paper);padding:14px 18px 16px}
.sp-closed-note{display:flex;align-items:flex-start;gap:10px;margin:0 0 12px;padding:10px 14px;border-radius:12px;background:var(--brand-wash);font-size:14px;color:var(--ink-2);line-height:1.45}
.sp-closed-note svg{width:18px;height:18px;flex:none;margin-top:1px;color:var(--ink)}
.sp-composer textarea{display:block;width:100%;min-height:52px;max-height:220px;resize:none;padding:12px 14px;border:1px solid var(--line-2);border-radius:14px;background:#fff;font:inherit;font-size:15px;line-height:1.5;color:var(--ink)}
.sp-composer textarea:focus,.sp-field input:focus,.sp-field select:focus,.sp-field textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px #17181c29;outline:0}
.sp-composer textarea[aria-invalid],.sp-field [aria-invalid]{border-color:#c62828;background:#fff8f8}
.sp-composer-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;flex-wrap:wrap}
.sp-composer-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap;justify-content:flex-end}
.sp-hint{font-size:12px;color:var(--muted)}
.sp-hint kbd{font:inherit;font-size:11px;font-weight:600;padding:1px 6px;border:1px solid var(--line-2);border-bottom-width:2px;border-radius:6px;background:#fff;color:var(--ink-2)}
.sp-send{min-height:42px;padding:10px 18px;border-radius:12px}
.sp .sp-send svg{width:17px;height:17px;margin-right:7px}
.sp-text-btn{min-height:40px;padding:8px 12px;border:0;border-radius:10px;background:none;font:inherit;font-size:14px;font-weight:600;color:var(--ink-2);cursor:pointer}
.sp-text-btn:hover{background:#efeee9;color:var(--ink)}
.sp-text-btn:disabled{opacity:.5;cursor:default}
.sp-danger{color:#a51d1d}
.sp-danger:hover{background:#fdecea;color:#8f1717}
.sp-confirm{display:inline-flex;align-items:center;gap:2px;padding:2px 2px 2px 12px;border:1px solid var(--line-2);border-radius:12px;background:#fff}
.sp-confirm-q{font-size:14px;color:var(--ink);font-weight:600;margin-right:4px}
.sp-err{margin:8px 0 0;font-size:13px;font-weight:600;color:#a51d1d}

/* New ticket form */
.sp-form{padding:22px 24px 26px;overflow-y:auto;flex:1;min-height:0;display:grid;gap:18px;align-content:start}
.sp-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:18px}
.sp-field{display:grid;gap:7px;min-width:0}
.sp-field label{font-size:14px;font-weight:600;color:var(--ink)}
.sp-optional{font-weight:400;color:var(--muted)}
.sp-field input,.sp-field select,.sp-field textarea{width:100%;font:inherit;font-size:15px;padding:12px 14px;border:1px solid var(--line-2);border-radius:12px;background:#fff;color:var(--ink)}
.sp-field select{-webkit-appearance:none;appearance:none;padding-right:38px;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center/16px;text-overflow:ellipsis}
.sp-field textarea{resize:vertical;min-height:150px;line-height:1.55}
.sp-field .sp-err{margin:0}
.sp-field-foot{display:flex;justify-content:space-between;gap:12px}
.sp-counter{font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.sp-counter.is-short{color:#a51d1d}
.sp-form .form-error{margin:0}
.sp-form-actions{display:flex;gap:10px;flex-wrap:wrap}
.sp-form-actions .primary,.sp-form-actions .btn-outline{min-width:150px}
.sp .primary[aria-busy="true"]{opacity:.7;cursor:progress}

/* Gentle entrance, only when motion is welcome */
@media (prefers-reduced-motion:no-preference){
  .sp-thread .sp-msg:last-child{animation:sp-in .25s ease-out}
  @keyframes sp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
}

/* ---------- Tablet & phone: one pane at a time ---------- */
@media (max-width:860px){
  .sp{padding:130px 16px 56px}
  .sp-grid{grid-template-columns:minmax(0,1fr);height:auto}
  .sp-list-pane{max-height:none}
  .sp-list{overflow:visible}
  .sp-app:not(.sp-show-detail) .sp-detail-pane{display:none}
  .sp-app.sp-show-detail .sp-list-pane,.sp-app.sp-show-detail .sp-head{display:none}
  .sp-none:not(.sp-show-detail) .sp-detail-pane{display:flex}
  .sp-detail-pane{height:calc(100vh - 150px);height:calc(100dvh - 146px);min-height:480px}
  .sp-none:not(.sp-show-detail) .sp-detail-pane{height:auto;min-height:0}
  .sp-detail-pane:has(.sp-form){height:auto}
  .sp-form{overflow:visible}
  .sp-back{display:inline-flex}
  .sp-pane-head{flex-wrap:wrap;padding:14px 16px;gap:10px 12px}
  .sp-conv-head .sp-pane-title{flex-basis:100%;order:3}
  .sp-conv-status{margin-left:auto;order:2}
  .sp-pane-head h2{font-size:20px}
  .sp-form .sp-pane-title,.sp-pane-head:not(.sp-conv-head) .sp-pane-title{flex-basis:100%}
  .sp-thread{padding:16px 14px 8px}
  .sp-msg{max-width:88%}
  .sp-composer-wrap{padding:12px}
  .sp-form{padding:18px 16px 22px}
}
@media (max-width:560px){
  .sp-head{flex-direction:column;align-items:stretch;gap:14px}
  .sp-new-btn{width:100%}
  .sp-guest-card{padding:34px 22px}
  .sp-guest-points{grid-template-columns:1fr;gap:14px}
  .sp-guest-actions>*{flex:1 1 140px;min-width:0}
  .sp-hint{display:none}
  .sp-form-actions>*{flex:1 1 140px}
  .sp-bubble{font-size:15px;padding:10px 14px}
}
.sp-none .sp-new-btn{display:none}

/* ---------- Simple new-ticket form: topic tiles → order → message ---------- */
.sp-filters button{flex:1;justify-content:center}
.sp-step{display:grid;gap:10px;min-width:0;margin:0;padding:0;border:0}
.sp-step[hidden]{display:none}
.sp-step legend,.sp-step-label{display:flex;align-items:center;gap:10px;padding:0;margin-bottom:10px;font-size:15px;font-weight:700;color:var(--ink)}
.sp-step-label{margin-bottom:0}
.sp-num{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--ink);color:#fff;font-size:12px;font-weight:700;flex:none}
.sp-topics{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}
.sp-topic{position:relative;display:flex;align-items:center;gap:12px;padding:12px;border:1.5px solid var(--line-2);border-radius:14px;background:var(--paper);cursor:pointer;transition:border-color .15s,background .15s,box-shadow .15s}
.sp-topic:hover{border-color:var(--ink-2)}
.sp-topic input,.sp-order-opt input{position:absolute;opacity:0;pointer-events:none}
.sp-topic-ico{flex:none;width:40px;height:40px;border-radius:11px;display:grid;place-items:center;background:#ecebe6;color:var(--ink);transition:background .15s,color .15s}
.sp-topic-ico svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sp-topic-text{display:flex;flex-direction:column;gap:2px;min-width:0;line-height:1.25}
.sp-topic-text strong{font-size:14px}
.sp-topic-text small{font-size:12.5px;color:var(--muted)}
.sp-topic:has(input:checked){border-color:var(--ink);background:#fff;box-shadow:0 0 0 1px var(--ink)}
.sp-topic:has(input:checked) .sp-topic-ico{background:var(--ink);color:#fff}
.sp-topic:has(input:focus-visible),.sp-order-opt:has(input:focus-visible){outline:2px solid var(--brand);outline-offset:2px}
#sp-topic[aria-invalid="true"] .sp-topic{border-color:#d4483f}
.sp-orders{display:flex;flex-wrap:wrap;gap:8px}
.sp-order-opt{position:relative;display:inline-flex;align-items:center;min-height:42px;padding:8px 14px;border:1.5px solid var(--line-2);border-radius:999px;background:var(--paper);font-size:14px;cursor:pointer;transition:border-color .15s,background .15s,color .15s}
.sp-order-opt small{color:var(--muted);font-size:12.5px}
.sp-order-opt:hover{border-color:var(--ink-2)}
.sp-order-opt:has(input:checked){background:var(--ink);border-color:var(--ink);color:#fff}
.sp-order-opt:has(input:checked) small{color:#ffffffb8}
.sp-more summary{cursor:pointer;font-size:14px;font-weight:600;color:var(--ink-2);width:max-content}
.sp-more summary:hover{color:var(--ink)}
.sp-more input{margin-top:10px;width:100%}
@media(max-width:560px){.sp-topics{grid-template-columns:1fr 1fr}.sp-topic{flex-direction:column;align-items:flex-start;gap:8px}.sp-topic-text small{display:none}}
.sp-step textarea,.sp-more input{width:100%;font:inherit;font-size:15px;padding:12px 14px;border:1px solid var(--line-2);border-radius:12px;background:#fff;color:var(--ink)}
.sp-step textarea{resize:vertical;min-height:140px;line-height:1.55}
.sp-step textarea:focus,.sp-more input:focus{border-color:var(--brand);box-shadow:0 0 0 3px #17181c29;outline:0}
.sp-step .sp-err{margin:0}
.sp-topics{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:860px){.sp-topics{grid-template-columns:repeat(2,minmax(0,1fr))}}
.sp-item-top{display:flex;align-items:baseline;gap:10px;min-width:0}
.sp-item-subject{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sp-item-time{flex:none;white-space:nowrap}
