* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1c1c1e; background: #f6f6f8; line-height: 1.45; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; background: #fff; border-bottom: 1px solid #e3e3e8; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar .sub { margin: 2px 0 0; color: #6e6e73; font-size: 13px; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
h2 { font-size: 19px; margin: 20px 0 8px; }
h3 { font-size: 16px; margin: 16px 0 6px; }
.muted { color: #6e6e73; }
.small { font-size: 13px; color: #6e6e73; }
.btn { display: inline-block; padding: 10px 14px; border: 1px solid #c7c7cc; border-radius: 10px; background: #fff; color: #1c1c1e; font-size: 15px; text-decoration: none; cursor: pointer; margin: 4px 4px 4px 0; }
.btn:active { background: #efeff1; }
.btn-primary { background: #007aff; border-color: #007aff; color: #fff; }
.btn-primary:active { background: #0062cc; }
.btn-danger { background: #fff; border-color: #d70015; color: #d70015; }
.btn-danger.armed { background: #d70015; color: #fff; }
/* Armed (confirm-step) state for a plain button, e.g. Park this house:
   filled dark so the second tap is unmistakable, without the red that
   means "destructive" on the danger buttons. */
.btn.armed { background: #1c1c1e; border-color: #1c1c1e; color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.card { background: #fff; border: 1px solid #e3e3e8; border-radius: 14px; padding: 14px; margin: 10px 0; }
.tour-card { cursor: pointer; }
.tour-card:hover { border-color: #007aff; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2ff; color: #3730a3; }
.badge.confirmed { background: #dcfce7; color: #166534; }
.badge.checking, .badge.check_sent { background: #fef3c7; color: #92400e; }
.badge.available { background: #dbeafe; color: #1e40af; }
.badge.offer_accepted { background: #fee2e2; color: #991b1b; }
.badge.canceled { background: #fee2e2; color: #991b1b; }
.badge.parked { background: #e5e7eb; color: #374151; }
/* Canceled stop: stays visible on the tour, dimmed, marked canceled. */
.card.canceled { opacity: .55; }
/* Parked stop: same treatment as canceled, set aside, not gone. */
.card.parked { opacity: .55; }
/* Per-house notes log: agent-side only, newest first. */
.stop-notes { margin: 10px 0; }
.stop-notes h3 { margin: 10px 0 4px; }
.stop-notes textarea { width: 100%; min-height: 56px; resize: vertical; }
.stop-note { background: #f6f6f8; border: 1px solid #e3e3e8; border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.note-meta { display: flex; justify-content: space-between; align-items: center; color: #6e6e73; font-size: 12px; margin-bottom: 2px; }
.note-del { padding: 2px 8px; font-size: 13px; margin: 0; }
.stop-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.stop-time { font-size: 18px; font-weight: 700; }
.stop-addr { font-size: 17px; font-weight: 600; }
.stop-addr a { color: #007aff; text-decoration: none; }
.meta { color: #3a3a3c; font-size: 14px; margin: 4px 0; }
.agent-line { font-size: 14px; margin: 6px 0; }
.agent-line a { color: #007aff; text-decoration: none; }
.agent-only { background: #fffbeb; border: 1px dashed #d97706; border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.agent-only .tag { font-weight: 700; color: #92400e; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
/* Buyer feedback on a stop: agent-side only, same shape as .agent-only. */
.buyer-feedback { background: #eef6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.buyer-feedback .tag { font-weight: 700; color: #1e40af; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.textbox { background: #f6f6f8; border: 1px solid #e3e3e8; border-radius: 10px; padding: 10px; font-size: 14px; white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
/* Editable agent text (availability check / showing request): same look
   as .textbox, but a real textarea she can rewrite before sending. */
textarea.agent-text { width: 100%; box-sizing: border-box; background: #f6f6f8; border: 1px solid #e3e3e8; border-radius: 10px; padding: 10px; font-size: 14px; font-family: inherit; line-height: 1.5; margin: 6px 0; resize: vertical; }
textarea.buyer-text { width: 100%; min-height: 190px; border: 1px solid #e3e3e8; border-radius: 10px; padding: 10px; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #fff; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 2px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #c7c7cc; border-radius: 10px; font-size: 15px; background: #fff; }
input[type="number"] { -moz-appearance: textfield; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.notice { background: #eef6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.lookup-msg:empty { display: none; }
.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.panel { border: 1px solid #e3e3e8; border-radius: 14px; padding: 14px; margin: 14px 0; background: #fff; }
.panel.agent { background: #fffbeb; border-color: #f59e0b; }
.link-list a { display: block; padding: 8px 0; color: #007aff; text-decoration: none; font-size: 15px; word-break: break-all; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hidden { display: none; }
/* Notes sidebar: left panel on the tour detail view, toggled by Notes.
   On a wide screen it sits beside the tour; on a phone it slides in over
   the tour so the tour never gets squeezed into a sliver. */
.tour-layout { display: block; }
.tour-layout.notes-open { display: flex; gap: 16px; align-items: flex-start; }
.notes-sidebar { display: none; width: 280px; flex: 0 0 280px; background: #fff; border: 1px solid #e3e3e8; border-radius: 14px; padding: 14px; position: sticky; top: 76px; }
.notes-sidebar h2 { margin: 0 0 4px; }
.notes-sidebar textarea { width: 100%; min-height: 220px; resize: vertical; }
.tour-layout.notes-open .notes-sidebar { display: block; }
.tour-main { flex: 1; min-width: 0; }
main:has(.tour-layout.notes-open) { max-width: 1180px; }
.notes-saved { color: #166534; }
@media (max-width: 720px) {
  .tour-layout.notes-open { display: block; }
  .tour-layout.notes-open .notes-sidebar { display: block; width: min(320px, 85vw); flex: none; position: fixed; left: 0; top: 0; bottom: 0; z-index: 20; border-radius: 0; border-right: 1px solid #e3e3e8; overflow-y: auto; box-shadow: 0 0 24px rgba(0,0,0,.25); }
}
