/* Knowledge surfaces inherit the HelpDesk theme and never add remote assets. */
.knowledge-center-hero { padding: clamp(20px, 2.5vw, 32px); }
.knowledge-center-heading, .knowledge-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.knowledge-center-heading h1 { margin: 8px 0 9px; font-size: clamp(25px, 2.3vw, 36px); line-height: 1.2; }
.knowledge-center-heading p { margin: 0; color: var(--muted); }
.knowledge-center-heading > button { flex-shrink: 0; margin-top: 8px; }
.knowledge-center-tools { display: flex; align-items: end; gap: 12px; margin-top: 24px; }
.knowledge-search-field { display: grid; gap: 7px; flex: 1; min-width: 0; font-weight: 650; }
.knowledge-search-field > span { font-size: 13px; }
.knowledge-search-field input { width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--control-stroke); border-radius: 13px; padding: 12px 15px; background: var(--control-bg); color: inherit; font: inherit; }
.knowledge-search-field input:focus { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.knowledge-tabs { display: flex; gap: 6px; width: fit-content; padding: 5px; margin-top: 18px; background: var(--control-bg); border: 1px solid var(--stroke); border-radius: 12px; }
.knowledge-tabs button { border: 0; background: transparent; color: inherit; padding: 9px 13px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.knowledge-tabs button.is-active { background: rgba(64,135,234,.33); box-shadow: inset 0 0 0 1px rgba(151,197,255,.2); }
.knowledge-center-layout { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(0, 1.55fr); align-items: start; gap: 18px; margin-top: 18px; }
.knowledge-center-list { padding: 12px; display: grid; gap: 8px; max-height: 850px; overflow-y: auto; }
.knowledge-center-detail { min-width: 0; min-height: 260px; padding: clamp(20px, 2.1vw, 30px); overflow-wrap: anywhere; }
.knowledge-result { display: grid; gap: 9px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--stroke); color: inherit; padding: 16px; border-radius: 14px; font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.knowledge-result:hover, .knowledge-result.is-selected { background: var(--surface-hover); border-color: var(--primary); }
.knowledge-result:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.knowledge-result > strong { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.knowledge-result > small { color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.knowledge-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.knowledge-badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 8px; color: #cfdaea; border: 1px solid rgba(181,200,228,.18); background: rgba(178,199,228,.08); font-size: 12px; font-weight: 650; line-height: 1.35; }
.knowledge-badge svg { width: 11px; height: 11px; margin-right: 4px; stroke: currentColor; fill: none; flex-shrink: 0; }
.knowledge-badge.is-confidential { color: #ffdaad; border-color: rgba(255,190,94,.32); background: rgba(217,136,27,.14); }
.knowledge-badge.is-ai { color: #cfc5ff; border-color: rgba(171,142,255,.3); background: rgba(157,121,255,.12); }
.knowledge-origin { color: #cdbff6; font-size: 12px; }
.knowledge-detail-heading { margin-top: 18px; }
.knowledge-detail-heading h2 { margin: 0; line-height: 1.3; font-size: 24px; }
.knowledge-detail-heading > button { flex-shrink: 0; }
.knowledge-lead { line-height: 1.65; color: var(--muted); padding-bottom: 16px; border-bottom: 1px solid rgba(172,191,219,.15); }
.knowledge-content { line-height: 1.75; font-size: 14px; overflow-wrap: anywhere; }
.knowledge-content p { white-space: pre-wrap; margin: .8em 0; }
.knowledge-content h3 { margin: 1.35em 0 .55em; line-height: 1.4; font-size: 18px; }
.knowledge-content h3:first-child { margin-top: .5em; }
.knowledge-content ul, .knowledge-content ol { padding-left: 25px; margin: .7em 0; }
.knowledge-content li { padding: 3px 0 3px 4px; white-space: pre-wrap; }
.knowledge-content a { color: #9dcaff; text-underline-offset: 3px; }
.knowledge-content blockquote { margin: 15px 0; padding: 13px 17px; border-left: 3px solid #b7a7f1; border-radius: 0 10px 10px 0; background: rgba(157,130,226,.09); white-space: pre-wrap; }
.knowledge-content pre { max-width: 100%; white-space: pre-wrap; padding: 15px; background: rgba(0,0,0,.2); border: 1px solid rgba(181,201,233,.16); border-radius: 10px; overflow-wrap: anywhere; }
.knowledge-content code { font-size: .91em; background: rgba(159,181,212,.1); border-radius: 4px; padding: 2px 4px; }
.knowledge-detail-footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid rgba(168,191,223,.16); margin-top: 24px; padding-top: 15px; font-size: 12px; color: var(--muted); }
.knowledge-empty { display: grid; justify-items: center; text-align: center; padding: 35px 15px; color: var(--muted); }
.knowledge-empty > span { font-size: 35px; color: #b9d2f2; }
.knowledge-empty h2, .knowledge-empty h3 { color: var(--text, #f3f6fc); margin: 14px 0 8px; }
.knowledge-empty p { margin: 0; font-size: 13px; line-height: 1.6; }
.knowledge-review-notice { padding: 14px 16px; border: 1px solid rgba(245,192,112,.25); border-radius: 12px; background: rgba(217,151,68,.08); font-size: 13px; line-height: 1.6; margin: 18px 0; }
.knowledge-review-notice p { margin: 7px 0 0; }
.knowledge-editor { display: grid; gap: 16px; }
.knowledge-editor .knowledge-detail-heading { margin-top: 0; }
.knowledge-editor label.field { display: grid; gap: 7px; margin: 0; font-size: 13px; font-weight: 650; }
.knowledge-editor input[type=text], .knowledge-editor textarea, .knowledge-editor select { width: 100%; min-width: 0; border-radius: 11px; border: 1px solid var(--control-stroke); color: var(--text); background: var(--control-bg); padding: 12px; font: inherit; }
.knowledge-editor textarea { resize: none; line-height: 1.6; }
.knowledge-editor textarea.knowledge-markdown { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; min-height: 230px; }
.knowledge-editor-toolbar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: -10px; }
.knowledge-editor-toolbar button { color: inherit; font: inherit; font-size: 12px; padding: 7px 9px; border: 1px solid rgba(172,193,223,.2); border-radius: 7px; background: rgba(142,170,211,.1); cursor: pointer; }
.knowledge-editor-preview { padding: 13px 16px; border: 1px solid rgba(163,190,223,.2); border-radius: 12px; background: var(--panel-surface); }
.knowledge-editor-preview summary { cursor: pointer; font-weight: 650; font-size: 13px; }
.knowledge-editor-options { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.knowledge-editor-flags { display: grid; gap: 14px; }
.knowledge-editor-flags > label, .knowledge-reviewed-check, .knowledge-learning-toggle { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; }
.knowledge-editor-flags input, .knowledge-reviewed-check input, .knowledge-learning-toggle input { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; accent-color: #79aefe; }
.knowledge-editor-flags small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.knowledge-reviewed-check { padding: 14px; border-radius: 12px; border: 1px solid rgba(225,172,100,.25); background: rgba(199,139,61,.08); }
.knowledge-editor-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.knowledge-learning { margin-top: 18px; padding: 19px 23px; }
.knowledge-learning > details > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 14px; }
.knowledge-learning > details > summary::before { content: '▸'; color: #beaff5; }
.knowledge-learning > details[open] > summary::before { content: '▾'; }
.knowledge-learning > details > summary > span:first-child { flex: 1; }
.knowledge-learning-content { padding-top: 14px; font-size: 13px; line-height: 1.7; }
.knowledge-learning-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.knowledge-learning-counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }
.knowledge-learning-counts > span { padding: 7px 11px; border: 1px solid rgba(164,187,219,.2); border-radius: 9px; color: var(--muted); font-size: 12px; }
.knowledge-learning-counts strong { color: var(--text, #f3f6fc); margin-left: 8px; }
.knowledge-picker { margin: 14px 0; }
.knowledge-picker-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.knowledge-picker-bar .field-help { margin: 0; }
.knowledge-picker-body { margin-top: 12px; border: 1px solid rgba(154,181,219,.25); background: var(--panel-surface); border-radius: 15px; padding: 18px; }
.knowledge-picker-layout { display: grid; grid-template-columns: minmax(190px, .85fr) minmax(0, 1.15fr); gap: 14px; align-items: start; }
.knowledge-picker-results { display: grid; gap: 8px; max-height: 420px; overflow: auto; padding: 2px; }
.knowledge-picker-preview { padding: 16px; border: 1px solid rgba(169,190,222,.17); border-radius: 12px; background: var(--surface); min-width: 0; max-height: 540px; overflow: auto; }
.knowledge-picker-preview h3 { font-size: 18px; margin-top: 12px; }
.knowledge-preview-actions { display: grid; gap: 8px; margin-top: 20px; }
.knowledge-preview-actions small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.knowledge-review { padding: 20px; border: 1px solid rgba(156,147,239,.29); border-radius: 17px; background: linear-gradient(130deg, rgba(141,122,222,.105), rgba(80,145,190,.07)), var(--panel-surface); margin: 0 0 22px; }
.knowledge-review-heading { display: flex; align-items: center; gap: 12px; }
.knowledge-review-symbol { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border: 1px solid rgba(160,153,238,.28); background: rgba(143,123,215,.14); border-radius: 12px; font-size: 25px; color: #cfbfff; }
.knowledge-review-heading .eyebrow { font-size: 12px; }
.knowledge-review-heading h3 { font-size: 18px; margin: 4px 0 0; }
.knowledge-review-card { border: 1px solid rgba(160,180,217,.22); border-radius: 12px; padding: 15px; background: var(--surface); margin-top: 10px; }
.knowledge-review-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.knowledge-review-card > summary strong { font-size: 14px; }
.knowledge-review-card > summary > span { font-size: 12px; color: #a6cafa; flex-shrink: 0; }
.knowledge-review-card > p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.knowledge-review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 14px; }
.knowledge-review-actions small { font-size: 12px; color: var(--muted); }
.knowledge-center-layout [hidden], .knowledge-center-hero [hidden], .knowledge-picker [hidden], .knowledge-review [hidden], .knowledge-learning[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .knowledge-center-layout { grid-template-columns: minmax(220px,.8fr) minmax(0,1.25fr); }
  .knowledge-center-heading { flex-wrap: wrap; }
  .knowledge-picker-layout { grid-template-columns: 1fr; }
  .knowledge-picker-results { max-height: 220px; }
}
@media (max-width: 720px) {
  .knowledge-center-layout { grid-template-columns: 1fr; }
  .knowledge-center-list { max-height: 360px; }
  .knowledge-center-heading > button { width: 100%; }
  .knowledge-center-tools { flex-wrap: wrap; }
  .knowledge-center-tools .knowledge-search-field { flex-basis: 100%; }
  .knowledge-detail-heading { flex-wrap: wrap; }
  .knowledge-editor-options { grid-template-columns: 1fr; }
  .knowledge-learning { padding: 18px; }
  .knowledge-learning > details > summary { flex-wrap: wrap; }
  .knowledge-learning > details > summary > span:first-child { flex-basis: 75%; }
  .knowledge-picker-body, .knowledge-review { padding: 14px; }
  .knowledge-review-card > summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .knowledge-center-detail { padding: 19px; }
  .knowledge-editor-actions > button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .knowledge-result { transition: none; } }
.knowledge-automation { margin-top: 22px; padding-top: 17px; border-top: 1px solid rgba(169,189,220,.2); }
.knowledge-automation > summary, .knowledge-automation-rotation > summary { cursor: pointer; font-weight: 650; font-size: 13px; }
.knowledge-automation ol { padding-left: 22px; margin: 13px 0; }
.knowledge-automation li { margin: 9px 0; padding-left: 3px; }
.knowledge-automation-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.knowledge-automation-rotation { margin-top: 17px; padding: 13px; border: 1px solid rgba(225,175,100,.2); border-radius: 11px; background: rgba(198,134,52,.045); }
.knowledge-automation-rotation > button { margin-top: 12px; }
/* Structured authoring uses the same compact, familiar controls as tickets. */
.knowledge-rich-toolbar { display:flex; flex-wrap:wrap; gap:5px; padding:10px; border:1px solid rgba(177,196,224,.23); border-radius:13px 13px 0 0; background:var(--surface); }
.knowledge-rich-toolbar button, .knowledge-rich-link button, .knowledge-rich-attachment button { color:inherit; font:inherit; font-size:12px; border:1px solid var(--control-stroke); border-radius:8px; background:var(--surface); padding:7px 10px; cursor:pointer; }
.knowledge-rich-toolbar button:hover, .knowledge-rich-attachment button:hover { background:var(--surface-hover); }
.knowledge-rich-editor { min-height:180px; max-height:650px; overflow:auto; padding:17px; border:1px solid var(--control-stroke); border-top:0; border-radius:0 0 13px 13px; line-height:1.65; font-size:14px; background:var(--control-bg); overflow-wrap:anywhere; }
.knowledge-rich-editor:focus { outline:2px solid var(--focus-color); outline-offset:2px; }
.knowledge-rich-editor:empty::before { content:attr(data-placeholder); color:var(--muted); pointer-events:none; }
.knowledge-rich-editor p { margin:.65em 0; white-space:pre-wrap; }
.knowledge-rich-editor pre { white-space:pre-wrap; padding:12px; border-radius:9px; background:rgba(0,0,0,.2); }
.knowledge-rich-editor blockquote { border-left:3px solid #98c9d5; padding:10px 14px; margin:12px 0; background:rgba(105,182,195,.08); }
.knowledge-rich-link { display:grid; grid-template-columns:1fr 1fr auto auto; align-items:end; gap:8px; padding:12px; border:1px solid var(--control-stroke); background:var(--surface); }
.knowledge-rich-link[hidden] { display:none; }
.knowledge-rich-link label { display:grid; gap:5px; font-size:12px; }
.knowledge-rich-link input { padding:8px!important; }
.knowledge-rich-attachments { display:grid; gap:8px; }
.knowledge-rich-attachment { display:flex; align-items:center; gap:8px; border:1px solid rgba(167,190,221,.19); border-radius:11px; padding:10px 12px; }
.knowledge-rich-attachment > div { display:grid; gap:4px; flex:1; min-width:0; overflow-wrap:anywhere; }
.knowledge-rich-attachment span { font-size:13px; font-weight:600; }
.knowledge-rich-attachment small { font-size:12px; color:var(--muted); }
.knowledge-image { display:block; margin:16px 0; border:1px solid rgba(167,190,221,.22); border-radius:12px; padding:8px; background:var(--surface); }
.knowledge-image img { display:block; max-width:100%; height:auto; max-height:650px; object-fit:contain; border-radius:7px; }
.knowledge-image figcaption { margin-top:8px; font-size:12px; color:var(--muted); }
.knowledge-files { display:flex; flex-wrap:wrap; gap:8px; padding-top:16px; margin-top:18px; border-top:1px solid rgba(177,196,224,.18); }
.knowledge-tags { display:flex; flex-wrap:wrap; gap:7px; margin:16px 0; }
.knowledge-tags span { border:1px solid rgba(149,196,190,.22); background:rgba(97,170,160,.09); border-radius:999px; padding:4px 9px; font-size:12px; color:#bdded9; }
.knowledge-learning-selection { padding:0 0 22px; margin-bottom:18px; border-bottom:1px solid rgba(177,196,224,.18); }
.knowledge-learning-selection h3 { font-size:16px; margin:4px 0 8px; }
.knowledge-learning-tickets { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; max-height:330px; overflow:auto; margin-top:12px; }
.knowledge-learning-tickets .knowledge-result { padding:12px; gap:5px; }
.knowledge-ticket-action { margin-top:16px; padding:16px; border:1px solid rgba(126,181,191,.28); border-radius:13px; background:linear-gradient(130deg,rgba(110,171,185,.09),rgba(121,158,201,.04)),var(--panel-surface); }
.knowledge-ticket-action:empty, .knowledge-ticket-action[hidden] { display:none; }
.knowledge-ticket-action-heading { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.knowledge-ticket-action-heading strong { font-size:14px; }
.knowledge-ticket-action-buttons { display:flex; flex-wrap:wrap; gap:8px; }
.knowledge-ticket-action .field-help { font-size:12px; line-height:1.6; }
@media(max-width:720px) {
 .knowledge-learning-tickets { grid-template-columns:1fr; }
 .knowledge-rich-link { grid-template-columns:1fr 1fr; }
 .knowledge-rich-link label { grid-column:1/-1; }
 .knowledge-rich-attachment { flex-wrap:wrap; }
 .knowledge-rich-attachment > div { flex-basis:100%; }
 .knowledge-rich-toolbar { gap:4px; padding:8px; }
 .knowledge-rich-toolbar button { padding:7px 8px; }
 .knowledge-ticket-action-buttons > button { flex:1; }
}
.knowledge-editor [hidden] { display:none!important; }
.knowledge-source-link { display:inline-flex; margin-top:18px; font-size:12px; font-weight:650; color:#b9d9ef; text-decoration:none; border:1px solid rgba(160,200,225,.25); border-radius:10px; background:rgba(131,183,208,.1); padding:9px 12px; }

.knowledge-processing { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid rgba(124,197,221,.25); border-radius: 14px; background: linear-gradient(120deg,rgba(95,178,202,.15),rgba(136,205,179,.08)); }
.knowledge-processing[hidden] { display: none; }
.knowledge-processing > div { display: grid; gap: 5px; }
.knowledge-processing strong { font-size: .9rem; color: #c5e8f4; }
.knowledge-processing div > span { font-size: .8rem; line-height: 1.5; color: var(--muted); }
.knowledge-processing-orbit { flex: 0 0 30px; width: 30px; height: 30px; border: 3px solid rgba(160,222,233,.2); border-top-color: #a1dece; border-right-color: #a2d4f1; border-radius: 50%; animation: knowledge-prepare-spin 1s linear infinite; }
.knowledge-learning-feedback { min-height: 2.8em; }
.knowledge-learning [data-learning-count] { display: inline-block; min-width: 2ch; font-variant-numeric: tabular-nums; }
@keyframes knowledge-prepare-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .knowledge-processing-orbit { animation: none; } }

/* Internal reply templates share the existing knowledge controls and theme. */
.knowledge-usage-note { margin: 0; padding: 12px 14px; border: 1px solid var(--stroke); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); background: var(--info-bg); color: var(--text); font-size: 13px; line-height: 1.6; }
.knowledge-badge.is-reply-template { color: var(--primary); background: var(--info-bg); border-color: var(--primary); }
.knowledge-picker-search-row { display: flex; align-items: end; gap: 8px; }
.knowledge-result-card { position: relative; min-width: 0; border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface); }
.knowledge-result-card:hover, .knowledge-result-card.is-selected { border-color: var(--primary); }
.knowledge-result-card .knowledge-result-compact { min-height: 76px; gap: 4px; border: 0; border-radius: inherit; padding: 11px 48px 11px 12px; background: transparent; }
.knowledge-result-compact > strong { font-size: 14px; line-height: 1.35; }
.knowledge-result-compact > small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; white-space: normal; }
.knowledge-info-button, .knowledge-info-close { display: inline-grid; place-items: center; padding: 0; width: 32px; min-height: 32px; border: 0; border-radius: 50%; font: inherit; color: var(--muted); background: transparent; cursor: pointer; }
.knowledge-info-button { position: absolute; right: 5px; bottom: 5px; }
.knowledge-info-button > span { display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; line-height: 1; font-weight: 700; font-family: inherit; }
.knowledge-info-button:hover, .knowledge-info-close:hover { background: var(--surface-hover); color: var(--text); }
.knowledge-info-button:focus-visible, .knowledge-info-close:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.knowledge-info-overlay { position: fixed; inset: auto; z-index: 10020; box-sizing: border-box; margin: 0; padding: 16px; border: 1px solid var(--control-stroke); border-radius: 14px; background: var(--panel-surface); background: color-mix(in srgb, var(--panel-surface) 92%, transparent); backdrop-filter: blur(14px); color: var(--text); box-shadow: 0 12px 36px rgba(0,0,0,.3); overflow: auto; overflow-wrap: anywhere; }
.knowledge-info-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.knowledge-info-heading h3 { margin: 5px 0 0; font-size: 15px; line-height: 1.4; }
.knowledge-info-close { flex: 0 0 32px; font-size: 25px; }
.knowledge-info-overlay > .field-help { margin-bottom: 0; }
.knowledge-usage-stats { display: grid; gap: 8px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--stroke); font-size: 12px; }
.knowledge-usage-stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.knowledge-usage-stats dt { color: var(--muted); }
.knowledge-usage-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (any-pointer: coarse) { .knowledge-info-button, .knowledge-info-close { width: 44px; min-height: 44px; } .knowledge-info-close { flex-basis: 44px; } .knowledge-result-card .knowledge-result-compact { padding-right: 55px; } }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { .knowledge-info-overlay { background: var(--panel-surface); backdrop-filter: none; } }
@media (forced-colors: active) { .knowledge-info-overlay { background: Canvas; color: CanvasText; border-color: CanvasText; } .knowledge-info-button, .knowledge-info-close { color: ButtonText; } }
.knowledge-search-clear { width: 46px; min-height: 46px; flex: 0 0 46px; padding: 0; font-size: 22px; }
.knowledge-tabs { flex-wrap: wrap; max-width: 100%; }
.knowledge-tabs button { min-height: 44px; }
.knowledge-tabs button:hover:not(:disabled) { background: var(--surface-hover); }
.knowledge-tabs button:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.knowledge-tabs button:disabled { cursor: not-allowed; opacity: .6; }
.knowledge-discard { border: 1px solid var(--warning); border-radius: var(--radius-sm); padding: 14px; background: var(--warning-bg); }
.knowledge-discard p { margin: 0 0 12px; line-height: 1.6; }
.knowledge-editor [aria-invalid="true"] { border-color: var(--danger); }

/* Recognizable image attachments retain their source filename and stable editor-local number. */
.knowledge-rich-attachment { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; }
.knowledge-rich-attachment.has-image { grid-template-columns:88px minmax(0,1fr) auto; }
.knowledge-rich-attachment > .knowledge-rich-attachment-description { display:grid; gap:4px; min-width:0; }
.knowledge-rich-attachment-heading { display:flex; align-items:center; flex-wrap:wrap; gap:6px 8px; min-width:0; }
.knowledge-rich-attachment .knowledge-rich-image-label { display:inline-flex; align-items:center; min-height:23px; padding:2px 6px; border-radius:6px; border:1px solid var(--stroke); background:var(--info-bg); color:var(--primary); white-space:nowrap; font-size:12px; font-weight:750; }
.knowledge-rich-attachment .knowledge-rich-attachment-name { min-width:0; overflow-wrap:anywhere; }
.knowledge-rich-attachment > .knowledge-rich-attachment-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px; }
.knowledge-rich-attachment-actions button { min-height:44px; }
.knowledge-rich-attachment button:not(:disabled):active { background:var(--surface-hover); border-color:var(--primary); }
.knowledge-rich-attachment button:focus-visible { outline:2px solid var(--focus-color); outline-offset:3px; }
.knowledge-rich-attachment button:disabled { opacity:.65; cursor:not-allowed; }
.knowledge-rich-attachment button.knowledge-rich-thumbnail { display:grid; place-items:center; align-self:center; width:88px; height:66px; min-width:0; padding:4px; overflow:hidden; border-radius:8px; background:var(--control-bg); }
.knowledge-rich-thumbnail img { display:block; width:100%; height:56px; object-fit:contain; border-radius:4px; }
.knowledge-rich-thumbnail-placeholder { display:grid; place-items:center; color:var(--muted); }
.knowledge-rich-thumbnail-placeholder svg { display:block; width:27px; height:27px; fill:none; stroke:currentColor; stroke-width:1.4; }
.knowledge-rich-attachment [hidden] { display:none!important; }
.knowledge-rich-preview-hint { line-height:1.4; }
.knowledge-rich-attachment[data-upload-state="error"] .knowledge-rich-attachment-description > small:first-of-type { color:var(--danger); }
html[data-theme="light"] .knowledge-rich-attachment button.knowledge-rich-thumbnail { background:rgba(248,250,252,.95); }
html[data-theme="light"] .knowledge-rich-attachment .knowledge-rich-image-label { color:#185475; }
@media(max-width:560px) {
 .knowledge-rich-attachment, .knowledge-rich-attachment.has-image { grid-template-columns:72px minmax(0,1fr); gap:10px; }
 .knowledge-rich-attachment:not(.has-image) > .knowledge-rich-attachment-description { grid-column:1/-1; }
 .knowledge-rich-attachment > .knowledge-rich-attachment-actions { grid-column:1/-1; }
 .knowledge-rich-attachment button.knowledge-rich-thumbnail { width:72px; height:58px; }
 .knowledge-rich-thumbnail img { height:48px; }
}

/* Form and content controls share the app's focused, disabled and touch states. */
.knowledge-editor :is(input,textarea,select):focus-visible,
.knowledge-rich-link input:focus-visible,
.knowledge-rich-toolbar button:focus-visible,
.knowledge-rich-link button:focus-visible,
.knowledge-editor-toolbar button:focus-visible,
.knowledge-editor-preview > summary:focus-visible,
.knowledge-learning > details > summary:focus-visible,
.knowledge-review-card > summary:focus-visible,
.knowledge-automation > summary:focus-visible,
.knowledge-automation-rotation > summary:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 3px; }
.knowledge-rich-toolbar button:disabled,
.knowledge-rich-link button:disabled,
.knowledge-editor-toolbar button:disabled { cursor: not-allowed; opacity: .6; }
.knowledge-center-hero,
.knowledge-center-list,
.knowledge-center-detail,
.knowledge-learning { background: var(--panel-surface); }
@media (any-pointer: coarse) {
 .knowledge-rich-toolbar button,
 .knowledge-rich-link button,
 .knowledge-editor-toolbar button,
 .knowledge-tabs button,
 .knowledge-editor-preview > summary,
 .knowledge-learning > details > summary,
 .knowledge-review-card > summary,
 .knowledge-automation > summary,
 .knowledge-automation-rotation > summary { min-height: 44px; min-width: 44px; }
 .knowledge-editor-flags > label,
 .knowledge-learning-toggle { min-height: 44px; padding-block: 10px; }
 .knowledge-source-link { min-height: 44px; align-items: center; }
}
@media (forced-colors: active) {
 .knowledge-badge,
 .knowledge-result,
 .knowledge-review-card,
 .knowledge-picker-body,
 .knowledge-picker-preview,
 .knowledge-rich-editor,
 .knowledge-rich-toolbar { border-color: CanvasText; }
 .knowledge-result.is-selected,
 .knowledge-tabs button.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
 .knowledge-search-field input,
 .knowledge-editor :is(input,textarea,select),
 .knowledge-rich-editor { color: CanvasText; background: Canvas; }
}

/* Internal templates stay recognizable in both discovery surfaces, without motion. */
.knowledge-result.is-internal-template,
.knowledge-result-card.is-internal-template,
.knowledge-picker-preview.is-internal-template,
.knowledge-center-detail.is-internal-template {
  background: var(--surface);
  background: linear-gradient(120deg, color-mix(in srgb, var(--success) 10%, transparent), color-mix(in srgb, var(--success) 3%, transparent)), var(--surface);
  border-color: color-mix(in srgb, var(--success) 38%, var(--stroke));
}
.knowledge-result.is-internal-template:hover,
.knowledge-result.is-internal-template.is-selected,
.knowledge-result-card.is-internal-template:hover,
.knowledge-result-card.is-internal-template.is-selected { border-color: var(--primary); }
