/* Ringing Pal owner dashboard.
   Design intent: a tool a plumber checks one-handed in a truck between jobs.
   Jobsite palette -- deep slate, safety yellow, blueprint blue -- big tap
   targets, no decoration that slows reading. */

:root {
  --ink: #1b2430;          /* deep slate: text + header */
  --paper: #f6f7f5;        /* worksite-gray background */
  --card: #ffffff;
  --line: #d8dce1;
  --safety: #f5b400;       /* safety yellow: the one loud color */
  --blueprint: #1d5fbf;    /* links, actions */
  --ok: #1e7d43;
  --warn: #b34700;
  --danger: #b3261e;
  --muted: #5c6672;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* ---- Header ---- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  border-bottom: 4px solid var(--safety);
  position: relative;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
}
.brand-text {
  padding-bottom: 1px;
  border-bottom: 1px solid var(--safety);
}
.brand-mark { width: 28px; height: 28px; }
.brand-accent { color: var(--safety); }
.topbar nav { display: flex; gap: 12px; flex-wrap: wrap; }
.topbar nav a {
  color: #cfd6de;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.05rem;
}
.topbar nav a:hover, .topbar nav a:focus-visible { background: #2a3543; color: #fff; }
.nav-admin-highlight { border: 2px solid var(--safety); color: #fff !important; }
.logout-form { display: flex; align-items: center; gap: 12px; }
.logout-form .who { color: #cfd6de; font-weight: 600; font-size: 0.85rem; }
.topbar .btn-quiet {
  color: #cfd6de;
  border-color: #3a4553;
  padding: 8px 14px;
  margin-top: 0;
  font-size: 0.85rem;
}
.topbar .btn-quiet:hover { background: #2a3543; color: #fff; }

/* Collapsible nav: a compact "Menu" toggle by default, so the header stays
   one row on a phone instead of three. Deliberately a hidden checkbox +
   label, NOT <details>/<summary> -- a closed <details>'s content isn't
   just display:none, browsers treat it as fundamentally unrendered (like
   <template>), which isn't reliably overridable with CSS alone across
   browsers. A checkbox's :checked state is ordinary CSS with no such
   special case, so forcing the panel open at wider viewports (below) just
   works everywhere. */
.nav-toggle-checkbox { display: none; }
.nav-menu-toggle {
  cursor: pointer;
  color: #cfd6de;
  font-weight: 700;
  padding: 8px 14px;
  border: 1px solid #3a4553;
  border-radius: 6px;
  user-select: none;
  margin-left: auto;
}
.nav-menu-toggle:hover { background: #2a3543; color: #fff; }
.nav-menu-panel {
  display: none;
  position: absolute;
  right: 20px;
  top: 62px;
  background: var(--ink);
  border: 1px solid #3a4553;
  border-radius: 8px;
  padding: 12px;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  z-index: 20;
}
.nav-toggle-checkbox:checked ~ .nav-menu-panel { display: flex; }
.nav-menu-panel nav { display: flex; flex-direction: column; gap: 2px; }
/* JS relocates .logout-form into #nav-menu-panel on mobile (see base.html) --
   this only ever matches in that nested state, so the divider disappears
   automatically once JS moves it back out for desktop. */
.nav-menu-panel .logout-form { margin-top: 8px; padding-top: 8px; border-top: 1px solid #3a4553; }

@media (min-width: 760px) {
  .nav-menu-toggle { display: none; }
  /* Centered independently of the brand/logout widths on either side --
     absolute positioning takes it out of .topbar's flex flow entirely, so
     it doesn't compete for space with .logout-form's own margin-left:auto
     (below), which needs .topbar's real leftover flex space to push
     against. */
  .nav-menu-panel {
    display: flex;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    right: auto;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    gap: 24px;
    min-width: 0;
    z-index: auto;
  }
  .nav-menu-panel nav { flex-direction: row; gap: 4px; }
  .logout-form { margin-left: auto; }
}

/* The desktop nav row (5 links + Admin) is centered via absolute
   positioning (above) so it doesn't compete for .topbar's flex space with
   the brand/logout-form on either side -- but that also means it isn't
   forced to shrink when real estate gets tight, so between the 760px
   mobile-menu cutoff and roughly desktop width it can wrap onto a second
   line instead (confirmed: "Admin" dropping below the rest at ~1040px
   with a longer business name in the logout block). Same nav, same one
   row, just smaller text/padding through this range -- reverts to the
   roomier desktop sizing above 1180px, where there's space to spare. */
@media (min-width: 760px) and (max-width: 1179.98px) {
  .brand { font-size: 1.15rem; }
  .topbar nav a { font-size: 0.92rem; padding: 8px 14px; }
  .nav-menu-panel { gap: 12px; }
  .logout-form .who { font-size: 0.78rem; }
  .topbar .btn-quiet { padding: 6px 10px; font-size: 0.8rem; }
}
/* Narrower still: the moderate shrink above isn't tight enough right at
   the low end of its own range (confirmed: "Admin" still wrapping at
   780px) -- one step further, layered on top of it since this range is a
   subset. */
@media (min-width: 760px) and (max-width: 899.98px) {
  .brand { font-size: 1.05rem; }
  .topbar nav a { font-size: 0.82rem; padding: 6px 10px; }
  .nav-menu-panel { gap: 6px; }
  .logout-form .who { font-size: 0.72rem; }
}

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }

.impersonate-banner {
  background: var(--safety);
  color: var(--ink);
  font-weight: 700;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  text-align: center;
}
.impersonate-banner form { margin: 0; }
.impersonate-banner .btn-quiet {
  margin-top: 0;
  border-color: var(--ink);
  color: var(--ink);
  background: rgba(255,255,255,0.3);
}
.impersonate-banner .btn-quiet:hover { background: rgba(255,255,255,0.5); }

/* ---- Admin tables ---- */
.tablewrap { overflow-x: auto; margin-bottom: 16px; }
table.admin {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
table.admin th, table.admin td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); }
table.admin th:first-child, table.admin td:first-child { text-align: left; }
table.admin th {
  background: var(--paper);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
table.admin tr:last-child td { border-bottom: none; }
table.admin tr.total-row td { font-weight: 800; background: var(--paper); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 0 32px;
}
.foot-links { display: block; margin-top: 6px; }
.foot-links a { color: var(--muted); }

/* ---- Stat strip ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 4px 0 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  /* border-inline-start (not border-left) -- mirrors to the correct
     "leading edge" automatically under base.html's dir="rtl" (Arabic
     dashboards), instead of staying pinned to the physical left. Same
     logical-property fix applied to every other accent-bar/border-left
     rule below. */
  border-inline-start: 5px solid var(--safety);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}
.stat:hover, .stat:focus-visible {
  border-color: var(--blueprint);
  border-inline-start-color: var(--blueprint);
}
.stat.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.stat.active span { color: #b8c2cd; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat.alert { border-inline-start-color: var(--danger); }
.stat.good  { border-inline-start-color: var(--ok); }
.stat.active.alert, .stat.active.good { border-inline-start-color: var(--safety); }

.filter-note { color: var(--muted); margin: 0; }
.filter-note a { color: var(--blueprint); }

/* ---- Usage-tier badge + info disclosure (dashboard home) ---- */
.tier-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: -8px 0 20px;
}
.tier-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tier-light    { background: #eaf3ea; color: var(--ok); border-color: var(--ok); }
.tier-standard { background: #fff6e0; color: #8a6400; border-color: var(--safety); }
.tier-heavy    { background: #fdece8; color: var(--warn); border-color: var(--warn); }
.tier-info { color: var(--muted); font-size: 0.85rem; }
.tier-info summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--blueprint);
  list-style: none;
}
.tier-info summary::-webkit-details-marker { display: none; }
.tier-info summary::before { content: "▸ "; }
.tier-info[open] summary::before { content: "▾ "; }
.tier-info p { margin: 8px 0 0; }
.tier-info .tier-badge { margin-inline-end: 6px; }

/* ---- Toolbar with Hide-done toggle ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 16px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
}
.toggle:hover, .toggle:focus-visible { border-color: var(--blueprint); color: var(--ink); }
.toggle-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
}
.toggle-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.toggle.on { color: var(--ink); border-color: var(--ok); }
.toggle.on .toggle-track { background: var(--ok); }
.toggle.on .toggle-dot { left: 16px; }

/* ---- Sections & cards ---- */
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.settings-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}
.settings-link strong { font-size: 1.05rem; }
.settings-link:hover { border-color: var(--blueprint); }

/* ---- Call list ---- */
.call-row {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}
.call-row:hover, .call-row:focus-visible { border-color: var(--blueprint); }
.call-row .who { font-weight: 700; }
.call-row .what { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.call-row .meta { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 2px 8px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.badge.booked    { background: #e2f3e8; color: var(--ok); }
.badge.callback  { background: #fdf1e0; color: var(--warn); }
.badge.emergency { background: #fbe4e2; color: var(--danger); }
.badge.info      { background: #e8eef8; color: var(--blueprint); }
.badge.unreviewed{ background: var(--safety); color: var(--ink); }
.badge.done      { background: var(--ok); color: #fff; }
.badge.repeat    { background: var(--blueprint); color: #fff; }
.badge.new       { background: #e8eef8; color: var(--blueprint); }
.badge.beta      { background: #f1e8fb; color: #6b3fa0; cursor: help; }

/* ---- tel: link styled like the badge pills above, sized for a phone
   number rather than a one-word status label -- call_detail.html's
   "Callback number" and anywhere else a raw phone number is the main
   content of its own line, not an inline tag next to other text. ---- */
.tel-badge {
  display: inline-block;
  background: #e8eef8;
  color: var(--blueprint);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  padding: 4px 10px;
  text-decoration: none;
}
.tel-badge:hover, .tel-badge:focus-visible { background: var(--blueprint); color: #fff; }

/* ---- about.html: contact card + FAQ accordion ---- */
.contact-card { display: flex; flex-direction: column; gap: 14px; }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.contact-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.contact-copy.copied { background: var(--ok); color: #fff; border-color: var(--ok); }
.faq-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "▸"; color: var(--blueprint); font-size: 0.8rem; width: 10px; flex-shrink: 0; }
.faq-item[open] summary::before { content: "▾"; }
.faq-item p { margin: 8px 0 0 18px; color: var(--muted); }

/* ---- Customers page: one card per caller_number, expandable history ---- */
.customer {
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.customer[open] { border-inline-start-color: var(--blueprint); }
.customer.flag-followup { border-inline-start-color: var(--danger); }
.customer summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.customer summary::-webkit-details-marker { display: none; }
.customer summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; width: 10px; flex-shrink: 0; }
.customer[open] summary::before { content: "▾"; }
.customer .who-block { min-width: 180px; }
.customer .who-block .who { font-weight: 700; display: block; }
.customer .who-block .phone { color: var(--muted); font-size: 0.85rem; }
.customer .mini-stats {
  margin-inline-start: auto;
  display: flex;
  gap: 18px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}
.customer .mini-stats b { display: block; color: var(--ink); font-size: 0.95rem; }
.customer .history { border-top: 1px solid var(--line); padding: 4px 16px 6px; }
.customer .history-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.customer .history-row:last-child { border-bottom: none; }
.customer .history-row:hover .what { color: var(--blueprint); }
.customer .history-date { width: 64px; flex-shrink: 0; color: var(--muted); font-size: 0.8rem; padding-top: 1px; }
.customer .history-row .what { font-weight: 700; font-size: 0.92rem; }

/* ---- Admin dashboard: business rows collapsed to a summary by default --
   same accordion pattern as .customer above (badges/stats visible at a
   glance, everything else -- contact info, action buttons, notes, delete --
   tucked behind a click). Added 2026-08-08 after the page grew unwieldy:
   every business (house account, sales demo, regular customer) used to
   render as a full always-expanded card with up to 7 badges, 3 info lines,
   a 5-6 button action row, and two more nested collapsibles, all stacked
   vertically -- a short customer list still felt overwhelming even with
   just a handful of rows. */
.biz-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.biz-row[open] { border-inline-start-color: var(--blueprint); }
.biz-row.accent { border-inline-start-color: var(--accent, #f2c94c); }
.biz-row summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.biz-row summary::-webkit-details-marker { display: none; }
.biz-row summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; width: 10px; flex-shrink: 0; }
.biz-row[open] summary::before { content: "▾"; }
.biz-row-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.biz-row-name strong { font-size: 1.05rem; }
.biz-row-stats {
  margin-inline-start: auto;
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.biz-row-stats b { display: block; color: var(--ink); font-size: 0.95rem; }
/* flex-basis:100% on a flex-wrap:wrap container forces everything after it
   onto its own new line -- lands this below the name/badges/stats row
   while staying inside <summary> (always visible, collapsed or not).
   Added 2026-08-08: contact info/signup date used to live inside the
   collapsible body, right above the action buttons -- Ricardo wanted
   "who this is" visible at a glance without expanding, with only the
   ACTIONS (buttons, notes, delete) staying hidden until clicked. */
.biz-row-info { flex-basis: 100%; margin-top: 2px; }
.biz-row-info .hint { display: block; margin-bottom: 2px; }
.biz-row-body { border-top: 1px solid var(--line); padding: 14px 16px; }
.biz-row-body .hint { display: block; margin-bottom: 4px; }
.biz-row-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }

/* ---- Monthly stats page: plain CSS bar chart, no charting library ---- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 160px;
  padding: 10px 4px 0;
  margin-bottom: 8px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.bar-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
.bar {
  width: 100%;
  max-width: 44px;
  background: var(--blueprint);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
}
.bar-col.current .bar { background: var(--safety); }
.bar-col.current .bar-count { color: var(--ink); }
.bar-label {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Job status card: schedule/confirm state + all its actions in one place ---- */
/* Mobile-first single column (everything just stacks in DOM order); at
   760px+ this becomes a 2-col/3-row grid so the price panel sits beside
   the schedule info instead of under it, and the job-actions/complete-col
   pair share row 3 -- landing Accept/Decline and Mark Completed on the
   same line without needing to fake it with margin-inline-start:auto. */
.jobstate {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 10px;
  border-inline-start: 5px solid var(--warn);
}
.jobstate.done { border-inline-start-color: var(--ok); background: #f2faf5; }
.jobstate.declined { border-inline-start-color: var(--danger); background: #fbf2f1; }
.jobstate form { margin: 0; }
.jobstate .hint { color: var(--muted); font-size: 0.85rem; margin-inline-start: 8px; }
.job-info, .price-panel, .job-actions, .job-complete-col, .job-quick-actions { grid-column: 1; }
.job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.job-actions, .job-quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.job-complete-col { display: flex; }
.job-complete-col form { margin: 0; width: 100%; }
.job-complete-col button { width: 100%; }

@media (min-width: 760px) {
  /* BUG FIX 2026-08-07 (found via real-world report -- a job page showed
     overlapping, unreadable button text at this width): job.html renders a
     SECOND row of actions below .job-actions (on-my-way/running-late), but
     this block used to give every .job-actions element the same
     grid-column:1;grid-row:3 -- correct for call_detail.html, which only
     has ONE .job-actions, but on job.html BOTH the Accept/Decline/Mark-
     completed group and the on-my-way/running-late group are .job-actions,
     so they landed in the exact same grid cell and rendered on top of each
     other. .job-quick-actions is job.html's own class for that second
     group now, given its own row (4) instead of colliding with row 3. */
  .jobstate { grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto auto; column-gap: 16px; }
  .job-info { grid-column: 1; grid-row: 1; }
  .price-panel { grid-column: 2; grid-row: 1; }
  .job-actions { grid-column: 1; grid-row: 3; align-self: end; }
  .job-complete-col { grid-column: 2; grid-row: 3; align-self: end; justify-self: end; }
  .job-quick-actions { grid-column: 1; grid-row: 4; }
}
.btn-done {
  background: var(--ok);
  margin-top: 0;
}
.btn-done:hover { background: #166335; }
.btn-quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 0;
}
.btn-quiet:hover { background: #eef0ee; color: var(--ink); }

/* ---- Tag chips (setup.html: service area include/exclude lists, etc.) ---- */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card, #f4f4f2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 6px 3px 12px; font-size: 0.85rem;
}
.chip-remove {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 2px 6px; margin: 0;
}
.chip-remove:hover { color: var(--danger); }

.btn-decline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-top: 0;
}
.btn-decline:hover { background: #fbe4e2; }

/* ---- Quoted/final price (call_detail.html) ----
   .price-panel is an invisible wrapper -- no border/background of its own --
   that exists purely to keep the quoted-price and final-price fields
   reading as one group. It's its own grid cell in .jobstate (see above),
   sitting beside .job-info instead of stacked under it at 760px+. */
.price-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price-panel-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.price-panel-row .field-label { margin-bottom: 0; }
.price-form { display: flex; align-items: center; gap: 4px; }
.price-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease;
}
.price-sign:hover { color: var(--ink); }
.price-form.ready .price-sign { color: var(--ok); }
.price-sign.static { cursor: default; }
.price-sign.static:hover { color: var(--muted); }
/* .price-form .price-input (not just .price-input) so this reliably beats
   the global input[type=text] reset above, which is more specific than a
   single class on its own regardless of source order. */
.price-form .price-input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
  background: var(--card);
}
.price-form.synced .price-sign,
.price-form.synced .price-input {
  color: var(--ok);
  border-color: var(--ok);
}
.price-form .price-input:disabled {
  background: #f1f2f0;
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
}
.price-final { font-weight: 800; color: var(--ok); }

/* Mobile only: a job that hasn't been accepted yet doesn't need its price
   fields taking up screen height before the owner has even decided to take
   it -- desktop has the room to spare so it stays visible there. */
@media (max-width: 759.98px) {
  .price-panel.price-panel-pending { display: none; }
}

@media (min-width: 760px) {
  .price-panel { align-items: flex-end; }
  .price-panel-row { align-items: flex-end; }
  .price-form .price-input { flex: none; width: 100px; }
  .job-complete-col form,
  .job-complete-col button { width: auto; }
}

/* ---- Call detail: back button left, prev/next grouped on the right ---- */
.call-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.call-nav-group { display: flex; gap: 8px; }
.call-nav-link {
  display: inline-block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.call-nav-link:hover, .call-nav-link:focus-visible { border-color: var(--blueprint); color: var(--blueprint); }

/* ---- Admin sub-pages: back-links / sub-nav row -- same pill style as
   .call-nav-link so it reads as part of the app instead of default browser
   link styling, and wraps instead of overflowing the viewport on mobile. ---- */
.admin-links { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-links a {
  display: inline-block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  white-space: nowrap;
}
.admin-links a:hover, .admin-links a:focus-visible { border-color: var(--blueprint); color: var(--blueprint); }
.call-nav-link.disabled { color: var(--muted); opacity: 0.5; pointer-events: none; }

/* ---- Detail page ---- */
.kv { margin: 0 0 16px; }
.kv dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.field-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 2px; }
.kv dd { margin: 0 0 10px; font-weight: 600; }
.transcript {
  white-space: pre-wrap;
  background: #fbfcfa;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.95rem;
  max-height: 420px;
  overflow-y: auto;
}

/* ---- Setup page tabs ---- */
.setup-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap;
}
.setup-tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-top: 0;
  margin-bottom: -2px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.setup-tab:hover { background: transparent; color: var(--ink); }
.setup-tab.active { color: var(--ink); border-bottom-color: var(--blueprint); }

/* ---- Forms ---- */
form.stack label { display: block; font-weight: 700; margin: 14px 0 4px; }
form.stack .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; display: block; }
input[type=text], input[type=tel], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid var(--safety);
  outline-offset: 1px;
}
.check { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-weight: 600; }
.check input { width: 22px; height: 22px; }

button, .btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 18px;
}
button:hover { background: #2a3543; }

.rating { display: flex; gap: 8px; margin: 8px 0; }
.rating label {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}
.rating input { position: absolute; opacity: 0; }
.rating input:checked + span { color: var(--blueprint); }
.rating label:has(input:checked) { border-color: var(--blueprint); background: #e8eef8; }

/* ---- Prompt preview ---- */
pre.prompt {
  white-space: pre-wrap;
  background: var(--ink);
  color: #e8ecf1;
  border-radius: 8px;
  padding: 18px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  border: 2px dashed var(--line);
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Next job hero ---- */
.next-job { margin: 0 0 20px; }
.next-job-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.next-job .feed-row { margin-bottom: 0; border-width: 2px; padding: 14px 16px; }

/* ---- Needs attention & upcoming feed ---- */
.feed { margin-bottom: 8px; }
.feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--line);
  color: inherit;
  text-decoration: none;
  margin-bottom: 8px;
}
.feed-row:last-child { margin-bottom: 0; }
.feed-row:hover, .feed-row:focus-visible { border-color: var(--blueprint); }
.feed-row.overdue-row { border-inline-start-color: var(--danger); }
.feed-row.unconfirmed { border-inline-start-color: var(--warn); }
.feed-row.confirmed { border-inline-start-color: var(--ok); }
.feed-chip {
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 6px;
  padding: 6px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
.feed-chip.overdue { background: var(--danger); }
.feed-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.feed-desc {
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.feed-badge.unconfirmed { background: var(--warn); color: #fff; }
.feed-badge.confirmed { background: var(--ok); color: #fff; }
.feed-badge.conflict { background: var(--danger); color: #fff; }

.toggle-form { margin: 0; }
button.toggle { margin-top: 0; font-family: inherit; cursor: pointer; }

.savednote { border-inline-start: 5px solid var(--ok); color: var(--ok); font-weight: 700; }
.errornote { border-inline-start: 5px solid var(--danger); color: var(--danger); font-weight: 700; }

/* ---- Auth pages ---- */
.authwrap { max-width: 420px; margin: 40px auto; }
.authwrap h1 { text-align: center; }
.authwrap .foot-link { text-align: center; margin-top: 18px; color: var(--muted); }
.authwrap .foot-link a { color: var(--blueprint); font-weight: 700; text-decoration: none; }
.authwrap button { width: 100%; }

/* ---- Overdue + conflict flags ---- */
.clashwarn { border-inline-start: 5px solid var(--danger); }
.clash-item { margin: 6px 0; }
.clash-item a { color: var(--blueprint); font-weight: 700; }

/* ---- SMS thread on a job ---- */
.msg-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.msg-item:last-child { border-bottom: none; }
.msg-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.msg-item.in .msg-meta { color: var(--blueprint); }
.msg-body { font-size: 0.95rem; }
