/* Card browsing reuses the existing book/editor/chat layout and theme tokens. */
#card-workspace-bar[hidden],#card-overview[hidden],#card-sidebar[hidden]{display:none!important}
#card-workspace-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:64px;padding:10px 22px;background:var(--color-card);border-bottom:1px solid var(--color-border)}
.cw-book-title{display:flex;align-items:center;gap:14px;min-width:0;flex-wrap:wrap}
.cw-book-title h1{font-size:20px;line-height:1.5;margin:0;font-weight:600;overflow-wrap:anywhere}
.cw-book-title>span{font-size:13px;color:var(--color-ink-light)}
.cw-bar-actions{display:flex;gap:6px;flex-wrap:wrap;flex-shrink:0}
.cw-button{font:inherit;display:inline-flex;justify-content:center;align-items:center;gap:6px;min-height:40px;padding:7px 12px;border:1px solid var(--color-border);border-radius:8px;background:var(--color-card);color:var(--color-ink);cursor:pointer;overflow-wrap:anywhere}
.cw-button svg{width:17px;height:17px;flex-shrink:0}
.cw-button:focus-visible,.cw-search input:focus-visible,.cw-more>summary:focus-visible{outline:3px solid var(--color-primary);outline-offset:2px}
.cw-button:hover{background:var(--color-primary-bg);color:var(--color-primary)}
.cw-button.cw-primary{background:var(--color-primary);border-color:var(--color-primary);color:#fff}
#card-overview{flex:1;min-width:0;overflow-y:auto;padding:24px;background:var(--color-bg);order:1}
.cw-library-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.cw-library-head h2{font-size:22px;margin:0;font-weight:600;color:var(--color-ink)}
.cw-library-head p{font-size:14px;line-height:1.7;margin:6px 0 0;color:var(--color-ink-light)}
.cw-tabs{display:flex;gap:4px;border-bottom:1px solid var(--color-border);margin-bottom:14px}
.cw-tabs button{flex:1;border:none;background:transparent;border-radius:6px 6px 0 0;padding:10px 4px;white-space:nowrap}
.cw-tabs button[aria-pressed="true"]{color:var(--color-primary);background:var(--color-primary-bg);box-shadow:inset 0 -2px var(--color-primary)}
.cw-search{display:block;margin:0 0 16px}
.cw-search>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.cw-search input{box-sizing:border-box;width:100%;min-width:0;min-height:40px;border:1px solid var(--color-border);border-radius:8px;background:var(--color-card);color:var(--color-ink);font:inherit;padding:8px 11px}
.cw-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:16px;align-items:start}
.cw-card{border:1px solid var(--color-border);background:var(--color-card);border-radius:12px;padding:17px;min-width:0;overflow-wrap:anywhere}
.cw-card.is-active{border-color:var(--color-primary);background:var(--color-primary-bg)}
.cw-card .cw-card-pick{width:100%;text-align:left;display:flex;flex-direction:column;align-items:stretch;gap:10px;padding:0;border:0;background:transparent}
.cw-card-title{display:flex;align-items:flex-start;gap:8px;font-size:18px;line-height:1.6;color:var(--color-ink)}
.cw-card-title small{font-size:12px;line-height:2.4;color:var(--color-primary)}
.cw-card-title strong{flex:1;font-weight:500;min-width:0}
.cw-card-title svg{width:16px;height:16px;margin-top:7px;color:var(--color-ink-light)}
.cw-card-summary{font-size:15px;line-height:1.85;color:var(--color-ink-light)}
.cw-card-excerpt{margin-top:14px;padding-top:12px;border-top:1px solid var(--color-border);font-size:16px;line-height:1.9;color:var(--color-ink);white-space:pre-wrap}
.cw-card footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;margin-top:15px;font-size:12px;color:var(--color-ink-light)}
.cw-card footer>div{display:flex;gap:10px;flex-wrap:wrap}
.cw-card footer button{min-height:36px;border:0;padding:4px 0;background:transparent;color:var(--color-primary);font-size:14px}
.cw-empty{grid-column:1/-1;padding:32px 14px;text-align:center;color:var(--color-ink-light);font-size:16px;line-height:1.8}
.cw-empty h3{font-size:20px;color:var(--color-ink);margin:0 0 8px;font-weight:500}
.cw-empty p{margin:0 0 18px}.cw-empty button{margin:4px}
#card-sidebar{padding:14px 12px 8px;overflow-y:auto;flex:1;min-height:0}
#card-sidebar .cw-grid{grid-template-columns:1fr;gap:10px}
#card-sidebar .cw-card{padding:12px}
#card-sidebar .cw-card-title{font-size:16px}
#card-sidebar .cw-card-summary{font-size:13px}
#card-sidebar .cw-card footer{margin-top:9px}
#card-sidebar .cw-card footer>div{gap:8px}
#card-sidebar .cw-card footer button{font-size:13px}
#card-sidebar .cw-search input{font-size:14px}
.cw-more{min-height:0;overflow:auto}
.cw-more.cw-enabled{flex-shrink:0;border-top:1px solid var(--color-border);max-height:45%}
.cw-more>summary{padding:12px 15px;color:var(--color-ink-light);font-size:13px;cursor:pointer}
.cw-more:not(.cw-enabled){display:contents}
.cw-file h3{font-size:16px;font-weight:500;margin:12px 0 4px;color:var(--color-ink)}
.cw-file p{font-size:14px;line-height:1.7;margin:0;color:var(--color-ink-light)}
.cw-file-image{height:130px;display:flex;align-items:center;justify-content:center;background:var(--color-primary-bg);border-radius:7px;color:var(--color-primary);overflow:hidden}
.cw-file-image>svg{width:32px;height:32px}.cw-file-image img{max-width:100%;width:100%;height:100%;object-fit:cover}
.book-progress-bar.book-progress-compact{padding:4px 12px;margin:0 12px 6px;background:transparent;border:0;border-top:1px solid var(--color-border);border-radius:0;color:var(--color-ink)}
.book-progress-compact .book-progress-summary{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:14px;line-height:1.7}
.book-progress-compact .book-progress-summary>span{flex:1;min-width:75px;color:var(--color-ink-light)}
.book-progress-bar.book-progress-compact button{font:inherit;font-size:14px;min-height:40px;padding:5px 8px;background:var(--color-card);color:var(--color-primary);border-color:var(--color-border)}
.book-progress-compact .book-progress-details{padding:10px 12px;margin:3px 0 8px;border-radius:8px;background:var(--color-primary-bg)}
.book-progress-compact .book-progress-details[hidden]{display:none}
.book-progress-compact .book-progress-title{font-size:14px;margin-bottom:4px}.book-progress-compact .book-progress-text{font-size:14px}
.book-progress-compact .book-progress-actions{margin-top:8px;gap:8px}
@media(min-width:769px){
 body.card-book-open .main-layout{height:calc(100dvh - 56px - var(--card-bookbar-height,64px))}
 .card-overview-mode>.outline-pane,.card-overview-mode>#draft-pane,.card-overview-mode>#resize-handle-left,.card-overview-mode>#resize-handle-right{display:none!important}
 .card-overview-mode>#ai-pane{order:5}
 .card-overview-mode>#outline-float-btn,.card-overview-mode>#draft-float-btn{display:none!important}
 body.card-book-open:not(.focus-mode) .main-layout:not(.card-overview-mode) .outline-pane:not(.collapsed){width:250px}
 body.card-book-open .ai-pane:not(.collapsed):not(.ai-fullscreen){max-width:38%;min-width:280px}
 body.card-book-open .draft-actions{flex-wrap:wrap;row-gap:3px}
 body.card-book-open .draft-header{align-items:flex-start;flex-wrap:wrap}
 body.card-book-open .draft-title-row{max-width:100%;min-width:0}
 body.card-book-open .draft-chapter-name{overflow-wrap:anywhere;white-space:normal}
 body.card-book-open .draft-body{background:var(--color-card)}
}
@media(min-width:769px) and (max-width:1100px){
 #card-workspace-bar{padding:8px 14px}
 .cw-book-title h1{font-size:18px}
 .cw-bar-actions{gap:4px}.cw-bar-actions button{font-size:13px;padding:6px 8px}
 body.card-book-open:not(.focus-mode) .main-layout:not(.card-overview-mode) .outline-pane:not(.collapsed){width:210px}
 body.card-book-open .ai-pane:not(.collapsed):not(.ai-fullscreen){width:300px;min-width:260px;max-width:34%}
 #card-overview{padding:18px}
}
@media(max-width:768px){
 #card-workspace-bar,#card-overview{display:none!important}
 #card-sidebar{padding:14px 12px}
 #card-sidebar .cw-card{padding:16px}
 #card-sidebar .cw-card-title{font-size:20px}
 #card-sidebar .cw-card-summary{font-size:16px}
 #card-sidebar .cw-search input{font-size:16px;min-height:44px}
 #card-sidebar .cw-card footer button{font-size:16px;min-height:44px}
 #card-sidebar .cw-tabs button{font-size:16px;min-height:44px}
 .book-progress-bar.book-progress-compact{margin:0 12px 4px;padding:3px 0}
 .book-progress-bar.book-progress-compact button{min-height:44px;font-size:14px}
 .book-progress-compact .book-progress-actions button{flex:1 1 auto}
 .cw-more.cw-enabled{max-height:40%}
}
