/* Find a tool or setting: the search bar in the header, its dialog, and the
 * highlight left on the setting a result lands on. */
.finder-btn, #finder-dialog {
    --finder-line: #2f3d52;
    --finder-muted: #94a3b8;
    --finder-dim: #64748b;
    --finder-ring: #60a5fa;
    --finder-tint: rgba(37, 99, 235, .2);
    --finder-well: #0f172a;
}

/* ---- Search bar in the header ---- */
/* The slot is whatever room the header has spare. The bar is sized from the
 * slot, never the other way round, so the header's own controls are not
 * squeezed to make space for it. */
.finder-slot { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; container: finder / inline-size; }
.workspace-beta .finder-slot { margin: 0 -6px; } /* the slot adds no flex gap of its own */
.finder-btn { box-sizing: border-box; flex: 0 1 300px; min-width: 0; height: 32px; margin: 0 16px; padding: 0 8px 0 10px; display: flex; align-items: center; gap: 8px; background: var(--finder-well); border: 1px solid var(--finder-line); border-radius: 8px; color: var(--finder-muted); font: inherit; font-size: 13px; cursor: text; transition: border-color .15s ease, color .15s ease; }
.finder-btn svg { flex: 0 0 auto; width: 15px; height: 15px; }
.finder-btn-label { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder-btn-key { flex: 0 0 auto; padding: 1px 6px; border: 1px solid var(--finder-line); border-radius: 4px; background: var(--surface); color: var(--finder-dim); font: inherit; font-size: 11px; line-height: 16px; white-space: nowrap; }
.finder-btn:hover { border-color: var(--finder-dim); color: var(--text-primary); }
.finder-btn:focus-visible { outline: 2px solid var(--finder-ring); outline-offset: 2px; }
.workspace-beta .finder-btn { height: 30px; border-radius: 6px; }
@container finder (max-width: 250px) { .finder-btn-key { display: none; } }
@container finder (max-width: 190px) {
    .finder-btn { flex: 0 0 34px; margin: 0 6px; padding: 0; justify-content: center; cursor: pointer; }
    .finder-btn-label { display: none; }
}
@container finder (max-width: 45px) { .finder-btn { display: none; } } /* Ctrl / ⌘ K still opens it */
/* Browsers without container queries: size the bar from the window instead. */
@supports not (container-type: inline-size) {
    .finder-slot { flex: 0 1 auto; }
    @media (max-width: 1280px) {
        .finder-btn { flex: 0 0 34px; margin: 0 6px; padding: 0; justify-content: center; cursor: pointer; }
        .finder-btn-label, .finder-btn-key { display: none; }
    }
}
/* Touch layouts keep the header to a row of round buttons: the bar becomes one of them. */
body.layout-touch .finder-slot { flex: 0 0 auto; margin: 0 4px 0 auto; container-type: normal; }
body.layout-touch .finder-btn { flex: 0 0 32px; width: 32px; height: 32px; margin: 0; padding: 0; justify-content: center; border-radius: 50%; background: var(--surface-light); border-color: var(--border-color); cursor: pointer; }
body.layout-touch .finder-btn-label, body.layout-touch .finder-btn-key { display: none; }

/* ---- Dialog ---- */
#finder-dialog { box-sizing: border-box; width: min(640px, calc(100vw - 24px)); max-width: none; max-height: none; margin: 11vh auto auto; padding: 0; overflow: visible; background: transparent; border: 0; color: var(--text-primary); }
#finder-dialog::backdrop { background: rgba(8, 11, 18, .62); }
#finder-dialog .finder-box { display: flex; flex-direction: column; max-height: min(560px, calc(100dvh - 11vh - 24px)); background: var(--surface); border: 1px solid var(--finder-line); border-radius: 12px; box-shadow: var(--shadow-pop, 0 24px 64px -16px rgba(0, 0, 0, .7)); overflow: hidden; }
#finder-dialog .finder-field { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--finder-line); }
#finder-dialog .finder-field svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--finder-muted); }
#finder-input { flex: 1 1 auto; min-width: 0; height: 52px; margin: 0; padding: 0; background: transparent; border: 0; outline: 0; box-shadow: none; color: var(--text-primary); font: inherit; font-size: 16px; }
#finder-input::placeholder { color: var(--finder-dim); }
#finder-dialog .finder-close { flex: 0 0 auto; width: auto; min-height: 0; padding: 2px 7px; background: var(--finder-well); border: 1px solid var(--finder-line); border-radius: 5px; color: var(--finder-muted); font: inherit; font-size: 11px; line-height: 16px; cursor: pointer; }
#finder-dialog .finder-close:hover { color: var(--text-primary); border-color: var(--finder-dim); }
#finder-dialog .finder-close:focus-visible { outline: 2px solid var(--finder-ring); outline-offset: 2px; }
#finder-status { flex: 0 0 auto; margin: 0; padding: 10px 16px 6px; color: var(--finder-dim); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
#finder-results { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 8px; }
#finder-results:empty { padding-bottom: 0; }

.finder-result { display: block; padding: 9px 10px 10px; border-radius: 8px; border-left: 2px solid transparent; cursor: pointer; }
.finder-result[aria-selected="true"] { background: var(--finder-tint); border-left-color: var(--finder-ring); }
/* On a narrow screen the value drops to its own line rather than squeezing the name. */
.finder-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.finder-name { flex: 0 0 auto; max-width: 100%; font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.finder-scope { flex: 0 0 auto; padding: 0 6px; border: 1px solid var(--finder-line); border-radius: 999px; color: var(--finder-muted); font-size: 11px; line-height: 17px; white-space: nowrap; }
.finder-scope[data-scope="shape"] { border-color: transparent; background: var(--finder-tint); color: #bfdbfe; }
.finder-value { flex: 1 1 90px; min-width: 0; text-align: right; color: var(--text-primary); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder-about { display: block; margin-top: 2px; color: var(--finder-muted); font-size: 12.5px; line-height: 1.45; }
.finder-note { display: block; margin-top: 3px; color: var(--warning, #f59e0b); font-size: 12px; }

#finder-dialog .finder-foot { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 0; padding: 8px 16px; border-top: 1px solid var(--finder-line); background: var(--finder-well); color: var(--finder-dim); font-size: 11.5px; }
#finder-dialog .finder-foot span:last-child { margin-left: auto; }
#finder-dialog .finder-foot kbd { display: inline-block; min-width: 18px; margin-right: 3px; padding: 0 4px; border: 1px solid var(--finder-line); border-radius: 4px; background: var(--surface); color: var(--finder-muted); font: inherit; font-size: 11px; line-height: 16px; text-align: center; }
@media (max-width: 560px) {
    #finder-dialog { margin-top: 12px; }
    #finder-dialog .finder-box { max-height: calc(100dvh - 24px); }
    #finder-dialog .finder-foot span:not(:last-child) { display: none; }
    #finder-dialog .finder-foot span:last-child { margin-left: 0; }
}

/* ---- Where a result lands ---- */
/* A ring only: the setting keeps its own background, whatever it is. */
.finder-flash { animation: finder-flash 2.4s ease-out; }
@keyframes finder-flash {
    0%, 55% { box-shadow: 0 0 0 2px var(--accent, #ff7a18), 0 0 0 6px rgba(255, 122, 24, .25); }
    100% { box-shadow: 0 0 0 2px rgba(255, 122, 24, 0), 0 0 0 6px rgba(255, 122, 24, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .finder-flash { animation: none; box-shadow: 0 0 0 2px var(--accent, #ff7a18); }
    .finder-btn { transition: none; }
}
