:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #68645d;
  --paper: #f7f2e9;
  --panel: #fffaf1;
  --line: #d7cbb8;
  --olive: #2f3a35;
  --brass: #b08a57;
  --red: #7a2e1d;
  --blue: #506f83;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}

.shell {
  display: grid;
  grid-template-columns: minmax(380px, 500px) 1fr;
  height: 100dvh;
  inset: 0;
  min-height: 0;
  overflow: hidden;
  position: fixed;
  width: 100vw;
}

.panel {
  border-right: 1px solid var(--line);
  background: var(--panel);
  height: 100dvh;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.logout-button {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  margin-top: 10px;
  padding: 0 0 3px;
  text-transform: uppercase;
}

.logout-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.metric {
  min-width: 72px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: right;
  background: #fffdf8;
}

.metric span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.metric small {
  color: var(--muted);
}

.run-strip {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1px;
  grid-template-columns: 1.35fr 0.85fr 0.85fr;
  margin: 0 0 14px;
}

.dld-strip {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  margin: -14px 0 14px;
}

.run-strip div {
  background: #fffdf8;
  padding: 10px;
}

.dld-strip div {
  background: #fffdf8;
  padding: 9px 10px;
}

.run-strip span,
.dld-strip span,
.mini-grid span,
.memo-line span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.run-strip strong {
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.dld-strip strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  margin-top: 4px;
}

.mode-tabs {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.mode-tab,
.queue-toolbar button {
  appearance: none;
  background: #fffdf8;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  padding: 10px 6px;
  text-transform: uppercase;
}

.mode-tab:last-child {
  border-right: 0;
}

.mode-tab.active {
  background: var(--ink);
  color: var(--panel);
}

.controls {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.layers-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 14px 0 16px;
}

.community-panel,
.evidence-panel {
  margin-bottom: 16px;
}

.panel-label {
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  margin: 0 0 2px;
  text-transform: uppercase;
}

.layers-panel label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  line-height: 1.2;
  text-transform: none;
}

.layers-panel input {
  accent-color: var(--red);
  height: 15px;
  width: 15px;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
  text-transform: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.evidence-summary {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 4px 0 12px;
  padding: 10px 0;
}

.evidence-summary div {
  background: #fffdf8;
  border: 1px solid var(--line);
  min-width: 0;
  padding: 8px;
}

.evidence-summary span {
  display: block;
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
}

.evidence-summary small {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 750;
  margin-top: 4px;
  text-transform: uppercase;
}

.legend::after {
  content: "Deal dots use view color when tagged: lake blue, sea teal, park green, skyline red. Untagged deals still show so you do not miss the queue.";
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.high {
  background: var(--red);
}

.medium {
  background: var(--brass);
}

.low {
  background: var(--blue);
}

.target-list {
  display: grid;
  gap: 10px;
}

.run-history {
  border-top: 1px solid var(--line);
  margin-bottom: 12px;
  padding-top: 12px;
}

.run-list {
  border: 1px solid var(--line);
  display: grid;
}

.run-list div {
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  grid-template-columns: 1fr auto;
  padding: 9px;
}

.run-list div:last-child {
  border-bottom: 0;
}

.run-list span,
.run-list em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.run-list strong {
  color: var(--red);
  font-size: 13px;
}

.run-list em {
  grid-column: 1 / -1;
}

.cron-group {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.cron-heading {
  align-items: center;
  background: #fffdf8;
  border: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
}

.cron-heading span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cron-heading strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.queue-toolbar {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 14px;
}

.queue-toolbar button {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.queue-toolbar button:hover,
.card-link:hover {
  border-color: var(--red);
  color: var(--red);
}

.list-heading {
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  margin: 10px 0 0;
  text-transform: uppercase;
}

.context-heading {
  margin-top: 18px;
}

.empty-state {
  border: 1px dashed var(--line);
  color: var(--muted);
  margin: 0;
  padding: 12px;
}

.target-card {
  position: relative;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
  cursor: pointer;
}

.deal-card {
  border-color: rgba(122, 46, 29, 0.55);
  padding-right: 58px;
}

.deal-card.selected {
  border-color: var(--red);
  box-shadow: inset 4px 0 0 var(--red);
}

.deal-rank {
  align-items: center;
  background: var(--ink);
  color: var(--panel);
  display: flex;
  font-size: 18px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 42px;
}

.target-card:hover {
  border-color: var(--brass);
}

.card-kicker {
  color: var(--red);
  font-size: 11px;
  font-weight: 850;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.target-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.2;
}

.target-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.photo-strip {
  display: grid;
  gap: 6px;
  grid-template-columns: 1.3fr 1fr 1fr;
  margin: 8px 0 10px;
}

.photo-strip img {
  aspect-ratio: 4 / 3;
  background: var(--paper);
  border: 1px solid var(--line);
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.empty-photo {
  border: 1px dashed var(--line);
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  padding: 10px;
  text-transform: uppercase;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.finance-strip {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.check-grid {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
  padding-top: 10px;
}

.check-grid label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 6px;
  line-height: 1.15;
  text-transform: none;
}

.check-grid input {
  accent-color: var(--red);
  height: 14px;
  width: 14px;
}

.check-grid .ok {
  color: var(--olive);
}

.check-grid .missing {
  color: var(--muted);
}

.evidence-line {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 6px;
  margin-top: 9px;
}

.view-pill {
  background: #eef3ef;
  border: 1px solid #bfd0c2;
  color: var(--olive);
  font-weight: 850;
  padding: 4px 6px;
  text-transform: uppercase;
}

.finance-strip div {
  border: 1px solid var(--line);
  padding: 7px;
}

.finance-strip span,
.popup-grid span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-strip strong {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.positive {
  color: #486f3d;
}

.negative {
  color: var(--red);
}

.tag {
  border: 1px solid var(--line);
  padding: 4px 6px;
  color: var(--olive);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.card-link {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: inline-block;
  font-size: 12px;
  font-weight: 850;
  margin-top: 10px;
  text-decoration: none;
  text-transform: uppercase;
}

.missing-link {
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 850;
  margin-top: 10px;
  text-transform: uppercase;
}

.answer-panel {
  background: #fffdf8;
  border: 1px solid var(--line);
  padding: 14px;
}

.next-panel {
  margin-bottom: 12px;
}

.memory-card {
  cursor: default;
  padding-right: 12px;
}

.answer-panel h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.05;
  margin: 0 0 8px;
}

.answer-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 12px;
}

.mini-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin: 10px 0;
}

.mini-grid div,
.memo-line {
  border: 1px solid var(--line);
  padding: 8px;
}

.mini-grid strong {
  display: block;
  font-size: 14px;
  margin-top: 3px;
}

.memo-line {
  margin-top: 6px;
}

.memo-line strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.gap-list {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 10px 0 0;
  padding-left: 18px;
}

.transaction-table {
  border: 1px solid var(--line);
  margin-top: 10px;
}

.transaction-head,
.transaction-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 8px;
}

.transaction-row:last-child {
  border-bottom: 0;
}

.transaction-head {
  grid-template-columns: 1fr auto;
}

.transaction-head span,
.transaction-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.transaction-head strong,
.transaction-row strong {
  font-size: 12px;
}

.transaction-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.map {
  background: #151515;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.leaflet-container {
  height: 100%;
  overscroll-behavior: none;
}

.price-marker {
  pointer-events: auto;
}

.price-marker span {
  align-items: center;
  background: rgba(255, 250, 241, 0.96);
  border: 2px solid var(--marker-color, #7A2E1D);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
  color: var(--ink);
  display: inline-flex;
  gap: 7px;
  height: 30px;
  justify-content: center;
  min-width: 86px;
  padding: 0 7px;
  white-space: nowrap;
}

.price-marker strong {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
}

.price-marker em {
  align-items: center;
  background: var(--marker-color, #7A2E1D);
  color: #fffaf1;
  display: inline-flex;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 4px;
}

.community-label {
  background: rgba(21, 21, 21, 0.72);
  border: 1px solid rgba(255, 250, 241, 0.7);
  box-shadow: none;
  color: #fffaf1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 4px 7px;
  text-transform: uppercase;
}

.leaflet-tooltip-top.community-label::before,
.leaflet-tooltip-bottom.community-label::before,
.leaflet-tooltip-left.community-label::before,
.leaflet-tooltip-right.community-label::before {
  display: none;
}

.map-fallback {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 21, 0.08) 1px, transparent 1px),
    #ebe2d3;
  background-size: 56px 56px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.map-fallback span {
  color: var(--muted);
}

.leaflet-popup-content {
  min-width: 260px;
}

.popup-title {
  margin: 0 0 6px;
  font-size: 17px;
}

.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0;
  font-size: 12px;
}

.popup-grid strong {
  display: block;
  font-size: 14px;
}

.source-link {
  color: var(--red);
  font-weight: 800;
}

.family-context {
  border-top: 1px solid rgba(21, 21, 21, 0.12);
  margin-top: 10px;
  padding-top: 10px;
}

.family-context h4 {
  font-size: 13px;
  margin: 0 0 6px;
}

.family-context ul {
  margin: 6px 0;
  padding-left: 16px;
}

.family-context li {
  margin: 0 0 5px;
}

.family-context li span {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.route-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.route-links a {
  background: rgba(31, 111, 139, 0.1);
  border: 1px solid rgba(31, 111, 139, 0.25);
  border-radius: 999px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  text-decoration: none;
}

.tiny-note {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 46dvh 54dvh;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    height: 46dvh;
    max-height: none;
  }

  .map {
    height: 54dvh;
    min-height: 0;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
