:root {
  --ink: #17211b;
  --muted: #657168;
  --paper: #ffffff;
  --canvas: #f4f6f1;
  --line: #dce2da;
  --green: #1d6945;
  --green-dark: #124b31;
  --green-soft: #e8f2eb;
  --gold: #e6b84b;
  --shadow: 0 18px 48px rgba(32, 53, 41, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(230, 184, 75, 0.09), transparent 26rem),
    var(--canvas);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
label[for="fileInput"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 28px;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--green);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.privacy-badge {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #cadacf;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.68);
  font-size: 0.8rem;
  font-weight: 700;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2b9a63;
  box-shadow: 0 0 0 4px rgba(43, 154, 99, 0.12);
}

.page-shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  max-width: 760px;
  padding: 64px 0 42px;
}

.eyebrow,
.step-label {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.9rem, 7vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(420px, 1.2fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 28px;
  border: 1px solid rgba(220, 226, 218, 0.9);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.panel h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.drop-zone {
  display: flex;
  min-height: 225px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border: 1.5px dashed #aebcb1;
  border-radius: 14px;
  text-align: center;
  background: #fbfcfa;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--green);
  background: var(--green-soft);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone strong {
  margin: 12px 0 3px;
}

.drop-zone span:not(.upload-icon) {
  color: var(--muted);
  font-size: 0.9rem;
}

.drop-zone small {
  margin-top: 18px;
  color: #7b877f;
}

.upload-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 13px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 1.35rem;
  font-weight: 700;
}

.import-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border: 1px solid #cfe0d3;
  border-radius: 12px;
  background: var(--green-soft);
}

.import-summary div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.import-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.success-mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white !important;
  background: var(--green);
}

.divider {
  height: 1px;
  margin: 25px 0;
  background: var(--line);
}

.section-heading {
  margin-bottom: 17px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label,
legend {
  color: #3f4b43;
  font-size: 0.8rem;
  font-weight: 750;
}

select {
  width: 100%;
  min-height: 45px;
  margin-top: 7px;
  padding: 0 38px 0 12px;
  border: 1px solid #cfd7d0;
  border-radius: 9px;
  color: var(--ink);
  background: white;
}

select:focus,
input:focus-visible,
button:focus-visible,
.drop-zone:has(input:focus-visible) {
  outline: 3px solid rgba(29, 105, 69, 0.2);
  outline-offset: 2px;
}

.optional {
  color: #849087;
  font-weight: 500;
}

.segmented-field {
  margin: 0 0 19px;
  padding: 0;
  border: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 7px;
  padding: 4px;
  border-radius: 10px;
  background: #edf0ec;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: block;
  padding: 9px 8px;
  border-radius: 7px;
  text-align: center;
  font-size: 0.76rem;
}

.segmented-control input:checked + span {
  color: var(--green-dark);
  background: white;
  box-shadow: 0 1px 4px rgba(25, 43, 32, 0.12);
}

.range-field {
  display: block;
  margin-bottom: 19px;
}

.range-label,
.range-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-label output {
  display: grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--green);
  font-size: 0.9rem;
}

input[type="range"] {
  width: 100%;
  margin: 14px 0 3px;
  accent-color: var(--green);
}

.range-scale {
  color: #849087;
  font-size: 0.7rem;
}

.field-help {
  min-height: 38px;
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-button,
.secondary-button {
  min-height: 43px;
  border-radius: 9px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--green);
  color: white;
  background: var(--green);
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid #cfd7d0;
  color: var(--ink);
  background: white;
}

.secondary-button:hover {
  background: var(--canvas);
}

.text-button {
  padding: 4px;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
}

.form-message {
  min-height: 19px;
  margin: 8px 0 0;
  color: #a03931;
  font-size: 0.78rem;
}

.result-actions {
  display: flex;
  gap: 7px;
}

.results-panel {
  min-height: 585px;
}

.empty-state {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin: 18px 0 5px;
  color: var(--ink);
  font-size: 1.05rem;
}

.empty-state p {
  font-size: 0.86rem;
}

.empty-illustration {
  display: flex;
  gap: 8px;
  align-items: end;
  height: 58px;
}

.empty-illustration span {
  display: block;
  width: 40px;
  border: 1px solid #cfd7d0;
  border-radius: 8px 8px 4px 4px;
  background: #f4f6f3;
}

.empty-illustration span:nth-child(1) {
  height: 41px;
}

.empty-illustration span:nth-child(2) {
  height: 56px;
  background: var(--green-soft);
}

.empty-illustration span:nth-child(3) {
  height: 47px;
}

.results-summary {
  margin: -5px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.group-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfdfb;
}

.group-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--green-soft);
}

.group-card h3 {
  margin: 0;
  font-size: 0.87rem;
}

.group-card header span {
  color: var(--muted);
  font-size: 0.7rem;
}

.student-list {
  margin: 0;
  padding: 7px 13px 10px 32px;
}

.student-list li {
  padding: 5px 0;
  border-bottom: 1px solid #edf0ec;
  font-size: 0.83rem;
}

.student-list li:last-child {
  border-bottom: 0;
}

.privacy-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 17px;
  max-width: 760px;
  margin: 34px auto 72px;
  padding: 22px 25px;
  border: 1px solid #d8dfd9;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.58);
}

.privacy-note > div:first-child {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--green);
  background: var(--green-soft);
}

.privacy-note h2 {
  margin-bottom: 3px;
  font-size: 0.95rem;
}

.privacy-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

footer {
  padding: 25px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 0.75rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .hero {
    padding-top: 38px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .results-panel {
    min-height: 420px;
  }

  .empty-state {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 18px 20px;
  }

  .privacy-badge {
    font-size: 0;
  }

  .privacy-badge::after {
    content: "Local only";
    font-size: 0.72rem;
  }

  .page-shell {
    width: min(100% - 24px, 1200px);
  }

  .hero {
    padding-bottom: 30px;
  }

  .panel {
    padding: 21px;
    border-radius: 14px;
  }

  .field-grid,
  .groups-grid {
    grid-template-columns: 1fr;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .site-header,
  .hero,
  .controls-panel,
  .privacy-note,
  footer,
  .result-actions {
    display: none !important;
  }

  .page-shell,
  .workspace {
    width: 100%;
    margin: 0;
  }

  .workspace {
    display: block;
  }

  .results-panel {
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

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

  .group-card {
    break-inside: avoid;
  }
}
