body:has(.case-library) {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 14% 28%, #e3edfa 0, transparent 45%),
    radial-gradient(ellipse at 92% 44%, #ebe6f6 0, transparent 45%), #f5f6f8;
}
body:has(.case-library) #topbar {
  background: #ffffffb8;
  border-color: #ffffffc9;
  backdrop-filter: blur(18px);
}
.case-library {
  max-width: 1130px;
  padding-top: clamp(40px, 6vh, 84px);
}
.case-library .page-heading {
  align-items: center;
  margin: 0 0 28px;
}
.case-library h1 {
  font: 700 clamp(32px, 4vw, 48px) / 1.18 var(--sans);
  letter-spacing: -0.055em;
  color: #1c2029;
}
.case-library .page-heading .primary {
  background: linear-gradient(170deg, #515766, #2e3544);
  border: 1px solid #313644;
  border-radius: 99px;
  padding-inline: 18px;
  box-shadow:
    inset 0 1px #ffffff45,
    0 3px 7px #32395223;
}
.case-library .tools {
  padding: 0;
  margin: 0 0 23px;
  border: 0;
}
.case-library .tabs {
  border: 1px solid #ffffff95;
  border-radius: 99px;
  background: #d9deea8c;
  box-shadow: inset 0 1px 2px #3d4c6610;
}
.case-library .tab {
  border-radius: 99px;
}
.case-library .btn.tab[aria-pressed='true'] {
  color: #202431;
  box-shadow:
    0 1px 4px #4f566527,
    inset 0 1px #fff;
}
.case-library .search {
  border-radius: 99px;
  background: #ffffffb8;
  border-color: #dce0e8;
}
.case-library .case-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.case-library .empty {
  grid-column: 1/-1;
}
.case-tile {
  --hue: 212;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  padding: 7px;
  border: 1px solid #ffffffd9;
  background: linear-gradient(145deg, #ffffffed, #ffffffbd);
  box-shadow:
    inset 0 1px 1px #fff,
    0 2px 4px #2533580c,
    0 10px 24px -12px #34415f39,
    0 25px 48px -32px #25365857;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}
.case-tile.tint-1 {
  --hue: 265;
}
.case-tile.tint-2 {
  --hue: 23;
}
.tile-cover {
  position: relative;
  height: clamp(138px, 12vw, 175px);
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 38% 0, #fff9, transparent 64%),
    linear-gradient(126deg, hsl(var(--hue) 62% 91%), hsl(var(--hue) 63% 84%));
  box-shadow:
    inset 0 1px 2px #ffffffa8,
    inset 0 -1px 1px #34425a15;
}
.tile-cover .status {
  position: absolute;
  top: 12px;
  right: 12px;
  pointer-events: none;
  background: #fffffff0;
  border-color: #fff9;
  box-shadow: 0 1px 3px #26273b10;
}
.tile-cover .cover-link {
  display: grid;
  height: 100%;
  place-items: center;
}
.folder-art {
  position: relative;
  width: 116px;
  height: 85px;
  transform: rotate(-7deg);
}
.folder-art::before {
  content: '';
  position: absolute;
  inset: auto -8px -8px 8px;
  height: 14px;
  background: hsl(var(--hue) 50% 32% / 0.29);
  border-radius: 50%;
  filter: blur(8px);
}
.folder-back,
.folder-face,
.folder-sheet {
  position: absolute;
  display: block;
}
.folder-back {
  inset: 8px 0 3px;
  border-radius: 7px 11px 11px 11px;
  background: linear-gradient(120deg, hsl(var(--hue) 74% 70%), hsl(var(--hue) 65% 45%));
  box-shadow: inset 0 1px 1px #fff8;
}
.folder-back::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  width: 41%;
  height: 10px;
  background: hsl(var(--hue) 73% 70%);
  border-radius: 7px 8px 0 0;
}
.folder-sheet {
  inset: 10px 9px 12px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(180deg, transparent 0 5px, #2543681a 5px 6px) 10px 8px/48% 15px no-repeat,
    #fff;
  transform: rotate(5deg);
  box-shadow:
    0 -3px 0 -1px #ffffffa1,
    0 2px 6px #263d602b;
}
.folder-face {
  inset: 28px -3px 0 -2px;
  display: grid;
  place-items: center;
  border-radius: 7px 8px 12px 12px;
  transform: skewX(-5deg);
  color: hsl(var(--hue) 48% 36%);
  background: linear-gradient(150deg, hsl(var(--hue) 90% 88% / 0.94), hsl(var(--hue) 78% 67% / 0.96));
  border: 1px solid #ffffff85;
  box-shadow:
    inset 0 2px 1px #fffa,
    inset 0 -2px 2px #24385820,
    0 4px 7px #293c632a;
}
.folder-face svg {
  width: 17px;
  opacity: 0.7;
}
.tile-body {
  flex: 1;
  padding: 16px 15px 18px;
}
.tile-meta,
.tile-actions,
.tile-comments {
  display: flex;
  align-items: center;
}
.tile-meta {
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #586176;
}
.tile-meta span {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.tile-meta time {
  white-space: nowrap;
}
.tile-body h2 {
  margin: 6px 0;
  font: 650 clamp(19px, 1.65vw, 24px) / 1.35 var(--sans);
  letter-spacing: -0.035em;
}
.tile-summary {
  font-size: 13px;
  color: #616677;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.tile-actions {
  margin: 0 10px;
  padding: 10px 0 6px;
  border-top: 1px solid #dfe2eb;
  gap: 8px;
  flex-wrap: wrap;
}
.tile-actions .btn {
  border-radius: 99px;
  font-size: 12px;
  white-space: nowrap;
}
.tile-actions .secondary {
  margin-left: auto;
  background: #f5f5fa;
  border-color: #e1e3eb;
}
.tile-comments {
  gap: 5px;
  font-size: 12px;
  color: #62687a;
}
.tile-comments svg {
  width: 14px;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .case-tile:hover {
    transform: translateY(-4px);
    box-shadow:
      inset 0 1px #fff,
      0 4px 8px #25335810,
      0 17px 34px -12px #34415f42,
      0 32px 52px -30px #25365842;
  }
}
@media (max-width: 700px) {
  .case-library .case-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
  }
  .case-library .tools {
    margin-bottom: 16px;
  }
  .tile-cover {
    height: 130px;
  }
}
.library-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.library-actions .secondary {
  border-radius: 99px;
  background: #ffffffe0;
}
.template-library > iframe {
  display: block;
  width: 100%;
  height: 72vh;
  min-height: 420px;
  margin-top: 16px;
}
@media (max-width: 520px) {
  .case-library .page-heading,
  .template-library .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .library-actions .btn {
    min-height: 40px;
  }
}
.template-tools, .template-color, .template-color label {display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.template-tools {justify-content:space-between;gap:14px}
.template-color label {font-size:14px;font-weight:550;color:var(--muted);cursor:pointer}
.template-color input {padding:3px;width:42px;height:34px;cursor:pointer;border-radius:8px}
