:root {
  --void: #0a0e1a;
  --panel: #111827;
  --card: #1f2937;
  --border: #374151;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --green: #22c55e;
  --green-dim: #16a34a;
  --ink: #032;
  --warn: #f0d48a;
  --danger: #f87171;
  --max: 1080px;
  --gutter: clamp(1rem, 3vw, 1.75rem);
  --nav-h: 3.4rem;
  --radius: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--void); color: var(--text); font-family: var(--font); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code { font-family: var(--mono); font-size: 0.85em; color: var(--green); }
.req { color: var(--green); }

.tv-wrap { width: min(100%, calc(var(--max) + var(--gutter) * 2)); margin: 0 auto; padding: 1.25rem var(--gutter) 2.5rem; }
.tv-nav {
  display: flex; align-items: center; gap: 0.75rem 1rem;
  min-height: var(--nav-h);
  width: min(100%, calc(var(--max) + var(--gutter) * 2));
  margin: 0 auto; padding: 0.55rem var(--gutter);
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(34, 197, 94, 0.35);
}
.tv-brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; font-weight: 700; text-decoration: none; margin-right: auto; }
.tv-brand:hover { text-decoration: none; }
.tv-brand-em { color: var(--green); }
.tv-brand img { display: block; border-radius: 6px; }
.tv-links { display: flex; gap: 0.85rem; margin-left: auto; align-items: center; overflow-x: auto; }
.tv-links a, .tv-more > summary {
  color: var(--muted); font-size: 0.9rem; cursor: pointer; list-style: none;
}
.tv-links a.active, .tv-links a:hover, .tv-more > summary:hover { color: #fff; }
.tv-more { position: relative; flex-shrink: 0; }
.tv-more > summary::-webkit-details-marker { display: none; }
.tv-more-panel {
  position: absolute; right: 0; top: calc(100% + 0.35rem);
  min-width: 9rem; padding: 0.45rem; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border); z-index: 50;
  display: grid; gap: 0.25rem;
}
.tv-more-panel a { color: var(--muted); font-size: 0.88rem; padding: 0.35rem 0.5rem; display: block; }
.tv-more-panel a:hover, .tv-more-panel a.active { color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.7rem 1.1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: linear-gradient(90deg, var(--green), var(--green-dim)); color: var(--ink); }
.btn-primary:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: #fff; }
.btn-ghost:hover { border-color: var(--green); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.78rem; }

.tv-hero {
  width: min(100%, calc(var(--max) + var(--gutter) * 2));
  margin: 0 auto; padding: 2.5rem var(--gutter) 1.5rem;
}
.tv-eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
.tv-hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.1; margin: 0.5rem 0 0.85rem; letter-spacing: -0.02em; }
.tv-lede { color: var(--muted); max-width: 48ch; font-size: 1.05rem; line-height: 1.5; }
.tv-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0.75rem; }
.tv-note { font-size: 0.82rem; color: var(--muted); }
.tv-steps-preview { border-top: 1px solid var(--border); padding: 1.25rem var(--gutter) 2rem; width: min(100%, calc(var(--max) + var(--gutter) * 2)); margin: 0 auto; }
.tv-steps-preview ol { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; padding: 0; margin: 0; }
.tv-steps-preview ol.tv-steps-6 { grid-template-columns: repeat(3, 1fr); }
.tv-steps-preview li { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; font-size: 0.85rem; }
.tv-steps-preview span { display: inline-flex; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--green); color: var(--ink); align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; margin-right: 0.35rem; }

.tv-pagehead h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 0.35rem; }
.tv-pagehead p { color: var(--muted); margin: 0 0 1rem; }

.tv-steps { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }
.tv-steps .step {
  flex: 1; text-align: center; padding: 0.55rem 0.35rem; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); font-size: 0.72rem; opacity: 0.45;
}
.tv-steps .step.active { opacity: 1; border-color: var(--green); background: #14291f; }
.tv-steps .num {
  display: inline-flex; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--border); align-items: center; justify-content: center; margin-bottom: 0.2rem;
}
.tv-steps .step.active .num { background: var(--green); color: var(--ink); }

.tv-searchbar { display: flex; gap: 0.5rem; margin-bottom: 0.35rem; }
.tv-searchbar input,
.tv-searchbar .tv-input {
  flex: 1; padding: 0.7rem 0.9rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: #fff; font: inherit;
}
.tv-search-display {
  font-size: 0.82rem; color: var(--green); margin: 0 0 0.65rem; font-family: var(--mono);
}
.tv-map {
  height: min(52vh, 480px); min-height: 280px; width: 100%;
  border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; z-index: 1;
}
.tv-hint { font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 0.75rem; }
.tv-hint strong { color: var(--green); font-weight: 600; }
.tv-warn {
  border: 1px solid rgba(232, 184, 74, 0.45); background: rgba(232, 184, 74, 0.1);
  color: var(--warn); padding: 0.7rem 0.9rem; border-radius: 8px; font-size: 0.88rem; margin-bottom: 0.75rem;
}
.tv-panel { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.tv-panel .card,
.tv-lawyer .card {
  flex: 1; min-width: 220px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem;
}
.tv-panel h3, .tv-buy-panel h3, .tv-lawyer h3 { margin: 0 0 0.6rem; color: var(--green); font-size: 0.95rem; }
.tv-panel p { margin: 0.3rem 0; font-size: 0.88rem; color: var(--muted); }
.tv-panel .value, .tv-buy-panel .value { color: #fff; font-weight: 700; font-size: 1.05rem; }
.tv-panel .btn { width: 100%; margin-top: 0.75rem; }

.tv-field-label {
  display: block; font-size: 0.78rem; color: var(--muted); margin: 0.65rem 0 0.25rem;
}
.tv-field-hint { font-size: 0.78rem; color: var(--muted); margin: 0.35rem 0 0.5rem; }
.tv-input, .tv-textarea {
  width: 100%; padding: 0.55rem 0.65rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--void); color: #fff; font: inherit;
}
.tv-input:disabled { opacity: 0.45; cursor: not-allowed; }
.tv-price-input { font-size: 1.15rem; font-weight: 700; color: var(--green); font-family: var(--mono); }
.tv-textarea { resize: vertical; min-height: 4.5rem; }
select.tv-input { cursor: pointer; }

.tv-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 999;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.tv-modal[hidden] { display: none !important; }
.tv-modal-box {
  background: var(--card); border: 1px solid var(--green); border-radius: 14px;
  padding: 1.25rem; width: min(100%, 380px); max-height: 90vh; overflow: auto;
}
.tv-modal-wide { width: min(100%, 440px); }
.tv-modal-box h3 { margin: 0 1.5rem 0.5rem 0; color: var(--green); }
.tv-modal-box label { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.65rem; }
.tv-modal-box input[type="text"],
.tv-modal-box input[type="tel"],
.tv-modal-box input[type="email"],
.tv-modal-box input[type="file"] {
  width: 100%; margin-top: 0.25rem; padding: 0.55rem 0.65rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--void); color: #fff; font: inherit;
}
.tv-modal-close { float: right; background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.tv-check { display: grid !important; grid-template-columns: auto 1fr; gap: 0.55rem; align-items: start; margin-top: 0.9rem !important; font-size: 0.72rem !important; line-height: 1.4; color: var(--muted) !important; }
.tv-check input { margin-top: 0.15rem; }
.tv-modal-box .btn { width: 100%; margin-top: 0.9rem; }

.tv-toast {
  position: fixed; bottom: 1.1rem; right: 1.1rem; z-index: 1000;
  background: #14291f; border: 1px solid var(--green); padding: 1rem 1.1rem;
  border-radius: 10px; max-width: 320px;
}
.tv-toast[hidden] { display: none !important; }
.tv-toast h4 { margin: 0 0 0.35rem; color: var(--green); }
.tv-toast p { margin: 0; font-size: 0.85rem; color: var(--muted); }

.tv-prose { max-width: 58ch; }
.tv-prose ul, .tv-flow { padding-left: 1.2rem; }
.tv-flow li { margin: 0.55rem 0; }
.tv-disclaimer { border-left: 3px solid var(--green); padding: 0.75rem 1rem; background: rgba(34,197,94,0.06); font-size: 0.88rem; }

.tv-listings { list-style: none; padding: 0; display: grid; gap: 0.65rem; }
.tv-listings li,
.tv-listing-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem 1rem;
}
.tv-listing-item { cursor: pointer; transition: border-color 0.15s ease; }
.tv-listing-item:hover, .tv-listing-item.active { border-color: var(--green); background: #14291f; }
.tv-listing-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tv-listing-price { color: var(--green); font-weight: 700; font-size: 1.1rem; margin: 0.35rem 0 0; font-family: var(--mono); }

.tv-market {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
}
@media (min-width: 840px) {
  .tv-market { grid-template-columns: 1.1fr 0.9fr; align-items: start; }
}
.tv-buy-panel, .tv-attest-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem;
  position: sticky; top: calc(var(--nav-h) + 0.75rem);
}
.tv-buy-panel[hidden], .tv-attest-panel[hidden] { display: none !important; }
.tv-buy-title { font-weight: 700; color: #fff; margin: 0 0 0.35rem; }
.tv-escrow-box {
  margin: 0.85rem 0; padding: 0.75rem; border-radius: 8px;
  background: var(--void); border: 1px dashed rgba(34, 197, 94, 0.45);
}
.tv-escrow-addr {
  display: block; word-break: break-all; font-size: 0.82rem; margin: 0.35rem 0;
  color: var(--green);
}
.tv-buy-panel .btn { width: 100%; margin-top: 0.65rem; }
.tv-badge-row { margin: 0.4rem 0 0.6rem; }

.tv-badge {
  display: inline-flex; align-items: center; padding: 0.15rem 0.45rem;
  border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.35);
  text-transform: lowercase;
}
.tv-badge-draft, .tv-badge-pending, .tv-badge-submitted, .tv-badge-review {
  background: rgba(156, 163, 175, 0.12); color: var(--muted); border-color: var(--border);
}
.tv-badge-listed, .tv-badge-active, .tv-badge-approved, .tv-badge-queued {
  background: rgba(34, 197, 94, 0.15); color: var(--green); border-color: rgba(34, 197, 94, 0.35);
}
.tv-badge-escrow {
  background: rgba(240, 212, 138, 0.12); color: var(--warn); border-color: rgba(240, 212, 138, 0.35);
}
.tv-badge-rejected, .tv-badge-failed {
  background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.35);
}

.tv-lawyer { display: grid; gap: 1rem; }
.tv-lawyer-key { margin-bottom: 0.25rem; }
.tv-lawyer .tv-actions { margin-top: 0.75rem; }
.tv-msg-ok { color: var(--green) !important; }
.tv-msg-err { color: var(--danger) !important; }

.tv-deals-bar { margin-bottom: 1.25rem; }
.tv-deals-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tv-deals-cols h2 {
  font-size: 1.05rem;
  margin: 0 0 0.55rem;
  color: var(--green);
}
.tv-market-single { grid-template-columns: 1fr; }
.tv-disclaimer-mini {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0.65rem;
  line-height: 1.4;
}
.tv-listing-links { margin: 0.35rem 0 0; font-size: 0.85rem; }

html.wead-mini-embed .tv-deals-cols { grid-template-columns: 1fr; }

@media (max-width: 700px) {
  .tv-deals-cols { grid-template-columns: 1fr; }
}

.tv-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.tv-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tv-table th, .tv-table td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); }
.tv-table th { color: var(--muted); background: rgba(20,24,36,0.9); }
.tv-admin-actions { white-space: nowrap; }

.tv-foot { border-top: 1px solid var(--border); margin-top: 1rem; }
.tv-foot-inner { padding: 1.1rem var(--gutter); display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }

/* Leaflet.Draw vertex dots — red while drawing, green when polygon closes */
.tv-draw-vertex {
  background: transparent !important;
  border: none !important;
}
.tv-vdot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.tv-vdot-red {
  background: #ef4444;
  border: 2px solid #fff;
}
.leaflet-editing-icon,
.leaflet-div-icon.leaflet-editing-icon {
  background: #ef4444 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  width: 14px !important;
  height: 14px !important;
  margin-left: -7px !important;
  margin-top: -7px !important;
}

/* leaflet-rotate compass control */
.leaflet-control-rotate {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.leaflet-control-rotate a {
  background: rgba(12, 16, 28, 0.92) !important;
  color: #e8edf7 !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
}
.leaflet-control-rotate-hide { display: none !important; }
.tv-hint kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78em;
  background: rgba(255, 255, 255, 0.04);
}

html.wead-mini-embed .tv-foot { display: none !important; }
html.wead-mini-embed, html.wead-mini-embed body { background: var(--void) !important; }
html.wead-mini-embed .tv-map { height: min(46vh, 360px); min-height: 240px; }
html.wead-mini-embed .tv-hero { padding-top: 1.25rem; }
html.wead-mini-embed .tv-steps-preview ol,
html.wead-mini-embed .tv-steps-preview ol.tv-steps-6 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 700px) {
  .tv-steps-preview ol,
  .tv-steps-preview ol.tv-steps-6 { grid-template-columns: repeat(2, 1fr); }
  .tv-steps .step div:last-child { font-size: 0.65rem; }
  .tv-links { max-width: 48vw; }
  .tv-buy-panel, .tv-attest-panel { position: static; }
}
