:root {
  color-scheme: light;
  --ink: #132238;
  --ink-soft: #415067;
  --paper: #f7f5ef;
  --panel: #fffdf9;
  --line: #dedbd2;
  --line-dark: #b8b5ad;
  --accent: #ff6546;
  --accent-dark: #df4528;
  --blue: #2d6cdf;
  --shadow: 0 20px 55px rgba(19, 34, 56, .18);
  --header-h: 72px;
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(45, 108, 223, .35);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 15px 15px 15px 4px;
  background: var(--accent);
  color: white;
  font: 800 1.55rem/1 Georgia, serif;
  box-shadow: 0 10px 24px rgba(255, 101, 70, .28);
}

.brand-mark.small { width: 40px; height: 40px; border-radius: 12px 12px 12px 3px; font-size: 1.15rem; }

.login-screen { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(360px, .95fr); }
.login-visual { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: clamp(36px, 7vw, 92px); background: var(--ink); color: white; }
.login-visual::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 72% 26%, rgba(255,101,70,.22), transparent 26%), linear-gradient(145deg, transparent 45%, rgba(255,255,255,.04)); }
.login-visual p { position: relative; z-index: 2; margin: 0; font: 400 clamp(3.2rem, 7vw, 7.7rem)/.88 Georgia, serif; letter-spacing: -.06em; }
.globe-grid { position: absolute; z-index: 1; width: min(62vw, 720px); aspect-ratio: 1; left: 42%; top: -20%; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; background: repeating-radial-gradient(circle at center, transparent 0 50px, rgba(255,255,255,.07) 51px 52px), repeating-linear-gradient(90deg, transparent 0 72px, rgba(255,255,255,.06) 73px 74px); transform: rotate(-12deg); }
.route { position: absolute; z-index: 2; width: 360px; height: 160px; border-top: 2px dashed rgba(255,255,255,.45); border-radius: 50%; transform: rotate(-22deg); }
.route-a { left: 30%; top: 25%; }
.route-b { right: -4%; top: 44%; transform: rotate(24deg); }
.visual-pin { position: absolute; z-index: 3; width: 22px; height: 22px; border: 6px solid var(--accent); background: white; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.pin-a { left: 52%; top: 21%; }
.pin-b { right: 15%; top: 39%; }
.pin-c { left: 37%; top: 47%; }
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--panel); }
.login-card { width: min(100%, 430px); }
.login-card h1 { margin: 18px 0 6px; font: 700 clamp(2.8rem, 5vw, 4.5rem)/1 Georgia, serif; letter-spacing: -.055em; }
.login-copy { margin: 0 0 36px; color: var(--ink-soft); }
.login-card label { display: block; margin: 0 0 18px; }
.login-card label span, .field > span { display: flex; justify-content: space-between; margin: 0 0 7px; color: var(--ink-soft); font-size: .88rem; font-weight: 700; }
.login-card input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 12px 13px; color: var(--ink);
}
.login-card input { padding: 14px; }
.login-card input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,108,223,.1); outline: none; }
.form-error { min-height: 24px; margin: -3px 0 8px; color: #b62e1a; font-size: .88rem; }
.login-button { width: 100%; min-height: 50px; }
.legal-links { display: flex; justify-content: center; gap: 18px; margin-top: 22px; font-size: .8rem; }
.legal-links a { color: var(--ink-soft); }

.app { height: 100dvh; }
.topbar { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.96); }
.brand-lockup { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font: 700 1.25rem/1 Georgia, serif; letter-spacing: -.03em; }
.brand-lockup span { margin-top: 5px; color: var(--ink-soft); font-size: .64rem; font-weight: 700; letter-spacing: .16em; }
.brand-menu-icon, .mobile-sidebar-close, .mobile-sidebar-backdrop { display: none; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.place-count { margin-right: 12px; color: var(--ink-soft); font-size: .73rem; font-weight: 800; letter-spacing: .12em; }
.workspace { height: calc(100dvh - var(--header-h)); display: grid; grid-template-columns: 430px 1fr; min-height: 0; }
.sidebar { display: flex; min-height: 0; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); box-shadow: 10px 0 35px rgba(19,34,56,.06); z-index: 3; }
.search-block { padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.search-form { display: grid; grid-template-columns: 1fr auto; overflow: hidden; border: 1px solid var(--ink); border-radius: 11px; background: white; box-shadow: 0 5px 16px rgba(19,34,56,.06); }
.search-form input { min-width: 0; border: 0; padding: 13px 14px; outline: none; }
.search-form button { border: 0; border-left: 1px solid var(--ink); background: var(--ink); color: white; padding: 0 18px; font-weight: 700; }
.search-form:focus-within { box-shadow: 0 0 0 3px rgba(45,108,223,.14); }
.search-hint { margin: 8px 2px 0; color: #727b89; font-size: .75rem; }
.view-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 0 24px; border-bottom: 1px solid var(--line); }
.tab { position: relative; border: 0; background: transparent; padding: 16px 8px 13px; color: #77808d; font-weight: 700; }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.panel-view { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 18px 8px; }
.filter-grid select, .filter-grid input { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 9px 10px; color: var(--ink); font-size: .82rem; }
.filter-grid .filter-wide { grid-column: 1 / -1; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 20px 9px; color: var(--ink-soft); font-size: .78rem; }
.place-list { padding: 0 12px 24px; }
.month-group + .month-group { margin-top: 8px; }
.month-heading { position: sticky; z-index: 1; top: 0; margin: 0 -12px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.96); padding: 10px 20px 8px; color: var(--ink-soft); font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.place-card { position: relative; width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; border: 1px solid transparent; border-bottom-color: var(--line); background: transparent; padding: 15px 9px; text-align: left; color: var(--ink); }
.place-card:hover, .place-card.is-active { border-color: var(--line); border-radius: 12px; background: white; box-shadow: 0 8px 24px rgba(19,34,56,.07); }
.place-card.is-active { border-color: color-mix(in srgb, var(--category-color) 55%, white); }
.place-card.is-route-selected { border-color: #2d6cdf; border-radius: 12px; background: #f4f7ff; box-shadow: inset 0 0 0 1px rgba(45,108,223,.12); }
.category-dot { width: 11px; height: 11px; margin-top: 6px; border: 3px solid white; outline: 2px solid var(--category-color); border-radius: 50%; background: var(--category-color); }
.category-dot.route-sequence { display: grid; width: 23px; height: 23px; margin-top: 0; place-items: center; outline-color: #2d6cdf; background: #2d6cdf; color: white; font-size: .66rem; font-weight: 900; }
.place-card strong { display: block; font-size: .98rem; line-height: 1.35; }
.place-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.place-card-badges span { border: 1px solid #d9dce1; border-radius: 999px; background: #f6f7f8; padding: 2px 7px; color: #596579; font-size: .66rem; font-weight: 800; }
.place-card-meta { margin-top: 5px; color: #687385; font-size: .75rem; line-height: 1.5; }
.place-card-note { display: block; overflow: hidden; max-height: 0; margin-top: 0; color: #35445a; font-size: .8rem; line-height: 1.55; opacity: 0; transform: translateY(-4px); transition: max-height .2s ease, margin .2s ease, opacity .2s ease, transform .2s ease; white-space: pre-wrap; }
.place-card:hover .place-card-note, .place-card:focus-visible .place-card-note, .place-card.is-active .place-card-note { max-height: 160px; margin-top: 8px; opacity: 1; transform: translateY(0); }
.place-card-arrow { color: #9da3ad; font-size: 1.1rem; }
.empty-state { padding: 50px 22px; text-align: center; color: #737c89; }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--ink); font: 700 1.18rem/1.3 Georgia, serif; }
.inline-status { margin: 18px; border: 1px dashed var(--line-dark); border-radius: 10px; padding: 14px; color: var(--ink-soft); font-size: .84rem; }
.inline-status.is-loading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
.sns-place-form { padding: 22px 20px 28px; }
.sns-place-heading { margin-bottom: 20px; }
.sns-place-heading h2 { margin: 5px 0 8px; font: 700 1.35rem/1.25 Georgia, serif; letter-spacing: -.03em; }
.sns-place-heading > p:last-child { margin: 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.55; }
.sns-place-form textarea { min-height: 210px; resize: vertical; }
.sns-place-form .compact-status { margin: 12px 0; }
.sns-place-submit { width: 100%; }

.map-stage { position: relative; min-width: 0; background: #dfe5e8; }
.map { position: absolute; inset: 0; }
.map-message { position: absolute; z-index: 2; left: 50%; top: 50%; width: min(90%, 390px); transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: 15px; background: white; padding: 24px; box-shadow: var(--shadow); text-align: center; }
.map-message strong, .map-message span { display: block; }
.map-message span { margin-top: 7px; color: var(--ink-soft); font-size: .87rem; }
.map-actions { position: absolute; z-index: 2; top: 18px; right: 18px; display: grid; justify-items: end; gap: 8px; }
.map-action { border: 1px solid var(--ink); border-radius: 9px; background: var(--ink); color: white; padding: 10px 14px; box-shadow: 0 8px 22px rgba(19,34,56,.2); font-weight: 700; }
.secondary-map-action { border-color: rgba(19,34,56,.24); background: rgba(255,255,255,.96); color: var(--ink); }
.secondary-map-action:hover { background: white; }
.map-shortcuts { border: 1px solid rgba(19,34,56,.12); border-radius: 999px; background: rgba(255,255,255,.9); padding: 6px 9px; box-shadow: 0 3px 12px rgba(19,34,56,.08); color: #687385; font-size: .68rem; font-weight: 700; }
.map-legend { position: absolute; z-index: 2; right: 18px; bottom: 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; max-width: min(560px, 80%); }
.legend-chip { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(19,34,56,.14); border-radius: 999px; background: rgba(255,255,255,.94); padding: 6px 9px; box-shadow: 0 3px 12px rgba(19,34,56,.1); color: var(--ink-soft); font-size: .72rem; font-weight: 700; }
.legend-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color); }
.map-pin { display: grid; width: 34px; height: 34px; place-items: center; border: 3px solid white; border-radius: 50% 50% 50% 8px; background: var(--pin-color); box-shadow: 0 5px 14px rgba(19,34,56,.3); color: white; font-size: .72rem; font-weight: 900; transform: rotate(-45deg); }
.map-pin span { transform: rotate(45deg); }
.map-pin.is-active { width: 42px; height: 42px; box-shadow: 0 0 0 6px rgba(255,255,255,.88), 0 0 0 15px rgba(45,108,223,.24), 0 8px 22px rgba(19,34,56,.38); }
.map-pin.is-route-selected { width: 40px; height: 40px; background: #2d6cdf; box-shadow: 0 0 0 5px rgba(255,255,255,.9), 0 0 0 11px rgba(45,108,223,.22), 0 7px 18px rgba(19,34,56,.34); font-size: .86rem; }
.custom-route-pin { --pin-color: #2d6cdf; }
.preview-map-pin { --pin-color: #ff6248; width: 46px; height: 46px; font-size: .6rem; animation: focus-pulse 1.7s ease-in-out infinite; }
.manual-preview-pin { --pin-color: #ff6248; width: 46px; height: 46px; font-size: 1rem; animation: focus-pulse 1.7s ease-in-out infinite; }
.current-location-pin { width: 22px; height: 22px; border: 4px solid white; border-radius: 50%; background: #1687ff; box-shadow: 0 0 0 2px #1687ff, 0 0 0 12px rgba(22,135,255,.18), 0 5px 15px rgba(19,34,56,.3); animation: location-pulse 2s ease-in-out infinite; }
.map-note-card { max-width: 320px; padding: 7px 5px; color: var(--ink); }
.map-note-card strong { display: block; margin-bottom: 7px; font-size: 1.04rem; line-height: 1.4; }
.map-note-card p { margin: 0; color: #35445a; font-size: .92rem; line-height: 1.6; white-space: pre-wrap; }

.primary-button, .secondary-button, .danger-button { min-height: 42px; border-radius: 9px; padding: 9px 16px; font-weight: 800; }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .48; }
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: white; }
.primary-button:hover { background: #213750; }
.secondary-button { border: 1px solid var(--line-dark); background: white; color: var(--ink); }
.danger-button { border: 1px solid #e4aaa0; background: #fff3f0; color: #a83220; }
.text-button, .icon-button, .subtle-button { border: 0; background: transparent; color: var(--ink-soft); }
.text-button { padding: 8px; font-size: .83rem; font-weight: 700; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; font-size: 1.3rem; }
.icon-button:hover, .text-button:hover, .subtle-button:hover { background: #efede7; color: var(--ink); }
.subtle-button { border-radius: 7px; padding: 6px 8px; font-weight: 700; }

.backdrop { position: fixed; z-index: 20; inset: 0; background: transparent; pointer-events: none; }
.drawer { position: fixed; z-index: 21; top: 0; right: 0; width: min(470px, 100%); height: 100dvh; overflow: auto; pointer-events: none; background: var(--panel); box-shadow: -20px 0 60px rgba(19,34,56,.2); transform: translateX(102%); transition: transform .25s ease; }
.drawer.is-open { transform: translateX(0); pointer-events: auto; }
.drawer form { min-height: 100%; display: flex; flex-direction: column; padding: 26px; }
.drawer-header, .dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.drawer-header h2, .dialog-header h2 { margin: 0; font: 700 1.9rem/1 Georgia, serif; letter-spacing: -.04em; }
.drawer-header .icon-button, .dialog-header .icon-button, .drawer-actions button, .dialog-actions button { position: relative; z-index: 2; pointer-events: auto; }
.source-preview { border-left: 4px solid var(--blue); border-radius: 0 10px 10px 0; background: #edf3ff; padding: 13px 14px; margin-bottom: 20px; }
.source-preview span { display: block; color: var(--blue); font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.source-preview strong { display: block; margin-top: 4px; }
.source-preview p { margin: 3px 0 0; color: var(--ink-soft); font-size: .78rem; }
.field { display: block; margin-bottom: 15px; }
.field > span em { color: #8a6b27; font-size: .7rem; font-style: normal; font-weight: 600; }
.field textarea { resize: vertical; min-height: 118px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.section-label { margin: 6px 0 10px; color: var(--ink); font-size: .78rem; font-weight: 900; letter-spacing: .08em; }
.policy-note { margin: -5px 0 16px; color: #737c89; font-size: .72rem; line-height: 1.5; }
.photo-drop-zone { display: grid; place-items: center; gap: 7px; border: 2px dashed #c8ced8; border-radius: 12px; background: #faf9f5; padding: 16px; text-align: center; cursor: pointer; transition: border-color .16s ease, background .16s ease, opacity .16s ease; }
.photo-drop-zone:hover, .photo-drop-zone:focus-visible, .photo-drop-zone.is-dragover { border-color: var(--blue); background: #edf3ff; outline: none; }
.photo-drop-zone.is-processing { opacity: .58; pointer-events: none; }
.photo-drop-zone strong { color: var(--ink); font-size: .86rem; }
.photo-drop-zone > small { color: #687384; font-size: .72rem; line-height: 1.45; }
.photo-drop-zone > input[type="file"] { width: 100%; border: 1px solid var(--line); background: #fff; padding: 8px; font-size: .77rem; cursor: pointer; }
.photo-field > small { display: block; margin-top: 6px; color: #737c89; font-size: .7rem; }
.place-photo-preview { position: relative; overflow: hidden; margin-top: 9px; border: 1px solid var(--line); border-radius: 12px; background: #f1eee8; }
.place-photo-preview img { display: block; width: 100%; max-height: 250px; object-fit: cover; }
.place-photo-preview button { position: absolute; right: 9px; bottom: 9px; min-height: 34px; border-color: rgba(19,34,56,.22); background: rgba(255,255,255,.94); padding: 6px 11px; font-size: .75rem; }
.memo-field { flex: 1; }
.drawer-actions { position: sticky; bottom: -26px; display: flex; gap: 8px; margin: 16px -26px -26px; border-top: 1px solid var(--line); background: rgba(255,253,249,.96); padding: 16px 26px 22px; }
.action-spacer { flex: 1; }

.dialog { width: min(440px, calc(100% - 28px)); border: 0; border-radius: 16px; background: var(--panel); padding: 0; box-shadow: var(--shadow); color: var(--ink); }
.dialog::backdrop { background: rgba(19,34,56,.35); backdrop-filter: blur(3px); }
.dialog form { padding: 24px; }
.compact-status { margin: 10px 0 0; }
.dialog-actions-split { justify-content: space-between; gap: 10px; }
.color-field input { min-height: 48px; padding: 5px; }
.category-list { display: grid; gap: 7px; margin: 18px 0 8px; }
.category-row { display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); padding: 10px 2px 2px; font-size: .85rem; }
.category-row i { width: 10px; height: 10px; border-radius: 50%; background: var(--row-color); }
.category-row span:nth-child(3) { margin-left: auto; color: #78818f; }
.category-edit, .category-delete { border: 0; border-radius: 6px; background: transparent; padding: 5px 6px; font-size: .76rem; font-weight: 800; }
.category-edit { color: var(--blue); }
.category-delete { color: #a83220; }
.category-edit:hover, .category-delete:hover { background: #f1eee8; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.route-place-dialog { width: min(560px, calc(100% - 28px)); }
.route-place-dialog form { max-height: min(760px, calc(100dvh - 36px)); overflow: auto; }
.route-place-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 7px; }
.route-place-search-row input { min-width: 0; }
.route-place-search-row button { min-width: 76px; padding: 10px 14px; }
.route-place-saved-header { display: grid; grid-template-columns: auto minmax(160px, 1fr); align-items: center; gap: 12px; margin: 20px 0 8px; }
.route-place-saved-header strong { font-size: .85rem; }
.route-place-saved-header input { min-width: 0; padding: 9px 10px; font-size: .8rem; }
.route-place-options { display: grid; gap: 6px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #faf9f6; padding: 6px; }
.route-place-option { display: grid; gap: 3px; width: 100%; border: 1px solid transparent; border-radius: 8px; background: white; padding: 10px 11px; color: var(--ink); text-align: left; }
.route-place-option:hover, .route-place-option:focus-visible { border-color: var(--blue); background: #edf3ff; outline: none; }
.route-place-option strong { overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.route-place-option small { overflow: hidden; color: #6f7987; font-size: .72rem; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.route-place-empty { margin: 0; padding: 18px 10px; color: #7a8390; font-size: .8rem; text-align: center; }
.place-detail { position: absolute; z-index: 6; left: 18px; top: 18px; width: min(390px, calc(100% - 36px)); border: 1px solid rgba(19,34,56,.18); border-radius: 18px; background: rgba(255,253,249,.98); padding: 18px; box-shadow: 0 18px 52px rgba(19,34,56,.24); backdrop-filter: blur(10px); }
.mobile-sheet-handle { display: none; }
.place-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.place-detail-kicker { display: block; margin-bottom: 5px; color: var(--accent-dark); font-size: .7rem; font-weight: 900; letter-spacing: .08em; }
.place-detail h2 { margin: 0; font: 700 1.55rem/1.2 Georgia, serif; letter-spacing: -.035em; }
.place-detail-header .icon-button { width: 32px; height: 32px; flex: 0 0 auto; }
.place-detail-photo { display: block; width: calc(100% + 36px); max-height: 230px; margin: 14px -18px 0; object-fit: cover; }
.place-detail-location { margin: 13px 0 0; color: #5f6b7d; font-size: .82rem; line-height: 1.55; }
.place-detail-memo { max-height: 150px; overflow: auto; margin: 13px 0 0; border-radius: 11px; background: #f5f2ec; padding: 12px; color: #314057; font-size: .9rem; line-height: 1.65; white-space: pre-wrap; }
.place-detail-memo.is-empty { color: #7a8390; font-style: italic; }
.place-detail-route-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 14px; }
.place-detail-route-actions button { min-height: 42px; border: 1px solid #ccd5e4; border-radius: 10px; background: white; color: var(--ink); font-size: .82rem; font-weight: 900; }
.place-detail-route-actions button:hover { border-color: var(--blue); background: #edf3ff; color: var(--blue); }
.place-detail-route-actions button:first-child span { color: #13a05f; }
.place-detail-route-actions button:nth-child(2) span { color: #7b6b97; }
.place-detail-route-actions button:last-child span { color: #ef4d5c; }
.place-detail-edit { width: 100%; margin-top: 9px; border: 0; border-radius: 9px; background: transparent; padding: 10px; color: #5a6678; font-size: .8rem; font-weight: 800; }
.place-detail-edit:hover { background: #efede7; color: var(--ink); }
.map-context-menu { position: absolute; z-index: 9; width: 210px; overflow: hidden; border: 1px solid #d1d5db; border-radius: 10px; background: white; box-shadow: 0 14px 38px rgba(19,34,56,.25); }
.map-context-heading { border-bottom: 1px solid #e5e7eb; background: #f8f9fb; padding: 9px 13px; color: #687385; font-size: .72rem; font-weight: 900; }
.map-context-separator { border-top: 6px solid #eef0f3; }
.map-context-menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid #eceef1; background: white; padding: 11px 13px; color: #26364d; text-align: left; font-size: .84rem; }
.map-context-menu button:last-child { border-bottom: 0; }
.map-context-menu button:hover, .map-context-menu button:focus-visible { background: #edf3ff; }
.map-context-menu button > span:first-child { display: inline-grid; width: 15px; place-items: center; color: var(--blue); font-weight: 900; }
.context-dot { width: 10px !important; height: 10px; border-radius: 50%; }
.context-dot.start { background: #13a05f; }
.context-dot.via { border-radius: 2px; background: #7b6b97; transform: rotate(45deg); }
.context-dot.destination { background: #ef4d5c; }
.route-planner { position: absolute; z-index: 5; left: 18px; top: 18px; width: min(390px, calc(100% - 150px)); max-height: calc(100% - 36px); overflow: auto; border: 1px solid rgba(19,34,56,.18); border-radius: 16px; background: rgba(255,253,249,.97); padding: 16px; box-shadow: 0 16px 46px rgba(19,34,56,.2); backdrop-filter: blur(8px); }
.route-planner.is-obscured { display: none; }
.route-planner-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.route-planner-header span, .route-planner-header strong { display: block; }
.route-planner-header span { color: var(--blue); font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.route-planner-header strong { margin-top: 4px; font-size: 1rem; }
.route-planner-header .icon-button { width: 30px; height: 30px; flex: 0 0 auto; }
.route-stop-list { max-height: 220px; overflow: auto; margin: 12px 0 8px; border: 1px solid #d5d9df; border-radius: 10px; background: white; padding: 0; list-style: none; }
.route-stop-row { display: grid; grid-template-columns: 24px 13px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 48px; padding: 7px 8px 7px 7px; color: var(--ink-soft); font-size: .8rem; }
.route-stop-row + .route-stop-row { border-top: 1px solid #e5e7eb; }
.route-stop-row.is-editing { background: #edf3ff; box-shadow: inset 3px 0 var(--blue); }
.route-drag-handle { display: grid; width: 24px; height: 30px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #9aa3b0; font-size: 1.15rem; cursor: grab; touch-action: none; }
.route-drag-handle:hover, .route-drag-handle:focus-visible { background: #edf0f4; color: var(--blue); }
.route-drag-handle:active { cursor: grabbing; }
.route-drag-handle:disabled { opacity: .28; cursor: default; }
.route-stop-dragging { user-select: none; }
.route-stop-dragging .route-stop-row { transition: transform .12s ease, background .12s ease; }
.route-stop-marker { width: 9px; height: 9px; border: 2px solid currentColor; border-radius: 50%; background: white; }
.route-stop-row.is-start .route-stop-marker { color: #13a05f; }
.route-stop-row.is-via .route-stop-marker { border-radius: 2px; color: #7b6b97; transform: rotate(45deg); }
.route-stop-row.is-destination .route-stop-marker { color: #ef4d5c; }
.route-stop-row strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.route-stop-row strong.is-empty { color: #8a93a0; font-weight: 600; }
.route-stop-actions { display: flex; align-items: center; gap: 2px; }
.route-stop-actions button { min-width: 34px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: #687385; font-size: .72rem; font-weight: 800; }
.route-stop-actions button[data-route-action="remove"] { min-width: 28px; color: #9b3d32; font-size: 1.05rem; }
.route-stop-actions button:hover { background: #edf0f4; color: var(--blue); }
.route-edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 11px; }
.route-edit-actions button { min-height: 34px; border: 1px solid #d3d8df; border-radius: 8px; background: white; color: #526075; font-size: .75rem; font-weight: 800; }
.route-edit-actions button:hover, .route-edit-actions button.is-active { border-color: var(--blue); background: #edf3ff; color: var(--blue); }
.route-edit-actions button:disabled { cursor: not-allowed; opacity: .45; }
.route-mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 2px 0 12px; padding: 4px; border-radius: 11px; background: #eef2f7; }
.route-mode-selector button { min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: #637084; font-size: .78rem; font-weight: 800; cursor: pointer; }
.route-mode-selector button.is-active { background: white; color: var(--blue); box-shadow: 0 2px 8px rgba(19,34,56,.12); }
.route-mode-selector button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.route-status { min-height: 20px; margin: 0 0 12px; color: #687385; font-size: .75rem; line-height: 1.45; }
.route-status.is-loading::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; border: 2px solid #ccd5e4; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
.route-planner-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.route-planner-actions button { min-height: 40px; padding: 8px 10px; font-size: .76rem; }
.route-guidance { margin: 16px -16px -16px; border-top: 8px solid #eef0f3; background: #fffdf9; padding: 17px 16px 20px; }
.route-guidance-header span { color: var(--accent); font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.route-guidance-header h3 { margin: 5px 0 17px; font: 700 1.25rem/1.2 Georgia, serif; }
.transit-summary { margin: -8px 0 18px; border-radius: 11px; background: #f3effb; padding: 12px 14px; color: #574372; font-size: .86rem; font-weight: 800; line-height: 1.5; }
.transit-itinerary { display: grid; gap: 18px; }
.transit-leg { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: white; }
.transit-leg-header { display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); background: #faf8f4; padding: 11px 13px; }
.transit-leg-header span { display: grid; width: 23px; height: 23px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--blue); color: white; font-size: .7rem; font-weight: 900; }
.transit-leg-header strong { min-width: 0; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.transit-step-list { margin: 0; padding: 0; list-style: none; }
.transit-step { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 13px; }
.transit-step + .transit-step { border-top: 1px dashed #dfe3e9; }
.transit-step-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: #edf3ff; color: var(--blue); font-size: 1rem; }
.transit-step.is-transit .transit-step-icon { background: #f1e9ff; color: #6740b2; }
.transit-step.is-driving .transit-step-icon { background: #e9f3ff; color: #1565c0; font-size: 1.2rem; font-weight: 900; }
.transit-step-copy { min-width: 0; }
.transit-step-copy strong { display: block; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.transit-step-copy p { margin: 4px 0 0; color: #48566b; font-size: .82rem; line-height: 1.55; }
.transit-step-copy small { display: block; margin-top: 5px; color: #7a8390; font-size: .72rem; line-height: 1.45; }
.transit-empty { margin: 0; border: 1px dashed #cfd6e1; border-radius: 11px; padding: 18px; color: #687385; font-size: .84rem; text-align: center; }
.transit-notice { margin-top: 16px; }
.share-confirm-card { position: absolute; z-index: 5; left: 50%; bottom: 28px; width: min(620px, calc(100% - 40px)); transform: translateX(-50%); border: 1px solid rgba(19,34,56,.2); border-radius: 16px; background: rgba(255,253,249,.97); padding: 18px; box-shadow: 0 16px 46px rgba(19,34,56,.24); backdrop-filter: blur(8px); }
.share-confirm-copy { min-width: 0; }
.share-confirm-kicker { display: block; margin-bottom: 5px; color: var(--accent); font-size: .68rem; font-weight: 900; letter-spacing: .1em; }
.share-confirm-copy strong { display: block; overflow: hidden; font-size: 1.1rem; text-overflow: ellipsis; white-space: nowrap; }
.share-confirm-copy p { margin: 4px 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.45; }
.share-confirm-copy small { color: #7a8390; }
.share-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; max-width: min(480px, calc(100% - 28px)); transform: translate(-50%, 130%); border-radius: 10px; background: var(--ink); color: white; padding: 11px 16px; box-shadow: var(--shadow); opacity: 0; transition: .2s ease; font-size: .87rem; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: #9d2e1e; }

.legal-page { min-height: 100%; overflow: auto; background: var(--paper); padding: 52px 22px; }
.legal-document { width: min(760px, 100%); margin: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: clamp(26px, 6vw, 58px); box-shadow: 0 18px 48px rgba(19,34,56,.08); }
.legal-document h1 { font: 700 2.2rem/1.1 Georgia, serif; }
.legal-document h2 { margin-top: 30px; font-size: 1.1rem; }
.legal-document p, .legal-document li { color: var(--ink-soft); }
.back-link { color: var(--blue); font-weight: 700; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes focus-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255,255,255,.9), 0 0 0 14px rgba(255,98,72,.2), 0 8px 22px rgba(19,34,56,.38); }
  50% { box-shadow: 0 0 0 7px rgba(255,255,255,.96), 0 0 0 24px rgba(255,98,72,.08), 0 10px 28px rgba(19,34,56,.42); }
}
@keyframes location-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #1687ff, 0 0 0 8px rgba(22,135,255,.18), 0 5px 15px rgba(19,34,56,.3); }
  50% { box-shadow: 0 0 0 2px #1687ff, 0 0 0 18px rgba(22,135,255,.05), 0 5px 15px rgba(19,34,56,.3); }
}

@media (max-width: 900px) {
  body { overflow: hidden; }
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100dvh; padding: 28px; }
  .app { height: auto; min-height: 100dvh; }
  .workspace { height: calc(100dvh - var(--header-h)); display: block; }
  .map-stage { height: calc(100dvh - var(--header-h)); min-height: 480px; }
  .sidebar { position: fixed; z-index: 22; top: var(--header-h); bottom: 0; left: 0; width: min(430px, 100%); height: auto; min-height: 0; border-right: 0; box-shadow: 14px 0 40px rgba(19,34,56,.22); transform: translateX(-105%); visibility: hidden; pointer-events: none; transition: transform .22s ease, visibility 0s linear .22s; }
  body.mobile-sidebar-open .sidebar { transform: translateX(0); visibility: visible; pointer-events: auto; transition: transform .22s ease; }
  .sidebar .panel-view { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
  .mobile-sidebar-close { position: absolute; z-index: 5; top: 10px; right: 10px; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,253,249,.96); color: var(--ink); font-size: 1.5rem; box-shadow: 0 4px 14px rgba(19,34,56,.1); }
  .mobile-sidebar-backdrop { position: fixed; z-index: 18; inset: var(--header-h) 0 0; display: block; border: 0; background: rgba(19,34,56,.32); backdrop-filter: blur(2px); }
  .mobile-sidebar-backdrop[hidden] { display: none; }
  .brand-lockup { cursor: pointer; }
  .brand-menu-icon { display: grid !important; width: 30px; height: 30px; margin: 0 0 0 4px !important; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink) !important; font: 800 1rem/1 system-ui, sans-serif !important; letter-spacing: 0 !important; }
  .search-block { padding-right: 58px; }
  body.place-detail-open .sidebar { display: none; }
  body.place-detail-open .workspace { display: block; }
  body.map-context-open .route-planner { display: none; }
  .panel-view { max-height: none; }
  .map-legend { display: none; }
  .mobile-sheet-handle { position: sticky; z-index: 8; top: 0; display: grid; width: calc(100% + 36px); height: 42px; margin: 0 -18px 8px; place-items: center; border: 0; border-radius: 20px 20px 0 0; background: #fffdf9; box-shadow: 0 8px 14px rgba(19,34,56,.07); touch-action: none; }
  .mobile-sheet-handle span { width: 44px; height: 5px; border-radius: 999px; background: #c0c5cc; }
  .route-planner { left: 0; top: auto; bottom: 0; width: 100%; height: var(--route-sheet-height, 50%); max-height: 78%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: 52px; border: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; background: #fffdf9; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); transition: height .22s ease; isolation: isolate; }
  .place-detail { left: 0; top: auto; bottom: 0; width: 100%; height: var(--place-sheet-height, 40%); max-height: 78%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-padding-top: 52px; border: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; background: #fffdf9; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); transition: height .22s ease; isolation: isolate; }
  .route-planner.is-dragging, .place-detail.is-dragging { transition: none; user-select: none; }
  .place-detail-memo { max-height: 82px; }
  .map-context-menu { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: 16px; width: auto; z-index: 25; border-radius: 15px; }
  .route-stop-list { max-height: none; }
  .route-stop-row strong { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  .transit-leg-header { align-items: flex-start; }
  .transit-leg-header strong { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
  .transit-step-copy strong, .transit-step-copy p, .transit-step-copy small { overflow-wrap: anywhere; word-break: keep-all; }
  .route-guidance { margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
  .share-confirm-card { bottom: 14px; width: calc(100% - 24px); }
  .topbar { position: sticky; z-index: 30; top: 0; }
  .drawer {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 52dvh;
    max-height: 560px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 50px rgba(19,34,56,.24);
    transform: translateY(102%);
  }
  .drawer.is-open { transform: translateY(0); }
  .drawer form { height: 100%; min-height: 0; overflow: auto; }
  .drawer-header { position: sticky; z-index: 3; top: -26px; margin: -26px -26px 18px; background: rgba(255,253,249,.97); padding: 22px 26px 14px; border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  :root { --header-h: 64px; }
  .topbar { padding: 0 13px; }
  .brand-lockup > div > span, .place-count { display: none; }
  .search-block { padding: 18px 16px 14px; }
  .view-tabs { padding: 0 16px; }
  .map-stage { height: calc(100dvh - var(--header-h)); min-height: 460px; }
  .map-actions { top: 12px; right: 12px; }
  .map-action { font-size: .8rem; padding: 9px 11px; }
  .drawer form { padding: 20px; }
  .drawer { height: 54dvh; }
  .drawer-header { top: -20px; margin: -20px -20px 16px; padding: 18px 20px 12px; }
  .drawer-actions { bottom: -20px; margin: 14px -20px -20px; padding: 14px 20px 18px; }
  .two-column { grid-template-columns: 1fr; gap: 0; }
  .route-place-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .route-place-dialog form { max-height: calc(100dvh - 20px); padding: 19px 16px; }
  .route-place-saved-header { grid-template-columns: 1fr; gap: 7px; }
  .route-place-options { max-height: 190px; }
  .share-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .share-confirm-actions .primary-button { grid-column: 1 / -1; grid-row: 1; }
}

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