/**
 * Dashboard Share dialog — the form shown before a live dashboard is shared outward.
 *
 * ⛔ THIS FILE EXISTS BECAUSE THE DIALOG HAD NO STYLESHEET AT ALL. Every `dsh-share__*`
 * class it emits was undeclared, which is the exact defect `validate-css-class-declaration-drift`
 * was built for and names in its own header for the SIBLING dialog: ".rsd-share__* — seven
 * classes, NO declaration — the whole share dialog unstyled". The dashboard copy was in the
 * same state and nobody had noticed, because an undeclared class is valid HTML: the page
 * loads, the console is clean, every test passes, and the only symptom is visual.
 *
 * Mounted through ModalOverlay, which appends to document.body — so, exactly as for the
 * report dialog, these rules must live in a GLOBAL component stylesheet. A rule inside a
 * page's sheet is page-scoped and can never reach a modal parented outside that subtree.
 *
 * Structure emitted by dashboard-share-dialog.js:
 *   .dsh-share
 *     .dsh-share__intro                    what sharing this dashboard does
 *     .form-group > .dsh-share__hint       recipients / helper text
 *     .dsh-share__choice                   the drill-down decision
 *       .dsh-share__choice-main            the option, in the sharer's words
 *       .dsh-share__choice-note            what the RECIPIENT will be able to do
 *     .dsh-share__status[.is-error]        live region for the submit outcome
 *     .dsh-share__existing                 links already outstanding
 *       .dsh-share__existing-row           one recipient + its Revoke
 *         .dsh-share__existing-who         the address and when it lapses
 *
 * Colours come from base.css tokens only, so dark mode is carried by the tokens.
 */

.dsh-share__intro {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Hints sit under the control they explain, so the gap belongs above, not below. */
.dsh-share__hint {
    /* No single word stranded on the last line (11/12/1 measured). */
    text-wrap: pretty;
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

.dsh-share__hint.is-error {
    color: var(--danger-text-strong);
}

.dsh-share__choice {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/*
 * One option = the radio beside its two lines. `.radio-label` has no layout of its own on this
 * page (its rules live in admin-groups.css and board-report.css, neither loaded here), so the
 * radio sat on a line by itself ABOVE the words it selects — measured on the capture frame. A
 * two-column grid puts the control in the first column and both lines in the second.
 */
.dsh-share__choice .radio-label {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: start;
    cursor: pointer;
}

.dsh-share__choice .radio-label input[type="radio"] {
    grid-row: 1 / span 2;
    width: auto;
    margin: 3px 0 0;
}

.dsh-share__choice-main {
    grid-column: 2;
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

/*
 * The consequence line, which is the part that makes the decision an informed one —
 * readable rather than fine print, because it names what the recipient can see.
 */
.dsh-share__choice-note {
    grid-column: 2;
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.dsh-share__status {
    margin: 12px 0 0;
    min-height: 18px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dsh-share__status.is-error {
    color: var(--danger-text-strong);
}

.dsh-share__existing {
    margin-top: 4px;
}

/*
 * One outstanding link per row: who holds it on the left, the way to withdraw it on the
 * right. The separator matters — these are live grants, not a summary.
 */
.dsh-share__existing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle, var(--border-color));
}

.dsh-share__existing-row:last-child {
    border-bottom: none;
}

.dsh-share__existing-who {
    font-size: 13px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

/* Links that have ended — withdrawn or expired — listed under the live ones, collapsed: the
   history of who had access, on the page that grants it, without crowding what can still be
   withdrawn. Muted, because nothing here can be acted on. */
.dsh-share__ended {
    margin-top: 8px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dsh-share__ended > summary {
    cursor: pointer;
    padding: 4px 0;
}

/* Groups of colleagues (migration 2467): one checkbox per group, stacked, in a fieldset whose
   legend reads like the sibling field labels rather than the browser's default framed box. */
.dsh-share__groups {
    border: 0;
    padding: 0;
    margin-inline: 0;
    min-width: 0;
}

.dsh-share__groups > legend {
    padding: 0;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.dsh-share__groups [data-role="groups-list"] {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.dsh-share__groups [data-role="groups-list"] > label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}
