/* Ama Affiliate Ultra — Frontend Styles (v4.20)
   ────────────────────────────────────────────────────────────────────
   DESIGN RULE FOR THIS FILE — read before editing:

   Every shortcode root carries the class `.aap-sc`. That class does two
   jobs that the old stylesheet did not do, and both of them are the
   reason boxes used to look broken on real sites:

   1. THEME-PROOFING. A shortcode is dropped into somebody else's theme.
      That theme sets its own body background, text colour, link colour,
      paragraph margins and line-height, and those cascade straight into
      our markup. On a dark theme the cards inherited a dark background
      with dark text and content simply disappeared. So every surface
      here declares its OWN background AND its OWN text colour — never
      one without the other, and never left to inherit.

   2. NO DEAD SPACE. Themes put big margins on p / h2 / h3 / ul / li.
      Those margins stacked inside our cards and produced the large empty
      gaps. `.aap-sc` zeroes them and we control spacing with flex/grid
      `gap` only. Do not reintroduce margins on elements inside `.aap-sc`.

   Corollary: never set a `min-height` on an image well to "reserve"
   space. That is what produced the tall empty boxes. Use aspect-ratio
   on the image itself so a short product photo makes a short card.
   ──────────────────────────────────────────────────────────────────── */

:root{
  --aap-primary:#FF9900;
  --aap-primary-dark:#cc7a00;
  --aap-primary-light:rgba(255,153,0,.12);

  /* Surfaces + ink. Always used as a pair. */
  --aap-surface:#ffffff;
  --aap-surface-soft:#f8fafc;
  --aap-surface-alt:#f1f5f9;
  --aap-ink:#0f172a;
  --aap-ink-soft:#475569;
  --aap-ink-muted:#64748b;
  --aap-line:#e2e8f0;

  /* Amazon action button */
  --aap-amz:#ffd814;
  --aap-amz-hover:#f7ca00;
  --aap-amz-edge:#e9b800;
  --aap-amz-ink:#0f1111;
  --aap-amz-dark:#131921;

  --aap-sale:#16a34a;
  --aap-link:#1a56db;

  /* legacy aliases kept so older custom CSS keeps working */
  --aap-card-bg:#ffffff;
  --aap-card-border:#e2e8f0;
  --aap-title-color:#0f172a;
  --aap-btn-text:#0f1111;

  --aap-radius:12px;
  --aap-shadow:0 1px 2px rgba(15,23,42,.06),0 6px 20px rgba(15,23,42,.07);
  --aap-shadow-lift:0 6px 14px rgba(15,23,42,.10),0 18px 40px rgba(15,23,42,.12);
  --aap-transition:.2s ease;
}

/* ══════════════════════════════════════════════════════════════════
   0. SHARED RESET — the theme-proofing layer
══════════════════════════════════════════════════════════════════ */

.aap-sc{
  box-sizing:border-box;
  color:var(--aap-ink);
  font-size:16px;
  line-height:1.45;
  text-align:left;
  -webkit-font-smoothing:antialiased;
}
.aap-sc *,.aap-sc *::before,.aap-sc *::after{box-sizing:border-box}

/* Kill inherited theme spacing. Spacing inside cards is done with gap. */
.aap-sc p,.aap-sc h1,.aap-sc h2,.aap-sc h3,.aap-sc h4,.aap-sc h5,
.aap-sc ul,.aap-sc ol,.aap-sc li,.aap-sc figure,.aap-sc table,
.aap-sc dl,.aap-sc dd,.aap-sc blockquote{
  margin:0;
  padding:0;
}
.aap-sc ul,.aap-sc ol{list-style:none}
.aap-sc img{max-width:100%;height:auto;display:block;border:0}
.aap-sc a{text-decoration:none;box-shadow:none}
.aap-sc a:hover{text-decoration:none}
.aap-sc button{font:inherit}

/* ══════════════════════════════════════════════════════════════════
   1. THE PRODUCT BOX — one component, two layouts
      .aap-box--h  horizontal (single product / "Our Pick")
      .aap-box--v  vertical   (grid cards)
══════════════════════════════════════════════════════════════════ */

.aap-box{
  position:relative;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-radius:var(--aap-radius);
  box-shadow:var(--aap-shadow);
  overflow:hidden;
  transition:box-shadow var(--aap-transition),transform var(--aap-transition),border-color var(--aap-transition);
}
.aap-box:hover{
  box-shadow:var(--aap-shadow-lift);
  transform:translateY(-2px);
  border-color:#cbd5e1;
}

/* ── Ribbon / badge ── */
.aap-box__ribbon{
  position:absolute;
  top:0;
  left:0;
  z-index:2;
  display:inline-block;
  background:linear-gradient(135deg,#4f46e5,#7c3aed);
  color:#fff;
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.07em;
  text-transform:uppercase;
  padding:5px 16px 5px 12px;
  border-radius:var(--aap-radius) 0 12px 0;
  line-height:1.3;
}
.aap-box__sale{
  position:absolute;
  top:10px;
  right:10px;
  z-index:2;
  background:var(--aap-sale);
  color:#fff;
  font-size:.68rem;
  font-weight:700;
  letter-spacing:.06em;
  padding:3px 9px;
  border-radius:999px;
  line-height:1.5;
}

/* ── Media well. No min-height: a short photo makes a short card. ── */
.aap-box__media{
  background:var(--aap-surface);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
}
.aap-box__media a{display:block;width:100%}
.aap-box__media img{
  width:100%;
  max-height:170px;
  object-fit:contain;
  margin:0 auto;
  transition:transform .28s ease;
}
.aap-box:hover .aap-box__media img{transform:scale(1.04)}

/* ── Text column ── */
.aap-box__main{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:14px 16px 16px;
  min-width:0;
  flex:1;
}
.aap-box__brand{
  font-size:.7rem;
  font-weight:600;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--aap-ink-muted);
  line-height:1.3;
}
.aap-box__title{
  font-size:1rem;
  font-weight:700;
  line-height:1.35;
  color:var(--aap-ink);
}
.aap-box__title a{color:var(--aap-link)}
.aap-box__title a:hover{color:#1e40af;text-decoration:underline}

.aap-box__rating{
  display:flex;
  align-items:center;
  gap:5px;
  font-size:.8rem;
  color:var(--aap-ink-muted);
  line-height:1.3;
}
/* Star row — emitted by AAP_Shortcodes::stars_html(), shared everywhere */
.aap-stars{display:inline-block;letter-spacing:1px;line-height:1;white-space:nowrap}
.aap-stars .aap-star-full,.aap-stars .aap-star-half{color:var(--aap-primary)}
.aap-stars .aap-star-empty{color:#cbd5e1}
.aap-box__rating-value{font-weight:700;color:var(--aap-ink-soft)}

.aap-box__feats{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:.86rem;
  line-height:1.5;
  color:var(--aap-ink-soft);
}
.aap-box__feats li{
  position:relative;
  padding-left:16px;
}
.aap-box__feats li::before{
  content:"";
  position:absolute;
  left:2px;
  top:.55em;
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--aap-primary);
}

/* ── Footer: prices + button. `margin-top:auto` pins it to the bottom
      so cards in a grid line their buttons up without a fixed height. ── */
.aap-box__foot{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:auto;
  padding-top:2px;
}
.aap-box__prices{
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:8px;
  min-width:0;
}
.aap-box__was{
  font-size:.85rem;
  color:var(--aap-ink-muted);
  text-decoration:line-through;
}
.aap-box__save{
  background:#dcfce7;
  color:#15803d;
  font-size:.75rem;
  font-weight:700;
  padding:2px 8px;
  border-radius:999px;
  line-height:1.5;
  white-space:nowrap;
}
.aap-box__now{
  font-size:1.35rem;
  font-weight:800;
  color:var(--aap-ink);
  letter-spacing:-.01em;
  line-height:1.1;
}
.aap-box__prime{
  display:inline-flex;
  align-items:center;
  gap:3px;
  font-size:.76rem;
  font-weight:700;
  color:#0284c7;
  line-height:1.4;
}
.aap-box__note{
  font-size:.7rem;
  color:var(--aap-ink-muted);
  line-height:1.4;
}

/* ── HORIZONTAL layout ── */
.aap-box--h{
  display:flex;
  align-items:stretch;
  gap:0;
  margin:1.6em 0;
}
.aap-box--h .aap-box__media{
  flex:0 0 176px;
  max-width:176px;
  padding:18px 14px;
  align-self:center;
}
.aap-box--h .aap-box__media img{max-height:150px}
.aap-box--h .aap-box__main{
  padding:18px 20px 16px;
  /* Centre the text column instead of stretching it. In the vertical grid
     card `margin-top:auto` on the footer is right — it lines the buttons up
     across cards. Here it was wrong: a product with no rating and no
     bullets got its price row shoved to the bottom of a box sized by the
     photo, which is precisely the dead space this rewrite is removing. */
  justify-content:center;
}
.aap-box--h .aap-box__title{font-size:1.12rem}
.aap-box--h .aap-box__ribbon + .aap-box__media{padding-top:30px}
.aap-box--h .aap-box__foot{justify-content:flex-end;margin-top:4px}
.aap-box--h .aap-box__prices{margin-right:auto}
.aap-box--h .aap-btn{min-width:190px}

@media(max-width:620px){
  .aap-box--h{flex-direction:column}
  .aap-box--h .aap-box__media{flex:none;max-width:100%;width:100%;padding-top:36px}
  .aap-box--h .aap-box__foot{justify-content:space-between}
  .aap-box--h .aap-btn{min-width:0;width:100%}
}

/* ── VERTICAL layout (grid card) ── */
.aap-box--v{
  display:flex;
  flex-direction:column;
  height:100%;
}
.aap-box--v .aap-box__media{
  padding:16px 16px 4px;
  border-bottom:0;
}
.aap-box--v .aap-box__media img{max-height:150px;aspect-ratio:4/3;object-fit:contain}
.aap-box--v .aap-box__main{padding:12px 14px 14px;gap:7px}
.aap-box--v .aap-box__title{font-size:.92rem;font-weight:600}
.aap-box--v .aap-box__foot{flex-direction:column;align-items:stretch;gap:8px}
.aap-box--v .aap-box__prices{justify-content:space-between;width:100%}
.aap-box--v .aap-box__now{margin-left:auto}
.aap-box--v .aap-btn{width:100%}
.aap-box--v .aap-box__note{text-align:center}

/* ══════════════════════════════════════════════════════════════════
   2. BUTTONS — Amazon action button + secondary
══════════════════════════════════════════════════════════════════ */

.aap-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  background:linear-gradient(180deg,#ffe066 0%,var(--aap-amz) 55%,#f5c700 100%);
  color:var(--aap-amz-ink);
  border:1px solid var(--aap-amz-edge);
  border-radius:999px;
  padding:10px 20px;
  font-size:.9rem;
  font-weight:700;
  line-height:1.25;
  text-align:center;
  cursor:pointer;
  white-space:nowrap;
  box-shadow:0 1px 2px rgba(15,23,42,.10);
  transition:background .18s ease,box-shadow .18s ease,transform .15s ease,filter .18s ease;
}
/* Hover is on by default — the user asked for it and it needs no setting. */
.aap-btn:hover,.aap-btn:focus-visible{
  background:linear-gradient(180deg,#ffd94d 0%,var(--aap-amz-hover) 55%,#eab600 100%);
  color:var(--aap-amz-ink);
  box-shadow:0 6px 16px rgba(234,182,0,.42);
  transform:translateY(-2px);
  text-decoration:none;
}
.aap-btn:active{transform:translateY(0);box-shadow:0 1px 2px rgba(15,23,42,.14)}
.aap-btn:focus-visible{outline:2px solid #0f172a;outline-offset:2px}

.aap-btn--sm{padding:7px 14px;font-size:.8rem;gap:7px}
.aap-btn--lg{padding:13px 26px;font-size:1rem}
.aap-btn--block{width:100%}

/* ── The Amazon mark. Drawn in CSS so it always renders: no webfont,
      no external image, no SVG text node that depends on a font. ── */
.aap-btn__mark{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  width:24px;
  height:24px;
  border-radius:7px;
  background:var(--aap-amz-dark);
  color:#fff;
  font:900 13px/1 Arial,Helvetica,sans-serif;
  padding-bottom:3px;
}
.aap-btn__mark::after{
  content:"";
  position:absolute;
  left:5px;
  right:5px;
  bottom:4px;
  height:6px;
  border-bottom:2px solid var(--aap-primary);
  border-radius:0 0 60% 60%/0 0 100% 100%;
}
.aap-btn--sm .aap-btn__mark{width:20px;height:20px;border-radius:6px;font-size:11px}
.aap-btn--sm .aap-btn__mark::after{left:4px;right:4px;bottom:3px;height:5px}

/* Secondary / ghost */
.aap-btn-secondary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-radius:999px;
  padding:9px 18px;
  font-size:.86rem;
  font-weight:600;
  transition:background var(--aap-transition),border-color var(--aap-transition),transform .15s ease;
}
.aap-btn-secondary:hover{background:var(--aap-surface-alt);border-color:#cbd5e1;transform:translateY(-1px);color:var(--aap-ink)}

/* Legacy button class names — kept so old saved content and any custom
   templates keep rendering a sane button instead of unstyled text. */
.aap-btn-primary,.aap-btn-buynow,.aap-pc-btn,.aap-ct-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:linear-gradient(180deg,#ffe066 0%,var(--aap-amz) 55%,#f5c700 100%);
  color:var(--aap-amz-ink)!important;
  border:1px solid var(--aap-amz-edge);
  border-radius:999px;
  padding:10px 20px;
  font-size:.88rem;
  font-weight:700;
  text-decoration:none!important;
  transition:background .18s ease,box-shadow .18s ease,transform .15s ease;
}
.aap-btn-primary:hover,.aap-btn-buynow:hover,.aap-pc-btn:hover,.aap-ct-btn:hover{
  background:linear-gradient(180deg,#ffd94d 0%,var(--aap-amz-hover) 55%,#eab600 100%);
  box-shadow:0 6px 16px rgba(234,182,0,.42);
  transform:translateY(-2px);
}
.aap-btn-sm{padding:7px 14px;font-size:.8rem}
.aap-btn-lg{padding:13px 26px;font-size:1rem;width:100%}

/* ══════════════════════════════════════════════════════════════════
   3. GRID
══════════════════════════════════════════════════════════════════ */

.aap-grid{
  display:grid;
  gap:18px;
  margin:1.6em 0;
  align-items:stretch;
}
.aap-grid-1{grid-template-columns:minmax(0,340px)}
.aap-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.aap-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.aap-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1000px){.aap-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:860px){.aap-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){
  .aap-grid-2,.aap-grid-3,.aap-grid-4{grid-template-columns:minmax(0,1fr)}
}

/* Legacy grid class names still emitted by older saved posts */
.aap-pc-grid{display:grid;gap:18px;margin:1.6em 0;align-items:stretch}
.aap-pc-grid-1{grid-template-columns:minmax(0,340px)}
.aap-pc-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.aap-pc-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.aap-pc-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1000px){.aap-pc-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:860px){.aap-pc-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.aap-pc-grid-2,.aap-pc-grid-3,.aap-pc-grid-4{grid-template-columns:minmax(0,1fr)}}

/* ══════════════════════════════════════════════════════════════════
   4. LIST (bestsellers / new releases)
══════════════════════════════════════════════════════════════════ */

.aap-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin:1.6em 0;
}
.aap-list__item{
  position:relative;
  display:flex;
  align-items:center;
  gap:16px;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-radius:var(--aap-radius);
  box-shadow:var(--aap-shadow);
  padding:12px 16px 12px 12px;
  transition:box-shadow var(--aap-transition),transform var(--aap-transition),border-color var(--aap-transition);
}
.aap-list__item:hover{
  box-shadow:var(--aap-shadow-lift);
  transform:translateY(-2px);
  border-color:#cbd5e1;
}
.aap-list__rank{
  flex:0 0 32px;
  height:32px;
  width:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:linear-gradient(135deg,#1e293b,#334155);
  color:#fff;
  font-size:.9rem;
  font-weight:800;
  line-height:1;
}
.aap-list__item--1 .aap-list__rank{background:linear-gradient(135deg,#f59e0b,#ea8a00)}
.aap-list__item--2 .aap-list__rank{background:linear-gradient(135deg,#94a3b8,#64748b)}
.aap-list__item--3 .aap-list__rank{background:linear-gradient(135deg,#c2854a,#a06a34)}
.aap-list__media{flex:0 0 78px;width:78px}
.aap-list__media img{width:78px;height:78px;object-fit:contain}
.aap-list__main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.aap-list__brand{
  font-size:.68rem;
  font-weight:600;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--aap-ink-muted);
  line-height:1.3;
}
.aap-list__title{font-size:.94rem;font-weight:700;line-height:1.35}
.aap-list__title a{color:var(--aap-link)}
.aap-list__title a:hover{color:#1e40af;text-decoration:underline}
.aap-list__meta{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  font-size:.8rem;
  color:var(--aap-ink-muted);
  line-height:1.4;
}
.aap-list__meta .aap-star-full,.aap-list__meta .aap-star-half{color:var(--aap-primary)}
.aap-list__meta .aap-star-empty{color:#cbd5e1}
.aap-list__pricegroup{display:inline-flex;align-items:baseline;gap:7px;flex-wrap:wrap}
.aap-list__now{font-size:1.02rem;font-weight:800;color:var(--aap-ink)}
.aap-list__was{font-size:.78rem;color:var(--aap-ink-muted);text-decoration:line-through}
.aap-list__save{background:#dcfce7;color:#15803d;font-size:.7rem;font-weight:700;padding:1px 7px;border-radius:999px;white-space:nowrap}
.aap-list__cta{flex:0 0 auto;display:flex;align-items:center}

@media(max-width:620px){
  .aap-list__item{flex-wrap:wrap;padding:12px}
  .aap-list__main{flex:1 1 100%;order:3}
  .aap-list__cta{flex:1 1 100%;order:4}
  .aap-list__cta .aap-btn{width:100%}
}

/* ══════════════════════════════════════════════════════════════════
   5. COMPARISON TABLE
      Column tints are LIGHT and every cell states its own background
      AND ink colour, so a dark site theme cannot swallow the text.
══════════════════════════════════════════════════════════════════ */

.aap-cmp{margin:1.8em 0}
.aap-cmp__scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  padding:4px 4px 10px;
  margin:-4px -4px -10px;
}
.aap-cmp__table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:420px;
  background:var(--aap-surface);
  border:1px solid var(--aap-line);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--aap-shadow);
  font-size:.9rem;
  color:var(--aap-ink);
}
/* SPECIFICITY NOTE — do not "tidy" this into `.aap-cmp__table td`.
   An element-qualified selector like that scores (0,1,1) and would BEAT
   every single-class variant below it — `.aap-cmp__label` (0,1,0),
   `.aap-cmp__cell--row-alt`, `.aap-cmp__cell--best`, `.aap-cmp__badge-cell`
   — silently reverting the label column, the zebra striping, the best
   column tint and the badge row to plain white. Every cell already carries
   either .aap-cmp__cell or .aap-cmp__label, so the shared base lives on
   those two classes and stays at (0,1,0). Source order then decides. */
.aap-cmp__cell,.aap-cmp__label{
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:0;
  border-bottom:1px solid var(--aap-line);
  padding:12px 14px;
  text-align:center;
  vertical-align:middle;
}
.aap-cmp__table tr:last-child > td{border-bottom:0}

/* ── Label column ── */
.aap-cmp__label{
  background:var(--aap-surface-alt);
  color:var(--aap-ink-soft);
  font-size:.74rem;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  text-align:left;
  white-space:nowrap;
  width:150px;
  min-width:130px;
  border-right:1px solid var(--aap-line);
}

/* ── Product cells ── */
.aap-cmp__cell{
  min-width:150px;
  border-right:1px solid var(--aap-line);
  transition:background .2s ease;
}
.aap-cmp__cell:last-child{border-right:0}
.aap-cmp__in{
  display:block;
  transition:transform .22s cubic-bezier(.2,.8,.3,1);
}

/* ── Column hover: the whole column tints and lifts.
      scripts.js tags every cell of the hovered column with .is-hot,
      because CSS alone cannot select a table column on hover. ── */
.aap-cmp__cell.is-hot{background:#fffaf0}
.aap-cmp__cell.is-hot .aap-cmp__in{transform:scale(1.06)}
.aap-cmp__cell.is-hot.aap-cmp__cell--row-alt{background:#fff6e6}
@media(prefers-reduced-motion:reduce){
  .aap-cmp__in{transition:none}
  .aap-cmp__cell.is-hot .aap-cmp__in{transform:none}
}

/* ── Badge / crown row ── */
.aap-cmp__badge-cell{
  padding:0;
  border-bottom:0;
  height:38px;
}
.aap-cmp__badge{
  display:flex;
  align-items:center;
  justify-content:center;
  height:38px;
  color:#fff;
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.09em;
  text-transform:uppercase;
  line-height:1;
}
.aap-cmp__badge--empty{background:var(--aap-surface-alt)}

/* ── Image row ── */
.aap-cmp__img-cell{padding:16px 14px}
.aap-cmp__img-cell img{
  max-width:130px;
  max-height:130px;
  width:auto;
  margin:0 auto;
  object-fit:contain;
}

/* ── Title row ── */
.aap-cmp__title-cell{padding:10px 14px 14px}
.aap-cmp__title-cell a{
  color:var(--aap-link);
  font-weight:700;
  font-size:.88rem;
  line-height:1.35;
  display:block;
}
.aap-cmp__title-cell a:hover{color:#1e40af;text-decoration:underline}
.aap-cmp__brand{
  font-size:.66rem;
  font-weight:600;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--aap-ink-muted);
  margin-bottom:4px;
  display:block;
}

/* ── Data rows ── */
.aap-cmp__cell--row-alt,.aap-cmp__label--row-alt{background:var(--aap-surface-soft)}
.aap-cmp__label--row-alt{background:#e9eef4}
.aap-cmp__val{font-size:.88rem;color:var(--aap-ink)}
.aap-cmp__check{color:#16a34a;font-size:1.15rem;font-weight:800;line-height:1}
.aap-cmp__cross{color:#dc2626;font-size:1.15rem;font-weight:800;line-height:1}
.aap-cmp__na{color:#94a3b8}
.aap-cmp__now,.aap-cmp__price{display:block;font-weight:800;font-size:1.05rem;color:var(--aap-ink)}
.aap-cmp__was{
  display:block;
  font-size:.76rem;
  color:var(--aap-ink-muted);
  text-decoration:line-through;
  font-weight:400;
}
.aap-cmp__save{
  display:inline-block;
  background:#dcfce7;
  color:#15803d;
  font-size:.7rem;
  font-weight:700;
  padding:1px 7px;
  border-radius:999px;
  margin-bottom:3px;
  white-space:nowrap;
}
.aap-cmp__prime{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:.78rem;
  font-weight:700;
  color:#0284c7;
}
.aap-cmp__stars{white-space:nowrap;line-height:1}
.aap-cmp__stars .aap-star-full,.aap-cmp__stars .aap-star-half{color:var(--aap-primary)}
.aap-cmp__stars .aap-star-empty{color:#cbd5e1}

/* ── CTA row: full-width button, always the last thing you see ── */
.aap-cmp__cta-row td{
  background:var(--aap-surface-soft);
  border-bottom:0;
  padding:14px 12px;
}
.aap-cmp__cta-row .aap-cmp__label{background:#e9eef4}
.aap-cmp__cta-row .aap-btn{width:100%;padding:12px 14px;font-size:.86rem}

/* ── Best column: rich accent, still readable ── */
.aap-cmp__cell--best{
  background:#fbfaff;
  box-shadow:inset 2px 0 0 var(--aap-cmp-accent,#4f46e5),inset -2px 0 0 var(--aap-cmp-accent,#4f46e5);
}
.aap-cmp__cell--best.aap-cmp__cell--row-alt{background:#f6f5ff}
.aap-cmp__cta-row .aap-cmp__cell--best{
  box-shadow:inset 2px 0 0 var(--aap-cmp-accent,#4f46e5),inset -2px 0 0 var(--aap-cmp-accent,#4f46e5),inset 0 -2px 0 var(--aap-cmp-accent,#4f46e5);
}

/* ── Many columns: shrink so 4-6 products still fit ── */
.aap-cmp--cols-4 .aap-cmp__cell,
.aap-cmp--cols-5 .aap-cmp__cell,
.aap-cmp--cols-6 .aap-cmp__cell{min-width:0;padding:10px 8px;font-size:.83rem}
.aap-cmp--cols-4 .aap-cmp__img-cell img{max-width:104px;max-height:104px}
.aap-cmp--cols-5 .aap-cmp__img-cell img{max-width:92px;max-height:92px}
.aap-cmp--cols-6 .aap-cmp__img-cell img{max-width:80px;max-height:80px}
.aap-cmp--cols-4 .aap-cmp__cta-row .aap-btn,
.aap-cmp--cols-5 .aap-cmp__cta-row .aap-btn,
.aap-cmp--cols-6 .aap-cmp__cta-row .aap-btn{padding:10px 8px;font-size:.76rem;gap:6px}
.aap-cmp--cols-5 .aap-cmp__cta-row .aap-btn__mark,
.aap-cmp--cols-6 .aap-cmp__cta-row .aap-btn__mark{display:none}
.aap-cmp--nolabel.aap-cmp--cols-2 .aap-cmp__cell{width:50%}
.aap-cmp--nolabel.aap-cmp--cols-3 .aap-cmp__cell{width:33.33%}
.aap-cmp--nolabel.aap-cmp--cols-4 .aap-cmp__cell{width:25%}
.aap-cmp--nolabel.aap-cmp--cols-5 .aap-cmp__cell{width:20%}
.aap-cmp--nolabel.aap-cmp--cols-6 .aap-cmp__cell{width:16.66%}

@media(max-width:560px){
  .aap-cmp__label{width:96px;min-width:96px;font-size:.66rem;padding:10px 8px;white-space:normal}
  .aap-cmp__cell{min-width:118px;padding:10px 8px}
  .aap-cmp__img-cell img{max-width:84px;max-height:84px}
}

/* ══════════════════════════════════════════════════════════════════
   5b. TABLE LAYOUT — [aap_product template="table"]
══════════════════════════════════════════════════════════════════ */

.aap-ptab{margin:1.6em 0}
.aap-ptab__scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.aap-ptab__table{
  width:100%;
  min-width:520px;
  border-collapse:separate;
  border-spacing:0;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--aap-shadow);
  font-size:.9rem;
}
.aap-ptab__th{
  background:var(--aap-surface-alt);
  color:var(--aap-ink-soft);
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.07em;
  text-transform:uppercase;
  text-align:left;
  padding:12px 16px;
  border-bottom:1px solid var(--aap-line);
}
.aap-ptab__th--img{width:96px}
.aap-ptab__th--price{width:130px;text-align:right}
.aap-ptab__th--cta{width:150px}
.aap-ptab__td{
  background:var(--aap-surface);
  color:var(--aap-ink);
  padding:12px 16px;
  border-bottom:1px solid var(--aap-line);
  vertical-align:middle;
}
.aap-ptab__row:last-child .aap-ptab__td{border-bottom:0}
.aap-ptab__row:hover .aap-ptab__td{background:var(--aap-surface-soft)}
.aap-ptab__td--img{width:96px;padding:10px 12px}
.aap-ptab__td--img img{width:64px;height:64px;object-fit:contain;margin:0 auto}
.aap-ptab__title{
  display:block;
  color:var(--aap-link);
  font-weight:700;
  font-size:.9rem;
  line-height:1.4;
}
.aap-ptab__title:hover{color:#1e40af;text-decoration:underline}
.aap-ptab__rating{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:.76rem;
  color:var(--aap-ink-muted);
  margin-top:3px;
}
.aap-ptab__td--price{text-align:right;white-space:nowrap}
.aap-ptab__now{display:block;font-size:1rem;font-weight:800;color:var(--aap-ink)}
.aap-ptab__was{display:block;font-size:.76rem;color:var(--aap-ink-muted);text-decoration:line-through}
.aap-ptab__save{display:inline-block;background:#dcfce7;color:#15803d;font-size:.68rem;font-weight:700;padding:1px 6px;border-radius:999px}
.aap-ptab__td--cta{text-align:right}
.aap-ptab__td--cta .aap-btn{width:100%}

.aap-sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
  border:0;
}

@media(max-width:560px){
  .aap-ptab__table{min-width:420px;font-size:.84rem}
  .aap-ptab__td,.aap-ptab__th{padding:10px}
  .aap-ptab__td--cta .aap-btn__mark{display:none}
}

/* ══════════════════════════════════════════════════════════════════
   6. FLOATING BAR — compact, single row, no dead space
══════════════════════════════════════════════════════════════════ */

#aap-float{
  position:fixed;
  bottom:18px;
  left:50%;
  transform:translateX(-50%) translateY(140px);
  z-index:9998;
  display:flex;
  align-items:center;
  gap:12px;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-left:4px solid var(--aap-primary);
  border-radius:12px;
  box-shadow:0 10px 34px rgba(15,23,42,.2);
  padding:8px 40px 8px 10px;
  max-width:440px;
  width:calc(100% - 28px);
  opacity:0;
  transition:transform .42s cubic-bezier(.34,1.4,.64,1),opacity .35s ease;
}
#aap-float.aap-float--visible{transform:translateX(-50%) translateY(0);opacity:1}

/* ── Bar variants pinned to a corner instead of centred ─────────────
   The centred bar owes its position to translateX(-50%); a corner bar
   must NOT inherit that or it lands half off-screen. Each variant
   therefore restates both the hidden and the visible transform. */
#aap-float.aap-float--bottom_left{left:18px;right:auto;transform:translateY(140px)}
#aap-float.aap-float--bottom_left.aap-float--visible{transform:translateY(0)}
#aap-float.aap-float--bottom_right{left:auto;right:18px;transform:translateY(140px)}
#aap-float.aap-float--bottom_right.aap-float--visible{transform:translateY(0)}

/* ══════════════════════════════════════════════════════════════════
   6b. FLOATING RAIL — tall sky-scraper card beside the content
   Sits in the empty margin OUTSIDE the content column, never over it.
   Below 1400px there is no such margin on a normal 1200px layout, so
   the rail turns back into the bottom bar rather than overlapping a
   sidebar widget. Phones and tablets never see the rail at all.
══════════════════════════════════════════════════════════════════ */
@media(min-width:1400px){
  #aap-float.aap-float--rail{
    top:120px;                 /* overridden inline by the Rail Top Offset setting */
    bottom:auto;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    text-align:center;
    gap:8px;
    width:212px;
    max-width:212px;
    padding:30px 14px 14px;
    border-left:1px solid var(--aap-line);
    border-top:4px solid var(--aap-primary);
    border-radius:14px;
  }
  #aap-float.aap-float--left{left:16px;right:auto;transform:translateX(-130%)}
  #aap-float.aap-float--left.aap-float--visible{transform:translateX(0)}
  #aap-float.aap-float--right{right:16px;left:auto;transform:translateX(130%)}
  #aap-float.aap-float--right.aap-float--visible{transform:translateX(0)}

  #aap-float.aap-float--rail .aap-float__media{flex:0 0 auto;width:100%}
  #aap-float.aap-float--rail .aap-float__media img{width:100%;height:150px;object-fit:contain}
  #aap-float.aap-float--rail .aap-float__main{gap:5px;align-items:center}
  #aap-float.aap-float--rail .aap-float__label{font-size:.64rem}
  #aap-float.aap-float--rail .aap-float__title{
    font-size:.84rem;
    -webkit-line-clamp:3;
    text-align:center;
  }
  #aap-float.aap-float--rail .aap-float__price{justify-content:center;flex-wrap:wrap}
  #aap-float.aap-float--rail .aap-float__rating{line-height:1;font-size:.9rem}
  #aap-float.aap-float--rail .aap-float__cta{flex:0 0 auto;width:100%}
  #aap-float.aap-float--rail .aap-float__cta .aap-btn{
    display:flex;
    width:100%;
    justify-content:center;
    padding:11px 10px;
    font-size:.84rem;
    font-weight:800;
  }
  #aap-float.aap-float--rail .aap-float__note{
    font-size:.64rem;
    color:var(--aap-ink-muted);
    line-height:1.3;
  }
}
/* Narrower than 1400px: no free margin exists, so fall back to the bar. */
@media(max-width:1399px){
  #aap-float.aap-float--rail{
    top:auto !important;
    bottom:18px;
    left:50%;
    right:auto;
    flex-direction:row;
    text-align:left;
    width:calc(100% - 28px);
    max-width:440px;
    padding:8px 40px 8px 10px;
    border-top:1px solid var(--aap-line);
    border-left:4px solid var(--aap-primary);
    border-radius:12px;
    transform:translateX(-50%) translateY(140px);
  }
  #aap-float.aap-float--rail.aap-float--visible{transform:translateX(-50%) translateY(0)}
  #aap-float.aap-float--rail .aap-float__note,
  #aap-float.aap-float--rail .aap-float__rating{display:none}
  #aap-float.aap-float--rail .aap-float__media{flex:0 0 52px;width:52px}
  #aap-float.aap-float--rail .aap-float__media img{width:52px;height:52px}
  #aap-float.aap-float--rail .aap-float__main{align-items:flex-start}
  #aap-float.aap-float--rail .aap-float__title{text-align:left;-webkit-line-clamp:2}
}
.aap-float__close{
  position:absolute;
  top:6px;
  right:8px;
  background:none;
  border:0;
  font-size:1.05rem;
  line-height:1;
  cursor:pointer;
  color:#94a3b8;
  padding:3px 5px;
  border-radius:6px;
  transition:color .15s ease,background .15s ease;
}
.aap-float__close:hover{color:var(--aap-ink);background:var(--aap-surface-alt)}
.aap-float__media{flex:0 0 52px;width:52px}
.aap-float__media img{width:52px;height:52px;object-fit:contain}
.aap-float__main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.aap-float__label{
  font-size:.62rem;
  font-weight:800;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--aap-primary);
  line-height:1.3;
}
.aap-float__title{
  font-size:.82rem;
  font-weight:700;
  color:var(--aap-ink);
  line-height:1.3;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
.aap-float__price{
  display:flex;
  align-items:baseline;
  gap:6px;
  flex-wrap:nowrap;
  overflow:hidden;
  line-height:1.3;
}
.aap-float__now{font-size:.88rem;font-weight:800;color:var(--aap-ink)}
.aap-float__was{font-size:.72rem;color:var(--aap-ink-muted);text-decoration:line-through}
.aap-float__save{background:#dcfce7;color:#15803d;font-size:.66rem;font-weight:700;padding:1px 6px;border-radius:999px;white-space:nowrap}
.aap-float__cta{flex:0 0 auto}

@media(max-width:520px){
  #aap-float{gap:10px;padding:8px 34px 8px 8px;bottom:12px}
  .aap-float__media{flex:0 0 44px;width:44px}
  .aap-float__media img{width:44px;height:44px}
  .aap-float__cta .aap-btn{padding:8px 12px;font-size:.76rem}
  .aap-float__cta .aap-btn__mark{display:none}
}

/* ══════════════════════════════════════════════════════════════════
   6c. MEMBERSHIP PROMO BAR — the second floating bar

   Deliberately the same size and shape as the product bar: it is a
   sibling, not a takeover. It is pinned to one corner and never centred,
   because the centre belongs to the product bar.

   The vertical offset is set by JS at runtime (--aap-promo-lift) when the
   product bar occupies the same corner, so the two stack instead of
   overlapping and the product bar never has to move.
══════════════════════════════════════════════════════════════════ */

#aap-promo-bar{
  --aap-promo-accent:#00a8e1;
  --aap-promo-lift:0px;    /* set by JS when the product bar shares the corner */
  --aap-promo-gap:0px;     /* the author's own "distance from the edge" */
  position:fixed;
  bottom:calc(18px + var(--aap-promo-lift) + var(--aap-promo-gap));
  z-index:9997;                       /* one below the product bar */
  display:flex;
  align-items:center;
  gap:12px;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-left:4px solid var(--aap-promo-accent);
  border-radius:12px;
  box-shadow:0 10px 34px rgba(15,23,42,.2);
  padding:8px 40px 8px 10px;
  max-width:440px;
  width:calc(100% - 28px);
  opacity:0;
  transition:transform .42s cubic-bezier(.34,1.4,.64,1),opacity .35s ease,bottom .3s ease;
}
#aap-promo-bar.aap-promo--left{left:18px;right:auto;transform:translateY(140px)}
#aap-promo-bar.aap-promo--right{right:18px;left:auto;transform:translateY(140px)}
#aap-promo-bar.aap-promo--visible{transform:translateY(0);opacity:1}

.aap-promo__close{
  position:absolute;
  top:6px;
  right:8px;
  background:none;
  border:0;
  font-size:1.05rem;
  line-height:1;
  cursor:pointer;
  color:#94a3b8;
  padding:3px 5px;
  border-radius:6px;
  transition:color .15s ease,background .15s ease;
}
.aap-promo__close:hover{color:var(--aap-ink);background:var(--aap-surface-alt)}

.aap-promo__media{flex:0 0 52px;width:52px;display:flex;align-items:center;justify-content:center}
.aap-promo__media img{width:52px;height:52px;object-fit:contain;border-radius:8px}
.aap-promo__mark{
  display:flex;
  align-items:center;
  justify-content:center;
  width:52px;
  height:52px;
  border-radius:10px;
  /* Plain tint first: color-mix is dropped whole by older browsers, and a
     declaration they can use has to be there for them to fall back to. */
  background:#f1f5f9;
  background:color-mix(in srgb,var(--aap-promo-accent) 12%,#ffffff);
  color:var(--aap-promo-accent);
}
.aap-promo__mark svg{width:34px;height:34px}

.aap-promo__main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.aap-promo__badge{
  font-size:.62rem;
  font-weight:800;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--aap-promo-accent);
  line-height:1.3;
}
.aap-promo__title{
  font-size:.82rem;
  font-weight:700;
  color:var(--aap-ink);
  line-height:1.3;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
/* One line, never two. The benefits sit where the product bar puts its
   price, and matching that line keeps both bars exactly the same height —
   which is the point: this is a sibling of the product bar, not a bigger
   thing shouting over it. Anything that does not fit is clipped rather
   than wrapped, because a bar that grows is no longer a bar. */
.aap-promo__benefits{
  list-style:none;
  margin:1px 0 0;
  padding:0;
  display:flex;
  flex-wrap:nowrap;
  overflow:hidden;
  gap:0 10px;
  font-size:.68rem;
  line-height:1.35;
  color:var(--aap-ink-muted);
  /* Fade the clipped edge so a benefit cut off mid-word reads as "there is
     more" rather than as a rendering fault. Browsers without mask support
     simply get the hard clip. */
  -webkit-mask-image:linear-gradient(90deg,#000 88%,transparent 100%);
  mask-image:linear-gradient(90deg,#000 88%,transparent 100%);
}
.aap-promo__benefits li{position:relative;padding-left:11px;white-space:nowrap}
.aap-promo__benefits li:before{
  content:"";
  position:absolute;
  left:0;
  top:.42em;
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--aap-promo-accent);
  opacity:.6;
}
.aap-promo__cta{flex:0 0 auto}
.aap-promo__btn.aap-btn{background:var(--aap-promo-accent);border-color:var(--aap-promo-accent)}

.aap-promo__note{display:none}

/* ── Sidebar box style ───────────────────────────────────────────────
   The same card shape as the product rail, so the two read as a set. It
   only exists where there is a free margin beside the content column —
   below 1400px the rules below turn it back into the bottom bar rather
   than letting it sit on top of the article. */
@media(min-width:1400px){
  #aap-promo-bar.aap-promo--rail{
    flex-direction:column;
    align-items:center;
    /* Anchored to the top here, so the author's offset pushes it DOWN.
       bottom:auto matters — with both edges set the card would stretch. */
    top:calc(120px + var(--aap-promo-gap));
    bottom:auto;
    /* Same width, padding and radius as the product rail — the two are a
       set, and 20px of difference between them reads as a mistake. The
       accent edge moves to the top for the same reason. */
    width:212px;
    max-width:212px;
    gap:8px;
    padding:26px 14px 14px;
    border-left:1px solid var(--aap-line);
    border-top:4px solid var(--aap-promo-accent);
    border-radius:14px;
    text-align:center;
  }
  #aap-promo-bar.aap-promo--rail.aap-promo--left{left:16px;right:auto;transform:translateX(-130%)}
  #aap-promo-bar.aap-promo--rail.aap-promo--right{right:16px;left:auto;transform:translateX(130%)}
  #aap-promo-bar.aap-promo--rail.aap-promo--visible{transform:translateX(0)}

  .aap-promo--rail .aap-promo__media{flex:0 0 auto;width:100%}
  .aap-promo--rail .aap-promo__media img{width:100%;height:110px}
  .aap-promo--rail .aap-promo__mark{width:76px;height:76px;margin:0 auto}
  .aap-promo--rail .aap-promo__mark svg{width:50px;height:50px}
  .aap-promo--rail .aap-promo__main{align-items:center;gap:4px}
  .aap-promo--rail .aap-promo__title{-webkit-line-clamp:3;font-size:.86rem}
  /* Vertical list here: the card has the height for it, and each benefit
     is a reason to click. */
  .aap-promo--rail .aap-promo__benefits{
    flex-direction:column;
    flex-wrap:nowrap;
    align-items:flex-start;
    gap:3px 0;
    overflow:visible;
    text-align:left;
    -webkit-mask-image:none;
    mask-image:none;
  }
  .aap-promo--rail .aap-promo__benefits li{white-space:normal}
  .aap-promo--rail .aap-promo__cta{flex:0 0 auto;width:100%}
  .aap-promo--rail .aap-promo__cta .aap-btn{width:100%;justify-content:center}
  .aap-promo--rail .aap-promo__note{
    display:block;
    font-size:.62rem;
    line-height:1.3;
    color:var(--aap-ink-muted);
    opacity:.85;
  }
}

@media(max-width:520px){
  #aap-promo-bar{gap:10px;padding:8px 34px 8px 8px;bottom:calc(12px + var(--aap-promo-lift) + var(--aap-promo-gap))}
  #aap-promo-bar.aap-promo--left{left:14px}
  #aap-promo-bar.aap-promo--right{right:14px}
  .aap-promo__media{flex:0 0 44px;width:44px}
  .aap-promo__media img,.aap-promo__mark{width:44px;height:44px}
  /* Two benefits at most on a phone — a third wraps the bar to three
     lines and it stops being a bar. */
  .aap-promo__benefits li:nth-child(n+3){display:none}
  .aap-promo__cta .aap-btn{padding:8px 12px;font-size:.76rem}
  .aap-promo__cta .aap-btn__mark{display:none}
}

/* ══════════════════════════════════════════════════════════════════
   7. POPUP
══════════════════════════════════════════════════════════════════ */

#aap-popup{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .32s ease}
#aap-popup.aap-popup--visible{opacity:1}
.aap-popup-overlay{position:absolute;inset:0;background:rgba(15,23,42,.58);cursor:pointer}
.aap-popup-box{
  position:relative;
  z-index:1;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border-radius:16px;
  box-shadow:0 24px 64px rgba(15,23,42,.32);
  padding:26px 24px 22px;
  max-width:400px;
  width:calc(100% - 32px);
  text-align:center;
  transform:scale(.92);
  transition:transform .32s ease;
}
#aap-popup.aap-popup--visible .aap-popup-box{transform:scale(1)}
.aap-popup-close{position:absolute;top:10px;right:12px;background:none;border:0;font-size:1.3rem;cursor:pointer;color:#94a3b8;line-height:1;padding:3px 6px;border-radius:6px}
.aap-popup-close:hover{color:var(--aap-ink);background:var(--aap-surface-alt)}
.aap-popup-badge{
  display:inline-block;
  background:linear-gradient(135deg,var(--aap-primary),#ff6b00);
  color:#fff;
  font-size:.7rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.09em;
  padding:5px 14px;
  border-radius:999px;
  margin-bottom:12px;
}
.aap-popup-image img{max-width:140px;max-height:140px;object-fit:contain;margin:0 auto 12px}
.aap-popup-title{font-size:.98rem;font-weight:700;color:var(--aap-ink);line-height:1.4;margin-bottom:6px}
.aap-popup-rating{font-size:.82rem;color:var(--aap-ink-muted);margin-bottom:6px}
.aap-popup-price{font-size:1.25rem;font-weight:800;color:var(--aap-ink);margin-bottom:14px}
.aap-popup-disclaimer{font-size:.68rem;color:var(--aap-ink-muted);margin-top:10px}
.aap-popup-box .aap-btn{width:100%}

/* ══════════════════════════════════════════════════════════════════
   8. Inline text link + disclosure
══════════════════════════════════════════════════════════════════ */

.aap-text-link{
  color:var(--aap-link);
  font-weight:600;
  text-decoration:underline;
  text-underline-offset:2px;
  transition:color .15s ease;
}
.aap-text-link:hover{color:#1e40af}
.aap-disclosure{
  font-size:.76rem;
  color:var(--aap-ink-muted);
  margin:8px 0 0;
  padding:0;
  font-style:italic;
  line-height:1.5;
}
.aap-sc .aap-disclosure{margin:8px 0 0}

/* ══════════════════════════════════════════════════════════════════
   9. TICKER BAR
══════════════════════════════════════════════════════════════════ */

#aap-ticker{position:fixed;top:0;left:0;right:0;z-index:99999;height:46px;background:#0f1111;color:#fff;display:flex;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,.4)}
.aap-ticker-label{flex-shrink:0;background:var(--aap-primary);color:#0f1111;font-weight:800;font-size:.76rem;padding:0 14px;height:100%;display:flex;align-items:center;letter-spacing:.05em;white-space:nowrap}
.aap-ticker-viewport{flex:1;overflow:hidden;height:100%;display:flex;align-items:center;position:relative}
.aap-ticker-inner{display:flex;align-items:center;white-space:nowrap;will-change:transform}
.aap-ticker-speed-slow   .aap-ticker-inner{animation:aap-ticker 60s linear infinite}
.aap-ticker-speed-medium .aap-ticker-inner{animation:aap-ticker 35s linear infinite}
.aap-ticker-speed-fast   .aap-ticker-inner{animation:aap-ticker 20s linear infinite}
@keyframes aap-ticker{0%{transform:translateX(0)}100%{transform:translateX(-50%)}}
.aap-ticker-item{display:inline-flex;align-items:center;gap:8px;color:#fff;text-decoration:none;padding:0 24px 0 8px;font-size:.82rem;transition:color .15s;flex-shrink:0}
.aap-ticker-item:hover{color:var(--aap-primary);text-decoration:none}
.aap-ticker-item img{width:30px;height:30px;object-fit:contain;border-radius:3px;background:#fff;flex-shrink:0}
.aap-ticker-text{max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aap-ticker-cta{color:var(--aap-primary);font-weight:700;font-size:.78rem;flex-shrink:0;margin-left:4px}
.aap-ticker-sep{color:#444;padding:0 4px;font-size:1.2rem;flex-shrink:0}
.aap-ticker-close{flex-shrink:0;background:none;border:none;color:#aaa;font-size:1.3rem;cursor:pointer;padding:0 14px;height:100%;display:flex;align-items:center;line-height:1;transition:color .15s}
.aap-ticker-close:hover{color:#fff}
#aap-ticker:hover .aap-ticker-inner{animation-play-state:paused}

/* ══════════════════════════════════════════════════════════════════
   10. AI-generated spec table (Top-5 roundups)
══════════════════════════════════════════════════════════════════ */

table.aap-ai-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  margin:1.4em 0;
  font-size:.9rem;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:1px solid var(--aap-line);
  border-radius:12px;
  overflow:hidden;
  box-shadow:var(--aap-shadow);
}
table.aap-ai-table thead th,table.aap-ai-table thead td{
  background:linear-gradient(135deg,#312e81 0%,#4f46e5 55%,#7c3aed 100%);
  color:#fff;
  font-weight:700;
  text-align:center;
  padding:13px 12px;
  border:0;
  border-bottom:1px solid var(--aap-line);
}
table.aap-ai-table tbody td,table.aap-ai-table tbody th{
  padding:12px;
  text-align:center;
  vertical-align:middle;
  background:var(--aap-surface);
  color:var(--aap-ink);
  border:0;
  border-bottom:1px solid var(--aap-line);
  border-right:1px solid var(--aap-line);
}
table.aap-ai-table tbody td:last-child,table.aap-ai-table tbody th:last-child{border-right:0}
table.aap-ai-table tbody tr:last-child td,table.aap-ai-table tbody tr:last-child th{border-bottom:0}
table.aap-ai-table tbody tr:nth-child(even) td{background:var(--aap-surface-soft)}
table.aap-ai-table tbody tr > td:first-child,
table.aap-ai-table tbody tr > th:first-child{
  font-weight:700;
  color:var(--aap-ink);
  background:var(--aap-surface-alt);
  width:140px;
  text-align:left;
}
@media(max-width:680px){
  table.aap-ai-table{display:block;overflow-x:auto;white-space:nowrap}
}

/* ══════════════════════════════════════════════════════════════════
   11. ADMIN — analytics, charts, live-preview modal
       (wp-admin only; not part of the theme-proofing layer)
══════════════════════════════════════════════════════════════════ */

.aap-analytics-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin-bottom:20px}
@media(max-width:680px){.aap-analytics-grid{grid-template-columns:1fr}}
.aap-stat-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:18px 20px;text-align:center}
.aap-stat-number{font-size:2rem;font-weight:700;color:var(--aap-primary);line-height:1}
.aap-stat-label{font-size:.78rem;color:#6b7280;margin-top:4px}
.aap-stat-change{font-size:.78rem;margin-top:4px}
.aap-stat-up{color:#16a34a}.aap-stat-down{color:#dc2626}.aap-stat-same{color:#6b7280}
.aap-bar-chart{display:flex;flex-direction:column;gap:8px;margin:12px 0}
.aap-bar-row{display:flex;align-items:center;gap:10px;font-size:.82rem}
.aap-bar-label{width:100px;text-align:right;color:#374151;flex-shrink:0;font-size:.8rem}
.aap-bar-track{flex:1;background:#f3f4f6;border-radius:4px;height:20px;overflow:hidden}
.aap-bar-fill{height:100%;background:var(--aap-primary);border-radius:4px;transition:width .5s ease;min-width:2px}
.aap-bar-val{width:40px;font-weight:600;color:#111827;flex-shrink:0}
.aap-tip-list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:10px}
.aap-tip-list li{background:#fffbeb;border-left:4px solid #FF9900;padding:10px 14px;border-radius:4px;font-size:.88rem;line-height:1.5}
.aap-analytics-header{display:flex;align-items:center;flex-wrap:wrap;gap:16px;margin-bottom:20px}
.aap-date-range-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.aap-date-input{border:1px solid #d1d5db;border-radius:6px;padding:5px 10px;font-size:.85rem;color:#374151}
.aap-charts-row{display:grid;grid-template-columns:2fr 1fr;gap:16px;margin-bottom:20px}
@media(max-width:780px){.aap-charts-row{grid-template-columns:1fr}}
.aap-chart-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:20px;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.aap-chart-wrap{position:relative;height:220px}
.aap-chart-wrap-sm{height:200px}
.aap-analytics-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:20px;box-shadow:0 1px 4px rgba(0,0,0,.06);margin-bottom:16px}
.aap-table-wrap{overflow-x:auto}
.aap-mini-bar{height:8px;background:#f3f4f6;border-radius:4px;overflow:hidden;min-width:80px}
.aap-mini-bar-fill{height:100%;background:#FF9900;border-radius:4px}
.aap-type-legend{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.aap-legend-item{display:flex;align-items:center;gap:5px;font-size:.78rem;color:#4b5563}
.aap-legend-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}

.aap-ref-card-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.aap-modal{position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center}
.aap-modal-overlay{position:absolute;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(3px)}
.aap-modal-box{position:relative;background:#fff;border-radius:12px;box-shadow:0 24px 64px rgba(0,0,0,.25);width:90vw;max-width:900px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}
.aap-modal-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;flex-shrink:0}
.aap-modal-header h2{margin:0;font-size:1.05rem}
.aap-modal-close{background:none;border:none;font-size:1.4rem;cursor:pointer;color:#6b7280;line-height:1;padding:4px 8px;border-radius:6px}
.aap-modal-close:hover{background:#f3f4f6;color:#111}
.aap-modal-body{padding:20px;overflow-y:auto;flex:1}
.aap-preview-controls{padding-bottom:16px;border-bottom:1px solid #f3f4f6;margin-bottom:16px}
.aap-preview-row label{display:block;font-size:.82rem;font-weight:600;color:#374151;margin-bottom:4px}
.aap-preview-row input{margin-top:2px}
.aap-preview-output{border:1px solid #e5e7eb;border-radius:8px;padding:20px;background:#fff;margin-top:12px}
.aap-preview-sc-badge{display:inline-block;background:#1e1e2e;color:#a5f3fc;font-family:monospace;font-size:.78rem;padding:6px 12px;border-radius:6px;margin-top:10px}

/* ══════════════════════════════════════════════════════════════════
   10. RELATED ARTICLES BOX (v4.23)

   Placed between sections by the writer. Same two house rules as every
   other surface here: descendant margins are zeroed (host themes put
   margins on p/span and they stack), and every surface declares BOTH a
   background and an ink colour so nothing inherits dark-on-dark.
══════════════════════════════════════════════════════════════════ */

.aap-related{
  display:block;
  margin:2em 0;
  padding:18px 18px 20px;
  background:var(--aap-surface-alt,#f8fafc);
  color:var(--aap-ink,#0f172a);
  border:1px solid var(--aap-line,#e2e8f0);
  border-left:4px solid var(--aap-primary,#1e3a5f);
  border-radius:14px;
}
.aap-related *{margin:0;padding:0}
.aap-related__head{
  display:block;
  margin-bottom:14px !important;
  font-size:.74rem;
  font-weight:800;
  letter-spacing:.11em;
  text-transform:uppercase;
  color:var(--aap-ink-muted,#64748b);
}
.aap-related__grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
}
.aap-related__card{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  background:var(--aap-surface,#ffffff);
  color:var(--aap-ink,#0f172a);
  border:1px solid var(--aap-line,#e2e8f0);
  border-radius:11px;
  text-decoration:none !important;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.aap-related__card:hover{
  transform:translateY(-2px);
  border-color:var(--aap-primary,#1e3a5f);
  box-shadow:0 8px 20px rgba(15,23,42,.10);
  color:var(--aap-ink,#0f172a);
}
.aap-related__thumb{flex:0 0 62px;width:62px;height:62px;border-radius:8px;overflow:hidden;background:var(--aap-surface-alt,#f1f5f9)}
.aap-related__thumb img{width:100%;height:100%;object-fit:cover;display:block}
.aap-related__text{display:flex;flex-direction:column;gap:4px;min-width:0}
.aap-related__kicker{
  font-size:.64rem;
  font-weight:800;
  letter-spacing:.09em;
  text-transform:uppercase;
  color:var(--aap-primary,#1e3a5f);
}
.aap-related__title{
  font-size:.92rem;
  font-weight:700;
  line-height:1.35;
  color:var(--aap-ink,#0f172a);
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
@media(max-width:560px){
  .aap-related{padding:14px}
  .aap-related__grid{grid-template-columns:1fr}
}
