/* ============================================================
   Support desk - the issue list and one issue read as a
   conversation. Sits inside the .qs design system and borrows
   its tokens; nothing here redefines a colour.

   Two deliberate rules run through the whole file:

   1. A status pill is never a flex child that can stretch. Every
      pill carries flex:0 0 auto and align-self:center, and long
      prose always lives on its OWN row rather than beside a pill.
      A pill that grows to match a three-line note next to it is
      the single ugliest thing a log like this can do.

   2. The thread is sided by WHO IS READING, not by role: your own
      messages sit right whether you are the client or the team,
      so both sides read the same page as "my conversation".
   ============================================================ */

/* ---------- tone scale ---------- */

.sp-tone-ok { --tone: var(--success); --tone-bg: var(--success-bg); --tone-line: var(--success-border); }
.sp-tone-warn { --tone: var(--warn); --tone-bg: var(--warn-bg); --tone-line: var(--warn-border); }
.sp-tone-risk { --tone: var(--danger); --tone-bg: var(--danger-bg); --tone-line: var(--danger-border); }
.sp-tone-busy { --tone: var(--info); --tone-bg: var(--info-bg); --tone-line: var(--info-border); }
.sp-tone-calm { --tone: var(--text-3); --tone-bg: var(--surface-2); --tone-line: var(--border); }

/* ---------- pills ---------- */

.sp-pill {
    /* flex:none + align-self:center is the whole fix: a pill beside a tall block keeps its own
       height instead of stretching to the row. */
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    align-self: center;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--tone-line, var(--border));
    border-radius: 999px;
    background: var(--tone-bg, var(--surface-2));
    color: var(--tone, var(--text-2));
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.45;
    white-space: nowrap;
}

.sp-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.sp-tag {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    align-self: center;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- page head ---------- */

.sp-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.sp-head-main { min-width: 0; }

.sp-eyebrow {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-deep);
    margin-bottom: 0.3rem;
}

.sp-head h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sp-head-sub {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-2);
    max-width: 62ch;
}

/* ---------- filters ---------- */

.sp-filters {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sp-chips {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    min-width: 0;
}

.sp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}

.sp-chip:hover { border-color: var(--border-strong); color: var(--text); }

.sp-chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #FFF;
}

.sp-chip-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sp-chip.is-active .sp-chip-count { background: rgba(255, 255, 255, 0.2); color: #FFF; }

/* Unread is tinted rather than solid, so it reads as urgent without competing with the selected
   state - and when it IS selected, the solid brand still wins. */
.sp-chip-alert {
    border-color: var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger);
}

.sp-chip-alert .sp-chip-count { background: rgba(185, 28, 28, 0.12); color: var(--danger); }
.sp-chip-alert:hover { border-color: var(--danger); color: var(--danger); }

.sp-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.4rem 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-3);
}

.sp-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.sp-search input {
    border: 0;
    outline: none;
    background: none;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--text);
    min-width: 11rem;
}

.sp-search button {
    border: 0;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
}

.sp-search button:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- the list ---------- */

.sp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sp-row {
    position: relative;
    display: block;
    padding: 0.85rem 1rem 0.85rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    text-decoration: none;
    color: inherit;
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.sp-row:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* A hairline in the status tone down the leading edge - the queue is readable as colour alone
   before a single word is read. */
.sp-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65rem;
    bottom: 0.65rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--tone, var(--border-strong));
}

.sp-row-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.sp-row-ref {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
    flex: none;
}

.sp-row-when {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-3);
    white-space: nowrap;
    flex: none;
}

.sp-row-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.sp-row.is-unread .sp-row-title { font-weight: 700; }

.sp-row-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-3);
}

.sp-row-meta .sp-count {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex: none;
}

.sp-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-bg);
    flex: none;
}

.sp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    background: var(--surface);
    text-align: center;
}

.sp-empty-mark { color: var(--border-strong); margin-bottom: 0.25rem; }
.sp-empty b { font-size: 0.9375rem; }
.sp-empty p { margin: 0; font-size: 0.8125rem; color: var(--text-3); max-width: 46ch; line-height: 1.6; }
.sp-empty .qs-btn { margin-top: 0.6rem; }

/* ---------- one issue ---------- */

.sp-issue-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.sp-issue-head h1 {
    margin: 0.15rem 0 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.sp-issue-facts {
    display: flex;
    align-items: center;
    gap: 0.4rem 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-3);
}

.sp-issue-facts a { color: var(--text-2); }

.sp-issue-pills {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: none;
}

/* Status explainer: colour-matched to the status it describes, so the state lands before the
   sentence is read. */
.sp-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--tone-line, var(--border));
    border-left-width: 3px;
    border-left-color: var(--tone, var(--border-strong));
    border-radius: var(--r-md);
    background: var(--tone-bg, var(--surface));
    margin-bottom: 1.1rem;
}

.sp-banner-mark {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--tone, var(--text-2));
    box-shadow: 0 0 0 1px var(--tone-line, var(--border));
}

.sp-banner-body { min-width: 0; }
.sp-banner-body b { display: block; font-size: 0.875rem; color: var(--text); }
.sp-banner-body p { margin: 0.15rem 0 0; font-size: 0.8125rem; line-height: 1.6; color: var(--text-2); }
.sp-banner-body a { color: var(--brand); font-weight: 600; }

.sp-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.sp-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}

.sp-card {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.sp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.7rem 0.95rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.sp-card-head h2,
.sp-card-head h3 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-2);
}

.sp-card-head .sp-hint { font-size: 0.75rem; color: var(--text-3); font-weight: 500; }

.sp-card-body { padding: 0.95rem; }

/* ---------- the conversation ---------- */

.sp-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.1rem 1.1rem 1.2rem;
    max-height: 64vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    background:
        radial-gradient(circle at 1px 1px, rgba(15, 26, 20, 0.045) 1px, transparent 0) 0 0 / 18px 18px;
}

.sp-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    max-width: 88%;
}

.sp-msg-mine {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.sp-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
}

.sp-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sp-msg-staff .sp-avatar {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
    border-color: var(--brand);
    color: var(--gold-soft);
}

.sp-bubble {
    min-width: 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.sp-msg-mine .sp-bubble {
    background: var(--brand-soft);
    border-color: rgba(31, 61, 42, 0.16);
}

.sp-msg-open .sp-bubble { border-color: var(--border-strong); }

.sp-bubble-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
    font-size: 0.6875rem;
    color: var(--text-3);
}

.sp-bubble-meta b { font-size: 0.75rem; font-weight: 700; color: var(--text-2); }

.sp-bubble-body {
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sp-bubble-body:empty { display: none; }

/* The status a message carried, shown under its words rather than beside them - so a long message
   and a short pill never share a row. */
.sp-bubble-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.6875rem;
    color: var(--text-3);
}

/* A status change with nothing to say: a labelled rule across the thread, never an empty bubble. */
.sp-rule {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    align-self: stretch;
}

.sp-rule::before,
.sp-rule::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}

.sp-rule-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    font-size: 0.6875rem;
    color: var(--text-3);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

/* Where attention should land: everything below arrived since this reader last looked. */
.sp-new-rule {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    align-self: stretch;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--danger);
}

.sp-new-rule::before,
.sp-new-rule::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--danger-border);
}

/* ---------- attachments in a bubble ---------- */

.sp-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}

.sp-file-img {
    display: block;
    width: 84px;
    height: 84px;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface-2);
}

.sp-file-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-file-img:hover { border-color: var(--brand); }

.sp-file {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 15rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.75rem;
    text-decoration: none;
}

.sp-file:hover { border-color: var(--brand); color: var(--brand); }
.sp-file svg { flex: none; color: var(--text-3); }
.sp-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file small { flex: none; color: var(--text-4); }

/* ---------- composer ---------- */

.sp-composer {
    border-top: 1px solid var(--border);
    padding: 0.8rem 1.1rem 0.95rem;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sp-composer textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 74px;
}

.sp-composer textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.sp-composer-foot {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.sp-attach {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.sp-attach:hover { border-color: var(--brand); color: var(--brand); }
.sp-attach input[type="file"] { display: none; }

.sp-attach-names {
    font-size: 0.75rem;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 18rem;
}

.sp-composer-hint { margin-left: auto; font-size: 0.6875rem; color: var(--text-4); }

.sp-composer-closed {
    border-top: 1px solid var(--border);
    padding: 1rem 1.1rem;
    font-size: 0.8125rem;
    color: var(--text-3);
    line-height: 1.6;
}

/* ---------- side panels ---------- */

.sp-form { display: flex; flex-direction: column; gap: 0.75rem; }

.sp-form label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 0.25rem;
}

.sp-form label em {
    font-style: normal;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-4);
}

.sp-form select,
.sp-form input[type="number"],
.sp-form input[type="text"],
.sp-form input[type="email"],
.sp-form textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.8125rem;
}

.sp-form textarea { resize: vertical; min-height: 68px; line-height: 1.55; }

.sp-form select:focus,
.sp-form input:focus,
.sp-form textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.sp-form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.sp-form-note {
    margin: 0;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: var(--text-4);
}

.sp-facts { display: flex; flex-direction: column; gap: 0.55rem; }

.sp-fact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.9rem;
    font-size: 0.8125rem;
}

.sp-fact dt { color: var(--text-3); flex: none; }
.sp-fact dd { margin: 0; text-align: right; color: var(--text); overflow-wrap: anywhere; }

.sp-verdict { border-color: var(--success-border); }
.sp-verdict .sp-card-head { background: var(--success-bg); }
.sp-verdict .sp-card-head h3 { color: var(--success); }

/* ============================================================
   History
   ------------------------------------------------------------
   A proper rail rather than a row of floating dots: one
   continuous line down the marker column that stops at the last
   entry, a fixed-size dot per event, and - the important part -
   the pill and the note are on SEPARATE rows. Nothing that can
   grow ever sits beside something that should not.
   ============================================================ */

.sp-timeline {
    display: flex;
    flex-direction: column;
}

.sp-tl {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    column-gap: 0.7rem;
    padding-bottom: 0.95rem;
}

.sp-tl:last-child { padding-bottom: 0; }

.sp-tl-rail {
    position: relative;
    display: flex;
    justify-content: center;
    /* Fixed height: the rail column must not stretch with the entry's prose, or the dot drifts
       away from the line it belongs to. */
    align-items: flex-start;
}

/* The line runs from under this dot to the next one. The last entry has nothing below it, so its
   line is dropped rather than left dangling. */
.sp-tl-rail::after {
    content: '';
    position: absolute;
    top: 1.05rem;
    left: 50%;
    height: calc(100% + 0.95rem - 1.05rem);
    width: 1.5px;
    transform: translateX(-50%);
    background: var(--border);
}

.sp-tl:last-child .sp-tl-rail::after { display: none; }

.sp-tl-dot {
    position: relative;
    z-index: 1;
    width: 10px;
    height: 10px;
    margin-top: 0.3rem;
    border-radius: 50%;
    flex: none;
    background: var(--tone, var(--text-4));
    box-shadow: 0 0 0 3px var(--tone-bg, var(--surface)), 0 0 0 4px var(--tone-line, var(--border));
}

.sp-tl-body { min-width: 0; }

.sp-tl-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    /* The row holds only short, self-sized things - a pill, a from-label, a time. Prose is
       deliberately excluded and rendered below. */
    min-height: 1.35rem;
}

.sp-tl-from {
    font-size: 0.75rem;
    color: var(--text-4);
    flex: 0 0 auto;
    white-space: nowrap;
}

.sp-tl-who {
    font-size: 0.75rem;
    color: var(--text-3);
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 12rem;
}

.sp-tl-when {
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--text-4);
    flex: none;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* The note: its own row, quoted off the rail, free to be as long as it likes. */
.sp-tl-note {
    margin: 0.35rem 0 0;
    /* No padding on the block axis: a -webkit-box that is line-clamped renders its content
       THROUGH the bottom padding, which leaks a sliver of the line that was meant to be cut.
       Breathing room comes from the margin above instead. */
    padding: 0 0 0 0.6rem;
    border-left: 2px solid var(--tone-line, var(--border));
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-2);
    overflow-wrap: anywhere;
    /* Long notes are clamped in the panel; the same words are already in the thread in full. */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
    .sp-layout { grid-template-columns: 1fr; }
    .sp-side { position: static; }
    .sp-msg { max-width: 100%; }
}

@media (max-width: 640px) {
    .sp-filters { align-items: stretch; }
    .sp-search { width: 100%; }
    .sp-search input { min-width: 0; flex: 1; }
    .sp-thread { max-height: none; padding: 0.9rem 0.8rem 1rem; }
    .sp-form-split { grid-template-columns: 1fr; }
    .sp-head h1 { font-size: 1.25rem; }
    .sp-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.2rem; -webkit-overflow-scrolling: touch; }
}

/* ---------- light header (guests and visitors with no account) ---------- */

.sp-lite-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.sp-lite-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sp-lite-brand em { font-style: normal; font-weight: 600; color: var(--text-3); }

.sp-lite-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
    color: var(--gold-soft);
    flex: none;
}

.sp-lite-back {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
}

.sp-lite-back:hover { background: var(--surface-2); color: var(--brand); }


/* ---------- the full report form ---------- */

.sp-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding: 0.85rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.sp-contact-note {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.55;
    color: var(--text-3);
}

.sp-file-input {
    font-size: 0.8125rem;
    color: var(--text-2);
}

.sp-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

@media (max-width: 560px) {
    .sp-contact { grid-template-columns: 1fr; }
}

/* The native file control, given the same frame as the text inputs so the form does not have one
   visibly foreign row. Left native otherwise - a custom picker buys nothing here. */
.sp-file-input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px dashed var(--border-strong);
    border-radius: 9px;
    background: var(--surface-2);
    font-size: 0.8125rem;
    color: var(--text-2);
}

.sp-file-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
