/*
 * Styles used by exactly one page. Anything a second page needs moves to components.css.
 */
@layer pages {

  /* ---------- Resource form (resources/resource_form.html) ---------- */
  /* File vs link fields follow the chosen type, no JS needed. */
  .resource-form:has(input[name="kind"][value="link"]:checked) .when-file,
  .resource-form:has(input[name="kind"][value="file"]:checked) .when-link { display: none; }

  /* ---------- Expense form (expenses/expense_form.html) ---------- */
  /* Billing box (expenses/_billing_fields.html, also on Edit billing): the checkbox shows once a
     project is chosen, and the line item description and markup or discount once it's ticked. */
  .billing-fields:has(select[name="allocation"] option[value=""]:checked) .when-project { display: none; }
  .billing-fields:not(:has(input[name="billable"]:checked)) .when-billable { display: none; }
  /* Receipt drop area: the file input covers it invisibly, so a drop lands on the input. */
  .receipt-drop {
    position: relative; display: grid; justify-items: center; gap: var(--space-2); text-align: center;
    padding: var(--space-6) var(--space-5); cursor: pointer;
    border: 1.5px dashed var(--line-control); border-radius: var(--radius-md); background: var(--paper-raised);
    transition: border-color var(--bp-dur-quick) var(--bp-ease-tide), background-color var(--bp-dur-quick) var(--bp-ease-tide);
  }
  .receipt-drop .icon { width: 28px; height: 28px; color: var(--ink-muted); }
  .receipt-drop-title { font-weight: 600; font-size: 16px; }
  .receipt-drop:hover, .receipt-drop.is-over { border-color: var(--forest); background: var(--seaglass-soft); }
  .receipt-drop:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
  .receipt-drop:has([aria-invalid="true"]) { border-color: var(--danger); }
  .receipt-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .receipt-drop-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
  .receipt-drop-list:empty { display: none; }
  .receipt-drop-list li {
    display: flex; align-items: center; gap: var(--space-3); min-width: 0;
    padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--paper-raised); font-size: 14px;
  }
  .receipt-drop-list li span:first-of-type { overflow-wrap: anywhere; }
  .receipt-drop-list .icon { width: 18px; height: 18px; color: var(--ink-muted); }
  .receipt-drop-list .mono { margin-left: auto; color: var(--ink-muted); white-space: nowrap; }
  .receipt-drop-list .is-new { border-color: var(--forest); }

  /* ---------- Expense detail (expenses/expense_detail.html) ---------- */
  /* Where a reviewer is in the approval queue, under the header. */
  .approval-queue { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); font-size: 14px; color: var(--ink-muted); }
  /* A photo receipt shown inline. */
  .receipt-preview { margin-top: var(--space-1); }
  .receipt-preview > summary { width: max-content; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
  .receipt-preview img {
    margin-top: var(--space-3); max-width: min(100%, 420px); max-height: 560px; height: auto;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-subtle);
  }

  /* ---------- Invoice line editor (billing/invoice_editor.html) ---------- */
  .line-editor .bp-table td { padding: var(--space-2) var(--space-3); }
  .line-editor .bp-input { height: 40px; min-width: 0; }
  .line-editor td:first-child { min-width: 260px; width: 100%; }
  .line-editor td.num .bp-input { width: 110px; text-align: right; }
  /* Phones: each line is a card. Description across the top, quantity and unit price (or the
     expense's amount) side by side, then the tax and remove boxes, each named by its data-label.
     The empty row for a new line says so. */
  @media (max-width: 599px) {
    .line-editor .bp-table-wrap { overflow: visible; border: 0; background: none; }
    .line-editor :is(.bp-table, .bp-table tbody) { display: block; }
    .line-editor .bp-table caption { display: block; padding: 0 0 var(--space-3); }
    .line-editor .bp-table thead { display: none; }
    .line-editor .bp-table tr {
      display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3) var(--space-3);
      margin-bottom: var(--space-3); padding: var(--space-4);
      border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised);
    }
    .line-editor .bp-table tbody tr:hover { background: var(--paper-raised); }
    .line-editor .bp-table td { display: grid; gap: var(--space-1); padding: 0; border: 0; min-width: 0; width: auto; text-align: left; }
    .line-editor td::before {
      content: attr(data-label);
      font: 500 12px/16px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted);
    }
    .line-editor .bp-input { height: 48px; }
    .line-editor td.num .bp-input { width: 100%; text-align: left; }
    .line-editor .line-desc, .line-editor .line-amount { grid-column: span 6; }
    .line-editor :is(.line-qty, .line-price) { grid-column: span 3; }
    .line-editor .line-amount { font-weight: 600; }
    /* Tax and remove: a box beside its name, in a row. */
    .line-editor .bp-table td.line-check { grid-column: span 2; display: flex; align-items: center; gap: var(--space-2); }
    .line-editor td.line-check::before { order: 2; }
    .line-editor .bp-table td.line-check:empty { display: none; }
    .line-editor .bp-table tr.line-new { border-style: dashed; }
    .line-editor .line-new::before {
      content: "New line"; grid-column: 1 / -1;
      font-weight: 600; font-size: 15px; color: var(--ink);
    }
  }

  /* ---------- Invite detail (accounts/invite_detail.html) ---------- */
  .invite-link { flex: 1; min-width: 0; height: 48px; font-size: 14px; }

  /* ---------- Component showcase (core/showcase.html) ---------- */
  .showcase { display: grid; gap: var(--fluid-gap); grid-template-columns: 1fr; }
  @media (min-width: 1280px) { .showcase { grid-template-columns: 1fr 1fr; } }
  .showcase-panel {
    display: grid; gap: var(--space-6); align-content: start;
    padding: var(--space-6); border-radius: var(--radius-lg);
    background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  }
  .showcase-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
  .showcase-toasts { display: grid; gap: var(--space-2); max-width: 380px; }

} /* @layer pages */
