/* Đợt 15 Agent C — Kho phiếu */
#v-sheet-tpl .sl-head,
.sl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}
.sl-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
}
.sl-head p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 52ch;
}
.sl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sl-search {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 320px;
}
.sl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sl-chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.sl-chip:hover { background: var(--surface-hover); }
.sl-chip.on {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--text-strong);
}
.sl-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sl-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1200px) {
  .sl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .sl-grid { grid-template-columns: 1fr; }
  .sl-search { max-width: none; }
}

.sl-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.sl-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-pop, var(--shadow));
}
.sl-thumb {
  aspect-ratio: 210 / 297;
  width: 100%;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.sl-thumb-ph {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.sl-card-body {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
  min-width: 0;
}
.sl-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.sl-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-counts {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sl-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sl-badge.ok {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}
.sl-badge.warn {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, var(--surface));
}
.sl-badge.share {
  color: var(--accent-text);
  background: rgba(var(--accent-rgb), 0.1);
}
.sl-badge.priv {
  color: var(--text-muted);
  background: var(--surface-2);
}
.sl-meta {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-menu { position: relative; flex: none; }
.sl-more {
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  font-size: 18px;
  line-height: 1;
}
.sl-pop {
  position: fixed;
  z-index: var(--z-sticky, 40);
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg, var(--shadow));
  display: grid;
}
.sl-pop[hidden] { display: none; }
.sl-pop-item {
  text-align: left;
  border: 0;
  background: none;
  padding: 9px 12px;
  min-height: 40px;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  color: var(--text-strong);
  cursor: pointer;
}
.sl-pop-item:hover,
.sl-pop-item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.sl-pop-item.danger { color: var(--red); }
.sl-pop-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border-soft);
}

.sl-skel-card { pointer-events: none; }
.sl-skel-block,
.sl-skel-line {
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2));
  background-size: 200% 100%;
  animation: slShimmer 1.2s linear infinite;
}
.sl-skel-line {
  height: 14px;
  margin: 4px 16px;
}
.sl-skel-line.short { width: 40%; }
.sl-skel .sl-thumb { border: 0; }
@keyframes slShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sl-skel-block, .sl-skel-line, .sl-chip, .sl-card { animation: none; transition: none; }
}

.sl-empty { margin-top: 8px; }
.sl-err { margin-top: 8px; }

/* paper-setup: ảnh thu nhỏ + cảnh báo chưa chấm thử */
.ps-tpl-opt .ps-tpl-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}
.ps-tpl-opt .sl-badge {
  font-size: 11px;
  padding: 1px 7px;
}
.ps-tpl-untested {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--amber);
}
