.cad-page, .cad-page *, .cad-modal, .cad-modal * { box-sizing: border-box; }
.cad-page { width: min(1280px, calc(100% - 40px)); margin: 0 auto 72px; }
.cad-hero { padding: 36px 0 28px; }
.cad-kicker { margin: 0 0 8px; color: var(--accent-strong); letter-spacing: .14em; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.cad-hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: var(--heading-letter-spacing); }
.cad-hero p { margin: 0 0 18px; max-width: 42rem; color: var(--muted); }
.cad-search { display: flex; align-items: center; gap: 10px; width: min(640px, 100%); padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.cad-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--core-focus), var(--shadow); }
.cad-search i { color: var(--accent-strong); }
.cad-search input { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.cad-search input:focus { box-shadow: none; }
.cad-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.cad-side { position: sticky; top: calc(var(--header-height) + 16px); max-height: calc(100vh - var(--header-height) - 32px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.cad-side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cad-side-close { display: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.cad-tree { display: grid; gap: 2px; }
.cad-tree a, .cad-tree button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; text-decoration: none; font: inherit; cursor: pointer; }
.cad-tree a:hover, .cad-tree button:hover, .cad-tree .is-current { background: var(--accent-soft); color: var(--accent-strong); }
.cad-tree .cad-ico { width: 1.15em; flex: 0 0 auto; text-align: center; color: var(--muted); font-size: .9em; }
.cad-tree a.is-current .cad-ico, .cad-tree a:hover .cad-ico { color: var(--accent-strong); }
.cad-tree a span { flex: 1; min-width: 0; }
.cad-tree b { color: var(--muted); font-weight: 700; font-size: .78rem; margin-left: auto; }
.cad-tree .cad-branch { margin: 0 0 0 12px; display: grid; gap: 2px; }
.cad-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 16px; }
.cad-filter-btn { display: none; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 700; }
.cad-crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .86rem; }
.cad-crumbs a { color: var(--accent-strong); text-decoration: none; }
.cad-count { margin: 0 0 0 auto; color: var(--muted); font-size: .82rem; }
.cad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; transition: opacity .16s ease; }
.cad-grid.is-updating { opacity: .58; pointer-events: none; }
.cad-card { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cad-card h3 { margin: 0; font-size: .95rem; }
.cad-card p { margin: 0; color: var(--muted); font-size: .75rem; }
.cad-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: #ffffff; cursor: pointer; padding: 0; border: 0; }
.cad-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cad-thumb-mono > img { filter: none; }
html[data-theme="dark"] .cad-thumb { background: #111a30; }
html[data-theme="dark"] .cad-thumb-mono > img { filter: invert(1); }
.cad-ph { width: 100%; height: 100%; display: block; }
.cad-ph img { width: 100%; height: 100%; object-fit: cover; }
.cad-download { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; font-weight: 750; font-size: .82rem; }
.cad-download:hover { background: linear-gradient(135deg, #0b57d0, #1a73e8); color: #fff; }
.cad-skel { min-height: 210px; border-radius: 14px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: cadPulse 1.2s ease-in-out infinite; }
@keyframes cadPulse { 50% { background-position: 100% 0; } }
.cad-status { color: var(--muted); font-size: .82rem; }
.cad-modal { border: 0; padding: 0; background: transparent; }
.cad-modal::backdrop { background: color-mix(in srgb, var(--text) 38%, transparent); }
.cad-modal-card { position: relative; width: min(560px, calc(100vw - 24px)); padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cad-modal-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.cad-modal-preview { display: grid; place-items: center; min-height: 240px; margin: 0 0 12px; border-radius: 12px; background: #ffffff; }
.cad-modal-preview img { max-width: 100%; max-height: 320px; }
.cad-modal-preview.is-mono > img { filter: none; }
html[data-theme="dark"] .cad-modal-preview { background: #111a30; }
html[data-theme="dark"] .cad-modal-preview.is-mono > img { filter: invert(1); }
.cad-modal-path { color: var(--muted); font-size: .82rem; }
.cad-modal-preview .cad-ph { width: min(100%, 400px); aspect-ratio: 4 / 3; }
.cad-modal-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 6px; }
.cad-modal-support { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); text-align: left; }
.cad-modal-support p { margin: 0 0 8px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.cad-coffee { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 10px; background: #ffdd00; color: #1a1400; text-decoration: none; font-weight: 800; font-size: .82rem; }
.cad-coffee:hover { filter: brightness(0.96); }
@media (max-width: 640px) {
  .cad-modal-actions { grid-template-columns: 1fr; }
}
.cad-overlay { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--text) 28%, transparent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 860px) {
  .cad-layout { grid-template-columns: 1fr; }
  .cad-filter-btn { display: inline-flex; align-items: center; gap: 8px; }
  .cad-side { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); max-height: none; transform: translateX(-105%); transition: transform .2s ease; }
  .cad-side.is-open { transform: none; }
  .cad-side-close { display: grid; place-items: center; }
  .cad-count { margin-left: 0; }
}
