/*
  Homebase: "modern home" theme.

  Design ideas used here:
    - WARM NEUTRALS like a well-styled house: linen background, white cards, charcoal text.
      (Pure white + pure black can feel clinical; tinting them warm feels like a home.)
    - ONE CALM ACCENT: deep eucalyptus green for actions and progress, with terracotta
      and ochre as supporting "material" colors.
    - SOFT SHADOWS instead of glows: cards look like they sit on a surface, like paper on a table.
    - A SERIF FOR HEADINGS (Fraunces) + a clean sans for everything else (Inter): the classic
      pairing used by home and interiors brands. Numbers use Inter's tabular figures so they line up.
    - TEAM COLORS: each person's color arrives as the CSS variable --c, set in the HTML.
      color-mix() blends it with white to make soft tints from that one color.
*/

/* ===== Design tokens ===== */
:root {
  /* "Clean CRM" look (Nov 2026 redesign): cool gray page, white cards, navy text and sidebar,
     one coral accent for actions. Change these and the whole app follows. */
  --bg: #f5f8fa;            /* cool light gray */
  --panel: #ffffff;
  --panel-strong: #eaf0f6;  /* a step darker than the page, for hovers and selected things */
  --panel-solid: #ffffff;
  --edge: #dfe3eb;
  --edge-strong: #cbd6e2;
  --text: #213343;          /* deep navy */
  --muted: #516f90;
  --dim: #7c98b6;
  --cyan: #00799a;          /* links, progress and small accents: a readable teal (old name kept) */
  --violet: #d9573a;        /* small labels: a darker coral, so it's readable on white */
  --accent: #ff7a59;        /* coral: buttons and the current page */
  --accent-glow: 0 4px 14px rgba(255, 122, 89, 0.3);
  --navy: #213343;          /* the sidebar */
  --shadow: 0 1px 2px rgba(33, 51, 67, 0.06);
  --shadow-lift: 0 2px 4px rgba(33, 51, 67, 0.08), 0 10px 26px rgba(33, 51, 67, 0.1);
  --urgent: #d93f4c;
  --soon: #c27a0e;
  --good: #00a38d;
  --buyer: #3b6ea8;
  --seller: #b04f69;
  --tenant: #2b857b;
  --landlord: #8462a8;
  /* listing statuses */
  --active: #00a38d;
  --coming: #7a65a8;
  --pending: #c27a0e;
  --sold: #7c98b6;
  --radius: 8px;
  --font: "Lexend Deca", "Inter", system-ui, sans-serif;
  --display: "Lexend Deca", "Inter", system-ui, sans-serif;
  --mono: "Inter", system-ui, sans-serif; /* numbers: see .mono below for the tabular figures */
  color-scheme: light;
}

/* ===== Basics ===== */
[hidden] { display: none !important; }
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; font-weight: 500; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
h3 {
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 12px;
}
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

::selection { background: rgba(255, 122, 89, 0.18); }

/* (The old space theme's drifting glow and grid were here. Homes don't need them.) */
.aurora { display: none; }

/* ===== Glass panels ===== */
/* (Still called .glass from the old theme. Now it's a white card with a soft shadow.) */
.glass {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Layout: sidebar + main ===== */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px;
  background: var(--navy);   /* a dark navy sidebar, light text */
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px 24px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
}

.sidebar a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #cbd6e2;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s, background 0.15s;
}
.nav-icon { width: 19px; height: 19px; flex: none; }
.sidebar a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.sidebar a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
/* a glowing bar on the left of the current page */
.sidebar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar a[aria-current="page"] .nav-icon { color: var(--accent); }
/* The signed-in card and its links, on the dark sidebar */
.sidebar .me-card { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.12); }
.sidebar .me-text .muted, .sidebar .link-btn { color: #9fb2c6; }
.sidebar .link-btn:hover { color: #fff; }

/* ===== The top bar: ask-or-search, plus the most common actions ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  height: 57px;
  padding: 0 36px;
  background: var(--panel);
  border-bottom: 1px solid var(--edge);
}
.topbar-ask {
  flex: 1; max-width: 520px; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--edge-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--muted);
}
.topbar-ask input:not([type]):focus { box-shadow: none; }
.topbar-ask:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 121, 154, 0.15); }
.topbar-ask input:not([type]) { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; outline: none; color: var(--text); }
.topbar .btn:first-of-type { margin-left: auto; }

.me { margin-top: auto; display: grid; gap: 2px; }
.me-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 10%, white);
  border: 1px solid color-mix(in srgb, var(--c) 30%, white);
}
.me-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.9rem; }
.me-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn {
  padding: 4px 10px;
  border: none;
  background: none;
  color: var(--dim);
  font-size: 0.78rem;
  text-align: left;
}
.link-btn:hover { color: var(--text); }

main { min-width: 0; }

.view { padding: 32px 36px 56px; animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet);
}
.sub { margin: 8px 0 0; color: var(--muted); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--edge-strong);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: middle;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--panel-strong); border-color: var(--edge-strong); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover { box-shadow: var(--accent-glow); filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 0.82rem; border-radius: 6px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--edge-strong); }
.icon-btn.tiny { width: 24px; height: 24px; font-size: 0.7rem; border: none; background: none; }

.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0 0 6px rgba(255, 122, 89, 0.14); }
}

/* ===== Form fields ===== */
input:not([type="checkbox"]), select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.15);
}
select option { background: var(--panel-solid); }

/* ===== Segmented controls ===== */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  border: 1px solid var(--edge);
}
.segmented button {
  padding: 6px 13px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.88rem;
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(33, 51, 67, 0.12);
}

/* ===== Progress bars: a calm green fill that grows into place ===== */
.bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--panel-strong);
  overflow: hidden;
}
.bar.thin { height: 4px; }
.bar.thick { height: 10px; }
.bar-fill {
  height: 100%;
  width: var(--p);
  border-radius: inherit;
  background: var(--accent);
  animation: grow 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes grow { from { width: var(--from); } }

/* ===== Chips and warnings ===== */
.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--edge);
  color: var(--muted);
}
.chip.soon { color: var(--soon); border-color: color-mix(in srgb, var(--soon) 40%, transparent); background: color-mix(in srgb, var(--soon) 8%, transparent); }
.chip.urgent {
  color: var(--urgent);
  border-color: color-mix(in srgb, var(--urgent) 45%, transparent);
  background: color-mix(in srgb, var(--urgent) 10%, transparent);
}
.warn { font-family: var(--mono); font-size: 0.7rem; color: var(--soon); }
.warn.hot { color: var(--urgent); }

/* ===== Team avatars: a soft tint of the person's color ===== */
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 0.74rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--c) 75%, black);
  background: color-mix(in srgb, var(--c) 18%, white);
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, white);
}
.avatar.unassigned { --c: #6b7280; }
.avatar.xs { width: 22px; height: 22px; font-size: 0.55rem; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.62rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar.xl { width: 76px; height: 76px; font-size: 1.5rem; border-width: 2px; }

/* Client initials (not team members): a quiet rounded square tinted by client type */
.client-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--edge);
}
.client-mark.buyer { color: var(--buyer); background: color-mix(in srgb, var(--buyer) 12%, white); }
.client-mark.seller { color: var(--seller); background: color-mix(in srgb, var(--seller) 12%, white); }
.client-mark.tenant { color: var(--tenant); background: color-mix(in srgb, var(--tenant) 12%, white); }
.client-mark.landlord { color: var(--landlord); background: color-mix(in srgb, var(--landlord) 12%, white); }
.client-mark.big { width: 52px; height: 52px; font-size: 1.05rem; border-radius: var(--radius); }

.person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--c, #888) 75%, black);
}
.person-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
}

.team-stack { display: flex; }
.team-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }
.team-stack .avatar:first-child { margin-left: 0; }

/* ===== Sign-in ===== */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(760px, 100%);
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.brand.big { justify-content: center; font-size: 1.4rem; padding-bottom: 36px; }
.login-card h1 { font-size: clamp(2rem, 6vw, 3rem); }
.login-card > .muted { margin: 10px 0 32px; }

.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 14px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.profile:hover, .profile:focus-visible {
  outline: none;
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--c) 50%, white);
  box-shadow: var(--shadow-lift);
}
.demo-note { margin-top: 32px; color: var(--dim); font-size: 0.85rem; }

/* Live mode: email/password and first-time profile forms */
.login-form {
  width: min(380px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
  text-align: left;
}
.login-form label { display: grid; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.login-form input:not([type="radio"]) { width: 100%; }
.login-form .btn { justify-content: center; padding-block: 12px; }
.login-form fieldset { border: 0; padding: 0; margin: 0; }
.login-form legend { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.login-error { margin: 0; color: var(--urgent); font-size: 0.85rem; }
.login-wait { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.4; } }
.login-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Color picker made from radio buttons: the real radio is hidden, the dot shows the choice */
.swatch-pick { position: relative; cursor: pointer; }
.swatch-pick input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-pick .swatch { display: block; width: 30px; height: 30px; }
.swatch-pick .swatch.taken { opacity: 0.35; }
.swatch-pick input:checked + .swatch { border-color: #fff; box-shadow: 0 0 0 2px var(--c); opacity: 1; }
.swatch-pick input:focus-visible + .swatch { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ===== TODAY ===== */
.assistant-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.assistant-line strong { color: var(--text); }

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--good);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { to { transform: scale(3); opacity: 0; } }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; }
.stat-value {
  font-family: var(--display);
  font-size: 2.3rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text);
}
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-extra { color: var(--cyan); font-size: 0.82rem; font-weight: 600; }

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.spaced { margin-top: 32px; }

.nudges { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.nudge {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px 18px 16px 20px;
  overflow: hidden;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
/* Stagger: each card arrives a little after the one above it */
.nudge:nth-child(2) { animation-delay: 0.05s; }
.nudge:nth-child(3) { animation-delay: 0.1s; }
.nudge:nth-child(4) { animation-delay: 0.15s; }
.nudge:nth-child(n + 5) { animation-delay: 0.2s; }

/* A colored strip down the left side, showing urgency */
.nudge::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tone, var(--edge-strong));
}
.nudge.priority-0 { --tone: var(--urgent); }
.nudge.priority-1 { --tone: var(--soon); }
.nudge.priority-2 { --tone: var(--cyan); }

.nudge-body { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.nudge-body p { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.nudge-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.agenda li { display: flex; gap: 12px; align-items: stretch; }
.agenda-time {
  width: 74px;
  flex-shrink: 0;
  padding-top: 11px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}
.agenda-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 11px 14px 11px 16px;
  text-align: left;
  overflow: hidden;
}
.agenda-body::before {  /* the agent's color as a strip on the left */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c);
}
.agenda-body:hover { background: var(--panel-strong); }

.empty { color: var(--dim); font-size: 0.88rem; }
.empty.big { text-align: center; padding: 30px 12px; }


/* ===== CLIENTS board ===== */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }

.owner-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.owner-filter button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.owner-filter button[data-owner="all"] { padding: 6px 14px; }
.owner-filter button[aria-pressed="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--c, #2f5d4a) 55%, white);
  background: color-mix(in srgb, var(--c, #2f5d4a) 12%, white);
}
#client-search { flex: 1; min-width: 180px; max-width: 300px; }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr)); /* 4 active phases; closed deals live on Past clients */
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 14px;
}
.column {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  border: 1px solid transparent;
  min-height: 240px;
}
.column h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px 4px;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.count {
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.72rem;
}

.client-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: left;
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
/* The owner's color as a strip on the left edge */
.client-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c);
}
.client-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.card-top { display: flex; gap: 10px; align-items: center; }
.card-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.card-title strong { font-weight: 600; }
.card-title .muted { font-size: 0.8rem; }
.card-meta { display: flex; gap: 8px; font-size: 0.78rem; color: var(--muted); }
.card-meta .pct { color: var(--cyan); font-weight: 600; }
.card-meta .next { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card .chip, .client-card .warn { align-self: flex-start; }

/* ===== Drawer ===== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(33, 51, 67, 0.3);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  width: min(500px, 100%);
  overflow-y: auto;
  padding: 26px;
  background: var(--bg);
  border-left: 4px solid var(--c, var(--accent));
  box-shadow: -20px 0 60px rgba(33, 51, 67, 0.18);
  transform: translateX(100%);          /* starts off-screen to the right... */
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer.open { transform: translateX(0); } /* ...and slides in */

.drawer-head { display: flex; gap: 14px; align-items: center; }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 1.4rem; margin: 0; }
.drawer-head p { margin: 4px 0 0; font-size: 0.82rem; }

.owner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 10%, white);
  border: 1px solid color-mix(in srgb, var(--c) 30%, white);
}
.owner-row select { margin-left: auto; padding: 5px 10px; }

.contact-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 14px 0 4px; }
.log-label { margin-left: 6px; color: var(--dim); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }

.drawer-section {
  margin-top: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}

.progress-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.big-pct {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--cyan);
}

/* Stepper: a vertical line of dots, one per stage */
.stepper { list-style: none; margin: 18px 0 0; padding: 0; }
.stepper li { position: relative; }
.stepper li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 22px;
  bottom: -6px;
  width: 2px;
  background: var(--edge);
}
.stepper li.done::before { background: var(--accent); }
.stepper button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 5px 0;
  border: none;
  background: none;
  color: var(--dim);
  text-align: left;
  font-size: 0.88rem;
}
.stepper button:hover { color: var(--text); }
.dot {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--edge-strong);
  background: var(--panel-solid);
}
.stepper .done .dot { background: var(--cyan); border-color: var(--cyan); }
.stepper .done button { color: var(--muted); }
.stepper .current .dot { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(255, 122, 89, 0.15); animation: beat 2s ease-in-out infinite; }
.stepper .current button { color: var(--text); font-weight: 600; }
@keyframes beat { 50% { box-shadow: 0 0 0 7px rgba(255, 122, 89, 0.08); } }

.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist label { display: flex; gap: 12px; align-items: center; padding: 8px 0; cursor: pointer; }
.checklist input { width: 18px; height: 18px; accent-color: var(--cyan); }
.checklist input:checked + span { color: var(--dim); text-decoration: line-through; }

/* Deadlines (drawer.js deadlineList): a plain list with a colored bar, not a stack of pills */
.deadline-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.deadline-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 8px 12px;
  border-left: 3px solid var(--edge-strong);
  border-radius: 0 8px 8px 0;
  background: var(--panel-strong);
}
.deadline-row.soon { border-left-color: var(--soon); }
.deadline-row.urgent { border-left-color: var(--urgent); }
.deadline-row.soon .deadline-when { color: var(--soon); font-weight: 600; }
.deadline-row.urgent .deadline-when { color: var(--urgent); font-weight: 600; }
.deadline-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.deadline-title { font-size: 0.9rem; font-weight: 500; overflow-wrap: anywhere; }
.deadline-fold { margin: -4px 0 12px; }
.deadline-fold summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); padding: 4px 0; }
.deadline-fold .deadline-list { margin: 6px 0 0; }

.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input:not([type="date"]) { flex: 1; min-width: 140px; }

.details dl { margin: 0; display: grid; gap: 10px; }
.details dt { color: var(--dim); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.details dd { margin: 2px 0 0; }

.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--edge);
  font-size: 0.88rem;
}
.timeline-text { display: flex; flex-direction: column; min-width: 0; }
.timeline .when { color: var(--dim); font-size: 0.72rem; margin-top: 2px; }

/* ===== Dialogs (pop-up forms) ===== */
dialog {
  width: min(500px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(33, 51, 67, 0.25);
}
dialog[open] { animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog::backdrop { background: rgba(33, 51, 67, 0.35); }
dialog form { display: grid; gap: 14px; }
dialog h2 { font-size: 1.35rem; margin: 0; }
dialog label { display: grid; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ===== MAP ===== */
/* The map fills the screen under the top bar (57px tall), so nothing scrolls under it */
.view-map { display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 57px); padding: 0; }
#map { height: 100%; min-height: 360px; background: var(--panel-strong); }
/* Soften the map's colors so it matches the warm theme: less saturated, a touch of sepia.
   Only the map pictures are filtered, not our pins on top. */
.leaflet-tile-pane { filter: saturate(0.5) sepia(0.15) brightness(1.03) contrast(0.95); }

.map-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  background: var(--panel);
  border-left: 1px solid var(--edge);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  border: 1px solid var(--edge);
}
.tabs button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.tabs button[aria-selected="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(33, 51, 67, 0.12); }

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter-chip {
  --tone: var(--muted);
  padding: 4px 11px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: none;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 500;
}
.filter-chip.active { --tone: var(--active); }
.filter-chip.coming { --tone: var(--coming); }
.filter-chip.pending { --tone: var(--pending); }
.filter-chip.sold { --tone: var(--sold); }
.filter-chip[aria-pressed="true"] {
  color: var(--tone);
  border-color: color-mix(in srgb, var(--tone) 50%, transparent);
  background: color-mix(in srgb, var(--tone) 10%, transparent);
}

.listing-list { list-style: none; margin: 0; padding: 0; }
.listing-list li { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--edge); }
.listing-row {
  flex: 1;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px 2px;
  border: none;
  background: none;
  text-align: left;
}
.listing-row .avatar { margin-top: 2px; }
.listing-row:hover strong { color: var(--cyan); }
.listing-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.listing-price { display: flex; align-items: center; gap: 8px; }

.icon-btn.add { font-size: 1.05rem; }
.icon-btn.add.added { background: var(--accent); border-color: transparent; color: #fff; }

/* Price pins: white pills. The dot is the agent's color; the border is the status color. */
.pin {
  --tone: var(--active);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  border: 2px solid var(--tone);
  background: #fff;
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  box-shadow: 0 3px 10px rgba(33, 51, 67, 0.22);
  transition: transform 0.15s;
}
.pin.coming { --tone: var(--coming); }
.pin.pending { --tone: var(--pending); }
.pin.sold { --tone: var(--sold); }
.pin:hover { transform: translate(-50%, -100%) scale(1.12); }
.pin i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pin b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  color: #fff;
  font-size: 0.68rem;
}
.pin.on-tour { --tone: var(--cyan); }

.office-pin {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--text);
  background: var(--text);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 10px rgba(33, 51, 67, 0.25);
}

/* Leaflet's own popup bubble, restyled to match */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--edge);
  box-shadow: 0 16px 40px rgba(33, 51, 67, 0.2);
}
.leaflet-popup-content-wrapper { border-radius: var(--radius); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container { font-family: var(--font); }
.leaflet-bar a { background: #fff; color: var(--text); border-color: var(--edge); }
.leaflet-control-attribution { background: rgba(255, 255, 255, 0.8) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }

.popup { display: grid; gap: 4px; font-size: 0.85rem; }
.popup strong { font-family: var(--display); font-size: 1.15rem; font-weight: 500; }
.popup .btn { margin-top: 8px; }
.popup-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.popup-row select { padding: 4px 8px; font-size: 0.8rem; }
.popup-photo {
  --tone: var(--active);
  height: 92px;
  margin-bottom: 6px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  /* a stand-in for a real listing photo */
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--tone) 45%, transparent), transparent 65%),
    linear-gradient(135deg, #8a7a66, #4a4038);
  border: 1px solid color-mix(in srgb, var(--tone) 40%, white);
}
.popup-photo { position: relative; }
.rent-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tenant);
  color: var(--tenant);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
}
.popup-photo.coming { --tone: var(--coming); }
.popup-photo.pending { --tone: var(--pending); }
.popup-photo.sold { --tone: var(--sold); }

.status-tag {
  --tone: var(--active);
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--tone);
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
}
.status-tag.coming { --tone: var(--coming); }
.status-tag.pending { --tone: var(--pending); }
.status-tag.sold { --tone: var(--sold); }

/* Tour planner */
.tour-settings { display: grid; gap: 10px; margin-bottom: 16px; }
.tour-settings label { display: grid; gap: 5px; font-size: 0.78rem; color: var(--muted); }
.tour-settings select, .tour-settings input { width: 100%; }
.tour-settings .row { grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }

.tour-stops { list-style: none; margin: 0; padding: 0; }
.tour-stops li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--edge); }
.stop-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}
.tour-start .stop-num { background: var(--panel-strong); color: var(--text); width: 12px; height: 12px; margin: 0 7px; border: 2px solid var(--cyan); } /* start/end: a small ring */
.stop-text { flex: 1; display: flex; flex-direction: column; font-size: 0.88rem; min-width: 0; }
.stop-text strong { color: var(--cyan); font-weight: 600; font-variant-numeric: tabular-nums; }
.tour-summary { font-family: var(--mono); font-size: 0.82rem; margin: 16px 0 2px; color: var(--text); }
.tour-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* A checkbox with its label beside it, lined up with the dropdowns next to it */
.tour-settings label.check { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; color: var(--text); font-size: 0.85rem; }
.tour-settings label.check input { width: 16px; height: 16px; accent-color: var(--cyan); }

.start-form { margin: -4px 0 14px; }
.add-stop input { border-color: color-mix(in srgb, var(--accent) 40%, white); }
.hint { margin: 6px 0 16px; }

/* Route status: green when we have the real road route, amber while estimating */
.route-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: var(--panel);
  font-size: 0.8rem;
  color: var(--muted);
}
.route-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--soon); }
.route-status.ok { color: var(--text); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.route-status.ok .route-dot { background: var(--good); }
.route-status.loading .route-dot { animation: blink 0.8s ease-in-out infinite alternate; }
@keyframes blink { to { opacity: 0.2; } }

.order-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 30px; }

.conflict {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--urgent) 45%, transparent);
  background: color-mix(in srgb, var(--urgent) 10%, transparent);
  color: var(--urgent);
  font-size: 0.82rem;
}

/* Each stop: number | text | controls. It can be dragged to a new place. */
.tour-stops li.stop { cursor: grab; transition: background 0.15s, opacity 0.15s; }
.tour-stops li.stop:active { cursor: grabbing; }
.tour-stops li.dragging { opacity: 0.4; }
.tour-stops li.drop-target { box-shadow: inset 0 2px 0 var(--cyan); }
.tour-stops li.is-late .stop-num { background: var(--urgent); }
.tour-stops li.is-late .stop-text strong { color: var(--urgent); }

.note { font-size: 0.72rem; margin-top: 2px; }
.note.wait { color: var(--soon); }
.note.late { color: var(--urgent); }

.tour-stops li.stop { align-items: flex-start; }
.tour-stops li.stop > .icon-btn { margin-top: 2px; }

/* The row of tools under each stop: lock a time, move up, move down */
.stop-tools { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.stop-tools .icon-btn.tiny { border: 1px solid var(--edge); background: var(--panel); font-size: 0.55rem; }
.icon-btn:disabled { opacity: 0.25; cursor: default; }

/* The lock: a label with a small time box. Lit up amber when a time is set. */
.lock {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding: 2px 4px 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: pointer;
}
.lock input { width: 96px; padding: 3px 6px; font-size: 0.72rem; border-radius: 6px; font-family: var(--mono); }
.lock:not(.on) input { opacity: 0.6; }
.lock.on { color: var(--soon); border-color: color-mix(in srgb, var(--soon) 45%, transparent); background: color-mix(in srgb, var(--soon) 8%, transparent); }
.route-status .btn { margin-left: auto; }

/* This stop's showing time. Highlighted green when it's different from the usual time. */
.stay {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 2px 1px 7px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.72rem;
}
.stay select { padding: 3px 4px; border: none; background: transparent; font-size: 0.72rem; font-family: var(--mono); }
.stay.on { color: var(--cyan); border-color: color-mix(in srgb, var(--accent) 45%, white); background: color-mix(in srgb, var(--accent) 8%, white); }
.stop-tools { flex-wrap: wrap; }

.clear-tour { margin-top: 10px; }

/* Map pins for typed-in stops and for the tour's start point */
.pin.stop-pin { max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-family: var(--font); font-weight: 600; }
.start-pin {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 10px rgba(33, 51, 67, 0.25);
}

/* ===== TEAM ===== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.member {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-top: 4px solid var(--c, var(--edge));
}
.member-top { display: flex; gap: 14px; align-items: center; }
.member h2 { margin: 0; font-size: 1.1rem; }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.member-stats div { display: flex; flex-direction: column; }
.member-stats .num { font-family: var(--display); font-size: 1.6rem; font-weight: 500; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }

.member.add { align-content: start; border-style: dashed; border-top-width: 1px; box-shadow: none; background: transparent; }
.member.add input { width: 100%; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--edge); }

.connections { margin-top: 44px; }
.connections h2 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; }
.connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.connection { display: flex; align-items: center; gap: 14px; padding: 16px; }
.connection > div { flex: 1; min-width: 0; }
.connection p { margin: 2px 0 0; }
.connection-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--panel-strong);
  border: 1px solid var(--edge);
  font-size: 1.15rem;
}
.status-pill {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed var(--edge-strong);
  color: var(--dim);
  font-size: 0.68rem;
}

/* ===== Import clients ===== */
.import-dialog { width: min(760px, calc(100% - 32px)); }
.import { display: grid; gap: 14px; }
.import h3 { margin: 6px 0 0; }
.file-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--edge-strong);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  text-align: center;
}
.file-drop:hover { border-color: var(--accent); }
.file-drop strong { color: var(--cyan); }
/* The real file picker covers the whole box, invisibly, so tapping anywhere opens it */
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-help { font-size: 0.88rem; color: var(--muted); }
.import-help summary { cursor: pointer; color: var(--text); font-weight: 500; }
.import-help ul { padding-left: 18px; margin: 8px 0; display: grid; gap: 4px; }
.recent-import { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--edge); font-size: 0.9rem; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.map-grid label { display: grid; gap: 4px; font-size: 0.78rem; color: var(--muted); }
.map-grid select { width: 100%; }
.map-grid.defaults { padding-top: 12px; border-top: 1px solid var(--edge); }
.preview-wrap { overflow-x: auto; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--panel); }
.preview { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.preview th, .preview td { padding: 8px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--edge); }
.preview th { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.preview tr:last-child td { border-bottom: none; }
.import-counts { margin: 0; font-size: 0.9rem; }
.import-done { text-align: center; padding: 10px 0; }
.import-check {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.6rem;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.link-btn.danger { display: block; margin: 18px auto 4px; color: var(--urgent); }

/* ===== Address suggestions (drop-down under address boxes) ===== */
.suggestions {
  position: fixed;
  z-index: 3000;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--radius);
  border: 1px solid var(--edge-strong);
  background: #fff;
  box-shadow: 0 16px 40px rgba(33, 51, 67, 0.18);
  animation: rise 0.15s ease-out;
}
.suggestions li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
}
/* Phones: the list sits in the page under the address box instead of floating over it
   (see show() in autocomplete.js for why) */
.suggestions.in-page {
  position: static;
  width: auto;
  max-width: none;
  margin-top: 6px;
  box-shadow: 0 6px 16px rgba(33, 51, 67, 0.12);
}
.suggestions li strong { font-weight: 600; font-size: 0.92rem; }
.suggestions li span { color: var(--muted); font-size: 0.78rem; }
.suggestions li:hover, .suggestions li[aria-selected="true"] {
  background: var(--panel-strong);
  box-shadow: inset 3px 0 0 var(--cyan);
}

/* ===== Toasts ===== */
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 2000; display: grid; gap: 8px; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  border: 1px solid var(--text);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 16px 40px rgba(33, 51, 67, 0.3);
  animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.leaving { opacity: 0; transform: translateY(10px); }
.toast.warn { border-left: 4px solid var(--urgent); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.95); } }

/* ===== Confetti ===== */
.confetti {
  position: fixed;
  left: 50%;
  top: 60%;
  z-index: 3000;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  pointer-events: none;
  animation: burst 1.5s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

/* People who prefer less motion (a system setting) get a calmer app */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Nav labels: full on computers, short on phones ===== */
.sidebar .short { display: none; }
a.me-card { text-decoration: none; color: inherit; }
a.me-card:hover { border-color: var(--edge-strong); }

/* ===== Team: contact buttons ===== */
.member-contact { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.member-contact .btn { text-decoration: none; }
.member > .mono { margin: -10px 0 0; }

/* ===== My profile ===== */
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); /* 1 column on phones */
  gap: 18px;
  align-items: start;
}
.profile-card { display: grid; gap: 14px; padding: 22px; }
.profile-card h2 { margin: 0; font-size: 1.2rem; }
.profile-card p { margin: 0; }
.profile-card label { display: grid; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.profile-card input { width: 100%; }
.profile-card .stack { display: grid; gap: 10px; }
.reminders { grid-column: 1 / -1; border-top: 4px solid var(--cyan); } /* the most important card: full width */
.todo-dates { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.todo-dates li {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  padding: 10px 12px; border-radius: var(--radius); background: var(--panel-strong); font-size: 0.9rem;
}
.todo-dates li .muted { margin-left: auto; }
.btn.big { padding: 14px 20px; font-size: 1rem; justify-self: start; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.all-set { color: var(--good); font-weight: 600; }
.color-pick { border: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.color-pick legend { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; padding: 0; }

/* ===== Notification settings (My profile) ===== */
.notify-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--edge);
}
.notify-row > div { flex: 1 1 260px; display: grid; gap: 3px; }
.profile-card .switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
/* A checkbox drawn as an on/off switch: the box is hidden-looking, ::before is the knob */
.switch input {
  appearance: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px;
  background: var(--edge-strong); cursor: pointer; transition: background 0.2s;
}
.switch input::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.switch input:checked { background: var(--cyan); }
.switch input:checked::before { transform: translateX(18px); }
.switch input:disabled { opacity: 0.4; cursor: not-allowed; }
.reminders > .btn { justify-self: start; }

/* ===== Tasks ===== */
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 0 0 12px; }
.list-head h2 { margin: 0; font-size: 1.3rem; }
.list-tools { margin-left: auto; display: flex; gap: 12px; }
.list-tools .link-btn { flex: none; width: auto; padding: 0; }
.task-panel { padding: 18px 20px; display: grid; gap: 6px; }
.task-add { display: grid; gap: 8px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--edge); }
.task-add > input { width: 100%; font-size: 1rem; }
.task-add-options { display: flex; flex-wrap: wrap; gap: 8px; }
.task-add-options select, .task-add-options input { flex: 1 1 140px; min-width: 0; }
.task-add-options .btn { flex: none; }
.task-group {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 2px;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.task-group.late { color: var(--urgent); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--edge);
}
.task:last-child { border-bottom: none; }
.task > input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--cyan); cursor: pointer; }
.task-title {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
  overflow-wrap: anywhere;
}
button.task-title:hover { color: var(--cyan); }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.task.is-done .task-title { text-decoration: line-through; color: var(--dim); }
.task.editing { display: block; padding: 10px 0; }
.task.editing .task-add { border-bottom: none; padding-bottom: 0; margin: 0; }
.task-list.compact .task { padding: 7px 0; font-size: 0.9rem; }
.drawer-section .task-list + .inline-form, .drawer-section p + .inline-form { margin-top: 10px; }

/* ===== Phase tabs (Clients) ===== */
.phase-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;            /* on a phone the tabs themselves scroll a little if they must */
  scrollbar-width: none;
}
.phase-tabs button {
  flex: none;
  display: flex; gap: 6px; align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--muted);
  font: inherit; font-size: 0.85rem; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.phase-tabs button:hover { color: var(--text); border-color: var(--edge-strong); }
.phase-tabs button[aria-pressed="true"] { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.phase-tabs button[aria-pressed="true"] .count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* One phase picked: a single full-width column whose cards sit in a grid */
.board.single { grid-template-columns: 1fr; overflow: visible; }
.board.single .column {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  align-content: start;
}
.board.single .column h2 { grid-column: 1 / -1; }

/* ===== Property address ===== */
.drawer-address { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }
.address-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-address {
  display: block;
  font-size: 0.78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; /* one line, "…" if too long */
}
.optional { color: var(--dim); font-weight: 400; font-size: 0.8em; }

/* ===== Contract dates (drawer) ===== */
.contract-dates { display: grid; gap: 10px; margin-bottom: 12px; }
.contract-date {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  font-size: 0.85rem;
}
/* the date box (and its Clear button) spans the full row under its label */
.contract-date .date-field { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.contract-date input { flex: 1; min-width: 0; }
/* "Worked out: Nov 12 (3 days after...)" under a deal date's name (deal.js dealDateBoxes) */
.contract-date .date-hint { display: block; font-weight: 400; margin-top: 2px; }
.contract-date .chip { grid-row: 1; grid-column: 2; } /* the countdown sits beside the label */

/* ===== Past client box (drawer) ===== */
.past-client { background: color-mix(in srgb, var(--cyan) 6%, var(--panel)); border-radius: var(--radius); padding: 12px; }
.check-row { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--cyan); }
.new-deal { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.new-deal select { flex: 1; min-width: 120px; }

/* ===== Past clients page ===== */
.view-head .sub a { color: var(--cyan); font-weight: 600; text-decoration: none; }
.view-head .sub a:hover { text-decoration: underline; }
.archive-note { margin: -4px 0 14px; max-width: 70ch; }
.past-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.past-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-left: 4px solid var(--c);
}
.past-main {
  display: flex; gap: 12px; align-items: center;
  background: none; border: none; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  min-width: 0;
}
.past-who { display: grid; gap: 2px; min-width: 0; }
.past-who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.past-main:hover strong { color: var(--cyan); text-decoration: underline; }
.past-contact { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }

/* ===== Phones and small tablets ===== */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }

  /* The sidebar becomes a bar along the bottom of the screen */
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--edge);
    box-shadow: 0 -4px 20px rgba(33, 51, 67, 0.06);
    background: var(--panel);
  }
  .sidebar a { color: var(--muted); }
  .sidebar a:hover, .sidebar a[aria-current="page"] { color: var(--text); background: none; }
  .topbar { display: none; }
  .brand, .me { display: none; }
  .sidebar .long { display: none; }
  .sidebar .short { display: inline; }
  .task { flex-wrap: wrap; }
  .task-meta { width: 100%; padding-left: 28px; justify-content: flex-start; }
  .task-meta:empty { display: none; }
  .list-tools { margin-left: 0; width: 100%; }
  .reminders .btn.big { justify-self: stretch; } /* a big, easy thumb target */
  .sidebar a { flex-direction: column; gap: 2px; font-size: 0.68rem; padding: 6px 4px; white-space: nowrap; } /* 5 tabs must fit a phone */
  .sidebar a[aria-current="page"]::before { left: 20%; right: 20%; top: -7px; bottom: auto; width: auto; height: 2px; border-radius: 0 0 2px 2px; }

  .view { padding: 22px 16px 100px; }
  .today-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } /* two number cards per row on phones */
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 1.9rem; }
  .board { grid-template-columns: repeat(4, 84%); scroll-snap-type: x mandatory; }
  .board.single { grid-template-columns: 1fr; }
  .column { scroll-snap-align: start; }
  /* Past client rows stack: who on top, then contact, then agent + checkbox */
  .past-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .past-main { grid-column: 1 / -1; }

  .view-map { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; padding-bottom: 76px; }
  .map-panel { border-left: none; border-top: 1px solid var(--edge); overflow: visible; }

  #toasts { left: 16px; right: 16px; bottom: 88px; }
}

/* =====================================================================
   The assistant (js/assistant.js) and the contract reader (js/contract.js)
   ===================================================================== */

/* A small spinning circle: "working on it" */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--edge-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* The round "Assistant" button, bottom right on every screen */
.assistant-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 950;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px 6px 7px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  cursor: pointer;
}
.assistant-btn:hover { box-shadow: var(--accent-glow); filter: brightness(1.08); }
.assistant-btn .buddy { width: 36px; height: 36px; }
.assistant-btn:hover .buddy { animation: buddy-hop 0.5s ease; }
.assistant-btn.hello .buddy { animation: buddy-hop 0.6s ease 0.8s 2; } /* says hi when the page opens */

/* ---- The assistant's face (js/buddy.js) ----
   Each moving part gets "transform-box: fill-box" so it turns and squashes around its own middle. */
.buddy { display: block; overflow: visible; }
.buddy-body, .buddy-eyes, .buddy-eye, .buddy-talk {
  transform-box: fill-box;
  transform-origin: center;
}
.buddy-body { transform-origin: 50% 100%; transition: transform 0.3s ease; }
.buddy-talk { display: none; }

/* idle: blinks every few seconds, and breathes */
.buddy[data-mood="idle"] .buddy-eye { animation: buddy-blink 4.5s infinite; }
.buddy[data-mood="idle"] .buddy-body { animation: buddy-breathe 3.2s ease-in-out infinite; }
/* listening: head tilted, eyes wide */
.buddy[data-mood="listening"] .buddy-body { transform: rotate(-8deg); }
.buddy[data-mood="listening"] .buddy-eye { transform: scale(1.18); transition: transform 0.2s ease; }
/* thinking: looks from side to side */
.buddy[data-mood="thinking"] .buddy-eyes { animation: buddy-look 1.6s ease-in-out infinite; }
/* speaking: swaps the smile for a mouth that opens and closes */
.buddy[data-mood="speaking"] .buddy-smile { display: none; }
.buddy[data-mood="speaking"] .buddy-talk { display: inline; animation: buddy-talk 0.32s ease-in-out infinite alternate; }

@keyframes buddy-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes buddy-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
@keyframes buddy-look { 0%, 100% { transform: translateX(-1.4px); } 50% { transform: translateX(1.4px) translateY(-0.6px); } }
@keyframes buddy-talk { from { transform: scaleY(0.35); } to { transform: scaleY(1.1); } }
@keyframes buddy-hop { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-4px) rotate(-6deg); } 70% { transform: translateY(0) rotate(4deg); } }

/* In the panel's header, the face sits in a green circle, like on the button */
.buddy-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
}
.buddy-badge .buddy { width: 40px; height: 40px; }

/* Some people turn off motion in their phone's settings (it can cause dizziness). Respect that. */
@media (prefers-reduced-motion: reduce) {
  .buddy *, .buddy, .assistant-btn .buddy { animation: none !important; transition: none !important; }
}

/* The chat panel: a card that opens above the button */
.assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1002; /* above the client drawer, so you can ask about the client you're looking at */
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-lift);
}
.assistant-head { display: flex; align-items: center; gap: 12px; }
.assistant-title { flex: 1; min-width: 0; }
.assistant-head h2 { margin: 0 0 2px; font-size: 1.1rem; }
.assistant-head p { margin: 0; }

.assistant-messages {
  flex: 1;
  min-height: 0;          /* lets this part scroll instead of stretching the panel */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}
.bubble {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: var(--radius);
  white-space: pre-wrap;  /* keep the assistant's line breaks */
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.bubble.from-me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.from-assistant { align-self: flex-start; background: var(--panel-strong); border-bottom-left-radius: 4px; }
.bubble.thinking { color: var(--muted); }
.bubble .via { display: block; font-size: 0.7rem; opacity: 0.75; margin-bottom: 2px; }
.starters { display: flex; flex-wrap: wrap; gap: 6px; }
.starters .chip { cursor: pointer; text-align: left; }
.assistant-error { color: var(--urgent); }

.assistant-form { display: flex; gap: 8px; align-items: flex-end; }
.assistant-form textarea { flex: 1; resize: none; font: inherit; }
.assistant-foot { margin: 0; }

/* Contract reader, inside the client drawer */
.contract-reader { margin-top: 12px; }
.file-btn { cursor: pointer; }
.contract-review {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-strong);
}
.contract-review h4 { margin: 12px 0 6px; font-size: 0.9rem; }
.contract-review h4:first-child { margin-top: 0; }
.contract-review .reading { margin: 0; display: flex; gap: 8px; align-items: center; }
.contract-review .facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 0.85rem; }
.contract-review .facts dt { color: var(--muted); }
.contract-review .facts dd { margin: 0; }
.found-dates { display: grid; gap: 6px; }
.found-dates label { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.found-dates label strong { margin-left: auto; }
.found-dates p { margin: 0; }
.watch-out { margin: 0; padding-left: 18px; font-size: 0.85rem; color: var(--urgent); }
.contract-review .row { display: flex; gap: 8px; margin-top: 12px; }

/* Phones: the button sits above the bottom tabs; the panel fills the screen */
@media (max-width: 820px) {
  .assistant-btn { right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); padding: 6px; }
  .assistant-btn .buddy { width: 44px; height: 44px; }
  .assistant-btn span { display: none; }
  .assistant-panel { inset: 0; width: auto; height: auto; border-radius: 0; padding: calc(14px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom)); }
}

/* The microphone button in the Assistant panel (talk instead of typing) */
.mic-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: var(--panel-solid);
  color: var(--cyan);
  cursor: pointer;
}
.mic-btn:hover { border-color: var(--accent); }
.mic-btn:disabled { opacity: 0.5; cursor: default; }
/* While listening: red, with a soft pulse so it's obvious it's recording */
.mic-btn.listening {
  background: var(--urgent);
  border-color: var(--urgent);
  color: #fff;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(181, 67, 44, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(181, 67, 44, 0); }
}

/* The "Daily greeting" on/off switch, under the Assistant panel's title */
.assistant-settings { display: flex; flex-wrap: wrap; gap: 8px; }
.speak-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.speak-toggle:hover { border-color: var(--edge-strong); color: var(--text); }
.speak-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--cyan); }

/* ---- Documents (documents.js): one card per file, in the client panel ---- */
.documents { display: grid; gap: 10px; justify-items: start; }
.doc-card {
  justify-self: stretch;
  display: block; /* a <details>: its inside (.doc-body) is the grid */
  padding: 12px 14px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-strong);
  min-width: 0; /* long file names wrap instead of widening the panel */
}
.doc-card p, .doc-card h4, .doc-card ul { margin: 0; }
.doc-card h4 { font-size: 0.9rem; }
/* The folded line: tap anywhere on it to open or close the card */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; cursor: pointer; list-style: none; }
.doc-head::-webkit-details-marker { display: none; } /* Safari's own triangle; we draw a chevron */
.doc-title { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.doc-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.doc-fold {
  flex: none; width: 9px; height: 9px; margin: 6px 4px 0 0;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.15s;
}
.doc-card[open] .doc-fold { transform: rotate(-135deg); margin-top: 10px; }
.doc-body { display: grid; gap: 10px; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--edge); }
.doc-tools { display: flex; gap: 16px; align-items: center; }
.doc-tools .link-btn { margin: 0; }

/* "Needs your attention": the red flags and the law problems, together, at the top */
.doc-attention {
  display: grid; gap: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--urgent);
  border-radius: 0 8px 8px 0;
  background: var(--panel);
}
.doc-attention .watch-out { color: inherit; } /* the red bar and heading are enough; red paragraphs are hard to read */
.doc-attention h4 { color: var(--urgent); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.found-where { font-size: 0.7rem; font-weight: 600; color: var(--cyan); white-space: nowrap; }

/* "More": the less-used buttons, folded */
.doc-menu summary { list-style: none; }
.doc-menu summary::-webkit-details-marker { display: none; }
.doc-menu[open] summary { background: var(--panel); }
.doc-menu-list { display: grid; gap: 6px; margin-top: 8px; }
.doc-menu-list .btn { justify-content: flex-start; text-align: left; }
.doc-actions { align-items: flex-start; }
.doc-card .reading { display: flex; gap: 8px; align-items: center; }
.doc-more summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.doc-more[open] summary { margin-bottom: 6px; }
.doc-more ul { margin-top: 6px; padding-left: 18px; }
.doc-found { display: grid; gap: 8px; padding-top: 4px; border-top: 1px solid var(--edge); }
.doc-found .found-dates label { align-items: flex-start; }
.found-dates label strong { white-space: nowrap; } /* "Sat, Nov 7" stays on one line */
.doc-card .row { display: flex; flex-wrap: wrap; gap: 8px; }
.documents > .reading { display: flex; gap: 8px; align-items: center; margin: 0; }
.doc-card > .btn { justify-self: start; }

/* ===== Documents tab (js/docs-view.js) ===== */
.doc-drop-card, .doc-row {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.doc-drop-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; padding: 18px; margin-bottom: 22px; }
.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 170px;
  padding: 18px;
  border: 2px dashed var(--edge-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--cyan);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone strong { color: var(--text); overflow-wrap: anywhere; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.drop-zone.has-files { border-style: solid; border-color: var(--accent); }
.drop-form { display: grid; gap: 12px; align-content: start; }
.field { display: grid; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-row .chip { cursor: pointer; background: none; font: inherit; font-size: 0.75rem; }
.chips-row .chip.is-on { color: var(--cyan); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop-form .btn.primary { justify-self: start; }

.doc-rows { display: grid; gap: 12px; }
.doc-row { display: grid; gap: 8px; padding: 14px 16px; }
.doc-row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.doc-row .doc-title { min-width: 0; }
.doc-row .doc-title strong { overflow-wrap: anywhere; }
.doc-answer { border-left: 3px solid var(--accent); padding-left: 10px; }
.doc-answer p { margin: 0 0 3px; }
.doc-row .doc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.warn { color: var(--soon); background: color-mix(in srgb, var(--soon) 12%, transparent); }
.badge.good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.badge.urgent { color: var(--urgent); background: color-mix(in srgb, var(--urgent) 10%, transparent); }

/* ===== Review for signing (js/signing.js) ===== */
dialog.sign-review {
  width: min(1180px, 96vw);
  max-width: none;
  height: 92vh;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.sign-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--edge); }
.sign-title { min-width: 0; }
.sign-title h2 { overflow-wrap: anywhere; }
.sign-title p { margin: 2px 0 0; }
.sign-needed { color: var(--soon); }
.sign-body { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; }
.sign-list { overflow-y: auto; padding: 16px 18px; border-right: 1px solid var(--edge); display: grid; gap: 10px; align-content: start; }
.sign-list h4 { margin: 6px 0 0; font-size: 0.8rem; }
.sign-answer { padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.sign-answer h4 { margin: 0 0 4px; color: var(--cyan); }
.sign-answer p { margin: 0; }
.spot-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.spot {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.spot:hover { background: var(--panel-strong); }
.spot-text { display: grid; min-width: 0; }
.spot-text strong { font-size: 0.85rem; font-weight: 600; }
.spot.is-done .spot-text strong { color: var(--muted); text-decoration: line-through; }
/* The numbered dots, in the list and on the pages. Brick = still to sign, ochre = to fill in, green = done. */
.spot-num {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--urgent);
}
.spot-blank .spot-num { background: var(--soon); }
.is-done .spot-num { background: var(--good); }
.sign-actions { display: grid; gap: 8px; margin-top: 8px; }
.sign-actions .btn { justify-self: stretch; }

.sign-pages { overflow: auto; padding: 18px; background: var(--panel-strong); display: grid; justify-items: center; align-content: start; gap: 18px; }
.sign-page { position: relative; margin: 0; background: #fff; box-shadow: var(--shadow-lift); max-width: 100%; }
.sign-page canvas, .sign-page img { display: block; width: 100%; height: 100%; }
.sign-page figcaption { position: absolute; top: -16px; left: 0; font-size: 0.7rem; color: var(--muted); }
.spot-box {
  position: absolute;
  border: 2px solid var(--urgent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--urgent) 12%, transparent);
  scroll-margin: 80px;
}
.spot-box.spot-blank { border-color: var(--soon); background: color-mix(in srgb, var(--soon) 14%, transparent); }
.spot-box.is-done { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.spot-box .spot-num { position: absolute; top: -11px; left: -11px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
/* A spot the assistant listed but we couldn't find on the page: a numbered dot in the margin */
.spot-missing { position: absolute; right: 6px; top: 6px; }
.spot-missing { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; color: #fff; background: var(--urgent); }
.flash { animation: spot-flash 1.2s ease 2; }
@keyframes spot-flash { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--urgent) 35%, transparent); } }

@media (max-width: 820px) {
  .doc-drop-card { grid-template-columns: 1fr; }
  dialog.sign-review { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .sign-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); overflow-y: auto; }
  .sign-list { border-right: none; border-bottom: 1px solid var(--edge); max-height: none; }
  .sign-pages { overflow: visible; padding: 18px 8px; }
  /* Pages are small on a phone, so the dots are too (and sit further out, off the words) */
  .sign-page .spot-num { min-width: 16px; height: 16px; padding: 0 3px; font-size: 0.6rem; }
  .spot-box .spot-num { top: -9px; left: -9px; }
}

/* Under an answer about Texas law: the official sections it quoted (js/assistant.js bubble()) */
.bubble-sources { display: grid; gap: 3px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--edge-strong); white-space: normal; }
.bubble-sources span { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.bubble-sources a { font-size: 0.8rem; color: var(--cyan); overflow-wrap: anywhere; }

/* "Checked against Texas law" (js/documents.js lawChecks) */
.law-checks { display: grid; gap: 8px; }
.law-checks h4 { margin: 4px 0 6px; font-size: 0.8rem; }
.law-checks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.law-checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82rem; line-height: 1.4; }
.law-checks li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.law-checks a { color: var(--cyan); white-space: nowrap; }
.law-mark { flex: none; min-width: 30px; padding: 1px 6px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; text-align: center; }
.is-ok .law-mark { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.is-problem .law-mark { color: var(--urgent); background: color-mix(in srgb, var(--urgent) 10%, transparent); }

/* "Ready to send" on Today (js/autopilot.js drafts) */
.ready-to-send { margin-bottom: 28px; }
.ready-to-send > p { margin: -4px 0 12px; }
.drafts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.draft { padding: 14px 16px; border-radius: var(--radius); display: grid; gap: 10px; align-content: start; border-left: 3px solid var(--tone, var(--accent)); min-width: 0; }
.draft.priority-0 { --tone: var(--urgent); }
.draft.priority-1 { --tone: var(--soon); }
.draft.priority-2 { --tone: var(--cyan); }
.draft-head p { margin: 4px 0 0; }
.draft summary { cursor: pointer; font-size: 0.85rem; color: var(--cyan); }
.draft details[open] { display: grid; gap: 8px; }
.draft details[open] summary { margin-bottom: 4px; }
.draft textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.85rem; line-height: 1.45; padding: 10px; border-radius: var(--radius); border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); resize: vertical; }
.draft .nudge-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* "Fill it in" (js/fill.js): same frame as the signing review, but a single column */
dialog.fill-review { width: min(640px, 96vw); max-width: none; max-height: 90vh; padding: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.fill-body { overflow-y: auto; padding: 16px 20px 20px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.fill-body p { margin: 0; }
.fill-body h4 { margin: 4px 0 0; font-size: 0.8rem; }
.fill-body textarea { width: 100%; box-sizing: border-box; padding: 10px; border-radius: var(--radius); border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); resize: vertical; line-height: 1.45; }
.fill-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.fill-list li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 0.85rem; overflow-wrap: anywhere; }
.fill-list .mono { color: var(--muted); }
@media (max-width: 640px) {
  dialog.fill-review { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
}

/* Birthday in a client's panel (drafts a note on Today a few days before) */
.birthday-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.birthday-row input { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); }

/* "Worth a call" on Today (autopilot.js callsFor) */
.worth-a-call { margin-bottom: 28px; }
.worth-a-call > p { margin: -4px 0 12px; }
.calls { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.call { padding: 14px 16px; border-radius: var(--radius); display: grid; gap: 8px; align-content: start; border-left: 3px solid var(--violet); min-width: 0; }
.call p { margin: 3px 0 0; }
.talking-points { margin: 0; padding-left: 18px; font-size: 0.85rem; display: grid; gap: 2px; }
.call .nudge-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Posts screen (js/posts.js) */
.broker-card, .posts-ask { display: grid; gap: 10px; margin-bottom: 22px; max-width: 720px; }
.broker-card p, .posts-ask p { margin: 0; }
.broker-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.broker-card input, .posts-ask input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); }
.posts-ask .btn { justify-self: start; }
.posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.post { padding: 14px; border-radius: var(--radius); display: grid; gap: 10px; align-content: start; min-width: 0; }
.post.is-done { opacity: 0.6; }
/* A post the assistant just wrote: a soft outline that fades after a few seconds */
.post.is-fresh { animation: fresh-post 6s ease-out; }
@keyframes fresh-post { 0%, 70% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.post-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post-picture { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius); background: var(--panel); object-fit: cover; }
.post textarea { width: 100%; box-sizing: border-box; padding: 10px; border-radius: var(--radius); border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); font-size: 0.85rem; line-height: 1.45; resize: vertical; }
.hashtags { margin: 0; color: var(--cyan); overflow-wrap: anywhere; }
.post .nudge-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* The picture on each post opens the editor */
.post-picture-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--radius); display: block; }
.post-picture-btn .post-picture { display: block; }
.edit-hint { position: absolute; right: 10px; bottom: 10px; padding: 5px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent); color: var(--text); opacity: 0; transition: opacity 0.15s; }
.post-picture-btn:hover .edit-hint, .post-picture-btn:focus-visible .edit-hint { opacity: 1; }
@media (hover: none) { .edit-hint { opacity: 1; } } /* phones: always show it, there's no hover */

/* The picture editor (js/post-editor.js) */
dialog.post-editor { width: min(1100px, 96vw); max-width: none; height: 94vh; padding: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.editor-stage { position: relative; min-height: 0; background: color-mix(in srgb, var(--text) 6%, var(--panel)); }
/* Centered and shrunk to fit whatever space there is, keeping its 4:5 shape */
.editor-stage canvas { position: absolute; inset: 0; margin: auto; max-width: calc(100% - 32px); max-height: calc(100% - 32px);
  width: auto; height: auto; border-radius: 8px; box-shadow: var(--shadow);
  touch-action: none; cursor: grab; } /* touch-action: none = dragging doesn't scroll the page */
.editor-tools { overflow-y: auto; padding: 16px 18px; border-left: 1px solid var(--edge); display: grid; gap: 18px; align-content: start; }
.tool-group { display: grid; gap: 8px; }
.tool-group h4 { margin: 0; font-size: 0.8rem; }
.tool-group p { margin: 0; }
.tool-group .row { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-group textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); resize: vertical; }
.swatches { display: flex; gap: 10px; }
.swatch-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 2px solid var(--edge-strong); cursor: pointer; }
.swatch-btn.is-on { outline: 3px solid var(--accent); outline-offset: 2px; }
.slider { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; font-size: 0.85rem; }
.editor-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--edge); }
.editor-foot .spacer { flex: 1; }
@media (max-width: 760px) {
  dialog.post-editor { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .editor-body { grid-template-columns: 1fr; grid-template-rows: 52vh minmax(0, 1fr); }
  .editor-tools { border-left: 0; border-top: 1px solid var(--edge); }
}

/* =====================================================================
   The dashboard (Today screen, Nov 2026 "Clean CRM" redesign)
   Number cards across the top, then two columns of white panels.
   ===================================================================== */
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
a.stat { color: inherit; text-decoration: none; gap: 4px; padding: 14px 16px; transition: border-color 0.15s, box-shadow 0.15s; }
a.stat:hover { border-color: var(--edge-strong); box-shadow: var(--shadow-lift); }
.stat-label { order: -1; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-value { font-family: var(--display); font-size: 1.9rem; font-weight: 500; }
.stat-extra { color: var(--muted); font-weight: 400; }
.stat-extra.bad { color: var(--urgent); font-weight: 600; }

.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: grid; gap: 16px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--edge); }
.panel-head h2 { margin: 0; font-size: 0.98rem; font-weight: 600; }
.panel-link { margin-left: auto; font-size: 0.85rem; }
.panel-link a { color: var(--cyan); font-weight: 500; text-decoration: none; }
.panel-link a:hover { text-decoration: underline; }
.panel-body { padding: 12px 16px 16px; display: grid; gap: 10px; justify-items: start; min-width: 0; }
.panel-body > ul, .panel-body > ol { width: 100%; }
.panel .empty { margin: 4px 0; padding: 0; text-align: left; color: var(--muted); }
/* Cards inside a panel become plain rows with a line between them (no card-in-a-card) */
.panel .drafts, .panel .calls, .panel .nudges { grid-template-columns: 1fr; gap: 0; }
.panel .draft, .panel .call, .panel .nudge {
  box-shadow: none; border: 0; border-radius: 0; background: none;
  border-top: 1px solid var(--edge); padding: 12px 0 12px 14px;
  animation: none;
}
.panel li:first-child { border-top: 0; }
.panel .draft, .panel .call { border-left: 3px solid var(--tone, var(--violet)); }
.panel .draft.priority-0, .panel .nudge.priority-0 { --tone: var(--urgent); }
.ready-to-send, .worth-a-call { margin-bottom: 0; }

/* Pipeline snapshot: one tile per board column */
.funnel { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.funnel-stage { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); color: inherit; text-decoration: none; min-width: 0; }
.funnel-stage:hover { background: var(--panel-strong); }
.funnel-n { font-family: var(--display); font-size: 1.5rem; font-weight: 500; }
.funnel-bar { height: 5px; border-radius: 3px; background: var(--edge); margin-top: 6px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* The "+ New client" in the page header is for phones; computers have it in the top bar */
@media (min-width: 821px) { .phone-only { display: none !important; } }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:nth-child(5) { grid-column: span 2; } /* 5 cards: the last one fills its row */
  #view-today h1 { font-size: 1.7rem; }
}

/* ===== Connected accounts and sending for signatures (esign.js) ===== */
/* One service per row: name and status on the left, its button on the right */
.connect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--edge);
}
.connect-row > div { display: grid; gap: 2px; min-width: 0; }
.connect-more summary { cursor: pointer; color: var(--cyan); padding: 6px 0; }

/* A document's DocuSign status: a thin colored edge says how it's going */
.esign-line {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--panel-strong);
  box-shadow: inset 3px 0 0 var(--cyan);
  font-size: 0.85rem;
}
.esign-line.esign-completed { box-shadow: inset 3px 0 0 var(--good); }
.esign-line.esign-declined, .esign-line.esign-voided { box-shadow: inset 3px 0 0 var(--urgent); }

/* The "Send for signatures" window */
dialog.esign-send { width: min(560px, calc(100% - 24px)); padding: 0; }
.esign-form { display: grid; gap: 12px; padding: 0 20px 20px; }
.esign-form .sign-head { margin: 0 -20px; }
.esign-form h4 { margin: 4px 0 0; }
.signer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.signer .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--text); }
.signer .check input { width: 16px; height: 16px; accent-color: var(--cyan); }
@media (max-width: 640px) { .signer { grid-template-columns: 1fr; } }

/* The client's dotloop loop */
.loop-box { display: grid; gap: 8px; }

/* ===== Documents page tabs (docs-view.js) =====
   A row of underlined tabs. When the screen is too narrow for all five, they wrap onto a
   second line rather than hiding off the edge (a hidden tab is a tab nobody finds). */
.doc-tabs {
  display: flex;
  gap: 4px;
  margin: 26px 0 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--edge);
}
.doc-tabs button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; /* sits on top of the row's line, so the chosen tab's underline replaces it */
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.doc-tabs button:hover { color: var(--text); }
.doc-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.doc-tabs .mono {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--edge);
  font-size: 0.75rem;
  text-align: center;
}
/* Needs attention with something in it: the count turns red so it's noticed from any tab */
.doc-tabs .has-alert .mono { background: color-mix(in srgb, var(--urgent) 10%, transparent); border-color: color-mix(in srgb, var(--urgent) 35%, transparent); color: var(--urgent); }
.doc-row .doc-actions { flex-wrap: wrap; }

/* ===== Phone bottom bar: 5 tabs + the "More" sheet (main.js) =====
   Computers: the More button is hidden and every page is in the sidebar, as before.
   Phones: Deals, Clients, This week, Showings, More (rebuild phase 2). The other pages live in the More sheet. */
.more-tab { display: none; }
.more-sheet[hidden] { display: none; }
@media (max-width: 820px) {
  .sidebar a.in-more { display: none; }
  /* The order along the bottom (the sidebar's own order stays the same on computers) */
  .sidebar a[data-view="deals"] { order: 1; }
  .sidebar a[data-view="pipeline"] { order: 2; }
  .sidebar a[data-view="week"] { order: 3; }
  .sidebar a[data-view="map"] { order: 4; }
  .more-tab {
    order: 5;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.68rem; font-weight: 500;
    padding: 6px 4px; cursor: pointer; position: relative;
  }
  .more-tab[data-current], .more-tab[aria-expanded="true"] { color: var(--text); }
  .more-tab[data-current] .nav-icon { color: var(--accent); }
  /* A larger tap area for each of the 5 tabs now that there's room */
  .sidebar a, .more-tab { flex: 1; }

  .more-sheet {
    position: fixed; inset: 0; z-index: 899; /* just under the bottom bar, so More stays tappable to close */
    background: rgba(26, 38, 51, 0.4);
    display: flex; align-items: flex-end;
  }
  .more-panel {
    width: 100%;
    background: var(--panel);
    border-radius: 18px 18px 0 0;
    padding: 10px max(16px, env(safe-area-inset-left)) calc(84px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
    display: grid; gap: 6px;
    animation: sheet-up 0.18s ease-out;
  }
  .more-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--edge); justify-self: center; margin-bottom: 6px; }
  .more-links { display: grid; }
  .more-links a {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 6px; border-bottom: 1px solid var(--edge);
    color: var(--text); text-decoration: none; font-weight: 500;
  }
  .more-links a .nav-icon { width: 22px; height: 22px; color: var(--muted); }
  .more-links a[aria-current="page"] .nav-icon { color: var(--accent); }
  .more-panel .link-btn { justify-self: start; padding: 10px 6px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .more-panel { animation: none; } }
/* While the More sheet is open, the floating Assistant button steps aside so it doesn't cover the list */
body:has(.more-sheet:not([hidden])) #assistant-btn { display: none; }

/* ===== Today, simplified: 3 counts, "Up next", fold-away sections ===== */
/* Three counts you can tap. A button filters the Up next list; "Due" links to Tasks. */
.counts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.count-card {
  display: grid; gap: 2px; justify-items: start; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; font: inherit; text-align: left; cursor: pointer;
}
.count-card:hover { border-color: var(--edge-strong); }
.count-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.count-n { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.count-label { font-size: 0.8rem; color: var(--muted); }
.count-card.alert .count-n { color: var(--urgent); }

/* Up next: one row per item, a colored strip for urgency, ONE button, and "..." */
.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.next-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--panel);
}
.next-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: var(--radius) 0 0 var(--radius); background: var(--edge-strong); }
.next-bar.tone-0 { background: var(--urgent); }
.next-bar.tone-1 { background: var(--soon); }
.next-bar.tone-2 { background: var(--cyan); }
.next-text { flex: 1; min-width: 0; display: grid; gap: 2px; justify-items: start; }
.next-text .muted { overflow-wrap: anywhere; }
/* Only two lines of detail per row; the full story is one tap away (Open) */
.next-text > .muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.next-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.up-next .show-more { margin-top: 10px; }

/* The "..." menu: a <details> whose list floats under the button */
.dots-menu { position: relative; }
.dots-menu > summary { list-style: none; cursor: pointer; }
.dots-menu > summary::-webkit-details-marker { display: none; }
.dots-menu .menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px;
  display: grid; padding: 4px; background: var(--panel); border: 1px solid var(--edge);
  border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.menu-item {
  display: block; padding: 9px 10px; border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: 0.9rem; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* A section that's one line until tapped: the title row is the <summary> */
.fold-panel > summary { cursor: pointer; list-style: none; align-items: center; border-bottom: 0; }
.fold-panel > summary::-webkit-details-marker { display: none; }
.fold-panel[open] > summary { border-bottom: 1px solid var(--edge); }
.fold-chev { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.fold-panel[open] > summary .fold-chev { transform: rotate(-135deg); }
.dash-col { display: grid; gap: 16px; align-content: start; }

@media (max-width: 820px) {
  .counts-row { gap: 8px; }
  .count-card { padding: 10px 12px; }
  .count-n { font-size: 1.35rem; }
}

/* ===== Client panel, simplified ===== */
/* A drawer section that's one line until tapped (the title row is the <summary>) */
.fold-section { padding: 0; }
.fold-section > summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 16px; cursor: pointer; list-style: none;
}
.fold-section > summary::-webkit-details-marker { display: none; }
.fold-section > summary h3 { margin: 0; }
.fold-section .fold-body { padding: 4px 16px 16px; display: grid; gap: 10px; }
/* "> summary": only this section's own arrow turns, not the arrows of folds inside it */
.fold-section[open] > summary .fold-chev, .attention-fold[open] > summary .fold-chev { transform: rotate(-135deg); }
.sub-head { margin: 8px 0 0; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }

.progress-section .progress-head { justify-content: space-between; margin-bottom: 10px; }
.steps-fold > summary { list-style: none; cursor: pointer; margin-top: 10px; display: inline-block; }
.steps-fold > summary::-webkit-details-marker { display: none; }
.log-menu > summary { list-style: none; }

/* The ONE next step: a dark card, so it's the first thing the eye lands on */
.next-step {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--navy); color: #fff;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
}
.next-step-label { grid-column: 1; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: #9fb2c6; }
.next-step strong { grid-column: 1; font-weight: 500; }
.next-step .btn { grid-column: 2; grid-row: 1 / span 2; background: #fff; color: var(--navy); border-color: #fff; }

/* "Needs attention": a red row that starts closed. Used on the client and on each document. */
.attention-fold {
  margin-top: 14px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--urgent) 35%, transparent);
  background: color-mix(in srgb, var(--urgent) 6%, var(--panel));
}
.doc-body .attention-fold { margin-top: 0; }
.attention-fold > summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer; list-style: none; }
.attention-fold > summary::-webkit-details-marker { display: none; }
.attention-title { font-weight: 600; color: var(--urgent); }
.attention-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--urgent); color: #fff; font-size: 0.75rem; text-align: center; }
.attention-fold .fold-chev { border-color: var(--urgent); }
.attention-fold .doc-attention { margin: 0 12px 12px; }
.attention-list { list-style: none; margin: 0; padding: 0 14px 12px; display: grid; gap: 8px; }
.attention-list li {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  padding: 8px 10px; border-left: 3px solid var(--urgent); border-radius: 0 6px 6px 0; background: var(--panel); font-size: 0.88rem;
}
.attention-list li.soon { border-left-color: var(--soon); }
.attention-list li > span { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.attention-list .link-btn { flex-shrink: 0; margin: 0; }

/* Deal timeline: dots on a line. Past = filled (done), today = coral, next = bold, missing = faint */
.deal-timeline { list-style: none; margin: 0; padding: 0; }
.tl-row { position: relative; display: flex; gap: 12px; padding: 6px 0; }
.tl-row:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 2px; background: var(--edge); }
.tl-dot { flex-shrink: 0; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--edge-strong); background: var(--panel); }
.tl-text { display: grid; gap: 1px; min-width: 0; }
.tl-row.past .tl-dot { background: var(--good); border-color: var(--good); }
.tl-row.past .tl-label { color: var(--muted); }
.tl-row.today .tl-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.tl-row.today .tl-label, .tl-row.next .tl-label { font-weight: 600; }
.tl-row.next .tl-dot { border-color: var(--cyan); }
.tl-row.missing { opacity: 0.6; }

/* Broker file checklist */
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--edge); border-radius: 8px; }
.file-text { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: 0.9rem; }
.file-mark { flex-shrink: 0; width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--edge-strong); }
.file-row.doc .file-mark, .file-row.have .file-mark { background: var(--good); border-color: var(--good); }
.file-row.na .file-mark { background: var(--edge); border-color: var(--edge); }
.file-row.na .file-text > span:first-child { color: var(--muted); text-decoration: line-through; }
.file-row.missing { border-color: color-mix(in srgb, var(--urgent) 40%, transparent); background: color-mix(in srgb, var(--urgent) 5%, transparent); }
.file-row.missing .file-mark { border-color: var(--urgent); }

/* People on the deal */
.people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.person-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.person-row.editing { display: grid; gap: 4px; }
.person-text { display: grid; min-width: 0; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.person-form { display: flex; gap: 6px; flex-wrap: wrap; }
.person-form input { flex: 1 1 140px; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); font: inherit; font-size: 0.9rem; }

/* ===== Send for signing (handoff.js) ===== */
.menu-item.danger { color: var(--urgent); }
.doc-actions { align-items: center; }
.handoff-sheet .esign-form { display: grid; gap: 12px; }
.handoff-sheet h4 { margin: 4px 0 0; }
.app-chips .chip { font-size: 0.85rem; padding: 6px 12px; }
.other-app { display: flex; gap: 8px; flex-wrap: wrap; }
.other-app input { flex: 1 1 180px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--edge-strong); background: var(--panel-solid); color: var(--text); font: inherit; }
.handoff-warn { margin: 0; padding: 8px 10px; border-left: 3px solid var(--soon); background: color-mix(in srgb, var(--soon) 8%, transparent); border-radius: 0 6px 6px 0; }

/* The three steps: a number in a circle that turns into a green tick when done */
.handoff-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: step; }
.handoff-steps li {
  counter-increment: step; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--edge); border-radius: var(--radius);
}
.handoff-steps li::before {
  content: counter(step); flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 600;
  background: color-mix(in srgb, var(--cyan) 12%, transparent); color: var(--cyan);
}
.handoff-steps li.done::before { content: "\2713"; background: var(--good); color: #fff; }
.handoff-steps li > div { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }

/* The line on a document that's out for signature */
.handoff-line { display: grid; gap: 6px; padding: 8px 10px; border-left: 3px solid var(--cyan); border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--cyan) 6%, transparent); margin: 0; }
.handoff-line.done { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 6%, transparent); }

/* Documents page: the files you picked, waiting for "which client?" */
.drop-files { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; overflow-wrap: anywhere; }
#view-documents.dragging { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: var(--radius); }
.doc-tabs button { white-space: nowrap; }
.chip.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }

/* ===== Database page (database.js) and the import bar on Clients ===== */
.btn.danger { color: var(--urgent); }
.db-imports { padding: 12px 16px; margin-bottom: 14px; }
.db-imports .small-head { margin: 0 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.db-import { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--edge); font-size: 0.9rem; }
.db-import .row, .import-bar .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* The "what to do with the ticked people" bar sticks to the top while you scroll the list */
.db-actions { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 14px; margin-bottom: 10px; }
.db-row { grid-template-columns: auto minmax(0, 2fr) minmax(0, 1.4fr) auto; }
.db-pick { width: 18px; height: 18px; accent-color: var(--cyan); }
.import-bar { padding: 12px 16px; margin-bottom: 14px; border-left: 4px solid var(--cyan); display: grid; gap: 8px; }
.import-bar p { margin: 0; max-width: 75ch; }
@media (max-width: 820px) {
  .db-row { grid-template-columns: auto 1fr auto; }
  .db-row .past-main { grid-column: 2 / -1; }
  .db-row .past-contact { grid-column: 2 / 3; }
}

/* ===== Select mode on Clients (pipeline.js): tick cards, delete in bulk ===== */
.select-bar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 14px; margin-bottom: 12px; }
.client-card.selectable { position: relative; padding-left: 44px; }
.pick-box {
  position: absolute; left: 12px; top: 14px; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--edge); display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; color: #fff;
}
.client-card.picked { outline: 2px solid var(--cyan); }
.client-card.picked .pick-box { background: var(--cyan); border-color: var(--cyan); }

/* ===== Import: the possible-duplicates list (importer.js dupesStep) ===== */
.dupe-all { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.dupe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; }
.dupe { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--edge); border-radius: var(--radius); }
.dupe-who { display: grid; gap: 2px; min-width: 0; }
.dupe-rows { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.dupe-choice { justify-self: start; flex-wrap: wrap; }

/* ===== The assistant pointing something out (ui.js spotlight, assistant.js showInApp) ===== */
.spotlight { animation: spotlight 1.2s ease-out 2; border-radius: var(--radius); }
@keyframes spotlight {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}
.spotlight { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Wide screens: with a client card open, the assistant moves left of it, so both can be seen */
@media (min-width: 1000px) {
  body:has(.drawer.open) .assistant-panel { right: calc(min(500px, 100%) + 16px); }
}

/* "Past client" label on Database rows (past clients show there automatically) */
.db-tag {
  display: inline-block; padding: 1px 7px; margin-right: 4px; border-radius: 999px;
  border: 1px solid var(--edge-strong); color: var(--muted); font-size: 11px; letter-spacing: .02em;
}

/* Ticking a date off as done (deal.js timeline, drawer.js Other deadlines).
   On the timeline the dot itself is the tick box: an empty circle, green with a tick when done. */
.tl-check { appearance: none; -webkit-appearance: none; cursor: pointer; margin: 3px 0 0; padding: 0; position: relative; }
.tl-check:hover { border-color: var(--good); }
.tl-check:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tl-check:checked::after {
  content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 7px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.deadline-check { flex-shrink: 0; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--good); cursor: pointer; }
.deadline-row.done { border-left-color: var(--good); }
.deadline-row.done .deadline-title { color: var(--muted); text-decoration: line-through; }
/* A date that passed without being ticked: grey, not green, so "done" always means someone ticked it */
.tl-row.past .tl-check:not(:checked) { background: var(--panel-strong); border-color: var(--edge-strong); }
.tl-check:checked { background: var(--good); border-color: var(--good); }

/* ===== The deal screen (deal-screen.js): one timeline, a Needs you card, three tabs =====
   Used in the client panel once a deal is under contract. Same idea as the mockup in
   08-homebase-redesign-mockups/tc-app.html, in the app's own colors. */
.ds { display: grid; gap: 12px; margin: 4px 0 14px; }
.ds-facts { display: flex; flex-wrap: wrap; gap: 6px; }

/* Where the deal is: one short bar per under-contract stage. Tap one to move the deal there. */
.ds-miles { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.ds-miles button { width: 100%; display: grid; gap: 4px; justify-items: center; text-align: center; background: none; border: 0; padding: 0; font-size: 0.7rem; line-height: 1.2; color: var(--dim); cursor: pointer; }
.ds-miles i { width: 100%; height: 5px; border-radius: 99px; background: var(--panel-strong); }
.ds-miles .done button { color: var(--muted); }
.ds-miles .done i { background: var(--good); }
.ds-miles .now button { color: var(--text); font-weight: 600; }
.ds-miles .now i { background: var(--accent); }

/* Needs you: a soft red card. Every row has its own clear button. */
.ds-needs { border: 1px solid color-mix(in srgb, var(--urgent) 30%, var(--edge)); background: color-mix(in srgb, var(--urgent) 4%, var(--panel)); border-radius: 12px; padding: 10px 12px; }
.ds-needs h3 { margin: 0 0 4px; font-size: 0.9rem; color: var(--urgent); display: flex; gap: 6px; align-items: center; }
.ds-needs ul { list-style: none; margin: 0; padding: 0; }
.ds-needs li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--urgent) 14%, var(--edge)); font-size: 0.86rem; }
.ds-needs li:first-child { border-top: 0; }
.ds-need-text { min-width: 0; flex: 1 1 180px; display: grid; gap: 1px; }
.ds-need-text .late { color: var(--urgent); font-weight: 600; }
.ds-need-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-clear { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--good); font-size: 0.86rem; font-weight: 500; }

/* The three tabs */
.ds-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--panel-strong); border-radius: 10px; padding: 3px; }
.ds-seg button { background: none; border: 0; border-radius: 8px; padding: 7px 6px; font: inherit; font-size: 0.84rem; font-weight: 500; color: var(--muted); cursor: pointer; }
.ds-seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* The ONE timeline: a line down the left, a tick on each step, a "Today" marker */
.ds-tl { list-style: none; margin: 0; padding: 0; position: relative; }
.ds-tl::before { content: ""; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 2px; background: var(--edge); }
.ds-step { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; }
.ds-tick { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--edge-strong); background: var(--panel); color: transparent; display: grid; place-items: center; padding: 0; cursor: pointer; }
.ds-tick.start { border-color: var(--cyan); background: var(--cyan); cursor: default; transform: scale(0.6); }
.ds-step.done .ds-tick { background: var(--good); border-color: var(--good); color: #fff; }
.ds-step.late .ds-tick { border-color: var(--urgent); }
.ds-step.soon .ds-tick { border-color: var(--accent); }
.ds-what { display: grid; gap: 2px; font-size: 0.88rem; }
.ds-step.done .ds-title { color: var(--dim); text-decoration: line-through; }
.ds-step.late .ds-what > .small { color: var(--urgent); font-weight: 600; }
.ds-step.soon .ds-what > .small { color: var(--soon); font-weight: 600; }
.ds-links { display: flex; flex-wrap: wrap; gap: 12px; }
.ds-links .link-btn { font-size: 0.78rem; }
.ds-help { margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--cyan) 9%, var(--panel)); font-size: 0.8rem; }
.ds-tag { font-size: 0.68rem; color: var(--muted); background: var(--panel-strong); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.ds-today { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 34px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.ds-today::after { content: ""; flex: 1; height: 1px; background: var(--accent); }
.ds-move { padding: 4px 0 8px 34px; }
.ds-fold { justify-self: start; }

/* Typing a date by hand */
.ds-editor { display: grid; gap: 6px; margin-top: 6px; padding: 10px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); }
.ds-editor input[type=date] { max-width: 100%; }
.ds-arrived { display: grid; gap: 2px; }
.ds-editor-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* Add a step */
.ds-add { display: grid; gap: 6px; }
.ds-add input, .ds-add select { min-width: 0; }
.ds-add-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-add-row input, .ds-add-row select { flex: 1 1 120px; }


/* ===== Deals list (deals.js) and This week (week.js): rebuild phase 2 ===== */
.deal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.deal-card {
  display: flex; flex-direction: column; gap: 10px; text-align: left; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--edge); border-left: 4px solid var(--c);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer; min-width: 0;
}
.deal-card:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--edge)); border-left-color: var(--c); }
.deal-card-top { display: flex; align-items: center; gap: 10px; }
.deal-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.deal-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-card .chip { flex: none; }
.deal-next { font-size: 0.88rem; }
.deal-bar { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--edge) 70%, transparent); overflow: hidden; }
.deal-bar span { display: block; height: 100%; background: var(--c); border-radius: inherit; }
.deal-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.week { max-width: 760px; }
.week-h { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 8px; }
.week-h:first-child { margin-top: 0; }
.week-h.late { color: var(--urgent); }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.week-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--edge); border-radius: var(--radius); background: var(--panel);
}
.week-row.late { border-left: 3px solid var(--urgent); }
.week-row.done .week-title { text-decoration: line-through; color: var(--dim); }
.week-what { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1; }
.week-what .link-btn { padding: 0; font-size: 0.8rem; text-align: left; }
.week-after { margin-top: 18px; }

/* People tab: "Fill from the contract" (deal-screen.js, rebuild phase 4) */
.ds-reread { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; margin-bottom: 12px;
  border: 1px dashed var(--edge-strong); border-radius: var(--radius); }
.ds-reread p { margin: 0; flex: 1 1 220px; }

/* Contacts (database.js, rebuild phase 3): one list. Row = tick, who, contact, actions. */
.db-row { grid-template-columns: auto minmax(0, 2fr) minmax(0, 1.4fr) auto; }
.contact-acts { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.deal-person .past-who .link-btn { padding: 0; font-size: 0.8rem; white-space: normal; }
.deal-person .past-who > .small { white-space: normal; }
@media (max-width: 820px) {
  .db-row .contact-acts { grid-column: 2 / -1; justify-content: flex-start; }
}

/* "Close this deal?" pop-up (close-deal.js) */
.close-dialog { width: min(460px, calc(100% - 32px)); }
.close-box { display: grid; gap: 12px; }
.close-box p { margin: 0; color: var(--muted); }
.close-box .close-warn { color: var(--soon); }
.close-choices { display: grid; gap: 8px; margin-top: 4px; }
.close-choices .btn { display: grid; justify-items: start; gap: 2px; text-align: left; padding: 10px 14px; }
.close-choices .btn span { font-size: 0.78rem; font-weight: 400; opacity: 0.85; }
.close-choices .btn.ghost { justify-items: center; }

/* The assistant's change cards (assistant.js, rebuild phase 5): nothing changes until Confirm */
.change-cards { display: grid; gap: 8px; align-self: stretch; }
.change-card { border: 1px solid var(--edge-strong); border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 10px 12px; background: var(--panel); display: grid; gap: 6px; }
.change-card p { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.change-card.done { border-left-color: var(--good); }
.change-card.skipped { opacity: 0.6; border-left-color: var(--edge-strong); }
.change-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.change-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.change-ok { color: var(--good); }
.starters-for { flex-basis: 100%; margin: 0; }

/* ===== Pending Pro onboarding (login.js) ===== */
.brand-logo { width: 34px; height: 34px; border-radius: 9px; }
/* "Create account" and "Sign in" side by side, like two halves of one switch */
.login-tabs {
  display: inline-flex; gap: 4px; padding: 4px; margin: 0 auto 22px;
  background: var(--panel-strong); border-radius: 999px;
}
.login-tabs button {
  border: 0; background: none; padding: 8px 16px; border-radius: 999px;
  font: inherit; font-size: 0.88rem; color: var(--muted); cursor: pointer;
}
.login-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
/* On the sign-in cards: Forgot password?, Sign out */
.login .link-btn { border: 0; background: none; padding: 4px; font: inherit; font-size: 0.85rem; color: var(--cyan); text-decoration: underline; cursor: pointer; justify-self: center; }
.login-step { margin: 0 0 6px; color: var(--violet); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.login-beta { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--good) 12%, white); color: #00695b; font-size: 0.85rem; }
/* The "not a substitute for an attorney" notice: plain and readable, not hidden in grey fine print */
.login-legal { width: min(420px, 100%); margin: 26px auto 0; font-size: 0.8rem; line-height: 1.55; color: var(--muted); text-align: left; }
.login-legal strong { color: var(--text); }
.login-form select { width: 100%; }
/* Deals, empty workspace: "Start your first deal" (deals.js firstDeal) */
.first-deal { grid-column: 1 / -1; max-width: 460px; margin: 40px auto; padding: 32px 24px; text-align: center;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--shadow); }
.first-deal img { border-radius: 12px; }
.first-deal h2 { margin: 14px 0 8px; }
.first-deal p { margin: 0 0 20px; line-height: 1.55; }
.brand-logo.small { width: 26px; height: 26px; border-radius: 7px; }
/* Team page: invite links (team.js) */
.invite-made { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--panel-strong); }
.invite-made p { margin: 0; }
.invite-made input { width: 100%; font-size: 0.8rem; }
.invite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.invite-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
.invite-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* Deal screen: "Start with the signed contract" at the top of a new deal (deal-screen.js contractFirst) */
.ds-first { margin: 4px 0 16px; padding: 14px 16px; border: 1px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 6%, white); }
.ds-first h4 { margin: 0 0 8px; }

/* "Upload contract or packet" (contract.js): the box is also a drop zone for files and folders */
.contract-drop { display: grid; gap: 8px; border-radius: var(--radius); transition: background 0.15s, box-shadow 0.15s; }
.contract-drop .row { display: flex; flex-wrap: wrap; gap: 8px; }
.contract-drop.drag-over { background: var(--panel); box-shadow: 0 0 0 2px var(--accent); }

/* "Contract or packet" on the New deal form (index.html): a label, a button, and what was picked */
.packet-pick { display: grid; gap: 6px; justify-items: start; }
.packet-pick[hidden] { display: none; }
.packet-label { font-size: 0.9rem; color: var(--muted); }
.packet-pick [data-packet-chosen] { overflow-wrap: anywhere; }
