/* FlipRadar. Handwritten, phone first, light only. Works from 320px up. */

:root {
  --ground: #F6F5F2; --surface: #FFFFFF; --ink: #1B1A17; --ink-2: #4A4740; --muted: #7A756C;
  --line: #E7E3DB; --line-2: #D8D3C9;
  --accent: #1F4FD8; --accent-deep: #173FB0; --accent-soft: #E3EAFB;
  --great: #1E8A55; --great-soft: #DDF3E7; --fair: #C4860A; --fair-soft: #FBEFD2;
  --over: #8A8177; --over-soft: #ECE8E1;
  --danger: #B3261E; --danger-soft: #FBE4E1;
  --radius: 14px; --radius-s: 9px;
  --shadow: 0 1px 2px rgba(27,26,23,.06), 0 8px 24px -12px rgba(27,26,23,.18);
  --display: "Bricolage Grotesque", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: "Manrope", "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
p a, .sub a, .why a, .muted a, .small a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
code { font-size: .9em; background: var(--over-soft); padding: 1px 5px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }

/* ---------- app frame ---------- */
.app { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); padding-block: 0 96px; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--ground);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 14px 10px; border-bottom: 1px solid transparent;
  margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand svg { width: 30px; height: 30px; flex: 0 0 auto; }
.brand b { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.brand b span { color: var(--accent); }
.where {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
.where svg { width: 14px; height: 14px; }
.desknav { display: none; gap: 4px; }
.desknav a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--ink-2); }
.desknav a[aria-current="page"] { background: var(--ink); color: #fff; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 8px; }
.topright { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* ---------- account menu ---------- */
.usermenu { position: relative; }
.usermenu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px;
  font-weight: 600; font-size: 13px; max-width: 46vw;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 14px; flex: 0 0 auto;
}
.usermenu .uname { display: none; padding-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu[open] > summary { border-color: var(--ink); }
.usermenu .menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 6px;
}
.usermenu .who { color: var(--muted); font-size: 12px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--ink); }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--ground); }
.usermenu .menu a[aria-current="page"] { color: var(--accent-deep); }
.usermenu .menu form { margin: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); min-width: 64px; padding: 4px 6px; border-radius: 10px;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent-deep); }
.tabbar .badge {
  position: absolute; top: 0; left: 50%; transform: translate(6px, -2px);
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px;
}

.screenhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-block: 14px 12px; }
.screenhead h1 { font-size: 30px; font-weight: 800; line-height: 1.05; }
.screenhead .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.screenhead .sub b { color: var(--accent-deep); font-weight: 700; }
.screenhead > .btn { flex: 0 0 auto; }
.empty { padding: 24px 0; }

/* ---------- chips ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-block: 2px 12px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; padding-block: 4px 8px; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.great { color: var(--great); }
.chip.great.on { background: var(--great); border-color: var(--great); color: #fff; }
.chip.check { color: var(--muted); border-style: dashed; }
.chip.check.on { background: var(--over); border-color: var(--over); border-style: solid; color: #fff; }
.chip small, .chip .n { color: var(--muted); font-weight: 600; margin-left: 5px; font-size: 12px; }
.chip.on small, .chip.on .n { color: rgba(255,255,255,.75); }
.chip.clickable:hover, .chip.city:hover { border-color: var(--accent); color: var(--accent-deep); }
.chip.off { color: var(--muted); }
.chip.state-fetching { border-color: var(--accent); }
.chip.state-fetching .n { color: var(--accent); }
.chip.state-done .n { color: var(--great); }
.chip.state-blocked, .chip.state-error { border-color: var(--danger); }
.chip.state-blocked .n, .chip.state-error .n { color: var(--danger); }
.chip.state-disabled .n { color: var(--fair); }

/* ---------- deal cards (the feed) ---------- */
.feed { display: grid; grid-template-columns: 1fr; gap: 14px; }
.deal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; text-align: left; width: 100%; min-width: 0; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.deal .hit { display: grid; grid-template-columns: 132px 1fr; min-width: 0; color: inherit; }
.deal:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.deal.dismissed { opacity: .55; }
/* The action row: Open in the accent, the other two ghosted; every button a thumb's height. */
.cardactions { display: flex; gap: 8px; padding: 0 12px 12px; min-width: 0; }
.cardactions .btn { min-height: 40px; padding: 8px 12px; font-size: 13px; }
.cardactions .btn.open { flex: 0 0 auto; }
.cardactions .btn.ghost { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
.cardactions .btn svg { width: 15px; height: 15px; }
.deal .cardpanel { padding: 0 12px 12px; }
.deal .cardpanel .words { margin-top: 0; }
.btn.done, .btn.ghost.done { background: var(--great-soft); color: var(--great); border-color: var(--great); }
.copyfallback {
  display: block; width: calc(100% - 24px); margin: 0 12px 12px; font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--ground); color: var(--ink); resize: none; min-height: 64px;
}
.sheet .copyfallback { width: 100%; margin: 10px 0 0; }
.deal .ph { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--over-soft); overflow: hidden; }
.deal .ph img, .sheet .hero img, .card .photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.placeholder, .card .ph {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  font-size: 28px; color: var(--over); background: linear-gradient(135deg, var(--over-soft), #f7f4ee); user-select: none;
}
.deal .ph .src {
  position: absolute; top: 8px; left: 8px; background: rgba(27,26,23,.72); color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; padding: 3px 6px; border-radius: 6px;
}
.deal .body { padding: 12px 14px 12px 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pricerow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.label {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 9px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; line-height: 1.2;
}
.label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.label.great { background: var(--great-soft); color: var(--great); }
.label.fair { background: var(--fair-soft); color: var(--fair); }
.label.over { background: var(--over-soft); color: var(--over); }
/* "Needs a price check": muted, hollow dot, dashed edge. Not a verdict, a question. */
.label.check { background: var(--surface); color: var(--muted); border: 1px dashed var(--line-2); }
.label.check::before { background: transparent; border: 1.5px solid currentColor; width: 6px; height: 6px; }
.deal .title {
  font-weight: 600; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); overflow-wrap: anywhere;
}
.deal .est { font-size: 12.5px; color: var(--ink-2); }
.deal .est b { font-weight: 700; }
.deal .meta {
  font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0;
  white-space: nowrap; overflow: hidden; margin-top: auto;
}
.deal .meta .place { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.deal .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); flex: 0 0 auto; }
.deal .meta .wl {
  margin-left: auto; flex: 0 1 auto; background: var(--ground); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 7px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis;
}
.daybreak { grid-column: 1 / -1; font-weight: 700; font-size: 14px; color: var(--ink); padding: 4px 2px 0; margin-bottom: -4px; }
.daybreak small { font-weight: 600; color: var(--muted); margin-left: 8px; font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; }
.pill.on { background: var(--great-soft); color: var(--great); }
.pill.off { background: var(--over-soft); color: var(--muted); }
.pill.drop { background: var(--fair-soft); color: var(--fair); }
.pill.stale { background: var(--accent-soft); color: var(--accent-deep); }
.pill.hot { background: var(--accent); color: #fff; vertical-align: middle; margin-left: 4px; }
.deal .age, .sheet .age { font-size: 12px; color: var(--muted); }
.deal .age b, .sheet .age b { color: var(--ink-2); font-weight: 600; }
.dismissed-note .chip, .deal .dismissed-note .chip { padding: 1px 7px; font-size: 11px; margin-left: 4px; }
@media (max-width: 359px) {
  .deal .hit { grid-template-columns: 108px 1fr; }
  .deal .body { padding: 10px 10px 10px 10px; }
  .cardactions { padding: 0 10px 10px; gap: 6px; }
  .cardactions .btn { padding-inline: 8px; font-size: 12.5px; }
}

/* ---------- search ---------- */
.searchbar {
  display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1.5px solid var(--line-2);
  border-radius: 999px; padding: 6px 6px 6px 14px; margin-bottom: 4px;
}
.searchbar > svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--muted); }
.searchbar input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; min-width: 0; color: var(--ink); }
.searchbar input::placeholder { color: var(--muted); }
.searchbar .go { background: var(--ink); color: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.searchbar .go:hover { background: var(--accent-deep); }
.livebar { display: flex; align-items: center; gap: 10px; padding-block: 12px 10px; font-size: 13px; color: var(--ink-2); }
.livebar.progress { padding-block: 4px 10px; }
.livebar .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31,79,216,.45); }
  70% { box-shadow: 0 0 0 9px rgba(31,79,216,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,79,216,0); }
}
@media (prefers-reduced-motion: reduce) { .livebar .pulse { animation: none; } .deal { transition: none; } }
.livebar .prog { flex: 1 1 40px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; min-width: 24px; }
.livebar .prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }
.live-note { color: var(--muted); }
.live.off { margin: 4px 0 12px; }
.livehead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.livehead h2 { font-size: 18px; }
.livecontrols { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1 1 260px; }
.live .filter, .live .sort {
  min-width: 0; padding: 8px 12px; font: inherit; font-size: 14px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--surface); color: var(--ink);
}
.live .filter { flex: 1 1 140px; }
.citychips { padding-block: 2px 10px; }
@media (min-width: 700px) { .citychips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } }

.block { margin: 0 0 22px; }
.block > h2 { margin-bottom: 8px; }
.block > h2 .muted { font-weight: 600; font-size: 14px; font-family: var(--body); }
.block h3 { font-family: var(--body); font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 0 8px; letter-spacing: .02em; }

/* listing tiles: 2 columns on a phone, 3 from 700px, 4 from 900px, 5 from 1180px. Every part
   has a fixed height (square photo, 1-line price, 2-line title, 1-line meta) so a row of tiles
   is one height whatever the content. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.grid > .card[hidden] { display: none; }
.card {
  display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.card .photo { display: block; position: relative; aspect-ratio: 1 / 1; background: var(--over-soft); flex: 0 0 auto; overflow: hidden; }
.card .photo .pill.new { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; }
.card .photo .label { position: absolute; left: 8px; bottom: 8px; }
.card .body { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 11px; }
.card .price { display: block; font-size: 18px; line-height: 1.2; height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .price small { font-family: var(--body); font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.card .title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; font-weight: 600; line-height: 1.3; height: 2.6em; overflow-wrap: anywhere;
}
.card .meta { display: flex; align-items: center; gap: 5px; min-width: 0; height: 1.5em; font-size: 11.5px; color: var(--muted); }
.card .meta .txt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink-2); background: var(--ground); border: 1px solid var(--line); vertical-align: middle; white-space: nowrap;
}
.card .meta .badge { flex: 0 0 auto; }
.badge.city { color: var(--accent-deep); background: var(--accent-soft); border-color: transparent; }
.linkouts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.btn.linkout { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-2); padding: 8px 14px; font-size: 13.5px; }
.btn.linkout:hover { background: var(--ground); border-color: var(--accent); }
.openall-note { display: inline-block; margin-left: 8px; }

/* ---------- buttons and notices ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 11px 18px;
  font-weight: 700; font-size: 14.5px; background: var(--accent); color: #fff; transition: background .15s; white-space: nowrap;
  border: 1.5px solid transparent; line-height: 1.2; text-decoration: none;
}
.btn:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--ground); }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn svg { width: 18px; height: 18px; }
.btn.small svg { width: 15px; height: 15px; }
.notice { background: var(--fair-soft); color: var(--fair); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 12px; font-weight: 600; }
.error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 12px; font-weight: 600; }
.flash { background: var(--great-soft); color: var(--great); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 12px; font-weight: 600; }
.flash a { color: inherit; text-decoration: underline; }
.warn { color: var(--fair); font-weight: 700; }
.warnrow td { background: var(--fair-soft); }

/* ---------- watchlists ---------- */
.aibox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.aibox h2 { font-size: 20px; font-weight: 800; }
.aibox p { margin: 6px 0 12px; color: var(--ink-2); font-size: 13.5px; }
.aibox textarea, .refine textarea, .composeform textarea {
  display: block; width: 100%; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font: inherit;
  font-size: 15px; min-height: 84px; resize: vertical; background: var(--ground); color: var(--ink);
}
.aibox textarea[disabled] { opacity: .6; min-height: 64px; }
.aibox .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.aibox .hint, .hint { font-size: 12.5px; color: var(--muted); }
.composeactions { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.compose-result { margin-top: 14px; }
.compose-result .usage { display: inline-block; }
.wlist { display: flex; flex-direction: column; gap: 10px; }
.wl {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
}
.wl.paused { opacity: .7; }
.wl .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); }
.wl .ic svg { width: 22px; height: 22px; }
.wl .ic.car { background: var(--over-soft); color: var(--ink-2); }
.wl .ic.radar { background: var(--ground); color: var(--ink-2); }
.wl .wlbody { min-width: 0; }
.wl h3 { font-size: 15.5px; font-weight: 700; font-family: var(--body); letter-spacing: 0; overflow-wrap: anywhere; }
.wl .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wl .d b { color: var(--ink-2); font-weight: 600; }
.wl .d b a { color: inherit; text-decoration: none; }
.wl .d b a:hover { text-decoration: underline; }
.wl .wlactions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.wl .wlactions .muted { flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl .wlactions form { display: inline; }
.switch { display: block; width: 46px; height: 28px; border-radius: 999px; background: var(--great); position: relative; transition: background .15s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 21px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s;
}
.switch.off { background: var(--line-2); }
.switch.off::after { left: 3px; }
@media (min-width: 560px) { .wl .wlactions .muted { flex: 1 1 auto; } }

/* ---------- forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.form label { display: block; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
.form label input:not([type="checkbox"]):not([type="radio"]), .form label textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; font-weight: 400; font-size: 15px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--ground); color: var(--ink);
}
.form label textarea { resize: vertical; min-height: 64px; }
.form label small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 12.5px; }
.form label.check { font-weight: 500; display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.form label.check.disabled { color: var(--muted); }
.form input[type="checkbox"], .form input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px 4px; margin: 0 0 14px; }
.form legend { font-weight: 700; padding: 0 6px; font-size: 14px; }
.form .checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 2px 12px; }
.form .row { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.formactions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.form fieldset.speed .hotswitch { font-weight: 600; flex-wrap: wrap; }
.form fieldset.speed .hotswitch .muted { flex: 1 1 100%; padding-left: 25px; font-weight: 400; }
.form fieldset.speed .hotfields { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }
.form fieldset.speed .hotfields[hidden] { display: none; }
.form fieldset.speed select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; font-size: 15px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--ground); color: var(--ink);
}
.form fieldset.speed .hotcities .lbl { display: block; font-weight: 600; font-size: 14px; margin: 4px 0 6px; }
.form fieldset.speed label.check.dim { color: var(--muted); }
.form .budgetline { margin: 8px 0 6px; color: var(--ink-2); }
.form .budgetline:empty { display: none; }
.form .budgetline.over { color: var(--danger); font-weight: 600; }
.form details.advanced { margin: 0 0 14px; }
.form details.advanced > summary { cursor: pointer; font-weight: 700; font-size: 14px; padding: 6px 0; color: var(--ink-2); }
.form details.advanced[open] > summary { margin-bottom: 8px; }
.form details.advanced fieldset .row { margin-top: 4px; }
.form details.advanced fieldset > small { display: block; margin: 0 0 10px; font-size: 12.5px; }
@media (min-width: 560px) { .form .row { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) { .form.panel { max-width: 760px; } }

/* ---------- watchlist composer: describe -> proposal cards -> save ---------- */
.proposals { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0 0 12px; }
.form.proposal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; max-width: none; min-width: 0; }
.form.proposal.saved { background: var(--great-soft); border-color: var(--great); }
.form.proposal.saved .flash { margin: 0; }
.proposal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.proposal-head h3 { margin: 0; color: var(--ink); font-size: 17px; overflow-wrap: anywhere; }
.proposal .rationale { margin: 6px 0 8px; color: var(--ink-2); }
.proposal .assumptions { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.proposal .notice { margin: 0 0 8px; }
.proposal .budget { margin: 0 0 8px; color: var(--muted); }
.proposal .budget.warn { color: var(--fair); }
.proposal .summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 0 0 10px; font-size: 13.5px; }
.proposal .summary dt { color: var(--muted); }
.proposal .summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.proposal details.fields { border-top: 1px solid var(--line); padding-top: 8px; margin: 0 0 8px; }
.proposal details.fields summary { cursor: pointer; font-weight: 700; margin-bottom: 10px; }
.proposal details.fields .chips { display: none; }
.preview, .livepass, .livepass-slot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.livepass-slot .livepass { border-top: 0; padding-top: 0; margin-top: 0; }
.livepass-slot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview h4, .livepass h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.listings { list-style: none; margin: 0; padding: 0; }
.listings li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.listings li:first-child { border-top: 0; }
.listings li a { font-weight: 600; }
.listings .meta { color: var(--muted); font-size: 12.5px; }
.refine { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.refine label { display: block; font-weight: 700; font-size: 14px; }
.refine label small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 12.5px; }
.refine textarea { margin-top: 6px; min-height: 64px; }
.refine .composeactions { margin-top: 10px; margin-left: 0; }
.diff { margin-top: 12px; }
.diff .after { color: var(--great); }
.diff .rationale { margin: 0 0 8px; }
@media (min-width: 960px) { .proposals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; margin-top: 2px; line-height: 1.1; overflow-wrap: anywhere; }
.kpi .v small { font-size: 13px; color: var(--muted); font-weight: 600; font-family: var(--body); margin-left: 4px; letter-spacing: 0; }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.chart h3 { font-size: 14px; font-family: var(--body); font-weight: 700; }
.chart svg { width: 100%; height: auto; margin-top: 8px; }
.chart .chips { padding-block: 8px 0; }
h2.details { margin: 28px 0 4px; }
.details + p { margin: 0 0 12px; }

/* tables: real rows from 720px, stacked cards below */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; vertical-align: top; border-top: 1px solid var(--line); }
thead th { border-top: 0; color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
table.numbers td:not(:first-child), table.numbers th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 719px) {
  .tablewrap { background: none; border: 0; }
  table.cards thead { display: none; }
  table.cards tr { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; margin-bottom: 10px; background: var(--surface); }
  table.cards td { display: flex; gap: 10px; border: 0; padding: 4px 0; }
  table.cards td::before { content: attr(data-label); flex: 0 0 6em; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
  table.numbers.cards td { text-align: left; }
  table.numbers.cards td::before { flex-basis: 7em; text-transform: none; }
}

/* ---------- deal sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(27,26,23,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none !important; }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92%; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 0 0 calc(18px + env(safe-area-inset-bottom, 0px)); position: relative;
}
.sheet-page .sheet { max-height: none; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 auto; }
.sheet-page .grab, .sheet-page .close { display: none; }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 10px auto 6px; }
.sheet .hero { aspect-ratio: 4 / 3; background: var(--over-soft); position: relative; overflow: hidden; }
.sheet .hero .placeholder { font-size: 56px; }
.sheet .hero .label { position: absolute; left: 14px; bottom: 14px; font-size: 13px; padding: 6px 11px; }
.sheet .close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.9);
  display: grid; place-items: center; font-size: 22px; line-height: 1; color: var(--ink);
}
.sheet .in { padding: 14px 18px 0; }
.sheet .price { font-size: 30px; }
.sheet h2 { font-size: 18px; font-weight: 700; font-family: var(--body); letter-spacing: 0; margin-top: 6px; overflow-wrap: anywhere; text-wrap: pretty; }
.sheet .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sheet.dismissed .hero { opacity: .6; }
.guide { margin-top: 16px; background: var(--ground); border-radius: 12px; padding: 12px 14px; }
.guide .t { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); flex-wrap: wrap; }
.guide .bar {
  position: relative; height: 10px; border-radius: 5px; margin: 14px 0 6px;
  background: linear-gradient(90deg, var(--great) 0 33.3%, var(--fair) 33.3% 66.7%, var(--over) 66.7% 100%); opacity: .9;
}
.guide .marker { position: absolute; top: -6px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); transform: translateX(-50%); }
.guide .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; }
.guide .why { font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.guide .why.muted { color: var(--muted); margin-top: 6px; font-size: 12.5px; }
/* Open spans the row; Not for me and Copy message share the second, each thumb-sized. */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.actions .btn { min-width: 0; min-height: 44px; }
.actions .btn.open { grid-column: 1 / -1; }
.actions .btn svg { flex: 0 0 auto; }
.panel:empty { display: none; }
.words { margin-top: 12px; padding: 12px 14px; background: var(--ground); border-radius: 12px; }
.words p { margin: 0 0 6px; font-size: 13.5px; }
.words .chips { padding-block: 4px 10px; }
.sheet .dismissed-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- login, signup, reset ---------- */
/* Column, not row: the beta banner is a sibling of the card wrapper, and in a row it
   became a tall strip down the left of every signed-out page. */
.authpage { min-height: 100dvh; display: flex; flex-direction: column; }
.authwrap { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: 40px var(--gutter) 32px; display: flex; flex-direction: column; gap: 18px; }
.authwrap .brand { justify-content: center; }
.authwrap .brand svg { width: 36px; height: 36px; }
.authwrap .brand b { font-size: 26px; }
.authcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; }
.authcard h1 { font-size: 26px; font-weight: 800; margin-bottom: 12px; }
.authcard .flash, .authcard .error { margin-bottom: 14px; }
.authform label { display: block; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
.authform label input, .authform label select {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font: inherit; font-weight: 400; font-size: 16px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--ground); color: var(--ink);
}
.authform label input[readonly] { color: var(--muted); }
.authform label small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 12.5px; }
.btn.wide { width: 100%; justify-content: center; min-height: 46px; margin-top: 4px; }
.authhelp { margin: 14px 0 0; text-align: center; text-wrap: pretty; }
.authfoot { text-align: center; color: var(--muted); font-size: 12px; margin: 0; text-wrap: balance; }

/* ---------- account and admin ---------- */
.twocol { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
.twocol .panel h2 { margin-bottom: 12px; }
.form.panel select, .authform select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; font-size: 15px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--ground); color: var(--ink);
}
.devices h2, .block h2 + .tablewrap, #invites h2 { margin-bottom: 10px; }
.devices .formactions { margin-top: 12px; }
.pill.on { background: var(--accent-soft); color: var(--accent-deep); }
.rowactions { display: flex; gap: 6px; flex-wrap: wrap; }
.rowactions form { margin: 0; }
tr.disabledrow td { color: var(--muted); }
.linkbox { margin-bottom: 18px; border-color: var(--accent); }
.linkbox h2 { margin-bottom: 4px; }
.copyrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.copyrow .linkfield {
  flex: 1 1 220px; min-width: 0; padding: 10px 12px; font: inherit; font-size: 13.5px; border: 1.5px solid var(--line-2);
  border-radius: var(--radius-s); background: var(--ground); color: var(--ink); font-variant-numeric: tabular-nums;
}
.inviteform { margin-bottom: 12px; }
.inviteform .row { grid-template-columns: 1fr; }
.admintable td { overflow-wrap: anywhere; }
.limitsform { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; }
.limitsform label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; color: var(--ink-2); }
.limitsform input:not([type="checkbox"]) { width: 3.2em; padding: 4px 6px; font: inherit; border: 1.5px solid var(--line-2); border-radius: 6px; background: var(--ground); text-align: right; }
.limitsform input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
@media (max-width: 719px) {
  table.cards td.rowactions { display: flex; }
  table.cards td.rowactions::before { display: none; }
  table.cards td[data-label=""]::before { display: none; }
}

/* ---------- Telegram panel and nudges ---------- */
.tgblock { margin-bottom: 18px; }
.tgblock h2 { margin-bottom: 4px; }
.tgblock > .muted { margin: 0 0 10px; }
.tgpanel .tgstate { margin: 0 0 10px; }
.tgpanel .flash.tgstate { margin-bottom: 10px; }
.tgcode { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin: 0 0 8px; }
.tgcode .codebox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.code { font-size: 15px; padding: 5px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; user-select: all; }
.linkbtn { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; font-size: inherit; }
form.inline { display: inline; }
.nudge {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); color: var(--accent-deep);
  border-radius: var(--radius-s); padding: 10px 12px 10px 14px; margin: 0 0 12px; font-weight: 600;
}
.nudge[hidden] { display: none; }
.nudge > span { flex: 1 1 auto; min-width: 0; }
.nudge .btn.small { background: var(--accent-deep); }
.nudge .dismiss { font-size: 20px; line-height: 1; padding: 4px 8px; color: inherit; opacity: .7; }
.nudge .dismiss:hover { opacity: 1; }

/* ---------- beta banner, welcome steps, checklist, prose pages ---------- */
.beta { background: var(--ink); color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 6px var(--gutter); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.step .stepnum { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font-family: var(--display); font-weight: 800; }
.step.done .stepnum { background: var(--great-soft); color: var(--great); }
.step .stepbody { min-width: 0; }
.step h2 { font-size: 18px; margin-bottom: 2px; }
.step .stepbody > .muted { margin: 0 0 10px; }
.inlineform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inlineform select { flex: 1 1 220px; padding: 10px 12px; font: inherit; font-size: 15px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--ground); color: var(--ink); min-width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.step .composeform { margin-top: 6px; }
.welcomefoot { margin: 16px 0 0; }
.checklist { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; }
.checklist .checkhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.checklist .checkhead a { margin-left: auto; text-decoration: underline; }
.checklist ol { margin: 8px 0 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.checklist li a { color: var(--accent-deep); font-weight: 600; }
.checklist li.done { list-style: none; margin-left: -20px; padding-left: 20px; position: relative; color: var(--muted); }
.checklist li.done::before { content: "\2713"; position: absolute; left: 0; color: var(--great); font-weight: 800; }
.checklist li.done a { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.prose { max-width: 680px; padding: 8px 0 24px; }
.prose h1 { font-size: 28px; font-weight: 800; margin: 6px 0 10px; }
.prose h2 { font-size: 18px; margin: 22px 0 6px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15px; line-height: 1.55; text-wrap: pretty; }
.prose ul { padding-left: 20px; }
.prose p a { color: var(--accent-deep); text-decoration: underline; }
.authcard .prose { padding: 0; }
.authcard .prose h1 { font-size: 24px; }
.authlinks a { color: var(--accent-deep); text-decoration: underline; }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  .app { padding-block: 0 40px; }
  .topbar { padding-block: 18px 14px; }
  .desknav { display: flex; }
  .tabbar { display: none; }
  .screenhead h1 { font-size: 36px; }
  .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .deal .hit { grid-template-columns: 1fr; }
  .deal .ph { aspect-ratio: 4 / 3; }
  /* Desktop cards are narrow (272px in four columns): Open takes its own row so "Not for me"
     and "Copy message" each get a full half and never clip. */
  .cardactions { flex-wrap: wrap; }
  .cardactions .btn.open { flex: 1 1 100%; }
  .deal .body { padding: 12px 14px 14px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usermenu .uname { display: inline; max-width: 160px; }
  .twocol { grid-template-columns: 1fr 1fr; }
  .inviteform .row { grid-template-columns: 2fr 1fr; }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 20px; max-height: 88%; }
  .sheet .grab { display: none; }
  .chips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; }
}
@media (min-width: 1180px) {
  .feed { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
