/* ==========================================================
   Sauce Database (sauce.js)
   ========================================================== */
#view-knowledge { padding: 0 !important; }
.sd-root { display: grid; grid-template-columns: 250px 1fr; height: 100%; min-height: 0; color: #19191C; }

/* sidebar */
.sd-side { border-right: 1px solid #E9E9EB; background: #FAFAFB; padding: 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sd-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #E2E2E5; border-radius: 10px; padding: 0 10px; height: 38px; margin-bottom: 12px; }
.sd-search i { color: #8D8D9A; }
.sd-search input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 13.5px; width: 100%; color: #19191C; }
.sd-side-label { font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: #9A9AA5; padding: 16px 10px 6px; }
.sd-nav { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 13.5px; font-weight: 600; color: #3A3A42; cursor: pointer; transition: background .12s; }
.sd-nav > i:first-child { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #9B9BA6); flex-shrink: 0; }
.sd-nav.all > i { width: auto; height: auto; background: none; font-size: 15px; color: #6B6B76; }
.sd-nav span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-nav em { font-style: normal; font-size: 12px; font-weight: 700; color: #9A9AA5; }
.sd-nav:hover { background: #F0F0F2; }
.sd-nav.active { background: #fff; color: #121214; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px #E6E6E9; }

/* main */
.sd-main { overflow-y: auto; padding: 22px 28px 60px; min-width: 0; }
.sd-main-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.sd-main-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; color: #121214; }
.sd-main-head span { font-size: 13px; color: #8D8D9A; font-weight: 600; }
.sd-group { margin-bottom: 30px; }
.sd-group-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #4A4A55; margin-bottom: 12px; }
.sd-group-head > i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sd-group-head em { font-style: normal; color: #A5A5AF; font-weight: 700; }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.sd-card { display: flex; flex-direction: column; gap: 8px; text-align: left; background: #fff; border: 1px solid #E9E9EB; border-radius: 14px; padding: 16px 18px; font-family: inherit; cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; min-height: 132px; }
.sd-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: .85; }
.sd-card:hover { border-color: #D9D9DE; box-shadow: 0 8px 24px rgba(18,18,20,.07); transform: translateY(-1px); }
.sd-card-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #6B6B76; }
.sd-card-cat i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.sd-card-title { font-size: 15.5px; font-weight: 800; line-height: 1.35; color: #121214; letter-spacing: -0.15px; }
.sd-card-text { font-size: 13px; line-height: 1.55; color: #6B6B76; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sd-card-foot { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.sd-src { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: #4A4A55; background: #F3F3F5; border-radius: 999px; padding: 3px 9px 3px 7px; }
.sd-src i { color: #625DF5; font-size: 13px; }

.sd-empty { text-align: center; padding: 70px 20px; color: #6B6B76; }
.sd-empty > i { font-size: 34px; color: #B5B5BE; }
.sd-empty h3 { margin: 12px 0 6px; color: #121214; font-size: 18px; }
.sd-empty p { max-width: 420px; margin: 0 auto 16px; line-height: 1.5; font-size: 14px; }
.sd-empty.small { padding: 40px 20px; }

/* panel */
.sd-backdrop { position: fixed; inset: 0; background: rgba(18,18,20,.32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 2500; }
.sd-backdrop.open { opacity: 1; pointer-events: auto; }
.sd-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 100vw); background: #fff; box-shadow: -20px 0 60px rgba(0,0,0,.18); transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); z-index: 2600; display: flex; flex-direction: column; color: #19191C; }
.sd-panel.open { transform: translateX(0); }
.sd-p-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #F0F0F2; }
.sd-p-nav, .sd-p-actions { display: flex; align-items: center; gap: 6px; }
.sd-p-nav span { font-size: 12.5px; color: #8D8D9A; font-weight: 600; margin-left: 4px; }
.sd-p-title { font-size: 15px; font-weight: 800; }
.sd-icon { width: 34px; height: 34px; border-radius: 9px; border: 1px solid #E6E6E9; background: #fff; color: #3A3A42; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; }
.sd-icon:hover:not(:disabled) { background: #F5F5F7; }
.sd-icon:disabled { opacity: .35; cursor: default; }
.sd-btn { padding: 7px 14px !important; display: inline-flex !important; align-items: center; gap: 6px; }
.sd-p-scroll { flex: 1; overflow-y: auto; }

.sd-read { max-width: 680px; margin: 0 auto; padding: 34px 40px 80px; }
.sd-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: #4A4A55; background: #F4F4F6; border-radius: 999px; padding: 5px 12px 5px 10px; }
.sd-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sd-read h1 { font-size: 30px; line-height: 1.2; font-weight: 800; letter-spacing: -0.6px; margin: 14px 0 14px; color: #121214; }
.sd-sources { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 26px; }
.sd-src-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #121214; background: #F3F2FF; border: 1px solid #E3E1FF; border-radius: 999px; padding: 6px 13px 6px 10px; text-decoration: none; }
.sd-src-btn i { color: #625DF5; font-size: 16px; }
.sd-src-btn:hover { background: #EAE8FF; }
.sd-src-note { font-size: 12.5px; color: #8D8D9A; }
.sd-body { font-size: 15.5px; line-height: 1.75; color: #2A2A30; }
.sd-body p { margin: 0 0 14px; }
.sd-body h4 { font-size: 13px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #121214; margin: 26px 0 8px; }
.sd-body h4:first-child { margin-top: 0; }
.sd-body ul, .sd-body ol { margin: 0 0 16px; padding-left: 22px; }
.sd-body li { margin-bottom: 7px; padding-left: 4px; }
.sd-body ul li::marker { color: #A5A5AF; }
.sd-body strong { color: #121214; }
.sd-body a { color: #4C5FD5; word-break: break-all; }
.sd-muted { color: #9A9AA5; }

/* form */
.sd-form { max-width: 720px; margin: 0 auto; padding: 26px 40px 40px; display: flex; flex-direction: column; gap: 18px; }
.sd-title-in { font-family: inherit; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; color: #121214; border: none; outline: none; padding: 6px 0; border-bottom: 2px solid #F0F0F2; background: transparent; }
.sd-title-in:focus { border-bottom-color: #19191C; }
.sd-form-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.sd-form label { display: flex; flex-direction: column; gap: 6px; }
.sd-form label > span { font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #6B6B76; }
.sd-form label > span em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; color: #A5A5AF; margin-left: 4px; }
.sd-form select, .sd-form input:not(.sd-title-in), .sd-form textarea { font-family: inherit; font-size: 14px; color: #19191C; background: #fff; border: 1px solid #E2E2E5; border-radius: 10px; padding: 10px 12px; outline: none; width: 100%; box-sizing: border-box; }
.sd-form textarea { font-size: 15px; line-height: 1.7; padding: 16px 18px; resize: vertical; min-height: 45vh; }
.sd-form select:focus, .sd-form input:focus, .sd-form textarea:focus { border-color: #9A9AA5; }
.sd-p-foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid #F0F0F2; background: #FCFCFD; }
.sd-danger { color: #B42318 !important; }

@media (max-width: 900px) {
    .sd-root { grid-template-columns: 1fr; }
    .sd-side { border-right: none; border-bottom: 1px solid #E9E9EB; max-height: 220px; }
    .sd-read, .sd-form { padding-left: 20px; padding-right: 20px; }
    .sd-form-row { grid-template-columns: 1fr; }
}
.sd-panel .btn-outline, .sd-root .btn-outline { background: #fff !important; color: #19191C !important; border: 1px solid #E2E2E5 !important; }
.sd-panel .btn-outline:hover, .sd-root .btn-outline:hover { background: #F5F5F7 !important; }
.sd-panel .btn-outline.sd-danger { color: #B42318 !important; }
.sd-root { grid-template-columns: 270px 1fr; }

/* v2 cards: icon, clear summary, key quote */
.sd-card { gap: 10px; padding: 18px 20px 16px; min-height: 0; }
.sd-card::before { display: none; }
.sd-card-head { display: flex; align-items: center; gap: 8px; }
.sd-card-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 13%, #fff); color: var(--c); font-size: 15px; flex-shrink: 0; }
.sd-card-cat { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: color-mix(in srgb, var(--c) 75%, #19191C); }
.sd-card-title { font-size: 16.5px; line-height: 1.35; }
.sd-card-text { font-size: 13.5px; line-height: 1.55; color: #4A4A55; -webkit-line-clamp: 3; }
.sd-card-quote { font-size: 13px; line-height: 1.5; font-style: italic; color: #2A2A30; background: color-mix(in srgb, var(--c) 7%, #fff); border-left: 3px solid var(--c); border-radius: 0 8px 8px 0; padding: 8px 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-card-foot { align-items: center; padding-top: 6px; border-top: 1px solid #F2F2F4; margin-top: auto; }
.sd-card-more { margin-left: auto; font-size: 12.5px; font-weight: 700; color: #8D8D9A; display: inline-flex; align-items: center; gap: 4px; transition: color .15s, gap .15s; }
.sd-card:hover .sd-card-more { color: #121214; gap: 7px; }
.sd-group-head .sd-card-ic { width: 24px; height: 24px; font-size: 14px; }
.sd-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

/* reader: lead + quote */
.sd-lead { background: color-mix(in srgb, var(--c) 7%, #fff); border: 1px solid color-mix(in srgb, var(--c) 18%, #fff); border-radius: 14px; padding: 16px 20px; margin: 0 0 18px; }
.sd-lead span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: color-mix(in srgb, var(--c) 75%, #19191C); margin-bottom: 4px; }
.sd-lead p { margin: 0; font-size: 16.5px; line-height: 1.6; color: #19191C; font-weight: 500; }
.sd-quote { margin: 0 0 26px; padding: 4px 0 4px 18px; border-left: 3px solid var(--c); font-size: 18px; line-height: 1.5; font-style: italic; color: #2A2A30; }
.sd-form textarea.sd-small { min-height: 0; font-size: 14.5px; padding: 10px 12px; }

/* the category is already the section/page title: only show it on cards in search results */
.sd-main:not(.searching) .sd-card-head { display: none; }
.sd-group-head { font-size: 13px; gap: 10px; }

/* rich text: marker highlight, editor + toolbar */
.sd-body mark, .sd-card-text mark { background: linear-gradient(104deg, rgba(255,229,138,0) 0.6%, #FFE58A 2.5%, #FFE38A 96%, rgba(255,229,138,0) 98%); padding: 0.05em 0.25em; margin: 0 -0.1em; border-radius: 0.35em 0.2em; color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sd-body em { font-style: italic; }
.sd-text-label { display: flex; flex-direction: column; gap: 6px; }
.sd-lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #6B6B76; }
.sd-editor { border: 1px solid #E2E2E5; border-radius: 12px; background: #fff; transition: border-color .15s; }
.sd-editor:focus-within { border-color: #9A9AA5; }
.sd-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid #F0F0F2; background: #FCFCFD; border-radius: 12px 12px 0 0; }
.sd-toolbar button { width: 34px; height: 32px; border: none; background: none; border-radius: 8px; color: #3A3A42; font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.sd-toolbar button:hover { background: #EFEFF2; color: #121214; }
.sd-tb-mark span { position: absolute; left: 9px; right: 9px; bottom: 5px; height: 3px; border-radius: 2px; background: #F5C542; }
.sd-tb-sep { width: 1px; height: 20px; background: #E6E6E9; margin: 0 6px; }
.sd-editable { min-height: 45vh; padding: 18px 22px; outline: none; font-size: 15.5px; line-height: 1.75; }
.sd-editable.empty::before { content: attr(data-placeholder); color: #A5A5AF; pointer-events: none; position: absolute; }
.sd-editable h4 { margin-top: 18px; }
.sd-editable p { margin: 0 0 10px; }
