/* Seller dashboard, agent side (the #/sellerdash/<id> screen, the Tools picker
   and the Admin template editor). The seller's own page carries its own styles
   inline in server/sellerdashpage.js, because it is served to a phone with no
   app stylesheet and nothing here reaches it. One CSS file per feature. */

/* Two columns on a wide screen (inputs left, preview right), one on a phone. */
.sd-cols { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 1100px) {
  .sd-cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .sd-side { position: sticky; top: 72px; }
}

/* Sticky so Save is under the thumb however far down the comps table the
   agent has scrolled. */
.sd-head {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg, #fff);
  border-bottom: 1px solid var(--line, #e5e9f0);
  padding: 10px 0; margin-bottom: 14px;
}
.sd-head-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sd-head h2 { margin: 0; font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.sd-dirty { color: #b45309; font-weight: 600; }

.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sd-grid label { display: block; font-size: 12px; color: var(--muted, #64748b); margin-bottom: 3px; }
.sd-grid input, .sd-grid select { width: 100%; box-sizing: border-box; }
/* An amount and its unit (HOA a month / quarter / year, commission % or $). */
.sd-grid .sd-pair { display: flex; gap: 6px; }
.sd-grid .sd-pair input { flex: 1; min-width: 0; }
.sd-grid .sd-pair select { width: auto; flex: none; }
/* A value read from the MLS feed, not typed (2 Nov 2026). */
.sd-grid input.sd-auto { color: #1d4ed8; background: #eff6ff; }
.sd-mls { font-size: 10px; font-weight: 700; color: #1d4ed8; background: #dbeafe; border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.sd-sub { margin: 14px 0 6px; font-size: 13px; }

/* The comps table scrolls inside its own box, so the page never does. */
.sd-comps-wrap { overflow-x: auto; border: 1px solid var(--line, #e5e9f0); border-radius: 8px; margin-top: 10px; }
table.sd-comps { border-collapse: collapse; min-width: 980px; width: 100%; }
table.sd-comps th { text-align: left; font-size: 11px; padding: 6px 6px; white-space: nowrap; }
table.sd-comps td { padding: 4px 4px; vertical-align: middle; }
table.sd-comps input[type=text], table.sd-comps input[type=number], table.sd-comps input[type=date], table.sd-comps select {
  width: 100%; box-sizing: border-box; min-width: 0;
}
table.sd-comps .sd-n { width: 64px; }
table.sd-comps .sd-m { width: 104px; }
table.sd-comps .sd-d { width: 130px; }
table.sd-comps .sd-w { min-width: 200px; }
table.sd-comps tr.sd-noprice td { background: rgba(245, 158, 11, .08); }
.sd-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.sd-sec-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--line, #e5e9f0);
}
.sd-sec-row:last-child { border-bottom: 0; }
.sd-sec-row .sd-sec-text { flex: 1; min-width: 0; }
.sd-sec-row input[type=checkbox] { margin-top: 3px; }
.sd-quote { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0 4px 26px; font-size: 13px; }

.sd-answer { display: flex; gap: 10px; padding: 3px 0; font-size: 13px; flex-wrap: wrap; }
.sd-answer b { min-width: 0; overflow-wrap: anywhere; }

/* The preview is the seller's page exactly as it will look on a phone. */
.sd-frame { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line, #e5e9f0); border-radius: 10px; background: #fff; }

/* The picker modal on the Tools page. */
.sd-pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line, #e5e9f0); border-radius: 8px; padding: 4px 8px; }
.sd-pick-row { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 2px; border-bottom: 1px solid var(--line, #e5e9f0); cursor: pointer; font: inherit; color: inherit; }
.sd-pick-row:last-child { border-bottom: 0; }
.sd-pick-row:hover { background: rgba(37, 99, 235, .06); }
.sd-map { border: 1px solid var(--line, #e5e9f0); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.sd-maprow { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.sd-mapcell { flex: 0 0 42%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Admin, Seller dashboard. */
.sda-sec { border: 1px solid var(--line, #e5e9f0); border-radius: 10px; margin-bottom: 8px; background: var(--card, #fff); }
.sda-sec.dragging { opacity: .5; }
.sda-sec.drop-before { box-shadow: 0 -3px 0 #2563eb; }
.sda-sec.drop-after { box-shadow: 0 3px 0 #2563eb; }
.sda-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.sda-bar .sda-title { flex: 1; min-width: 0; font-weight: 600; cursor: pointer; background: none; border: 0; text-align: left; font: inherit; color: inherit; font-weight: 600; }
.sda-grip { cursor: grab; color: var(--muted, #64748b); user-select: none; padding: 0 4px; }
.sda-body { padding: 4px 12px 12px; border-top: 1px solid var(--line, #e5e9f0); }
.sda-key { margin-top: 12px; }
.sda-key textarea { width: 100%; box-sizing: border-box; }
.sda-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.sda-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line, #e5e9f0); background: var(--bg-soft, #f7f9fc); cursor: pointer; }
.sda-chip:hover { border-color: #2563eb; }
.sda-frame { width: 100%; height: 560px; border: 1px solid var(--line, #e5e9f0); border-radius: 10px; background: #fff; }

/* Showing feedback, CompScope parts and the IO numbers (29 Oct 2026). */
.sd-fb { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; }
.sd-fb.off { opacity: .55; }
.sd-fb-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sd-fb-inc { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: inherit; }
.sd-fb-text { margin: 0 0 6px; }
.sd-fb textarea, .sd-fb input[type="text"] { width: 100%; box-sizing: border-box; }
/* Screenshots on feedback added by hand (18 Nov 2026). */
.sd-mf-imgs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.sd-mf-img { position: relative; display: inline-flex; }
.sd-mf-img img { width: 96px; height: 72px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }
.sd-mf-img .icon-btn { position: absolute; top: -8px; right: -8px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 50%; min-width: 28px; min-height: 28px; }
.sd-mf-pick { cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 4px; }
.sd-fb .sd-fb-top input[type="text"] { width: auto; flex: 0 1 180px; }
.sd-part { display: flex; gap: 6px; align-items: center; padding: 4px 0; color: inherit; font-size: 14px; }
.sd-comps .sd-z { width: 190px; }

/* Pete, 1 Nov 2026: weekly update card; the minimum-figures grid is one column on a phone. */
@media (max-width: 860px) {
  .sd-weekly .sr-floors { grid-template-columns: 1fr; }
  .sd-weekly .sr-floor input { width: 96px; min-height: 36px; }
  .sd-weekly select, .sd-weekly .btn { min-height: 36px; }
}

/* Per-seller section order (10 Nov 2026). */
.sd-sec-row .sd-move { display: inline-flex; flex-direction: column; gap: 0; margin-right: 4px; }
.sd-sec-row .sd-move .icon-btn { padding: 0 4px; line-height: 1; font-size: 10px; min-height: 0; }

/* The plan editor and the per-seller plan ticks (11 Nov 2026). */
.sda-plan-row { border: 1px solid var(--line, #dde5ee); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: grid; gap: 6px; }
.sda-plan-f input { width: 100%; box-sizing: border-box; }
.sd-plan-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 6px 0; border-top: 1px solid var(--line, #dde5ee); }
.sd-plan-row:first-of-type { border-top: 0; }

/* Work log, offers and the check-in's agent cards (11 Nov 2026). */
.sdv-log-row { display: grid; grid-template-columns: 9.5em 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.sdv-log-row input[type=text] { min-width: 0; }
.sdv-doc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.sdv-doc-row input[type=text] { min-width: 0; }

/* Seller dashboard, 19 Nov 2026: double-click in the preview, drag to reorder, saved layouts, broker note. */
/* The preview stays beside the card being edited: sticky under the header, tall as the screen, and the
   iframe scrolls inside it. Two columns only (1100px and up); below that it stacks and nothing sticks. */
@media (min-width: 1100px) {
  .sd-side { max-height: calc(100vh - 88px); overflow-y: auto; }
  .sd-side .sd-frame { height: calc(100vh - 190px); min-height: 360px; }
}
/* Briefly outlined after a double-click in the preview points at it. */
.sd-flash { outline: 3px solid #d4a800; outline-offset: 3px; border-radius: 12px; background: rgba(255, 244, 194, .5); transition: outline-color .3s; }
/* The grip a row is dragged by (only the grip is draggable, so a row's text still selects). */
.sd-sec-row .sd-grip { cursor: grab; color: var(--muted, #5b6b80); user-select: none; letter-spacing: -2px; padding: 2px 2px 0 0; line-height: 1.3; }
.sd-sec-row .sd-grip[aria-hidden="true"] { visibility: hidden; cursor: default; }
.sd-sec-row.sd-dragging { opacity: .45; }
.sd-sec-row.sd-drop-before { box-shadow: 0 -3px 0 0 var(--accent, #1d4ed8); }
.sd-sec-row.sd-drop-after { box-shadow: 0 3px 0 0 var(--accent, #1d4ed8); }
/* Documents: two folders and the password (19 Nov 2026). */
.sdv-doc-row { grid-template-columns: auto 1fr auto auto; }
.sdv-doc-row select { min-width: 0; max-width: 9em; }
.sdv-lock-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sdv-lock-row input[type=text] { flex: 1 1 14em; min-width: 0; }

/* The documents popup on the agent screen (19 Nov 2026, page-sellerdash-v2.js sdvDocsPopHtml). */
.sdv-pop { position: fixed; inset: 0; z-index: 900; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.sdv-pop[hidden] { display: none; }
.sdv-pop-box { width: 100%; max-width: 760px; background: var(--bg, #fff); border-radius: 10px;
  padding: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.sdv-pop-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; font-size: 16px; }
body.sdv-pop-on { overflow: hidden; }

/* The top of the page card and the agent's pick star (27 Nov 2026, page-sellerdash-top.js). */
.sdt-hero { width:100%; max-width:420px; aspect-ratio:16/10; object-fit:cover; border-radius:10px; display:block; background:#e9eef5; }
.sdt-btns { display:flex; gap:8px; flex-wrap:wrap; }
.sdt-star { width:auto; min-height:36px; padding:0 10px; }
.sdt-star.on { color:#b45309; font-weight:700; }
.sdt-star:disabled { opacity:.4; }
.sdt-note { margin-top:6px; }
/* Closing steps and Deadlines cards (27 Nov 2026) */
.sdv-step { padding: 8px 0; border-top: 1px solid var(--line, #dde5ee); }
.sdv-step:first-of-type { border-top: 0; }
.sdv-step-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.sdv-step input[type=text] { width: 100%; box-sizing: border-box; }
.sda-rl-row, .sda-ct-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line, #dde5ee); }
/* Help for your buyers card (27 Nov 2026, page-sellerdash-dpr.js) */
.sdd-btns { display:flex; gap:8px; flex-wrap:wrap; }
.sdd-row { display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:8px; align-items:end; margin:0 0 8px; }
