/* LandBridge - a consumer proptech skin deliberately distinct from the Pacta
   explorer: warm editorial palette, serif display type. The protocol panel is
   the intentional contrast: dark, monospace, ledger-like. */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #f6f1e7;
  --card: #fffdf8;
  --ink: #26221b;
  --muted: #7a715f;
  --line: #e5dcc9;
  --terra: #c05b2e;
  --terra-dark: #9c4622;
  --olive: #5f6b3c;
  --sea: #2e6f6c;
  --danger: #a83232;
  --dark: #16130e;
  --dark-line: #2c261c;
  --amber: #e8b25c;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  padding: 20px clamp(14px, 3vw, 40px) 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--terra); }
.brand-mark { width: 40px; height: 28px; }
.brand-name { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.5px; }
.brand-tag { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; }
.pacta-badge {
  font-size: 13px; color: var(--cream); background: var(--dark);
  padding: 7px 14px; border-radius: 999px; text-decoration: none;
}
.pacta-badge strong { color: var(--amber); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.tech-toggle {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.tech-toggle input { position: absolute; opacity: 0; }
.tech-track {
  width: 30px; height: 17px; border-radius: 999px; background: var(--line);
  border: 1px solid var(--muted); position: relative; transition: background .15s;
}
.tech-track::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--card); border: 1px solid var(--muted);
  transition: left .15s;
}
.tech-toggle input:checked + .tech-track { background: var(--olive); border-color: var(--olive); }
.tech-toggle input:checked + .tech-track::after { left: 14px; border-color: var(--olive); }
body.tech .tech-toggle { color: var(--olive); font-weight: 600; }

/* ── Property hero ───────────────────────────────────────────────────── */
.property { display: grid; grid-template-columns: 300px 1fr 200px; overflow: hidden; margin-bottom: 14px; }
.property-art svg { display: block; width: 100%; height: 100%; min-height: 170px; }
.property-info { padding: 18px 22px; }
.property-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--terra); font-weight: 700; }
.property-info h1 { font-family: var(--serif); font-size: 28px; margin: 2px 0 0; }
.property-loc { color: var(--muted); margin-bottom: 10px; }
.property-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; font-size: 13px; }
.property-facts dt { color: var(--muted); float: left; margin-right: 6px; }
.property-facts dd { display: inline; }
.property-side { border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 16px; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.side-value { font-family: var(--serif); font-size: 22px; color: var(--olive); font-weight: 700; }

/* ── Closing stepper ─────────────────────────────────────────────────── */
.stepper { display: flex; align-items: center; padding: 14px 22px; gap: 10px; margin-bottom: 14px; }
.lane { display: flex; align-items: center; gap: 10px; flex: 1; }
.lane-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 2px solid var(--muted); flex: none; }
.lane-text { display: flex; flex-direction: column; min-width: 0; }
.lane-name { font-family: var(--serif); font-weight: 700; }
.lane-status { font-size: 12px; color: var(--muted); }
.lane-detail { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-link { height: 2px; flex: 0 0 46px; background: var(--line); border-radius: 2px; }
.lane.working .lane-dot { background: var(--amber); border-color: var(--terra); animation: pulse 1.2s infinite; }
.lane.verifying .lane-dot { background: var(--sea); border-color: var(--sea); animation: pulse 1.2s infinite; }
.lane.done .lane-dot { background: var(--olive); border-color: var(--olive); }
.lane.issue .lane-dot { background: var(--danger); border-color: var(--danger); }
.lane.done .lane-status { color: var(--olive); font-weight: 600; }
.lane.issue .lane-status { color: var(--danger); font-weight: 600; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* ── Split: chat + protocol ──────────────────────────────────────────── */
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 14px; align-items: start; }

.chat { display: flex; flex-direction: column; min-height: 480px; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 20px; max-height: 60vh; }
.msg { max-width: 92%; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; }
.msg p { margin-bottom: 8px; } .msg p:last-child { margin-bottom: 0; }
.msg.user { background: var(--terra); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.assistant { background: #f2ecdd; border-bottom-left-radius: 4px; }
.msg.assistant strong { color: var(--terra-dark); }
.msg.error { background: #f7e2e2; color: var(--danger); font-size: 13px; }
.scripted-note { font-size: 12.5px; color: #7a6f58; border-top: 1px dashed #d8cfba; padding-top: 8px; }
.tool-chip {
  display: inline-block; font-family: var(--mono); font-size: 11.5px;
  background: var(--dark); color: var(--amber); border-radius: 8px;
  padding: 3px 9px; margin: 0 6px 8px 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.tool-chip.err { color: #e07a7a; }
.tool-chip .ok { color: #9dc978; }

/* Folded protocol activity between messages. Hidden for humans; the run's
   progress lives in the stepper and the protocol panel instead. */
details.activity { margin: 0 0 12px; }
body:not(.tech) details.activity { display: none; }
details.activity summary {
  cursor: pointer; font-family: var(--mono); font-size: 11.5px;
  color: var(--muted); list-style: none;
}
details.activity summary::before { content: "⚙ "; }
details.activity summary::-webkit-details-marker { display: none; }
details.activity[open] summary { margin-bottom: 6px; }
.act-body { display: flex; flex-wrap: wrap; }

/* Heartbeat while the copilot works (it stays quiet between milestones). */
.working { font-size: 13px; color: var(--muted); font-style: italic; margin: 2px 0 12px 4px; }
.working .dots i { font-style: normal; animation: blink 1.2s infinite; }
.working .dots i:nth-child(2) { animation-delay: .2s; }
.working .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60% { opacity: .15; } 30% { opacity: 1; } }
.chat-suggest { padding: 0 20px 10px; }
.chat-suggest button {
  font: inherit; font-size: 13px; color: var(--terra-dark);
  background: none; border: 1px dashed var(--terra); border-radius: 999px;
  padding: 7px 14px; cursor: pointer;
}
.chat-suggest button:hover { background: #f8e9df; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; font: inherit; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--cream); outline: none;
}
.chat-input input:focus { border-color: var(--terra); }
.chat-input button {
  font: inherit; font-weight: 600; color: #fff; background: var(--terra);
  border: none; border-radius: 10px; padding: 10px 20px; cursor: pointer;
}
.chat-input button:disabled { opacity: 0.5; cursor: default; }

/* ── Protocol panel (deliberately "terminal") ────────────────────────── */
.protocol {
  background: var(--dark); border-color: var(--dark-line); color: #cfc4ae;
  font-family: var(--mono); font-size: 12px; display: flex; flex-direction: column;
  min-height: 480px; max-height: 78vh;
}
.protocol-head { padding: 12px 16px; border-bottom: 1px solid var(--dark-line); }
.protocol-title { color: var(--amber); font-weight: 700; letter-spacing: 2px; }
.protocol-sub { display: block; color: #7d715a; font-size: 10.5px; margin-top: 2px; }
.providers { padding: 10px 16px; border-bottom: 1px solid var(--dark-line); display: grid; gap: 4px; }
.prov { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.prov-name { overflow: hidden; text-overflow: ellipsis; }
.prov .stake { color: #9dc978; }
.prov.unvetted { color: #6d614c; }
.prov.unvetted .stake { color: var(--danger); }
.feed { flex: 1; overflow-y: auto; padding: 10px 16px; display: flex; flex-direction: column-reverse; gap: 7px; }
.feed-empty { color: #6d614c; }
.evt { border-left: 2px solid #4b4132; padding-left: 9px; }
.evt .evt-amt { color: var(--amber); }
.evt.escrow_fund { border-color: var(--sea); }
.evt.escrow_release { border-color: #9dc978; }
.evt.refund, .evt.stake_slash { border-color: var(--danger); }
.evt.stake_slash .evt-amt { color: #e07a7a; }
.evt .evt-memo { color: #8d8168; display: block; }
body:not(.tech) .evt-memo { display: none; }
.protocol-foot {
  display: flex; justify-content: space-between; padding: 10px 16px;
  border-top: 1px solid var(--dark-line); color: #7d715a; font-size: 11px;
}
.protocol-foot a { color: var(--amber); text-decoration: none; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .property { grid-template-columns: 1fr; }
  .property-art svg { max-height: 140px; }
  .property-side { border-left: none; border-top: 1px solid var(--line); flex-direction: row; }
  .stepper { flex-wrap: wrap; } .lane-link { display: none; }
}
