:root {
  --green-950: #0a4a43;
  --green-900: #0b5a50;
  --green-800: #0c6a5e;
  --green-700: #0f7f70;
  --green-100: #dff0ec;
  --green-50: #f1f8f6;

  --ink-950: #111816;
  --ink-800: #28332f;
  --ink-600: #5e6b66;
  --ink-500: #7a8681;
  --ink-400: #a0aaa6;

  --page: #f4f7f6;
  --surface: #ffffff;
  --side: #f1f4f3;
  --line: #dce4e1;
  --line-strong: #c8d2ce;

  --success: #087647;
  --success-soft: #eef9f2;
  --success-line: #b9e4c9;

  --danger: #b42318;
  --danger-soft: #fff3f2;
  --danger-line: #f4c9c5;

  --info: #185a9d;
  --info-soft: #f0f7fd;
  --info-line: #c9dff0;

  --warning: #9a5b13;

  --purple: #6d5bd0;
  --blue: #2d72d2;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 9px 12px;
  border-radius: 6px;
  color: white;
  background: var(--green-800);
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

/* FULL PAGE FRAME */
.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 28%) minmax(0, 72%);
  background: var(--surface);
}

/* LEFT */
.side-panel {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 28px 26px 24px;
  border-right: 1px solid var(--line);
  background: var(--side);
}

.side-top,
.side-bottom {
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.logo-wrap {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  box-shadow: var(--shadow);
}

.logo-wrap img,
.mobile-logo-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  background: white;
}

.logo-fallback {
  color: var(--green-800);
  font-size: 13px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-copy strong {
  font-size: 12px;
  letter-spacing: .035em;
}

.brand-copy span {
  color: var(--ink-500);
  font-size: 10.5px;
}

/* subtle visual inspired by reference, not copied */
.side-visual {
  position: relative;
  height: 245px;
  margin: 34px -26px 0;
  overflow: hidden;
  pointer-events: none;
}

.orbit {
  position: absolute;
  border: 1px solid #cdd8d3;
  border-radius: 50%;
}

.orbit-1 {
  width: 210px;
  height: 210px;
  right: -112px;
  top: 8px;
}

.orbit-2 {
  width: 150px;
  height: 150px;
  right: -78px;
  top: 38px;
}

.orbit-3 {
  width: 86px;
  height: 86px;
  right: -45px;
  top: 70px;
}

.orbit-dot {
  position: absolute;
  width: 27px;
  height: 27px;
  border: 4px solid var(--side);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.dot-1 {
  right: 99px;
  top: 32px;
  background: var(--green-700);
}

.dot-2 {
  right: 57px;
  top: 116px;
  background: var(--purple);
}

.dot-3 {
  right: 136px;
  top: 151px;
  background: var(--blue);
}

.progress-label {
  margin: 0 0 12px;
  color: var(--ink-500);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.progress-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  list-style: none;
}

.progress-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 9px 9px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  opacity: .54;
  transition: opacity .18s ease, background .18s ease, border-color .18s ease;
}

.progress-item.is-active {
  opacity: 1;
  border-color: var(--line);
  background: white;
}

.progress-item.is-complete {
  opacity: .85;
}

.progress-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1.5px solid #aebbb5;
  border-radius: 50%;
  color: transparent;
  font-size: 10px;
  font-weight: 900;
}

.progress-item.is-active .progress-icon {
  border-color: var(--green-700);
  box-shadow: inset 0 0 0 4px white;
  background: var(--green-700);
}

.progress-item.is-complete .progress-icon {
  border-color: var(--green-700);
  color: white;
  background: var(--green-700);
}

.progress-item strong {
  display: block;
  margin-bottom: 1px;
  color: var(--ink-800);
  font-size: 11px;
}

.progress-item > div > span {
  display: block;
  color: var(--ink-500);
  font-size: 9.5px;
  line-height: 1.35;
}

.side-footer {
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 9.5px;
}

/* RIGHT WORKSPACE */
.workspace {
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: white;
}

.workspace-topbar {
  min-height: 60px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid transparent;
}

.mobile-brand,
.mobile-progress {
  display: none;
}

.workspace-body {
  flex: 1 0 auto;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 62px 54px 56px;
}

.view {
  width: min(100%, 620px);
}

.view-heading,
.record-heading {
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-700);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.view-heading h1,
.record-heading h1,
.view-done h1 {
  margin: 0 0 8px;
  font-size: clamp(29px, 3.5vw, 38px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.view-heading > p:last-child,
.record-nis,
.done-copy {
  margin: 0;
  color: var(--ink-600);
  font-size: 13.5px;
}

.search-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink-800);
  font-size: 12.5px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  color: var(--ink-950);
  background: white;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input {
  min-height: 48px;
  padding: 11px 13px;
}

textarea {
  min-height: 145px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-400);
}

input:hover:not(:read-only),
textarea:hover {
  border-color: #9eaaa5;
}

input:focus,
textarea:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(15, 127, 112, .11);
}

input:read-only {
  color: var(--ink-600);
  background: #f5f7f6;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #e34b40;
  box-shadow: 0 0 0 3px rgba(227, 75, 64, .08);
}

.hint {
  margin: 0;
  color: var(--ink-500);
  font-size: 10.5px;
}

.button {
  width: fit-content;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.button:focus-visible,
.back-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 127, 112, .13);
}

.button-primary {
  color: white;
  background: var(--green-700);
  border-color: var(--green-700);
}

.button-primary:hover:not(:disabled) {
  background: var(--green-800);
  border-color: var(--green-800);
}

.button-secondary {
  color: var(--ink-800);
  background: white;
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled) {
  background: #f8faf9;
}

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.button.is-loading .button-spinner {
  display: inline-block;
}

.feedback {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
}

.feedback[data-tone="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.feedback[data-tone="success"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.feedback[data-tone="info"] {
  color: var(--info);
  background: var(--info-soft);
  border-color: var(--info-line);
}

/* STEP 2 */
.view-nav {
  min-height: 31px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  padding: 3px 0;
  border: 0;
  border-radius: 4px;
  color: var(--green-700);
  background: transparent;
  font-size: 11.5px;
  font-weight: 800;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 10.5px;
  font-weight: 800;
}

.verified-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.student-form {
  display: grid;
  gap: 17px;
}

.address-hint {
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  border-left: 3px solid #a4d7ce;
  background: #f7fbfa;
  color: var(--ink-600);
  font-size: 10px;
  line-height: 1.45;
}

.address-hint strong {
  color: var(--ink-800);
}

.form-footer {
  margin-top: 6px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.change-info {
  margin: 0;
  color: var(--ink-500);
  font-size: 10.5px;
}

.change-info.is-dirty {
  color: var(--warning);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-notice {
  margin-bottom: 22px;
  padding: 12px 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--success-line);
  border-radius: 7px;
  color: var(--success);
  background: var(--success-soft);
}

.saved-check {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--success);
  font-size: 10px;
  font-weight: 900;
}

.saved-notice strong {
  display: block;
  margin-bottom: 1px;
  font-size: 11.5px;
}

.saved-notice p {
  margin: 0;
  color: #356a52;
  font-size: 10.5px;
}

/* STEP 3 */
.view-done {
  padding-top: 30px;
}

.done-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green-700);
  font-size: 22px;
  font-weight: 900;
}

.done-copy {
  max-width: 480px;
  margin-bottom: 28px;
}

.done-summary {
  width: min(100%, 490px);
  margin-bottom: 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.done-summary > div {
  min-height: 55px;
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 16px;
}

.done-summary > div + div {
  border-top: 1px solid var(--line);
}

.done-summary span {
  color: var(--ink-500);
  font-size: 10.5px;
}

.done-summary strong {
  color: var(--ink-800);
  font-size: 12.5px;
}

/* FOOTER */
.workspace-footer {
  padding: 16px 28px 20px;
  color: var(--ink-400);
  font-size: 9.5px;
  text-align: right;
}

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  width: min(calc(100% - 32px), 350px);
}

.toast {
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  box-shadow: 0 12px 34px rgba(16,24,40,.12);
  font-size: 11.5px;
  font-weight: 800;
}

.toast[data-tone="success"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.toast[data-tone="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

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

/* TABLET */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(245px, 30%) minmax(0, 70%);
  }

  .side-panel {
    padding: 24px 20px 20px;
  }

  .side-visual {
    margin-inline: -20px;
  }

  .workspace-body {
    padding: 48px 34px 44px;
  }
}

/* MOBILE */
@media (max-width: 720px) {
  body {
    background: white;
  }

  .app-shell {
    min-height: 100dvh;
    display: block;
  }

  .side-panel {
    display: none;
  }

  .workspace {
    min-height: 100dvh;
  }

  .workspace-topbar {
    min-height: 68px;
    padding: 10px 16px;
    justify-content: space-between;
    border-bottom-color: var(--line);
  }

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

  .mobile-logo-wrap {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
  }

  .mobile-brand > div {
    display: grid;
    gap: 1px;
  }

  .mobile-brand strong {
    font-size: 10.5px;
    letter-spacing: .035em;
  }

  .mobile-brand > div > span {
    color: var(--ink-500);
    font-size: 9.5px;
  }

  .mobile-progress {
    display: block;
    color: var(--ink-500);
    font-size: 9.5px;
    font-weight: 700;
  }

  .workspace-body {
    width: 100%;
    padding: 30px 18px 36px;
  }

  .view {
    width: 100%;
  }

  .view-heading,
  .record-heading {
    margin-bottom: 24px;
  }

  .view-heading h1,
  .record-heading h1,
  .view-done h1 {
    font-size: 27px;
  }

  .view-heading > p:last-child,
  .record-nis,
  .done-copy {
    font-size: 12.5px;
  }

  .search-form .button {
    width: 100%;
  }

  .student-form {
    gap: 16px;
  }

  .form-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 0 -18px -36px;
    padding: 11px 18px calc(11px + env(safe-area-inset-bottom));
    display: block;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(9px);
  }

  .change-info {
    margin-bottom: 8px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
  }

  .form-actions .button {
    width: 100%;
  }

  .view-done {
    padding-top: 8px;
  }

  .workspace-footer {
    display: none;
  }
}

@media (max-width: 420px) {
  .mobile-brand > div > span {
    display: none;
  }

  .view-heading h1,
  .record-heading h1,
  .view-done h1 {
    font-size: 25px;
  }

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

  .button-secondary {
    order: 2;
  }

  .done-summary > div {
    grid-template-columns: 92px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
