/* Scoped to knowledge folders and their local collection flow. */
#knowledge-rules{width:min(480px,100vw);height:100dvh;max-width:100vw;max-height:100dvh;margin:0 auto;padding:0;border:0;border-radius:0;background:var(--canvas,#f7f7f7);color:var(--ink,#202020);overflow:hidden}
#knowledge-rules[open]{display:flex;flex-direction:column}
#knowledge-rules::backdrop{background:rgba(0,0,0,.4)}
.kg-header{display:flex;align-items:center;gap:8px;padding:16px 12px 12px;border-bottom:1px solid var(--line,#e6e6e6);flex-shrink:0}
.kg-header h1{font-size:20px;line-height:28px;font-weight:600;margin:0}.kg-header button{width:44px;height:44px;display:grid;place-items:center;background:none;border:0}
.kg-body{padding:24px 16px;overflow:auto;flex:1;min-height:0}.kg-body h2{font-size:17px;line-height:24px;margin:24px 0 12px}.kg-intro{font-size:15px;line-height:24px;margin:0 0 24px}
.kg-fields{padding:16px;background:var(--surface,#fff);border-radius:20px}.kg-fields>label{display:block;font-size:13px;line-height:20px;margin:0 0 8px;color:var(--ink-secondary,#626262)}.kg-fields>label:not(:first-child){margin-top:24px}
.kg-fields input{box-sizing:border-box;width:100%;min-height:44px;border:0;border-bottom:1px solid var(--line,#e6e6e6);border-radius:0;background:transparent;font-size:16px;padding:8px 0;color:inherit}
.kg-keywords{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.kg-keyword{display:inline-flex;align-items:center;min-height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--line-strong,#d4d4d4);background:var(--line,#e6e6e6);color:var(--ink,#202020);font-size:13px;line-height:20px;overflow-wrap:anywhere;max-width:100%}.kg-keyword:has(button){padding-right:0}.kg-keyword button{position:relative;display:grid;place-items:center;width:24px;min-width:24px;height:28px;min-height:28px;background:transparent!important;border:0;padding:0;color:inherit}.kg-keyword svg{width:14px;height:14px}
.kg-add-keyword{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:28px;padding:0 12px;border:1px dashed var(--line-strong,#d4d4d4);border-radius:8px;background:transparent;color:var(--ink-secondary,#626262);font-size:13px}.kg-add-keyword svg{width:14px;height:14px}
#kg-keyword-input:not([hidden]){display:flex;gap:8px;margin-top:12px}#kg-keyword-input input{min-width:0}#kg-keyword-input button{flex-shrink:0;min-height:44px;padding:0 12px;border:0;background:var(--surface-sunken,#f2f2f2);border-radius:8px}
.kg-help{color:var(--ink-secondary,#626262);font-size:13px;line-height:20px;margin:12px 0 24px}.kg-check{display:flex;align-items:center;gap:8px;min-height:44px;font-size:15px}.kg-check input,.kg-retro-row input{accent-color:#202020;width:20px;height:20px;flex-shrink:0}
.kg-actions,.kg-footer{display:flex;gap:12px}.kg-actions{margin-top:24px}.kg-actions button,.kg-footer button{flex:1;min-height:48px}.kg-footer{padding:12px 16px max(16px,env(safe-area-inset-bottom));background:var(--surface,#fff);border-top:1px solid var(--line,#e6e6e6);flex-shrink:0}
.kg-error{color:var(--error,#a13629);font-size:13px;line-height:20px}.kg-delete{margin-top:32px;min-height:44px;background:none;border:0;color:var(--error,#a13629);padding:0 4px}
.kg-retro-row{display:flex;gap:12px;align-items:center;padding:12px 0;min-height:44px;border-bottom:1px solid var(--line,#e6e6e6)}.kg-retro-row span{min-width:0}.kg-retro-row strong,.kg-skipped strong{display:block;font-size:15px;line-height:24px;font-weight:400;overflow-wrap:anywhere;white-space:pre-wrap}.kg-retro-row small,.kg-skipped small{display:block;font-size:13px;line-height:20px;color:var(--ink-secondary,#626262);margin-top:4px}.kg-skipped{padding:12px 0;border-bottom:1px solid var(--line,#e6e6e6)}
.kg-folder-settings{padding:8px 16px 16px}.kg-folder-settings>button{display:flex;align-items:center;gap:8px;min-height:44px;background:none;border:0;color:var(--ink-secondary,#626262);font-size:13px;padding:0}.kg-folder-settings>button svg{width:16px;height:16px}.kg-folder-settings .kg-keywords:empty{display:none}
.knowledge-category-list.kg-layout-single{display:flex;flex-direction:column}.knowledge-category-list.kg-layout-double{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.kg-layout-double .knowledge-category-card{min-width:0;display:flex;flex-direction:column;align-items:stretch;padding:12px}.kg-layout-double .knowledge-folder{align-self:center;max-width:100%;margin-bottom:12px}.kg-layout-double .knowledge-category-copy{min-width:0}.kg-layout-double .knowledge-category-copy strong{overflow-wrap:anywhere}.kg-layout-double .knowledge-category-copy small{font-size:12px;white-space:normal}
.kg-capture-mode{font-size:11px;color:var(--ink-secondary,#626262);padding:2px 8px;border-radius:8px;background:var(--surface-sunken,#f2f2f2);margin-left:auto}.kg-capture-mode+.result-more{margin-left:0}
.kg-also{margin:16px 0;font-size:13px;line-height:20px;color:var(--ink-secondary,#626262)}.kg-also p{margin:0}.kg-also button{min-height:44px;background:none;border:0;padding:0 12px 0 0;color:var(--ink,#202020)}
.kg-undo-list{padding:8px 16px}.kg-undo-list>div{display:flex;align-items:center;gap:8px;padding:8px 0;font-size:13px;color:var(--ink-secondary,#626262)}.kg-undo-list span{flex:1;overflow-wrap:anywhere}.kg-undo-list button{min-height:44px;flex-shrink:0;border:0;background:var(--surface-sunken,#f2f2f2);color:var(--ink,#202020);padding:0 12px;border-radius:8px}
#knowledge-rules,#knowledge-rules *{scrollbar-width:none}#knowledge-rules::-webkit-scrollbar,#knowledge-rules *::-webkit-scrollbar{display:none;width:0;height:0}#knowledge-rules :is(button,input[type=checkbox]):focus-visible{outline:2px solid var(--ink,#202020);outline-offset:2px}#knowledge-rules button:disabled{opacity:.4}
@media(max-width:350px){.kg-layout-double .knowledge-folder{transform:scale(.85);transform-origin:center}.kg-fields{padding:12px}.kg-header h1{font-size:20px}}

.kg-retro-empty{padding:24px 0 16px}.kg-retro-empty>svg{width:32px;height:32px;color:var(--ink-secondary,#626262)}.kg-retro-empty h2{margin:16px 0 8px}.kg-retro-empty p{font-size:15px;line-height:24px;color:var(--ink-secondary,#626262);margin:0}
/* Layout from the user's knowledge artboards; surfaces and type use existing UI tokens. */
.kg-header{justify-content:space-between;padding:12px 16px;height:72px;min-height:72px;border-bottom:0}.kg-header h1{flex:1}.kg-header button{flex-shrink:0}
.kg-body:has(.kg-form){display:flex;flex-direction:column;padding:16px 16px 0}.kg-form{display:flex;flex-direction:column;flex:1;min-height:100%}.kg-form .kg-actions{position:sticky;bottom:0;margin-top:auto;padding:16px 0 max(16px,env(safe-area-inset-bottom));background:var(--canvas,#f7f7f7);z-index:1}.kg-form .kg-actions .secondary{flex:0 0 72px;min-width:72px;padding:0 12px;white-space:nowrap;background:transparent}.kg-form .kg-actions .primary{flex:1}.kg-fields input#knowledge-category-name{background:var(--surface-sunken,#f2f2f2);border:0;border-radius:12px;padding:12px;min-height:48px}.kg-keyword-heading{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:4px;row-gap:0;margin:16px 0 8px;font-size:13px;line-height:20px;color:var(--ink-secondary,#626262)}.kg-keyword-heading>span:first-child{white-space:nowrap}.kg-field-help{font-size:13px;line-height:20px;color:var(--ink-secondary,#626262)}
.kg-retro-option{display:flex;align-items:center;gap:16px;padding:16px;margin-top:16px;border-radius:20px;background:var(--surface,#fff)}.kg-retro-option>span:first-child{flex:1}.kg-retro-option strong,.kg-retro-option small{display:block}.kg-retro-option strong{font-size:15px;line-height:24px;font-weight:400}.kg-retro-option small{font-size:13px;line-height:20px;color:var(--ink-secondary,#626262);margin-top:4px}.kg-switch{position:relative;width:52px;height:44px;flex-shrink:0}.kg-switch input{position:absolute;inset:0;width:52px;height:44px;margin:0;opacity:0;cursor:pointer;z-index:1}.kg-switch>span{position:absolute;inset:8px 0;border-radius:999px;background:var(--line-strong,#d4d4d4)}.kg-switch>span:after{content:'';position:absolute;width:22px;height:22px;border-radius:50%;background:var(--surface,#fff);left:3px;top:3px}.kg-switch input:checked+span{background:var(--ink,#202020)}.kg-switch input:checked+span:after{left:27px}.kg-switch input:focus-visible+span{outline:2px solid var(--line-strong,#d4d4d4);outline-offset:2px}
.kg-selection-card,.kg-skipped-card{background:var(--surface,#fff);border-radius:20px;padding:4px 16px}.kg-selection-card .kg-retro-row:last-child,.kg-skipped-card .kg-skipped:last-child{border-bottom:0}.kg-retro-row:has(input:not(:checked)) strong{color:var(--ink-secondary,#626262)}.kg-footer{flex-wrap:wrap}.kg-footer>button{min-width:0}.kg-undo-hint{flex-basis:100%;font-size:12px;line-height:20px;color:var(--ink-secondary,#626262);text-align:center;margin:0}.kg-intro{color:var(--ink-secondary,#626262)}
.knowledge-home-header [data-knowledge-search-open]{order:0}.knowledge-home-header [data-kg-layout]{order:1}.knowledge-home-header [data-knowledge-add]{order:2}.knowledge-category-header [data-knowledge-category-search-open]{order:0}.knowledge-category-header [data-knowledge-new-current]{order:1}.knowledge-category-header [data-kg-settings]{order:2}.kg-folder-count{margin:16px 0 0;font-size:13px;line-height:20px;color:var(--ink-secondary,#626262)}
.knowledge-screen .knowledge-skills-entry{padding:12px 0;background:transparent;box-shadow:none;border:0;margin-top:8px}.knowledge-screen .knowledge-skills-entry small{display:none}.knowledge-screen .knowledge-skills-entry strong{font-size:13px;font-weight:400;color:var(--ink-secondary,#626262)}.knowledge-screen .knowledge-skills-entry>svg{width:16px;height:16px}.knowledge-category-screen{padding-bottom:110px}
.kg-folder-settings{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.kg-folder-settings .kg-keywords{display:contents}.kg-folder-settings .kg-folder-count{margin:0}
.home-v3 .compact-turn:has(>.kg-also){flex-direction:column;align-items:flex-end}.compact-turn>.kg-also{width:min(332px,100%);margin:12px 0 0;padding:16px;border-radius:20px;background:var(--surface,#fff);color:var(--ink,#202020)}.compact-turn>.kg-also p{margin:0 0 12px;font-size:13px;line-height:22px}.compact-turn>.kg-also button{padding:0 16px;border-radius:999px;min-height:44px;margin-right:8px}.compact-turn>.kg-also [data-kg-also]{background:var(--ink,#202020);color:var(--inverse,#fff)}.compact-turn>.kg-also [data-kg-dismiss]{background:var(--surface-sunken,#f2f2f2)}

/* New-folder composition follows the supplied 402 by 874 reference. */
#knowledge-rules.kg-creation .kg-header{margin-top:56px;height:72px;min-height:72px;padding:0 8px 0 16px}
#knowledge-rules.kg-creation .kg-fields{padding:16px;flex-shrink:0}
#knowledge-rules.kg-creation #knowledge-category-name{height:44px;min-height:44px}
#knowledge-rules.kg-creation .kg-retro-option{margin:12px 0 0;padding:12px 16px;min-height:72px;flex-shrink:0}
#knowledge-rules.kg-creation .kg-retro-option strong{line-height:20px}
#knowledge-rules.kg-creation .kg-retro-option small{line-height:20px;margin-top:4px}
.kg-manual-hint{margin:12px 4px 24px;line-height:24px;overflow-wrap:anywhere}
.kg-manual-hint code{font:inherit;color:var(--ink,#202020);padding:2px 6px;border-radius:8px;background:var(--surface-sunken,#f2f2f2)}
#knowledge-rules.kg-creation .kg-actions{padding:16px 0 max(40px,env(safe-area-inset-bottom))}
#knowledge-rules.kg-creation .kg-actions .primary{min-height:52px;padding:0 16px;font-size:16px;line-height:24px;font-weight:600}
.kg-error:empty{display:none}
.kg-keyword button:after,.kg-add-keyword:after{content:'';position:absolute;inset:-8px 0}
@media(max-height:600px){#knowledge-rules.kg-creation .kg-header{margin-top:8px}#knowledge-rules.kg-creation .kg-actions{padding-bottom:max(16px,env(safe-area-inset-bottom))}}

/* Measurements and inline keyword entry from the supplied HTML export. */
#kg-chips .kg-keywords{row-gap:8px}
#kg-chips #kg-word{flex:0 0 96px;width:96px;height:28px;min-height:28px;border:1px dashed var(--line-strong,#d4d4d4);border-radius:8px;background:transparent;padding:0 10px;font-size:13px;line-height:20px}
.kg-switch,.kg-switch input{width:51px}.kg-switch>span{inset:6.5px 0}.kg-switch>span:after{width:27px;height:27px;left:2px;top:2px}.kg-switch input:checked+span:after{left:22px}
#knowledge-rules.kg-creation .kg-retro-option{padding:4px 16px}
#knowledge-rules.kg-creation .kg-retro-option strong{line-height:24px}
#knowledge-rules.kg-creation .kg-retro-option small{margin-top:0}
#knowledge-rules.kg-creation .kg-help{line-height:20px}

/* Knowledge flow geometry from Prototype.dc.html; existing surfaces and real content retained. */
.knowledge-home-header{height:128px;box-sizing:border-box;padding:56px 16px 0}
.knowledge-home-header>div{gap:4px}.knowledge-home-header svg{width:24px;height:24px}
.knowledge-category-list{padding:16px;gap:12px}
.knowledge-category-card{border-radius:20px}
.kg-layout-single .knowledge-category-card{display:flex;min-height:116px;gap:16px;padding:16px}
.knowledge-category-card>svg{display:none}.knowledge-category-copy{padding:0;gap:8px}
.knowledge-folder{width:92px;height:84px;flex:none;transform:none;align-self:flex-start}
.kg-layout-double .knowledge-category-card{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:16px;min-height:180px}
.kg-layout-double .knowledge-folder{width:92px;height:84px;margin:0;align-self:flex-start;transform:none}
.kg-layout-double .knowledge-category-copy{width:100%;gap:8px}
.kg-new-folder-tile{min-height:180px;border:1px dashed var(--line-strong,#d4d4d4);border-radius:20px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:transparent;font-size:13px;color:var(--ink-secondary,#626262)}
.kg-new-folder-tile svg{width:24px;height:24px}
.knowledge-category-header{height:128px;box-sizing:border-box;padding:56px 8px 0 4px;border-bottom:1px solid var(--line,#e6e6e6)}
.kg-folder-settings{padding:12px 20px 4px}.knowledge-timeline{padding-top:8px}
.knowledge-timeline-row{grid-template-columns:56px minmax(0,1fr);gap:12px;align-items:center}
.knowledge-timeline-row>time{padding-top:0}.knowledge-timeline-row>time strong{font-size:26px;line-height:32px}
.knowledge-course-card{padding:14px 18px}.knowledge-course-card>button strong{font-size:17px;line-height:24px}.knowledge-course-excerpt{margin-top:0;line-height:20px}
#knowledge-rules.kg-preview .kg-header{margin-top:56px;height:72px;min-height:72px;padding:0 8px 0 16px}
#knowledge-rules.kg-preview .kg-body{padding:0 16px 16px}
#knowledge-rules.kg-preview .kg-intro{margin-bottom:12px}
#knowledge-rules.kg-preview .kg-body>h2{font-size:13px;line-height:20px;font-weight:400;color:var(--ink-secondary,#626262);margin:12px 4px}
.kg-selection-card .kg-retro-row{position:relative;margin:0;min-height:64px;padding:8px 0;gap:12px}
.kg-retro-row input{width:24px;height:24px}.kg-retro-row small{margin-top:0}
.kg-skipped-card .kg-skipped{min-height:64px;padding:8px 0}
#knowledge-rules.kg-preview .kg-footer{padding:16px 16px max(32px,env(safe-area-inset-bottom));border:0;background:var(--canvas,#f7f7f7);gap:8px}
#knowledge-rules.kg-preview .kg-footer>button{height:52px;min-height:52px}
#knowledge-rules.kg-preview .kg-undo-hint{font-size:13px;line-height:20px}
@media(max-height:600px){#knowledge-rules.kg-preview .kg-header{margin-top:8px}}

.kg-keyword{box-sizing:border-box;height:28px}.kg-keyword button{height:26px;min-height:26px}.kg-keyword button:after{inset:-9px -10px}

#knowledge-rules.kg-creation .kg-header h1{flex:initial}

.kg-header h1{letter-spacing:0}

body[data-page=knowledge] .knowledge-home-header{height:128px!important;min-height:128px;padding:56px 16px 0!important;margin:0!important}
body[data-page=knowledge-category] .knowledge-category-header{height:128px!important;min-height:128px;padding:56px 8px 0 4px!important;margin:0!important}
