/* Bills screen (js/screens/bills.js). Tokens from app.css only; every class starts with .bills- */

/* ---------- Month switcher: ‹ November 2026 › ---------- */

.bills-month {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: start;
  gap: 8px;
}

.bills-month > .icon-btn {
  border-radius: 999px;
}

.bills-month__mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bills-month__name {
  max-width: 100%;
  font: 600 28px/44px var(--font-display);
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bills-month__mid .btn {
  border-radius: 999px;
}

/* ---------- Summary: the one bold place ---------- */

.bills-summary .total__value {
  margin-top: 2px;
}

.bills-calm {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bills-calm__icon {
  flex: none;
  display: flex;
  margin-top: 1px;
  color: var(--ok);
}

.bills-calm__body {
  min-width: 0;
}

.bills-calm__title {
  font: 600 25px/1.15 var(--font-display);
  letter-spacing: 0.01em;
  color: var(--ink);
}

.bills-calm__title + .total__sub {
  margin-top: 4px;
}

.bills-summary--calm::before {
  background: var(--ok);
}

/* Drafts / Waiting / Overdue / Paid: 2 x 2 on a phone, one row on a wider screen.
   Each stat spans three shared rows (label, value, sub) so values line up across a row
   even when one label needs two lines. */
.bills-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 0;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.bills-stat {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 2px;
  align-content: start;
  min-width: 0;
  padding: 12px 12px 10px 0;
}

.bills-stat > .bills-stat__label {
  align-self: end;
}

.bills-stat:nth-child(even) {
  padding-left: 14px;
  padding-right: 0;
  border-left: 1px solid var(--line);
}

.bills-stat:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.bills-stat:nth-child(n + 3) {
  padding-bottom: 0;
}

.bills-stat__label {
  font: 600 11.5px/1.3 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.bills-stat__value {
  font: 600 25px/1.15 var(--font-display);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.bills-stat__sub {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-2);
}

.bills-stat--none .bills-stat__value {
  color: var(--ink-2);
}

.bills-stat--bad .bills-stat__value,
.bills-stat--bad .bills-stat__sub {
  color: var(--bad);
}

.bills-stat--bad .bills-stat__sub {
  font-weight: 600;
}

@media (min-width: 560px) {
  .bills-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bills-stat,
  .bills-stat:nth-child(even),
  .bills-stat:nth-child(n + 3) {
    padding: 12px 10px 0 14px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .bills-stat:first-child {
    padding-left: 0;
    border-left: 0;
  }
}

/* ---------- Rows: name and lines left, amount right, tags on their own line ---------- */

.bills-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main side"
    "tags tags";
  gap: 0 12px;
  align-items: start;
}

.bills-row.list-row--tap {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "main side chev"
    "tags tags chev";
}

.bills-row > .list-row__main {
  grid-area: main;
}

.bills-row > .list-row__side {
  grid-area: side;
  gap: 2px;
  max-width: none;
  padding-top: 1px;
}

.bills-row > .list-row__chev {
  grid-area: chev;
  align-self: center;
}

/* Long job names get two lines instead of being cut short */
.bills-row .list-row__title {
  display: -webkit-box;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.bills-row__line {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bills-row__num {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bills-row > .list-row__side > .chip {
  margin-top: 4px;
}

.bills-row__tags {
  grid-area: tags;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.bills-row--due > .list-row__side {
  gap: 8px;
}

/* A bill made a moment ago lights up once */
.bills-row--new {
  animation: bills-new 2.6s ease-out;
}

@keyframes bills-new {
  0%,
  35% {
    background: var(--accent-bg);
  }
  100% {
    background: var(--surface);
  }
}

/* Small "Sample" tag on made-up records */
.chip.bills-sample {
  flex: none;
  height: 20px;
  padding: 0 8px 0 7px;
  font-size: 11.5px;
}

.bills-head .chip.bills-sample {
  height: 22px;
}

/* Short how-to lines */
.bills-hint {
  padding: 0 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}

.section__body > .bills-hint {
  margin: -4px 0 -2px;
}

/* "You can make these on Dec 1." under a later month's list */
.bills-later {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-ctl);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

/* ---------- One bill ---------- */

.bills-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px;
}

.bills-head__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bills-head__title {
  min-width: 0;
  font: 600 30px/1.1 var(--font-display);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.bills-head__sub {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.4;
}

.bills-total__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

.bills-total__late {
  color: var(--bad);
  font-weight: 600;
}

.bills-total--overdue::before {
  background: var(--bad);
}

.bills-total--paid::before {
  background: var(--ok);
}

.bills-lines {
  display: flex;
  flex-direction: column;
}

.bills-line {
  padding: 10px 0;
}

.bills-line + .bills-line {
  border-top: 1px solid var(--line);
}

.bills-line:last-child {
  padding-bottom: 0;
}

.bills-line__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.bills-line__label {
  min-width: 0;
  font-weight: 600;
  line-height: 1.35;
}

.bills-line__amt {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bills-line__detail {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}

/* Send PDF / View PDF / Copy text / Copy email, then the status step */
.bills-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bills-actions > .bills-hint {
  margin-bottom: 2px;
}

.bills-actions__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bills-actions__grid > .btn {
  min-width: 0;
  padding: 0 12px;
}

/* Whole-row buttons on a pale band: "Add how customers pay you in Settings ›",
   "Plus 1 bill to make now, in November ›" */
.bills-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 12px 10px 12px 14px;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--info-bg);
  color: var(--ink);
  font: 400 15px/1.4 var(--font-body);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.bills-tip > .icon:first-child {
  color: var(--info);
}

.bills-tip > .icon:last-child {
  color: var(--ink-2);
}

.bills-tip__text {
  flex: 1 1 auto;
  min-width: 0;
}

.bills-tip:focus-visible {
  outline-offset: 2px;
}

/* Bill to */
.bills-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bills-card > .label {
  margin-bottom: 6px;
}

.bills-card__strong {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.bills-card__muted {
  color: var(--ink-2);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.bills-kv--nowrap .kv__v {
  white-space: nowrap;
}

/* Job link inside the details card */
.bills-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin: -12px -8px -12px 0;
  padding: 0 4px 0 8px;
  border: 0;
  border-radius: var(--radius-ctl);
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-align: right;
  cursor: pointer;
  touch-action: manipulation;
}

.bills-link > span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* "Not sent after all?  [Back to draft]" */
.bills-undo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: var(--ink-2);
  font-size: 15px;
}

.bills-undo > p {
  min-width: 0;
}

/* Mark paid sheet: who and how much */
.bills-paysum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.bills-paysum__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bills-paysum__who {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.bills-paysum__what {
  color: var(--ink-2);
  font-size: 14px;
}

.bills-paysum__amt {
  flex: none;
  font: 600 26px/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
}
