.cms-admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); background: var(--soft); min-height: 80vh; }
.cms-panel code { overflow-wrap: anywhere; }
.cms-sidebar { padding: 32px 20px; background: #fff; border-right: 1px solid var(--line); }
.cms-brand { display: block; font-size: 22px; font-weight: 800; color: var(--ink); margin-bottom: 30px; }
.cms-brand span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .15em; }
.cms-sidebar nav { display: grid; gap: 8px; }
.cms-nav { display: block; text-align: left; width: 100%; border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 12px 14px; cursor: pointer; }
.cms-nav:hover, .cms-nav.is-active { background: var(--accent-soft); color: var(--brand-dark); }
.cms-sidebar > p { margin-top: 50px; font-size: 12px; color: var(--muted); }
.cms-workspace { padding: 38px clamp(20px, 4vw, 64px) 80px; min-width: 0; max-width: 1400px; width: 100%; }
.cms-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.cms-heading h1 { font-size: 32px; margin: 8px 0 0; }
.cms-chip { display: inline-block; border-radius: 6px; background: var(--accent-soft); color: var(--brand-dark); font-size: 12px; padding: 3px 8px; white-space: nowrap; }
.cms-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.cms-toolbar input { flex: 1; min-width: 150px; }
.cms-admin input:not([type=checkbox]), .cms-admin select, .cms-admin textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; color: var(--ink); min-width: 0; }
.cms-toolbar select { width: auto; }
.cms-admin label { display: grid; gap: 7px; font-size: 14px; color: #49413d; margin: 12px 0; }
.cms-admin .cms-check { display: flex; align-items: center; gap: 8px; }
.cms-check input { accent-color: var(--brand); width: 17px; height: 17px; }
.cms-options { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.cms-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.cms-table { width: 100%; border-collapse: collapse; }
.cms-table th, .cms-table td { padding: 18px; border-bottom: 1px solid var(--line); text-align: left; }
.cms-table th { font-size: 12px; color: var(--muted); background: #fcfaf8; }
.cms-table td { font-size: 14px; }
.cms-table small { display: block; color: var(--muted); margin-top: 5px; }
.cms-empty-state { padding: 45px 10px; text-align: center; color: var(--muted); }
.cms-panel { padding: 25px 30px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 22px; }
.cms-panel h2 { font-size: 20px; margin: 0 0 12px; }
.cms-panel h2 small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 12px; }
.cms-panel h3 { font-size: 15px; margin: 20px 0 8px; }
.cms-form-grid, .cms-meta-editor { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 24px; }
.cms-meta-editor > div { margin-bottom: 10px; }
.cms-media-grid { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.cms-media-tile { border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.cms-media-tile img { display: block; width: 150px; height: 110px; object-fit: cover; border-radius: 6px; }
.cms-media-tile > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0 0; }
.cms-markdown { font-family: Consolas, monospace; line-height: 1.7; resize: vertical; }
.cms-markdown-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.cms-savebar { position: sticky; bottom: 0; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -5px 25px #18181808; z-index: 5; }
.cms-savebar > span { margin-right: auto; font-size: 13px; color: var(--muted); }
.cms-version, .cms-definition { border: 1px solid var(--line); padding: 18px; border-radius: 10px; margin: 18px 0; min-width: 0; }
.cms-version { padding: 0; }
.cms-version-bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; min-height: 58px; }
.cms-version-summary { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; font-size: 13px; }
.cms-version-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 15px; }
.cms-version-summary > span { flex-shrink: 0; color: var(--muted); }
.cms-version-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.cms-version-actions .cms-check { margin: 0; white-space: nowrap; font-size: 13px; }
.cms-version-actions button { min-height: 32px; white-space: nowrap; }
.cms-version-delete { color: #a43b32; }
.cms-version-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); }
.cms-version-body[hidden] { display: none; }
@media (max-width: 700px) {
  .cms-version-bar { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .cms-version-summary { flex-basis: 100%; }
  .cms-version-actions { width: 100%; justify-content: flex-end; }
  .cms-version-actions .cms-check { margin-right: auto; }
}
.cms-course-link { margin: 14px 0 22px; }
.cms-qr-thumb { max-width: 140px; max-height: 140px; display: block; }
.cms-dialog { width: min(560px, calc(100% - 32px)); max-height: 88vh; border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 20px 90px #0003; }
.cms-dialog::backdrop, .cms-preview::backdrop { background: #18181899; }
.cms-dialog > header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.cms-dialog > header h2 { font-size: 20px; margin: 0; }
.cms-dialog > header button { width: 44px; height: 44px; border: 0; border-radius: 50%; font-size: 26px; cursor: pointer; }
.cms-dialog-body { padding: 26px; }
.cms-recommended { background: var(--soft); border-radius: 12px; padding: 22px; margin-bottom: 26px; }
.cms-recommended h3 { font-size: 25px; margin: 8px 0; }
.cms-history { list-style: none; padding: 0; }
.cms-history li { border-top: 1px solid var(--line); padding: 14px 0; }
.cms-history p { font-size: 14px; margin: 4px 0 0; color: var(--muted); }
.cms-contact { text-align: center; }
.cms-contact img { width: min(280px,100%); max-height: 340px; object-fit: contain; }
.cms-preview { width: min(1200px,95vw); max-height: 92vh; padding: 20px; border: 0; border-radius: 16px; }
.cms-preview > button { position: sticky; top: 0; z-index: 4; }
.cms-detail { width: min(1120px, calc(100% - 48px)); margin: 40px auto 80px; }
.cms-detail-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; margin: 36px 0; }
.cms-detail-hero h1 { font-size: clamp(32px,4vw,52px); line-height: 1.2; overflow-wrap: anywhere; }
.cms-detail-hero img, .cms-image-placeholder { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; background: var(--soft); }
.cms-meta { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--line); padding: 24px 0; margin: 40px 0; }
.cms-meta > div { min-height: 55px; padding: 0 18px; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.cms-meta > div:last-child { border: 0; }
.cms-meta dt { font-size: 12px; color: var(--muted); }
.cms-meta dd { margin: 8px 0 0; font-size: 15px; }
.cms-gallery-controls { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 12px; }
.cms-gallery-track { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 16px; }
.cms-gallery-track img { height: 340px; max-width: 90%; object-fit: contain; border-radius: 14px; scroll-snap-align: start; background: var(--soft); }
.cms-prose { max-width: 760px; margin: 50px auto; overflow-wrap: anywhere; }
.cms-prose h2 { margin-top: 35px; font-size: 28px; }
.cms-prose img { max-width: 100%; border-radius: 12px; }
.cms-prose pre { overflow: auto; padding: 20px; background: var(--night); color: #fff; border-radius: 10px; }
.cms-prose blockquote { margin: 20px 0; border-left: 4px solid var(--brand); padding: 12px 20px; background: var(--soft); }
.cms-prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.cms-prose td, .cms-prose th { border: 1px solid var(--line); padding: 10px; }
.cms-interactions { background: var(--soft); border: 1px solid var(--line); border-radius: 18px; padding: 32px; margin-top: 50px; scroll-margin-top: 100px; }
[data-managed-item][hidden], #cms-empty[hidden] { display: none !important; }
#cms-message:empty { display: none; }
body [hidden] { display: none !important; }
.cms-gallery-image { flex: 0 0 auto; max-width: 90%; padding: 0; border: 0; border-radius: 14px; background: var(--soft); cursor: zoom-in; scroll-snap-align: start; }
.cms-gallery-image img { display: block; max-width: 100%; }
.cms-gallery-image:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.cms-lightbox { width: min(1440px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px; color: #fff; background: #181818; box-shadow: 0 20px 90px #0005; }
.cms-lightbox::backdrop { background: #000b; }
.cms-lightbox header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; }
.cms-lightbox header p { margin: 0; }
.cms-lightbox button { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #ffffff40; border-radius: 50%; color: #fff; background: #ffffff18; font-size: 24px; cursor: pointer; }
.cms-lightbox button:hover { background: #ffffff30; }
.cms-lightbox button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cms-lightbox-stage { position: relative; display: grid; place-items: center; padding: 0 68px 20px; }
.cms-lightbox-stage img { display: block; width: 100%; height: min(78dvh, 960px); object-fit: contain; }
.cms-lightbox-prev, .cms-lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); }
.cms-lightbox-prev { left: 12px; }
.cms-lightbox-next { right: 12px; }
@media (max-width: 620px) {
  .cms-lightbox-stage { padding: 0 8px 64px; }
  .cms-lightbox-stage img { height: 65dvh; }
  .cms-lightbox-prev, .cms-lightbox-next { top: auto; bottom: 10px; transform: none; }
}
.catalog-feature dl > div { min-width: 0; flex: 1; }
.catalog-feature dd { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .cms-admin { grid-template-columns: 1fr; }
  .cms-sidebar { padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .cms-brand, .cms-sidebar > p { display: none; }
  .cms-sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .cms-nav { width: auto; padding: 8px 12px; }
  .cms-workspace { padding: 24px 16px 45px; }
  .cms-detail-hero { gap: 25px; }
}
@media (max-width: 620px) {
  .cms-heading { align-items: flex-start; }
  .cms-heading h1 { font-size: 27px; }
  .cms-heading > .cms-chip { display: none; }
  .cms-panel { padding: 20px 16px; }
  .cms-form-grid, .cms-meta-editor, .cms-detail-hero { grid-template-columns: 1fr; }
  .cms-meta { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 0; }
  .cms-gallery-track img { height: 230px; }
  .cms-savebar > span { flex-basis: 100%; }
  .cms-detail { width: calc(100% - 32px); }
  .cms-interactions { padding: 22px; }
}
