/* phase1.css (UI) — Phase 1 screens: topbar mode pill / user button, Today and Batches tabs, skip-trace import,
   parcel-card People / Touch / Timeline / Offers / Conditions / Underwriting, data-updated stamp.
   Uses app.css tokens (--panel, --fg, --muted, --accent, --border, --ok, --warn, --fail …). */

.p1-view, .cc-drawer {
  --cc-card: var(--card, var(--panel, #fff));
  --cc-good: var(--ok, #15803d); --cc-warn: var(--warn, #b45309); --cc-bad: var(--fail, #b91c1c);
  --cc-soft: color-mix(in srgb, var(--fg, #1c1f24) 6%, transparent);
}

/* ---------- topbar ---------- */
.userbox { display: flex; align-items: center; gap: 6px; min-width: 0; }
.userbox:empty { display: none; }
.mode-pill {
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; cursor: help;
  padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--border-strong, #b8c0cc); color: var(--muted);
}
.mode-pill[data-mode="cloud"] { border-style: solid; color: var(--ok); border-color: currentColor; }
.mode-pill[data-mode="unavailable"] { border-style: solid; color: var(--warn); border-color: currentColor; }
.user-btn:empty { display: none; }
.tab-badge {
  display: inline-block; min-width: 15px; margin-left: 4px; padding: 0 4px; border-radius: 999px;
  background: var(--fail); color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 700;
}
.migrate-banner {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 8px); transform: translateX(-50%); z-index: 65;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius, 8px); padding: 8px 12px; box-shadow: var(--shadow);
}
#tabs [role="tab"] { white-space: nowrap; display: inline-flex; align-items: center; }
@media (max-width: 1500px) and (min-width: 761px) {
  #tabs [role="tab"] { padding-left: 7px; padding-right: 7px; }
  .brand-txt { display: none; }
  .fresh .f-item:not(:first-child) { display: none; }
}
@media (max-width: 1100px) and (min-width: 761px) { .mode-pill { max-width: 84px; overflow: hidden; text-overflow: ellipsis; } }

/* ---------- data-updated stamp ---------- */
.data-stamp {
  position: absolute; left: 10px; bottom: 30px; z-index: 3; pointer-events: auto; cursor: default;
  font-size: 10.5px; line-height: 1.3; padding: 1px 6px; border-radius: 4px;
  color: var(--muted); background: color-mix(in srgb, var(--panel) 72%, transparent);
  white-space: nowrap; user-select: none;
}
.data-stamp:hover, .data-stamp:focus-visible { color: var(--fg); background: var(--panel); }
@media (max-width: 760px) { .card-open .data-stamp { display: none; } }

/* ---------- shared view chrome ---------- */
.p1-wrap { padding: 10px 12px 20px; font-size: 13px; color: var(--fg); }
.p1-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.p1-h { font-size: 15px; margin: 0; flex: 1 1 auto; }
.p1-muted, .p1-small.p1-muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.p1-group { border-top: 1px solid var(--border); padding: 8px 0; }
.p1-gh { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 2px 0 6px; display: flex; gap: 6px; align-items: center; }
details > summary.p1-gh { cursor: pointer; }
.p1-n { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11px; color: var(--fg); }
.p1-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.p1-small { font-size: 12px; }
.p1-warn { color: var(--warn); }
.p1-foot { color: var(--muted); font-size: 11.5px; margin-top: 10px; }
.p1-state { margin: 4px 0; font-size: 12.5px; color: var(--muted); }
.p1-state::before { display: inline-block; margin-right: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 5px; border-radius: 3px; border: 1px solid currentColor; }
.p1-state[data-state="none"]::before { content: "none"; }
.p1-state[data-state="not-loaded"]::before { content: "not loaded"; color: var(--warn); }
.p1-state[data-state="not-covered"]::before { content: "not covered"; }
.p1-state[data-state="failed"] { color: var(--fail); }
.p1-state[data-state="failed"]::before { content: "failed"; }
.p1-state[data-state="loading"]::before { content: "…"; border: 0; }
.p1-tag { display: inline-block; font-size: 10.5px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.p1-tag-role { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.p1-tag-bad { color: var(--fail); border-color: currentColor; }
.p1-tag-warn { color: var(--warn); border-color: currentColor; }
.p1-tag-ok { color: var(--ok); border-color: currentColor; }
.p1-src { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.p1-hint { color: var(--muted); font-size: 11.5px; }
.p1-ev { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.p1-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; margin: 2px 10px 2px 0; }
.p1-view .cc-field input, .p1-view .cc-field select { font-size: 13px; }
.p1-view :focus-visible, .cc :focus-visible { outline: 2px solid var(--focus, #2563eb); outline-offset: 1px; }

/* forms (card + views) */
.p1-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; align-items: end; margin: 6px 0; }
.p1-grid .cc-field { margin: 0; }
.p1-wide { grid-column: 1 / -1; }
.p1-grid fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px 6px; margin: 0; min-width: 0; }
.p1-grid legend { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.p1-mech { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.p1-mech legend { grid-column: 1 / -1; }
.p1-mech .cc-field { margin: 0; }
.p1-inline { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.p1-inline input { flex: 1 1 140px; min-width: 0; font-size: 12.5px; padding: 3px 7px; min-height: 28px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); }
.p1-inline select { font-size: 12px; padding: 2px 4px; min-height: 28px; }
.p1-add > summary { cursor: pointer; font-size: 12px; color: var(--accent); margin: 6px 0; }
.p1-count:not(:empty) { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; color: var(--muted); }

/* ---------- parcel card: people & contacts ---------- */
.p1-person { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.p1-person-top { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.p1-cps { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 3px; }
.p1-cp { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12.5px; }
.p1-cp-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.p1-cp-bad .p1-cp-val { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.p1-cp-acts { margin-left: auto; display: inline-flex; gap: 2px; }
.p1-cp-acts .cc-btn { padding: 1px 6px; }

/* timeline */
.p1-tl { list-style: none; margin: 4px 0; padding: 0 0 0 4px; }
.p1-tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 6px; padding: 4px 0; position: relative; }
.p1-tl-item::before { content: ""; position: absolute; left: 4px; top: 16px; bottom: -4px; width: 2px; background: var(--border); }
.p1-tl-item:last-child::before { display: none; }
.p1-tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.p1-tl-item[data-type="touch"] .p1-tl-dot { background: var(--accent); }
.p1-tl-item[data-type="offer"] .p1-tl-dot { background: var(--ok); }
.p1-tl-item[data-type="task"] .p1-tl-dot { background: var(--warn); }
.p1-tl-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.p1-tl-top time { color: var(--muted); font-size: 11px; }
.p1-tl-body { margin: 1px 0 0; color: var(--fg); overflow-wrap: anywhere; white-space: pre-wrap; }

/* conditions */
.p1-conds { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 6px; }
.p1-cond { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }

/* underwriting */
.cc-uw { border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 6px; }
.cc-uw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cc-uw-lab { font-weight: 600; font-size: 12px; }
.cc-uw .seg button[data-v="ready"][aria-pressed="true"] { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.cc-uw-as { margin-top: 6px; }
.cc-uw-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.cc-uw-list .cc-tag { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.cc-uw-sugg { display: flex; flex-wrap: wrap; gap: 2px; }
.cc-uw-in { font: inherit; font-size: 12px; padding: 3px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); width: 100%; margin-top: 4px; min-height: 28px; }
.cc-comp-off td { opacity: .5; }
.cc-comp-off td:first-child { opacity: 1; }
.cc-comp-use { margin: 0; }
.cc-flips { margin: 6px 0; }
.cc-flips summary { cursor: pointer; }

/* ---------- Today / Batches / skip-trace / Pipeline pages: see pages.css ----------
   (kept here: the task row pieces the property page reuses) */
.p1-task-main { min-width: 0; }
.p1-task-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

@media (max-width: 760px) {
  .p1-grid, .p1-mech { grid-template-columns: minmax(0, 1fr); }
  .migrate-banner { top: calc(var(--topbar-h) + 4px); }
}
