/* Toilet Alarm — price alerts.
   Revamped 11/08/2026 on the same design tokens as the Windows desktop app, so the two surfaces
   read as one product. Every selector the JS touches is preserved:
   .flash .matched .empty .below .fresh .empty-row .d-time .d-match .d-channel .d-text  */

:root {
  /* one palette — slate with a blue-violet bias, one accent, gold reserved for "this matched" */
  --canvas:  #0B0E14;
  --surface: #131826;
  --raised:  #1A2032;
  --border:  #242C40;
  --text:    #EAEEF7;
  --muted:   #8892A6;
  --faint:   #5A6379;
  --accent:  #5B8CFF;
  --accent2: #3D6FE0;
  --green:   #35C08A;
  --red:     #E5484D;
  --amber:   #F2C14E;
  /* legacy aliases kept so any stray rule/inline style still resolves */
  --bg: var(--canvas);
  --panel: var(--surface);

  --r: 12px;            /* radius */
  --r-sm: 8px;
  --sp: 8px;            /* spacing unit — everything is a multiple */
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(91, 140, 255, 0.3); }

/* thin scrollbars everywhere — the default light one broke the dark surface */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ── top nav ──────────────────────────────────────────────────────────── */
.topnav {
  display: flex; align-items: center; gap: var(--sp);
  padding: 10px 22px;
  background: var(--canvas);
}
.topnav a {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px;
  transition: background .15s, color .15s, border-color .15s;
}
.topnav a:hover { color: var(--text); background: var(--raised); }
.topnav a.active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ── header ───────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp); flex-wrap: wrap;
  padding: 14px 22px;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
header h1 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.2px;
}
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── controls ─────────────────────────────────────────────────────────── */
button {
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .06s;
}
button:hover { background: var(--raised); color: var(--text); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent2); border-color: var(--accent2); color: #fff; }

.sel, .vol {
  display: flex; align-items: center; gap: var(--sp);
  font-size: 12px; color: var(--faint);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
}
.sel select {
  background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 30px 7px 10px; font-size: 13px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238892A6'%3E%3Cpath d='M4.2 6.1l3.8 3.8 3.8-3.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.sel select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* range input — the native one renders as a grey OS slider */
.vol input[type=range] {
  width: 120px; height: 4px; appearance: none;
  background: var(--border); border-radius: 999px; cursor: pointer;
}
.vol input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.vol input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0;
}
#vol-pct { color: var(--muted); font-variant-numeric: tabular-nums; text-transform: none; }

.status { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── stop-alarm button (unchanged behaviour, restyled) ─────────────────── */
.stop-floating {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: none;
  background: var(--red); border: 0; color: #fff;
  font-size: 17px; font-weight: 700; letter-spacing: .3px;
  padding: 18px 30px; border-radius: 14px; cursor: pointer;
  box-shadow: 0 10px 34px rgba(229, 72, 77, .45);
  animation: bigpulse .9s ease-in-out infinite alternate;
}
.stop-floating.active { display: block; }
.stop-floating:hover { background: #C93B3F; }
.stop-floating:active { transform: scale(.97); }
@keyframes bigpulse {
  from { box-shadow: 0 0 0 0 rgba(229, 72, 77, .6), 0 10px 34px rgba(0,0,0,.4); }
  to   { box-shadow: 0 0 0 16px rgba(229, 72, 77, 0), 0 10px 34px rgba(0,0,0,.4); }
}

/* ── layout ───────────────────────────────────────────────────────────── */
main { max-width: 960px; margin: 26px auto 64px; padding: 0 22px; }
section + section { margin-top: 34px; }

h2 {
  font-size: 12px; font-weight: 700; margin: 0 0 12px;
  text-transform: uppercase; letter-spacing: .8px; color: var(--faint);
  display: flex; align-items: baseline; gap: var(--sp); flex-wrap: wrap;
}
.hint { color: var(--faint); font-weight: 500; font-size: 12px; text-transform: none; letter-spacing: 0; }

/* ── alert card ───────────────────────────────────────────────────────── */
.alert-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 22px 24px;
  transition: box-shadow .6s, border-color .6s;
}
.alert-card.flash {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, .25), 0 0 40px rgba(242, 193, 78, .3);
}
.empty-msg { color: var(--faint); }

.alert-content .row1 { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.ticker { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; }
.chain {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); background: var(--raised);
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border);
}
.name { color: var(--muted); margin-bottom: 10px; font-size: 14px; }
.ca {
  font-family: var(--mono); font-size: 12px; color: var(--faint);
  word-break: break-all; margin-bottom: 16px; user-select: all;
}
.mcap-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 15px; margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.direction-badge {
  background: var(--green); color: #08130D; font-weight: 800;
  padding: 3px 9px; border-radius: 6px; font-size: 11px;
  letter-spacing: .5px; text-transform: uppercase;
}
.direction-badge.below { background: var(--red); color: #fff; }
.threshold, .current { font-weight: 700; }
.current { font-size: 21px; color: var(--green); }
.threshold-label, .now-label, .arrow { color: var(--faint); font-size: 13px; }

.links { display: flex; gap: var(--sp); flex-wrap: wrap; margin-bottom: 10px; }
.links a {
  color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600;
  background: var(--raised); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.links a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.received-at { color: var(--faint); font-size: 11px; }

/* ── tables ───────────────────────────────────────────────────────────── */
#hist-table, #wl-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; font-size: 13px;
}
#hist-table th, #hist-table td,
#wl-table th, #wl-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
#hist-table th, #wl-table th {
  background: var(--raised); font-size: 11px; color: var(--faint);
  font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  position: sticky; top: 0;
}
#hist-table tr:last-child td, #wl-table tr:last-child td { border-bottom: none; }
#hist-table tbody tr { transition: background .15s; }
#hist-table tbody tr:hover { background: var(--raised); }
#hist-table tr.matched { background: rgba(53, 192, 138, .07); }
#hist-table tr.matched:hover { background: rgba(53, 192, 138, .12); }
#hist-table .verdict { font-weight: 700; font-size: 12px; }
#hist-table .verdict.matched { color: var(--green); }
#hist-table .verdict.ignored { color: var(--faint); font-weight: 600; }
#hist-table .verdict.ignored .reason { color: var(--faint); font-weight: 400; font-size: 11px; }
#hist-table .empty-row td { color: var(--faint); text-align: center; padding: 26px; }
#hist-table .ticker-cell { font-weight: 700; }
#hist-table td.time { color: var(--faint); font-size: 12px; white-space: nowrap;
                      font-variant-numeric: tabular-nums; }
#hist-table td { font-variant-numeric: tabular-nums; }

#wl-table input {
  width: 100%; background: var(--canvas); color: var(--text);
  border: 1px solid var(--border); padding: 7px 9px; border-radius: var(--r-sm);
  font-size: 13px; font-family: inherit;
}
#wl-table input:focus { outline: none; border-color: var(--accent); }
#wl-table button.del {
  background: transparent; border: none; color: var(--faint); cursor: pointer;
  font-size: 16px; padding: 2px 6px;
}
#wl-table button.del:hover { color: var(--red); background: transparent; }

.wl-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.wl-help { margin-top: 16px; color: var(--muted); font-size: 13px; }
.wl-help summary { cursor: pointer; color: var(--faint); font-weight: 600; }
.wl-help summary:hover { color: var(--text); }
.wl-help p { line-height: 1.6; }
.wl-help code, code {
  background: var(--raised); padding: 2px 6px; border-radius: 5px;
  font-family: var(--mono); font-size: 12px;
}

/* ── feeds (deploys / redacted / money share one visual language) ─────── */
.deploys-feed-wrap, .redacted-feed-wrap, .money-feed-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  max-height: 280px; overflow-y: auto;
}
.deploy-feed, .redacted-feed, .money-feed { list-style: none; margin: 0; padding: 0; }
.deploy-feed li, .redacted-feed li, .money-feed li {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; display: flex; gap: 10px; align-items: baseline;
}
.deploy-feed li:last-child, .redacted-feed li:last-child, .money-feed li:last-child {
  border-bottom: none;
}
.deploy-feed li.empty-row, .redacted-feed li.empty-row, .money-feed li.empty-row {
  color: var(--faint); justify-content: center; padding: 26px;
}
.deploy-feed li.fresh, .redacted-feed li.fresh, .money-feed li.fresh {
  animation: deploy-fade 4s ease-out forwards;
}
@keyframes deploy-fade {
  from { background: rgba(53, 192, 138, .22); }
  to   { background: transparent; }
}
.d-time    { color: var(--faint); font-size: 12px; white-space: nowrap; min-width: 62px;
             font-variant-numeric: tabular-nums; }
.d-match   { color: var(--green); font-weight: 700; }
.d-channel { color: var(--accent); font-size: 12px; white-space: nowrap; }
.d-text    { color: var(--text); flex: 1; overflow-wrap: anywhere; }

/* ── textareas ────────────────────────────────────────────────────────── */
.deploys-wl, .redacted-wl { margin-top: 16px; }
.deploys-wl label, .redacted-wl label {
  display: block; font-size: 12px; color: var(--faint); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
}
.deploys-wl textarea, .redacted-wl textarea {
  width: 100%; resize: vertical;
  background: var(--canvas); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
}
.deploys-wl textarea { min-height: 120px; }
.redacted-wl textarea { min-height: 90px; }
.deploys-wl textarea:focus, .redacted-wl textarea:focus {
  outline: none; border-color: var(--accent);
}

input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── narrow screens: the page is opened on the phone too ──────────────── */
@media (max-width: 640px) {
  header { padding: 12px 16px; }
  .controls { gap: var(--sp); }
  main { padding: 0 16px; margin-top: 18px; }
  .ticker { font-size: 23px; }
  .alert-card { padding: 18px 16px; }
  #hist-table { font-size: 12px; }
  #hist-table th, #hist-table td { padding: 8px 9px; }
  .vol input[type=range] { width: 90px; }
}
