:root {
  color-scheme: light;
  --orange: #f26621;
  --orange-dark: #f26621;
  --ink: #1d1d1f;
  --muted: #65656d;
  --line: #dedee3;
  --paper: #ffffff;
  --wash: #f5f7fa;
  --green: #147d47;
  --red: #d71920;
  --blue: #174ea6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Avenir, "Avenir Next", Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #fff4ec 0%, #f5f7fa 34%, #eef4f7 100%);
  color: var(--ink);
  overflow-x: hidden;
}

body.login-mode {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

body.login-mode .shell,
body.login-mode .footer-credit {
  display: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  align-items: start;
  gap: 18px;
}

.footer-credit {
  width: min(1120px, calc(100% - 32px));
  margin: -14px auto 20px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.tracker,
.watch-list {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(36, 41, 47, 0.08);
}

.tracker {
  padding: 24px;
}

.watch-list {
  padding: 20px;
}

.topbar,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange-dark);
  font-size: 0.98rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  max-width: 560px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.4rem;
}

.section-title {
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 800;
}

.logo {
  margin: 0;
  color: var(--orange);
  font-family: "Cooper Black", Cooper, Georgia, serif;
  font-size: clamp(2.6rem, 6vw, 4.7rem);
  font-weight: 900;
  line-height: 0.9;
}

.logo-image {
  display: block;
  width: min(240px, 58vw);
  height: auto;
}

.icon-button,
.primary-button,
.secondary-button,
.small-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
}

.icon-button {
  width: 35px;
  height: 35px;
  min-height: 35px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}

.settings-button {
  background: white;
  border: 1px solid var(--orange);
  color: var(--muted);
  font-size: 0.93rem;
}

.settings-button span {
  color: currentColor;
}

.settings-button:hover,
.settings-button:active,
.settings-button:focus-visible {
  color: var(--orange);
  outline: none;
}

#signOutButton span {
  transform: translateY(2px);
}

.account-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-greeting {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.account-greeting > span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.account-greeting .easy-day {
  color: var(--orange);
  font-weight: 400;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

.segmented span {
  display: grid;
  place-items: center;
  min-height: 44px;
  background: #f7f7f8;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--orange);
  color: white;
}

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

label {
  display: grid;
  gap: 7px;
}

label > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

select:focus,
input:focus {
  border-color: var(--orange);
  outline: 3px solid rgba(242, 102, 33, 0.16);
}

.is-hidden {
  display: none !important;
}

.primary-button {
  background: var(--orange);
  color: white;
  font-weight: 800;
  padding: 0 18px;
}

.secondary-button,
.small-button {
  background: var(--orange);
  color: white;
  padding: 0 14px;
  font-weight: 800;
}

.secondary-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.small-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.route .small-button {
  background: #eef0f3;
  color: var(--muted);
}

.action-row {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(180px, 1fr);
  align-items: end;
  gap: 14px;
}

.action-row .primary-button {
  width: 100%;
}

.search-panel {
  padding: 4px 0;
  display: block;
}

.search-panel .secondary-button {
  width: 100%;
  min-height: 42px;
}

.search-copy h2 {
  font-size: 1.15rem;
}

.results {
  display: grid;
  gap: 14px;
}

.result-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.result-summary span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.result-columns h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.flight-option {
  width: 100%;
  min-height: 66px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.flight-option:hover,
.flight-option.selected {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 102, 33, 0.14);
}

.flight-option strong,
.flight-option small {
  display: block;
}

.flight-option small {
  color: var(--muted);
  margin-top: 3px;
}

.cards {
  display: grid;
  gap: 12px;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.empty-state.compact {
  min-height: 88px;
}

.card {
  border: 1px solid var(--orange);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

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

.watch-legs {
  flex: 1;
  display: grid;
  gap: 12px;
}

.watch-leg {
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.route strong {
  display: block;
  font-size: 1.05rem;
}

.watch-leg small,
.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.watch-leg-price {
  text-align: right;
  white-space: nowrap;
}

.remove-icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
}

.remove-icon-button:hover,
.remove-icon-button:focus-visible {
  background: #e3e7eb;
  color: var(--ink);
}

.meta-lines {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.watch-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.watch-email-toggle,
.toggle-row {
  display: grid;
  grid-template-columns: max-content 46px;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.watch-email-toggle {
  min-width: 150px;
}

.watch-email-toggle > span:first-child,
.toggle-row > span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
}

.toggle-button {
  width: 46px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d8dde3;
  position: relative;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.toggle-button::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}

.toggle-button.is-on {
  background: var(--orange);
}

.toggle-button.is-on::after {
  transform: translateX(20px);
}

.toggle-button:focus-visible {
  outline: 3px solid rgba(242, 102, 33, 0.16);
  outline-offset: 2px;
}

.toggle-ui {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d8dde3;
  position: relative;
  cursor: pointer;
  transition: background 160ms ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-ui {
  background: var(--orange);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(20px);
}

.history-block {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.price {
  font-size: 1.8rem;
  font-weight: 800;
}

.watch-status {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.watch-status small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.96rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.up {
  background: #fff0ee;
  color: var(--red);
}

.badge.down {
  background: #eaf7ef;
  color: var(--green);
}

.badge.flat {
  background: #eef3ff;
  color: var(--blue);
}

.history {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.history li {
  margin-bottom: 10px;
}

.history-row,
.history small {
  display: block;
}

.history-row {
  display: grid;
  grid-template-columns: 166px 70px;
  align-items: baseline;
  column-gap: 12px;
  width: max-content;
  max-width: 100%;
}

.watch-card-footer {
  display: flex;
  justify-content: flex-end;
}

.history-leg-row {
  margin-top: 2px;
}

.history-row > strong {
  color: var(--ink);
  font-weight: 800;
}

.history-change {
  text-align: right;
  white-space: nowrap;
}

.history small {
  color: var(--muted);
  font-size: inherit;
  font-weight: 400;
}

.inline-change {
  font-weight: 800;
}

.inline-change.up {
  color: #d71920;
}

.inline-change.down {
  color: #42a66a;
}

.watchlist-add {
  display: grid;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100% - 36px));
  transform: translateY(120%);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  background: var(--orange);
  color: white;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 29, 31, 0.34);
  overflow: hidden;
}

body.login-mode .modal-backdrop {
  position: static;
  inset: auto;
  width: min(520px, calc(100% - 32px));
  padding: 0;
  background: transparent;
  overflow: visible;
}

.modal-backdrop.is-hidden {
  display: none;
}

.settings-modal {
  position: relative;
  z-index: 2;
  width: min(460px, 100%);
  border-radius: 8px;
  background: white;
  border: 1px solid rgba(222, 222, 227, 0.82);
  box-shadow:
    0 2px 6px rgba(29, 29, 31, 0.04),
    0 18px 44px rgba(29, 29, 31, 0.12),
    0 36px 90px rgba(29, 29, 31, 0.08);
  padding: 20px;
}

.confetti-burst {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.confetti-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: confetti-pop 1200ms cubic-bezier(0.14, 0.74, 0.2, 1) var(--delay) forwards;
}

@keyframes confetti-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--r));
  }
}

.welcome-message {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.welcome-back-message {
  display: grid;
  gap: 14px;
  margin-bottom: 0;
  text-align: center;
  justify-items: center;
}

.welcome-back-message h2 {
  margin: 0;
  color: var(--orange);
  font-size: 1.35rem;
}

.welcome-back-message p {
  margin: 0;
  color: var(--muted);
}

.welcome-message h2 {
  color: var(--orange);
}

.welcome-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.welcome-title span {
  color: var(--ink);
}

.welcome-title img {
  width: min(150px, 48vw);
  height: auto;
}

.welcome-message p {
  margin: 0;
  color: var(--muted);
}

.modal-subheading {
  color: var(--ink);
  margin-bottom: 0;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-form {
  display: grid;
  gap: 20px;
}

.settings-section {
  display: grid;
  gap: 12px;
}

.settings-section-intro {
  display: grid;
  gap: 4px;
}

.settings-subheading {
  margin: 0;
  color: var(--orange);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}

.settings-help {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.settings-form .toggle-row {
  grid-template-columns: minmax(0, 1fr) 46px;
  justify-content: start;
}

.settings-form .toggle-row > span:first-child {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
}

.confirm-modal {
  display: grid;
  gap: 14px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

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

.confirm-actions .primary-button,
.confirm-actions .small-button {
  width: 100%;
}

.neutral-button {
  background: #eef0f3;
  color: var(--muted);
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .tracker,
  .watch-list {
    padding: 16px;
  }

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

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

  .action-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading,
  .search-panel,
  .result-summary,
  .route,
  .watch-alert-row,
  .price-row,
  .watch-leg {
    align-items: stretch;
    flex-direction: column;
  }

  .watch-leg-price {
    text-align: left;
  }
}
