:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --ink: #111111;
  --muted: #626262;
  --line: #d8d8d6;
  --surface: #ffffff;
  --soft: #edf5f0;
  --primary: #009045;
  --primary-strong: #006b34;
  --primary-faint: #f1faf5;
  --accent: #9d9d9c;
  --danger: #8a1f2d;
  --success: #009045;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Frutiger LT Pro", Frutiger, "Segoe UI", "Source Sans Pro", "Source Sans 3", Arial, sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.topbar {
  border-top: 8px solid var(--primary);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar__content,
.app-layout,
.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar__content {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

.topbar__text {
  min-width: 0;
}

.topbar__logo {
  width: min(280px, 34vw);
  max-height: 94px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  color: #000;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  letter-spacing: 0;
}

h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.lead,
.legal-note,
.footer,
.visible-count {
  color: var(--muted);
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 28px 0 36px;
}

.side-menu {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.side-menu__header {
  margin-bottom: 14px;
}

.actions {
  display: grid;
  gap: 8px;
}

.button {
  display: inline-flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.button svg,
.search-wrap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  flex: 0 0 auto;
}

.button--ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button--ghost:hover {
  border-color: var(--accent);
  background: #f5f5f4;
}

.button--danger {
  background: #fff7f7;
  border-color: #d8b5bb;
  color: var(--danger);
}

.button--current {
  border-color: rgba(0, 144, 69, 0.38);
  background: var(--primary-faint);
  color: var(--primary-strong);
}

.button:hover,
.tab:hover {
  transform: translateY(-1px);
}

.page {
  min-width: 0;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.control-block,
.level-board,
.items-area,
.report,
.notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-block,
.level-board,
.items-area,
.report,
.notes {
  padding: 18px;
}

.section-heading {
  margin-bottom: 16px;
}

.fields {
  display: grid;
  gap: 12px;
}

.fields--profile {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fields--target {
  grid-template-columns: minmax(0, 1fr) 160px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
button:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(0, 144, 69, 0.22);
  outline-offset: 2px;
}

.legal-note {
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  min-height: 24px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  color: var(--primary-strong);
  font-size: clamp(1.45rem, 4vw, 2.15rem);
  line-height: 1;
}

.level-board {
  margin-bottom: 18px;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
  overflow-x: visible;
  padding-bottom: 0;
}

.level-chip {
  min-width: 0;
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.level-chip.is-target {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.level-chip.is-ok {
  border-color: rgba(0, 144, 69, 0.38);
  background: var(--primary-faint);
}

.level-chip h3 {
  margin-bottom: 8px;
}

.level-chip p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.level-chip .badge {
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge--ok {
  background: #e1f3e9;
  color: var(--success);
}

.badge--warn {
  background: #eeeeec;
  color: #000;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
}

.search-wrap input {
  border: 0;
  background: transparent;
  padding-left: 0;
}

.toggle {
  min-height: 42px;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

.toggle input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.tab {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.tab[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.items-area {
  margin-bottom: 18px;
}

.items-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.visible-count {
  margin-top: 4px;
  font-weight: 800;
  white-space: nowrap;
}

.requirement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
  margin-bottom: 18px;
  overflow-x: visible;
}

.requirement-meter {
  min-width: 0;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.meter-line {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.meter-line span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
}

.requirement-meter strong {
  display: block;
  margin-bottom: 4px;
}

.requirement-meter small {
  color: var(--muted);
  font-weight: 700;
}

.items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.requirement-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid #cfcfcd;
  border-left: 6px solid var(--primary);
  border-radius: 8px;
  padding: 16px;
  background: var(--primary-faint);
}

.requirement-divider span {
  display: block;
  margin-bottom: 5px;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.requirement-divider h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1.12rem;
}

.requirement-divider p {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--muted);
}

.requirement-divider strong {
  min-width: 190px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--primary-strong);
  text-align: right;
  box-shadow: inset 0 0 0 1px rgba(0, 144, 69, 0.18);
}

.item-card {
  display: grid;
  gap: 14px;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.item-card.is-filled {
  border-color: rgba(0, 144, 69, 0.45);
  background: #fbfffd;
}

.item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, auto);
  gap: 18px;
  align-items: start;
}

.item-description {
  min-width: 0;
}

.item-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.item-number {
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.25;
  white-space: nowrap;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-meta .badge {
  border-radius: 8px;
}

.item-controls {
  width: min(100%, 350px);
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fafbf9;
}

.item-controls.has-variants {
  width: min(100%, 480px);
}

.entry-header,
.entry-row {
  display: grid;
  grid-template-columns: 108px 112px 96px;
  gap: 10px;
  align-items: center;
}

.item-controls.has-variants .entry-header,
.item-controls.has-variants .entry-row {
  grid-template-columns: minmax(86px, 1fr) 108px 112px 96px;
}

.entry-header {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.entry-row {
  min-height: 42px;
}

.entry-row + .entry-row {
  margin-top: 8px;
}

.entry-kind {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.entry-score {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid rgba(0, 144, 69, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f2f8f5;
  color: var(--primary-strong);
  font-weight: 900;
}

.entry-quantity {
  display: block;
}

.entry-row output {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8f8f7;
  font-weight: 900;
}

.evidence-block {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.evidence-toggle {
  display: flex;
  min-height: 40px;
  width: max-content;
  max-width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.evidence-toggle:hover {
  border-color: var(--accent);
  background: #f8f8f7;
}

.evidence-toggle::before {
  color: var(--primary);
  content: "+";
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.evidence-toggle[aria-expanded="true"]::before {
  content: "-";
}

.evidence-toggle strong {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--primary-faint);
  color: var(--primary-strong);
  font-size: 0.78rem;
  white-space: nowrap;
}

.evidence-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.evidence-panel[hidden] {
  display: none;
}

.evidence-field {
  color: var(--muted);
}

.evidence-field span {
  font-weight: 800;
}

.document-list {
  display: flex;
  min-height: 32px;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.document-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 144, 69, 0.18);
  border-radius: 8px;
  padding: 4px 5px 4px 8px;
  background: var(--primary-faint);
  color: var(--primary-strong);
}

.document-pill span {
  border: 0;
  padding: 0;
  background: transparent;
}

.remove-document {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.remove-document:hover {
  border-color: var(--accent);
  color: #000;
}

.evidence-field--comment {
  margin-top: 2px;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.report {
  margin-bottom: 18px;
}

.selected-report {
  display: grid;
  gap: 12px;
}

.report-item {
  border-left: 4px solid var(--primary);
  padding: 10px 0 10px 12px;
}

.report-item strong {
  display: block;
}

.report-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.report-evidence {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  background: #fff;
}

.notes p,
.footer {
  margin-bottom: 0;
}

.instructions-page {
  display: grid;
  gap: 18px;
}

.instruction-hero,
.instruction-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.instruction-hero h2 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.12;
}

.instruction-hero p,
.instruction-section p,
.instruction-section li {
  color: var(--muted);
}

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

.instruction-section h3 {
  margin-bottom: 8px;
}

.instruction-section ul,
.instruction-section ol {
  margin: 10px 0 0 1.2rem;
  padding: 0;
}

.instruction-section li + li {
  margin-top: 8px;
}

.notice-box {
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
  background: var(--primary-faint);
}

.notice-box--warning {
  border-left-color: var(--danger);
  background: #fff7f7;
}

.reference-list a {
  color: var(--primary-strong);
  font-weight: 800;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  font-size: 0.9rem;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer p + p {
  margin-top: 4px;
}

@media (max-width: 1020px) {
  .app-layout,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .side-menu {
    position: static;
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-layout {
    grid-template-columns: 1fr;
  }

  .item-controls,
  .item-controls.has-variants {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 680px) {
  .topbar__content,
  .app-layout,
  .footer {
    width: min(100% - 20px, 1180px);
  }

  .topbar__content {
    display: grid;
    gap: 18px;
  }

  .topbar__logo {
    width: min(240px, 82vw);
  }

  .actions,
  .toolbar,
  .fields--profile,
  .fields--target,
  .instruction-grid,
  .notes {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .items-header {
    display: block;
  }

  .item-title {
    grid-template-columns: 1fr;
  }

  .item-number {
    width: max-content;
  }

  .entry-header {
    display: none;
  }

  .entry-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .item-controls.has-variants .entry-row {
    grid-template-columns: 1fr;
  }

  .entry-score::before,
  .entry-row output::before {
    margin-right: 8px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .entry-score::before {
    content: "Pontuação";
  }

  .entry-row output::before {
    content: "Total";
  }

  .entry-quantity::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    content: "Quantidade";
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .evidence-toggle {
    width: 100%;
  }

  .evidence-toggle strong {
    white-space: normal;
    text-align: right;
  }

  .requirement-divider {
    grid-template-columns: 1fr;
  }

  .requirement-divider strong {
    text-align: left;
  }

  .entry-score,
  .entry-row output {
    justify-content: flex-start;
  }
}

@media print {
  body {
    background: #fff;
  }

  .actions,
  .side-menu,
  .toolbar,
  .tabs,
  .items-area,
  .footer {
    display: none !important;
  }

  .topbar,
  .control-block,
  .level-board,
  .report,
  .notes,
  .stat-card {
    box-shadow: none;
  }

  .topbar__content,
  .app-layout,
  .page {
    width: 100%;
  }

  .app-layout {
    display: block;
    padding: 0;
  }

  .topbar__content {
    padding: 0 0 16px;
  }

  .page {
    padding: 0;
  }
}
