:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #65748b;
  --line: #dbe4ef;
  --strong: #003b70;
  --accent: #0066b1;
  --accent-strong: #004f8c;
  --cyan: #13a8c8;
  --green: #27a56b;
  --danger: #b93f3f;
  --warning-bg: #fff1e8;
  --ok-bg: #e8f8f0;
  --shadow: 0 18px 42px rgba(15, 55, 92, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, #eef5fb 360px, var(--bg) 100%);
  color: var(--text);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 28px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 760;
  max-width: 780px;
}

.topbar p {
  max-width: 640px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.eyebrow,
.partner-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: #e8f3fc;
  color: var(--accent);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.partner-card {
  position: relative;
  display: grid;
  min-height: 92px;
  align-content: start;
  gap: 5px;
  overflow: hidden;
  border: 1px solid #d9e8f5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 14px 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.partner-card::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  border: 10px solid rgba(0, 102, 177, 0.10);
  transform: rotate(45deg);
}

.partner-card:hover {
  border-color: #96c5ea;
  box-shadow: 0 22px 46px rgba(0, 102, 177, 0.16);
  transform: translateY(-2px);
}

.partner-card strong {
  color: var(--strong);
  font-size: 22px;
  line-height: 1.1;
}

.partner-card span:not(.partner-kicker) {
  max-width: 620px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.partner-card em {
  align-self: end;
  color: var(--accent);
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
}

.cifraved-card .partner-kicker {
  background: #eaf8f2;
  color: var(--green);
}

.cifraved-card::after {
  border-color: rgba(39, 165, 107, 0.12);
}

.workspace,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workspace {
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.panel {
  display: none;
  padding: 20px;
}

.active-panel {
  display: block;
}

.dropzone {
  display: grid;
  min-height: 210px;
  place-items: center;
  gap: 10px;
  border: 2px dashed #9fc8e8;
  border-radius: 8px;
  background: #f7fbff;
  text-align: center;
  outline: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.dropzone.dragging,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: #eaf5fd;
}

.dropzone input {
  display: none;
}

.dropzone strong {
  font-size: 22px;
}

.dropzone span,
.metric-label,
.field-label,
.settings span {
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

input[type="text"],
select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.settings {
  display: flex;
  align-items: end;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
}

.settings label {
  display: grid;
  gap: 6px;
  min-width: 132px;
}

.primary-button,
.secondary-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 18px;
  text-decoration: none;
  cursor: pointer;
}

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

.primary-button:hover,
.download-button:hover {
  border-color: var(--accent);
  background: #ffffff;
  color: var(--accent);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
}

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

.download-button.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--line);
}

.status-strip div {
  display: grid;
  gap: 4px;
  min-width: 0;
  background: var(--panel);
  padding: 14px 16px;
}

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
}

.status-strip strong {
  font-size: 21px;
  overflow-wrap: anywhere;
}

.progress-track {
  height: 7px;
  margin-bottom: 16px;
  background: #dfe5df;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 220ms ease;
}

.results {
  border-radius: 0 0 8px 8px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 22px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

th:nth-child(2),
td:nth-child(2) {
  width: auto;
}

th:nth-child(1),
td:nth-child(1) {
  width: 120px;
}

td {
  overflow-wrap: anywhere;
}

.code-cell {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: var(--ok-bg);
  color: #14784b;
}

.badge.bad {
  background: var(--warning-bg);
  color: var(--danger);
}

.empty-state {
  height: 130px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 1160px);
    padding-top: 14px;
  }

  .topbar,
  .settings,
  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .partner-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .primary-button {
    margin-left: 0;
  }

  th:nth-child(1),
  td:nth-child(1),
  th:nth-child(2),
  td:nth-child(2) {
    width: auto;
  }
}
