:root {
  --primary: #003d64;
  --primary-2: #005b92;
  --accent: #f07800;
  --success: #008c78;
  --danger: #ba1a1a;
  --warning: #c76500;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-blue: #eff4ff;
  --line: #d7e0ee;
  --line-strong: #b9c7da;
  --text: #0b1c30;
  --muted: #53627a;
  --shadow: 0 8px 24px rgba(0, 61, 100, 0.08);
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--primary-2);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #004a78 0%, #003d64 100%);
  color: #fff;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 210px;
  max-width: 100%;
  height: auto;
}

.brand.horizontal img {
  width: 240px;
}

.side-nav {
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  padding-top: 22px;
  display: grid;
  gap: 8px;
}

.side-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.82);
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 600;
}

.side-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.side-link.disabled {
  opacity: 0.72;
}

.side-link em {
  font-weight: 400;
}

.nav-icon,
.info-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  padding-top: 20px;
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.86);
}

.sidebar-foot span {
  font-size: 13px;
}

.main-area {
  padding: 30px 28px 40px;
}

.page-header {
  min-height: 86px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: -30px -28px 24px;
  padding: 30px 36px 20px;
  background: rgba(255, 255, 255, 0.76);
}

h1,
h2 {
  font-family: Montserrat, Inter, sans-serif;
  margin: 0;
  letter-spacing: 0;
}

.page-header h1 {
  font-size: 28px;
  line-height: 36px;
}

.page-header p,
.upload-card p,
.validation-panel p,
.step small {
  color: var(--muted);
  margin: 4px 0 0;
}

.session-box,
.session-banner,
.alert,
.requirements,
.what-happens {
  border: 1px solid var(--line);
  background: var(--surface-blue);
  border-radius: 8px;
}

.session-box {
  min-width: 330px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: var(--primary);
}

.session-box span,
.session-banner span:last-child {
  font-size: 13px;
}

.alert {
  padding: 12px 14px;
  margin-bottom: 18px;
}

.alert.error {
  color: var(--danger);
  background: #fff4f2;
  border-color: #ffd0ca;
}

.upload-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
}

.upload-panel,
.validation-panel,
.table-panel,
.pdf-panel,
.empty-results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.upload-panel {
  overflow: hidden;
}

.stepper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 28px;
  color: var(--muted);
}

.step span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #9aa8ba;
  font-weight: 700;
}

.step.active span {
  background: var(--primary-2);
}

.step strong,
.upload-card h2,
.validation-panel h2 {
  color: var(--text);
}

.drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 28px;
}

.upload-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  display: grid;
  gap: 18px;
}

.file-heading {
  display: flex;
  gap: 14px;
  align-items: center;
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.file-icon.excel {
  background: #0f8f53;
  font-size: 24px;
}

.file-icon.pdf {
  background: #de1717;
  font-size: 12px;
}

.upload-card h2 {
  font-size: 18px;
  line-height: 24px;
}

.drop-zone {
  min-height: 170px;
  border: 2px dashed #a8bdd6;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--primary-2);
  cursor: pointer;
  text-align: center;
  background: #fbfdff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-card.dragging .drop-zone {
  border-color: var(--accent);
  background: #fff8f0;
}

.upload-glyph {
  width: 56px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 42px;
  line-height: 1;
}

.selected-file {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.selected-file.ready::before {
  content: "✓";
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--success);
  border-radius: 50%;
  margin-right: 10px;
}

.file-meta {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.file-meta strong {
  word-break: break-word;
}

.file-meta span,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.requirements {
  margin: 0 28px 24px;
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
}

.requirements span::before {
  content: "✓";
  color: var(--success);
  margin-right: 8px;
}

.form-error {
  margin: 0 28px 18px;
  color: var(--danger);
  font-weight: 600;
}

.actions {
  border-top: 1px solid var(--line);
  padding: 18px 28px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.secondary {
  color: var(--primary);
  background: #fff;
  border-color: var(--line-strong);
}

.validation-panel {
  padding: 24px;
  align-self: start;
}

.validation-panel h2 {
  font-size: 18px;
}

.validation-list {
  list-style: none;
  padding: 16px 0 8px;
  margin: 0;
  display: grid;
  gap: 18px;
}

.validation-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.validation-list li span {
  width: 30px;
  height: 30px;
  border: 2px solid #9aa8ba;
  border-radius: 50%;
}

.validation-list li.ready span {
  border-color: var(--success);
  background: radial-gradient(circle at center, var(--success) 40%, transparent 43%);
}

.validation-list small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  grid-column: 2;
}

.validation-list strong {
  grid-column: 2;
  grid-row: 1;
}

.what-happens {
  margin-top: 12px;
  padding: 14px;
  display: grid;
  gap: 8px;
  color: var(--primary);
}

.what-happens span {
  font-size: 13px;
}

.processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(248, 249, 255, 0.92);
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.processing-card {
  width: min(560px, 90vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.spinner {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border: 8px solid #e8edf5;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.process-steps {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.process-steps span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.results-shell {
  min-height: 100vh;
  padding: 0 24px 24px;
}

.results-header {
  min-height: 92px;
  margin: 0 -24px 20px;
  background: linear-gradient(90deg, #003d64, #005b92);
  display: grid;
  grid-template-columns: 280px minmax(240px, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 0 24px;
}

.session-banner {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(118px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.kpi {
  min-height: 110px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: #fff;
  color: inherit;
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: left;
  font: inherit;
}

.kpi:last-child {
  border-right: 0;
}

.kpi:disabled {
  cursor: default;
}

.kpi:not(:disabled):hover,
.kpi.active {
  background: #eef6ff;
}

.kpi.active {
  box-shadow: inset 0 -3px 0 var(--primary-2);
}

.kpi span,
.kpi small {
  color: var(--muted);
}

.kpi strong {
  font-family: Montserrat, Inter, sans-serif;
  font-size: 30px;
  line-height: 36px;
}

.kpi.success strong {
  color: var(--success);
}

.kpi.danger strong {
  color: var(--danger);
}

.kpi.warning strong {
  color: var(--warning);
}

.kpi.compliance strong {
  color: var(--success);
}

.kpi.cost strong,
.kpi.time strong {
  color: var(--primary);
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 0.86fr);
  gap: 0;
  align-items: start;
}

.table-panel {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  overflow: hidden;
}

.pdf-panel {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
  overflow: hidden;
}

.table-toolbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar h1 {
  font-size: 20px;
  line-height: 28px;
}

.table-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.table-toolbar input {
  width: min(320px, 42vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 310px);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table th,
.results-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  font-size: 12px;
}

.results-table tbody tr {
  cursor: pointer;
}

.results-table tbody tr:hover,
.results-table tbody tr.selected {
  background: #eef6ff;
}

.table-empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.status {
  display: inline-flex;
  border-radius: 6px;
  padding: 5px 8px;
  font-weight: 700;
}

.status.success {
  color: #00705f;
  background: #d9f2ec;
}

.status.danger {
  color: #b00016;
  background: #ffe0e0;
}

.status.warning {
  color: #c05a00;
  background: #fff0d6;
}

.status.neutral {
  color: #425166;
  background: #e7ecf3;
}

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

.pdf-toolbar {
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
}

.pdf-toolbar a {
  color: #fff;
  font-weight: 700;
}

.pdf-panel iframe {
  width: 100%;
  height: min(560px, calc(100vh - 330px));
  border: 0;
  background: #263442;
}

.row-detail {
  border-top: 1px solid var(--line);
  padding: 16px;
  background: #fff;
}

.row-detail h2 {
  font-size: 17px;
  line-height: 24px;
  margin-bottom: 12px;
}

.row-detail dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.row-detail dt {
  font-weight: 700;
  color: var(--primary);
}

.row-detail dd {
  margin: 4px 0 0;
  color: var(--text);
}

.empty-results {
  max-width: 760px;
  margin: 72px auto;
  padding: 32px;
  text-align: center;
}

.empty-results h1 {
  font-size: 26px;
  margin-bottom: 8px;
}

.empty-results p {
  color: var(--muted);
  margin: 0 0 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
  }

  .side-nav,
  .sidebar-foot {
    display: none;
  }

  .brand img {
    width: 190px;
  }

  .upload-layout,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .pdf-panel,
  .table-panel {
    border-radius: 10px;
    border: 1px solid var(--line);
  }

  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .main-area,
  .results-shell {
    padding: 16px;
  }

  .page-header {
    margin: -16px -16px 16px;
    padding: 20px 16px;
    display: grid;
  }

  .session-box {
    min-width: 0;
  }

  .drop-grid,
  .stepper,
  .kpi-strip,
  .results-header,
  .row-detail dl {
    grid-template-columns: 1fr;
  }

  .drop-grid {
    padding: 16px;
  }

  .requirements {
    margin: 0 16px 16px;
  }

  .actions {
    padding: 16px;
    flex-direction: column-reverse;
  }

  .button {
    width: 100%;
  }

  .results-header {
    margin: -16px -16px 16px;
    padding: 16px;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar input {
    width: 100%;
  }
}
