/* Shared library presentation; both template types use the same card structure. */
#page-templates .page-heading,#page-history .page-heading{margin-bottom:24px}
.library-kind-tabs{gap:4px;padding:5px;background:#e9e9e6;border-color:#deded9;border-radius:10px}
.library-kind-tabs button{min-width:122px;padding:10px 24px;font-size:13px;font-weight:600}
.library-kind-tabs button[aria-selected=true]{background:linear-gradient(180deg,#e6eaef,#bdc9da);border-color:#738aaa;color:#2c3a4e;box-shadow:inset 0 1px 0 #f1f3f6,0 2px 4px #252b3415}
#page-templates .library-toolbar,#page-history .library-toolbar{margin-bottom:16px}
#page-templates .selection-bar,#page-history .selection-bar{background:#ededee;border-color:#e0e0db;margin-bottom:22px}
#page-templates .library-template,.dt-library .library-template{display:flex;flex-direction:column;padding:0;cursor:default;box-shadow:0 3px 14px #20212604;transition:border-color .18s,box-shadow .18s}
#page-templates .library-template:hover,.dt-library .library-template:hover{border-color:#98a7bd;box-shadow:0 6px 20px #1d283712}
.library-template .template-cover{aspect-ratio:4/3;background:linear-gradient(145deg,#ececed,#f4f5f6)}
.library-template .template-content{padding:18px 20px}
.library-template .template-content h3{min-height:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.6;font-size:14px}
.library-template .template-copy-title{margin:7px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px;color:#7d7f84;line-height:1.8}
.library-template .template-chips{min-height:26px;align-items:flex-start;margin-top:13px}
.library-template .template-saved{font-size:10px;color:#96979b;margin:14px 0 17px}
.library-template .template-actions{margin-top:auto}
.library-template .library-manage{padding:10px 13px;justify-content:flex-start;background:#fafafa}
.library-template .library-manage .manage-button{flex:1;text-align:center;padding:7px 2px;font-size:11px}
.library-template .library-manage .manage-button+.manage-button{border-left:1px solid #e6e6e7;border-radius:0}
.dt-library .library-toolbar{margin-top:24px}.dt-library .library-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr))}
.dt-embedded .library-toolbar{margin-top:0}.dt-trash-preview{display:block;width:42px;height:46px;object-fit:contain;border-radius:5px;background:#ebebec;flex-shrink:0}.dt-trash-copy{flex:1;min-width:0}.dt-trash-copy strong{overflow-wrap:anywhere}
.editor-actions>.inline-template-actions,.detail-editor-actions .action-row{margin-top:0}.inline-template-actions .button,.detail-editor-actions .inline-primary-actions .button{font-size:11px;padding:10px 8px}.detail-editor-actions .action-row{gap:9px}.detail-editor-actions .inline-primary-actions>.primary{flex:1.2}
.sidebar{width:228px;padding:27px 16px 18px;background:linear-gradient(180deg,#2e2f32,#27282b);border-right:1px solid #40403b;overflow:hidden;gap:0}
.sidebar .brand-workbench{flex-shrink:0;justify-content:flex-start;gap:10px;margin:0 5px 22px}
.sidebar .brand-workbench img{width:42px;height:42px;border-radius:10px;padding:3px}
.sidebar .brand-workbench .brand-copy{display:block}.sidebar .brand-workbench strong{font-size:17px;font-weight:600;letter-spacing:.2px}.sidebar .brand-workbench small{font-size:6px;letter-spacing:1.05px;color:#8e9aaa}
.sidebar nav{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;gap:0;margin:0;padding-right:2px;scrollbar-width:thin;scrollbar-color:#55544e transparent}
.nav-group{display:flex;flex-direction:column;gap:4px;margin-bottom:18px}
.nav-group:last-child{margin-bottom:0}
.sidebar .nav-caption{margin:0 12px 6px;font-size:9px;letter-spacing:1.4px;color:#8d8e93}
.sidebar .nav-item{min-height:44px;padding:10px 12px;gap:11px;font-size:13.5px;border:1px solid transparent;border-radius:8px;color:#b9babe;line-height:1.5;position:relative;transition:background .16s,color .16s,border-color .16s;flex-shrink:0}
.sidebar .nav-item .nav-icon{width:18px;height:18px;flex-shrink:0;opacity:.85}.sidebar .nav-item .nav-label{font-size:13.5px;width:auto;display:block;font-weight:450}
.sidebar .nav-item.active{color:#a3b6d0;background:linear-gradient(105deg,#455d7d1f,#455d7d0a);border-color:#7288a62e;box-shadow:inset 3px 0 0 #b9c8dc,0 2px 4px #0000000a}
.sidebar .nav-item.active .nav-label{font-weight:600}.sidebar .nav-item:not(.active):hover{background:#ffffff08;color:#ebeced}.sidebar .nav-item.active .nav-icon{opacity:1}
.sidebar .nav-count{font-size:9px;background:#ffffff09;border:1px solid #ffffff0a;color:#a6a7a9;margin-left:auto;padding:1px 6px;min-width:20px;text-align:center}
.sidebar .nav-chevron{font-size:17px;color:#929189;margin-left:auto;line-height:1;transition:transform .16s}.sidebar .nav-count+.nav-chevron{margin-left:0}.sidebar [aria-expanded=true] .nav-chevron{transform:rotate(90deg);color:#859ab8}
.sidebar .library-nav-sub{display:flex;flex-direction:column;gap:4px;padding:3px 0 3px 15px;margin:1px 0 4px 20px;border-left:1px solid #ffffff14}
.sidebar .library-nav-sub button{position:relative;padding:8px 12px;font-size:12px;text-align:left;color:#9fa0a4;min-height:35px;border-radius:6px}
.sidebar .library-nav-sub button:hover{color:#cacfd6;background:#ffffff05}.sidebar .library-nav-sub button.is-active{background:#7c92b112;color:#a1b4cf}.sidebar .library-nav-sub button.is-active:before{content:"";position:absolute;left:-18px;top:15px;width:5px;height:5px;background:#7990af;border-radius:50%;box-shadow:0 0 0 3px #2b2c2f}
.sidebar-bottom{flex-shrink:0;padding-top:8px;margin-top:0}.sidebar .private-note{padding:15px 9px 11px;font-size:10px;color:#b5b5b7;border-top-color:#ffffff0c;gap:9px}.sidebar .private-note small{font-size:9px;color:#7f8086;margin-top:5px}.sidebar .status-dot{width:5px;height:5px;background:#7a90ae;margin-top:5px}
.sidebar-logout{display:flex;align-items:center;gap:9px;width:100%;padding:10px 11px;background:none;border:1px solid transparent;border-radius:7px;color:#8e9096;font-size:11px;text-align:left}.sidebar-logout:hover{background:#ffffff06;color:#ccced1}.sidebar-logout svg{width:16px;height:16px}
.workspace{margin-left:228px;width:calc(100% - 228px)}
@media(max-width:1120px) and (min-width:851px){.sidebar{width:208px;padding-left:12px;padding-right:12px}.sidebar .brand-workbench strong{font-size:16px}.sidebar .brand-workbench img{width:38px;height:38px}.workspace{margin-left:208px;width:calc(100% - 208px)}}
@media(max-width:850px){.sidebar{width:72px;padding:22px 10px 12px}.sidebar .brand-workbench{justify-content:center;margin:0 0 27px}.sidebar .brand-workbench img{width:40px;height:40px}.sidebar .brand-workbench .brand-copy,.sidebar .nav-caption,.sidebar .nav-item .nav-label,.sidebar .nav-count,.sidebar .nav-chevron,.sidebar .library-nav-sub,.sidebar .private-note,.sidebar-logout span{display:none}.sidebar .nav-item{justify-content:center;min-height:43px;padding:12px 8px;gap:0}.sidebar .nav-item .nav-icon{width:20px;height:20px}.nav-group{margin-bottom:20px}.sidebar-bottom{display:block}.sidebar-logout{justify-content:center;padding:12px 0}.workspace{margin-left:72px;width:calc(100% - 72px)}.library-template .template-content{padding:16px}.library-toolbar>div{flex-wrap:wrap;gap:5px 12px}.dt-library .library-toolbar{align-items:flex-start;flex-direction:column;gap:12px}}
#page-history .history-card{display:flex;flex-direction:column;align-self:stretch;cursor:default;padding:0;box-shadow:0 3px 14px #20212604}
.history-card .history-cover{aspect-ratio:4/3;background:linear-gradient(145deg,#ececed,#f4f5f6);cursor:zoom-in}
.history-card .history-card-content{padding:18px 20px;display:flex;flex-direction:column;flex:1;min-width:0}
.history-card .history-card-content h3{font-size:14px;line-height:1.6;font-weight:600;min-height:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.history-card .history-card-description{display:flex;align-items:center;flex-wrap:wrap;gap:7px;font-size:11px;line-height:1.8;color:#7d7f84;margin:7px 0 0}
.design-type-badge{display:inline-flex;align-items:center;padding:3px 9px;border-radius:5px;font-size:12px;font-weight:650;line-height:1.6;letter-spacing:.2px;border:1px solid #434c59;background:#353536;color:#b1bfd3}
.design-type-badge[data-design-type=details]{background:#d1d9e5;border-color:#94a8c4;color:#334762}
.library-template .template-type-row{display:flex;align-items:center;gap:7px;white-space:normal;overflow:visible;min-width:0}
.template-type-row .design-type-badge{flex-shrink:0}.template-type-row .template-title-preview{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-card .history-chips{margin-top:13px;min-height:26px;align-items:flex-start}
.history-card .history-card-updated{font-size:10px;color:#96979b;margin:14px 0 17px;line-height:1.9}
.history-card .history-actions{margin-top:auto;gap:10px}.history-card .history-actions .button{padding:10px 8px;width:100%;font-size:11px;gap:5px}
.history-card .library-manage{padding:10px 13px;background:#fafafa}.history-card .library-manage .manage-button{flex:1;padding:7px 2px;font-size:11px;text-align:center}.history-card .library-manage .manage-button+.manage-button{border-left:1px solid #e6e6e7;border-radius:0}
#page-history .history-activity{margin:24px 0 0}
.mh-history-dialog{width:min(900px,94vw)}.mh-preview-layout{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(240px,1fr);gap:24px;align-items:start;margin-top:24px}.mh-preview-stage{height:min(48vh,440px);background:linear-gradient(145deg,#eee,#f2f3f5);border:1px solid var(--line);border-radius:9px;overflow:hidden;display:flex;align-items:center;justify-content:center}.mh-preview-stage img{display:block;width:100%;height:100%;object-fit:contain}.mh-preview-content{padding:8px 0}.mh-preview-content label{margin-top:20px}.mh-preview-content .button{margin-top:24px}.mh-preview-content .hint{line-height:1.9}.mh-preview-stage .library-placeholder{padding:24px;text-align:center;font-size:12px}
@media(max-width:850px){.history-card .history-card-content{padding:16px}.mh-preview-layout{grid-template-columns:1fr;gap:15px}.mh-preview-stage{max-height:400px}.mh-preview-content{padding:0}.dh-history-toolbar{align-items:flex-start;flex-direction:column;gap:8px}.dh-history-toolbar label{width:100%}}
@media(prefers-reduced-motion:reduce){.sidebar .nav-item,.sidebar .nav-chevron,#page-templates .library-template,#page-history .history-card{transition:none}}

/* Project completion state and matching filters in both history lists. */
.history-filter-controls{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
#page-history .library-toolbar>.history-filter-controls{gap:14px;flex-direction:row;align-items:center}
#page-history .history-filter-controls .sort-control{min-width:125px;margin:0}
.project-state-badge{display:inline-flex;align-items:center;padding:3px 9px;border-radius:5px;font-size:11px;font-weight:600;line-height:1.6;white-space:nowrap;border:1px solid #d7d9dc;background:#edeeef;color:#77756d}
.project-state-badge[data-project-state="generated"]{background:linear-gradient(180deg,#e3e7ed,#c7d1e0);border-color:#95aac8;color:#3a4f6c}
@media(max-width:650px){#page-history .library-toolbar{align-items:flex-start;flex-direction:column;gap:12px}#page-history .history-filter-controls{width:100%;gap:12px}#page-history .history-filter-controls .sort-control{flex:1;min-width:100px}}

.library-search-row{display:flex;align-items:center;gap:16px;margin:0 0 16px}
.library-search-row>label{font-size:12px;color:#777780;white-space:nowrap;margin:0}
.library-search-box{display:flex;gap:9px;align-items:center;flex:1;min-width:0}
.library-search-box input[type="search"]{flex:1;min-width:0;margin:0;font-size:12px;padding:11px 13px;background:#fff}
.library-search-box .button{flex-shrink:0;min-height:37px}
@media(max-width:560px){.library-search-row{align-items:flex-start;flex-direction:column;gap:8px}.library-search-box{width:100%}.library-search-box input[type="search"]{font-size:11px}}

.library-search-row{scroll-margin-top:90px}
.library-search-hint{font-size:11px;color:#606e82;margin:-7px 0 16px;line-height:1.7;overflow-wrap:anywhere}
.library-pagination{display:flex;justify-content:space-between;align-items:center;gap:15px;padding:18px 0;margin-top:16px;border-top:1px solid var(--line)}
.pagination-summary{font-size:11px;color:var(--muted);white-space:nowrap}
.pagination-controls{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.pagination-controls label{display:flex;align-items:center;gap:8px;margin:0;font-size:11px;white-space:nowrap;color:var(--muted)}
.pagination-controls select{width:auto;min-width:75px;margin:0;padding:7px 10px;font-size:11px;background:#fff}
.pagination-controls .button{font-size:11px;min-height:34px}
@media(max-width:850px){.library-pagination{align-items:flex-start;flex-direction:column}.pagination-controls{gap:8px;width:100%;justify-content:flex-end}.pagination-controls select{min-width:65px;padding:7px}.library-search-box{flex-wrap:wrap}.library-search-box input[type="search"]{flex-basis:180px}}
@media(max-width:460px){.pagination-controls{justify-content:flex-start}.pagination-jump{order:3}.pagination-controls .button{padding:8px}.library-search-box input[type="search"]{flex-basis:150px}}
