/* Qi Configure, styled to match Qi 6 and the other Qi dashboards (Importer, ResourceSpace sync):
   dark header, red Qi square, light canvas, white cards, amber primary buttons. */

:root {
    --qi-bg:        #ffffff;
    --qi-canvas:    #f7f7f8;
    --qi-subheader: #efefef;

    --qi-header-bg:     #1a1a1a;
    --qi-header-text:   #ffffff;
    --qi-header-muted:  #a8a8a8;
    --qi-header-hover:  #2a2a2a;
    --qi-header-active: #2f2f2f;

    --qi-red:    #e23f23;
    --qi-red-dk: #c1331a;

    --qi-text:        #1f2937;
    --qi-text-strong: #111827;
    --qi-muted:       #6b7280;

    --qi-border:       #d8dde3;
    --qi-border-soft:  #e8ebef;
    --qi-border-input: #c5cbd3;

    --qi-good:    #16a34a;
    --qi-good-bg: #dcf3e2;
    --qi-warn:    #b8730a;
    --qi-warn-bg: #fbecd1;
    --qi-bad:     #b32424;
    --qi-bad-bg:  #fbe1e1;
    --qi-info:    #1e57aa;
    --qi-info-bg: #e0f0ff;
    --qi-change:    #6a46c4;
    --qi-change-bg: #eee8fc;
    --qi-new-bg:    #eef8f1;

    --qi-context-bg:   #f3f7fc;
    --qi-context-line: #e6edf6;
    --qi-locked-bg:    #eceef1;

    --qi-save:    #f0a500;
    --qi-save-dk: #cf8a00;

    --qi-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --qi-radius: 4px;
    --qi-fs:     14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    font: var(--qi-fs)/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    color: var(--qi-text);
    background: var(--qi-canvas);
    min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--qi-red); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font: 0.92em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 3px; }

/* ------- header ------- */
.qi-header {
    display: flex; align-items: stretch;
    background: var(--qi-header-bg); color: var(--qi-header-text);
    height: 52px; border-bottom: 1px solid #000;
}
.qi-brand {
    display: flex; align-items: center; gap: 10px; padding: 0 16px;
    border-right: 1px solid #000; color: inherit;
}
.qi-brand:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.qi-logo { height: 30px; width: auto; }
.qi-product { font-weight: 600; font-size: 15px; }
.qi-edition {
    font-size: 10px; padding: 2px 6px; border-radius: 3px;
    background: rgba(255,255,255,0.15); color: #fff; letter-spacing: 0.04em; text-transform: uppercase;
}
.qi-nav { display: flex; align-items: stretch; flex: 1; }
.qi-nav a {
    display: flex; align-items: center; padding: 0 18px;
    color: var(--qi-header-muted); font-weight: 500; font-size: 13px;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.qi-nav a:hover { background: var(--qi-header-hover); color: #fff; text-decoration: none; }
.qi-nav a.is-active { background: var(--qi-header-active); color: #fff; box-shadow: inset 0 -3px 0 var(--qi-red); }
.qi-header-meta {
    display: flex; align-items: center; gap: 10px; padding: 0 16px;
    border-left: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: var(--qi-header-muted);
}
.qi-header-meta a { color: var(--qi-header-muted); }
.qi-header-meta a:hover { color: #fff; }
.qi-header-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; font-weight: 600; }
.qi-header-meta form { margin: 0; }
.qi-header-export {
    padding: 3px 10px; border: 1px solid rgba(255,255,255,0.2); border-radius: 3px; white-space: nowrap;
    background: none; color: var(--qi-header-muted); font: inherit; cursor: pointer;
}
.qi-header-export:hover { border-color: rgba(255,255,255,0.5); color: #fff; }

/* ------- layout ------- */
.qi-main { padding: 24px 32px; width: 100%; max-width: 1320px; margin: 0 auto; flex: 1; }
.qi-main-narrow { max-width: 560px; padding-top: 48px; }
/* Who is signed in, and signing out, at the end of the header */
.qi-header-user { display: inline-flex; align-items: center; gap: 8px; margin-left: 18px; padding-left: 18px; border-left: 1px solid rgba(255,255,255,0.15); }
.qi-header-user a { color: #fff; text-decoration: none; font-weight: 600; }
.qi-header-user a:hover { text-decoration: underline; }
.qi-header-user form { margin: 0; }
.qi-header-user button { border: 1px solid rgba(255,255,255,0.25); background: none; color: var(--qi-header-muted); border-radius: 3px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.qi-header-user button:hover { color: #fff; border-color: #fff; }
.qi-card {
    background: var(--qi-bg); border: 1px solid var(--qi-border);
    border-radius: var(--qi-radius); box-shadow: var(--qi-shadow);
    padding: 24px 28px; margin-bottom: 20px;
}
.qi-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: var(--qi-text-strong); }
.qi-card h2 {
    margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--qi-text-strong);
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--qi-border-soft); padding-bottom: 8px;
    display: flex; align-items: center; gap: 10px;
}
.qi-card h2 .qi-h-link { margin-left: auto; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.qi-card h2 .qi-muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
.qi-card h2 .qi-muted code { font-size: 11px; }
.qi-card-intro { margin: 0 0 16px; color: var(--qi-muted); }
.qi-card-quiet { padding: 14px 28px; }
.qi-summary-title { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--qi-text-strong); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 10px; }
.qi-summary-title .qi-muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
.qi-summary-title code { font-size: 11px; }
.qi-summary-title::before { content: "▸"; color: var(--qi-muted); width: 10px; }
details[open] > .qi-summary-title::before { content: "▾"; }
.qi-muted { color: var(--qi-muted); font-weight: normal; }
.qi-hint { color: var(--qi-muted); font-size: 12px; }
.qi-grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.qi-grid-2 > .qi-card { margin-bottom: 0; }
.qi-stack { display: grid; gap: 20px; margin-bottom: 20px; }
@media (max-width: 1000px) { .qi-grid-2 { grid-template-columns: 1fr; } }

/* ------- flash ------- */
.qi-flash { padding: 10px 14px; border-radius: var(--qi-radius); margin-bottom: 16px; font-weight: 500; }
.qi-flash-error { background: var(--qi-bad-bg); color: var(--qi-bad); border: 1px solid #f3b6b6; }
.qi-flash-ok { background: var(--qi-good-bg); color: var(--qi-good); border: 1px solid #b5e2c2; }
.qi-flash-warning { background: var(--qi-warn-bg); color: var(--qi-warn); border: 1px solid #efd29c; }
.qi-backup .qi-btn { margin-right: 6px; }
.qi-link-button { border: 0; padding: 0; background: none; font: inherit; color: var(--qi-red); cursor: pointer; }
.qi-link-button:hover { text-decoration: underline; }

/* ------- database exports, in the background ------- */
.qi-exports { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.qi-export {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px;
    background: var(--qi-info-bg); border: 1px solid #b9d7f5; border-radius: var(--qi-radius); box-shadow: var(--qi-shadow);
}
.qi-export form { margin: 0; }
.qi-export.is-done { background: var(--qi-good-bg); border-color: #b5e2c2; }
.qi-export.is-failed { background: var(--qi-bad-bg); border-color: #f3b6b6; color: var(--qi-bad); }
.qi-export-done { color: var(--qi-good); font-weight: 700; }

/* ------- metrics ------- */
.qi-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.qi-metric {
    background: #fff; border: 1px solid var(--qi-border); border-radius: var(--qi-radius);
    padding: 12px 16px; box-shadow: var(--qi-shadow); color: inherit; display: block;
}
a.qi-metric:hover { border-color: var(--qi-red); text-decoration: none; }
.qi-metric strong { font-size: 24px; display: block; font-weight: 700; color: var(--qi-text-strong); font-variant-numeric: tabular-nums; }
.qi-metric span { font-size: 11px; color: var(--qi-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.qi-metric-good strong { color: var(--qi-good); }
.qi-metric-warn strong { color: var(--qi-warn); }
.qi-metric-bad strong { color: var(--qi-bad); }

/* ------- progress ------- */
.qi-progress { height: 8px; background: var(--qi-border-soft); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.qi-progress > div { height: 100%; background: var(--qi-red); transition: width .3s; }

/* ------- tables ------- */
.qi-table { width: 100%; border-collapse: collapse; background: #fff; }
.qi-table th, .qi-table td { padding: 8px 10px; border-bottom: 1px solid var(--qi-border-soft); text-align: left; vertical-align: middle; }
.qi-table thead th {
    background: #fafafb; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--qi-muted);
    border-bottom: 1px solid var(--qi-border);
}
.qi-table tr:hover td { background: #fafbfc; }
.qi-table .qi-num { text-align: right; font-variant-numeric: tabular-nums; }
.qi-table .qi-nowrap { white-space: nowrap; }
.qi-table .qi-wrap { max-width: 420px; }
.qi-table tr.is-current td { background: #fff8e6; }
.qi-table-compact th, .qi-table-compact td { padding: 4px 8px; font-size: 13px; }
.qi-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.qi-meta dt { color: var(--qi-muted); font-weight: 500; }
.qi-meta dd { margin: 0; }

/* ------- pills ------- */
.qi-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.qi-pill-done, .qi-pill-completed, .qi-pill-ok { background: var(--qi-good-bg); color: var(--qi-good); }
.qi-pill-warning { background: var(--qi-warn-bg); color: var(--qi-warn); }
.qi-pill-error { background: var(--qi-bad-bg); color: var(--qi-bad); }
.qi-pill-skipped, .qi-pill-interrupted, .qi-pill-stopped { background: #e5e7eb; color: #4b5563; }
.qi-pill-stopping { background: var(--qi-warn-bg); color: var(--qi-warn); }
.qi-pill-failed { background: var(--qi-bad-bg); color: var(--qi-bad); }
.qi-pill-pending, .qi-pill-warn { background: var(--qi-warn-bg); color: var(--qi-warn); }
.qi-pill-running, .qi-pill-info { background: var(--qi-info-bg); color: var(--qi-info); }

.qi-kind {
    display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; background: #eef0f3; color: #4b5563;
}
.qi-kind-content, .qi-kind-table { background: #e9e3fb; color: #5b3cc4; }
.qi-kind-list { background: var(--qi-info-bg); color: var(--qi-info); }
.qi-kind-xref { background: #e3f4f1; color: #0f766e; }
.qi-kind-view, .qi-kind-link { background: #f3e8d8; color: #8a5a12; }
.qi-kind-definition { background: var(--qi-good-bg); color: #15803d; }
.qi-kind-reciprocal { background: transparent; color: var(--qi-muted); box-shadow: inset 0 0 0 1px var(--qi-border-input); }

/* ------- the two ways to start, on the home page ------- */
.qi-start { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; margin-bottom: 20px; }
.qi-start > .qi-card { margin-bottom: 0; display: flex; flex-direction: column; }
@media (max-width: 1000px) { .qi-start { grid-template-columns: 1fr; } }
.qi-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--qi-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.qi-divider::before, .qi-divider::after { content: ""; flex: 1; border-top: 1px solid var(--qi-border-soft); }
.qi-google-status { margin-top: auto; padding-top: 14px; }
.qi-google-status .qi-google { margin-bottom: 0; }
/* The database being worked on, with what can be done to it */
.qi-current {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding: 14px 16px; margin-bottom: 14px; border-radius: var(--qi-radius);
    background: var(--qi-context-bg); border: 1px solid var(--qi-context-line); box-shadow: inset 3px 0 0 var(--qi-red);
}
.qi-current-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.qi-current-name strong { font-size: 16px; color: var(--qi-text-strong); }
.qi-current-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--qi-muted); }
.qi-current form { margin: 0; }
details.qi-details-plain { border: 0; background: none; margin: 0; }
details.qi-details-plain > summary { padding: 6px 0; color: var(--qi-text-strong); font-weight: 600; }
details.qi-details-plain > summary:hover { background: none; text-decoration: underline; }
details.qi-details-plain > .qi-details-body { padding: 8px 0 0; }
.qi-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border: 2px dashed var(--qi-border-input); border-radius: var(--qi-radius); padding: 22px 16px;
    text-align: center; background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s;
}
.qi-drop:hover, .qi-drop.is-over { border-color: var(--qi-red); background: #fff6f4; }
.qi-drop input[type="file"] { display: none; }
.qi-drop strong { color: var(--qi-text-strong); }
.qi-input {
    border: 1px solid var(--qi-border-input); border-radius: var(--qi-radius);
    padding: 7px 10px; font: inherit; background: #fff; color: var(--qi-text-strong); min-width: 0;
}
.qi-input:focus { outline: none; border-color: var(--qi-red); box-shadow: 0 0 0 2px rgba(226,63,35,0.15); }
.qi-input-wide { flex: 1; }
.qi-field { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.qi-label { display: block; font-size: 12px; font-weight: 600; color: var(--qi-muted); margin: 14px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.qi-btn[disabled] { opacity: .5; cursor: not-allowed; }
.qi-btn-danger { background: var(--qi-bad); color: #fff; border-color: #8f1d1d; font-weight: 600; }
.qi-btn-danger:hover { background: #8f1d1d; color: #fff; }
.qi-header-meta a.qi-current-db {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 3px;
    background: rgba(255,255,255,0.1); color: #fff; font-weight: 600; text-decoration: none;
}
.qi-header-meta a.qi-current-db:hover { background: rgba(255,255,255,0.18); }
.qi-header-meta a.qi-current-db.is-empty { background: none; border: 1px dashed rgba(255,255,255,0.25); color: var(--qi-header-muted); font-weight: 500; }
.qi-header-meta a.qi-current-db.is-empty:hover { color: #fff; border-color: rgba(255,255,255,0.5); }

/* ------- mode tabs ------- */
.qi-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--qi-border); margin: 0 0 16px; }
.qi-tabs a {
    padding: 9px 18px; color: var(--qi-muted); font-weight: 600; border: 1px solid transparent; border-bottom: none;
    border-radius: var(--qi-radius) var(--qi-radius) 0 0; margin-bottom: -1px;
}
.qi-tabs a:hover { color: var(--qi-text-strong); text-decoration: none; }
.qi-tabs a.is-active { color: var(--qi-text-strong); background: #fff; border-color: var(--qi-border); box-shadow: inset 0 3px 0 var(--qi-red); }
.qi-tabs a small { display: block; font-weight: 400; font-size: 11px; }
.qi-input-search { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; }
.qi-host-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius); }
.qi-host-list li + li { border-top: 1px solid var(--qi-border-soft); }
.qi-host-list a { display: flex; gap: 8px; align-items: baseline; padding: 9px 12px; color: inherit; text-decoration: none; }
.qi-host-list a:hover, .qi-host-list a:focus { background: #fafbfc; text-decoration: none; }
.qi-host-list a:hover strong { color: var(--qi-red); }
.qi-host-list .qi-host-server { margin-left: auto; }
.qi-host-list .qi-host-go { color: var(--qi-muted); font-size: 16px; line-height: 1; align-self: center; }
.qi-host-list a:hover .qi-host-go { color: var(--qi-red); }
.qi-row-actions { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
details.qi-menu { position: relative; }
.qi-google { display: grid; gap: 6px; justify-items: start; margin-bottom: 14px; }
.qi-google > form, .qi-google > p { margin: 0; }
.qi-google-cli > summary { display: inline-block; list-style: none; cursor: pointer; font-size: 12px; color: var(--qi-muted); }
.qi-google-cli > summary::-webkit-details-marker { display: none; }
.qi-google-cli > summary:hover { color: var(--qi-text); text-decoration: underline; }
.qi-google-cli > form {
    margin-top: 6px; padding: 8px 12px; gap: 6px 10px;
    background: #fafbfc; border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius);
}
details.qi-menu > summary { list-style: none; }
details.qi-menu > summary::-webkit-details-marker { display: none; }
.qi-menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: 4px 0; background: #fff; border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); text-align: left; }
.qi-menu-body form { margin: 0; }
.qi-menu-item { display: block; width: 100%; padding: 7px 14px; border: 0; background: none; font: inherit; font-size: 13px; color: inherit; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.qi-menu-item:hover, .qi-menu-item:focus { background: #fafbfc; }

/* ------- hosts ------- */
.qi-form-grid { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 8px 12px; align-items: baseline; margin-top: 10px; }
.qi-form-grid > label, .qi-form-grid > .qi-form-label { font-size: 13px; font-weight: 600; color: var(--qi-text-strong); }
.qi-form-grid [data-user-hosts].is-off { opacity: .45; }
.qi-form-grid .qi-input { width: 100%; max-width: 360px; }
.qi-form-grid .qi-input-port { max-width: 110px; }
.qi-form-grid .qi-input-full { max-width: none; }
.qi-form-grid span.qi-hint { display: block; margin-top: 3px; }
/* Radio buttons or checkboxes, one a line, each with a word or two of explanation */
.qi-check-list { display: grid; gap: 4px; padding-top: 2px; }
.qi-check-list label { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 400; color: var(--qi-text); cursor: pointer; }
.qi-check-list input { margin: 0; position: relative; top: 2px; accent-color: var(--qi-red); }
.qi-check-list .qi-hint, .qi-form-grid .qi-check-list span.qi-hint { display: inline; margin: 0; }
.qi-fieldset { border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius); margin: 18px 0 0; padding: 4px 14px 14px; }
.qi-fieldset legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--qi-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.qi-keys { margin: 0 0 12px; padding-left: 18px; }
.qi-keys li { margin: 3px 0; }
.qi-key { display: flex; gap: 8px; align-items: baseline; margin: 6px 0; cursor: pointer; }
.qi-keys code, .qi-key code { word-break: break-all; }
.qi-key-text { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; resize: vertical; }

/* ------- validation issues and structure ------- */
.qi-issue-error td:first-child { box-shadow: inset 3px 0 0 var(--qi-bad); }
.qi-issue-warning td:first-child { box-shadow: inset 3px 0 0 var(--qi-warn); }
details.qi-details { border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius); margin-bottom: 8px; background: #fff; }
details.qi-details > summary {
    cursor: pointer; padding: 8px 12px; display: flex; gap: 10px; align-items: center; list-style: none;
}
details.qi-details > summary::-webkit-details-marker { display: none; }
details.qi-details > summary::before { content: "▸"; color: var(--qi-muted); width: 10px; }
details.qi-details[open] > summary::before { content: "▾"; }
details.qi-details > summary:hover { background: #fafbfc; }
details.qi-details > .qi-details-body { padding: 0 12px 12px; }
.qi-summary-meta { margin-left: auto; color: var(--qi-muted); font-size: 12px; }

/* ------- change plan ------- */
.qi-change { display: grid; grid-template-columns: 26px 78px 1fr; gap: 4px 10px; padding: 8px 10px; border-bottom: 1px solid var(--qi-border-soft); align-items: start; }
.qi-change:last-child { border-bottom: none; }
.qi-change:hover { background: #fafbfc; }
.qi-change input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--qi-red); }
.qi-change-title { font-weight: 600; color: var(--qi-text-strong); }
.qi-change-details { grid-column: 3; color: var(--qi-muted); font-size: 12.5px; margin: 0; padding: 0; list-style: none; }
.qi-change-risk { grid-column: 3; color: var(--qi-bad); font-size: 12.5px; font-weight: 500; }
.qi-change-blocked { grid-column: 3; display: block; color: var(--qi-bad); background: var(--qi-bad-bg); border-radius: 4px; padding: 4px 8px; margin-top: 4px; font-size: 12.5px; font-weight: 500; }
.qi-hint.is-bad { color: var(--qi-bad); }
.qi-change.is-off .qi-change-title { color: var(--qi-muted); font-weight: 500; }
.qi-group-title { margin: 18px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--qi-muted); display: flex; gap: 10px; align-items: center; }
.qi-group-title:first-child { margin-top: 0; }
.qi-plan { border: 1px solid var(--qi-border); border-radius: var(--qi-radius); }
.qi-unchanged { margin: 0 0 12px; }
.qi-unchanged summary { cursor: pointer; }
.qi-unchanged ul { max-height: 240px; overflow: auto; }
.qi-sticky { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--qi-border); padding: 14px 0 4px; margin-top: 16px; }
.qi-warning-box { background: var(--qi-warn-bg); color: #7a4d06; border: 1px solid #f0d29a; border-radius: var(--qi-radius); padding: 12px 14px; margin-bottom: 14px; }
.qi-danger-box { background: var(--qi-bad-bg); color: var(--qi-bad); border: 1px solid #f3b6b6; border-radius: var(--qi-radius); padding: 12px 14px; margin-bottom: 14px; }
.qi-danger-box ul, .qi-warning-box ul { margin: 6px 0 0; padding-left: 18px; }
.qi-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.qi-chips code { font-size: 11.5px; }

/* ------- run log ------- */
.qi-log { background: #1a1a1a; color: #d4d4d4; border-radius: var(--qi-radius); padding: 12px 14px; max-height: 620px; overflow: auto; margin: 0; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.qi-log .l-success { color: #4ade80; }
.qi-log .l-warning { color: #fbbf24; }
.qi-log .l-error { color: #f87171; }

/* ------- Google Drive dialog ------- */
dialog.qi-dialog {
    border: 1px solid var(--qi-border); border-radius: 6px; padding: 0; width: min(760px, 94vw);
    box-shadow: 0 20px 50px rgba(0,0,0,.25); color: var(--qi-text);
}
dialog.qi-dialog::backdrop { background: rgba(17,24,39,.45); }
.qi-dialog-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--qi-header-bg); color: #fff; }
.qi-dialog-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.qi-dialog-head button { margin-left: auto; background: none; border: none; color: var(--qi-header-muted); font-size: 22px; cursor: pointer; line-height: 1; }
.qi-dialog-head button:hover { color: #fff; }
.qi-dialog-body { padding: 16px 18px; }
.qi-dialog-body .qi-input { width: 100%; }
dialog.qi-session-dialog { width: min(560px, 94vw); }
.qi-session-dialog .qi-dialog-body p { margin: 0 0 8px; }
.qi-session-dialog .qi-dialog-body p:last-child { margin-bottom: 0; }
dialog.qi-tab-dialog { width: min(980px, 96vw); }
.qi-tab-dialog .qi-dialog-body { max-height: 65vh; overflow: auto; }
.qi-tab-dialog .qi-log { max-height: 40vh; overflow: auto; }
/* The default of a field in a popup: a function with its check and trial, or a long calculated or external default */
dialog.qi-default-dialog { width: min(920px, 96vw); }
.qi-default-dialog .qi-dialog-body { max-height: 76vh; overflow: auto; display: grid; gap: 8px; }
.qi-default-dialog .qi-dialog-body p { margin: 0; }
.qi-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
textarea.qi-code { width: 100%; resize: vertical; tab-size: 4; white-space: pre; overflow: auto; }
.qi-default-heading { margin: 8px 0 0; font-size: 13px; }
.qi-default-tools { display: flex; align-items: flex-start; gap: 10px; }
.qi-default-tools .qi-default-status { flex: 1; padding-top: 4px; }
.qi-default-status { font-size: 12px; margin: 0; white-space: pre-wrap; }
.qi-default-status.is-good { color: var(--qi-good); }
.qi-default-status.is-bad { color: var(--qi-bad); }
.qi-function-try { border-top: 1px solid var(--qi-border-soft); padding-top: 4px; display: grid; gap: 8px; }
.qi-function-inputs { display: grid; gap: 6px; }
.qi-function-input { display: grid; grid-template-columns: minmax(110px, max-content) minmax(90px, max-content) 1fr; align-items: center; gap: 8px; font-size: 12px; }
.qi-function-result { font-size: 12.5px; padding: 6px 8px; border-radius: var(--qi-radius); background: var(--qi-canvas); }
.qi-function-result:empty { display: none; }
.qi-function-result.is-good { background: var(--qi-good-bg); }
.qi-function-result.is-bad { background: var(--qi-bad-bg); color: var(--qi-bad); white-space: pre-wrap; }
.qi-function-value { white-space: pre-wrap; }
.qi-dialog-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--qi-border-soft); }
.qi-dialog-foot:empty { display: none; }
.qi-results { list-style: none; margin: 12px 0 0; padding: 0; max-height: 380px; overflow-y: auto; border: 1px solid var(--qi-border-soft); border-radius: var(--qi-radius); }
.qi-results li { border-bottom: 1px solid var(--qi-border-soft); }
.qi-results li:last-child { border-bottom: none; }
.qi-results button {
    display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; width: 100%;
    padding: 9px 12px; background: #fff; border: none; text-align: left; font: inherit; cursor: pointer; color: inherit;
}
.qi-results button:hover, .qi-results button:focus { background: #fff6f4; outline: none; }
.qi-results .qi-sheet-icon { width: 18px; height: 22px; border-radius: 2px; background: #0f9d58; position: relative; }
.qi-results .qi-sheet-icon::after { content: ""; position: absolute; inset: 7px 4px 5px; border: 1.5px solid #fff; border-radius: 1px; }
.qi-results strong { display: block; color: var(--qi-text-strong); font-weight: 600; }
.qi-results span { color: var(--qi-muted); font-size: 12px; }
.qi-results .qi-empty { padding: 18px; text-align: center; color: var(--qi-muted); }
.qi-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--qi-border); border-top-color: var(--qi-red); border-radius: 50%; animation: qi-spin .7s linear infinite; vertical-align: -2px; }
@keyframes qi-spin { to { transform: rotate(360deg); } }
.qi-busy { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: none; align-items: center; justify-content: center; z-index: 50; flex-direction: column; gap: 10px; font-weight: 600; }
.qi-busy.is-on { display: flex; }
.qi-busy .qi-spinner { width: 28px; height: 28px; border-width: 3px; }

/* ------- forms and buttons ------- */
.qi-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.qi-toolbar input[type="search"], .qi-toolbar select {
    border: 1px solid var(--qi-border-input); border-radius: var(--qi-radius);
    padding: 7px 10px; font: inherit; background: #fff; color: var(--qi-text-strong);
}
.qi-toolbar input[type="search"] { min-width: 280px; }
.qi-toolbar input:focus, .qi-toolbar select:focus { outline: none; border-color: var(--qi-red); box-shadow: 0 0 0 2px rgba(226,63,35,0.15); }
.qi-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--qi-radius);
    border: 1px solid var(--qi-border-input); background: #fff;
    color: var(--qi-text-strong); font: inherit; font-weight: 500; cursor: pointer;
}
.qi-btn:hover { background: #f4f4f4; text-decoration: none; }
.qi-btn-primary { background: var(--qi-save); color: #1a1a1a; border-color: var(--qi-save-dk); font-weight: 600; }
.qi-btn-primary:hover { background: var(--qi-save-dk); color: #fff; }
.qi-btn-small { padding: 3px 10px; font-size: 12px; }
.qi-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------- CLI cheat sheet ------- */
.qi-cli { background: #1a1a1a; color: #e5e5e5; border-radius: var(--qi-radius); padding: 14px 16px; overflow-x: auto; margin: 0; font-size: 12.5px; line-height: 1.7; }
.qi-cli .c { color: #8a8a8a; }

/* ------- pager ------- */
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; flex-wrap: wrap; }
.pagination li a, .pagination li span {
    display: inline-block; padding: 4px 10px; border: 1px solid var(--qi-border); border-radius: 3px;
    background: #fff; color: var(--qi-text); font-size: 13px;
}
.pagination li.active a { background: var(--qi-header-bg); color: #fff; border-color: var(--qi-header-bg); }

/* ------- workbook editor ------- */
.qi-main:has(.qi-editor) { max-width: none; }
.qi-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qi-editor-head form { margin: 0; }
.qi-save-state { padding: 1px 8px; border-radius: 10px; background: var(--qi-subheader); font-size: 12px; }
.qi-save-state.is-good { background: var(--qi-good-bg); color: var(--qi-good); }
.qi-save-state.is-bad { background: var(--qi-bad-bg); color: var(--qi-bad); }
.qi-pending { border: 0; padding: 1px 8px; border-radius: 10px; background: var(--qi-change-bg); color: var(--qi-change); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.qi-pending:hover { box-shadow: inset 0 0 0 1px var(--qi-change); }
/* Scrolled down to, the editor fills the window from a margin above it to the footer (50px) and the padding above that */
.qi-editor {
    display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start;
    --qi-editor-height: max(420px, calc(100vh - 86px));
}
.qi-editor-tabs {
    background: #fff; border: 1px solid var(--qi-border); border-radius: var(--qi-radius);
    box-shadow: var(--qi-shadow); height: var(--qi-editor-height); display: flex; flex-direction: column;
}
.qi-editor-tabs-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--qi-border-soft); }
.qi-editor-tabs-head .qi-label { margin: 0; }
.qi-editor-tabs ul { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; }
.qi-editor-tabs li button {
    display: flex; width: 100%; align-items: center; gap: 6px; padding: 5px 10px; border: 0; background: none;
    font: inherit; font-size: 13px; text-align: left; cursor: pointer; color: var(--qi-text);
}
.qi-editor-tabs li button:hover { background: var(--qi-canvas); }
.qi-editor-tabs li.is-current button { background: var(--qi-subheader); font-weight: 600; box-shadow: inset 3px 0 0 var(--qi-red); }
.qi-editor-tabs li.qi-editor-tab-group {
    display: flex; justify-content: space-between; padding: 10px 10px 3px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--qi-text-strong); border-bottom: 1px solid var(--qi-border-soft);
}
.qi-editor-tabs li.qi-editor-tab-group:not(:first-child) { margin-top: 6px; }
.qi-editor-tab-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-editor-tab-status { font-size: 11px; min-width: 18px; text-align: center; border-radius: 8px; padding: 0 5px; color: var(--qi-muted); }
.qi-editor-tab-status.is-good { color: var(--qi-good); }
.qi-editor-tab-status.is-warn { background: var(--qi-warn-bg); color: var(--qi-warn); }
.qi-editor-tab-status.is-bad { background: var(--qi-bad-bg); color: var(--qi-bad); font-weight: 600; }
.qi-editor-tab-changes { font-size: 11px; min-width: 18px; text-align: center; border-radius: 8px; padding: 0 5px; background: var(--qi-change-bg); color: var(--qi-change); font-weight: 600; }
.qi-editor-tab-changes[hidden] { display: none; }
.qi-editor-summary { border-top: 1px solid var(--qi-border-soft); padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; }
.qi-editor-validity { font-weight: 600; }
.qi-editor-validity.is-good { color: var(--qi-good); }
.qi-editor-validity.is-bad { color: var(--qi-bad); }
.qi-editor-main { padding: 0; overflow: hidden; margin: 0; height: var(--qi-editor-height); display: flex; flex-direction: column; }
.qi-editor-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--qi-border-soft); }
.qi-editor-toolbar strong { font-size: 15px; margin-right: 6px; }
.qi-editor-spacer { flex: 1; }
.qi-editor-main .qi-warning-box { margin: 10px 12px; display: flex; align-items: center; gap: 12px; }
.qi-grid-wrap { overflow: auto; flex: 1 1 0; min-height: 0; scroll-padding-top: 30px; }
.qi-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.qi-grid th {
    position: sticky; top: 0; z-index: 1; background: var(--qi-header-bg); color: #fff; font-weight: 600; text-align: left;
    padding: 5px 6px; white-space: nowrap; font-size: 12px;
}
.qi-grid-letter { color: var(--qi-header-muted); font-weight: 500; margin-right: 2px; }
.qi-grid td { padding: 0; border-bottom: 1px solid var(--qi-border-soft); border-right: 1px solid var(--qi-border-soft); }
.qi-grid td.is-widest, .qi-grid th.is-widest { min-width: 300px; }
.qi-grid td.is-wide, .qi-grid th.is-wide { min-width: 170px; }
.qi-grid td.is-narrow, .qi-grid th.is-narrow { min-width: 80px; }
.qi-grid td.is-narrowest, .qi-grid th.is-narrowest { min-width: 52px; }
.qi-grid td, .qi-grid th { min-width: 88px; }
.qi-grid th.is-annotation { background: var(--qi-header-active); }
.qi-grid td:not(.is-annotation) + td.is-annotation, .qi-grid th:not(.is-annotation) + th.is-annotation { border-left: 2px solid var(--qi-border); }
.qi-grid .qi-grid-num { min-width: 52px; width: 52px; white-space: nowrap; text-align: right; color: var(--qi-muted); padding: 0 6px; background: var(--qi-canvas); font-variant-numeric: tabular-nums; }
.qi-grid th.qi-grid-num { background: var(--qi-header-bg); }
.qi-grid .qi-grid-on { min-width: 0; width: 24px; padding: 0 4px; text-align: center; background: var(--qi-canvas); }
.qi-grid th.qi-grid-on { background: var(--qi-header-bg); cursor: help; }
.qi-online { margin: 0; vertical-align: middle; cursor: pointer; accent-color: var(--qi-text); }
.qi-online:disabled { cursor: not-allowed; opacity: .4; }
.qi-grid th.qi-grid-on { white-space: nowrap; }
.qi-online.has-error { outline: 2px solid var(--qi-bad); outline-offset: 1px; }
.qi-online.has-warning { outline: 2px solid var(--qi-warn); outline-offset: 1px; }
/* Offline: Qi keeps the field or relationship, but does not show it */
.qi-grid tr.is-offline td:not(.qi-grid-num):not(.qi-grid-on):not(.qi-grid-actions) {
    background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(107, 114, 128, .08) 5px 10px);
}
.qi-grid tr.is-offline .qi-cell { color: var(--qi-muted); }
.qi-drag { float: left; cursor: grab; color: var(--qi-muted); opacity: .45; padding: 0 2px; user-select: none; }
.qi-grid tr:hover .qi-drag { opacity: 1; }
.qi-drag:hover { color: var(--qi-text-strong); }
.qi-grid tr.is-dragging td { opacity: .4; }
.qi-grid tr.is-drop-before td { box-shadow: inset 0 3px 0 var(--qi-red); }
.qi-grid tr.is-drop-after td { box-shadow: inset 0 -3px 0 var(--qi-red); }
.qi-grid tr.is-table .qi-cell[data-c="A"] { font-weight: 600; }
.qi-grid tr.is-moved td { animation: qi-moved 1.4s ease-out; }
@keyframes qi-moved { from { background-color: var(--qi-info-bg); } }
.qi-cell {
    width: 100%; border: 0; background: transparent; font: inherit; padding: 5px 6px; color: var(--qi-text); outline: none;
}
select.qi-cell { padding: 4px 2px; cursor: pointer; }
/* The annotations: a line for each of their values, without wrapping, as the other cells */
textarea.qi-cell { display: block; resize: none; overflow: hidden; white-space: pre; }
.qi-cell:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--qi-info); }
/* The fill handle of the cell worked on, and the cells a drag of it copies the value into */
.qi-grid td:has(> .qi-fill-handle) { position: relative; }
.qi-fill-handle {
    position: absolute; right: 0; bottom: 0; width: 7px; height: 7px; z-index: 2;
    background: var(--qi-info); border: 1px solid #fff; cursor: crosshair;
}
.qi-grid td.is-fill { background: var(--qi-info-bg); box-shadow: inset 0 0 0 1px var(--qi-info); }
.qi-grid td.is-fill .qi-cell { background: transparent; }
body.is-filling, body.is-filling * { cursor: crosshair !important; user-select: none; }
.qi-cell.has-error { background: var(--qi-bad-bg); box-shadow: inset 0 0 0 1px var(--qi-bad); }
.qi-cell.has-warning { background: var(--qi-warn-bg); }
.qi-grid-actions { white-space: nowrap; min-width: 0 !important; width: 1%; padding: 0 4px !important; }
.qi-grid td.qi-grid-actions { background: var(--qi-canvas); }
.qi-grid-actions button {
    border: 0; background: none; cursor: pointer; color: var(--qi-muted); padding: 3px 4px; font-size: 13px; line-height: 1;
    opacity: .35;
}
.qi-grid tr:hover .qi-grid-actions button, .qi-grid tr:focus-within .qi-grid-actions button { opacity: 1; }
.qi-grid-actions button:hover { color: var(--qi-text-strong); }
.qi-grid-actions button[data-act=delete]:hover { color: var(--qi-bad); }
.qi-grid-empty { padding: 16px !important; color: var(--qi-muted); text-align: center; }
.qi-grid tr.qi-set td { background: var(--qi-canvas); border-top: 4px solid var(--qi-text); padding: 3px 6px; font-size: 12px; }
.qi-grid tr.qi-set td.qi-grid-actions { padding: 0 4px !important; }
.qi-set-name { font-weight: 600; color: var(--qi-text-strong); }
.qi-grid tr.qi-set.is-empty .qi-set-name { font-style: italic; font-weight: 500; }
.qi-grid tr.qi-set button:disabled { opacity: .35; cursor: default; }
.qi-grid tr.qi-set button[data-act=tab-field], .qi-grid tr.qi-set button[data-act=tabs-remove], .qi-grid tr.qi-set button[data-act=type-rename] {
    margin-left: 10px; border: 1px solid var(--qi-border-soft); background: #fff; border-radius: 3px; cursor: pointer;
    font: inherit; font-size: 11px; padding: 0 6px; color: var(--qi-muted);
}
.qi-grid tr.qi-set button[data-act=tab-field]:hover, .qi-grid tr.qi-set button[data-act=tabs-remove]:hover,
.qi-grid tr.qi-set button[data-act=type-rename]:hover { color: var(--qi-text-strong); border-color: var(--qi-muted); }
/* The name of a content or list type in Qi, next to its table */
.qi-set-type { color: var(--qi-text-strong); }
.qi-set-renamed { color: var(--qi-info); }
.qi-grid tr.qi-set button[data-act=type-rename] { margin-left: 6px; }
.qi-grid tr.qi-set.is-loose td { background: var(--qi-warn-bg); }
.qi-set-warning { color: var(--qi-warn); font-weight: 600; }
/* The relationships of a table come after all its fields, tab by tab */
.qi-grid tr.qi-set.is-links .qi-set-name::before { content: '⇄ '; color: var(--qi-muted); font-weight: 500; }
/* Columns of the database that no configuration uses, under the fields of their table or relationship */
.qi-grid tr.qi-unconfigured-set td { background: var(--qi-canvas); border-top: 1px dashed var(--qi-muted); padding: 3px 6px; font-size: 12px; }
.qi-grid tr.qi-unconfigured-set .qi-set-name { font-style: italic; color: var(--qi-muted); }
.qi-grid tr.qi-unconfigured-set button {
    margin-left: 8px; border: 1px solid var(--qi-border); border-radius: 4px; background: #fff; cursor: pointer;
    font: inherit; font-size: 11px; padding: 0 6px; color: var(--qi-muted);
}
.qi-grid tr.qi-unconfigured-set button:hover { color: var(--qi-text-strong); border-color: var(--qi-muted); }
.qi-grid tr.qi-unconfigured td:not(.qi-grid-num):not(.qi-grid-on):not(.qi-grid-actions) {
    background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0, 0, 0, .035) 6px 12px);
    padding: 4px 6px; color: var(--qi-muted); font-style: italic; font-size: 12.5px; white-space: nowrap;
}
.qi-grid tr.qi-unconfigured td.is-field { color: var(--qi-text); }
.qi-unconfigured-info { font-style: normal; font-size: 11.5px; }
.qi-grid tr.qi-unconfigured.is-in-link td:not(.qi-grid-num):not(.qi-grid-on):not(.qi-grid-actions),
.qi-grid tr.qi-unconfigured-set.is-in-link td:not(.qi-grid-num):not(.qi-grid-actions) { background-color: var(--qi-context-bg); }
.qi-grid tr.qi-unconfigured.is-in-link td.is-field { padding-left: 20px; }
.qi-grid tr.qi-unconfigured-set button[data-act=drop]:hover, .qi-grid-actions button[data-act=drop]:hover { color: var(--qi-bad); border-color: var(--qi-bad); }
/* Above each table of a tab: its name, what it has, and what can be done with all of it */
.qi-grid tr.qi-set.is-table-set td { background: var(--qi-subheader); padding: 5px 6px; font-size: 13px; }
.qi-grid tr.qi-set.is-table-set + tr.qi-set td { border-top-width: 1px; }
.qi-grid td.is-locked .qi-cell { color: var(--qi-muted); cursor: not-allowed; }
.qi-grid td.is-locked .qi-cell:focus:not(.has-error):not(.has-warning) { background: transparent; }
.qi-grid td.has-popup { position: relative; }
.qi-grid td.has-popup .qi-cell { padding-right: 24px; }
.qi-cell-popup {
    position: absolute; right: 3px; top: 50%; transform: translateY(-50%); padding: 2px 4px; border: 1px solid var(--qi-border);
    border-radius: 3px; background: var(--qi-bg); color: var(--qi-muted); font-size: 11px; line-height: 1; cursor: pointer; opacity: .6;
}
.qi-grid tr:hover .qi-cell-popup { opacity: 1; }
.qi-cell-popup:hover { color: var(--qi-text-strong); border-color: var(--qi-muted); }
.qi-grid tr.is-again .qi-cell[data-c="A"] { font-style: italic; }
.qi-grid tr.qi-line td { padding: 0 8px; border: 0; background: var(--qi-subheader); font-size: 11px; line-height: 15px; }
.qi-grid tr.is-context td:not(.qi-grid-num):not(.qi-grid-on):not(.qi-grid-actions) { background-color: var(--qi-context-bg); }
.qi-grid tr.is-context .qi-cell[data-c="B"] { padding-left: 14px; }

/* The first row of a relationship: its definition, where its fields are configured, stands out; a reciprocal, which
   only adds the link back, is set back, and the fields under it are ignored */
.qi-grid tr.is-definition > td.qi-grid-num { box-shadow: inset 3px 0 0 var(--qi-good); }
.qi-grid tr.is-definition .qi-cell[data-c="A"] { font-weight: 600; }
.qi-grid tr.is-reciprocal > td.qi-grid-num { box-shadow: inset 3px 0 0 var(--qi-border-input); }
.qi-grid tr.is-reciprocal .qi-cell[data-c="A"] { font-weight: normal; font-style: italic; color: var(--qi-muted); }
.qi-grid tr.is-reciprocal .qi-cell[data-c="A"]::placeholder { color: var(--qi-muted); }
.qi-grid tr.is-ignored .qi-cell { color: var(--qi-muted); text-decoration: line-through; }
.qi-grid tr.is-ignored > td.qi-grid-num { box-shadow: inset 3px 0 0 var(--qi-bad); }

/* A row removed since the workbook was read: it stays, read-only, until a commit removes it from the database too */
.qi-grid tr.is-removed td { background: #fdeaee; }
/* A list nothing uses: a badge and a button to delete it in its table's header, and every one in the summary */
.qi-set-unused { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; vertical-align: middle; }
.qi-editor-unused { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--qi-warn-bg); border-radius: 6px; background: #fffaf0; }
.qi-editor-unused-title { font-size: 12px; }
.qi-editor-unused-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; }
.qi-grid tr.is-removed td.qi-grid-num { color: var(--qi-bad); text-align: center; box-shadow: inset 3px 0 0 var(--qi-bad); }
.qi-grid tr.is-removed .qi-removed-cell {
    display: block; padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    color: #9b2c3f; text-decoration: line-through; text-decoration-color: rgba(155, 44, 63, .45);
}
/* Edits not committed yet: a bar by the row number (new, changed, moved), and the cells that changed */
.qi-grid tr.is-pending-moved td.qi-grid-num { box-shadow: inset 4px 0 0 var(--qi-info); }
.qi-grid tr.is-pending-changed td.qi-grid-num { box-shadow: inset 4px 0 0 var(--qi-change); }
.qi-grid tr.is-pending-new td.qi-grid-num { box-shadow: inset 4px 0 0 var(--qi-good); }
.qi-grid tr.is-pending-new td:not(.qi-grid-num):not(.qi-grid-on):not(.qi-grid-actions) { background-color: var(--qi-new-bg); }
.qi-grid tr.qi-set.is-pending-new td { background: var(--qi-new-bg); }
/* A cell the editor keeps is grey, over the backgrounds of its row */
.qi-grid tr[data-row] td.is-locked:not(.qi-grid-num):not(.qi-grid-actions) { background-color: var(--qi-locked-bg); }
/* A changed cell is light purple, over the backgrounds of its row, and while it is being edited too; issues show over it */
.qi-grid tr[data-row] td.is-pending:not(.qi-grid-num):not(.qi-grid-actions) { background-color: var(--qi-change-bg); }
.qi-grid td.is-pending .qi-cell:focus:not(.has-error):not(.has-warning) { background-color: var(--qi-change-bg); }
.qi-set-pending { color: var(--qi-change); font-weight: 600; }
.qi-pending-removed { margin: 8px 12px 0; padding: 6px 10px; border-radius: var(--qi-radius); background: var(--qi-change-bg); color: var(--qi-change); font-size: 12px; }
.qi-grid tr.qi-line.is-context td:not(.qi-grid-num):not(.qi-grid-actions) { background: var(--qi-context-line); padding-left: 16px; }
/* Under the first row of a many-to-many relationship: its main definition and reciprocals, linked to each other */
.qi-grid tr.qi-relation-line td { padding: 1px 8px 2px 14px; border-right: 0; background: var(--qi-context-bg); font-size: 11px; line-height: 16px; }
.qi-grid tr.qi-relation-line td.qi-grid-num, .qi-grid tr.qi-relation-line td.qi-grid-actions { padding: 0; background: var(--qi-canvas); }
.qi-relation-go, .qi-relation-add { border: 0; background: none; padding: 0; font: inherit; color: var(--qi-info); cursor: pointer; }
.qi-relation-go:hover, .qi-relation-add:hover { text-decoration: underline; }
.qi-relation-add { font-weight: 600; }
.qi-relation-add[disabled] { color: var(--qi-muted); font-weight: 400; cursor: help; text-decoration: none; }
.qi-grid tr.qi-line td.qi-grid-num, .qi-grid tr.qi-line td.qi-grid-actions { background: var(--qi-subheader); }
.qi-grid tr.qi-line span { color: var(--qi-good); font-weight: 600; font-variant-numeric: tabular-nums; }
.qi-grid tr.qi-line.is-short span,
.qi-grid tr.qi-line.is-over span { color: var(--qi-bad); }
.qi-editor-issues { padding: 0 12px; max-height: 30%; overflow-y: auto; }
.qi-editor-issues-toggle {
    position: sticky; top: 0; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0;
    border: 0; background: #fff; font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
}
.qi-editor-issues-toggle::before { content: "▸"; color: var(--qi-muted); width: 10px; }
.qi-editor-issues-toggle[aria-expanded="true"]::before { content: "▾"; }
.qi-editor-issues-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.qi-editor-issues-count.is-bad { color: var(--qi-bad); }
.qi-editor-issues-count.is-warn { color: var(--qi-warn); }
.qi-editor-issues ul { list-style: none; margin: 0 0 12px; padding: 0; font-size: 12.5px; display: grid; gap: 2px; }
.qi-editor-issues li { padding: 3px 8px; border-radius: 3px; }
.qi-editor-issues li.is-link { cursor: pointer; }
.qi-editor-issues li.is-link:hover { background: var(--qi-canvas); }
.qi-editor-issues .qi-issue-error { box-shadow: inset 3px 0 0 var(--qi-bad); }
.qi-editor-issues .qi-issue-warning { box-shadow: inset 3px 0 0 var(--qi-warn); }

/* ------- footer ------- */
.qi-footer { padding: 14px 32px; color: var(--qi-muted); font-size: 12px; text-align: center; border-top: 1px solid var(--qi-border); background: #fff; }
.qi-editor-unused-list .qi-link-button { color: var(--qi-info); }
.qi-grid tr.qi-set button[data-act=delete-table] { padding: 1px 10px; font-size: 11px; border-radius: 3px; cursor: pointer; }
/* A table removed whole: its header, pink, with what committing does */
.qi-grid tr.qi-set.is-removed-set td { background: #fbdde3; border-top-color: var(--qi-bad); }
.qi-grid tr.qi-set.is-removed-set .qi-set-name { color: #9b2c3f; text-decoration: line-through; }
.qi-grid tr.qi-set.is-removed-set .qi-pill { margin: 0 8px; }
/* The lists made by fields, at the end of the lists tab: one line each, with the rows that use it */
.qi-grid tr.qi-implicit-list td { padding: 4px 14px; font-size: 12.5px; border-bottom: 1px solid var(--qi-border-soft); background: #fff; }
.qi-implicit-name { font-weight: 600; color: var(--qi-text-strong); }
.qi-grid tr.qi-implicit-list .qi-link-button { color: var(--qi-info); }
