/* Supplier rejection portal additions on top of the shared PML stylesheet */
.badge.reported { background: var(--amber-tint); color: var(--amber); }
.badge.returned { background: var(--red-tint); color: var(--red); }
.badge.dn_raised { background: var(--beige-tint); color: var(--beige-text); }
.badge.accepted { background: var(--blue-tint); color: var(--blue); }
.badge.disputed { background: #efe7fb; color: #6b46c1; }
.badge.recovered { background: var(--green-tint); color: var(--green); }
.badge.waived { background: #eee; color: #555; }
.overdue-text { color: var(--red); font-weight: 500; }

.kpi.green { border-left-color: var(--green); }
.kpi.green .val { color: var(--green); }
.grid.kpis.fy .kpi { background: var(--beige-tint); }

.banner .big-amount { font: 700 26px var(--font-head); color: var(--ink); text-align: right; line-height: 1.1; }
.banner .big-amount span { display: block; font: 500 12px var(--font-body); color: var(--ink-3); }

.viz-col .pair { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; }
.viz-col .pair .viz-seg { width: min(22px, 40%); border-radius: 3px 3px 0 0; min-height: 0; }
tbody td:first-child a, td.nowrap { white-space: nowrap; }

.input-add { display: flex; gap: 6px; }
.input-add select { flex: 1; min-width: 0; }
.edit-table td { padding: 6px 8px; }
.edit-table input, .edit-table select { min-width: 90px; }
.edit-table input.qty { width: 100px; min-width: 0; }
.edit-table select[name=kind] { min-width: 200px; }
.edit-table input[name=description] { min-width: 200px; }
.edit-table input[name=unit] { width: 70px; min-width: 0; }
.edit-table tfoot td { border-bottom: 0; padding-top: 12px; }
tr.total-row td { font-weight: 700; background: #fbfaf8; }
.sticky-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-bar .btn.primary { min-width: 220px; }
.inline-select { width: auto; padding: 3px 6px; font-size: 13px; }
.group-label { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.check-group.invalid { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 6px; }
.check-group { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 4px; }
.check-group label.check { margin: 0; min-height: 32px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); }
tr.inactive td { color: var(--ink-3); }
.chat-preview { white-space: pre-wrap; font: 13px/1.5 var(--font-body); background: #f4f6f8; border-radius: 8px; padding: 12px; margin: 0; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
code { background: var(--beige-tint); padding: 1px 5px; border-radius: 4px; font-size: 12px; word-break: break-all; }

/* Debit note sheet (A4 when printed) */
/* On screen the letterhead strips sit at the top and bottom of the sheet; print rules below repeat them on every page. */
.dn-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-width: 820px; margin: 0 auto; font-size: 13.5px;
  overflow: hidden; display: flex; flex-direction: column; }
.dn-lh-head, .dn-lh-foot { display: block; width: 100%; height: auto; }
.dn-lh-foot { order: 2; margin-top: 8px; }
table.dn-frame, .dn-frame > * > tr > td { border: 0; padding: 0; background: none; }
.dn-frame > tbody > tr:hover { background: none; }
.dn-frame .dn-body { padding: 12px 40px 8px; }
.dn-space-top, .dn-space-bottom { display: none; }
.dn-titlebar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 3px solid var(--red); padding-bottom: 8px; margin-bottom: 14px; }
.dn-title { font: 700 20px var(--font-head); color: var(--red); letter-spacing: 1px; }
.dn-meta { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.dn-meta .k, .dn-nums .k { color: var(--ink-3); font-size: 12px; }
.dn-nums { text-align: right; }
.dn-table { margin: 10px 0 14px; }
.dn-table th, .dn-table td { border: 1px solid var(--line); }
.dn-table tbody th { width: 160px; background: #fbfaf8; }
.dn-sign { display: flex; justify-content: space-between; margin-top: 36px; font-size: 12.5px; }
.dn-sign > div:last-child { text-align: right; }
@media print {
  .no-print, .tabbar { display: none !important; }
  .main { padding: 0; }
  .dn-sheet { border: 0; padding: 0; max-width: none; border-radius: 0; display: block; overflow: visible; }
  /* Letterhead edge to edge, repeated on every page (A4 is 210 mm wide; the strips are 30.9 and 40.2 mm tall). */
  @page { size: A4; margin: 14mm; }
  @page dn { size: A4; margin: 0; }
  .dn-sheet { page: dn; }
  .dn-lh-head, .dn-lh-foot { position: fixed; left: 0; width: 210mm; margin: 0; }
  .dn-lh-head { top: 0; }
  .dn-lh-foot { bottom: 0; }
  .dn-space-top { display: block; height: 35mm; }
  .dn-space-bottom { display: block; height: 44mm; }
  .dn-frame .dn-body { padding: 0 14mm; }
  .dn-frame thead { display: table-header-group; }
  .dn-frame tfoot { display: table-footer-group; }
  html, body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 700px) {
  .sticky-bar { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .sticky-bar .btn { flex: 1; min-width: 0; }
  .dn-frame .dn-body { padding: 12px 16px 8px; }
  .dn-meta { flex-direction: column; }
  .dn-nums { text-align: left; }
  .banner .big-amount { text-align: left; }
}

/* ---------- Audit additions ---------- */
.badge.yours { background: var(--red); color: #fff; }
.badge.overdue { background: var(--red-tint); color: var(--red); }
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 240px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; }
.menu-list a, .menu-list button { text-align: left; padding: 9px 12px; border-radius: 6px; border: 0; background: none; font: 500 14px var(--font-body); color: var(--ink); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--beige-tint); text-decoration: none; }
.photo-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; margin: 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fbfaf8; }
.thumb img { width: 100%; height: 100px; object-fit: cover; display: block; }
.thumb .pdf { display: grid; place-items: center; height: 100px; font: 700 18px var(--font-head); color: var(--red); }
.thumb span { display: block; font-size: 11px; padding: 4px 6px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
ul.files { list-style: none; padding: 0; margin: 12px 0 0; }
ul.files li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-form { display: flex; gap: 8px; margin-bottom: 14px; }
.note-form input { flex: 1; }
.timeline li.note { background: var(--beige-tint); border-radius: 0 6px 6px 0; }
.row-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field label { margin: 0; white-space: nowrap; }
.inline-field select { width: auto; }
.sticky-total { margin-right: auto; align-self: center; font-size: 14px; }
.edit-table .unit-cell select { min-width: 110px; }
.dn-total { font-size: 15px; }
.recover-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); padding: 14px 18px; }
.recover-bar .field { margin: 0; min-width: 180px; }
.recover-bar > div:first-child { margin-right: auto; align-self: center; }
.dn-annex { break-before: page; margin-top: 32px; }
.dn-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dn-photos figure { margin: 0; break-inside: avoid; }
.dn-photos img { width: 100%; max-height: 300px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; }
.dn-photos figcaption { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
label.check { margin-bottom: 6px; }
label.btn { margin: 0; color: var(--ink); }

/* Phone: lot and cost rows become cards with labelled fields */
@media (max-width: 700px) {
  .edit-table thead { display: none; }
  .edit-table, .edit-table tbody, .edit-table tfoot, .edit-table tr, .edit-table td { display: block; width: 100%; }
  .edit-table tbody tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; background: #fff; }
  .edit-table td { border: 0; padding: 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .edit-table td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--ink-2); flex: none; width: 40%; }
  .edit-table td input, .edit-table td select { flex: 1; min-width: 0 !important; width: auto !important; }
  .edit-table td.right .btn { width: 100%; }
  .edit-table tfoot td { justify-content: flex-end; }
  .edit-table tfoot td:empty { display: none; }
  .table-wrap:has(.edit-table) { overflow: visible; }
  .card-head .actions .btn { flex: 1 1 auto; }
  .sticky-total { width: 100%; text-align: center; }
  .sticky-bar { flex-wrap: wrap; }
  .note-form { flex-direction: column; }
  .dn-photos { grid-template-columns: 1fr; }
  .menu-list { right: auto; left: 0; }
  .recover-bar { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); }
}

/* dd/mm/yyyy date box with a calendar button (the browser's picker stays hidden behind it) */
.date-field { position: relative; display: flex; align-items: stretch; gap: 0; width: 100%; }
.date-field .date-text { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; font-variant-numeric: tabular-nums; }
.date-field .date-cal { flex: none; width: 42px; border: 1px solid #d9d3cb; border-left: 0; border-radius: 0 8px 8px 0; background: #fbfaf8; cursor: pointer; font-size: 16px; }
.date-field .date-cal:hover { background: var(--beige-tint); }
.date-field .date-native { position: absolute; right: 0; bottom: 0; width: 42px; height: 100%; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.edit-table .date-field { min-width: 150px; }
@media (max-width: 700px) { .edit-table td .date-field { flex: 1; } .edit-table td .date-field .date-text { width: auto !important; } }

/* Supplier rating (F/PURF/10) */
.badge.r-very-good { background: var(--green-tint); color: var(--green); }
.badge.r-good { background: var(--blue-tint); color: var(--blue); }
.badge.r-needs-improvement { background: var(--amber-tint); color: var(--amber); }
.badge.r-poor { background: var(--red-tint, #fde8e7); color: var(--red); }
table.rating th, table.rating td { white-space: nowrap; }
table.rating .grp { text-align: center; border-bottom: 2px solid var(--beige); }
.ppm-table td input { width: 110px; }
