:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #d7deea;
  --primary: #155eef;
  --primary-dark: #0b4ccc;
  --success: #087a4b;
  --success-bg: #e8f7ef;
  --warning: #9a5b00;
  --warning-bg: #fff3d6;
  --danger: #b42318;
  --danger-bg: #feeceb;
  --shadow: 0 12px 32px rgb(31 42 68 / 8%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}

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

a {
  color: var(--primary-dark);
}

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

h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.8rem, 7vw, 2.75rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
  line-height: 1.25;
}

:focus-visible {
  outline: 3px solid #f5b700;
  outline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem max(1rem, calc((100% - 72rem) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 0.35rem;
}

nav a {
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

nav a[aria-current="page"] {
  background: #e9efff;
  color: var(--primary-dark);
}

.page {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
  padding-block: 2rem 3rem;
}

.page--centered {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.hero {
  max-width: 46rem;
  margin-bottom: 1.5rem;
}

.hero > p:last-child {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 0.3rem;
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  gap: 1rem;
}

.card {
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notification-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.install-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field-label {
  margin-bottom: 0.15rem;
}

.field-help {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.field-grid {
  display: grid;
  gap: 0.85rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 1px solid #aeb9cb;
  border-radius: 0.6rem;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  cursor: pointer;
  font-weight: 750;
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button--primary {
  background: var(--primary);
  color: #fff;
}

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

.button--secondary {
  border-color: var(--border);
  background: #fff;
  color: var(--text);
}

.button--compact {
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
}

.button--icon {
  min-height: 2.2rem;
  padding: 0.35rem 0.6rem;
}

.button--approve {
  background: var(--success);
  color: #fff;
}

.button--reject {
  border-color: #f0aaa5;
  background: #fff;
  color: var(--danger);
}

.message {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.message[data-kind="success"] {
  color: var(--success);
}

.message[data-kind="error"] {
  color: var(--danger);
}

.muted,
.request-meta {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.view-switcher {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: #f8fbff;
}

.view-switcher__button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-color: transparent;
}

.view-switcher__button[data-active="true"] {
  background: #e9efff;
  color: var(--primary-dark);
}

.view-switcher__icon {
  font-size: 1rem;
  font-weight: 800;
}

.request-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.request-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: #fbfcfe;
}

.request-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.request-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.request-details {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.request-details dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  text-transform: uppercase;
}

.request-details dd {
  margin: 0.1rem 0 0;
  white-space: pre-wrap;
}

.badge {
  flex: none;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge--pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge--approved {
  background: var(--success-bg);
  color: var(--success);
}

.badge--rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.compact-diff--driver {
  margin-top: 1rem;
}

.reorder-list {
  display: grid;
  gap: 0.65rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.reorder-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fbfcfe;
}

.reorder-item--dragging {
  opacity: 0.68;
  box-shadow: 0 0 0 2px #bfd2ff inset;
}

.reorder-item--target {
  border-color: var(--primary);
  background: #eef4ff;
}

.drag-handle {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: grab;
}

.reorder-index {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 999px;
  background: #e9efff;
  color: var(--primary-dark);
  font-weight: 800;
}

.reorder-label {
  font-weight: 650;
}

.reorder-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: end;
}

.order-preview {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fbfcfe;
}

.order-preview h3 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.order-preview__text {
  margin: 0;
  color: var(--text);
}

.diff-summary {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-weight: 650;
}

.compact-diff,
.slope-diff {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: #fbfcfe;
}

.compact-diff h4,
.slope-diff h4 {
  margin: 0 0 0.6rem;
}

.compact-diff__list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-diff__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid #dbe4f2;
  border-radius: 0.75rem;
  background: #fff;
}

.compact-diff__index,
.slope-diff__index {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
}

.compact-diff__index {
  background: #e9efff;
  color: var(--primary-dark);
}

.compact-diff__label,
.slope-diff__label {
  min-width: 0;
  font-weight: 650;
}

.compact-diff__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.compact-diff__badge--unchanged {
  background: #edf2f7;
  color: var(--muted);
}

.compact-diff__badge--up {
  background: var(--success-bg);
  color: var(--success);
}

.compact-diff__badge--down {
  background: var(--danger-bg);
  color: var(--danger);
}

.slope-diff {
  margin-top: 0.9rem;
  background:
    linear-gradient(180deg, rgb(233 239 255 / 70%), rgb(255 255 255 / 100%));
}

.slope-diff__grid {
  position: relative;
  display: grid;
  gap: 1rem;
}

.slope-diff__column {
  position: relative;
  z-index: 1;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 10px 24px rgb(23 32 51 / 8%);
}

.slope-diff__lane {
  position: relative;
  min-width: 5.25rem;
}

.slope-diff__list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.slope-diff__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0.45rem 0.1rem;
}

.slope-diff__index--old {
  background: #fce9e7;
  color: var(--danger);
}

.slope-diff__index--new {
  background: #e5f7ee;
  color: var(--success);
}

.slope-diff__index--unchanged {
  background: #edf2f7;
  color: var(--muted);
}

.slope-diff__anchor {
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 5px rgb(255 255 255 / 96%);
}

.slope-diff__anchor--old {
  color: #b2452f;
  margin-left: auto;
}

.slope-diff__anchor--new {
  color: #1f8f6a;
  margin-right: 0.15rem;
}

.slope-diff__svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.slope-diff__path-halo {
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0.16;
}

.slope-diff__path-halo--blue {
  stroke: #2b7cd3;
}

.slope-diff__path-halo--green {
  stroke: #22a447;
}

.slope-diff__path-halo--orange {
  stroke: #d98b16;
}

.slope-diff__path-halo--purple {
  stroke: #8a4ee8;
}

.slope-diff__path-halo--red {
  stroke: #d1473a;
}

.slope-diff__path-halo--teal {
  stroke: #1f9da0;
}

.slope-diff__path {
  stroke-width: 4.25;
  stroke-linecap: round;
  opacity: 1;
}

.slope-diff__path--blue {
  stroke: #2b7cd3;
}

.slope-diff__path--green {
  stroke: #22a447;
}

.slope-diff__path--orange {
  stroke: #d98b16;
}

.slope-diff__path--purple {
  stroke: #8a4ee8;
}

.slope-diff__path--red {
  stroke: #d1473a;
}

.slope-diff__path--teal {
  stroke: #1f9da0;
}

@media (min-width: 48rem) {
  .page {
    padding-block: 3.5rem 5rem;
  }

  .card {
    padding: 1.5rem;
  }

  .layout {
    grid-template-columns: minmax(18rem, 0.9fr) minmax(22rem, 1.1fr);
    align-items: start;
  }

  .notification-card {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .install-card {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .request-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid,
  .slope-diff__grid {
    grid-template-columns: minmax(0, 1fr) minmax(5rem, 7.5rem) minmax(0, 1fr);
  }
}

@media (max-width: 38rem) {
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .view-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .compact-diff__item {
    grid-template-columns: auto 1fr;
  }

  .compact-diff__badge {
    grid-column: 2;
    justify-self: start;
  }

  .slope-diff__anchor {
    width: 0.75rem;
    height: 0.75rem;
  }

  .slope-diff__lane {
    min-width: 3.5rem;
  }

  .slope-diff__path-halo {
    stroke-width: 6;
  }

  .slope-diff__path {
    stroke-width: 3;
  }
}
