/* Trang «In đề · Có phiếu trả lời riêng» — chỉ biến màu app.css */
body:has(#v-paper-setup:not([hidden])) .page-head { display: none; }
@media (max-width: 767px) {
  body:has(#v-paper-setup:not([hidden])) .bottom-nav { display: none; }
  body:has(#v-paper-setup:not([hidden])) #app-view .page { padding-bottom: 0; }
  body:has(#v-paper-setup:not([hidden])) .ps-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

.ps-page {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
  box-sizing: border-box;
  width: 100%;
}
.ps-head { display: grid; gap: 4px; min-width: 0; }
.ps-head .asg-crumb-link { justify-self: start; }
.ps-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ps-meta { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.ps-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
  min-width: 0;
}
.ps-card-h {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
}
.ps-codes-preview {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
.ps-err {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}
.ps-hint-one {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.ps-codes-ta {
  min-height: 72px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

/* Chọn mẫu: hai cột ≥1024 */
.ps-tpl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}
@media (max-width: 1023px) {
  .ps-tpl-grid { grid-template-columns: 1fr; }
  .ps-card { padding: 16px; }
}
@media (max-width: 767px) {
  #v-paper-setup .asn-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #v-paper-setup .asn-card > .switch-row.compact {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .ps-title { font-size: 18px; }
}
.ps-tpl-list { display: grid; gap: 4px; min-width: 0; }
.ps-tpl-group-h {
  margin: 12px 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ps-tpl-group-h:first-child { margin-top: 0; }
.ps-tpl-empty {
  margin: 4px 0 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ps-tpl-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 140ms, background 140ms;
}
.ps-tpl-opt:hover { background: var(--surface-hover); }
.ps-tpl-opt:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ps-tpl-opt.on {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.ps-tpl-opt.locked {
  opacity: .72;
  cursor: not-allowed;
  background: var(--surface);
}
.ps-tpl-opt input { margin-top: 3px; flex: none; }
.ps-tpl-opt-body { min-width: 0; flex: 1; display: grid; gap: 2px; }
.ps-tpl-opt-body b {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-tpl-opt-body .ps-tpl-why {
  font-size: 12px;
  color: var(--red);
  line-height: 1.35;
}
.ps-tpl-opt-body .ps-tpl-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}
.ps-tpl-badge {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 6px;
  padding: 2px 6px;
  align-self: center;
}

.ps-tpl-preview-col { display: grid; gap: 10px; min-width: 0; }
.ps-tpl-preview-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ps-tpl-preview-frame {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 210 / 297;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
}
.ps-tpl-preview-frame svg,
.ps-tpl-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ps-tpl-preview-cap {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.ps-foot {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px 0 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}
.ps-sum {
  margin: 0;
  flex: 1 1 200px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ps-foot-btns { display: flex; gap: 8px; flex: none; }
@media (max-width: 767px) {
  .ps-foot-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .ps-foot-btns .btn-primary,
  .ps-foot-btns .btn-ghost { width: 100%; min-height: 44px; }
}

.ps-done-card { text-align: center; gap: 12px; }
.ps-done-card h2 { margin: 0; font-size: 20px; color: var(--text-strong); }
.ps-done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.ps-done-actions .btn-primary,
.ps-done-actions .btn-ghost { min-height: 44px; }

.ps-skel { display: grid; gap: 16px; }
.ps-skel .skel-line {
  height: 14px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--border) 55%, var(--surface));
}
.ps-skel .skel-block {
  height: 160px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--border) 40%, var(--surface));
}

@media (prefers-reduced-motion: reduce) {
  .ps-tpl-opt { transition: none; }
}
.ps-switch { display: inline-block; vertical-align: middle; }
@media (max-width: 767px) {
  /* Công tắc nằm bên phải chữ, không rơi xuống dòng riêng */
  #v-paper-setup .asn-row:has(.ps-switch) { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
}
