/* ============================================================================================================
   WHO HEARS ABOUT IT (slack-phase-2-design.md section 6; CONVERSATION-BUILDER.md "Who hears about it"). ONE stylesheet owns
   the conv-notify-* classes (ConversationBuilderCssOwnershipTests): the Settings group's list (one calm card per notification,
   written as a sentence), the sheet (When / Who / What), the legacy Notify row's line in the drawer and the END drawer's
   notification row. The settings card, the field labels, the inputs, the segmented choice and the Slack pick list are their
   own sheets' classes (conv-rail.css, conv-drawer.css, conv-surface-send.css) - never restyled here. Only --theme-* / --conv-*
   tokens; the Action family's hue is --conv-act (a notification is a send).
   ============================================================================================================ */

/* The group: the list and, beside it, the sheet (drawer width); stacked on a narrow screen. */

.conv-builder .conv-notify {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}

.conv-builder .conv-notify-list-card {
    flex: 1 1 420px;
    min-width: 0;
}

/* One calm card per notification. */

.conv-builder .conv-notify-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.conv-builder .conv-notify-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--theme-border-subtle);
    border-left: 4px solid var(--conv-act);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    transition: box-shadow var(--conv-motion, 150ms ease);
}

.conv-builder .conv-notify-card:hover {
    box-shadow: var(--theme-shadow);
}

.conv-builder .conv-notify-card.is-open {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--conv-act) 45%, transparent);
}

.conv-builder .conv-notify-icon {
    display: inline-flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--theme-radius-button);
    background: var(--conv-act-soft, var(--theme-background-subtle));
    color: var(--conv-act);
}

.conv-builder .conv-notify-body {
    flex: 1;
    min-width: 0;
}

.conv-builder .conv-notify-sentence {
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-sm);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.conv-builder .conv-notify-sub {
    margin-top: 2px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-builder .conv-notify-tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
}

/* A line in the warning ink: a member who left, a PDF that is not held-aware, a channel the app is not in. */

.conv-builder .conv-notify-warn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
    color: var(--conv-issue-warn, var(--theme-warning));
    font-size: var(--theme-font-size-xs);
    line-height: 1.4;
}

.conv-builder .conv-notify-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 12px;
    padding: 12px;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

/* THE SHEET - a drawer-width panel on the node background. */

.conv-builder .conv-notify-sheet {
    flex: 0 1 400px;
    min-width: 0;
    max-width: 100%;
    padding: 16px 20px 18px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    box-shadow: var(--theme-shadow-lg);
}

.conv-builder .conv-notify-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.conv-builder .conv-notify-part {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 0;
    border-top: 1px solid var(--theme-border-subtle);
}

.conv-builder .conv-notify-part-title {
    margin: 0 0 6px;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* WHEN - three tiles. */

.conv-builder .conv-notify-tiles {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.conv-builder .conv-notify-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background);
    color: var(--theme-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--conv-motion, 150ms ease), background var(--conv-motion, 150ms ease);
}

.conv-builder .conv-notify-tile:hover:not(:disabled) {
    border-color: var(--conv-act);
}

.conv-builder .conv-notify-tile.is-on {
    border-color: var(--conv-act);
    background: var(--conv-act-soft, var(--theme-background-subtle));
}

.conv-builder .conv-notify-tile:focus-visible {
    outline: 2px solid var(--conv-act);
    outline-offset: 2px;
}

.conv-builder .conv-notify-tile:disabled {
    cursor: default;
    opacity: 0.6;
}

.conv-builder .conv-notify-tile-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
}

.conv-builder .conv-notify-tile-head > .bi {
    color: var(--conv-act);
}

.conv-builder .conv-notify-tile-line {
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    line-height: 1.4;
}

/* WHO - the chips, the typed address. */

.conv-builder .conv-notify-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 2px;
    padding: 0;
    list-style: none;
}

.conv-builder .conv-notify-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 2px 4px 2px 8px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-subtle);
    color: var(--theme-text);
    font-size: var(--theme-font-size-xs);
}

.conv-builder .conv-notify-chip.is-warn {
    border-color: var(--conv-issue-warn, var(--theme-warning));
    color: var(--conv-issue-warn, var(--theme-warning));
}

.conv-builder .conv-notify-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-builder .conv-notify-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.conv-builder .conv-notify-chip-x:hover:not(:disabled) {
    background: var(--theme-background-hover);
}

.conv-builder .conv-notify-address {
    display: flex;
    gap: 6px;
}

.conv-builder .conv-notify-address > .conv-input {
    flex: 1;
    min-width: 0;
}

/* WHAT - the switches. */

.conv-builder .conv-notify-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    cursor: pointer;
}

.conv-builder .conv-notify-switch input {
    accent-color: var(--conv-act);
}

.conv-builder .conv-notify-switch.is-disabled {
    color: var(--theme-text-muted);
    cursor: default;
}

.conv-builder .conv-notify-sub-switch {
    margin-left: 24px;
}

/* The foot - what is still missing, the actions, the preview line. */

.conv-builder .conv-notify-sheet-foot {
    padding-top: 12px;
    border-top: 1px solid var(--theme-border-subtle);
}

.conv-builder .conv-notify-problem {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.conv-builder .conv-notify-sheet-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

/* THE LEGACY NOTIFY's line in the drawer (P2-D9) and the END drawer's notification row. */

.conv-builder .conv-notify-legacy {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: var(--theme-radius-button);
    background: color-mix(in srgb, var(--conv-issue-warn, var(--theme-warning)) 12%, var(--conv-node-bg));
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    line-height: 1.45;
}

.conv-builder .conv-notify-legacy > .bi {
    margin-top: 2px;
    color: var(--conv-issue-warn, var(--theme-warning));
}

.conv-builder .conv-notify-edge-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* THE DRAWER'S CONTROLS, ON THE SETTINGS TAB. The segmented choice, the small buttons, the spacing helpers, the note and the Slack
   pick list are styled only inside .conv-drawer (conv-drawer.css, conv-surface-send.css); the Notify group sits on the Settings
   tab, so the same look is given here - SCOPED to .conv-notify, never redefining those classes for anyone else. */

.conv-builder .conv-notify .conv-gap { margin-top: 12px; }
.conv-builder .conv-notify .conv-flush { margin-top: 0; }

.conv-builder .conv-notify .conv-btn-sm {
    padding: 4px 10px;
    font-size: var(--theme-font-size-xs);
}

.conv-builder .conv-notify .conv-mono {
    font-family: var(--theme-font-mono);
    font-size: var(--theme-font-size-xs);
}

.conv-builder .conv-notify .conv-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.conv-builder .conv-notify .conv-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-subtle);
}

.conv-builder .conv-notify .conv-seg-btn {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text-secondary);
    font: inherit;
    font-size: var(--theme-font-size-xs);
    cursor: pointer;
}

.conv-builder .conv-notify .conv-seg-btn:hover:not(:disabled),
.conv-builder .conv-notify .conv-seg-btn:focus-visible {
    color: var(--theme-text-emphasis);
    outline: none;
}

.conv-builder .conv-notify .conv-seg-btn.is-on {
    background: var(--theme-background-raised);
    color: var(--conv-act);
    box-shadow: var(--theme-shadow);
    font-weight: 600;
}

.conv-builder .conv-notify .conv-seg-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.conv-builder .conv-notify .conv-send-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: var(--theme-radius-button);
    background: var(--conv-act-soft, var(--theme-background-subtle));
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.conv-builder .conv-notify .conv-surfsend-list {
    max-height: 220px;
    margin: 4px 0 0;
    padding: 0;
    overflow-y: auto;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    list-style: none;
}

.conv-builder .conv-notify .conv-surfsend-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid var(--theme-border-subtle);
    background: transparent;
    color: var(--theme-text);
    text-align: left;
    cursor: pointer;
}

.conv-builder .conv-notify .conv-surfsend-item:hover,
.conv-builder .conv-notify .conv-surfsend-item:focus-visible {
    background: var(--conv-act-soft, var(--theme-background-subtle));
}

.conv-builder .conv-notify .conv-surfsend-item.is-on {
    box-shadow: inset 3px 0 0 var(--conv-act);
}

.conv-builder .conv-notify .conv-surfsend-item-name {
    font-weight: 600;
}

.conv-builder .conv-notify .conv-surfsend-item-handle {
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
}

@media (max-width: 760px) {
    .conv-builder .conv-notify-sheet {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .conv-builder .conv-notify-card,
    .conv-builder .conv-notify-tile {
        transition: none;
    }
}
