:root {
  --ink: #10233f;
  --muted: #70809a;
  --line: #dfe6ee;
  --soft: #f4f7fa;
  --blue: #1769e8;
  --blue-soft: #eaf3ff;
  --coral: #ff6248;
  --green: #178a43;
  --danger: #dd2d37;
  --shadow: 0 18px 50px rgba(21, 50, 85, .16);
  --header-h: 64px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(23, 105, 232, .18); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  height: var(--header-h); display: flex; align-items: stretch; gap: 28px; padding: 0 24px;
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); position: fixed; inset: 0 0 auto 0; z-index: 30;
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 780; font-size: 20px; letter-spacing: -.5px; white-space: nowrap; }
.brand-mark { color: var(--blue); display: grid; place-items: center; }
.brand-mark svg { width: 42px; height: 30px; stroke-width: 2.1; }
.view-tabs { display: flex; align-items: stretch; gap: 14px; }
.view-tab { border: 0; background: transparent; color: #334563; min-width: 66px; padding: 0 10px; font-size: 14px; font-weight: 600; position: relative; }
.view-tab.active { color: var(--blue); }
.view-tab.active::after { content: ""; position: absolute; height: 3px; background: var(--blue); border-radius: 3px 3px 0 0; left: 8px; right: 8px; bottom: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.live-weather { min-width: 150px; padding: 7px 10px; border: 1px solid #d9e6f4; border-radius: 9px; background: #f6faff; color: #5f7087; text-align: left; line-height: 1.15; }
.live-weather span, .live-weather strong { display: block; white-space: nowrap; }
.live-weather span { margin-bottom: 3px; font-size: 10px; }
.live-weather strong { color: #244261; font-size: 12px; }
.live-weather.ready:hover { border-color: #9fc3f2; background: #eef6ff; }
.weather-switch { background: var(--soft); border-radius: 10px; padding: 3px; display: flex; }
.weather-btn { border: 0; background: transparent; color: #53627a; padding: 8px 13px; border-radius: 8px; font-size: 13px; font-weight: 650; }
.weather-btn.active { background: #fff; color: var(--green); box-shadow: 0 1px 5px rgba(34, 62, 90, .13); }
.weather-btn span { font-size: 16px; margin-right: 4px; }
.primary-btn { border: 0; border-radius: 9px; background: var(--coral); color: white; height: 40px; padding: 0 17px; display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; box-shadow: 0 7px 18px rgba(255, 98, 72, .18); }
.primary-btn:hover { background: #f65339; }
.primary-btn svg { width: 17px; }

.app-shell { position: fixed; inset: var(--header-h) 0 0; height: auto; display: grid; grid-template-columns: 330px minmax(420px, 1fr) 350px; }
.places-panel, .detail-panel { background: white; position: relative; z-index: 12; min-width: 0; }
.places-panel { border-right: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .25s ease, margin .25s ease; }
.panel-heading { height: 65px; padding: 0 18px 0 20px; display: flex; align-items: center; justify-content: space-between; }
.panel-heading > div { display: flex; align-items: baseline; gap: 8px; }
.panel-heading h1 { font-size: 19px; margin: 0; letter-spacing: -.35px; }
.panel-heading span { color: var(--muted); font-size: 13px; }
.icon-btn { background: transparent; border: 0; color: #53627a; padding: 7px; border-radius: 7px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--soft); }
.search-box { height: 40px; border: 1px solid var(--line); border-radius: 8px; margin: 0 18px; padding: 0 11px; display: flex; align-items: center; gap: 8px; color: var(--muted); background: white; }
.search-box:focus-within { border-color: #8cb8f7; box-shadow: 0 0 0 3px rgba(23,105,232,.08); }
.search-box svg { width: 18px; }
.search-box input { border: 0; outline: 0; min-width: 0; width: auto; flex: 1 1 auto; font-size: 13px; color: var(--ink); background: transparent; }
.category-tabs { padding: 14px 18px 10px; display: flex; gap: 7px; overflow-x: auto; }
.category-tab { border: 0; padding: 7px 11px; border-radius: 7px; color: #59677d; background: var(--soft); white-space: nowrap; font-size: 12px; font-weight: 650; }
.category-tab.active { background: var(--blue); color: white; }
.places-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 10px 15px; }
.day-group { margin-bottom: 10px; }
.group-title { padding: 9px 10px 7px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 750; color: #253953; }
.group-title span { color: #8491a4; font-weight: 500; }
.place-row { width: 100%; border: 0; text-align: left; background: transparent; display: grid; grid-template-columns: 36px 1fr 30px; gap: 9px; align-items: center; padding: 8px; border-radius: 8px; color: var(--ink); cursor: pointer; }
.place-row:hover { background: #f5f8fb; }
.place-row.active { background: var(--blue-soft); }
.place-index { width: 30px; height: 30px; border: 2px solid #dbe3ed; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 750; background: white; color: #354b68; }
.place-index.unordered { border-style: dashed; color: #8491a4; font-size: 16px; }
.place-row.active .place-index { border-color: var(--blue); background: var(--blue); color: white; }
.place-copy { min-width: 0; }
.place-copy strong { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-more { width: 28px; height: 30px; border: 0; border-radius: 7px; color: #8290a3; background: transparent; display: grid; place-items: center; }
.row-more:hover { color: var(--blue); background: rgba(255,255,255,.8); }
.row-more svg { width: 16px; }
.panel-footer { height: 49px; padding: 0 17px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.text-btn { border: 0; background: transparent; display: flex; align-items: center; gap: 6px; color: #43617f; font-size: 12px; font-weight: 650; padding: 5px; }
.text-btn svg { width: 16px; }

.map-stage { position: relative; min-width: 0; overflow: hidden; background: #deebf1; }
#map { position: absolute; inset: 0; }
.map-loading { position: absolute; inset: 0; z-index: 9; background: #edf3f6; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: #36516b; font-size: 13px; transition: opacity .25s; }
.map-loading.hidden { opacity: 0; pointer-events: none; }
.loader { width: 30px; height: 30px; border: 3px solid #c8d6df; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-toolbar { position: absolute; right: 16px; top: 14px; z-index: 10; display: flex; box-shadow: 0 5px 18px rgba(24,55,83,.14); border-radius: 8px; overflow: hidden; }
.map-toolbar button { height: 38px; border: 0; border-right: 1px solid var(--line); background: white; color: #425773; padding: 0 12px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; }
.map-toolbar button:last-child { border-right: 0; }
.map-toolbar button.active { color: var(--blue); }
.map-toolbar svg { width: 17px; }
.route-summary { position: absolute; left: 16px; bottom: 16px; z-index: 10; min-height: 48px; max-width: calc(100% - 32px); border-radius: 9px; padding: 10px 14px; background: rgba(255,255,255,.96); box-shadow: 0 7px 25px rgba(24,55,83,.15); display: flex; align-items: center; gap: 10px; font-size: 12px; color: #607089; }
.route-summary strong { color: var(--ink); font-size: 13px; display: block; margin-bottom: 2px; }
.route-summary > div { min-width: 0; }
.route-summary .route-path { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-summary .route-dot { width: 10px; height: 10px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px var(--blue-soft); }
.custom-marker { position: relative; width: 34px; height: 42px; filter: drop-shadow(0 4px 5px rgba(25,75,130,.24)); }
.custom-marker .marker-pin { width: 34px; height: 34px; display: grid; place-items: center; background: var(--blue); color: white; border: 3px solid white; border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); font: 750 12px/1 Inter, sans-serif; }
.custom-marker .marker-pin span { transform: rotate(45deg); }
.custom-marker.food .marker-pin { background: var(--coral); }
.custom-marker.stay .marker-pin { background: #7c5ce0; }
.custom-marker.rainy .marker-pin { background: #4b88a9; }
.marker-label { position: absolute; left: 40px; top: 3px; display: none; max-width: 180px; padding: 6px 9px; border: 1px solid rgba(205,217,230,.95); border-radius: 7px; background: rgba(255,255,255,.96); color: #17304d; box-shadow: 0 4px 13px rgba(21,50,85,.13); font: 700 12px/1.2 Inter,"PingFang SC",sans-serif; white-space: nowrap; pointer-events: none; }
.custom-marker.show-label .marker-label, .custom-marker.selected .marker-label { display: block; }
.custom-marker.selected { transform: scale(1.08); transform-origin: bottom center; }

.detail-panel { border-left: 1px solid var(--line); overflow-y: auto; }
.detail-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 34px; color: var(--muted); }
.detail-empty svg { width: 52px; height: 52px; color: #aec0d4; margin-bottom: 12px; }
.detail-empty strong { color: #30455f; display: block; font-size: 16px; margin-bottom: 7px; }
.detail-hero { height: 154px; position: relative; overflow: hidden; background: linear-gradient(135deg,#c4e5f5,#77b9d9); background-size: cover; background-position: center; }
.detail-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 25% 20%,rgba(255,255,255,.8),transparent 20%), linear-gradient(145deg,transparent 42%,rgba(255,255,255,.28) 43% 44%,transparent 45%); opacity: .8; }
.detail-hero.has-photo::before { background: linear-gradient(180deg, transparent 48%, rgba(9,29,48,.62)); opacity: 1; }
.detail-hero .hero-label { position: absolute; left: 20px; bottom: 18px; color: white; text-shadow: 0 2px 8px rgba(18,56,85,.35); font-size: 12px; font-weight: 700; }
.detail-body { padding: 20px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title-row h2 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
.category-label { color: var(--blue); margin: 8px 0 13px; font-size: 12px; font-weight: 650; }
.address { display: flex; gap: 8px; color: #5e6f87; font-size: 12px; line-height: 1.6; }
.address svg { width: 17px; flex: 0 0 auto; color: var(--blue); margin-top: 1px; }
.description { color: #42536b; font-size: 13px; line-height: 1.75; margin: 17px 0; }
.quick-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 17px 0; }
.quick-fact { min-height: 76px; padding: 11px 12px; border: 1px solid #dce6f0; border-radius: 10px; background: #f8fbfe; }
.quick-fact span { display: block; margin-bottom: 7px; color: #738198; font-size: 10px; font-weight: 650; }
.quick-fact strong { display: block; color: #213b58; font-size: 12px; line-height: 1.45; }
.quick-fact.reservation { background: #fff8e8; border-color: #f0dfaf; }
.quick-fact.reservation strong { color: #7b5712; }
.quick-fact.hours { background: #edf9f2; border-color: #cfe9d9; }
.quick-fact.hours strong { color: #24623d; }
.quick-fact.weather { background: #eef6ff; border-color: #d2e5fb; }
.tips-box { position: relative; overflow: hidden; background: #fff7df; border: 1px solid #ead9a5; border-radius: 11px; padding: 15px; box-shadow: 0 8px 22px rgba(134,100,24,.09); }
.tips-box::before { content: ""; position: absolute; width: 42px; height: 12px; left: 50%; top: -4px; transform: translateX(-50%) rotate(-2deg); background: rgba(255,255,255,.68); border: 1px solid rgba(222,202,143,.48); }
.tips-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 750; font-size: 14px; }
.tips-box textarea { width: 100%; min-height: 72px; padding: 0; resize: vertical; border: 0; outline: 0; background: transparent; color: #362d19; font-size: 13px; font-weight: 560; line-height: 1.7; }
.visit-info { margin-top: 16px; border-top: 1px solid var(--line); }
.visit-info h3 { margin: 17px 0 11px; font-size: 14px; }
.info-row { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf1f5; font-size: 12px; line-height: 1.55; }
.info-row span:first-child { color: #718097; }
.info-row strong { color: #243a55; font-weight: 650; }
.place-menu { position: fixed; z-index: 60; width: 286px; padding: 13px; border: 1px solid #d8e1eb; border-radius: 11px; background: white; box-shadow: 0 16px 45px rgba(19,47,76,.2); }
.place-menu[hidden] { display: none; }
.place-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px 10px; }
.place-menu-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.place-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.place-menu label { display: grid; gap: 5px; color: #68788e; font-size: 11px; }
.place-menu label.wide { grid-column: 1 / -1; }
.place-menu select, .place-menu input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; color: var(--ink); background: white; font-size: 12px; }
.place-menu-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 11px; }
.place-menu-actions button { min-height: 35px; border-radius: 7px; font-size: 12px; font-weight: 700; }
.field-grid { display: grid; gap: 12px; margin: 17px 0; }
.field { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; color: #54657e; font-size: 12px; }
.field label { display: flex; align-items: center; gap: 7px; }
.field svg { width: 17px; color: #4771a4; }
.field select, .field input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; color: var(--ink); background: white; font-size: 12px; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary-btn, .danger-btn { min-height: 39px; border-radius: 7px; background: white; border: 1px solid var(--line); color: #37506d; font-size: 12px; font-weight: 700; }
.secondary-btn { color: var(--blue); border-color: #b8d3fa; background: #f7fbff; }
.danger-btn { color: var(--danger); border-color: #f2c9cc; }

.add-dialog { padding: 0; border: 0; border-radius: 13px; width: min(590px, calc(100vw - 28px)); box-shadow: var(--shadow); color: var(--ink); }
.add-dialog::backdrop { background: rgba(16,35,63,.28); backdrop-filter: blur(2px); }
.dialog-shell { padding: 0; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px 13px; }
.dialog-header h2 { margin: 0 0 4px; font-size: 19px; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 12px; }
.dialog-tabs { padding: 0 22px; border-bottom: 1px solid var(--line); display: flex; gap: 26px; }
.dialog-tabs button { height: 39px; padding: 0; border: 0; background: transparent; color: #607089; position: relative; font-size: 13px; font-weight: 650; }
.dialog-tabs button.active { color: var(--blue); }
.dialog-tabs button.active::after { content: ""; position: absolute; height: 2px; bottom: -1px; left: 0; right: 0; background: var(--blue); }
.add-view { padding: 18px 22px 23px; }
.add-view.hidden { display: none; }
.search-box.large { margin: 0; height: 44px; }
.search-box.large input { min-width: 0; width: 0; }
.search-box.large button { border: 0; border-radius: 6px; background: var(--blue); color: white; padding: 7px 13px; font-size: 12px; font-weight: 700; }
.search-hint { padding: 22px; text-align: center; font-size: 12px; color: var(--muted); }
.poi-results { max-height: 300px; overflow: auto; }
.poi-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 10px 5px; border-bottom: 1px solid #edf1f5; }
.poi-icon { width: 35px; height: 35px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 800; }
.poi-copy strong { display: block; font-size: 13px; }
.poi-copy span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.poi-add { border: 1px solid #b8d3fa; color: var(--blue); background: #f7fbff; border-radius: 7px; padding: 7px 11px; font-size: 12px; font-weight: 700; }
.manual-note { font-size: 12px; color: var(--muted); margin-bottom: 16px; line-height: 2; }
.manual-note span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 750; margin-right: 4px; }
.add-view > label:not(.search-box) { display: grid; gap: 7px; margin-bottom: 13px; color: #52637b; font-size: 12px; font-weight: 650; }
.add-view > label:not(.search-box) input, .add-view > label:not(.search-box) select { height: 40px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; background: white; }
.add-view .secondary-btn { width: 100%; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%,20px); z-index: 50; padding: 10px 15px; border-radius: 8px; background: #152b45; color: white; font-size: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 300px minmax(400px, 1fr); }
  .detail-panel { position: fixed; z-index: 25; right: 0; top: var(--header-h); bottom: 0; width: 350px; box-shadow: -12px 0 35px rgba(24,55,83,.14); transform: translateX(105%); transition: transform .25s; }
  .detail-panel.open { transform: translateX(0); }
  .brand span:last-child { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: 112px; }
  .topbar { height: var(--header-h); padding: 0 12px; flex-wrap: wrap; align-content: center; gap: 7px 12px; }
  .brand { height: 48px; }
  .top-actions { height: 48px; }
  .view-tabs { order: 3; width: 100%; height: 43px; overflow-x: auto; }
  .view-tab { flex: 1; min-width: 65px; }
  .weather-switch { display: none; }
  .live-weather { min-width: 0; max-width: 150px; padding: 6px 8px; }
  .live-weather span { display: none; }
  .live-weather strong { overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .primary-btn { padding: 0 12px; }
  .app-shell { display: block; position: relative; }
  .app-shell { position: fixed; }
  .map-stage { position: absolute; inset: 0; height: auto; }
  .places-panel { position: fixed; z-index: 22; left: 8px; right: 8px; bottom: 8px; height: 44vh; border: 0; border-radius: 13px; box-shadow: var(--shadow); overflow: hidden; }
  .panel-heading { height: 54px; }
  .category-tabs { display: none; }
  .search-box { height: 37px; }
  .detail-panel { top: var(--header-h); width: 100%; }
  .map-toolbar { top: 10px; right: 10px; }
  .route-summary { left: 12px; bottom: calc(44vh + 18px); }
  .custom-marker.show-label:not(.selected) .marker-label { display: none; }
  .place-menu { left: 12px !important; right: 12px !important; bottom: 12px !important; top: auto !important; width: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
