/* =========================================
   SHARE RESULT (SR-2) — sender bar + sheet, and the read-only recipient page.

   Loaded after style.css on both the Research page and the /r/<id> page and reuses its tokens (--space-*, --radius-*,
   --border-subtle, --focus-ring, --status-*). No new color families; nothing here is inline (the CSP forbids inline styles).
   ========================================= */

/* ------------------------------------------------------------ sender: the Share bar on the report */

.share-result-bar {
    display: flex;
    margin: var(--space-4) 0 0;
}

.share-result-bar[hidden] { display: none; }

.share-result-open {
    width: auto;
    min-height: var(--control-height);
    margin: 0;
}

.share-result-open:disabled {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 520px) {
    .share-result-open { width: 100%; }
}

/* ------------------------------------------------------------------- sender: the sheet */

.share-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(31, 41, 51, .5);
}

.share-sheet-backdrop[hidden] { display: none; }

.share-sheet {
    position: fixed;
    z-index: 90;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(100% - 32px, 460px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: var(--space-5);
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(31, 41, 51, .25);
}

.share-sheet[hidden] { display: none; }

.share-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.share-sheet-header h2 { margin: 0; font-size: 20px; }

.share-sheet-x {
    /* style.css gives every button width:100%; this one is an icon button */
    flex: 0 0 auto;
    width: var(--control-height);
    min-width: var(--control-height);
    min-height: var(--control-height);
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #26323c;
}

.share-sheet-x:focus-visible,
.share-sheet select:focus-visible,
.share-sheet input:focus-visible,
.share-sheet-stop:focus-visible,
.share-sheet a:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.share-sheet-vehicle { margin: var(--space-2) 0 var(--space-3); font-weight: bold; }
.share-sheet-intro { margin: 0 0 var(--space-4); color: var(--text-secondary); font-size: 14px; line-height: 1.45; }

.share-sheet-field {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.share-sheet select,
.share-sheet-link {
    width: 100%;
    min-height: var(--control-height);
    padding: 10px 12px;
    border: 1px solid #cfd6dc;
    border-radius: var(--radius-sm);
    background: #fff;
    color: #1f2933;
    font: inherit;
    font-size: 16px;
}

.share-sheet-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    font-size: 15px;
    line-height: 1.4;
}

.share-sheet-check input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; }
.share-sheet-check small { color: var(--text-secondary); }

.share-sheet .primary-button { width: 100%; min-height: var(--control-height); margin: 0; }

.share-sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-3) 0;
}

.share-sheet-actions > * {
    flex: 1 1 130px;
    width: auto;
    min-height: var(--control-height);
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
}

.share-sheet-actions > [hidden] { display: none; }

.share-sheet-note { margin: var(--space-2) 0; color: var(--text-secondary); font-size: 14px; }

.share-sheet-stop {
    width: auto;
    margin-top: var(--space-3);
    min-height: var(--control-height);
    padding: 0 var(--space-3);
    border: 0;
    background: transparent;
    color: #8b2e2e;
    font: inherit;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}

.share-sheet-stop[hidden] { display: none; }

.share-sheet-error {
    margin: 0 0 var(--space-3);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #fff1f1;
    color: #8b2e2e;
    font-weight: bold;
}

.share-sheet-status { min-height: 1.2em; margin: var(--space-3) 0 0; font-size: 14px; color: var(--text-secondary); }

/* ---------------------------------------------------------- recipient: the read-only page */

.share-page .share-snapshot-banner {
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #f8fafb;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.45;
}

.share-page .share-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0;
    padding: 0;
    list-style: none;
}

.share-page .share-facts li {
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: #fff;
}

.share-page .share-facts .share-fact-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.share-page .share-facts .share-fact-value { display: block; margin-top: 4px; font-size: 18px; font-weight: bold; }

.share-page .share-verdict {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--status-caution-bg);
    border: 1px solid var(--status-caution-border);
}

.share-page .share-verdict.share-verdict-good {
    background: var(--status-positive-bg);
    border-color: var(--status-positive-border);
}

.share-page .share-verdict h2 { margin: 0 0 var(--space-2); font-size: 22px; }
.share-page .share-verdict p { margin: 0; }

.share-page .share-list { margin: var(--space-2) 0 0; padding-left: 1.2em; }
.share-page .share-list li { margin: 4px 0; }

.share-page .share-cta { margin: var(--space-section) 0 0; }
.share-page .share-cta a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-height: var(--control-height); padding: 0 var(--space-5); }

.share-page .share-footnote { margin: var(--space-section) 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }

.share-page .share-message { text-align: center; padding: var(--space-group) var(--space-4); }

.share-page .share-details { margin: var(--space-3) 0 0; }
.share-page .share-details summary { cursor: pointer; font-weight: bold; min-height: var(--control-height); display: flex; align-items: center; }
.share-page .share-details summary:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-ring-offset); }

/* ---- earlier links (the sender's stop-sharing list) and its footer entry point */

.share-sheet-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }

.share-sheet-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border-subtle);
}

.share-sheet-list li span { flex: 1 1 200px; font-size: 15px; }
.share-sheet-list li .share-sheet-stop { margin-top: 0; }

.share-result-manage { width: auto; min-height: var(--control-height); margin: 0 0 0 var(--space-2); }
.share-result-manage[hidden] { display: none; }

.share-result-bar { flex-wrap: wrap; gap: var(--space-2); }

@media (max-width: 520px) {
    .share-result-manage { width: 100%; margin-left: 0; }
}

.share-footer-link {
    width: auto;
    min-height: var(--control-height);
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.share-footer-link[hidden] { display: none; }
.share-footer-link:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-ring-offset); }
