/* Hearth additions on the shared shell (app.css): global search, result lists, source marks, access explanations. */

.topsearch { position: relative; display: flex; align-items: center; flex: 0 1 520px; min-width: 0; }
.topsearch .icon { position: absolute; left: 12px; color: var(--faint); font-size: 19px; pointer-events: none; }
.topsearch .input { width: 100%; height: 40px; border-radius: 20px; padding-left: 40px; background: var(--surface-2); border-color: transparent; }
.topsearch .input:focus { background: var(--surface); }

/* Source marks: icon on a tinted square, the same everywhere a source is named. */
.src { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--struct); white-space: nowrap; }
.src .mark { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--struct); }
.src .mark .icon { font-size: 16px; }
.src.slack .mark { background: #F1E6F3; color: #6B2C70; }
.src.drive .mark { background: #E3EEFB; color: #1F5FB8; }
.src.github .mark { background: #E9ECF1; color: #1F2733; }
.src.granola .mark { background: #E5F2EA; color: #2F7A4A; }
.src.claude .mark { background: var(--accent-soft); color: var(--accent-text); }
.src.notes .mark { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="dark"] .src .mark { background: var(--surface-3); color: var(--struct); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src .mark { background: var(--surface-3); color: var(--struct); } }

/* Filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--struct); font-size: 13px; font-weight: 500; cursor: pointer; }
.filter .icon { font-size: 17px; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filter .n { font-variant-numeric: tabular-nums; color: var(--faint); font-weight: 600; font-size: 12px; }
.filter[aria-pressed="true"] .n { color: var(--nav-muted); }

/* Result list */
.results { display: flex; flex-direction: column; }
.result { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 18px; border-top: 1px solid var(--line); cursor: pointer; text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; width: 100%; }
.result:first-child { border-top: 0; }
.result:hover { background: var(--surface-1); }
.result[aria-current="true"] { background: var(--info-soft); box-shadow: inset 3px 0 0 var(--info); }
.result .src { grid-row: 1 / 3; align-self: start; }
.result .t { color: var(--ink); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .when { font-size: 12px; color: var(--faint); white-space: nowrap; }
.result .snip { grid-column: 2 / 4; color: var(--muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result .meta { grid-column: 2 / 4; display: flex; gap: 8px; align-items: center; margin-top: 2px; }

/* Item text */
.doc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.65; color: var(--body); max-height: 60vh; overflow: auto; background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.doc.full { max-height: none; }

/* "Why you can see this" and access lists */
.why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.why li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; }
.why li .icon { font-size: 18px; color: var(--good); }
.why li .p { font: 500 11.5px var(--mono); color: var(--faint); overflow-wrap: anywhere; }
.access-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* Notes */
.note { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.note:first-child { border-top: 0; }
.note .body { white-space: pre-wrap; color: var(--ink); font-size: 14px; line-height: 1.6; }
.note .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.note .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note textarea { width: 100%; min-height: 160px; font: inherit; font-size: 14px; line-height: 1.6; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, transparent); color: var(--ink); resize: vertical; }

/* Source health */
.scope-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.scope-row:first-child { border-top: 0; }
.source-card .card-head { padding-bottom: 4px; }
.source-card .count { font-size: 26px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }

/* Simple tables */
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 0 14px; height: 40px; border-bottom: 1px solid var(--line); color: var(--body); }
table.list tr:last-child td { border-bottom: 0; }
table.list td.num { text-align: right; }

.signin-dev { display: flex; gap: 8px; }
.signin-dev .input { flex: 1; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--faint); }

/* Utilities (the CSP allows no inline styles) */
.sk-line.w0 { width: 90%; } .sk-line.w1 { width: 78%; } .sk-line.w2 { width: 66%; } .sk-line.w3 { width: 54%; }
.sheet-title { margin-top: 8px !important; }
.scopes { margin-top: 12px; }
.flush-top { padding-top: 0 !important; }
.grow { flex: 1; }
.input.compact { height: 30px; font-size: 12.5px; }
.signin-page .left .tagline { font-size: 11px; letter-spacing: .12em; }

/* Weaker search matches, folded */
details.weak { border-top: 1px solid var(--line); }
details.weak summary { padding: 12px 18px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 6px; }
details.weak summary::before { content: "expand_more"; font-family: "Material Symbols Rounded"; font-size: 18px; transition: transform .15s; }
details.weak[open] summary::before { transform: rotate(180deg); }
details.weak .result { opacity: .85; }

/* Ask */
.page-actions { display: flex; justify-content: flex-end; margin-top: -12px; }
.card.chat { display: flex; flex-direction: column; min-height: calc(100vh - var(--top) - 190px); }
.thread { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - var(--top) - 300px); }
.turn { display: flex; gap: 12px; align-items: flex-start; }
.turn.user { justify-content: flex-end; }
.turn.user .bubble { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 70%; white-space: pre-wrap; font-size: 14.5px; }
.turn.assistant .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.avatar.ai { background: var(--accent-soft); color: var(--accent-text); flex: none; }
.avatar.ai .icon { font-size: 18px; }
.cite-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin: 0 1px; border-radius: 9px; border: 0; background: var(--info-soft); color: var(--info); font: 600 11px var(--font); cursor: pointer; vertical-align: 2px; }
.cite-n:hover { background: var(--info); color: var(--surface); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; height: 30px; padding: 0 10px 0 4px; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--body); }
.source-chip:hover { background: var(--surface-1); }
.source-chip .n { width: 20px; height: 20px; border-radius: 10px; background: var(--info-soft); color: var(--info); display: grid; place-items: center; font-weight: 600; font-size: 11px; }
.source-chip .src .mark { width: 20px; height: 20px; }
.source-chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.chat-composer { border-top: 1px solid var(--line); padding: 14px 18px; }
.chat-composer textarea { min-height: 52px; }

/* Connectors */
.setting { display: grid; grid-template-columns: minmax(0, 420px) auto minmax(0, 1fr); gap: 10px; align-items: end; }
.setting .hint { padding-bottom: 8px; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: 13px; }
.checklist li .icon { font-size: 19px; color: var(--faint); }
.checklist li.ok .icon { color: var(--good); }
.warn-text { color: var(--warn); }
