/* /tools/connection-string-builder - page-specific rules ONLY. Shared
   primitives (tokens, buttons, cards, notices, pills, tables, form controls)
   come from tokens.css / site.css and tools.css. No new colors: every value
   here is a site token. Mono is for connection strings and keys only. */

.csb-tool { padding: 32px 0 clamp(48px, 6vw, 72px); }
.csb code, .csb-ref code, .csb-error code { font-family: "JetBrains Mono", monospace; font-size: .88em; overflow-wrap: anywhere; }

/* ---------- Mode tabs: the selected tab is the panel itself ---------- */
.csb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.csb-tabs [role="tab"] {
    background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none;
    border-radius: 10px 10px 0 0; padding: 10px 20px; font: inherit; font-weight: 600; font-size: .98rem;
    cursor: pointer; margin-bottom: -1px; min-height: 44px;
}
.csb-tabs [role="tab"]:hover { color: var(--heading); }
.csb-tabs [role="tab"][aria-selected="true"] { background: var(--card); color: var(--heading); border-color: var(--line); }
.csb-tabs [role="tab"]:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- Form ---------- */
.csb-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.csb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.csb-field[hidden] { display: none; }
.csb-field-wide { grid-column: span 2; }
.csb-field label { font-size: .86rem; font-weight: 600; color: var(--heading); }
.csb-field input, .csb-field select { width: 100%; padding: 10px 12px; font-size: .95rem; min-width: 0; }
.csb-field input { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-variant-ligatures: none; }
.csb-check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; align-self: end; }
.csb-check input { width: 18px; height: 18px; flex: none; accent-color: var(--blue-bright); }
.csb-check label { font-weight: 500; color: var(--ink); cursor: pointer; }

.csb-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 20px 0 14px; }
.csb-reveal { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink); min-height: 44px; cursor: pointer; }
.csb-reveal[hidden] { display: none; }
.csb-reveal input { width: 18px; height: 18px; accent-color: var(--blue-bright); }
.csb-status { font-size: .9rem; color: var(--muted); }

/* ---------- Output cards ---------- */
.csb-outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.csb-out { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.csb-out-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.csb-out-titles { min-width: 0; }
.csb-out-title { font-size: 1.02rem; margin: 0; }
.csb-out-used { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.csb-copy { flex: none; }
.csb-code {
    margin: 0; padding: 12px 14px; background: var(--cream); border: 1px solid var(--line); border-radius: 10px;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-size: .84rem; line-height: 1.55;
    color: var(--ink); font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
    max-height: 340px; overflow: auto;
}
.csb-code:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.csb-out-na { margin: 0; color: var(--muted); font-size: .92rem; }
.csb-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.csb-notes li + li { margin-top: 4px; }
.csb-offscreen { position: fixed; left: -9999px; top: 0; }

/* ---------- Open in SQLly ---------- */
.csb-open {
    display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between;
    margin-top: 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--blue-soft);
}
.csb-open[hidden] { display: none; }
.csb-open-text { min-width: 0; flex: 1 1 320px; }
.csb-open-title { font-size: 1.1rem; margin: 0 0 4px; }
.csb-open-note { margin: 0; color: var(--blue-on-soft); font-size: .92rem; }
.csb-open-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.csb-open-get { font-weight: 600; font-size: .92rem; }
.btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: auto; }

/* ---------- Decoder ---------- */
.csb-pane-label { display: block; font-family: "JetBrains Mono", monospace; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
#csd-input {
    width: 100%; min-height: 110px; resize: vertical;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-size: .9rem; line-height: 1.55;
    font-variant-ligatures: none;
}
.csd-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 12px 0 18px; }
.csd-samples-label { font-size: .86rem; color: var(--muted); }
.csd-sample {
    background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 14px; font: inherit; font-size: .86rem; cursor: pointer; min-height: 36px;
}
.csd-sample:hover { border-color: var(--link); color: var(--heading); }
.csd-sample:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.csd-reveal { margin-left: auto; }
.csd-empty { color: var(--muted); }
.csd-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.csd-h { font-size: 1.08rem; margin: 22px 0 10px; }
.csd-ok { color: var(--green); font-weight: 600; }
.csd-warnings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.csd-w { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: .93rem; line-height: 1.5; }
.csd-w-tag { flex: none; font-family: "JetBrains Mono", monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; margin-top: 1px; }
.csd-w-text { min-width: 0; overflow-wrap: anywhere; }
.csd-w-danger { background: var(--pink-wash); border-color: var(--pink-soft); color: var(--pink-ink); }
.csd-w-danger .csd-w-tag { background: var(--card); color: var(--pink-ink); }
.csd-w-warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); }
.csd-w-warn .csd-w-tag { background: var(--card); color: var(--amber-ink); }
.csd-w-info .csd-w-tag { background: var(--blue-soft); color: var(--blue-on-soft); }
.csd-table-wrap { margin-bottom: 8px; }
.csd-table td { vertical-align: top; }
.csd-key, .csd-val { font-family: "JetBrains Mono", monospace; font-size: .85rem; overflow-wrap: anywhere; word-break: break-word; }
.csd-key { white-space: nowrap; color: var(--heading); }
.csd-val { min-width: 8ch; }
.csd-meaning { color: var(--muted); font-size: .9rem; }
.csd-sqlly, .csd-carry { color: var(--muted); font-size: .9rem; margin: 14px 0 0; }
.csd-error { margin: 0; }

.csb-privacy { margin: 26px 0 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: .92rem; color: var(--muted); }
.csb-privacy strong { color: var(--heading); }

/* ---------- Content ---------- */
.csb-engine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.csb-engine-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; color: var(--ink); }
.csb-engine-card:hover { border-color: var(--link); text-decoration: none; }
.csb-engine-card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.csb-engine-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.csb-examples { display: grid; gap: 4px; }
.csb-example h3 { margin-bottom: 8px; }
.csb-example-used { font-weight: 400; font-size: .86rem; color: var(--muted); margin-left: 6px; }
.csb-example .fmt-code { overflow-wrap: anywhere; }
.csb-ref td { vertical-align: top; font-size: .9rem; }
.csb-ref td:first-child { white-space: nowrap; }
.csb-ref td:nth-child(2), .csb-ref td:nth-child(3) { color: var(--muted); }
.csb-errors { display: grid; gap: 16px; }
.csb-error h3 { font-size: 1rem; margin: 0 0 10px; line-height: 1.45; }
.csb-error h3 code { font-size: .92em; }
.csb-error p { margin: 6px 0 0; color: var(--ink); line-height: 1.6; }
.csb-links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px 24px; }
.csb-links a { font-weight: 600; }

@media (max-width: 640px) {
    .csb-field-wide { grid-column: auto; }
    .csb-form { grid-template-columns: 1fr; }
    .csb-ref td:first-child { white-space: normal; }
    .csd-key { white-space: normal; }
    .csd-reveal { margin-left: 0; }
    .csb-tabs [role="tab"] { flex: 1; }
}
