/* ============================================================
   The agent portal — home, my listings, the board.

   Everything here lives inside the existing slate world and uses its
   tokens; nothing invents a colour. The new work is structural: a
   two-door home, a list that leads with state, and a claim sheet
   built to read like the printed one it replaces.

   Motion rules, applied throughout and worth stating once:
   transform and opacity only, ease-out for anything entering,
   nothing over 220ms, :active on every pressable thing, hover gated
   behind a fine pointer, and all of it dropped under
   prefers-reduced-motion. Entrances animate transform only — a
   filled opacity:0 from-state permanently hides content wherever the
   animation clock does not advance, which has blanked this app
   before.
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─── Home: two doors ───────────────────────────────────────
   Deliberately large. This is the first screen after sign-in on a
   phone held in one hand in a car, and the two choices should be
   unmissable rather than tasteful. */

.doors {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.door {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 18px 18px 18px 20px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 14px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms var(--ease-out),
              box-shadow 160ms var(--ease-out),
              transform 160ms var(--ease-out);
}
.door:active { transform: scale(0.99); }
.door:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .door:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
}

.door-icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}
.door-icon svg { width: 22px; height: 22px; }

.door-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.door-title { font-size: 18px; font-weight: 650; letter-spacing: -0.011em; color: var(--ink); }
.door-sub { font-size: 13.5px; color: var(--ink-muted); }

.door-state {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--neutral-soft);
  border: 1px solid var(--neutral-line);
  border-radius: 999px;
  padding: 6px 11px;
  white-space: nowrap;
}
/* Amber only where something is actually waiting on this person. */
.door-state.is-urgent {
  color: var(--attention-ink);
  background: var(--attention-soft);
  border-color: var(--attention-line);
}

.door-go { color: var(--ink-faint); display: grid; place-items: center; }
.door-go svg { width: 18px; height: 18px; }

.home-next { margin-top: 18px; }

@media (max-width: 560px) {
  .door { grid-template-columns: auto 1fr auto; padding: 16px; gap: 12px; }
  .door-go { display: none; }              /* the whole card is the target */
  .door-state { grid-column: 2 / -1; justify-self: start; }
}

/* ─── My listings ───────────────────────────────────────────
   A row leads with the address and answers "does this need me?"
   before the eye reaches the right-hand side. */

.lrows { display: flex; flex-direction: column; gap: 8px; }

.lrow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md, 12px);
  text-decoration: none;
  color: inherit;
  transform: translateY(6px);
  animation: portal-rise 260ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 35ms);
  transition: border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.lrow:active { transform: scale(0.995); }
.lrow:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .lrow:hover { border-color: var(--line-strong); }
}

.lrow-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lrow-addr { font-weight: 620; color: var(--ink); letter-spacing: -0.008em; }
.lrow-note { font-size: 13px; color: var(--ink-muted); }

.lrow-state {
  font-size: 12.5px; font-weight: 650;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--neutral-soft); border: 1px solid var(--neutral-line);
  color: var(--neutral-ink);
}
.lrow-state.is-warn {
  background: var(--attention-soft); border-color: var(--attention-line);
  color: var(--attention-ink);
}
.lrow-state.is-ok {
  background: var(--positive-soft); border-color: var(--positive-line);
  color: var(--positive-ink);
}
.lrow-go { color: var(--ink-faint); display: grid; place-items: center; }
.lrow-go svg { width: 17px; height: 17px; }

@media (max-width: 560px) {
  .lrow { grid-template-columns: 1fr auto; }
  .lrow-go { display: none; }
}

/* The set-hours widget. It is the reason the drill-in exists, so it
   gets the visual weight of a primary action, not a settings row. */
.setwidget {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; padding: 18px 20px;
}
.setwidget.is-wanted {
  border-color: var(--attention-line);
  background: var(--attention-soft);
}
.setwidget-copy { min-width: 240px; flex: 1; }
.setwidget-copy h2 { margin: 0 0 4px; font-size: 17px; }
.setwidget-copy p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.setwidget-days {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.setwidget-days li {
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}

/* ─── The board: one card per house ─────────────────────── */

.hgrid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.hcard {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md, 12px);
  text-decoration: none; color: inherit;
  transform: translateY(6px);
  animation: portal-rise 260ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 35ms);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out),
              transform 160ms var(--ease-out);
}
.hcard:active { transform: scale(0.995); }
.hcard:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .hcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
}

.hcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hcard-addr { font-weight: 640; color: var(--ink); letter-spacing: -0.008em; line-height: 1.3; }
.hcard-sub { font-size: 13px; color: var(--ink-muted); }
.hcard-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.hc-date {
  font-size: 12.5px; color: var(--ink-soft);
  background: var(--surface-sunken); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 4px 8px;
}
.hc-date b { font-weight: 700; color: var(--ink); }
.hc-date.is-full { color: var(--ink-muted); }
.hc-date.is-more { color: var(--ink-muted); background: none; border-style: dashed; }

/* ─── The sheet: what replaces the printed page ─────────────
   Day down the left, claimable blocks across. The shape is the
   paper's; the blocks are live. */

.claim-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 4px 2px 10px;
}
.claim-title { padding: 2px 2px 6px; }
.claim-title h2 { margin: 0 0 2px; }
.claim-help {
  margin: 0 0 14px; padding: 10px 12px;
  font-size: 13.5px; color: var(--ink-soft);
  background: var(--surface-sunken); border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.claim-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 14px 2px;
  border-top: 1px solid var(--line-soft);
  transform: translateY(5px);
  animation: portal-rise 240ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.claim-day { display: flex; flex-direction: column; gap: 1px; }
.claim-day b { font-size: 14px; font-weight: 700; color: var(--ink); }
.claim-day span { font-size: 12.5px; color: var(--ink-muted); }
.claim-day i { font-style: normal; font-size: 12px; color: var(--ink-faint); }

.claim-slots { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }

/* A slot is a real target on a phone in a driveway: 44px floor, and
   comfortably past it in practice. */
.slot {
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-height: 52px; min-width: 104px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out),
              transform 140ms var(--ease-out);
}
.slot b { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.slot i { font-style: normal; font-size: 11.5px; color: var(--ink-muted); }

.slot.is-open { border-color: var(--accent-line); background: var(--accent-tint); }
.slot.is-open:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .slot.is-open:hover { border-color: var(--accent); background: var(--accent-soft); }
}
.slot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Taken blocks are not buttons and must not look like them. */
.slot.is-taken {
  background: var(--positive-soft);
  border-color: var(--positive-line);
  color: var(--positive-ink);
  font-size: 13px; font-weight: 620;
  cursor: default;
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  min-width: 0;
}
.slot.is-none {
  background: var(--surface-sunken); border-style: dashed; color: var(--ink-muted);
  font-size: 13px; cursor: default; justify-content: center;
}
.slot.is-custom { border-style: dashed; background: transparent; }
.slot.is-custom:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .slot.is-custom:hover { border-color: var(--line-strong); background: var(--surface); }
}

.claim-mine {
  grid-column: 2; margin: 8px 0 0;
  font-size: 13px; color: var(--positive-ink);
}

@media (max-width: 560px) {
  .claim-row { grid-template-columns: 1fr; gap: 8px; }
  .claim-day { flex-direction: row; align-items: baseline; gap: 8px; }
  .claim-mine { grid-column: 1; }
  .slot { flex: 1 1 128px; }
}

/* ─── Map ───────────────────────────────────────────────── */

.map-panel { padding: 0; overflow: hidden; }
.ohmap { height: min(62vh, 560px); width: 100%; background: var(--surface-sunken); }
.map-note {
  margin: 0; padding: 10px 14px;
  font-size: 13px; color: var(--ink-muted);
  border-top: 1px solid var(--line-soft);
}

/* A pin carries its count so the map survives greyscale and colour
   blindness — the hue is a second signal, never the only one. */
.pin {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  border: 2px solid var(--surface-raised);
  box-shadow: var(--shadow-md);
}
.pin b { transform: rotate(45deg); font-size: 12.5px; font-weight: 700; line-height: 1; }
.pin.is-open { background: var(--attention); color: oklch(28% 0.06 66); }
.pin.is-full { background: var(--positive); color: oklch(99% 0 0); }

.pin-pop { min-width: 180px; }
.pin-addr { margin: 0 0 2px; font-weight: 650; color: var(--ink); }
.pin-meta { margin: 0 0 10px; font-size: 13px; color: var(--ink-muted); }

/* Leaflet ships its own type and chrome; pull both back into the
   app's world rather than letting a second design system show. */
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-bar a { color: var(--ink); }

@keyframes portal-rise { to { transform: translateY(0); } }

/* Reduced motion means gentler, not absent: the rise is dropped and
   everything else keeps its colour and border feedback. */
@media (prefers-reduced-motion: reduce) {
  .lrow, .hcard, .claim-row { animation: none; transform: none; }
  .door, .lrow, .hcard, .slot { transition-duration: 1ms; }
  .door:active, .lrow:active, .hcard:active,
  .slot.is-open:active, .slot.is-custom:active { transform: none; }
}
