:root {
  --bg: #070c16;
  --card: #0e1626;
  --card-2: #111c30;
  --border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent-2: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --purple: #a855f7;
  --slate: #64748b;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(249, 115, 22, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(59, 130, 246, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.3px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 28px 48px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card h2 {
  margin: 0;
  font-size: 16px;
}

.card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card code {
  background: rgba(249, 115, 22, 0.12);
  color: #fdba74;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 20px;
  border: 1.5px dashed #334155;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.15s;
  text-align: center;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.08);
  transform: translateY(-1px);
}

.dz-icon {
  font-size: 30px;
}

.dz-title {
  font-weight: 600;
  font-size: 14.5px;
}

.dz-sub {
  color: var(--muted);
  font-size: 12.5px;
}

.dropzone.loaded {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.btn:hover {
  border-color: #334155;
  background: #152238;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 7px 12px;
  font-size: 12.5px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #111;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
}

.btn.primary:hover {
  filter: brightness(1.07);
}

.btn.big {
  padding: 15px 26px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 22px 0;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-accent {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(245, 158, 11, 0.08));
  border-color: rgba(249, 115, 22, 0.4);
}

.kpi-label {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
}

.kpi-accent .kpi-value {
  font-size: 17px;
  line-height: 1.35;
}

.preview {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}

.table-wrap {
  overflow: auto;
  max-height: 620px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

thead th {
  position: sticky;
  top: 0;
  background: #1e3a5f;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  z-index: 1;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #1c2940;
  white-space: nowrap;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(249, 115, 22, 0.07);
}

td.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-weight: 600;
}

.curve-45 { color: var(--red); font-weight: 700; }
.curve-55 { color: #fb923c; font-weight: 700; }
.curve-65 { color: #fbbf24; font-weight: 700; }
.curve-80 { color: #a3e635; font-weight: 700; }
.curve-100 { color: var(--green); font-weight: 700; }

.status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}

.status-P { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.status-F { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.status-AM { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
.status-DSR { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }

.side-boxes {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.box h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #fdba74;
}

.box dl {
  margin: 0;
}

.box .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #24344f;
  font-size: 13px;
}

.box .row:last-child {
  border-bottom: none;
}

.box .row dt {
  color: var(--muted);
}

.box .row dd {
  margin: 0;
  font-weight: 800;
  font-size: 14px;
}

.leader-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leader-row {
  display: grid;
  grid-template-columns: 1fr 44px 54px;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
}

.leader-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-row .qtd {
  text-align: center;
  font-weight: 800;
}

.leader-row .faltas {
  text-align: center;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 8px;
}

.leader-row .faltas.ok { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.leader-row .faltas.warn { background: rgba(239, 68, 68, 0.14); color: #f87171; }

.actions {
  margin: 26px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0;
  text-align: center;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border-color: rgba(34, 197, 94, 0.4);
}

.result-icon {
  font-size: 34px;
}

.result-card h2 {
  margin: 0 0 6px;
  color: #4ade80;
}

.result-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

footer {
  text-align: center;
  padding: 20px;
  color: #475569;
  font-size: 12px;
}

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

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