:root {
  --color-background-primary: #ffffff;
  --color-background-secondary: #f5f8fc;
  --color-background-tertiary: #eef3f8;
  --color-text-primary: #172033;
  --color-text-secondary: #667085;
  --color-border-primary: #cbd5e1;
  --color-border-secondary: #dce4ee;
  --color-border-tertiary: #e8eef5;
  --yt-primary: #0b5cad;
  --yt-primary-deep: #074b91;
  --yt-primary-soft: #eaf3ff;
  --yt-accent: #f28a00;
  --yt-shadow-sm: 0 2px 8px rgba(16, 44, 76, 0.06);
  --yt-shadow-md: 0 12px 30px rgba(16, 44, 76, 0.1);
  --yt-shadow-lg: 0 28px 70px rgba(9, 48, 88, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  background: #eaf0f6;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  color: var(--color-text-primary);
  font-family: Inter, "SF Pro Display", "SF Pro Text", -apple-system,
    BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif !important;
  background:
    radial-gradient(circle at 8% 6%, rgba(11, 92, 173, 0.12), transparent 28rem),
    radial-gradient(circle at 92% 14%, rgba(242, 138, 0, 0.1), transparent 23rem),
    linear-gradient(145deg, #edf3f8 0%, #f8fafc 48%, #e9f0f7 100%) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgba(11, 92, 173, 0.08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

body::before {
  top: -14rem;
  left: -9rem;
  box-shadow:
    0 0 0 3rem rgba(11, 92, 173, 0.025),
    0 0 0 7rem rgba(11, 92, 173, 0.02);
}

body::after {
  right: -11rem;
  bottom: -16rem;
  box-shadow:
    0 0 0 4rem rgba(242, 138, 0, 0.025),
    0 0 0 8rem rgba(11, 92, 173, 0.018);
}

#root {
  position: relative;
  z-index: 1;
}

::selection {
  color: #ffffff;
  background: rgba(11, 92, 173, 0.78);
}

button,
input,
select,
textarea {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

button:not(:disabled):hover {
  filter: saturate(1.04);
}

button:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(11, 92, 173, 0.2) !important;
  outline-offset: 2px;
}

input,
select,
textarea,
[contenteditable="true"] {
  border-radius: 10px !important;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input:hover,
select:hover,
textarea:hover,
[contenteditable="true"]:hover {
  border-color: #bdcad8 !important;
}

input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  border-color: var(--yt-primary) !important;
  box-shadow: 0 0 0 3px rgba(11, 92, 173, 0.11) !important;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3 !important;
}

a {
  text-underline-offset: 3px;
}

/* Main application surface */
#root > div[style*="max-width: 720px"] {
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--yt-shadow-lg);
}

#root div[style*="min-height: 100vh"][style*="background: var(--color-background-tertiary)"] {
  background:
    linear-gradient(rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    var(--color-background-tertiary) !important;
}

/* Brand header */
#root div[style*="linear-gradient(135deg"] {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 16px 36px rgba(7, 75, 145, 0.2);
}

#root div[style*="linear-gradient(135deg"]::after {
  position: absolute;
  top: -55%;
  right: -8%;
  width: 13rem;
  height: 13rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 0 2.6rem rgba(255, 255, 255, 0.035),
    0 0 0 5.3rem rgba(255, 255, 255, 0.025);
  content: "";
  pointer-events: none;
}

#root div[style*="linear-gradient(135deg"] button {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(8px);
}

#root div[style*="linear-gradient(135deg"] button:hover {
  background: rgba(255, 255, 255, 0.24) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Navigation and filter surfaces */
#root div[style*="position: sticky"][style*="z-index: 30"],
#root div[style*="position: sticky"][style*="z-index: 10"] {
  border-bottom-color: rgba(203, 213, 225, 0.72) !important;
  background: rgba(255, 255, 255, 0.91) !important;
  box-shadow: 0 10px 28px rgba(15, 50, 83, 0.07) !important;
  backdrop-filter: blur(18px) saturate(1.25) !important;
}

#root div[style*="grid-template-columns: repeat(5"] > button {
  border-radius: 11px !important;
}

#root div[style*="grid-template-columns: repeat(5"] > button:hover {
  border-color: rgba(11, 92, 173, 0.34) !important;
  box-shadow: var(--yt-shadow-sm) !important;
}

/* Cards and panels */
#root div[style*="background: var(--color-background-primary)"][style*="border-radius: 12px"][style*="border: 0.5px"] {
  border-color: rgba(203, 213, 225, 0.78) !important;
  border-radius: 14px !important;
  box-shadow: var(--yt-shadow-sm) !important;
}

#root div[style*="cursor: pointer"][style*="border-radius: 12px"] {
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

#root div[style*="cursor: pointer"][style*="border-radius: 12px"]:hover {
  border-color: rgba(11, 92, 173, 0.3) !important;
  box-shadow: 0 10px 24px rgba(16, 44, 76, 0.1) !important;
  transform: translateY(-2px);
}

#root div[style*="background: var(--color-background-primary)"][style*="border-radius: 16px"],
#root div[style*="background: rgb(255, 255, 255)"][style*="border-radius: 14px"] {
  border: 1px solid rgba(203, 213, 225, 0.68) !important;
  box-shadow: var(--yt-shadow-sm);
}

/* Authentication and user-selection pages */
#root > div[style*="justify-content: center"][style*="background: var(--color-background-tertiary)"] {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -8%, rgba(11, 92, 173, 0.16), transparent 31rem),
    linear-gradient(155deg, #edf5fc 0%, #f9fbfd 54%, #edf2f7 100%) !important;
}

#root > div[style*="justify-content: center"] > div[style*="max-width: 360px"],
#root > div[style*="justify-content: center"] > div[style*="max-width: 340px"] {
  max-width: 410px !important;
  padding: 28px !important;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 20px !important;
  box-shadow: 0 24px 64px rgba(16, 44, 76, 0.13) !important;
}

#root img[alt="远特工程云"] {
  border-color: rgba(11, 92, 173, 0.14) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 16px 36px rgba(11, 92, 173, 0.15) !important;
}

/* Delivery panel injected outside React */
#yt-delivery-items-panel {
  border: 1px solid rgba(203, 213, 225, 0.78) !important;
  border-radius: 14px !important;
  box-shadow: var(--yt-shadow-sm);
}

#yt-delivery-items-panel input {
  border-color: var(--color-border-secondary) !important;
}

/* Scrollbars */
* {
  scrollbar-color: #b9c7d6 transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #b9c7d6;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 680px) {
  body {
    background: var(--color-background-tertiary) !important;
  }

  body::before,
  body::after {
    display: none;
  }

  #root > div[style*="max-width: 720px"] {
    border: 0;
    box-shadow: none;
  }

  #root div[style*="linear-gradient(135deg"] {
    border-radius: 0 0 20px 20px;
  }

  #root > div[style*="justify-content: center"] > div[style*="max-width: 360px"],
  #root > div[style*="justify-content: center"] > div[style*="max-width: 340px"] {
    padding: 22px !important;
    border-radius: 18px !important;
  }

  #root div[style*="cursor: pointer"][style*="border-radius: 12px"]:hover {
    transform: none;
  }
}

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