:root {
  --brand: #005bab;
  --brand-dark: #004a8c;
  --brand-darker: #003a6e;
  --brand-light: #1a7ad4;
  --brand-lighter: #e8f2fc;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-soft: #555a6e;
  --muted: #8a8fa0;
  --border: #e5e9f0;
  --success: #1f9d55;
  --success-bg: #e6f6ec;
  --danger: #d23b3b;
  --danger-bg: #fbeaea;
  --warning: #b8860b;
  --warning-bg: #fdf6e3;
  --info-bg: #e8f2fc;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }

/* ---- layout ---- */
.app-shell { display: flex; min-height: 100vh; flex-direction: column; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.main { flex: 1; padding: 1.75rem 0 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .95rem; }

/* ---- navbar ---- */
.navbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.navbar .container { display: flex; align-items: center; gap: .5rem; height: 60px; }
.navbar .brand { color: #fff; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.navbar .brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav-item { position: relative; }
.nav-link { color: #eaf3fb; padding: .5rem .8rem; border-radius: var(--radius-sm); display: inline-block; font-size: .92rem; font-weight: 500; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
/* Open on hover only on desktop; on touch/mobile the JS accordion controls it. */
@media (min-width: 861px) {
  .dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu { display: block; }
}
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%; background: #fff; color: var(--text);
  min-width: 210px; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; border: 1px solid var(--border);
}
.dropdown-menu a { display: block; padding: .55rem .75rem; border-radius: var(--radius-sm); color: var(--text-soft); font-size: .9rem; }
.dropdown-menu a:hover { background: var(--brand-lighter); color: var(--brand-dark); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; margin-left: auto; padding: .25rem .5rem; }
/* Off-canvas sidebar chrome (desktop: hidden) */
.sidebar-head { display: none; }
/* Below the navbar's stacking context (.navbar z-index:50) so the sidebar,
   which lives inside .navbar, stays tappable above the scrim. */
.nav-backdrop { position: fixed; inset: 0; background: rgba(10,18,35,.5); z-index: 40; opacity: 0; visibility: hidden; transition: opacity .28s ease; }
.nav-close { background: none; border: 0; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; padding: .1rem .4rem; }

/* ---- cards ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.25rem 1.4rem; }
.card + .card { margin-top: 1.25rem; }
.card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.split { display: grid; gap: 1.25rem; grid-template-columns: 340px 1fr; align-items: start; }

/* ---- stat tiles ---- */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 1.9rem; font-weight: 700; color: var(--brand-dark); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-top: .25rem; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: .9rem; cursor: pointer; transition: all .15s ease; background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.4rem; font-size: 1rem; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-lighter); color: var(--brand-dark); }
.btn-ghost { background: var(--brand-lighter); color: var(--brand-dark); }
.btn-ghost:hover { background: #d6e8fa; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b22c2c; }
.btn-muted { background: #eef1f6; color: var(--text-soft); }
.btn-muted:hover { background: #e3e7ee; }
.btn-block { width: 100%; }

/* ---- forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--text-soft); }
.input, .select, .textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; color: var(--text); background: #fff;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(26,122,212,.15); }
.textarea { min-height: 120px; resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.checkline { display: flex; align-items: center; gap: .5rem; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
/* Keep big list tables tabular on mobile — scroll horizontally instead of
   squishing. Selection tables (.scroll-list) stay fluid so the build/generate
   pages are naturally responsive. */
.table-wrap:not(.scroll-list) table.data { min-width: 720px; }
table.data { width: 100%; border-collapse: collapse; background: #fff; }
table.data th, table.data td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: top; }
table.data th { background: var(--brand); color: #fff; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; position: sticky; top: 0; }
table.data tbody tr:hover { background: var(--brand-lighter); }
table.data tr:last-child td { border-bottom: 0; }

/* ---- badges ---- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; text-transform: capitalize; }
.badge.pending { background: var(--info-bg); color: var(--brand-dark); }
.badge.queued { background: #eceafe; color: #5b4bd6; }
.badge.running, .badge.processing { background: var(--warning-bg); color: var(--warning); }
.badge.completed { background: var(--success-bg); color: var(--success); }
.badge.failed { background: var(--danger-bg); color: var(--danger); }
.badge.cancelled { background: #eef1f6; color: var(--text-soft); }

/* ---- progress ---- */
.progress { background: #e9edf4; border-radius: 999px; height: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-light), var(--brand)); transition: width .4s ease; }

/* ---- alerts ---- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-size: .92rem; border: 1px solid transparent; }
.alert.success { background: var(--success-bg); color: #166534; border-color: #bfe8cd; }
.alert.error { background: var(--danger-bg); color: #991b1b; border-color: #f3c9c9; }
.alert.info { background: var(--info-bg); color: var(--brand-darker); border-color: #cfe4fa; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* ---- media cards ---- */
.video-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.video-card video { width: 100%; height: 260px; background: #000; object-fit: contain; display: block; }
/* Denser grid for video galleries — compact thumbnails to preview & select */
.video-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.video-card .vc-body { padding: .85rem 1rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.video-card .vc-title { font-weight: 600; font-size: .95rem; }
.video-card .vc-meta { color: var(--muted); font-size: .8rem; }
.video-card .vc-actions { display: flex; gap: .4rem; padding: .75rem 1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---- misc ---- */
.flex { display: flex; gap: .6rem; align-items: center; }
.flex-between { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt { margin-top: 1rem; } .mt-2 { margin-top: 1.5rem; } .mb { margin-bottom: 1rem; }
.muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.tag { background: var(--brand-lighter); color: var(--brand-dark); padding: .15rem .5rem; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .ico { font-size: 2.5rem; margin-bottom: .5rem; }
.scroll-list { max-height: 420px; overflow-y: auto; }
.pagination { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: 1.25rem; }
.pagination a, .pagination span { padding: .4rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; font-size: .85rem; color: var(--text-soft); }
.pagination .active span, .pagination span[aria-current] { background: var(--brand); color: #fff; border-color: var(--brand); }
.selectbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---- hero / landing ---- */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-darker)); color: #fff; padding: 4rem 0 4.5rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.15rem; max-width: 620px; opacity: .92; margin-bottom: 1.75rem; }
.hero .btn-outline { color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn-outline:hover { background: rgba(255,255,255,.12); }
.feature { text-align: left; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-lighter); color: var(--brand); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: .75rem; }

/* ---- throttle banner ---- */
.throttle { background: var(--brand-lighter); border: 1px dashed var(--brand-light); border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--brand-darker); font-size: .9rem; }
.throttle code { background: #fff; padding: .1rem .4rem; border-radius: 6px; border: 1px solid var(--border); }

footer.foot { background: #fff; border-top: 1px solid var(--border); padding: 1.25rem 0; color: var(--muted); font-size: .85rem; text-align: center; }

/* ---- install prompt ---- */
#pwa-install { position: fixed; bottom: 1rem; right: 1rem; z-index: 60; display: none; }

/* ---- custom confirm modal (replaces native confirm) ---- */
.cmodal {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(10, 18, 35, .55); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease;
}
.cmodal.show { opacity: 1; visibility: visible; }
.cmodal-card {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); padding: 1.8rem 1.5rem 1.4rem; text-align: center;
  transform: translateY(14px) scale(.96); transition: transform .24s cubic-bezier(.2,.8,.2,1);
  border-top: 5px solid var(--brand);
}
.cmodal-card.danger { border-top-color: var(--danger); }
.cmodal.show .cmodal-card { transform: translateY(0) scale(1); }
.cmodal-icon {
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 1rem; font-size: 2rem;
}
.cmodal-icon.primary { background: var(--brand-lighter); color: var(--brand); }
.cmodal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.cmodal.show .cmodal-icon { animation: cmPop .34s ease; }
@keyframes cmPop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.cmodal-title { font-size: 1.2rem; margin-bottom: .35rem; }
.cmodal-msg { color: var(--text-soft); margin-bottom: 1.4rem; }
.cmodal-actions { display: flex; gap: .6rem; }
.cmodal-actions .btn { flex: 1; padding: .65rem 1rem; }

/* Author display rules must never un-hide [hidden] elements. */
[hidden] { display: none !important; }

/* ---- template picker (build pages) ---- */
.tpl-grid { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.tpl-card, .field .tpl-card { display: flex; flex-direction: column; gap: .3rem; cursor: pointer; margin: 0; font-weight: 500; position: relative; }
/* Labels styled as buttons inside a .field (beats `.field label`). */
.field label.btn { display: inline-flex; margin-bottom: 0; font-size: .9rem; color: #fff; }
.field label.btn-sm { font-size: .82rem; }
.field label.btn-outline { color: var(--brand); }
.tpl-card input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tpl-swatch {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 7%;
  aspect-ratio: 4 / 5; padding: 12% 12%; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tpl-title { display: block; height: 7%; width: 70%; margin: 0 auto 6%; border-radius: 3px; opacity: .95; }
.tpl-opt { display: flex; align-items: center; height: 13%; padding: 0 9%; }
.tpl-opt i { display: block; height: 30%; width: 55%; border-radius: 2px; opacity: .85; }
.tpl-timer { position: absolute; right: 8%; bottom: 5%; width: 16%; aspect-ratio: 1; border: 2px solid; border-radius: 50%; border-right-color: transparent !important; }
.tpl-name { font-size: .78rem; text-align: center; color: var(--text-soft); line-height: 1.2; }
.tpl-card:hover .tpl-swatch { transform: translateY(-2px); }
.tpl-card input:checked + .tpl-swatch { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,122,212,.25); }
.tpl-card input:checked ~ .tpl-name { color: var(--brand-dark); font-weight: 700; }
.tpl-card input:focus-visible + .tpl-swatch { outline: 3px solid var(--brand-light); outline-offset: 2px; }

/* ---- question image field ---- */
.image-field { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.image-preview {
  width: 112px; height: 112px; flex: 0 0 auto; border-radius: var(--radius); border: 1px dashed var(--border);
  background: repeating-conic-gradient(#f3f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  display: grid; place-items: center; overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-empty { color: var(--muted); font-size: .8rem; text-align: center; line-height: 1.3; }
.image-empty i { font-size: 1.6rem; }
.image-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.image-actions .btn { min-height: 38px; }
.textarea-sm { min-height: 72px; }
.q-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #f3f5f9; display: block; }

/* ---- icon picker modal ---- */
.ipicker {
  position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(10, 18, 35, .55); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .2s ease;
}
.ipicker.show { opacity: 1; visibility: visible; }
.ipicker-card {
  background: #fff; width: 100%; max-width: 760px; height: min(82vh, 700px); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
.ipicker-head { display: flex; gap: .5rem; align-items: center; padding: .9rem 1rem .6rem; }
.ipicker-close { background: #eef1f6; border: 0; border-radius: 50%; width: 40px; height: 40px; flex: 0 0 auto; cursor: pointer; font-size: 1.1rem; color: var(--text-soft); }
.ipicker-cats {
  display: flex; gap: .4rem; overflow-x: auto; padding: 0 1rem .7rem; flex: 0 0 auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; border-bottom: 1px solid var(--border);
}
.chip {
  flex: 0 0 auto; white-space: nowrap; border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: .35rem .8rem; font: inherit; font-size: .82rem; cursor: pointer; min-height: 34px;
}
.chip:hover { background: var(--brand-lighter); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ipicker-grid {
  flex: 1; overflow-y: auto; padding: .8rem 1rem; display: grid; gap: .5rem; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); -webkit-overflow-scrolling: touch;
}
.ipicker-grid .empty, .ipicker-more { grid-column: 1 / -1; }
.ipicker-item {
  aspect-ratio: 1; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm);
  padding: 10%; cursor: pointer; transition: background .12s ease, transform .12s ease;
}
.ipicker-item:hover, .ipicker-item:focus-visible { background: var(--brand-lighter); border-color: var(--brand-light); transform: scale(1.05); outline: none; }
.ipicker-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ipicker-foot { padding: .55rem 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .78rem; }

/* ---- copy box (credits) ---- */
.copy-box { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.copy-box .textarea { flex: 1 1 260px; }

@media (max-width: 640px) {
  /* Icon picker becomes a full-screen sheet on phones. */
  .ipicker { padding: 0; }
  .ipicker-card { max-width: none; height: 100%; height: 100dvh; border-radius: 0; }
  .ipicker-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); padding: .6rem .75rem; }
  .ipicker-head { padding: .75rem .75rem .5rem; }
  .ipicker-cats { padding: 0 .75rem .6rem; }
  .image-preview { width: 96px; height: 96px; }
  .copy-box .btn { width: 100%; }
  .tpl-grid { gap: .5rem; }
  .tpl-name { font-size: .72rem; }
}

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }

  .nav-toggle { display: block; }

  /* Left-to-right slide-in sidebar */
  .nav-links {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 284px; max-width: 84vw;
    background: var(--brand-dark); color: #fff;
    flex-direction: column; align-items: stretch;
    padding: 0; gap: 0; margin: 0;
    transform: translateX(-100%); transition: transform .28s ease;
    z-index: 70; overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  .nav-links.open { transform: translateX(0); }
  .nav-backdrop.show { opacity: 1; visibility: visible; }

  .sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1rem; border-bottom: 1px solid rgba(255,255,255,.18);
    font-weight: 700; position: sticky; top: 0; background: var(--brand-dark); z-index: 1;
  }

  .nav-link { display: block; border-radius: 0; padding: .9rem 1.1rem; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  /* Collapsible accordion sections — collapsed by default, tap to expand */
  .nav-item.dropdown > .nav-link { cursor: pointer; }
  .dropdown-menu { position: static; display: none; box-shadow: none; background: rgba(0,0,0,.18); border: 0; border-radius: 0; padding: 0; min-width: 0; }
  .nav-item.dropdown.open > .nav-link { background: rgba(255,255,255,.1); }
  .nav-item.dropdown.open .dropdown-menu { display: block; }
  .dropdown-menu a { color: #cfe4fa; padding: .75rem 1.1rem .75rem 1.9rem; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.06); }
  .dropdown-menu a:hover { background: rgba(255,255,255,.12); color: #fff; }

  .nav-links form { padding: .4rem 0; }
  .nav-links form .nav-link { width: 100%; text-align: left; }
}
/* Stacked "card" tables on phones (add class="stack" to table.data) */
@media (max-width: 640px) {
  table.data.stack,
  table.data.stack tbody,
  table.data.stack tr,
  table.data.stack td { display: block; width: 100%; }
  table.data.stack thead { display: none; }
  table.data.stack tr {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff; margin-bottom: .75rem; padding: .5rem .9rem;
  }
  table.data.stack tbody tr:hover { background: #fff; }
  table.data.stack td {
    border: 0; border-bottom: 1px solid var(--border);
    padding: .5rem 0; font-size: .9rem; text-align: left;
  }
  table.data.stack tr td:last-child { border-bottom: 0; }
  table.data.stack td::before {
    content: attr(data-label); display: block;
    font-size: .68rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted); margin-bottom: .15rem;
  }
  table.data.stack td:empty { display: none; }
}

@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 2.75rem 0 3rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1.02rem; }
  .page-head { margin-bottom: 1rem; }
  .page-head h1 { font-size: 1.3rem; }
  .main { padding: 1.1rem 0 2.5rem; }
  .container { padding: 0 1rem; }
  .card-pad { padding: 1rem; }
  .card-title { font-size: 1rem; }
  .btn { padding: .6rem 1rem; }          /* larger tap target */
  .btn-sm { padding: .45rem .75rem; }
  .stat .n { font-size: 1.55rem; }
  table.data th, table.data td { padding: .55rem .6rem; font-size: .85rem; }
  /* Keep two compact video thumbnails per row on phones */
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
  .video-card video { height: 220px; }
  .video-card .vc-body { padding: .6rem .7rem; }
  .video-card .vc-actions { padding: .55rem .7rem; gap: .3rem; }
}
