:root {
  --ts-blue: #012169;
  --ts-blue-2: #1f3d86;
  --ts-yellow: #f2a900;
  --ink: #0e1b3e;
  --line: #d6ddf4;
  --bot-bubble: #eef3ff;
  --user-bubble: #f2a900;
  --user-text: #1b1400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(42rem 28rem at 8% -10%, #3f66c4 0%, transparent 65%),
    radial-gradient(30rem 20rem at 95% 8%, #ffd469 0%, transparent 62%),
    linear-gradient(165deg, #e6edff 0%, #f8fbff 48%, #fff6df 100%);
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.28;
  filter: blur(2px);
}

.shape-a {
  width: 22rem;
  height: 22rem;
  background: var(--ts-yellow);
  right: -5rem;
  bottom: -8rem;
  animation: floatA 8s ease-in-out infinite;
}

.shape-b {
  width: 18rem;
  height: 18rem;
  background: var(--ts-blue);
  left: -5rem;
  top: 22rem;
  animation: floatB 9s ease-in-out infinite;
}

@keyframes floatA {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(12px); }
}

.shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 1.1rem auto 0.65rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1rem;
  align-items: start;
  flex: 1 0 auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(1, 33, 105, 0.14);
  min-width: 0;
  overflow: hidden;
}

.panel-info {
  padding: 1.3rem;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.25rem;
  width: 100%;
  overflow: hidden;
}

.brand-wordmark {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
}

.panel-app {
  padding: 1.05rem;
  min-height: 86vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.75rem;
}

.eyebrow {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--ts-blue-2);
  font-weight: 700;
}

h1, h2, h3, h4 {
  margin: 0.42rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.08;
}

h1 {
  font-size: clamp(1.42rem, 2.2vw, 1.92rem);
}

h2 {
  font-size: 1.16rem;
}

h3 {
  font-size: 1.02rem;
}

h4 {
  font-size: 0.96rem;
}

.lede {
  margin: 0.9rem 0 1rem;
  line-height: 1.45;
  color: #253971;
}

.lede-emphasis {
  color: #012169;
}

.lede-emphasis strong {
  display: block;
  font-weight: 700;
}

code {
  background: #eef3ff;
  padding: 0.08rem 0.32rem;
  border-radius: 6px;
}

.auth-shell {
  display: grid;
  gap: 0.72rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
}

.auth-tab {
  background: #edf2ff;
  color: #173278;
  border: 1px solid #c8d6ff;
}

.auth-tab.active {
  background: #012169;
  color: #fff;
  border-color: #012169;
}

.auth-form {
  display: grid;
  gap: 0.5rem;
}

.signin-help {
  margin: -0.1rem 0 0.1rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #3a4f86;
}

.signin-help strong {
  color: #0f2b73;
}

.about-panel {
  display: grid;
  gap: 0.5rem;
  border: 1px solid #d4defb;
  border-radius: 12px;
  background: #f7f9ff;
  padding: 0.8rem;
}

.about-panel h3 {
  margin-top: 0.35rem;
  color: #0e2a6f;
}

.about-panel p {
  margin: 0;
  line-height: 1.45;
  color: #233765;
  font-size: 0.92rem;
}

.about-panel a {
  color: #012169;
  font-weight: 700;
  text-decoration-thickness: 2px;
}

.about-panel a:hover {
  color: #0f3ea8;
}

.about-panel p.about-signature {
  margin-top: 1.25rem;
  color: #0d2358;
  font-weight: 700;
}

.about-logo-row {
  display: flex;
  justify-content: center;
}

.about-logo-mark {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  border: 1px solid #d2dcfb;
}

.auth-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #253971;
}

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

input,
select {
  width: 100%;
  border: 1px solid #b5c2eb;
  border-radius: 12px;
  padding: 0.72rem 0.85rem;
  font-size: 0.95rem;
  background: #fcfdff;
}

input:focus,
select:focus {
  outline: 2px solid #9cb3f4;
  border-color: #8ba4eb;
}

button {
  border: none;
  border-radius: 12px;
  padding: 0.72rem 1rem;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 130ms ease, filter 130ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#email-btn,
#code-btn,
#signin-btn,
#refresh-rides-btn,
.ride-save-btn,
.connect-btn,
#map-confirm-btn {
  background: linear-gradient(110deg, var(--ts-blue), #355fb7);
  color: white;
}

#map-search-btn,
.secondary-btn,
.ride-delete-btn,
.ride-leave-btn,
.tab-btn {
  background: #edf2ff;
  color: #173278;
  border: 1px solid #c8d6ff;
}

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.42rem;
  align-items: start;
  font-weight: 600;
}

.consent-row input {
  width: 1.03rem;
  height: 1.03rem;
  margin-top: 0.1rem;
}

.auth-status {
  min-height: 1.2rem;
  margin: 0;
  color: #2d488f;
  font-size: 0.9rem;
}

.auth-status.error {
  color: #a01022;
}

.signed-in {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.signed-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.signed-email {
  margin: 0;
  color: #2d488f;
  font-size: 0.9rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border-bottom: 1px solid #dae3ff;
  padding-bottom: 0.68rem;
}

.app-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid #d2dcfb;
}

.state-pill {
  border-radius: 999px;
  background: #e9efff;
  color: var(--ts-blue);
  border: 1px solid #c4d2ff;
  padding: 0.36rem 0.68rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.tab-btn.active {
  background: #012169;
  color: #fff;
  border-color: #012169;
}

.view-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto auto auto;
  gap: 0.66rem;
}

.chat-log {
  overflow-y: auto;
  padding: 0.12rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.64rem;
  min-height: 180px;
}

.map-panel {
  border: 1px solid #c2d2ff;
  border-radius: 16px;
  padding: 0.72rem;
  background: linear-gradient(180deg, #f9fbff 0%, #f2f7ff 100%);
  display: grid;
  gap: 0.56rem;
  box-shadow: inset 0 0 0 1px #edf2ff;
}

.map-canvas {
  height: 250px;
  border-radius: 14px;
  border: 1px solid #bccfff;
  box-shadow: 0 8px 24px rgba(1, 33, 105, 0.12);
}

.map-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.map-search-wrap {
  position: relative;
}

.map-suggestions {
  position: absolute;
  z-index: 420;
  top: calc(100% + 0.34rem);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #c5d4ff;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(1, 33, 105, 0.18);
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.map-suggestion {
  border: none;
  display: grid;
  width: 100%;
  text-align: left;
  padding: 0.56rem 0.7rem;
  background: transparent;
  cursor: pointer;
  transition: background 120ms ease;
}

.map-suggestion:hover,
.map-suggestion.active {
  background: #eef3ff;
}

.map-suggestion .primary {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1c326f;
}

.map-suggestion .secondary {
  font-size: 0.79rem;
  color: #5469a5;
  margin-top: 0.12rem;
}

.map-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.42rem;
  min-width: 172px;
}

.map-status {
  margin: 0;
  font-size: 0.86rem;
  color: #2d488f;
}

.time-panel {
  border: 1px solid #c8d8ff;
  border-radius: 16px;
  padding: 0.74rem;
  display: grid;
  gap: 0.65rem;
  background: #f9fbff;
}

.time-controls {
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  gap: 0.8rem;
}

.time-window-wrap {
  display: grid;
  gap: 0.46rem;
}

.time-range-slider {
  margin-top: 0.2rem;
}

.time-range-slider.noUi-target {
  border: 1px solid #c6d5ff;
  background: #edf3ff;
  box-shadow: none;
  border-radius: 999px;
  height: 12px;
}

.time-range-slider .noUi-connect {
  background: linear-gradient(90deg, #4d74ca 0%, #012169 100%);
}

.time-range-slider .noUi-handle {
  width: 18px !important;
  height: 18px !important;
  top: -4px !important;
  right: -9px !important;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #012169;
  box-shadow: 0 3px 10px rgba(1, 33, 105, 0.28);
}

.time-range-slider .noUi-handle::before,
.time-range-slider .noUi-handle::after {
  display: none;
}

.time-range-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.time-label {
  margin: 0.25rem 0 0;
  color: #25428d;
  font-weight: 700;
  font-size: 0.88rem;
}

.time-search-status {
  margin: 0;
  font-size: 0.84rem;
  color: #294b94;
}

.time-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.no-match-panel {
  border: 1px dashed #c7d4fb;
  border-radius: 12px;
  background: #fff;
  padding: 0.62rem;
  display: grid;
  gap: 0.42rem;
}

.no-match-time-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.42rem;
}

.time-results {
  display: grid;
  gap: 0.45rem;
}

.ride-result {
  border: 1px solid #d1dcff;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.ride-result:hover,
.ride-result.active {
  border-color: #8ca8f0;
  box-shadow: 0 7px 20px rgba(1, 33, 105, 0.12);
}

.ride-row {
  font-size: 0.85rem;
  color: #1d316e;
  margin: 0.12rem 0;
}

.connect-wrap {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 130ms ease;
}

.ride-result:hover .connect-wrap,
.ride-result.active .connect-wrap {
  opacity: 1;
  pointer-events: auto;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.58rem;
  border-top: 1px solid #dae3ff;
  padding-top: 0.7rem;
}

#send-btn {
  background: var(--ts-yellow);
  color: #1f1a02;
  min-width: 92px;
}

.bubble {
  max-width: min(78%, 680px);
  padding: 0.72rem 0.84rem;
  border-radius: 14px;
  line-height: 1.38;
  white-space: pre-wrap;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--bot-bubble);
  border: 1px solid #d3dfff;
}

.bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--user-text);
  border: 1px solid #de9c00;
}

.my-rides-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.my-rides-status {
  margin: 0.2rem 0 0;
  color: #35508c;
  font-size: 0.87rem;
}

.my-rides-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.rides-list {
  display: grid;
  gap: 0.55rem;
}

.ride-card {
  border: 1px solid #cfdcff;
  border-radius: 12px;
  background: #fff;
  padding: 0.64rem;
  display: grid;
  gap: 0.44rem;
}

.ride-card .meta {
  font-size: 0.8rem;
  color: #3d58a0;
}

.ride-card .fields {
  display: grid;
  gap: 0.35rem;
}

.ride-card .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.site-footer {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto 1.2rem;
  padding: 0.3rem 0.2rem 0.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #153276;
  flex: 0 0 auto;
}

.footer-contact {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-contact a {
  color: #012169;
  text-decoration-thickness: 2px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.social-link {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 8px;
  border: 1px solid #bfcfff;
  background: #edf3ff;
  color: #012169;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.social-link:hover {
  transform: translateY(-1px);
  background: #fff0c7;
  border-color: #e8be44;
}

.social-link svg {
  width: 0.72rem;
  height: 0.72rem;
  fill: currentColor;
}

@media (max-width: 1060px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100vw - 1rem));
    margin-top: 0.85rem;
  }

  .panel-app {
    min-height: 72vh;
  }

  .time-controls,
  .my-rides-columns,
  .auth-grid.two-col {
    grid-template-columns: 1fr;
  }

  .map-controls {
    grid-template-columns: 1fr;
  }

  .map-actions {
    min-width: 0;
  }

  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .brand-wordmark {
    width: 100%;
    max-width: 260px;
  }

  .app-logo-mark {
    width: 34px;
    height: 34px;
  }

  .site-footer {
    width: min(760px, calc(100vw - 1rem));
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-left: 0.1rem;
  }

  .social-link {
    width: 1.25rem;
    height: 1.25rem;
  }
}
