/* Staff screens, QA pass 2026-11-10 (Eugene: "run QA across everything and improve it ... from my point of view").
   Presentation only: fewer taps, nothing cut off on the phone, no table that hides its buttons.
   Builds on comfort-theme.css and table-polish.css; no font rules here (typography is owned elsewhere). */

/* ---- Tables that stack into rows on the phone (.tbl.stack). Desktop keeps the table. ----
   Before: every .tbl is forced to 600px and the card scrolls sideways, so on a 390px phone the Done / Restore
   buttons and the channel columns were off-screen with no hint (dashboard "Ads to take down", Tasks, Appointments). */
@media screen and (max-width: 840px) {
  body.app-shell .main .tbl.stack { min-width: 0; width: 100%; display: block; }
  body.app-shell .main .tbl.stack thead,
  body.app-shell .main .tbl.stack tbody,
  body.app-shell .main .tbl.stack tr,
  body.app-shell .main .tbl.stack td { display: block; }
  body.app-shell .main .tbl.stack tr:has(> th) { display: none; }
  body.app-shell .main .tbl.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line, #dcd9d2); }
  body.app-shell .main .tbl.stack tr:last-child { border-bottom: 0; }
  body.app-shell .main .tbl.stack td { padding: 2px 0; border: 0; overflow-wrap: anywhere; }
  body.app-shell .main .tbl.stack td:empty { display: none; }
  body.app-shell .main .tbl.stack td.right { text-align: left; padding-top: 8px; }
  body.app-shell .main .tbl.stack td.right form.inline { display: inline-block; margin: 0 6px 6px 0; }
  body.app-shell .main .tbl.stack td.right .btn { min-height: 44px; }
  body.app-shell .main .tbl.stack td.stack-inline { display: inline-block; vertical-align: middle; padding-right: 8px; }
  body.app-shell .main .tbl.stack tbody tr:hover td { background: transparent; }
}

/* Small buttons inside table cells never break into two lines ("Do / ne" on the Tasks page at 1368px). */
body.app-shell .main .tbl td .btn { white-space: nowrap; }

/* Sticky-header customer table: the phone number stays on one line (it wrapped into two lines in every row).
   Long detail text (a pasted link) wraps instead of widening the table past the card. */
body.app-shell .cust-table-wrap td.nowrap { white-space: nowrap; }
body.app-shell .main .tbl td .muted.small { overflow-wrap: anywhere; }
/* Folded phone in landscape (844px): the nine-column customer table drops "Language", "Interested in" and "Last visit"
   (583px fits the 584px card) so it needs no sideways scroll; the phone cards and the desktop table keep every column. */
@media screen and (min-width: 841px) and (max-width: 1100px) {
  body.app-shell .cust-table-wrap .tbl :is(td, th):nth-child(3),
  body.app-shell .cust-table-wrap .tbl :is(td, th):nth-child(4),
  body.app-shell .cust-table-wrap .tbl :is(td, th):nth-child(5) { display: none; }
}
/* The count heading only while a search narrows the list (the "All 133" chip already says the total). */
body.app-shell .cust-wrap .card-head.cu-head[hidden] { display: none; }

/* ---- Dashboard ---- */
/* New arrivals | Sold with nothing in the period: both cards shrink to one line each and sit side by side on the phone,
   so the first actionable card is one scroll closer (Eugene's rule: a card with nothing to show gets a quiet line). */
body.app-shell .sell-grid.sell-grid-empty { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
body.app-shell .sell-card.is-empty { padding: 10px 12px 8px; }
body.app-shell .sell-card.is-empty .card-head { margin-bottom: 0; }
body.app-shell .sell-card.is-empty .sell-empty { margin: 2px 0 0; }
body.app-shell .sell-card.is-empty .sell-empty .sell-since { color: var(--ink-4, #677278); }
body.app-shell .sell-card.is-empty .card-head h2 { white-space: nowrap; }
@media screen and (max-width: 600px) {
  /* nothing to fold or list in an empty card: no See all, no caret */
  body.app-shell .sell-card.is-empty .card-head :is(.act, .df-card-toggle) { display: none; }
  body.app-shell .sell-card.is-empty .sell-empty .sell-since { display: block; }
}

/* Hot-lead card: a.card is display:block in app.css, so the number, text and chevron stacked on three lines. */
body.app-shell a.card.hl-dash { display: flex; }
body.app-shell .hl-dash .hl-dash-go { display: inline-flex; align-items: center; }
body.app-shell .hl-dash .hl-dash-go .ico { width: 18px; height: 18px; }

/* Renew-on-Facebook rows: info left, buttons right, always in the same order (Open post, Renew, mark as renewed).
   Before, a long title pushed the buttons under the text on some rows and not on others. */
body.app-shell .fbr-card .fbr-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 12px; }
body.app-shell .fbr-card .fbr-acts { flex-wrap: nowrap; justify-content: flex-end; }
body.app-shell .fbr-card .fbr-acts form.inline { display: inline-flex; }
@media screen and (max-width: 600px) {
  /* phone: the two buttons share one row (Renew | mark as renewed); Open post, when present, is a slim row above them */
  body.app-shell .fbr-card .fbr-row { grid-template-columns: minmax(0, 1fr); }
  body.app-shell .fbr-card .fbr-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
  body.app-shell .fbr-card .fbr-acts > a.btn.ghost { grid-column: 1 / -1; justify-content: center; }
  body.app-shell .fbr-card .fbr-acts form.inline { display: block; min-width: 0; }
  body.app-shell .fbr-card .fbr-acts .btn { width: 100%; min-height: 44px; padding-inline: 8px; white-space: normal; line-height: 1.2; }
}

/* Right rail (1100px and up): the Top inventory highlights table drops the km column, as it already does on the phone,
   so it fits the 340px rail when opened (it ran 38px past the card). */
@media screen and (min-width: 1100px) {
  body.app-shell #mk-card .tbl.narrow :is(td, th):nth-child(3) { display: none; }
}

/* 180-entry callout: the number and the explanation read as one line on wide screens, stacked on the phone. */
body.app-shell .card.callout.callout-amber { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
body.app-shell .card.callout.callout-amber h2 { margin: 0; }

/* ---- Marketing: the two "do it now" lists use the same two-column rhythm as the dashboard. ---- */
body.app-shell #ad-sold .sd-row,
body.app-shell #ad-renew .rn-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; }
body.app-shell #ad-sold .sd-acts { flex-wrap: nowrap; justify-content: flex-end; }
body.app-shell #ad-sold .sd-acts > a.small { white-space: nowrap; }
@media screen and (max-width: 600px) {
  body.app-shell #ad-sold .sd-row,
  body.app-shell #ad-renew .rn-row { grid-template-columns: minmax(0, 1fr); }
  /* phone: [Take down on Facebook | Mark taken down] on one row; the Open listing link, when present, on its own slim row above */
  body.app-shell #ad-sold .sd-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
  body.app-shell #ad-sold .sd-acts > a.small { grid-column: 1 / -1; min-height: 36px; display: inline-flex; align-items: center; }
  body.app-shell #ad-sold .sd-acts form.inline { display: block; min-width: 0; }
  body.app-shell #ad-sold .sd-acts .btn { width: 100%; min-height: 44px; padding-inline: 8px; white-space: normal; line-height: 1.2; }
}

/* ---- Reviews: step buttons show their whole label on the phone instead of "Copy ..." / "Send te..." ---- */
@media screen and (max-width: 600px) {
  body.app-shell .rv-steps .rv-s { padding: 6px 6px; }
  body.app-shell .rv-steps .rv-s .rv-t { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; text-align: left; }
}
/* Survey follow-ups with nothing due today: the card folds to its heading plus one quiet line; everything else is one tap away. */
body.app-shell .sv-card.sv-quiet .rv-qh { margin-bottom: 0; }
body.app-shell .sv-quiet-more > summary { cursor: pointer; min-height: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  list-style: none; color: var(--ink-2, #495761); }
body.app-shell .sv-quiet-more > summary::-webkit-details-marker { display: none; }
body.app-shell .sv-quiet-more > summary .sv-quiet-open { color: var(--df-violet, #4b46c8); text-decoration: underline; text-underline-offset: 3px; }
body.app-shell .sv-quiet-more[open] > summary .sv-quiet-open { display: none; }

/* Appointments: an empty list is one quiet line, not a 140px box; stacked rows keep the date bold as the anchor. */
body.app-shell .ap-list.ap-none .empty { padding: 8px 0 2px; justify-items: start; text-align: left; }

/* ---- Settings: time inputs in the work-hours table fit the phone width (the table ran 12px past the card). ---- */
@media screen and (max-width: 840px) {
  body.app-shell .tbl.narrow input[type="time"] { width: 100%; min-width: 0; max-width: 100%; padding-inline: 6px; }
  body.app-shell .tbl.narrow td { padding-inline: 5px; }
}
/* Two-week rotation: start and end stack inside the cell on anything narrower than a desktop (two 140px inputs side by side ran past the card). */
@media screen and (max-width: 1100px) {
  body.app-shell .rot-tbl .rot-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  body.app-shell .rot-tbl .rot-cell input[type="time"] { width: 100%; min-width: 0; padding-inline: 6px; }
}

/* ---- Command Center: the page background reaches the app bar (a 23px strip showed above it). Light canvas since the
   2026-11-23 light theme (GPT PR #33, ops/_map_style.html --mx-bg); the old #0b1020 left a dark band above the header. ---- */
body.app-shell .main:has(> #ops) { background: #f0f5fa; }

/* More sheet: focus lands on the sheet itself when it opens, with no ring (base.html), so no row looks pre-selected. */
body.app-shell .m-sheet:focus { outline: none; }

/* ---- Tasks: the open list comes first; the add form is a folded card like "+ New appointment". ---- */
body.app-shell details.card.task-new > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; }
body.app-shell details.card.task-new > summary::-webkit-details-marker { display: none; }
body.app-shell details.card.task-new > summary h2 { display: inline; margin: 0; }
body.app-shell details.card.task-new > summary .ap-caret { margin-left: auto; width: 0; height: 0; border-left: 5px solid transparent;
  border-right: 5px solid transparent; border-top: 6px solid var(--ink-3, #5f6b70); transition: transform .15s; }
body.app-shell details.card.task-new[open] > summary .ap-caret { transform: rotate(180deg); }
body.app-shell details.card.task-new > form { margin-top: 10px; }
