/* App / product demo */
.app-frame {
  max-width: 1240px; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; background: #fff;
  box-shadow: var(--shadow-lg);
}
.app-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.tl { display: flex; gap: 6px; margin-right: 6px; }
.tl span { width: 11px; height: 11px; border-radius: 50%; background: #d4d1c7;}
.tl span:nth-child(1){ background:#E8705E;} .tl span:nth-child(2){ background:#E8B84C;} .tl span:nth-child(3){ background:#7CC27A;}
.urlbar {
  flex: 1; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.urlbar .lock { width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 2px; position: relative;}
.urlbar .lock::before{ content:""; position:absolute; inset:-4px 1px auto 1px; height:4px; border:1.5px solid var(--muted); border-bottom:0; border-radius: 4px 4px 0 0;}
.app-body { display: grid; grid-template-columns: 220px 1fr; min-height: 720px; }
.sidebar {
  border-right: 1px solid var(--line);
  padding: 16px 10px; background: #fff;
  display: flex; flex-direction: column; gap: 2px;
}
.side-brand { display: flex; align-items: center; gap: 8px; padding: 8px 10px 16px; font-weight: 600; letter-spacing: -0.01em; }
.side-brand .dot { width: 20px; height: 20px; border-radius: 5px; background: var(--ink); position: relative; }
.side-brand .dot::after { content:""; position:absolute; inset: 4px 4px auto auto; width:7px; height:7px; border-radius:2px; background: var(--accent); }
.side-sec { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); padding: 14px 10px 4px; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; border: 1px solid transparent;
}
.side-item:hover { background: var(--bg-2); }
.side-item.active { background: var(--ink); color: #fff; }
.side-item.active .ico svg path { stroke: #fff; }
.side-item .ico { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; }
.side-item .badge { margin-left: auto; font-size: 11px; padding: 2px 6px; border-radius: 999px; background: var(--accent); color: var(--ink); font-weight: 500;}
.side-item.active .badge { background: var(--accent); color: var(--ink); }

.side-profile {
  margin-top: auto; padding: 10px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #222, #555); color: #fff; display:flex; align-items:center; justify-content:center; font-size: 12px; font-weight: 600; }
.side-profile .meta { font-size: 12px; line-height: 1.2; }
.side-profile .meta .name { color: var(--ink); font-weight: 500; }
.side-profile .meta .sub { color: var(--muted); font-size: 11px; }

.screen { display: none; padding: 0; }
.screen.active { display: block; }

/* Shared pane */
.pane-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 28px 20px; border-bottom: 1px solid var(--line); gap: 20px;
}
.pane-header h1 { font-family: 'Fraunces', serif; font-weight: 400; font-size: 34px; margin: 0; letter-spacing: -0.015em; line-height: 1.05;}
.pane-header .sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }
.pane-body { padding: 24px 28px 28px; }

/* Stage stepper */
.stages {
  display: flex; gap: 0; padding: 10px 28px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  overflow-x: auto;
}
.stage {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 6px 14px 6px 6px; font-size: 12.5px; color: var(--muted); position: relative;
}
.stage .num { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid var(--line-2); display:flex; align-items:center; justify-content:center; font-size: 11px; font-weight: 500;}
.stage.done .num { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage.active .num { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.stage.active { color: var(--ink); font-weight: 500; }
.stage.done { color: var(--ink-2); }
.stage + .stage::before {
  content: ""; width: 24px; height: 1px; background: var(--line-2); margin-right: 6px;
}

/* Property card */
.props { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.prop {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.prop:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.prop-img {
  aspect-ratio: 16/10; background: linear-gradient(180deg, #E5E3DC 0%, #D4D1C7 100%);
  position: relative; overflow: hidden;
}
.prop-img::after {
  content:""; position:absolute; inset:0;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(10,10,10,0.04) 18px 19px);
}
.prop-img .tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: var(--ink);
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.prop-img .fav {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,0.9); width: 28px; height: 28px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center; font-size: 14px;
}
.prop-img .note {
  position:absolute; bottom: 10px; left: 10px; font-family: 'IBM Plex Mono', monospace;
  background: rgba(10,10,10,0.8); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 10px; letter-spacing: .05em;
}
.prop-body { padding: 14px 16px 16px; }
.prop-addr { font-size: 13px; color: var(--muted); }
.prop-price { font-family: 'Fraunces', serif; font-size: 26px; line-height: 1; margin: 4px 0 10px; letter-spacing: -0.01em; }
.prop-kind { font-size: 11.5px; color: var(--muted); margin: -4px 0 10px; letter-spacing: 0; font-family: 'IBM Plex Mono', monospace; text-transform: none; }
.prop-stats { display: flex; gap: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px;}
.prop-stats b { color: var(--ink); font-weight: 600; }
.prop-score {
  position: absolute; bottom: 10px; right: 10px;
  background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 11px;
  display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-sm);
}
.prop-score .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Chat */
.chat {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  display: flex; flex-direction: column; height: 100%;
  min-height: 560px;
}
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-head .who { font-size: 13px; font-weight: 600; }
.chat-head .who small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 1px;}
.chat-body { flex: 1; padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;}
.msg { max-width: 82%; font-size: 13.5px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 14px 14px 2px 14px;}
.msg.ai { align-self: flex-start; }
.msg.ai .bubble { background: var(--bg-2); padding: 12px 14px; border-radius: 14px 14px 14px 2px;}
.msg.ai .tool {
  margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 12px;
}
.msg.ai .tool-title { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; display: flex; align-items: center; gap: 6px;}
.msg.ai .tool-title .spin {
  width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); border-top-color: var(--ink);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chat-input {
  border-top: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 8px; align-items: center;
}
.chat-input input {
  flex: 1; border: 0; outline: 0; font-size: 14px; padding: 8px;
  font-family: inherit; background: transparent;
}
.chat-input .send { width: 36px; height: 36px; border-radius: 999px; background: var(--accent); border: 0; cursor: pointer; display:flex; align-items:center; justify-content:center;}

/* Deal / analysis */
.deal-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.block {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 18px 20px;
}
.block h3 { margin: 0 0 12px; font-size: 13px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);}
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px;}
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 600; }
.kv .mono { font-variant-numeric: tabular-nums; }
.kv .pos { color: #3C8A4E; }
.kv .neg { color: #C13E2A; }

.score-big {
  display: flex; align-items: flex-end; gap: 14px; padding: 14px 0 4px;
}
.score-big .num { font-family: 'Fraunces', serif; font-size: 88px; line-height: .9; letter-spacing: -0.02em; }
.score-big .of { color: var(--muted); padding-bottom: 8px; }
.score-big .verdict { margin-left: auto; text-align: right; }
.score-big .verdict .v { font-family: 'Fraunces', serif; font-size: 22px;}
.score-big .verdict .vs { font-size: 12px; color: var(--muted); }

.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 14px;}
.bar { display: flex; align-items: center; gap: 12px; font-size: 12.5px;}
.bar .lbl { width: 130px; color: var(--muted); }
.bar .trk { flex: 1; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.bar .fl { height: 100%; background: var(--accent); border-radius: 3px;}
.bar .v { width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

.flags { display: flex; flex-direction: column; gap: 10px;}
.flag {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 13px;
}
.flag.warn { border-color: #F0D9A1; background: #FEF7E6; }
.flag.good { border-color: #C8E4B8; background: #F4FBEC; }
.flag.info { background: var(--bg); }
.flag b { font-weight: 600; display: block; margin-bottom: 2px; }
.flag .ico { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-size: 12px; font-weight: 600; }
.flag.warn .ico { background: #E8A93C; color: #fff; }
.flag.good .ico { background: #4E9E5E; color: #fff; }
.flag.info .ico { background: var(--ink); color: #fff; }

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-top {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px;
}
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .val { font-family: 'Fraunces', serif; font-size: 34px; line-height: 1; margin: 8px 0 4px; letter-spacing: -0.01em; }
.stat .delta { font-size: 12px; color: #3C8A4E; }
.stat .delta.neg { color: #C13E2A; }

.timeline { display: flex; flex-direction: column; }
.tl-row {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px dashed var(--line);
  align-items: flex-start;
}
.tl-row:last-child { border: 0; }
.tl-row .when { font-size: 11px; color: var(--muted); width: 72px; font-variant-numeric: tabular-nums; padding-top: 3px;}
.tl-row .body { flex: 1; font-size: 13.5px; }
.tl-row .body b { font-weight: 600; }
.tl-row .body small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.tl-row .tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line);
}
.tl-row .tag.auto { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.tl-row .tag.human { background: #fff; color: var(--muted); }

/* Chart */
.chart { position: relative; height: 180px; margin-top: 10px; }
.chart svg { width: 100%; height: 100%; display: block; }

/* Toggle */
.switch {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: .15s;
}
.switch .track::after {
  content:""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { left: 18px; }

/* Map preview */
.map {
  aspect-ratio: 16/9; border-radius: 10px; overflow: hidden;
  background:
    linear-gradient(180deg, #E8EAE3, #DDE0D4),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(0,0,0,0.04) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(0,0,0,0.04) 22px 23px);
  position: relative;
  border: 1px solid var(--line);
}
.map::before {
  content:""; position:absolute; inset:0;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(0,0,0,0.06) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(0,0,0,0.06) 22px 23px);
}
.pin {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--ink);
  transform: translate(-50%, -50%);
}
.pin.me { background: var(--ink); border-color: #fff; box-shadow: 0 0 0 6px rgba(10,10,10,0.08); }

/* Ring */
.ring { width: 110px; height: 110px; }
.ring-outer { stroke: var(--line); }
.ring-inner { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }

/* Mobile app look for landing */
.phone {
  width: 280px; background: #0A0A0A; border-radius: 36px;
  padding: 8px; box-shadow: var(--shadow-lg);
  aspect-ratio: 9/19;
  position: relative;
}
.phone-screen { background: var(--bg); height: 100%; border-radius: 28px; overflow: hidden; position: relative;}

/* Utility for demo */
.hint { font-size: 11px; color: var(--muted); padding: 4px 10px; background: var(--bg-2); border-radius: 999px; display: inline-block; border: 1px dashed var(--line-2); }

@media (max-width: 980px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .deal-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-top { grid-template-columns: 1fr 1fr; }
  .props { grid-template-columns: 1fr; }
}
