/* ════════════════════════════════════════════════════
   controls/connect-dialogs — the connect step's dialogs and its form frame

   Connecting a connector is a step a person can start from more than one
   place: a tile in Settings, a Sanity suggestion card, an offer in a chat.
   These rules were part of the stylesheet Settings injects when it mounts, so
   the step drew unstyled anywhere else. The shell links them instead; Settings
   keeps the rules for its own grid, list and detail.

   Markup: js/apps/settings/connector-add-dispatch.js (the refusal and the
   enrolment-failure dialogs) and the connector-forms*.js overlays.
   ════════════════════════════════════════════════════ */

/* Body of the "why this connection cannot be added" dialog. */
.cust-add-card-refusal { margin: 0; line-height: var(--lh-relaxed); color: var(--text-secondary); }

/* Signed out of Lani: the how-far-back step says what reading without a model gives. */
.cust-read-back-warning { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--status-warning); border-radius: 6px; line-height: var(--lh-relaxed); color: var(--text-secondary); background: color-mix(in srgb, var(--status-warning) 10%, transparent); }

/* The enrolment failure's long form: the cause in the platform's words and the take-back. */
.cust-enroll-failure-details { margin-top: 12px; font-size: var(--fs-meta); color: var(--text-muted); }
.cust-enroll-failure-details > summary { cursor: pointer; color: var(--text-secondary); }
.cust-enroll-failure-cause { overflow-wrap: anywhere; }

/* ── The design's modal chrome ──────────────────────
   Every window of the connect step looks like the Prime design's modal (and
   the Settings Providers dialogs): a blurred backdrop, an 18px card with a
   deep shadow, a 16px title, a footer row over a hairline, a white primary
   button. Three frames carry it: the connect forms (.cust-overlay), the
   connect step's plain dialogs (.connect-dialog, set by CONNECT_DIALOG_CLASS)
   and the setup wizard (css/wizard.css). */

.cust-overlay,
.connect-dialog.kanban-dialog-overlay {
    background: rgba(16, 16, 20, 0.4);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.cust-overlay {
    position: fixed; inset: 0; z-index: 1000; display: flex;
    align-items: center; justify-content: center;
}
.cust-overlay-panel {
    width: 480px; max-width: calc(100vw - 40px); max-height: calc(100vh - 40px);
    background: var(--bg-panel); border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 28px 72px -12px rgba(16, 16, 20, 0.3);
    display: flex; flex-direction: column; overflow: hidden;
}
.cust-overlay-header {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 22px 12px; flex-shrink: 0;
}
.cust-overlay-header h2 {
    flex: 1; margin: 0; font-size: var(--fs-subtitle); font-weight: 700;
    letter-spacing: -0.01em; color: var(--text-primary);
}
.cust-overlay-close {
    display: flex; align-items: center; justify-content: center; flex: none;
    width: 28px; height: 28px; padding: 0; border: none; border-radius: 7px;
    background: none; color: var(--text-secondary); cursor: pointer; font-size: var(--fs-body);
}
.cust-overlay-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.cust-overlay-desc {
    padding: 0 22px 4px; font-size: var(--fs-ui); line-height: var(--lh-relaxed); color: var(--text-secondary);
}
/* Scrollable body: bounds a long form (discovered host features) within the
   panel, which scrolls instead of overflowing. min-height:0 lets it shrink. */
.cust-overlay-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
}

/* ── A connect form's fields ──────────────────────── */
.cust-form { display: flex; flex-direction: column; gap: 14px; padding: 12px 22px 0; }
.cust-label { display: block; margin-bottom: 8px; font-size: var(--fs-ui); font-weight: 600; color: var(--text-primary); }
.cust-label-dim { margin-left: 4px; font-weight: 400; color: var(--text-muted); }
.cust-input {
    width: 100%; height: 38px; box-sizing: border-box; padding: 0 12px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-primary); font-family: inherit; font-size: var(--fs-body); outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cust-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.cust-input--marked { padding-right: 34px; }
.cust-input-wrap { position: relative; }
/* The token's answer inside its field: a check, a cross, or an ellipsis. */
.cust-input-mark {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center; width: 20px; height: 20px;
    padding: 0; border: none; background: none; line-height: 1; cursor: default;
    font-size: var(--fs-body); color: var(--text-muted);
}
.cust-input-mark[hidden] { display: none; }
.cust-input-mark[data-state="ok"] { color: var(--status-ok); }
.cust-input-mark[data-state="bad"] { color: var(--status-error); cursor: pointer; }
.cust-select-slot > * { display: block; width: 100%; }
.cust-hint { margin-top: 6px; font-size: var(--fs-meta); line-height: var(--lh-relaxed); color: var(--text-muted); }
.cust-note { font-size: var(--fs-ui); line-height: var(--lh-body); color: var(--text-muted); }
.cust-field-error { margin-top: 6px; font-size: var(--fs-ui); line-height: var(--lh-snug); color: var(--status-error); }
.cust-form-error { font-size: var(--fs-ui); color: var(--status-error); }

/* ── The WhatsApp link step: the code to scan, and the sentence under it ── */
.cust-wa-qr { display: flex; align-items: center; justify-content: center; min-height: 264px; }
/* The code carries three keys, so it is dense: drawn at twice the QR control's own size so a phone reads it. */
.cust-wa-qr svg { width: 264px; height: 264px; border-radius: 8px; }
/* The step's buttons are shown and hidden by the status; a button's own display would otherwise win over [hidden]. */
.cust-form-actions .cust-btn[hidden] { display: none; }
.cust-wa-message { font-size: var(--fs-ui); line-height: var(--lh-relaxed); color: var(--text-secondary); text-align: center; }
.cust-check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-ui); color: var(--text-secondary); }
.cust-row { display: flex; gap: 10px; }
.cust-col { flex: 1; min-width: 0; }
.cust-inline { display: flex; align-items: center; gap: 10px; }
.cust-status { font-size: var(--fs-ui); color: var(--text-muted); }
/* The footer row: Cancel and the primary action, over a hairline, full width. */
.cust-form-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    margin: 4px -22px 0; padding: 14px 22px; border-top: 1px solid var(--border);
}
.cust-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px;
    background: transparent; color: var(--text-secondary); cursor: pointer;
    font-family: inherit; font-size: var(--fs-ui); font-weight: 500; white-space: nowrap;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.cust-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.cust-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cust-btn--primary { padding: 0 18px; border: none; background: var(--text-primary); color: var(--bg-panel); font-weight: 600; }
.cust-btn--primary:hover:not(:disabled) { background: var(--text-primary); color: var(--bg-panel); opacity: 0.85; }

/* Lani Forge: one discovered host feature, a checkbox and its words. */
.lf-features { display: flex; flex-direction: column; gap: 8px; }
.lf-feature { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.lf-feature input { margin-top: 2px; }
.lf-feature-text { flex: 1; min-width: 0; }
.lf-feature-name { font-size: var(--fs-body); font-weight: 600; color: var(--text-primary); }
.lf-feature-desc, .lf-feature-paths, .lf-feature-warn { display: block; margin-top: 2px; font-size: var(--fs-meta); color: var(--text-muted); }
.lf-feature-paths { color: var(--text-secondary); }
.lf-feature-warn { color: var(--warning-text); }

/* ── The connect step's plain dialogs (dialog() with CONNECT_DIALOG_CLASS) ── */
.connect-dialog .kanban-dialog {
    padding: 20px 22px; border-radius: 18px; gap: 12px;
    box-shadow: 0 28px 72px -12px rgba(16, 16, 20, 0.3);
}
.connect-dialog .kanban-dialog-header > h3,
.connect-dialog .kanban-dialog > h3 { font-size: var(--fs-subtitle); }
.connect-dialog .dialog-actions {
    margin: 4px -22px -20px; padding: 14px 22px; border-top: 1px solid var(--border);
}
.connect-dialog .kanban-dialog .btn-secondary {
    height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px;
    background: transparent; color: var(--text-secondary); font-size: var(--fs-ui); font-weight: 500;
}
.connect-dialog .kanban-dialog .btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.connect-dialog .kanban-dialog .btn-primary {
    height: 36px; padding: 0 18px; border: none; border-radius: 8px;
    background: var(--text-primary); color: var(--bg-panel); font-size: var(--fs-ui); font-weight: 600;
}
.connect-dialog .kanban-dialog .btn-primary:hover { background: var(--text-primary); filter: none; opacity: 0.85; }

@media (max-width: 767px) {
    /* Overlays: full width, slide up from bottom */
    .cust-overlay { align-items: flex-end; padding: 0; }
    .cust-overlay-panel {
        width: 100% !important; max-width: none !important;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
    }
}

/* "Coming soon" for a connector Lani has no integration for yet (connector-coming-soon.js). */
.connector-coming-soon { margin: 0; font-size: var(--fs-body); line-height: var(--lh-relaxed); color: var(--text-secondary); }
