/* ==========================================================
 * Templates page — Smartico email templates review
 * Aligned with the Propuestas page design system (clean, editorial,
 * hairline-based, mono type for metadata, pink accent only for
 * trazos/hover states). See public/js/pages/propuestas.js for ref.
 * ======================================================= */

/* ===== HERO (editorial, no heavy gradients) ===== */
.tpl-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 22px;
  padding: 22px 26px;
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}
.tpl-hero::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(234,143,215,0.5), transparent);
}
.tpl-hero__eyebrow {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 8px;
}
.tpl-hero__title {
  font-family: 'Geist', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--t1);
  margin-bottom: 6px;
}
.tpl-hero__sub {
  font-size: 12px;
  color: var(--t3);
  max-width: 520px;
  line-height: 1.55;
}
.tpl-hero__stats {
  display: flex;
  gap: 12px;
}
.tpl-stat-box {
  background: var(--bg);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 14px 20px;
  min-width: 80px;
  text-align: center;
}
.tpl-stat-box__num {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--t1);
  letter-spacing: -0.02em;
}
.tpl-stat-box__lbl {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t3);
  margin-top: 2px;
}

/* ===== SECTION TABS (Smartico / Standards) ===== */
.tpl-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 4px;
  width: fit-content;
}
.tpl-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 10px 16px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  cursor: pointer;
  border-radius: 0;
  transition: color .15s ease, border-color .15s ease;
}
.tpl-tab:hover { color: var(--t1); }
.tpl-tab.on {
  background: transparent;
  color: var(--color-brand);
  border-bottom-color: var(--color-brand);
}
.tpl-tab__count {
  display: inline-block;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  padding: 2px 7px;
  border-radius: 0;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-left: 4px;
  color: var(--t3);
}
.tpl-tab.on .tpl-tab__count {
  color: var(--color-brand);
  border-color: rgba(234,143,215,.35);
}
.tpl-tab.on .tpl-tab__count {
  background: rgba(0,0,0,0.18);
  color: #1a1a1a;
}

/* ===== TOOLBAR ===== */
.tpl-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tpl-search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 10px 14px;
  color: var(--t3);
  transition: border-color .15s;
}
.tpl-search:focus-within {
  border-color: var(--color-brand);
}
.tpl-search input {
  flex: 1;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--t1);
  outline: none;
}
.tpl-search input::placeholder { color: var(--t3); }

.tpl-chips { display: flex; gap: 6px; }
.tpl-chip {
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 6px 12px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.tpl-chip:hover { border-color: var(--hair-strong); color: var(--ink); }
.tpl-chip.on {
  background: rgba(234,143,215,.08);
  color: var(--color-brand);
  border-color: rgba(234,143,215,.45);
}

.tpl-sort, .tpl-view { display: flex; align-items: center; gap: 8px; }
.tpl-sort label, .tpl-view label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t3);
}
.tpl-sort select {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 8px 12px;
  color: var(--t1);
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.tpl-view__toggle {
  display: flex;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 0;
  overflow: hidden;
}
.tpl-view__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 7px 12px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.tpl-view__btn + .tpl-view__btn { border-left: 1px solid var(--hair); }
.tpl-view__btn:hover { color: var(--ink); background: rgba(255,255,255,.02); }
.tpl-view__btn.on {
  background: rgba(234,143,215,.08);
  color: var(--color-brand);
}

/* ===== COUNTS / BULK ===== */
.tpl-counts {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  margin-bottom: 18px;
}
.tpl-counts__stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-right: 16px;
  border-right: 1px solid var(--b1);
}
.tpl-counts__stat:last-of-type { border-right: 0; }
.tpl-counts__stat span {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--t1);
}
.tpl-counts__stat small {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t3);
}
.tpl-counts__stat--gold span { color: var(--color-brand); }
.tpl-counts__bulk {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.tpl-counts__bulk button {
  background: transparent;
  border: 1px solid var(--hair-strong);
  border-radius: 0;
  padding: 8px 14px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.tpl-counts__bulk button:hover { background: rgba(234,143,215,0.05); color: var(--color-brand); border-color: var(--color-brand); }

/* ===== GRID ===== */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  padding-bottom: 140px;
}

.tpl-card {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  position: relative;
  transition: border-color .15s ease;
}
.tpl-card:hover { border-color: rgba(234,143,215,0.32); }
.tpl-card.is-selected {
  border: 1px solid var(--color-brand);
  background: rgba(234,143,215,0.03);
}
.tpl-card.is-selected::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--color-brand);
}

.tpl-card__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.tpl-card__checkwrap {
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  padding-top: 2px;
}
.tpl-card__checkwrap input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card__checkbox {
  display: block;
  width: 18px; height: 18px;
  border: 1.5px solid var(--b2);
  border-radius: 5px;
  background: var(--bg);
  transition: all .15s;
}
.tpl-card__checkwrap:hover .tpl-card__checkbox { border-color: var(--color-brand); }
.tpl-card__checkwrap input:checked + .tpl-card__checkbox {
  background: var(--color-brand);
  border-color: var(--color-brand);
}
.tpl-card__checkwrap input:checked + .tpl-card__checkbox::after {
  content: '✓';
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 15px;
}

.tpl-card__title { flex: 1; min-width: 0; }
.tpl-card__id {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  font-weight: 600;
}
.tpl-card__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.35;
  word-break: break-word;
}

.tpl-pill {
  flex-shrink: 0;
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
}
.tpl-pill--active { background: var(--gbg); color: var(--green); }
.tpl-pill--draft  { background: rgba(234,143,215,0.12); color: var(--color-brand); }
.tpl-pill--other  { background: rgba(255,255,255,0.04); color: var(--t3); }
.tpl-card__selectedby {
  font-size: 11px;
  color: #FFC808;
  background: rgba(255,200,8,0.08);
  border: 1px solid rgba(255,200,8,0.18);
  border-radius: 8px;
  padding: 6px 12px;
  margin-top: 6px;
}
.tpl-card__selectedby strong { color: #ffe56b; }

.tpl-card__subject {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.5;
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--hair);
  border-radius: 0;
  min-height: 42px;
}

.tpl-card__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tpl-metric {
  background: var(--bg);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 8px 6px;
  text-align: center;
}
.tpl-metric__num {
  display: block;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--t1);
  letter-spacing: -0.02em;
}
.tpl-metric__lbl {
  display: block;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--t3);
  margin-top: 2px;
}

.tpl-card__date {
  font-size: 10px;
  color: var(--t3);
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.tpl-card__foot {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
}

/* Buttons — outline-first system. Primary = outline with pink stroke
   (client: "trazo en rosa, no fondo rosa"). Ghost = neutral hairline.
   Used for Preview, Open in Smartico, Download HTML, Download MJML. */
.tpl-btn {
  flex: 1;
  text-align: center;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 10px;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
  border: 1px solid var(--hair-strong);
  background: transparent;
  color: var(--t1);
}
.tpl-btn--primary {
  background: transparent;
  color: var(--color-brand);
  border-color: var(--color-brand);
  font-weight: 600;
}
.tpl-btn--primary:hover {
  background: rgba(234,143,215,0.10);
  color: var(--color-brand);
  border-color: var(--color-brand);
}
.tpl-btn--ghost {
  background: transparent;
  color: var(--t3);
  border-color: var(--hair-strong);
}
.tpl-btn--ghost:hover {
  color: var(--color-brand);
  border-color: var(--color-brand);
  background: rgba(234,143,215,0.05);
}
.tpl-btn--gold {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
  padding: 12px 26px;
  font-size: 11px;
  border-radius: 0;
  box-shadow: none;
  letter-spacing: 0.18em;
}
.tpl-btn--gold:hover:not(:disabled) {
  background: rgba(234,143,215,0.08);
  box-shadow: none;
  transform: none;
}
.tpl-btn:disabled {
  background: transparent;
  color: var(--t4);
  border-color: var(--hair);
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== LIST VIEW ===== */
.tpl-grid--list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tpl-grid--list .tpl-card {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 58px;
}
.tpl-grid--list .tpl-card__head {
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}
.tpl-grid--list .tpl-card__title { flex: 1 1 auto; min-width: 0; }
.tpl-grid--list .tpl-card__name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-grid--list .tpl-card__subject {
  flex: 2 1 260px;
  padding: 6px 10px;
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-grid--list .tpl-card__meta {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  grid-template-columns: none;
}
.tpl-grid--list .tpl-metric {
  padding: 5px 8px;
  min-width: 44px;
}
.tpl-grid--list .tpl-metric__num { font-size: 11px; }
.tpl-grid--list .tpl-metric__lbl { font-size: 7px; }
.tpl-grid--list .tpl-card__date {
  flex: 0 0 auto;
  white-space: nowrap;
}
.tpl-grid--list .tpl-card__foot {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.tpl-grid--list .tpl-btn { padding: 8px 14px; font-size: 8px; }
.tpl-grid--list .tpl-card.is-selected::before { display: none; }

@media (max-width: 1280px) { .tpl-grid--list .tpl-card__subject { display: none; } }
@media (max-width: 1040px) { .tpl-grid--list .tpl-card__meta   { display: none; } }
@media (max-width: 900px)  { .tpl-grid--list .tpl-card__date   { display: none; } }

/* ===== EMPTY ===== */
.tpl-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--t3);
  font-size: 13px;
}

/* ===== MODAL ===== */
.tpl-modal { position: fixed; inset: 0; z-index: 1000; }
.tpl-modal[hidden] { display: none; }
.tpl-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(2,6,23,0.88);
  backdrop-filter: blur(6px);
}
.tpl-modal__panel {
  position: absolute;
  top: 4%; left: 50%; transform: translateX(-50%);
  width: min(1120px, 92vw);
  height: 92vh;
  background: var(--s1);
  border: 1px solid var(--b2);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.tpl-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--b1);
}
.tpl-modal__meta h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 4px;
  word-break: break-word;
}
.tpl-modal__meta p {
  font-size: 11px;
  color: var(--t3);
  line-height: 1.5;
}
.tpl-modal__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tpl-modal__actions a {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t1);
  border: 1px solid var(--color-brand);
  border-radius: 0;
  padding: 9px 14px;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  transition: background .15s ease, color .15s ease;
}
.tpl-modal__actions a:hover { background: rgba(234,143,215,0.08); color: var(--color-brand); }
.tpl-modal__actions button {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--b2);
  font-size: 20px;
  line-height: 1;
  color: var(--t3);
  cursor: pointer;
}
.tpl-modal__actions button:hover { color: var(--t1); border-color: var(--color-brand); }
.tpl-modal__body {
  flex: 1;
  overflow: hidden;
  background: #f4f4f4;
}
.tpl-modal__body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* ===== STANDARDS GRID + CARDS ===== */
.tpl-grid--standards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
  padding-bottom: 80px;
}
.tpl-std-card {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s ease;
}
.tpl-std-card:hover { border-color: rgba(234,143,215,0.32); }

/* Align actions row across cards regardless of description length.
   Without this, .tpl-std-info collapsed to its content and the Download
   buttons floated up/down depending on description height. Now the info
   block fills available card height and `margin-top: auto` on actions
   pins them to the bottom. */
.tpl-std-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.tpl-std-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tpl-std-version {
  display: inline-block;
  background: transparent;
  color: var(--color-brand);
  border: 1px solid rgba(234,143,215,0.4);
  padding: 4px 9px;
  border-radius: 0;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.tpl-std-title {
  flex: 1;
  font-family: 'Geist', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--t1);
  letter-spacing: -0.2px;
  min-width: 0;
}
.tpl-std-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 12px;
}
.tpl-std-badge--new     { background: rgba(234,143,215,0.14); color: #ea8fd7; border: 1px solid rgba(234,143,215,0.3); }
.tpl-std-badge--hot     { background: rgba(255,58,58,0.14);   color: #ff6b6b; border: 1px solid rgba(255,58,58,0.3); }
.tpl-std-badge--vip     { background: rgba(255,200,8,0.14);   color: #FFC808; border: 1px solid rgba(255,200,8,0.3); }
.tpl-std-badge--neutral { background: rgba(138,172,204,0.14); color: #8AACCC; border: 1px solid rgba(138,172,204,0.3); }

.tpl-std-desc {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.55;
}

.tpl-std-features {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tpl-std-chip {
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: transparent;
  border: 1px solid var(--hair);
  color: var(--t3);
  padding: 4px 9px;
  border-radius: 0;
}

/* GRID view: medium preview at top of card, scaled down so the whole
   header + hero of the email is visible. Hover for full size at the side.
   The preview goes ABOVE the info block so download buttons sit underneath. */
.tpl-grid--standards:not(.tpl-grid--standards-list) .tpl-std-preview { order: -1; }
.tpl-std-preview {
  position: relative;
  width: 100%;
  height: 260px;
  max-height: 260px;
  border: 1px solid var(--hair);
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.tpl-std-preview iframe {
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  pointer-events: none;
  background: #fff;
  display: block;
}
.tpl-std-preview__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,0.0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all .2s;
}
.tpl-std-preview__overlay span {
  background: transparent;
  color: #fff;
  padding: 10px 20px;
  border: 1px solid var(--color-brand);
  border-radius: 0;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.tpl-std-preview:hover .tpl-std-preview__overlay {
  background: rgba(2,6,23,0.55);
  opacity: 1;
}

.tpl-std-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.tpl-std-actions .tpl-btn { flex: 1; padding: 11px 12px; font-size: 10px; }

/* Standards LIST view — compact horizontal row with a thumbnail preview.
   Hover the thumbnail to see the full email floating to the side. */
.tpl-grid--standards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tpl-grid--standards-list .tpl-std-card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  min-height: 88px;
}
.tpl-grid--standards-list .tpl-std-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.tpl-grid--standards-list .tpl-std-head {
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: nowrap;
}
.tpl-grid--standards-list .tpl-std-title {
  font-size: 13px;
  white-space: nowrap;
}
.tpl-grid--standards-list .tpl-std-desc {
  flex: 1 1 auto;
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tpl-grid--standards-list .tpl-std-features { display: none; }
.tpl-grid--standards-list .tpl-std-actions {
  flex: 0 0 auto;
  margin-top: 0;
  flex-direction: row;
  gap: 6px;
}
.tpl-grid--standards-list .tpl-std-actions .tpl-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 9px;
}
/* Tiny thumbnail (110x64) on the LEFT — same scale trick as v1 */
.tpl-grid--standards-list .tpl-std-preview {
  flex: 0 0 110px;
  width: 110px;
  height: 64px;
  border-radius: 8px;
  order: -1; /* before .tpl-std-info */
}
.tpl-grid--standards-list .tpl-std-preview iframe {
  width: 555%;
  height: 555%;
  transform: scale(0.18);
  transform-origin: top left;
}

@media (max-width: 1280px) {
  .tpl-grid--standards-list .tpl-std-desc { display: none; }
}
@media (max-width: 900px) {
  .tpl-grid--standards-list .tpl-std-title { display: none; }
}

/* ===== HOVER PREVIEW (quick look) ===== */
.tpl-hover-preview {
  position: fixed;
  z-index: 900;
  width: 340px;
  height: 440px;
  background: var(--s1);
  border: 1px solid var(--color-brand);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(234,143,215,0.18);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: top left;
  transition: opacity .18s ease, transform .18s ease;
  display: flex;
  flex-direction: column;
}
.tpl-hover-preview.on {
  opacity: 1;
  transform: scale(1);
}
.tpl-hover-preview__title {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--t1);
  background: var(--s2);
  border-bottom: 1px solid var(--b1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.tpl-hover-preview__frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.tpl-hover-preview__hint {
  padding: 6px 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-brand);
  background: var(--s2);
  border-top: 1px solid var(--b1);
  text-align: center;
  flex-shrink: 0;
}

/* ===== STICKY FOOTER ===== */
.tpl-footer {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: var(--s1);
  border-top: 1px solid var(--b2);
  padding: 14px 28px;
  z-index: 500;
  transform: translateY(110%);
  transition: transform .25s ease;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.35);
}
.tpl-footer.on { transform: translateY(0); }
.tpl-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.tpl-footer__text {
  font-size: 12px;
  color: var(--t3);
}
.tpl-footer__text strong {
  font-size: 18px;
  color: var(--color-brand);
  font-weight: 800;
  margin-right: 4px;
}

/* ===== EDITORIAL FLAT TABLE (replaces card grid) ===== */
.tpl-table-wrap {
  width: 100%;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.012);
}
.tpl-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 12px;
}
.tpl-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--t4);
  font-weight: 600;
  border-bottom: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
.tpl-table .tpl-th-check,
.tpl-table .tpl-td-check { width: 34px; text-align: center; padding: 12px 10px; }
.tpl-table .tpl-th-id,
.tpl-table .tpl-td-id { width: 64px; color: var(--t4); font-weight: 500; }
.tpl-table .tpl-th-status,
.tpl-table .tpl-td-status { width: 110px; }
.tpl-table .tpl-th-metric,
.tpl-table .tpl-td-metric { width: 80px; text-align: right; color: var(--t3); }
.tpl-table .tpl-th-date,
.tpl-table .tpl-td-date { width: 130px; color: var(--t4); font-size: 10px; letter-spacing: 0.08em; }
.tpl-table .tpl-th-actions,
.tpl-table .tpl-td-actions { width: 220px; text-align: right; }

.tpl-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--hair);
  vertical-align: middle;
}
.tpl-table .tpl-row {
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: default;
}
.tpl-table .tpl-row:hover td {
  background: rgba(234, 143, 215, 0.04);
}
.tpl-table .tpl-row.is-selected td {
  background: rgba(234, 143, 215, 0.07);
  border-left: 2px solid var(--color-brand);
}
.tpl-table .tpl-row.is-selected .tpl-td-check { padding-left: 8px; }

.tpl-td-name {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl-td-subject {
  color: var(--t3);
  font-size: 11px;
  letter-spacing: 0.02em;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl-selby {
  margin-left: 8px;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--color-brand);
  font-weight: 400;
  letter-spacing: 0.1em;
}

.tpl-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--t4);
}
.tpl-status-dot.active { background: #4CD17A; box-shadow: 0 0 6px rgba(76, 209, 122, 0.6); }
.tpl-status-dot.draft  { background: var(--color-brand); }
.tpl-status-dot.other  { background: var(--t4); }

/* Row actions — hairline + nearly invisible until hovered. The row-hover
   floating iframe is the primary preview affordance; these buttons are a
   quiet secondary fallback. No pink outlines, no fills. */
.tpl-row-action {
  display: inline-block;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--t4);
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-left: 4px;
}
.tpl-row-action:hover {
  color: var(--t1);
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
}
.tpl-row-action.ghost {
  color: var(--t4);
  border-color: rgba(255, 255, 255, 0.05);
}
.tpl-row-action.ghost:hover {
  color: var(--t1);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Category group rows — editorial section dividers between row blocks. */
.tpl-group-row td {
  padding: 22px 14px 10px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: transparent;
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-brand);
  font-weight: 600;
}
.tpl-group-row:first-child td {
  border-top: 0;
  padding-top: 16px;
}
.tpl-group-row .tpl-group-count {
  color: var(--t4);
  margin-left: 10px;
  letter-spacing: 0.16em;
  font-weight: 400;
}

.tpl-row-check,
.tpl-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-brand);
  cursor: pointer;
}

/* Empty state */
.tpl-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--t3);
  font-family: 'Noto Sans Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Mobile: hide secondary columns */
@media (max-width: 900px) {
  .tpl-table .tpl-th-subject,
  .tpl-table .tpl-td-subject,
  .tpl-table .tpl-th-metric,
  .tpl-table .tpl-td-metric,
  .tpl-table .tpl-th-date,
  .tpl-table .tpl-td-date { display: none; }
  .tpl-table .tpl-th-actions,
  .tpl-table .tpl-td-actions { width: 110px; }
  .tpl-row-action { padding: 5px 8px; font-size: 9px; }
}
@media (max-width: 560px) {
  .tpl-table .tpl-th-id,
  .tpl-table .tpl-td-id,
  .tpl-table .tpl-th-status,
  .tpl-table .tpl-td-status { display: none; }
  .tpl-td-name { max-width: 200px; }
  .tpl-row-action.ghost { display: none; }
}
