:root {
  --cf-bg: #f4f7f9;
}
:root[data-theme="dark"] {
  --cf-bg: #101b25;
}
:root {
  --cf-green: #16735a;
  --cf-green-bg: #eaf7ef;
  --cf-amber: #906016;
  --cf-amber-bg: #fff6e4;
  --cf-red: #ac4141;
  --cf-red-bg: #fff0ef;
}
:root[data-theme="dark"] {
  --cf-green: #92d5bc;
  --cf-green-bg: #20483b;
  --cf-amber: #e9c17d;
  --cf-amber-bg: #463b27;
  --cf-red: #f0b0b0;
  --cf-red-bg: #4c3035;
}
.cf-ui .page-heading {
  gap: 14px;
  flex-wrap: wrap;
}
.cf-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0 0;
}
.cf-actions .btn,
.cf-ui .btn {
  font-size: 12px;
}
.cf-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}
.cf-entry p {
  font-size: 13px;
  line-height: 1.8;
}
.cf-context {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  gap: 15px;
  justify-content: space-between;
  align-items: center;
}
.cf-context h2 {
  font-size: 19px;
  margin: 8px 0;
}
.cf-context p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}
.cf-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.cf-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cf-metric span {
  font-size: 12px;
  color: var(--muted);
}
.cf-metric strong {
  font-size: 33px;
  line-height: 1.2;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.cf-metric small {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
}
.cf-metric.blue strong {
  color: var(--blue);
}
.cf-metric.amber strong,
.cf-amber {
  color: var(--cf-amber);
}
.cf-metric.red strong,
.cf-red {
  color: var(--cf-red);
}
.cf-progress {
  padding: 17px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.cf-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 12px;
}
.cf-progress span {
  color: var(--muted);
}
.cf-progress progress {
  width: 100%;
  height: 8px;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
}
.cf-progress progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 8px;
}
.cf-progress progress::-webkit-progress-value {
  background: #228b75;
}
.cf-progress progress::-moz-progress-bar {
  background: #228b75;
}
.cf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}
.cf-main,
.cf-reader {
  min-width: 0;
  display: grid;
  gap: 20px;
}
.cf-ui .panel {
  margin: 0;
}
.cf-main .panel-head {
  align-items: center;
}
.cf-ui h2 {
  font-size: 16px;
}
.cf-tools {
  padding: 0 18px 18px;
  display: grid;
  gap: 10px;
}
.cf-tools input {
  width: 100%;
  font-size: 12px;
}
.cf-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.cf-filters .btn {
  padding: 7px 10px;
  min-height: 30px;
  font-size: 11px;
  flex: 1;
}
.cf-filters [aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
}
.cf-table {
  position: relative;
  overflow-x: auto;
}
.cf-table table {
  min-width: 590px;
}
.cf-table th {
  font-size: 10px;
}
.cf-table td {
  font-size: 12px;
}
.cf-table td small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.cf-table .name-cell {
  min-width: 180px;
}
.cf-table .btn {
  font-size: 11px;
  white-space: nowrap;
  padding: 7px;
}
.cf-pill {
  display: inline-flex;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.5;
  padding: 5px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.cf-pill.green {
  color: var(--cf-green);
  background: var(--cf-green-bg);
}
.cf-pill.amber {
  color: var(--cf-amber);
  background: var(--cf-amber-bg);
}
.cf-pill.red {
  color: var(--cf-red);
  background: var(--cf-red-bg);
}
.cf-pill.neutral {
  color: var(--muted);
  background: var(--cf-bg);
}
.cf-footnote {
  padding: 14px 18px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
  border-top: 1px solid var(--line);
  margin: 0;
}
.cf-issues {
  border-color: #dfb4b4;
}
.cf-issue {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  align-items: center;
}
.cf-issue > div {
  display: grid;
  gap: 5px;
}
.cf-issue strong {
  font-size: 12px;
}
.cf-issue small {
  font-size: 11px;
  color: var(--cf-red);
}
.cf-issue code {
  font-size: 10px;
  overflow-wrap: anywhere;
}
.cf-source-state {
  background: var(--cf-bg);
  padding: 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.8;
}
.cf-source {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
  font-size: 12px;
}
.cf-source small {
  font-size: 10px;
  line-height: 1.8;
  color: var(--muted);
}
.cf-totals {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
}
.cf-totals span {
  display: flex;
  justify-content: space-between;
}
.cf-totals strong {
  color: var(--ink);
}
.cf-reader .btn {
  width: 100%;
}
.cf-field {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  font-size: 12px;
  font-weight: 600;
}
.cf-field input,
.cf-field select,
.cf-field textarea {
  width: 100%;
  font: inherit;
}
.cf-check {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.8;
  align-items: flex-start;
  margin: 17px 0;
}
.cf-check input {
  width: auto;
  min-height: 0;
  margin-top: 5px;
}
.cf-unit,
.cf-history-item {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
}
.cf-unit > div {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.cf-unit strong,
.cf-history-item strong {
  font-size: 13px;
}
.cf-unit small,
.cf-history-item p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}
.cf-unit code,
.cf-report code {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.cf-unit .btn {
  flex: none;
}
.cf-history {
  padding: 0 22px 20px;
}
.cf-report {
  font-size: 12px;
  line-height: 1.8;
}
.cf-report h2 {
  font-size: 23px;
  line-height: 1.4;
}
.cf-report .cf-metric {
  padding: 13px;
  gap: 6px;
}
.cf-report .cf-metric strong {
  font-size: 25px;
}
.cf-report .cf-metric small {
  display: none;
}
.cf-report-item {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  break-inside: avoid;
}
.cf-report-item small {
  color: var(--muted);
}
#cf-print {
  display: none;
}
.cf-score .cf-metric strong {
  font-size: clamp(38px, 4.2vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.cf-score .cf-metric span {
  font-size: 13px;
  font-weight: 650;
}
.cf-count-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 16px;
}
.cf-count-strip strong {
  color: var(--cf-green);
}
.cf-last-read {
  display: grid;
  gap: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 9px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.cf-last-read span {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
}
.cf-last-read strong {
  font-size: 17px;
}
.cf-last-read small {
  color: var(--muted);
  font-size: 11px;
}
.cf-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}
.cf-product-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cf-product-card.red {
  border-top-color: var(--cf-red);
}
.cf-product-card.amber {
  border-top-color: var(--cf-amber);
}
.cf-product-card.green {
  border-top-color: var(--cf-green);
}
.cf-product-card[data-latest="true"] {
  animation: cf-read-pulse 1.5s ease-out;
}
@keyframes cf-read-pulse {
  from {
    box-shadow: 0 0 0 3px var(--blue);
  }
  to {
    box-shadow: 0 0 0 0 transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cf-product-card[data-latest="true"] {
    animation: none;
  }
}
.cf-product-heading {
  display: grid;
  gap: 10px;
}
.cf-product-heading h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.cf-product-heading small {
  color: var(--muted);
  font-size: 11px;
}
.cf-product-heading .cf-pill {
  justify-self: start;
}
.cf-product-count {
  display: flex;
  gap: 12px;
  align-items: center;
}
.cf-product-count > strong {
  font-size: 62px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}
.cf-product-count > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.cf-product-count b {
  color: var(--ink);
  font-size: 20px;
}
.cf-product-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cf-product-breakdown span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.cf-product-breakdown b {
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.cf-product-card > .btn {
  margin-top: auto;
  align-self: start;
}
.cf-empty {
  padding: 18px;
  color: var(--muted);
}
.cf-report-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cf-report-meta > div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.cf-report-meta dt {
  color: var(--muted);
  font-size: 12px;
}
.cf-report-meta dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}
.cf-os-table table {
  min-width: 800px;
}
.cf-os-table td {
  font-variant-numeric: tabular-nums;
}
.cf-os-table td small {
  display: block;
  color: var(--muted);
}
@media (max-width: 1050px) and (min-width: 801px) {
  .cf-product-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .cf-product-grid,
  .cf-report-meta {
    grid-template-columns: 1fr;
  }
  .cf-product-grid {
    padding: 12px;
  }
  .cf-score .cf-metric strong {
    font-size: 44px;
  }
  .cf-product-count > strong {
    font-size: 58px;
  }
}
@media (max-width: 1200px) {
  .cf-workspace {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 14px;
  }
  .cf-metric {
    padding: 14px;
  }
  .cf-context {
    padding: 18px;
  }
}
@media (max-width: 800px) {
  .cf-workspace {
    grid-template-columns: 1fr;
  }
  .cf-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .cf-context {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .cf-entry {
    grid-template-columns: 1fr;
  }
  .cf-history-item {
    flex-wrap: wrap;
  }
  .cf-progress {
    padding: 15px;
  }
  .cf-unit {
    flex-wrap: wrap;
  }
  .cf-report .cf-table table {
    min-width: 480px;
  }
}
@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
    @bottom-left {
      content: "LOCUP - Conferência RFID";
      font:
        9px Arial,
        sans-serif;
      color: #555;
    }
    @bottom-right {
      content: "Página " counter(page) " de " counter(pages);
      font:
        9px Arial,
        sans-serif;
      color: #555;
    }
  }
  body.cf-printing > #app,
  body.cf-printing > #modal,
  body.cf-printing > #toast {
    display: none !important;
  }
  body.cf-printing > #cf-print {
    display: block;
    color: #111;
    padding: 0;
    background: #fff;
  }
  #cf-print .cf-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #cf-print .cf-metric {
    color: #111;
    background: #f5f5f5;
    border: 1px solid #ddd;
  }
  #cf-print .cf-table {
    overflow: visible;
  }
  #cf-print table {
    min-width: 0;
  }
  #cf-print tr {
    break-inside: avoid;
  }
  #cf-print .cf-report {
    color: #111;
  }
  #cf-print {
    --ink: #111;
    --muted: #444;
    --line: #ddd;
    --surface: #fff;
  }
  #cf-print .cf-table table {
    min-width: 0;
    width: 100%;
    font-size: 10px;
  }
  #cf-print .cf-table th,
  #cf-print .cf-table td {
    padding: 6px;
    overflow-wrap: anywhere;
  }
  #cf-print .cf-score .cf-metric strong {
    font-size: 30px;
    color: #111;
  }
  #cf-print thead {
    display: table-header-group;
  }
  #cf-print h3 {
    break-after: avoid;
  }
  #cf-print .cf-report {
    font-size: 12px;
  }
  #cf-print .cf-report > header p {
    margin: 6px 0;
    font-size: 11px;
  }
  #cf-print .cf-report p {
    margin: 7px 0;
  }
  #cf-print .cf-report-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0;
  }
  #cf-print .cf-report-meta > div {
    padding: 5px 0;
  }
  #cf-print .cf-metrics {
    margin: 12px 0;
  }
  #cf-print .cf-metric {
    padding: 10px;
    gap: 8px;
  }
  #cf-print .cf-count-strip {
    gap: 6px 14px;
    font-size: 10px;
    margin-bottom: 10px;
  }
  #cf-print .cf-report h3 {
    font-size: 14px;
    margin: 14px 0 8px;
  }
  #cf-print .cf-report-item {
    display: block;
    padding: 7px 0;
    line-height: 1.35;
    break-inside: avoid;
  }
  #cf-print .cf-report-item strong {
    display: inline-block;
    width: 38%;
    vertical-align: top;
    font-size: 12px;
    padding-right: 8px;
  }
  #cf-print .cf-report-item code {
    display: inline-block;
    width: 27%;
    vertical-align: top;
    font-size: 11px;
    padding-right: 8px;
  }
  #cf-print .cf-report-item small {
    display: inline-block;
    width: 33%;
    vertical-align: top;
    font-size: 11px;
  }
}

/* The full OS table needs room on desktop; narrow screens keep horizontal table scrolling. */
dialog:has(.cf-report) {
  width: min(1120px, 94vw);
}

.cf-order-choice {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.cf-order-choice legend {
  font-weight: 700;
}

.cf-order-choice { min-inline-size: 0; }
.cf-order-choice .cf-table table { min-width: 480px; }
