.downloads-page { --library-muted: #526674; }
.downloads-page [hidden] { display: none !important; }
.downloads-page button, .downloads-page input, .downloads-page select { font: inherit; }
.downloads-page button, .downloads-page select { cursor: pointer; }
.downloads-page :is(button,input,select):focus-visible { outline: 3px solid #177c87; outline-offset: 4px; }
.library-main { padding-block: 54px 60px; }
.library-intro { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.library-intro h1 { font-size: clamp(2.15rem, 4vw, 3.55rem); line-height: 1.14; letter-spacing: -.045em; margin: 0; color: var(--navy); }
.library-intro h1 span { color: #177c87; }
.library-lead { max-width: 660px; font-size: 1.05rem; color: var(--library-muted); margin: 22px 0 0; }
.library-free { flex-shrink: 0; padding: 20px 24px; border-left: 1px solid var(--line); font-weight: 750; color: var(--navy); line-height: 1.8; }
.library-free > span:first-child { color: #177c87; margin-right: 5px; }
.library-free > span:last-child { font-size: .85rem; font-weight: 400; color: var(--library-muted); }
.fixture-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; padding: 11px 14px; margin: 28px 0 32px; border: 1px solid var(--line); border-radius: 9px; font-size: .77rem; color: #59644e; background: #f2f0e6; }
.fixture-dot { width: 6px; height: 6px; background: #7a8961; border-radius: 50%; }
.section-label { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-label h2 { margin: 0; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--library-muted); }
.label-line { width: 24px; height: 2px; background: #177c87; }
.latest-card { position: relative; display: grid; grid-template-columns: 72px minmax(0,1fr) auto; align-items: center; gap: 24px; padding: 28px 30px; background: var(--navy); color: white; border-radius: 18px; overflow: hidden; }
.latest-card .file-symbol { width: 68px; height: 82px; background: #294761; border: 1px solid #53697b; color: #b7f2f2; font-size: .8rem; }
.latest-card h3 { font-size: 1.35rem; margin: 4px 0 8px; line-height: 1.4; letter-spacing: -.02em; color: white; }
.latest-card .material-description { color: #d2dfe8; }
.latest-card .material-meta { color: #c1d2df; }
.new-badge { display: inline-flex; align-items: center; gap: 6px; color: #a7eced; font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.new-badge::before { content: ''; width: 6px; height: 6px; background: #72dfdf; border-radius: 50%; }
.latest-card .material-actions { flex-direction: column; align-items: stretch; min-width: 132px; }
.latest-card .library-button { background: #b6eeee; color: #18304b; border-color: #b6eeee; }
.latest-card .library-button-light { background: transparent; border-color: #53697b; color: white; }
.catalog-section { margin-top: 44px; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.catalog-heading h2 { margin: 0; color: var(--navy); letter-spacing: -.025em; font-size: 1.65rem; }
#catalog-total { font-size: .8rem; color: var(--library-muted); }
.category-filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) minmax(0,1.5fr); gap: 10px; }
.category-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 66px; padding: 12px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--navy-soft); font-size: .88rem !important; font-weight: 700 !important; }
.category-number { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 8px; background: #f0ebe2; font-size: 1rem; }
.category-count { color: #5f727e; font-size: .72rem; font-weight: 500; }
.category-button:hover { border-color: #177c87; }
.category-button[aria-pressed="true"] { background: #e1f3f1; border-color: #29898c; box-shadow: inset 0 0 0 1px #29898c; color: #125d63; }
.category-button[aria-pressed="true"] .category-number { background: #1a757c; color: white; }
.catalog-toolbar { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 18px; margin-top: 24px; padding: 22px 24px; background: #eee9df; border-radius: 12px; }
.catalog-toolbar label { display: block; font-size: .76rem; font-weight: 750; margin-bottom: 7px; color: var(--navy-soft); }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; top: 14px; left: 14px; width: 19px; height: 19px; color: #6e7b85; }
.catalog-toolbar input, .catalog-toolbar select { width: 100%; min-height: 48px; border: 1px solid #d6cebf; border-radius: 8px; background: var(--paper); color: var(--text); font-size: .9rem; padding: 10px 12px; }
.catalog-toolbar input { padding-left: 43px; }
.catalog-toolbar select { padding-right: 30px; }
.catalog-toolbar:has(.unit-field[hidden]) { grid-template-columns: minmax(0,1fr); }
.results-heading { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; color: var(--library-muted); font-size: .79rem; }
.results-heading p { margin: 8px 0 13px; }
.material-list { display: grid; gap: 12px; }
.material-card { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.file-symbol { display: grid; align-content: center; justify-items: center; gap: 9px; width: 50px; height: 66px; background: #ecf3ed; border: 1px solid #d7e4da; border-radius: 7px 15px 7px 7px; color: #366c51; font-size: .63rem; font-weight: 800; letter-spacing: .025em; }
.file-symbol::before { content: ''; width: 21px; height: 13px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .5; }
.format-docx { color: #35679b; background: #eaf0f7; border-color: #d6e1ef; }
.format-pptx { color: #a26331; background: #f8ede0; border-color: #efddc8; }
.material-card h3 { margin: 0 0 5px; font-size: 1.03rem; line-height: 1.45; font-weight: 750; color: var(--navy); }
.material-description { font-size: .86rem; margin: 0 0 9px; color: var(--library-muted); line-height: 1.6; }
.material-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; color: var(--library-muted); font-size: .72rem; }
.material-meta span + span, .material-meta time { position: relative; }
.material-meta span + span::before, .material-meta time::before { content: '·'; position: absolute; left: -9px; }
.material-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.material-tag { background: #f1eee7; color: #53636b; border-radius: 4px; padding: 2px 6px; font-size: .65rem; }
.material-actions { display: flex; align-items: center; gap: 8px; }
.library-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 9px 15px; border: 1px solid var(--navy); border-radius: 8px; background: var(--navy); color: white; font-size: .81rem !important; font-weight: 700; line-height: 1.4; text-decoration: none; }
.library-button svg { width: 16px; height: 16px; flex: 0 0 auto; }
.library-button:hover { filter: brightness(.94); }
.library-button-light { background: transparent; border-color: #d6cebf; color: var(--navy); }
.loading-note, .catalog-error, .empty-state { padding: 28px; border: 1px dashed #c9c5b9; border-radius: 12px; text-align: center; }
.catalog-error { background: #fff3eb; }
.empty-state > span { font-size: 2.5rem; color: #177c87; }
.empty-state h3 { margin: 3px 0; }
.empty-state p { color: var(--library-muted); font-size: .9rem; }
.library-note { display: flex; gap: 16px; padding: 24px 0 0; margin-top: 16px; color: var(--library-muted); font-size: .82rem; }
.library-note > span { color: #177c87; font-size: 1.3rem; }
.library-note p { margin: 0; max-width: 700px; }
.library-note strong { color: var(--navy); }
.library-footer { padding: 30px 0; }
.library-footer .shell { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; align-items: center; }
.library-footer p, .library-footer > .shell > div { font-size: .76rem; color: var(--library-muted); }
.library-footer > .shell > div { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.preview-dialog { width: min(1060px,calc(100% - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--text); padding: 24px; }
.preview-dialog::backdrop { background: rgba(15,32,49,.7); }
.preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.preview-header .eyebrow { font-size: .68rem; margin-bottom: 6px; }
.preview-header h2 { margin: 0; font-size: 1.3rem; line-height: 1.4; }
.close-preview { flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); background: transparent; border-radius: 9px; color: var(--navy); }
#preview-description, .preview-fallback { font-size: .8rem; color: var(--library-muted); }
.preview-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.preview-fallback { margin: 12px 0; }
#preview-frame { display: flex; width: 100%; height: 54dvh; min-height: 240px; border: 1px solid var(--line); background: #ecebe8; border-radius: 8px; }
.downloads-page.preview-open { overflow: hidden; }
@media (max-width: 900px) {
  .library-free { display: none; }
  .category-button { flex-wrap: wrap; gap: 5px; }
  .category-number { display: none; }
  .latest-card { grid-template-columns: 64px minmax(0,1fr); }
  .latest-card .material-actions { grid-column: 2; flex-direction: row; }
  .material-card { grid-template-columns: 50px minmax(0,1fr); gap: 14px; }
  .material-card .material-actions { grid-column: 2; }
}
@media (max-width: 600px) {
  .library-main { padding-block: 30px 36px; }
  .library-intro .eyebrow { font-size: .62rem; letter-spacing: .08em; }
  .library-lead { font-size: .94rem; margin-top: 16px; }
  .fixture-notice { margin-block: 20px 26px; }
  .fixture-notice > span:last-child { flex-basis: 100%; }
  .latest-card { grid-template-columns: 1fr; padding: 24px 20px; gap: 12px; }
  .latest-card .file-symbol { display: none; }
  .latest-card .material-actions { grid-column: 1; }
  .latest-card h3 { font-size: 1.2rem; }
  .catalog-section { margin-top: 32px; }
  .catalog-heading h2 { font-size: 1.35rem; }
  .catalog-heading { flex-wrap: wrap; gap: 4px; }
  .category-filters { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
  .category-button { min-height: 54px; font-size: .77rem !important; padding: 8px 3px; }
  .category-general { grid-column: 1 / -1; min-height: 45px; }
  .category-count { display: none; }
  .catalog-toolbar { grid-template-columns: 1fr; padding: 16px; gap: 14px; margin-top: 18px; }
  .material-card { padding: 18px 16px; grid-template-columns: 38px minmax(0,1fr); gap: 12px; }
  .material-card .file-symbol { width: 36px; height: 50px; font-size: .52rem; gap: 6px; }
  .material-card .file-symbol::before { width: 15px; height: 10px; }
  .material-card .material-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .material-card h3 { font-size: .98rem; }
  .material-description { font-size: .8rem; }
  .material-meta { font-size: .67rem; }
  .preview-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 16px; border-radius: 12px; }
  .preview-header h2 { font-size: 1.08rem; }
  .preview-actions { flex-direction: column; }
  .preview-dialog .library-button { width: 100%; }
}

/* Progressive static catalogue: keep long public titles/names inside the existing cards. */
.material-body { min-width: 0; overflow-wrap: anywhere; }
.results-heading { flex-wrap: wrap; align-items: center; }
#show-all { margin-block: 4px; }

.catalog-folders { display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,14rem),1fr));gap:.65rem;margin-bottom:.8rem }
.catalog-folders:empty { display:none }
.folder-button { display:grid;grid-template-columns:20px minmax(0,1fr) auto;align-items:center;min-height:48px;gap:10px;padding:10px 14px;text-align:start }
.folder-button svg {width:20px;height:20px;color:var(--navy-soft)}
.folder-count {color:#526572;white-space:nowrap;font-size:.8rem;font-weight:500}
#unfiled-label {margin:16px 0 8px;color:var(--navy-soft);font-size:.9rem;font-weight:650}
.folder-name,#folder-title { overflow-wrap:anywhere }
#folder-navigation:not([hidden]) { display:flex;align-items:center;flex-wrap:wrap;gap:.8rem;margin:.7rem 0 }
.catalog-toolbar:not([hidden]) {grid-template-columns:minmax(0,2fr) repeat(2,minmax(0,1fr))}
@media(max-width:690px){.catalog-toolbar:not([hidden]){grid-template-columns:minmax(0,1fr)}}
