/* AI Rascals HQ - Sales (SPEC-STEP7.md 6.1). The page itself is built from the shared parts
   in app.css (tabs, numbers line, chips, board, table); this file holds only what they do
   not give, then the record sheet's sections, which other pages' sheets use too. */

/* ---------- The Sales page ---------- */

/* The numbers line: the long label ("Recurring revenue") on laptops, the short one
   ("Revenue") on phones, as in the drawings. The long one stays for screen readers. */
.sales-fig__short {
  display: none;
}

@media (max-width: 899.98px) {
  .sales-fig__long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sales-fig__short {
    display: inline;
  }
}

/* "N won, M lost": a link that stays pressed while the closed deals show. */
.sales-closed[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

/* Dragging a card to another column (laptops, edit access). */
.sales-board .bcard[draggable="true"] {
  cursor: grab;
}

.sales-board .bcard.is-dragging {
  opacity: 0.5;
}

.sales-board .board__col.is-over {
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

/* Customers on a phone: the plan sits in the quiet text place, as words rather than a pill. */
@media (max-width: 899.98px) {
  .dt[aria-label="Customers"] .dt--text .pill {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
  }
}

/* ---------- Record sheets: shared ----------
   Every record sheet in the tool uses these (Sales, and the sheets of Operations, Marketing,
   Library and the admin screens): .rec__meta, .rec__owner, .rec__gap, .rec__archive, .sec,
   .sec__head, .sec__title, .facts, .subs and .sub*, .noteform, .notes and .note*. Keep the
   names. Plain sections separated by thin lines, 13px section names, label-and-value lists
   in plain text. */

/* Under the title: the status pill, the Sample pill, the owner. */
.rec__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
}

.rec__owner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.rec__person {
  font-weight: 500;
}

.rec__step {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.rec__gap {
  margin-top: 8px;
}

.sec p + .inline {
  margin-top: 12px;
}

/* A line or a button above the list of subscriptions (a lead that still has some). */
.sec p + .subs,
.sec .inline + .subs {
  margin-top: 12px;
}

/* Quiet buttons have side padding and a border (6px + 1px on a small one); pull this one back
   by that much so its text starts at the content edge of the sheet. */
.rec__archive .btn {
  margin-left: -7px;
}

.sec {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.sec__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 8px;
}

.sec__title {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ink);
}

/* Phone and email as text, with Call / Email and Copy as small buttons beside them. */
.contact {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.contact__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.contact__text {
  user-select: all;
  overflow-wrap: anywhere;
}

/* Label and value, in plain text. */
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 24px;
  margin: 0;
}

.facts dt {
  color: var(--ink-3);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Subscriptions (and other short lists in a sheet): plain lines, no boxes. */
.subs {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sub {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.sub:first-child {
  border-top: 0;
  padding-top: 0;
}

.sub .inline {
  margin-top: 4px;
}

.sub__main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sub__plan {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.sub__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.renewal {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

/* Notes: a box to add one, then the log, newest first. */
.noteform {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.noteform .input {
  min-height: 64px;
}

.notes {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.note:first-child {
  border-top: 0;
}

.note__meta {
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.note__body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Mark won: keep the subscription or add another ---------- */

.choice {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice__legend {
  padding: 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.choice__detail {
  margin: -4px 0 4px 32px;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

/* ---------- Avenues on a deal, and the project after Won (SPEC-STEP8 section 5) ---------- */

/* One avenue per plain line, as the subscriptions are: its name, and Remove on the right
   for editors. */
.rec-avenues {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rec-avenue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 4px 0;
  border-top: 1px solid var(--line-soft);
}

.rec-avenue:first-child {
  border-top: 0;
  padding-top: 0;
}

.rec-avenue__name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rec-avenue .btn {
  flex: none;
}

.rec-avenues + .rec-avenues__add,
.sec p + .rec-avenues__add {
  margin-top: 12px;
}

/* "Project: Live" and the link to it in Operations, under the stage chips. */
.rec-project {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin: 12px 0 0;
}

.rec-project__link {
  font-weight: 500;
}

/* ---------- Old table, still used by the Operations chart (operations-chart.js) ----------
   Not used by Sales any more. Remove once no page uses .table-wrap and .table. */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.table th {
  background: var(--panel);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ink-3);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
