/* ===== Approved tickers page (26 Oct): #/ticker-whitelist =====
   Markup: index.html #page-ticker-whitelist → .wrap.wl. Data: GET /api/ticker-whitelist (4 Nov; the
   app's own whitelist), assets/data/tickers.json as the marked fallback. Behaviour:
   assets/js/whitelist.js (renders the grid and counts, filters as you type). The look is the Rules
   page's: white page, a white search card with a hairline border and soft shadow, a lavender count
   pill, small white tiles, a light blue notice. No animation beyond the input's focus ring.
   States (4 Nov): grey placeholder tiles while loading; the sync line under the heading for a
   verified list; the amber .wl__warn notice (the Rules page's alert colours), an amber count pill
   and dashed tiles for an unverified list. */
#page-ticker-whitelist .sub {
  background: #fff;
}
.wl {
  position: relative;
  z-index: 1;
}
.sub .wl h1 {
  font-weight: 600;
  color: var(--ink);
}
.wl__hl {
  color: var(--blue);
}

/* ---- search card ---- */
.wl__search {
  margin-top: 32px;
  max-width: 720px;
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 20px;
  padding: 20px 22px 18px;
  box-shadow: 0 10px 40px rgba(20, 20, 120, 0.06);
}
.wl__search label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.wl__field {
  position: relative;
}
.wl__field svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  color: var(--ink-2);
  pointer-events: none;
}
/* the id outranks mobile.css's generic phone input rule */
#whitelist .wl__field input {
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  color: var(--ink);
  width: 100%;
  min-height: 52px;
  padding: 12px 52px 12px 46px;
  border-radius: 14px;
  border: 1.5px solid #c9ccef;
  background: #fff;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
#whitelist .wl__field input::placeholder {
  color: #6f7394;
  opacity: 1;
}
#whitelist .wl__field input:hover {
  border-color: #a9aee6;
}
#whitelist .wl__field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 43, 245, 0.2);
}
#whitelist .wl__field input::-webkit-search-cancel-button,
#whitelist .wl__field input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
#whitelist .wl__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
#whitelist .wl__clear:hover {
  background: var(--lav);
  color: var(--ink);
}
#whitelist .wl__clear:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
#whitelist .wl__clear[hidden] {
  display: none;
}
.sub .wl__count {
  margin: 10px 0 0;
  min-height: 1.4em;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}

/* ---- the grid ---- */
.wl__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 44px 0 16px;
}
.sub .wl__head h2 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.wl__total {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--lav);
  border: 1px solid #cfd3f7;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.wl__total:empty {
  display: none;
}
.wl__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.wl__grid[hidden] {
  display: none;
}
.wl__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 8px;
  background: #fbfbff;
  border: 1px solid var(--line-d);
  border-radius: 12px;
  box-shadow: inset 0 -2px 0 rgba(43, 43, 245, 0.1); /* the quiet blue accent */
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.wl__tile[hidden] {
  display: none;
}
.wl__empty,
.wl__fail {
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 16px;
}
.wl__empty b {
  display: block;
  font-size: 16px;
  color: var(--ink);
}
.sub .wl__empty p,
.sub .wl__fail p {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.wl__fail a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wl__empty[hidden],
.wl__fail[hidden] {
  display: none;
}
.wl__noscript {
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}

/* ---- notice ---- */
.wl__note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 28px;
  padding: 16px 18px;
  background: #f3f5ff;
  border: 1px solid #d6daf8;
  border-radius: 14px;
}
.wl__note svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--blue);
}
.sub .wl__note p {
  margin: 0;
  max-width: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

/* ---- states (4 Nov): loading, verified, unverified ---- */
.wl__tile--skel {
  color: transparent;
  background: #f1f2f8;
  border-color: transparent;
  box-shadow: none;
}
.sub .wl__sync {
  margin: -6px 0 14px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}
.wl__sync[hidden] {
  display: none;
}
.wl__warn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 18px;
  background: #fff8e6;
  border: 1px solid #e3c98a;
  border-radius: 14px;
}
.wl__warn svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: #9a6b00;
}
.sub .wl__warn p {
  margin: 0;
  max-width: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.wl__warn[hidden],
.wl__warn p[hidden] {
  display: none;
}
#whitelist .wl__retry {
  margin-top: 10px;
  min-height: 36px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  background: #fff;
  border: 1px solid #cfd3f7;
  border-radius: 999px;
  cursor: pointer;
}
#whitelist .wl__retry:hover,
#whitelist .wl__retry:focus-visible {
  border-color: var(--blue);
}
#whitelist .wl__retry:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
#whitelist .wl__retry[disabled] {
  opacity: 0.6;
  cursor: default;
}
.wl__total--unverified {
  background: #fff8e6;
  border-color: #e3c98a;
  color: #7a5500;
}
.is-unverified .wl__tile {
  background: #fff;
  border-style: dashed;
  box-shadow: none;
}
.wl__none {
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 16px;
}
.wl__none b {
  display: block;
  font-size: 16px;
  color: var(--ink);
}
.sub .wl__none p {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.wl__none a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wl__none[hidden] {
  display: none;
}

/* ---- tablets and phones ---- */
@media (max-width: 1024px) {
  .wl__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* 27 Oct (Task 3.5): the × that clears the search is a 44px target on touch screens (36px stays on
   desktop browsers, 1024px included); the input keeps 48–52px of right padding, so it never sits over
   the typed symbol */
@media (max-width: 1024px) and (pointer: coarse) {
  #whitelist .wl__clear {
    width: 44px;
    height: 44px;
    right: 4px;
  }
}
@media (max-width: 768px) {
  .wl__search {
    margin-top: 26px;
    max-width: none;
    padding: 18px 18px 16px;
    border-radius: 18px;
  }
  #whitelist .wl__field input {
    min-height: 50px;
    padding: 12px 48px 12px 44px;
  }
  .wl__head {
    margin: 36px 0 14px;
  }
  .wl__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .wl__tile {
    min-height: 48px;
    padding: 8px 6px;
  }
  .wl__empty,
  .wl__fail,
  .wl__none {
    padding: 18px;
  }
  .wl__warn {
    padding: 12px 14px;
  }
}
/* 27 Oct (Task 3.5): phones (320–440px) show two columns, as the mobile plan asks; three columns
   gave 93–120px tiles at 375–440px. Tablets from 441px keep three, 769–1024px four, desktop six. */
@media (max-width: 440px) {
  .wl__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  #whitelist .wl__field input {
    transition: none;
  }
}
