/* Variant B: collection. Edit component rules here; do not append override patches. */
#app.workspace .history-empty { max-width: 600px; margin: 0 auto; padding:38px 24px; text-align:center; }
#app.workspace .history-empty .feature-icon { margin:0 auto 22px; }
#app.workspace .history-empty h2 { font-size:24px; margin:0 0 10px; }
#app.workspace .history-empty p { color:var(--ui-muted); margin:0 0 24px; }
#app.workspace .history-empty .btn { width:auto; max-width:100%; }
#app.workspace .history-guest-notice { display:flex; align-items:flex-start; gap:10px; }
#app.workspace .history-guest-notice .ui-icon { width:19px; height:19px; flex:0 0 19px; margin-top:2px; }
#app.workspace .history-guest-notice p { margin:4px 0 0; }
#app.workspace .history-resume { display:flex; align-items:center; gap:14px; margin-bottom:18px; padding:17.5px 18px; border:1px solid #e1d4b7; border-radius:13px; background:#fff5df; }
#app.workspace .history-resume>div { flex:1; }
#app.workspace .history-resume h2 { font-size:16px; margin:0; }
#app.workspace .history-resume p { font-size:13px; margin:8px 0 0; color:var(--ui-muted); }
#app.workspace .skeleton { height:20px; border-radius:6px; background:#e7e5da; margin:14px 0; }
#app.workspace .skeleton.short { width:45%; }
#app.workspace .skeleton.skeleton-action { height:48px; margin-top:28px; }
#app.workspace .history-hero {
  display: block;
  margin: 0 0 22px;
  padding: 0;
  background: none;
  border: 0;
  min-height: 0;
}

#app.workspace .history-hero::before { content: none; }

#app.workspace .history-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(112deg,#302722,#15334c);
  color: #fff9ed;
  box-shadow: none;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#app.workspace .history-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#ffffff05 1px,transparent 1px),linear-gradient(90deg,#ffffff05 1px,transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

#app.workspace .history-hero-card::after {
  content: none;
}

#app.workspace .history-card::before {
  content: none;
}

#app.workspace .history-hero .hero-copy {
  display: block;
  margin: 0;
  padding: 0;
  max-width: none;
  min-width: 0;
  position: relative;
}

#app.workspace .history-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

#app.workspace .history-hero h1 {
  color: #fff9ed;
  font-size: 1.75rem;
  font-weight: 750;
  min-width: min(100%, 7ch);
  overflow-wrap: anywhere;
}

#app.workspace .history-count {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: #ffffff0c;
  border: 1px solid #ffffff30;
  color: inherit;
  font-size: 14px;
  flex: none;
}

#app.workspace .history-hero p {
  font-size: 14px;
  color: #fff9ed;
  margin: 8px 0 0;
}

#app.workspace .history-refresh {
  color: #fff9ed;
  background: #ffffff05;
  border-color: #ffffff30;
  box-shadow: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 10px;
  flex: none;
  position: relative;
}

#app.workspace .history-refresh svg {
  width: 21px;
  height: 21px;
}

#app.workspace .history-refresh span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

#app.workspace .history-shell {
  display: block;
}

#app.workspace .history-shell>.builder-flow {
  display: block;
}

#app.workspace .history-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#app.workspace #history-refresh-status:empty {
  display: none;
}

#app.workspace #history-refresh-status { margin-top: 14px; text-align: center; color: var(--ui-muted); font-size: 14px; }

#app.workspace .history-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 18px;
}

#app.workspace .history-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  background: var(--ui-paper);
  box-shadow: var(--ui-shadow);
  min-width: 0;
  scroll-margin-top: 24px;
  transition: box-shadow .2s,border-color .2s;
}

#app.workspace .history-entry::before {
  content: none;
}

#app.workspace .history-entry::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid color-mix(in srgb, var(--ui-blue) 44%, var(--ui-line));
  border-radius: inherit;
  box-shadow: 0 5px 16px color-mix(in srgb, var(--ui-blue) 9%, transparent);
  pointer-events: none;
  opacity: 0;
}

#app.workspace .history-entry:focus-within::after { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  #app.workspace .history-entry:hover::after { opacity: 1; }
}
#app.workspace .history-entry[data-status="expired"] { background: #f6f2e9; }
#app.workspace .history-entry[data-status="expired"] h3 { color: #526071; }

#app.workspace .history-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

#app.workspace .history-status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 650;
  color: #277b55;
  background: #eaf2e7;
  border-radius: 7px;
  padding: 5px 9px;
}

#app.workspace .history-status .ui-icon {
  width: 14px;
  height: 14px;
}

#app.workspace .history-status.info {
  color: #285e7a;
  background: #e8eff3;
}

#app.workspace .history-status.muted {
  color: #5b6268;
  background: #eae7df;
}

#app.workspace .history-entry__type {
  font-size: 13px;
  color: var(--ui-muted);
}

#app.workspace .history-entry h3 {
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -.4px;
  margin: 0 0 7px;
  overflow-wrap: anywhere;
}

#app.workspace .history-detail-link { display: block; min-height: 44px; color: inherit; font: inherit; text-decoration: none; border-radius: 4px; }
#app.workspace .history-detail-link:hover { text-decoration: underline; text-underline-offset: .18em; }

#app.workspace .history-entry__description { margin: 9px 0 14px; color: var(--ui-muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

#app.workspace .history-entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: none;
  padding: 0;
  border: 0;
  margin: 0 0 19px;
  font-size: 13px;
  color: var(--ui-ink);
}

#app.workspace .history-entry__meta>span {
  padding: 6px 10px;
  background: #f5f1e8;
  border: 1px solid #ded8cc;
  border-radius: 7px;
}

#app.workspace .history-entry__validity {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ui-muted);
  margin: 0 0 20px;
}

#app.workspace .history-entry__validity .ui-icon {
  width: 16px;
  height: 16px;
}

#app.workspace .history-entry__progress { height: 7px; margin: 2px 0 42px; overflow: hidden; border-radius: 7px; background: var(--ui-line); }
#app.workspace .history-entry__progress span { display: block; width: 63%; height: 100%; border-radius: inherit; background: #398761; animation: history-progress 2s ease-in-out infinite alternate; }
@keyframes history-progress { from { transform: translateX(0); } to { transform: translateX(59%); } }
@media (prefers-reduced-motion:reduce) { #app.workspace .history-entry__progress span { animation: none; } }

#app.workspace .history-entry__side {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-top: auto;
}

#app.workspace .history-entry__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#app.workspace .history-entry__actions>.btn {
  flex: auto;
  width: 100%;
  max-width: none;
  font-size: 15px;
  min-height: 48px;
  padding: 11px 16px;
}

#app.workspace .history-entry__actions>.btn.primary { align-self: flex-start; }

#app.workspace .history-action-teacher {
  order: -1;
}

#app.workspace .history-entry__actions>.history-action-reuse {
  margin-top: -10px;
  border: 0;
  background: none;
  color: var(--ui-blue);
  box-shadow: none;
  font-weight: 400;
  font-size: 14px;
  text-decoration: underline;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 0;
}

#app.workspace .history-action-remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #52677a;
  cursor: pointer;
}

#app.workspace .history-reuse-reason {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ui-muted);
  margin: 14px 0 0;
}

#app.workspace .history-tools {
  margin-top: 22px;
}

#app.workspace .history-active-card {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #e7c79d;
  background: #fff4e1;
  box-shadow: none;
}

#app.workspace .collection-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 22px;
}

#app.workspace .collection-create { min-width: 170px; }

#app.workspace .collection-filters {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--ui-line);
}

#app.workspace .collection-filters button {
  position: relative;
  flex: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  padding: 10px 0 12px;
  min-height: 46px;
  font: 650 14px/1.4 "Segoe UI",sans-serif;
  color: var(--ui-muted);
  cursor: pointer;
}

#app.workspace .collection-filters button[aria-pressed=true] {
  color: var(--ui-ink);
}

#app.workspace .collection-marker {
  position: absolute;
  inset-inline: 0;
  bottom: -3px;
  height: 3px;
  border-radius: 3px;
  background: var(--ui-orange);
  transform-origin: left center;
  pointer-events: none;
}

@media (forced-colors: active) {
  #app.workspace .collection-marker { background: Highlight; forced-color-adjust: none; }
}

@media (prefers-reduced-motion: no-preference) {
  #app.workspace .history-entry::after { transition: opacity 380ms cubic-bezier(.25,.46,.25,1); }
  #app.workspace .history-refresh[aria-busy="true"] svg { animation: collection-refresh 1.1s 160ms linear infinite; }
  @keyframes collection-refresh { to { transform: rotate(1turn); } }
}

#app.workspace .collection-empty {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--ui-line);
  border-radius: 16px;
  color: var(--ui-muted);
}

@media (max-width:1000px) {
  #app.workspace .history-list {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (min-width:801px) { #app.workspace .history-entry__validity { margin-bottom: 16px; } }

@supports (grid-template-rows: subgrid) {
  @media (min-width:801px) {
    #app.workspace .history-entry:not([hidden]) {
      display: grid;
      grid-row: span 2;
      grid-template-rows: subgrid;
    }

    #app.workspace .history-entry__side { margin-top: 0; }
  }
}

@media (max-width:800px) {
  #app.workspace .history-hero { margin-bottom: 18px; }
  #app.workspace .history-resume { flex-wrap:wrap; align-items:flex-start; gap:10px; padding:14px; }
  #app.workspace .history-resume>div { flex:1 1 70%; }
  #app.workspace .history-resume>.btn { flex:1; margin-left:31px; min-height:44px; }
  #app.workspace .history-list {
    grid-template-columns: minmax(0,1fr);
    gap: 16px;
  }

  #app.workspace .history-entry {
    padding: 20px;
  }

  #app.workspace .history-hero-card {
    padding: 18px 19px 20px;
  }

  #app.workspace .history-hero h1 {
    font-size: 1.625rem;
  }

  #app.workspace .history-hero p {
    font-size: 13px;
  }

  #app.workspace .collection-filters {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.35fr 1fr;
    gap: 4px;
    padding-inline: clamp(10px, 3vw, 18px);
  }

  #app.workspace .collection-filters button {
    min-width: 0;
    white-space: normal;
  }

  #app.workspace .collection-create { display: none; }
  #app.workspace .collection-tools { margin-bottom: 18px; }
}

@media (max-width:360px) {
  #app.workspace .history-hero-card { padding: 16px 12px; gap: 8px; }
  #app.workspace .history-heading { gap: 6px; }
  #app.workspace .history-hero h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion:reduce) {
  #app.workspace .history-entry {
    transition: none;
  }
}
