:root {
  --bg: #0b0e14;
  --surface: #131722;
  --border: #232838;
  --ink: #f2f4f8;
  --ink-soft: #8b93a7;
  --accent: #3ddc97;
  --accent-bright: #5cf0af;
  --on-accent: #04140d;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; }

.topbar { display: flex; align-items: baseline; gap: 0.6rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.wordmark { font-weight: 800; letter-spacing: 0.08em; font-size: 1.2rem; color: var(--accent-bright); }
.tagline { font-size: 0.8rem; color: var(--ink-soft); }

.tabbar { display: flex; border-bottom: 1px solid var(--border); }
.tab-btn { flex: 1; background: none; border: none; color: var(--ink-soft); font-weight: 600; font-size: 0.9rem; padding: 0.85rem; cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

main { display: flex; flex-direction: column; height: calc(100% - 104px); }

.view { display: none; flex-direction: column; height: 100%; min-height: 0; }
.view.active { display: flex; }

#map { flex: 1; min-height: 0; background: var(--bg); }
.map-tiles-dark { filter: invert(1) hue-rotate(180deg) saturate(0.6) brightness(0.9); }

.panel { background: var(--surface); border-top: 1px solid var(--border); padding: 1rem 1.25rem 1.4rem; display: flex; flex-direction: column; gap: 0.9rem; }

.demo-controls { display: flex; gap: 0.6rem; }
.btn-ghost { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--ink); padding: 0.55rem 0.7rem; border-radius: 8px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-urgent { color: #ff8a8a; border-color: #4a2a2a; }
.btn-urgent:hover { border-color: #ff5c5c; }

.subtabbar { display: flex; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.subtab-btn { flex: 0 0 auto; background: none; border: none; color: var(--ink-soft); font-weight: 600; font-size: 0.82rem; padding: 0.75rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtab-btn.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

.dash-scroll { flex: 1; overflow-y: auto; padding: 1rem 1.1rem 2rem; }
.subview { display: none; flex-direction: column; gap: 0.7rem; }
.subview.active { display: flex; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1rem; }
.card-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.card-title { font-weight: 700; font-size: 0.95rem; }
.card-meta { font-size: 0.78rem; color: var(--ink-soft); }
.card-desc { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.3rem; }
.card-parts { margin-top: 0.5rem; font-size: 0.78rem; color: var(--ink-soft); }
.card-parts strong { color: var(--ink); }
.urgent-badge { background: #ff5c5c; color: #1a0505; font-size: 0.68rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: 999px; text-transform: uppercase; }
.price-tag { color: var(--accent-bright); font-weight: 700; }

.day-heading { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin: 0.4rem 0 0.1rem; }

.status-badge { font-size: 0.68rem; font-weight: 800; padding: 0.15rem 0.55rem; border-radius: 999px; text-transform: uppercase; }
.status-pending { background: #3a3220; color: #e8c766; }
.status-invoiced { background: #1f2f4a; color: #7fb2ff; }
.status-paid { background: #1a3a2a; color: var(--accent-bright); }

.materials-total { font-size: 0.82rem; color: var(--ink-soft); margin-top: -0.2rem; }

#transcript { max-height: 32vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.msg { padding: 0.65rem 0.9rem; border-radius: 10px; font-size: 0.92rem; line-height: 1.45; max-width: 92%; }
.msg-user { align-self: flex-end; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.msg-lenny { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); }
.msg-thinking { opacity: 0.6; font-style: italic; }

.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
#mic-btn { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.5); transition: transform 0.15s; }
#mic-btn:active { transform: scale(0.95); }
#mic-btn.listening { animation: pulse 1.4s ease-out infinite; background: #ff5c5c; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.5); }
  70% { box-shadow: 0 0 0 22px rgba(255, 92, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0); }
}
#mic-status { margin: 0; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }

.job-marker { background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; border: 2px solid var(--bg); }

.footer-credit { margin: 0.7rem 0 0; text-align: center; font-size: 0.75rem; color: var(--ink-soft); }
.footer-credit a { color: var(--accent-bright); text-decoration: none; font-weight: 600; }
.footer-credit a:hover { text-decoration: underline; }
