/* ─── SmartDirect listing template (eBay description) ────────────────
   Scoped under #template-container so eBay's surrounding chrome is
   unaffected. Loaded via <link> inside buildDescription()'s output. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Full-width cream sheet sitting outside the 760px content column.
   eBay's sanitizer strips body-level background rules but accepts class
   rules on inner elements, so we wrap the column in this canvas div to
   get edge-to-edge cream behind the listing. */
.tpl-canvas {
  background: #f4f1ec;
  width: 100%;
  margin: 0;
  padding: 0;
}

#template-container {
  --bg: #f4f1ec;
  --paper: #ffffff;
  --ink: #1a1f2b;
  --ink-2: #5a6472;
  --ink-3: #969da8;
  --accent: #cfe2ff;
  --accent-ink: #0a2547;
  --blue: #1e4fd8;
  --blue-deep: #0a2547;
  --soft: #eaf1fb;
  --warn: #b04a1c;
  --warn-soft: #fbece3;

  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  padding: 28px 28px 56px;
  box-sizing: border-box;
  letter-spacing: -0.005em;
  max-width: 760px;
  margin: 0 auto;
}

/* ─── Store strip ─── */
#template-container .tpl-store {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px 12px 14px;
  background: var(--paper);
  border-radius: 999px;
  margin-bottom: 24px;
}
#template-container .tpl-store-id { display: flex; align-items: center; gap: 14px; }
#template-container .tpl-store-logo {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 8px;
}
#template-container .tpl-store-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
#template-container .tpl-store-rating {
  font-size: 12px; color: var(--ink-2);
  display: flex; gap: 4px;
  align-items: center;
  margin-top: 2px;
}
#template-container .tpl-stars { color: var(--blue); }
#template-container .tpl-store-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}

/* ─── Allstate warranty card (above hero, eligibility-gated) ─── */
#template-container .tpl-warranty {
  background: var(--paper);
  border: 2px solid var(--blue);
  border-radius: 28px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
}
#template-container .tpl-warranty-shield {
  width: 56px; height: 56px;
  background: var(--blue);
  color: #fff;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
}
#template-container .tpl-warranty-shield svg {
  width: 28px;
  height: 28px;
  margin: 0 !important;
  fill: currentColor;
}
#template-container .tpl-warranty-l {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 4px;
}
#template-container .tpl-warranty-h {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 4px;
}
#template-container .tpl-warranty-sub {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
  max-width: 48ch;
}
#template-container .tpl-warranty-badge {
  text-align: center;
  padding: 12px 18px;
  background: var(--soft);
  color: var(--blue-deep);
  border-radius: 14px;
}
#template-container .tpl-warranty-badge-v {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--blue);
}
#template-container .tpl-warranty-badge-l {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
  color: var(--ink-2);
  font-weight: 600;
}

/* ─── Hero card ─── */
#template-container .tpl-hero {
  background: var(--paper);
  border-radius: 28px;
  padding: 40px 36px;
  margin-bottom: 18px;
}
#template-container .tpl-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3a4150;
  margin-bottom: 12px;
}
#template-container .tpl-hero h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  color: var(--ink);
}
#template-container .tpl-hero-var {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
#template-container .tpl-chip {
  background: #f3f0e9;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
}
#template-container .tpl-hero-desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
  margin: 0 0 20px;
}

/* ─── Battery strip ─── */
#template-container .tpl-battery-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--soft);
  border-radius: 18px;
  margin-top: 4px;
}
#template-container .tpl-battery-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-deep);
}
#template-container .tpl-battery-bar {
  height: 8px;
  background: rgba(30,79,216,0.18);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
#template-container .tpl-battery-fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--blue);
  border-radius: 4px;
}
#template-container .tpl-battery-pct {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
}

/* ─── Condition card ─── */
#template-container .tpl-cond {
  background: #1807a1;
  color: #fff;
  border-radius: 28px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}
#template-container .tpl-cond-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 6px;
}
#template-container .tpl-cond-h {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
#template-container .tpl-cond-sub {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
  max-width: 50ch;
  line-height: 1.5;
  opacity: 0.85;
}
#template-container .tpl-cond-grade {
  text-align: center;
  padding: 14px 20px;
  background: #fff;
  color: var(--blue);
  border-radius: 18px;
  min-width: 96px;
}
#template-container .tpl-cond-grade-pct {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
#template-container .tpl-cond-grade-lbl {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 6px;
  color: var(--blue-deep);
  opacity: 0.7;
}

/* For parts / not working: same card structure, deep-red palette
   to signal "buyer beware". Grade tile is suppressed in the PHP
   emission, so the grid degenerates to a single full-width column. */
#template-container .tpl-cond.is-parts {
  background: #a10707;
}

/* ─── Card chrome (reused across carrier, box, process) ─── */
#template-container .tpl-card {
  background: var(--paper);
  border-radius: 24px;
  padding: 24px 26px 26px;
  margin-bottom: 18px;
}
#template-container .tpl-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
#template-container .tpl-section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
#template-container .tpl-section-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  background: var(--soft);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ─── Carrier card ─── */
#template-container .tpl-carrier-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#template-container .tpl-carrier-cell {
  background: #faf8f3;
  border-radius: 16px;
  padding: 16px 18px 18px;
}
#template-container .tpl-carrier-cell-k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}
#template-container .tpl-carrier-cell-v {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.1;
}
#template-container .tpl-carrier-cell-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-2);
}
#template-container .tpl-imei-cell {
  grid-column: 1 / -1;
  background: var(--soft);
  border-radius: 16px;
  padding: 16px 18px 18px;
}
#template-container .tpl-imei-cell-k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-deep);
  margin-bottom: 8px;
  opacity: 0.7;
}
#template-container .tpl-imei-cell-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--blue-deep);
}
#template-container .tpl-imei-cell-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

/* ─── Box card ─── */
#template-container .tpl-box-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
#template-container .tpl-box-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #faf8f3;
  border-radius: 14px;
}
#template-container .tpl-box-tick {
  width: 28px; height: 28px;
  background: var(--blue);
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  flex: 0 0 28px;
  font-weight: 700;
}
#template-container .tpl-box-tick svg {
  width: 14px;
  height: 14px;
  margin: 0 !important;
  vertical-align: middle;
  fill: currentColor;
}
#template-container .tpl-box-text { font-size: 14px; font-weight: 500; color: var(--ink); }

/* ─── Process (Before it ships) ─── */
#template-container .tpl-steps {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
#template-container .tpl-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: #faf8f3;
  border-radius: 16px;
}
#template-container .tpl-step-n {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
}
#template-container .tpl-step-t { font-size: 15px; font-weight: 600; color: var(--ink); }
#template-container .tpl-step-d { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ─── Guarantee card ─── */
#template-container .tpl-guarantee {
  background: var(--blue-deep);
  color: var(--paper);
  border-radius: 28px;
  padding: 32px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
#template-container .tpl-guarantee-eyebrow {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  background: rgba(207,226,255,0.12);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#template-container .tpl-guarantee h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 14px;
  max-width: 16ch;
  color: #fff;
}
#template-container .tpl-guarantee-accent { color: var(--accent); }
#template-container .tpl-guarantee p {
  font-size: 14px;
  color: rgba(255,255,255,0.72);
  max-width: 42ch;
  line-height: 1.55;
  margin: 0 0 24px;
}
#template-container .tpl-promises {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
#template-container .tpl-promise {
  background: rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 18px;
}
#template-container .tpl-promise-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--blue-deep);
  display: grid; place-items: center;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 15px;
}
#template-container .tpl-promise-t {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  color: #fff;
}
#template-container .tpl-promise-d {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
}

/* ─── Footstrip ─── */
#template-container .tpl-footstrip {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

/* ─── Mobile ─── */
@media (max-width: 640px) {
  #template-container {
    padding: 16px 16px 40px;
  }
  #template-container .tpl-stars,
  #template-container .tpl-rating-sep { display: none; }
  #template-container .tpl-cond-grade { display: none; }
  #template-container .tpl-cond { grid-template-columns: 1fr; }
  #template-container .tpl-hero {
    padding: 28px 24px;
  }
  #template-container .tpl-hero h1 {
    font-size: 38px;
  }
  #template-container .tpl-carrier-stack {
    grid-template-columns: 1fr;
  }
  #template-container .tpl-box-items {
    grid-template-columns: 1fr;
  }
  #template-container .tpl-promises {
    grid-template-columns: 1fr;
  }
  #template-container .tpl-guarantee {
    padding: 24px;
  }
  #template-container .tpl-guarantee h2 {
    font-size: 26px;
  }
  #template-container .tpl-warranty {
    grid-template-columns: 48px 1fr;
    row-gap: 14px;
    padding: 20px 22px;
  }
  #template-container .tpl-warranty-shield {
    width: 48px;
    height: 48px;
  }
  #template-container .tpl-warranty-shield svg {
    width: 22px;
    height: 22px;
  }
  #template-container .tpl-warranty-badge {
    grid-column: 1 / -1;
    display: flex;
    gap: 14px;
    align-items: baseline;
    justify-content: flex-start;
    padding: 10px 14px;
  }
  #template-container .tpl-warranty-badge-l {
    margin-top: 0;
  }
}