:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-strong: #f8fbfd;
  --ink: #14213d;
  --ink-2: #24334f;
  --muted: #667085;
  --line: #d9e3ee;
  --line-strong: #c4d2e2;
  --teal: #087f73;
  --teal-soft: #e5f7f4;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #188753;
  --green-soft: #e8f7ef;
  --amber: #b76a00;
  --amber-soft: #fff4db;
  --red: #bf2c24;
  --red-soft: #fff0ef;
  --violet: #6d5dfc;
  --violet-soft: #f0efff;
  --shadow: 0 22px 60px rgba(20, 33, 61, 0.1);
  --shadow-soft: 0 10px 28px rgba(20, 33, 61, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(8, 127, 115, 0.12), transparent 340px),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 42%, #f9fbfd 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.topbar {
  align-items: center;
  background: linear-gradient(90deg, #071926 0%, #0b3b47 48%, #0a655c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 52px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand div {
  display: grid;
  gap: 2px;
}

.brand strong {
  color: #ffffff;
  font-size: 16px;
}

.brand span,
.environment,
.eyebrow,
.uploader-head span,
.kpis span,
.meta-label {
  color: var(--muted);
  font-size: 13px;
}

.topbar .brand span {
  color: #bad0dc;
}

.mark {
  align-items: center;
  background: linear-gradient(135deg, #0b5a6a 0%, var(--teal) 100%);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(8, 127, 115, 0.22);
  color: white;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.environment {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #9ff0e5;
  font-weight: 800;
  padding: 7px 11px;
}

.layout {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1840px;
  padding: 18px clamp(10px, 1.8vw, 28px) 34px;
}

.hero {
  align-items: stretch;
  background:
    linear-gradient(120deg, rgba(8, 24, 42, 0.98) 0%, rgba(10, 86, 92, 0.96) 58%, rgba(38, 76, 158, 0.94) 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: white;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 300px;
  overflow: hidden;
  padding: clamp(24px, 4vw, 42px);
  position: relative;
}

.hero::after {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  inset: 0;
  opacity: 0.22;
  pointer-events: none;
  position: absolute;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 60px);
  letter-spacing: 0;
  line-height: 1.02;
  margin: 0;
  max-width: 820px;
}

.hero p {
  color: #dbe9f2;
  font-size: 17px;
  line-height: 1.55;
  margin: 16px 0 0;
  max-width: 780px;
}

.eyebrow {
  color: #73ded1;
  font-weight: 800;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.hero-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-signals span {
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #eef8ff;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 11px;
}

.hero-card {
  align-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 22px;
}

.hero-kicker {
  color: #aee9e1;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-number {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
}

.hero-mini-grid {
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  gap: 5px 12px;
  grid-template-columns: auto 1fr;
  margin-top: 18px;
  padding-top: 16px;
  width: 100%;
}

.hero-mini-grid span {
  color: #b9d7e5;
  font-size: 12px;
}

.hero-mini-grid strong {
  font-size: 12px;
  text-align: right;
}

.workspace {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr);
}

.uploader,
.results > section,
.document-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.uploader {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  position: sticky;
  top: 82px;
}

.uploader-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.uploader-head span {
  background: #eefaf8;
  border: 1px solid #c3e9e2;
  border-radius: 999px;
  color: var(--teal);
  font-weight: 800;
  padding: 6px 10px;
}

h2,
h3,
p {
  margin: 0;
}

.uploader h2 {
  font-size: 22px;
}

.dropzone {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(8, 127, 115, 0.08), rgba(37, 99, 235, 0.05));
  border: 2px dashed #a8bbcf;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.batch-table label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  text-transform: uppercase;
}

.batch-table select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 10px 11px;
  text-transform: none;
}

.progress-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.progress-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-panel div {
  background: #dce8f4;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.progress-panel i {
  background: linear-gradient(90deg, var(--teal), var(--blue));
  display: block;
  height: 100%;
  width: 0;
}

.dropzone:hover {
  border-color: var(--teal);
  box-shadow: 0 16px 34px rgba(8, 127, 115, 0.12);
  transform: translateY(-1px);
}

.dropzone input {
  display: none;
}

.dropzone span,
.dian-box p,
.workflow-box li {
  color: var(--muted);
  line-height: 1.45;
}

.drop-icon {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  color: var(--teal);
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 54px;
  justify-content: center;
  justify-self: center;
  letter-spacing: 0;
  width: 64px;
}

.actions,
.report-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.button-link {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 11px 14px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

button.primary,
.button-link.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

button:hover,
.button-link:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.dian-box {
  background: linear-gradient(180deg, var(--blue-soft), #f7faff);
  border: 1px solid #c9dcff;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 13px;
}

.dian-box code {
  overflow-wrap: anywhere;
}

.workflow-box {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 13px;
}

.workflow-box span {
  color: var(--ink);
  font-weight: 850;
}

.workflow-box ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 19px;
}

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

.manual-cufe label {
  font-weight: 800;
}

.manual-cufe textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: 13px Consolas, "Courier New", monospace;
  min-height: 104px;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.manual-cufe textarea:focus {
  border-color: var(--teal);
  outline: 3px solid var(--teal-soft);
}

.cufe-meter {
  display: grid;
  gap: 5px;
}

.cufe-meter span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cufe-meter .ok,
.cufe-limit.ok {
  color: var(--green);
}

.cufe-meter .error,
.cufe-limit.error {
  color: var(--red);
}

.manual-cufe button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.results {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.kpis {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
}

.kpis article {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
}

.kpis article:last-child {
  border-right: 0;
}

.kpis strong {
  color: var(--ink);
  font-size: clamp(24px, 1.8vw, 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpis article:last-child strong {
  font-size: clamp(20px, 1.45vw, 28px);
  white-space: nowrap;
}

.evidence-panel {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
}

.evidence-panel article {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
}

.evidence-panel article:last-child {
  border-right: 0;
}

.evidence-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-panel strong {
  color: var(--ink);
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-actions {
  align-items: center;
  background:
    linear-gradient(135deg, #ffffff 0%, #f6fbff 60%, #edf8f6 100%);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px;
}

.report-actions h2 {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.05;
}

.report-actions p:last-child {
  color: var(--muted);
  margin-top: 6px;
}

.report-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.report-buttons button {
  background: #071926;
  border-color: #071926;
  color: #ffffff;
}

.section-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 18px;
}

.section-head h2 {
  font-size: 24px;
}

.batch-table {
  overflow: hidden;
}

.table-wrap {
  max-height: calc(100vh - 355px);
  min-height: 430px;
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 1180px;
  width: 100%;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fbfd;
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
}

td {
  color: var(--ink-2);
  font-size: 14px;
}

body.has-report .layout {
  max-width: none;
}

body.has-report .workspace {
  grid-template-columns: 285px minmax(0, 1fr);
}

body.has-report .uploader {
  padding: 14px;
}

body.has-report .dropzone {
  min-height: 118px;
  padding: 15px;
}

body.has-report .drop-icon {
  height: 42px;
  width: 52px;
}

body.has-report .workflow-box,
body.has-report .manual-cufe {
  display: none;
}

body.has-report .dian-box p {
  font-size: 13px;
}

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

td code {
  color: #0d5060;
  font-size: 12px;
}

td a {
  color: var(--teal);
  font-weight: 800;
}

.empty {
  align-items: center;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 220px;
  min-height: 300px;
  overflow: hidden;
  padding: 34px;
  position: relative;
}

.empty p {
  color: var(--muted);
  margin-top: 6px;
}

.empty h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  max-width: 650px;
}

.empty-preview {
  background: linear-gradient(135deg, #ffffff, #edf7fb);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.empty-preview span {
  background: linear-gradient(90deg, #dce8f4, #f8fbfd);
  border-radius: 8px;
  display: block;
  height: 46px;
}

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

.document-card {
  overflow: hidden;
}

.card-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  background:
    linear-gradient(90deg, #ffffff 0%, #f8fbff 100%);
  padding: 22px 22px 22px 26px;
  position: relative;
}

.card-header::before {
  background: linear-gradient(180deg, var(--teal), var(--blue));
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: 5px;
}

.card-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.card-title strong {
  color: var(--ink);
  font-size: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  white-space: nowrap;
}

.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.error {
  background: var(--red-soft);
  color: var(--red);
}

.card-status {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.score-ring {
  align-items: baseline;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  gap: 1px;
  justify-content: center;
  min-width: 68px;
  padding: 7px 10px;
}

.score-ring small {
  font-size: 11px;
}

.score-ring.ok {
  background: var(--green-soft);
  border-color: #bfe8d2;
  color: var(--green);
}

.score-ring.warning {
  background: var(--amber-soft);
  border-color: #f0d18f;
  color: var(--amber);
}

.score-ring.error {
  background: var(--red-soft);
  border-color: #f3c2bd;
  color: var(--red);
}

.card-body {
  display: grid;
  gap: 20px;
  padding: 20px;
}

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

.insight {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.insight span {
  color: var(--muted);
  font-size: 12px;
}

.insight strong {
  color: var(--ink);
  font-size: 18px;
}

.insight.ok {
  border-color: #cbeedd;
}

.insight.warning {
  border-color: #f0d18f;
}

.insight.error {
  border-color: #f3c2bd;
}

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

.meta-item {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  padding: 12px;
}

.meta-grid .meta-item:nth-child(1),
.meta-grid .meta-item:nth-child(2) {
  grid-column: span 2;
}

.meta-item strong {
  display: block;
  margin-top: 5px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  white-space: normal;
}

.cufe-box {
  background:
    linear-gradient(180deg, #f8fafc, #ffffff);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  display: grid;
  gap: 9px;
  padding: 14px;
}

.cufe-value {
  color: #0d5060;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cufe-limit {
  font-size: 14px;
  font-weight: 800;
}

.fiscal-note {
  background: linear-gradient(90deg, var(--teal-soft), #f4fbff);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  color: var(--ink-2);
  line-height: 1.45;
  padding: 14px;
}

.checks-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.checks-list li {
  align-items: stretch;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 40px minmax(0, 1fr);
  min-height: 118px;
  padding: 14px;
}

.checks-list li.ok {
  background: linear-gradient(90deg, var(--green-soft), #ffffff);
}

.checks-list li.warning {
  background: linear-gradient(90deg, var(--amber-soft), #ffffff);
}

.checks-list li.error {
  background: linear-gradient(90deg, var(--red-soft), #ffffff);
}

.check-icon {
  align-items: center;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  line-height: 1;
  margin-top: 2px;
  width: 38px;
}

.ok .check-icon {
  background: var(--green);
}

.warning .check-icon {
  background: var(--amber);
}

.error .check-icon {
  background: var(--red);
}

.checks-list span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  line-height: 1.4;
  margin-top: 5px;
}

.check-basis {
  color: #3f5872;
  display: block;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 8px;
}

.checks-list code {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin-top: 8px;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .uploader {
    position: static;
  }

  .kpis,
  .evidence-panel,
  .document-insight,
  .checks-list,
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid .meta-item:nth-child(1),
  .meta-grid .meta-item:nth-child(2) {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .topbar,
  .card-header,
  .report-actions {
    align-items: start;
    display: grid;
  }

  .kpis,
  .evidence-panel,
  .document-insight,
  .checks-list,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid .meta-item:nth-child(1),
  .meta-grid .meta-item:nth-child(2) {
    grid-column: span 1;
  }

  .kpis article,
  .evidence-panel article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }
}

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

  .topbar,
  .uploader,
  .report-buttons {
    display: none !important;
  }

  .layout {
    max-width: none;
    padding: 0;
  }

  .workspace {
    display: block;
  }

  .results {
    gap: 12px;
  }

  .document-card,
  .results > section {
    box-shadow: none;
    break-inside: avoid;
  }

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