:root {
  --accent: #e93356;
  --accent-dark: #b81f3e;
  --ink: #202124;
  --muted: #59616d;
  --line: #dfe3ea;
  --panel: #ffffff;
  --bg: #f6f7f9;
  --subtle: #eef1f5;
  --ok: #176b47;
  --error: #a32626;
  --warning: #8a5a00;
  --font-ui: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.auth-screen {
  width: min(500px, calc(100vw - 36px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 0 54px;
}

.auth-logo {
  width: 180px;
  height: auto;
  margin-bottom: 30px;
}

.auth-screen h1 {
  font-size: 3.25rem;
  font-weight: 420;
  line-height: 1;
  text-align: center;
}

.auth-subtitle {
  width: min(500px, 100%);
  margin: 12px 0 36px;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.25;
  text-align: center;
}

.auth-form {
  width: min(420px, 100%);
  display: grid;
  gap: 13px;
}

.auth-form input {
  height: 46px;
  border-radius: 8px;
  padding: 0 15px;
  font-size: 20px;
  font-weight: 400;
}

.auth-form input::placeholder {
  color: #808590;
}

.two-factor-title {
  margin: 0 0 2px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 520;
  text-align: center;
}

.two-factor-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.two-factor-grid .two-factor-digit {
  height: 54px;
  padding: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
}

.two-factor-grid.has-error .two-factor-digit {
  border-color: var(--error);
  outline-color: rgba(163, 38, 38, 0.2);
}

.auth-form button {
  height: 48px;
  margin-top: 4px;
  border-radius: 9px;
  font-size: 22px;
  font-weight: 450;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.button-label {
  display: inline-block;
}

.slot-text {
  display: inline-flex;
  align-items: baseline;
  white-space: pre;
}

.slot-cell {
  position: relative;
  display: inline-block;
  height: 1.22em;
  min-width: 0.34em;
  overflow: hidden;
  line-height: 1.22;
  vertical-align: bottom;
}

.slot-char {
  display: block;
  animation-duration: 320ms;
  animation-delay: calc(var(--slot-index) * 24ms);
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.slot-old {
  position: absolute;
  inset: 0;
}

.slot-up .slot-old {
  animation-name: slot-old-up;
}

.slot-up .slot-new {
  animation-name: slot-new-up;
}

.slot-down .slot-old {
  animation-name: slot-old-down;
}

.slot-down .slot-new {
  animation-name: slot-new-down;
}

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

button.is-loading {
  opacity: 0.82;
  cursor: progress;
}

.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 20;
  width: min(460px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 14px 40px rgba(32, 33, 36, 0.16);
  font-size: 15px;
  line-height: 1.35;
}

.toast.ok {
  color: var(--ok);
  border-color: #b9dac9;
}

.toast.error {
  color: var(--error);
  border-color: #ecc2c2;
}

.toast.working {
  color: var(--warning);
  border-color: #ead9a7;
}

.is-authenticated .auth-screen,
.is-login .app-shell {
  display: none;
}

.app-shell {
  min-height: 100vh;
}

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

.brand img {
  width: 46px;
  height: 46px;
}

.brand strong {
  display: block;
  font-size: 19px;
}

.brand span,
.section-title p,
small {
  color: var(--muted);
}

.layout {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.sync-layout {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.has-proposals .sync-layout {
  min-height: auto;
  justify-content: flex-start;
}

.sync-progress {
  width: min(760px, 100%);
  margin: 0 auto;
  text-align: center;
}

.loading-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  max-width: 100%;
}

.loading-mark {
  width: 24px;
  height: 24px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
}

.loading-mark span {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(233, 51, 86, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-text {
  position: relative;
  min-height: 1.4em;
  margin: 0;
  color: transparent;
  background: linear-gradient(
    100deg,
    var(--muted) 0%,
    var(--muted) 38%,
    var(--accent) 47%,
    #ff8aa0 50%,
    var(--accent) 53%,
    var(--muted) 62%,
    var(--muted) 100%
  );
  background-size: 260% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 420;
  line-height: 1.35;
  letter-spacing: 0;
  animation: loading-text-light 2.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  transition: opacity 180ms ease, transform 180ms ease;
}

.loading-text.is-fading {
  opacity: 0;
  transform: translateY(6px);
}

.loading-text.is-typing::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.9em;
  margin-left: 3px;
  background: var(--accent);
  transform: translateY(0.12em);
  animation: caret-blink 0.82s step-end infinite;
}

.sync-steps {
  display: grid;
  gap: 12px;
  text-align: left;
}

.sync-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sync-step span {
  width: 14px;
  height: 14px;
  border: 2px solid #cfd3da;
  border-radius: 50%;
}

.sync-step p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.sync-step.is-working span {
  border-color: rgba(233, 51, 86, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.sync-step.is-working p {
  color: var(--ink);
}

.sync-step.is-done span {
  border-color: var(--ok);
  background: var(--ok);
  box-shadow: inset 0 0 0 3px #fff;
}

.sync-step.is-done p {
  color: var(--ok);
}

.sync-step.is-error span {
  border-color: var(--error);
  background: var(--error);
}

.sync-step.is-error p {
  color: var(--error);
}

.sync-step.is-pending span {
  background: #fff;
}

.sync-progress.is-complete {
  margin-bottom: 28px;
}

.proposals-view {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.wide {
  grid-column: 1 / -1;
}

.section-title {
  margin-bottom: 2px;
}

.section-title p {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 1.875rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.125rem;
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd3da;
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(233, 51, 86, 0.2);
  border-color: var(--accent);
}

button {
  height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 15px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

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

button:focus-visible {
  outline: 2px solid rgba(233, 51, 86, 0.28);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

button.is-loading:disabled {
  opacity: 0.82;
}

.ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.ghost:hover {
  background: #f2f3f5;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 44px;
  margin-top: 16px;
  padding: 12px 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fbfbfc;
  font-size: 14px;
}

.status.ok {
  color: var(--ok);
  border-color: #b9dac9;
  background: #f2fbf6;
}

.status.error {
  color: var(--error);
  border-color: #ecc2c2;
  background: #fff7f7;
}

.status.working {
  color: var(--warning);
  border-color: #ead9a7;
  background: #fffaf0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.proposal-list {
  display: grid;
  min-width: 0;
}

.proposal-primary,
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.proposal-primary {
  min-width: 132px;
}

.row-action {
  min-width: 96px;
  height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.proposal-select-wrap {
  display: none;
}

.proposal-review {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.proposal-nav {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding-right: 2px;
  position: sticky;
  top: 16px;
}

.proposal-nav-item {
  width: 100%;
  height: auto;
  display: grid;
  gap: 6px;
  justify-items: start;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.proposal-nav-item:hover {
  color: var(--ink);
  background: var(--subtle);
}

.proposal-nav-item:focus-visible {
  outline: 2px solid rgba(233, 51, 86, 0.28);
  outline-offset: 2px;
}

.proposal-nav-item.is-active {
  border-color: rgba(233, 51, 86, 0.28);
  background: #fff;
}

.proposal-nav-item span {
  max-width: 100%;
  font-size: 0.875rem;
  font-weight: 750;
  line-height: 1.25;
  text-wrap: pretty;
}

.nav-state {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.nav-state-synced {
  color: var(--muted);
}

.nav-pill {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.71875rem;
  line-height: 1.45;
}

.nav-pill-add {
  color: var(--ok);
  background: #edf8f2;
}

.nav-pill-remove {
  color: var(--warning);
  background: #fff3cf;
}

.proposal-list.empty {
  color: var(--muted);
  border: 1px dashed #cfd3da;
  border-radius: 8px;
  padding: 24px;
}

.proposal {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 18px 16px;
  background: #fff;
}

.proposal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.proposal h3 {
  line-height: 1.25;
  text-wrap: balance;
}

.proposal-heading {
  max-width: 70ch;
}

.proposal-heading > span {
  color: var(--muted);
  font-size: 13px;
}

.proposal-heading p {
  max-width: 62ch;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.proposal-header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

.badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.warning {
  color: var(--warning);
  background: #fff3cf;
}

.proposal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.proposal-summary span {
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: #f1f3f5;
  font-size: 13px;
  font-weight: 750;
}

.proposal-summary .summary-add {
  color: var(--ok);
  background: #edf8f2;
}

.proposal-summary .summary-remove {
  color: var(--warning);
  background: #fff3cf;
}

.proposal-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.proposal-section + .proposal-section {
  margin-top: 16px;
}

.proposal-section h4 {
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

.proposal-section p,
.section-hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.section-hint {
  margin-bottom: 8px;
}

.proposal-synced {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.proposal-synced > span {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--ok);
  background: #edf8f2;
  font-size: 16px;
  font-weight: 800;
}

.proposal-synced h4 {
  margin-bottom: 4px;
  font-size: 0.9375rem;
}

.proposal-synced p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.student-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

li small {
  display: block;
}

.student-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 0;
  border-top: 0;
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.student-row.is-applying,
.proposal.is-applying {
  opacity: 0.62;
}

.student-row + .student-row {
  border-top: 1px solid var(--line);
}

.student-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 650;
}

.student-row small {
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.remove-row {
  background: transparent;
}

.row-action.danger {
  border: 1px solid #cfb1b1;
  color: #8d2424;
  background: #fff;
}

.row-action.danger:hover {
  border-color: #b87979;
  color: #741c1c;
  background: #fff6f6;
}

.row-action.danger.is-confirming {
  border-color: var(--error);
  color: #fff;
  background: var(--error);
}

.row-action.danger.is-confirming:hover {
  border-color: #7d2222;
  background: #7d2222;
}

.apply-result {
  margin-top: 12px;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 650;
}

.apply-result.ok {
  color: var(--ok);
  background: #f2fbf6;
}

.apply-result.warning {
  color: var(--warning);
  background: #fffaf0;
}

.apply-result.error {
  color: var(--error);
  background: #fff7f7;
}

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

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

@keyframes loading-text-light {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

@keyframes slot-old-up {
  from {
    transform: translateY(0);
    opacity: 1;
  }

  to {
    transform: translateY(-105%);
    opacity: 0;
  }
}

@keyframes slot-new-up {
  from {
    transform: translateY(105%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slot-old-down {
  from {
    transform: translateY(0);
    opacity: 1;
  }

  to {
    transform: translateY(105%);
    opacity: 0;
  }
}

@keyframes slot-new-down {
  from {
    transform: translateY(-105%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button-spinner,
  .slot-char,
  .loading-mark span,
  .loading-text,
  .loading-text.is-typing::after {
    animation: none;
  }

  .loading-text {
    color: var(--muted);
    background: none;
    transition: none;
    -webkit-text-fill-color: currentColor;
  }

  .student-row,
  .proposal {
    transition: none;
  }
}

@media (forced-colors: active) {
  .loading-text {
    color: CanvasText;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

@media (max-width: 820px) {
  .auth-screen {
    width: min(420px, calc(100vw - 36px));
    justify-content: flex-start;
    padding-top: 42px;
  }

  .auth-logo {
    width: 164px;
    margin-bottom: 26px;
  }

  .auth-screen h1 {
    font-size: 2.625rem;
  }

  .auth-subtitle {
    margin-bottom: 28px;
    font-size: 1.125rem;
  }

  .auth-form input,
  .auth-form button {
    height: 48px;
    font-size: 18px;
  }

  .two-factor-grid {
    gap: 6px;
  }

  .two-factor-grid .two-factor-digit {
    height: 50px;
    font-size: 21px;
  }

  .sync-layout {
    padding: 32px 0;
  }

  .loading-line {
    gap: 10px;
  }

  .loading-text {
    font-size: 1.25rem;
    text-align: left;
  }

  .section-title {
    margin-bottom: 10px;
  }

  .proposal-select-wrap {
    display: grid;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 10;
    margin: -6px 0 2px;
    padding: 6px 0 10px;
    background: var(--bg);
  }

  .proposal-select-wrap span {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 700;
  }

  .proposal-select-wrap select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
  }

  .proposal-review {
    display: block;
  }

  .proposal-nav {
    display: none;
  }

  .proposal {
    padding: 16px;
  }

  .proposal header {
    align-items: flex-start;
    flex-direction: column;
  }

  .proposal-header-actions,
  .proposal-primary {
    width: 100%;
  }

  .proposal-heading p {
    font-size: 0.875rem;
  }

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

  .student-row {
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .row-action {
    justify-self: flex-start;
  }
}
