:root {
  --navy: #102a43;
  --blue: #1f5f99;
  --blue-strong: #174f82;
  --sky: #eaf4fb;
  --teal: #128277;
  --green: #e6f6f2;
  --amber: #b96b13;
  --amber-bg: #fff5df;
  --red: #aa3434;
  --red-bg: #fff0f0;
  --ink: #183247;
  --muted: #647686;
  --line: #d9e3ea;
  --paper: #ffffff;
  --canvas: #f4f7f9;
  --shadow: 0 18px 55px rgba(16, 42, 67, 0.10);
  --radius: 22px;
  --small-radius: 13px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(69, 160, 205, 0.12), transparent 34rem),
    linear-gradient(180deg, #f9fbfc 0, var(--canvas) 34rem);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--blue); }
button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 78px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(217, 227, 234, 0.85);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--navy);
  text-decoration: none;
}

.brand img { width: 106px; height: 35px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 1rem; letter-spacing: 0.02em; }
.brand small { margin-top: 0.25rem; color: var(--muted); font-size: 0.76rem; }

.language-link,
.admin-nav a {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.admin-nav { display: flex; gap: 0.6rem; }

main { width: min(1160px, 92vw); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 3.4rem;
  align-items: center;
  padding: 5rem 0 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1.25rem; color: var(--navy); font-size: clamp(2.15rem, 5vw, 4.25rem); line-height: 1.08; letter-spacing: -0.035em; }
h2 { margin-bottom: 0; color: var(--navy); font-size: 1.45rem; line-height: 1.25; }

.hero-lead { max-width: 760px; margin-bottom: 1.5rem; color: #445d70; font-size: 1.08rem; }
.notice-stack { display: grid; gap: 0.7rem; }
.notice { margin: 0; padding: 0.8rem 1rem; border-radius: 12px; font-size: 0.92rem; font-weight: 650; }
.primary-notice { border: 1px solid #f1d49a; background: var(--amber-bg); color: #7b4a0e; }
.privacy-notice { border: 1px solid #bfe3db; background: var(--green); color: #17665e; }

.route-card {
  padding: 2rem;
  border: 1px solid rgba(217, 227, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.route-stop { display: grid; grid-template-columns: 58px 1fr; gap: 1rem; align-items: center; }
.route-stop strong { display: block; color: var(--navy); font-size: 1rem; }
.route-stop small { display: block; margin-top: 0.2rem; color: var(--muted); line-height: 1.45; }
.route-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.route-line { width: 2px; height: 32px; margin: 0.4rem 0 0.4rem 28px; background: linear-gradient(var(--blue), var(--teal)); }

.error-panel {
  margin: 0 auto 1.5rem;
  padding: 1.2rem 1.5rem;
  border: 1px solid #f0baba;
  border-radius: var(--small-radius);
  background: var(--red-bg);
  color: #7c2929;
}
.error-panel ul { margin: 0.45rem 0 0; padding-left: 1.25rem; }

.survey-form { display: grid; gap: 1.35rem; padding: 0 0 5rem; }
.form-section {
  padding: clamp(1.35rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(16, 42, 67, 0.055);
}

.section-heading { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.8rem; }
.section-heading > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--sky);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 800;
}
.section-heading p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.94rem; }

.field-grid { display: grid; gap: 1.25rem; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.field > span { color: var(--navy); font-size: 0.92rem; font-weight: 750; }
.field em { margin-left: 0.35rem; color: var(--red); font-size: 0.72rem; font-style: normal; font-weight: 700; }
.field small { color: var(--muted); font-size: 0.8rem; }

input, select, textarea {
  width: 100%;
  border: 1px solid #c9d7e1;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input, select { min-height: 48px; padding: 0 0.85rem; }
textarea { padding: 0.8rem 0.9rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 95, 153, 0.12); }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f6; }

.choice-cards { display: grid; gap: 0.9rem; }
.need-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-card {
  position: relative;
  display: flex;
  gap: 0.85rem;
  min-height: 116px;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: #91b9d5; }
.choice-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-dot { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 0.1rem; border: 2px solid #9db0bd; border-radius: 50%; box-shadow: inset 0 0 0 4px #fff; }
.choice-card strong { display: block; color: var(--navy); }
.choice-card small { display: block; margin-top: 0.35rem; color: var(--muted); line-height: 1.45; }
.choice-card:has(input:checked) { border-color: var(--blue); background: var(--sky); }
.choice-card input:checked + .choice-dot { border-color: var(--blue); background: var(--blue); }

.demand-details { display: grid; gap: 1.35rem; max-height: 4000px; opacity: 1; transition: opacity 180ms ease; }
.demand-details.is-hidden { display: none; opacity: 0; }

.schedule-wrap, .table-scroll { overflow-x: auto; }
.schedule-table, .admin-table { width: 100%; border-collapse: collapse; }
.schedule-table th, .schedule-table td { padding: 0.85rem; border-bottom: 1px solid var(--line); text-align: left; }
.schedule-table thead th { background: #f6f9fb; color: var(--navy); font-size: 0.84rem; }
.schedule-table tbody th { min-width: 90px; color: var(--navy); }
.schedule-table select { min-width: 230px; }

.switch-label { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; }
.switch-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-label > span { position: relative; width: 40px; height: 23px; border-radius: 999px; background: #c7d2d9; transition: background 160ms ease; }
.switch-label > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform 160ms ease; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.switch-label input:checked + span { background: var(--teal); }
.switch-label input:checked + span::after { transform: translateX(17px); }
.switch-label b { color: var(--muted); font-size: 0.8rem; font-weight: 650; }

.confirm-section { border-color: #bddfd7; background: linear-gradient(150deg, #fff 0%, #f1faf7 100%); }
.consent-row { display: flex; gap: 0.8rem; align-items: flex-start; cursor: pointer; }
.consent-row input { flex: 0 0 auto; width: 20px; min-height: 20px; margin-top: 0.15rem; accent-color: var(--teal); }
.privacy-copy { margin: 0.8rem 0 1.5rem 2.8rem; color: var(--muted); font-size: 0.85rem; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.72rem 1.25rem;
  border-radius: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { border-color: var(--blue-strong); background: var(--blue-strong); }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--navy); }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 1.8rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.success-card, .login-card {
  width: min(620px, 100%);
  margin: 6rem auto;
  padding: clamp(1.8rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.success-card h1, .login-card h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.success-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green); color: var(--teal); font-size: 2rem; font-weight: 900; }
.success-name { color: var(--navy); font-size: 1.1rem; font-weight: 800; }
.reference { display: flex; flex-direction: column; gap: 0.25rem; margin: 1.5rem 0; padding: 1rem; border-radius: 12px; background: #f5f8fa; }
.reference span { color: var(--muted); font-size: 0.78rem; }
.reference strong { color: var(--navy); letter-spacing: 0.06em; }
.login-card form { display: grid; gap: 1rem; margin-top: 1.5rem; text-align: left; }

.flash-wrap { width: min(700px, 92vw); margin: 1.5rem auto 0; }
.flash { padding: 0.9rem 1rem; border-radius: 10px; }
.flash.error { border: 1px solid #f0baba; background: var(--red-bg); color: var(--red); }

/* Admin */
.admin-body { background: #eef3f6; }
.admin-shell { display: grid; gap: 1.2rem; padding: 3rem 0 5rem; }
.admin-title-row, .panel-heading { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-end; }
.admin-title-row h1 { margin-bottom: 0.4rem; font-size: clamp(2rem, 4vw, 3.2rem); }
.admin-title-row p, .panel-heading p { margin-bottom: 0; color: var(--muted); }
.export-actions { display: flex; gap: 0.65rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-grid article { padding: 1.35rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.stat-grid span { display: block; color: var(--muted); font-size: 0.82rem; }
.stat-grid strong { display: block; margin-top: 0.3rem; color: var(--navy); font-size: 2.25rem; line-height: 1; }
.admin-panel { padding: 1.4rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.panel-heading { margin-bottom: 1rem; }
.panel-heading h2 { font-size: 1.15rem; }
.admin-table th, .admin-table td { padding: 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.admin-table thead th { background: #f6f8fa; color: var(--navy); font-size: 0.78rem; white-space: nowrap; }
.admin-table td { font-size: 0.84rem; }
.admin-table td small { display: block; margin-top: 0.25rem; color: var(--muted); }
.admin-table td a { display: block; margin-top: 0.35rem; }
.compact-table td { font-size: 1rem; font-weight: 750; }
.response-table { min-width: 1080px; }
.response-table td:first-child { min-width: 150px; }
.return-cell span { display: block; white-space: nowrap; }
.status-pill { display: inline-flex; padding: 0.28rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.status-pill.yes { background: var(--green); color: #0f6d64; }
.status-pill.unsure { background: var(--amber-bg); color: #87500e; }
.status-pill.no { background: #eef1f3; color: #5d6a73; }
.area-list { display: grid; gap: 0.6rem; }
.area-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.9rem; border-radius: 10px; background: #f6f9fa; }
.area-list span { color: #38546a; }
.area-list strong { color: var(--navy); white-space: nowrap; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 180px 150px auto auto; gap: 0.7rem; align-items: center; margin-bottom: 1rem; }
.filter-bar a { text-align: center; }
.empty-state { padding: 1.5rem !important; color: var(--muted); text-align: center !important; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 3.5rem; }
  .route-card { max-width: 650px; }
  .need-cards { grid-template-columns: 1fr; }
  .choice-card { min-height: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-title-row { align-items: flex-start; flex-direction: column; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar input { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .site-header { min-height: 68px; padding: 0 4vw; }
  .brand img { width: 82px; height: 30px; }
  .brand strong { font-size: 0.88rem; }
  .brand small { display: none; }
  .language-link { padding: 0.45rem 0.7rem; font-size: 0.78rem; }
  main { width: min(94vw, 1160px); }
  .hero { padding: 2.7rem 0 2rem; }
  h1 { font-size: 2.15rem; }
  .hero-lead { font-size: 0.98rem; }
  .route-card, .form-section { border-radius: 17px; }
  .route-card { padding: 1.35rem; }
  .route-stop { grid-template-columns: 49px 1fr; gap: 0.8rem; }
  .route-icon { width: 49px; height: 49px; border-radius: 13px; font-size: 0.68rem; }
  .route-line { height: 26px; margin-left: 24px; }
  .two-columns { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .section-heading { margin-bottom: 1.35rem; }
  .schedule-table th, .schedule-table td { padding: 0.7rem; }
  .schedule-table select { min-width: 205px; }
  .privacy-copy { margin-left: 0; }
  .site-footer { flex-direction: column; gap: 0.35rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid strong { font-size: 1.8rem; }
  .export-actions { width: 100%; }
  .export-actions a { flex: 1; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar input { grid-column: auto; }
  .admin-nav a:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
