/* CynchUp — surgical teal + slate, "spec plate" listing aesthetic. Mobile-first. */

:root {
  --ink: #101826;
  --ink-soft: #3d4a5c;
  --muted: #71808f;
  --paper: #f6f8f6;
  --card: #ffffff;
  --line: #dce3df;
  --teal: #0e7c7b;
  --teal-deep: #0a5453;
  --teal-wash: #e3f0ef;
  --signal: #e8623d;          /* live auctions / alerts */
  --signal-wash: #fdeee8;
  --gold: #b98a2f;            /* wholesale */
  --ok: #2e7d4f;
  --err: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 38, .06), 0 8px 24px -12px rgba(16, 24, 38, .18);
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Instrument Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
[data-theme="dark"] {
  --ink: #e8edf2;
  --ink-soft: #b6c2cf;
  --muted: #8593a3;
  --paper: #0f1519;
  --card: #171f26;
  --line: #26313a;
  --teal: #2ea8a5;
  --teal-deep: #7fd6d2;
  --teal-wash: #12302f;
  --signal: #f07a55;
  --signal-wash: #3a1f16;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img, video { max-width: 100%; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
.mono, .spec, .price { font-family: var(--font-mono); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ── header / footer (public) ── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 58px; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; color: var(--ink); letter-spacing: -.02em; }
.logo b { color: var(--teal); font-weight: 800; }
.logo:hover { text-decoration: none; }
.nav-links { display: none; gap: 18px; margin-left: 8px; }
.nav-links a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.header-cta { margin-left: auto; display: flex; gap: 10px; align-items: center; }
@media (min-width: 760px) { .nav-links { display: flex; } }

.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 36px 0 90px; color: var(--muted); font-size: .9rem; }
.site-footer .cols { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h3 { color: var(--ink); font-size: .95rem; }
.site-footer a { color: var(--muted); display: block; padding: 3px 0; }

/* ── buttons & forms ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--teal); color: #fff; border: 1px solid var(--teal);
  padding: 10px 18px; border-radius: 999px; font: 600 .95rem var(--font-body);
  cursor: pointer; transition: background .15s, transform .1s;
  text-decoration: none !important;
}
.btn:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--teal); }
.btn.ghost:hover { background: var(--teal-wash); }
.btn.subtle { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.subtle:hover { background: var(--teal-wash); border-color: var(--teal); }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn.signal { background: var(--signal); border-color: var(--signal); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: 400 .95rem var(--font-body);
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-wash); }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin: 12px 0 4px; }
.field-row { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.form-err { color: var(--err); font-size: .88rem; margin-top: 8px; min-height: 1em; }

/* ── hero ── */
.hero { padding: 44px 0 26px; }
.hero .eyebrow { font: 600 .78rem var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.hero p.lede { max-width: 46ch; color: var(--ink-soft); font-size: 1.06rem; }
.hero-search { display: flex; gap: 8px; margin: 18px 0 10px; max-width: 640px; }
.hero-search input { height: 52px; font-size: 1.02rem; border-radius: 14px; }
.hero-search .btn { height: 52px; border-radius: 14px; padding: 0 22px; flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font: 500 .84rem var(--font-body); color: var(--ink-soft);
  border: 1px solid var(--line); background: var(--card);
  padding: 6px 13px; border-radius: 999px;
}
.chip:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
.chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ── listing cards & spec plate ── */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.card .thumb { aspect-ratio: 4/3; background: var(--teal-wash); display: grid; place-items: center; position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .noimg { font: 600 .78rem var(--font-mono); color: var(--teal); opacity: .7; letter-spacing: .08em; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .title { font-weight: 600; font-size: .93rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { font-size: 1rem; font-weight: 600; margin-top: auto; }
.price .cur { font-size: .72em; color: var(--muted); margin-left: 3px; }
.price.ask { color: var(--muted); font-size: .88rem; font-weight: 500; }

/* the spec plate: machined equipment-tag strip */
.spec-plate {
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  font: 500 .72rem var(--font-mono); color: var(--ink-soft);
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(16,24,38,.015) 6px 12px);
}
.spec-plate span { padding: 3px 8px; border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.spec-plate span:last-child { border-right: 0; }
.spec-plate .k { color: var(--muted); margin-right: 4px; text-transform: uppercase; font-size: .92em; letter-spacing: .05em; }

.badge {
  display: inline-block; font: 700 .66rem var(--font-mono); letter-spacing: .09em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px; border: 1px solid currentColor;
}
.badge.new { color: var(--ok); }
.badge.used { color: var(--ink-soft); }
.badge.refurbished { color: var(--gold); }
.badge.for_parts { color: var(--err); }
.badge.live { color: var(--signal); background: var(--signal-wash); border-color: transparent; }
.badge.rent { color: var(--teal); }
.badge.tag { color: var(--muted); }
.badge.live .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 5px; animation: pulse 1.6s infinite; vertical-align: 1px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.section-head .more { margin-left: auto; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.section-head h2 { margin: 0; }

/* ── listing detail ── */
.detail { display: grid; gap: 24px; margin-top: 20px; }
@media (min-width: 900px) { .detail { grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); align-items: start; } }
.gallery .main { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--teal-wash); aspect-ratio: 4/3; display: grid; place-items: center; }
.gallery .main img, .gallery .main video, .gallery .main iframe { width: 100%; height: 100%; object-fit: contain; border: 0; background: #000; }
.gallery .strip { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery .strip button { flex: none; width: 72px; height: 54px; border-radius: 8px; border: 2px solid var(--line); overflow: hidden; padding: 0; background: var(--teal-wash); cursor: pointer; }
.gallery .strip button.active { border-color: var(--teal); }
.gallery .strip img { width: 100%; height: 100%; object-fit: cover; }
.gallery .strip .vid { display: grid; place-items: center; font-size: 1.2rem; color: var(--teal); width: 100%; height: 100%; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.price-lg { font-size: 1.9rem; font-weight: 700; }
.geo-note { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.geo-note.blocked { color: var(--err); }
.seller-card { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font: 700 1.05rem var(--font-display); flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ── tables ── */
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 560px; }
.tbl th { text-align: left; font: 600 .72rem var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover { background: var(--teal-wash); }

/* ── app shell ── */
.app-shell { display: flex; min-height: 100dvh; }
.app-rail {
  display: none; flex-direction: column; gap: 2px; width: 218px; flex: none;
  border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--card);
}
.app-rail .logo { padding: 6px 10px 16px; }
.app-rail a.nav {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--ink-soft); font-weight: 500; font-size: .93rem;
}
.app-rail a.nav:hover { background: var(--teal-wash); text-decoration: none; }
.app-rail a.nav.active { background: var(--teal); color: #fff; }
.app-rail .nav .ico { width: 20px; text-align: center; }
.app-rail .spacer { flex: 1; }
.app-main { flex: 1; min-width: 0; padding: 16px 16px 96px; }
@media (min-width: 900px) { .app-rail { display: flex; } .app-main { padding: 22px 28px 40px; } }
.app-topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.app-topbar h1 { margin: 0; font-size: 1.4rem; }
.app-topbar .grow { flex: 1; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; text-align: center; padding: 8px 0 7px; color: var(--muted); font-size: .62rem; font-weight: 600; }
.tabbar a .ico { display: block; font-size: 1.25rem; line-height: 1.2; }
.tabbar a.active { color: var(--teal); }
.tabbar a:hover { text-decoration: none; }
@media (min-width: 900px) { .tabbar { display: none; } }

.badge-dot { position: relative; }
.badge-dot[data-n]:not([data-n="0"])::after {
  content: attr(data-n); position: absolute; top: -4px; right: -10px;
  background: var(--signal); color: #fff; font: 700 .6rem var(--font-body);
  min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px;
}

/* stat tiles */
.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font: 700 1.5rem var(--font-display); }
.stat .l { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ── anahi sidebar ── */
.anahi-fab {
  position: fixed; right: 16px; bottom: 76px; z-index: 46;
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff; font: 700 1rem var(--font-display);
  box-shadow: var(--shadow); display: grid; place-items: center;
}
@media (min-width: 900px) { .anahi-fab { bottom: 24px; } }
.anahi-panel {
  position: fixed; z-index: 60; background: var(--card);
  inset: auto 0 0 0; height: 86dvh; border-radius: 18px 18px 0 0;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: none; flex-direction: column; overflow: hidden;
}
.anahi-panel.open { display: flex; }
@media (min-width: 900px) {
  .anahi-panel { inset: auto 20px 20px auto; width: 400px; height: min(640px, 86dvh); border-radius: 16px; }
}
.anahi-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--teal-wash); }
.anahi-head .who { font: 700 1rem var(--font-display); }
.anahi-head .sub { font-size: .74rem; color: var(--muted); }
.anahi-head button { margin-left: auto; }
.anahi-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.anahi-tabs button {
  border: 0; background: none; cursor: pointer; padding: 7px 13px; font: 600 .84rem var(--font-body);
  color: var(--muted); border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent;
}
.anahi-tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }
.anahi-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: .92rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; color: var(--muted); font-size: .78rem; background: none; }
.anahi-input { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.anahi-input textarea { resize: none; height: 44px; border-radius: 12px; }
.typing { display: inline-flex; gap: 4px; padding: 10px 6px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }

/* ── chat threads (messages) ── */
.threads { display: flex; flex-direction: column; }
.thread-item { display: flex; gap: 12px; padding: 13px 6px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.thread-item:hover { background: var(--teal-wash); }
.thread-item .prev { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item .meta { margin-left: auto; text-align: right; font-size: .72rem; color: var(--muted); flex: none; }
.chat-log { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; min-height: 40vh; }

/* ── toasts / modals ── */
.toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); animation: slidein .2s ease; }
[data-theme="dark"] .toast { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.toast.err { background: var(--err); color: #fff; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } }
.modal-scrim { position: fixed; inset: 0; background: rgba(10, 16, 24, .55); z-index: 70; display: grid; place-items: center; padding: 14px; }
.modal { background: var(--card); border-radius: 16px; width: min(680px, 100%); max-height: 92dvh; overflow-y: auto; padding: 22px; }

/* newsletter bug */
.news-bug { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 24px; margin-top: 40px; }
[data-theme="dark"] .news-bug { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.news-bug h2 { color: inherit; }
.news-bug form { display: flex; gap: 8px; max-width: 440px; margin-top: 12px; }
.news-bug p { opacity: .8; font-size: .92rem; }

/* upload zone */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--muted); cursor: pointer; background: var(--card); transition: border-color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--teal); color: var(--teal); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.media-grid .m { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--teal-wash); }
.media-grid .m img { width: 100%; height: 100%; object-fit: cover; }
.media-grid .m .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: .7rem; }
.media-grid .m .k { position: absolute; left: 4px; bottom: 4px; font: 600 .6rem var(--font-mono); background: rgba(0,0,0,.55); color: #fff; padding: 2px 6px; border-radius: 4px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--teal); width: 0; transition: width .2s; }

/* utility */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 28px; }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty .big { font-size: 2rem; }
.hidden { display: none !important; }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pill-tabs button { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); padding: 7px 14px; border-radius: 999px; font: 600 .85rem var(--font-body); cursor: pointer; }
.pill-tabs button.active { background: var(--teal); border-color: var(--teal); color: #fff; }

@media print {
  .site-header, .site-footer, .tabbar, .anahi-fab, .anahi-panel, .app-rail, .btn { display: none !important; }
  body { background: #fff; }
}
