/* Price Tracker — price drop alerts (options.pricetrackr.in) */
:root {
  --brand: #27b092;
  --brand-ink: #1b7f69;
  --brand-soft: #e6f6f1;
  --amber: #ffbe2c;
  --amber-soft: #fff5dc;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --text: #17231f;
  --muted: #5f6f69;
  --line: #e2e8e5;
  --danger: #d4483b;
  --danger-soft: #fdeceb;
  --shadow: 0 1px 2px rgba(16, 40, 32, .06), 0 4px 16px rgba(16, 40, 32, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #39c4a4;
    --brand-ink: #6fe0c4;
    --brand-soft: #143a31;
    --amber-soft: #3a3016;
    --bg: #0f1614;
    --surface: #17211e;
    --text: #e6eeeb;
    --muted: #9aaba5;
    --line: #2a3733;
    --danger: #f07065;
    --danger-soft: #3a1d1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-ink); }
[hidden] { display: none !important; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 19px; letter-spacing: -.01em; }
.brand b { color: var(--brand); }
.version { font-size: 12px; color: var(--muted); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; }

/* hero */
.hero { background: linear-gradient(135deg, var(--brand-soft), var(--amber-soft)); border-bottom: 1px solid var(--line); }
.hero__inner { display: flex; align-items: center; gap: 24px; padding: 28px 0 20px; }
.hero__text { flex: 1 1 auto; }
.hero__art { flex: 0 0 auto; width: 210px; margin: -6px 0 -14px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); }
h1 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; letter-spacing: -.02em; }
.lede { margin: 0; max-width: 560px; color: var(--muted); font-size: 16px; }
@media (max-width: 640px) {
  .hero__art { width: 120px; }
  .lede { font-size: 15px; }
}
@media (max-width: 420px) { .hero__art { display: none; } }

main { padding: 24px 0 48px; min-height: 50vh; }

/* cards & states */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.state { text-align: center; padding: 40px 24px; }
.state--gate { max-width: 620px; margin: 8px auto; }
.state--gate img { width: 200px; margin-bottom: 8px; }
.state h2, .empty h2 { margin: 6px 0 8px; font-size: 21px; }
.state p, .empty p { margin: 0 auto 6px; max-width: 480px; color: var(--muted); }
.state .hint { font-size: 13px; margin-top: 14px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:focus-visible, .tab:focus-visible, input:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, .seg button:focus-visible, .chip-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.93); }
.btn--danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 2px; }
.tab { font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--line); color: var(--text); font-size: 12px; line-height: 20px; text-align: center; }
.tab[aria-selected="true"] .count { background: var(--brand); color: #fff; }
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; height: 42px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
@media (max-width: 560px) { .tabs { width: 100%; } .tab { flex: 1; padding-inline: 4px; font-size: 13px; } .count { margin-left: 2px; padding: 0 5px; min-width: 20px; } .search { max-width: none; } }

.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--brand-soft); }
.bulkbar__actions { display: flex; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); font-size: 14px; }
.summary { margin: 0 0 10px; color: var(--muted); font-size: 13px; min-height: 1.5em; }

/* alert list */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.alert { position: relative; display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 14px; transition: opacity .2s, transform .2s; }
.alert.is-busy { opacity: .55; pointer-events: none; }
.alert.is-leaving { opacity: 0; transform: scale(.98); }
.alert__select { position: absolute; top: 10px; left: 10px; z-index: 1; background: var(--surface); border-radius: 6px; padding: 3px; line-height: 0; box-shadow: var(--shadow); }
.alert__img { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 10px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.alert__img img { max-width: 84px; max-height: 84px; object-fit: contain; }
.alert__img.no-img img { display: none; }
.alert__img.no-img::after { content: "🛍"; font-size: 34px; }
.alert__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.alert__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); color: var(--text); text-transform: capitalize; }
.pill { padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.pill--on { background: var(--brand-soft); color: var(--brand-ink); }
.pill--off { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.date { margin-left: auto; }
.alert__title { color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alert__title:hover { color: var(--brand-ink); text-decoration: underline; }
.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 0; }
.prices div { background: var(--bg); border-radius: 8px; padding: 5px 8px; min-width: 0; }
.prices dt { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prices dd { margin: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-now.is-lower { color: var(--brand-ink); }
.alert__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.channels { font-size: 12px; color: var(--muted); }
.alert__actions { display: flex; gap: 4px; margin-left: auto; }
@media (max-width: 420px) {
  .alert { grid-template-columns: 64px 1fr; gap: 10px; }
  .alert__img { width: 64px; height: 64px; }
  .alert__img img { max-width: 58px; max-height: 58px; }
  .prices { grid-template-columns: 1fr 1fr; }
  .prices div:last-child { grid-column: span 2; }
}

.empty { text-align: center; padding: 32px 24px; }
.empty img { width: 180px; }
.more { text-align: center; margin-top: 18px; }

/* dialog & toasts */
.dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(420px, 100% - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(10, 20, 17, .45); }
.dialog h2 { margin: 0 0 6px; font-size: 19px; }
.dialog p { margin: 0; color: var(--muted); }
.dialog .actions { justify-content: flex-end; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(420px, 100% - 32px); }
.toast { background: #17231f; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease-out; }
.toast--error { background: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.footer { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 13px; }
/* unsubscribed alerts */
.alert--off { border-style: dashed; background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.alert__banner {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -14px -14px 0; padding: 8px 14px 8px 46px; border-radius: var(--radius) var(--radius) 0 0;
  background: repeating-linear-gradient(-45deg, var(--bg) 0 10px, color-mix(in srgb, var(--line) 70%, var(--bg)) 10px 20px);
  border-bottom: 1px dashed var(--line); color: var(--muted); font-size: 13px;
}
.alert__banner svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert__banner b { color: var(--text); }
.alert__banner-text { flex: 1 1 auto; }
.alert--off .alert__select { top: 8px; }
.alert__img { position: relative; }
.alert__off { display: none; }
.alert--off .alert__img img { filter: grayscale(1); opacity: .55; }
.alert--off .alert__off {
  display: block; position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; text-align: center;
  font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #fff; background: rgba(23, 35, 31, .72);
}
.alert--off .alert__title, .alert--off .prices dd { color: var(--muted); }
.alert--off .p-now.is-lower { color: var(--muted); }

/* price graph */
.alert__foot-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand-ink); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dialog--graph { width: min(760px, 100% - 24px); padding: 18px 20px 18px; }
.graph__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.graph__heading { min-width: 0; }
.graph__heading h2 { margin: 6px 0 0; font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icon-btn { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-btn:focus:not(:focus-visible) { outline: none; }
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.graph__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.graph__stats div { background: var(--bg); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.graph__stats dt { font-size: 12px; color: var(--muted); }
.graph__stats dd { margin: 0; font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.graph__stats dd.is-low { color: var(--brand-ink); }
.graph__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); }
.seg button { font: inherit; font-size: 13px; font-weight: 700; border: 0; background: none; color: var(--muted); padding: 4px 11px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.seg button:disabled { opacity: .4; cursor: default; }
.graph__legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.graph__legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 5px; }
.graph__legend .lg-price { border-color: var(--brand); }
.graph__legend .lg-set { border-color: var(--muted); border-top-style: dashed; }
.graph__legend .lg-target { border-color: var(--amber); border-top-style: dashed; }
.graph__box { position: relative; height: 280px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; touch-action: pan-y; }
.graph__box svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.graph__state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }
.graph__state .spinner { margin: 0 0 8px; }
.g-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.g-label { fill: var(--muted); font-size: 11px; }
.g-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.g-area { fill: var(--brand); opacity: .12; }
.g-set { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.g-target { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.g-cross { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.g-dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.g-low { fill: var(--brand); }
.graph__tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); background: #17231f; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow); }
.graph__tip b { font-size: 14px; }
.graph__note { font-size: 12px; color: var(--muted); margin: 8px 0 0 !important; min-height: 1em; }
@media (max-width: 560px) {
  .graph__stats { grid-template-columns: repeat(2, 1fr); }
  .graph__box { height: 220px; }
  .dialog--graph { padding: 14px; }
}

/* contacts */
.contact { padding: 14px 16px; margin-bottom: 16px; display: flex; gap: 16px 24px; align-items: center; flex-wrap: wrap; }
.contact__head { flex: 1 1 240px; min-width: 0; }
.contact__head h2 { margin: 0 0 2px; font-size: 16px; }
.contact__head p { margin: 0; color: var(--muted); font-size: 13px; }
.contact__rows { flex: 2 1 420px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.contact__row { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.contact__row > svg { flex: 0 0 auto; width: 20px; height: 20px; fill: none; stroke: var(--brand-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact__row > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.contact__label { font-size: 12px; color: var(--muted); }
.contact__value { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact__value.is-empty { font-weight: 500; color: var(--muted); }
.badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); }
.dialog--contact { width: min(420px, 100% - 32px); }
.field { display: block; margin: 12px 0 4px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field__input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 12px; }
.field__input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.field__input span { color: var(--muted); font-weight: 700; margin-right: 6px; }
.field__input input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; outline: none; padding-right: 12px; }
.field__input input.otp { letter-spacing: .5em; font-weight: 800; font-size: 20px; text-align: center; padding-left: .5em; }
#ct-timer { color: var(--muted); }

/* edit dialog */
.dialog--edit { width: min(460px, 100% - 32px); }
.edit__product { font-weight: 600; color: var(--text) !important; margin: 0 0 4px !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.edit__setat { font-size: 14px; margin: 0 0 14px !important; }
.dialog fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0 0 12px; }
.dialog legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.radio { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 15px; }
.radio input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.radio:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
.muted { color: var(--muted); font-size: 13px; }
.edit__target { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px 28px; }
.edit__target[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.money { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 10px; }
.money:focus-within { border-color: var(--brand); }
.money span { color: var(--muted); font-weight: 600; }
.money input { width: 120px; height: 40px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700; padding: 0 10px 0 4px; outline: none; }
.presets { display: flex; gap: 6px; }
.chip-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.field-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0 !important; }
.form-error { color: var(--danger) !important; font-size: 14px; min-height: 1.2em; margin: 0 0 4px !important; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
