:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #68736d;
  --line: #dde2dd;
  --accent: #0f766e;
  --accent-strong: #0a524c;
  --gold: #d99b35;
  --rose: #ba4a5a;
  --shadow: 0 18px 50px rgba(24, 34, 30, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(217, 155, 53, 0.16), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.workspace,
.results-section,
.summary-grid > div {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(221, 226, 221, 0.9);
  box-shadow: var(--shadow);
}

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

.masthead {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #ffffff, #f2f8f6);
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.35rem;
}

.rank-visual {
  display: grid;
  grid-template-columns: repeat(6, 18px);
  align-items: end;
  gap: 8px;
  min-width: 150px;
  height: 118px;
  padding: 14px;
  border-radius: 8px;
  background: #10221f;
}

.rank-visual span {
  display: block;
  height: var(--height);
  min-height: 18px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
}

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

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

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.file-drop {
  grid-column: span 2;
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #9fb1aa;
  border-radius: 8px;
  background: #f8fbfa;
  cursor: pointer;
}

.file-drop input {
  max-width: 100%;
}

.file-drop strong {
  color: var(--ink);
  font-size: 1rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
}

.advanced-toggle {
  align-self: end;
  min-height: 44px;
  padding: 0 4px;
}

.is-hidden {
  display: none;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button[type="button"] {
  color: var(--accent-strong);
  background: #e4f2ef;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

.summary-grid > div {
  border-radius: 8px;
  padding: 18px;
}

.summary-grid span {
  display: block;
  color: var(--rose);
  font-size: 2rem;
  font-weight: 900;
}

.summary-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.results-section {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
}

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

.table-wrap {
  overflow: auto;
}

.empty {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  font-weight: 700;
}

.achievement {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff8e9;
  color: #7b4a08;
  font-weight: 900;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f8f6;
  color: #33413b;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td:nth-child(1),
td:nth-child(8),
td:nth-child(9) {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 850px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

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

  .masthead {
    display: grid;
  }

  .file-drop {
    grid-column: span 1;
  }

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