/*
 * Sales. Loads inside index.html, so it lives in the hub's dark theme and has
 * to answer for the light one. Same approach as css/hours.css: every accent
 * used as TEXT is a token defined for both themes (HANDOFF rule 6), using the
 * contrast-checked light values #9C5C08 amber, #B03A2E red, #1B7A4B green.
 * Buttons and inputs are at least 44px tall: this is used on a phone mid-call.
 */

:root {
  --sal-ok: #34D399;
  --sal-warn: #E8A23D;
  --sal-bad: #E05A4A;
  --sal-panel: rgba(255,255,255,0.03);
  --sal-line: var(--glass-border);
}
body.light-theme {
  --sal-ok: #1B7A4B;
  --sal-warn: #9C5C08;
  --sal-bad: #B03A2E;
  --sal-panel: rgba(0,0,0,0.02);
  --sal-line: rgba(0,0,0,0.1);
}

.sal-wrap { max-width: 900px; margin: 0 auto; padding: 0 1rem 6rem; }

.sal-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sal-tab {
  background: none; color: var(--muted); border: 1px solid var(--sal-line); border-radius: 999px;
  padding: 0.5rem 1rem; font-family: inherit; font-size: 0.9rem; cursor: pointer; min-height: 40px;
}
.sal-tab.on { background: var(--amber); color: #1A1814; border-color: var(--amber); font-weight: 600; }

.sal-status { margin: 0 0 1rem; font-size: 0.9rem; }
.sal-status:empty { display: none; }
.sal-status-ok { color: var(--sal-ok); }
.sal-status-error { color: var(--sal-bad); }
.sal-status-info { color: var(--muted); }

.sal-fault {
  border-radius: 10px; padding: 0.9rem 1rem; margin-bottom: 1rem; font-size: 0.92rem; line-height: 1.5;
  border: 1px solid var(--sal-bad); color: var(--sal-bad); background: rgba(224,90,74,0.08);
}
.sal-fault-missing { border-color: var(--sal-warn); color: var(--sal-warn); background: rgba(232,162,61,0.08); }
.sal-note { border: 1px dashed var(--sal-line); border-radius: 10px; padding: 1rem; color: var(--sand); font-size: 0.92rem; line-height: 1.55; margin-bottom: 1rem; }
.sal-quiet { color: var(--muted); font-size: 0.88rem; line-height: 1.55; }

.sal-section { margin-bottom: 2rem; }
.sal-section-head {
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--sal-line); padding-bottom: 0.4rem; margin: 0.4rem 0 0.8rem;
}
.sal-section-title { font-family: 'Fraunces', serif; font-size: 1.15rem; font-weight: 600; }
.sal-count { font-size: 0.85rem; color: var(--muted); }
.sal-right { margin-left: auto; }

.sal-card, .sal-record, .sal-quote {
  background: var(--sal-panel); border: 1px solid var(--sal-line); border-radius: 12px;
  padding: 1rem; margin-bottom: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem;
}
.sal-record { border-color: var(--amber); }
.sal-card-top { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; }
.sal-co { font-family: 'Fraunces', serif; font-size: 1.05rem; font-weight: 600; }
.sal-who { font-size: 0.92rem; color: var(--sand); margin-top: 2px; }
.sal-why { font-size: 0.78rem; color: var(--sal-warn); white-space: nowrap; text-align: right; }
.sal-score { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--sal-line); border-radius: 6px; padding: 0 0.35rem; }
.sal-dial { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.sal-tel {
  font-size: 1.15rem; font-weight: 600; color: var(--sal-warn); text-decoration: none;
  border: 1px solid var(--amber); border-radius: 8px; padding: 0.4rem 0.8rem; min-height: 44px; display: inline-flex; align-items: center;
}
.sal-dial-note { font-size: 0.82rem; color: var(--muted); }
.sal-hook { font-size: 0.88rem; color: var(--sand); line-height: 1.5; margin: 0; }
.sal-acts { font-size: 0.8rem; color: var(--muted); }

.sal-outs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sal-out {
  background: none; color: var(--bone); border: 1px solid var(--sal-line); border-radius: 8px;
  padding: 0.5rem 0.75rem; font-family: inherit; font-size: 0.85rem; cursor: pointer; min-height: 44px;
}
.sal-out:hover, .sal-out.on { border-color: var(--amber); color: var(--sal-warn); }
.sal-card-foot { display: flex; justify-content: flex-end; }

.sal-row { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.sal-row .sal-input { flex: 1 1 200px; }
.sal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem; }
.sal-lbl { font-size: 0.8rem; color: var(--muted); display: block; min-width: 0; }
.sal-input {
  display: block; width: 100%; margin-top: 3px; box-sizing: border-box;
  background: var(--concrete); color: var(--bone); border: 1px solid var(--sal-line); border-radius: 8px;
  padding: 0.55rem 0.7rem; font-family: inherit; font-size: 0.92rem; min-height: 44px;
}
body.light-theme .sal-input { background: #F5F3F0; color: #1A1814; border-color: rgba(0,0,0,0.1); }
.sal-notes { min-height: 44px; resize: vertical; }
.sal-check { font-size: 0.86rem; color: var(--sand); display: flex; gap: 0.5rem; align-items: center; }
.sal-checks { display: flex; flex-direction: column; gap: 0.4rem; }
.sal-total { font-size: 0.92rem; line-height: 1.6; border-top: 1px solid var(--sal-line); padding-top: 0.6rem; }

.sal-btn {
  background: var(--amber); color: #1A1814; border: none; border-radius: 8px;
  padding: 0.55rem 1rem; font-family: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; min-height: 44px;
}
.sal-btn-quiet {
  background: none; color: var(--muted); border: 1px solid var(--sal-line); border-radius: 8px;
  padding: 0.45rem 0.8rem; font-family: inherit; font-size: 0.82rem; cursor: pointer; min-height: 40px;
}
.sal-btn-quiet:hover { color: var(--bone); border-color: var(--amber); }
.sal-danger { color: var(--sal-bad); }
.sal-delete { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
.sal-act { font-size: 0.85rem; padding: 0.3rem 0; border-bottom: 1px solid var(--sal-line); color: var(--sand); }
.sal-act span { color: var(--muted); }

/* Pipeline: columns side by side on a desk, swiped sideways on a phone.
   Only the board scrolls; the page never does. */
.sal-board { display: flex; gap: 0.7rem; overflow-x: auto; padding-bottom: 0.6rem; }
.sal-col { flex: 0 0 210px; display: flex; flex-direction: column; gap: 0.4rem; }
.sal-col-head { font-weight: 600; font-size: 0.9rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--sal-line); }
.sal-chip {
  text-align: left; background: var(--sal-panel); border: 1px solid var(--sal-line); border-radius: 8px;
  padding: 0.5rem 0.6rem; color: var(--bone); font-family: inherit; font-size: 0.82rem; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
.sal-chip span { color: var(--muted); }
.sal-chip .sal-chip-date { color: var(--sal-warn); }

.sal-table { display: flex; flex-direction: column; margin-top: 0.6rem; }
.sal-trow-r { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sal-apollo { border-left: 2px solid var(--amber); padding-left: 0.7rem; margin: 0.2rem 0 0.8rem; }
.sal-trow { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.55rem 0; border-bottom: 1px solid var(--sal-line); font-size: 0.9rem; }

@media (max-width: 560px) {
  .sal-card-top { flex-direction: column; }
  .sal-why { text-align: left; white-space: normal; }
}

/* ---- phase 2 ------------------------------------------------------------ */
.sal-search { margin: 0 0 0.8rem; }
.sal-filters .sal-filter { flex: 0 1 200px; }
a.sal-btn-quiet { display: inline-flex; align-items: center; text-decoration: none; }
.sal-chip-wide { width: 100%; margin-bottom: 0.4rem; }
.sal-ok { color: var(--sal-ok); font-size: 0.82rem; }
.sal-warn { color: var(--sal-warn); font-size: 0.82rem; }
.sal-pre { white-space: pre-wrap; }

/* Overview: the summary first, then the detail (tiles, goal, funnel). */
.sal-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-bottom: 1.4rem; }
.sal-tile { border: 1px solid var(--sal-line); border-radius: 12px; padding: 0.9rem; background: var(--sal-panel); display: flex; flex-direction: column; gap: 0.2rem; }
.sal-tile b { font-family: 'Fraunces', serif; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.sal-tile span { font-size: 0.8rem; color: var(--muted); }
.sal-goal { height: 12px; border-radius: 99px; background: var(--sal-panel); border: 1px solid var(--sal-line); overflow: hidden; margin-bottom: 0.6rem; }
.sal-goal i { display: block; height: 100%; background: var(--amber); }
.sal-fun { display: grid; grid-template-columns: 120px 1fr 44px; gap: 0.6rem; align-items: center; font-size: 0.86rem; padding: 0.25rem 0; }
.sal-fun-bar { height: 10px; background: var(--sal-panel); border-radius: 99px; overflow: hidden; }
.sal-fun-bar i { display: block; height: 100%; background: var(--amber); opacity: 0.8; }
.sal-fun b { text-align: right; font-variant-numeric: tabular-nums; }

/* Bookings */
.sal-booking { border-color: var(--amber); }
.sal-crew-row { border-top: 1px solid var(--sal-line); padding-top: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem; }
.sal-grid-tight { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.sal-crew-name { flex: 0 0 140px; font-weight: 600; font-size: 0.9rem; align-self: center; }
@media (max-width: 560px) {
  .sal-fun { grid-template-columns: 90px 1fr 36px; }
  .sal-crew-name { flex-basis: 100%; }
}

/* Pipeline: "From a quote PDF" (js/quote-to-event.js). Lives here because
   css/sales.css is already loaded on every screen; no new file to precache. */
.qte-btn { margin-left: 0.5rem; }
.qte-panel { border: 1px solid var(--sal-line); border-left: 3px solid var(--amber); border-radius: 10px;
  padding: 0.9rem 1rem; margin: 0.8rem 1rem 1rem; font-size: 0.92rem; line-height: 1.5; background: var(--sal-panel); }
.qte-panel.qte-error { border-left-color: var(--sal-bad); color: var(--sal-bad); }
.qte-panel.qte-ok { border-left-color: var(--sal-ok); color: var(--sal-ok); }
.qte-head { font-family: 'Fraunces', serif; font-size: 1.05rem; margin-bottom: 0.5rem; }
.qte-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.25rem 1rem; }
.qte-grid span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 0.3rem; }
.qte-warn { color: var(--sal-warn); margin: 0.6rem 0 0; padding-left: 1.1rem; }
.qte-q { margin-top: 0.8rem; font-weight: 600; }
.qte-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
