:root {
  --paper: #f5f1e8; --surface: #fffdf8; --ink: #20211f; --muted: #6c6d66;
  --line: #d8d3c8; --red: #d94f3d; --green: #24745d; --yellow: #c98d1d;
  --blue: #3576a8; --violet: #765590; --coral: #d36b4b;
  --shadow: 0 10px 28px rgba(37,35,29,.14);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing: 0; overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
.app { display: grid; grid-template-rows: auto auto auto minmax(0,1fr); height: 100dvh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 18px; background: rgba(245,241,232,.97); border-bottom: 1px solid var(--line); z-index: 1000; }
.brand { min-width: 0; }
.brand h1 { margin: 0; font-family: Georgia,"Times New Roman",serif; font-size: clamp(24px,3vw,38px); font-weight: 500; line-height: 1; letter-spacing: 0; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.top-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.icon-button:hover { border-color: var(--ink); }
.icon-button.active { color: white; background: var(--blue); border-color: var(--blue); }
.icon-button svg { width: 19px; height: 19px; }
.day-tabs, .category-bar { display: flex; align-items: center; gap: 6px; padding: 8px 18px; overflow-x: auto; scrollbar-width: thin; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 900; }
.day-tab, .category-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: max-content; height: 34px; padding: 0 11px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.day-tab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tab-color,var(--ink)); }
.day-tab:hover, .category-toggle:hover { background: var(--paper); }
.day-tab.active, .category-toggle.active { color: var(--ink); background: var(--paper); border-color: var(--line); }
.category-toggle svg { width: 15px; height: 15px; color: var(--cat-color); }
.category-toggle:not(.active) { opacity: .48; }
.category-label { min-width: max-content; margin-right: 3px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.workspace { display: grid; grid-template-columns: minmax(400px,480px) minmax(0,1fr); min-height: 0; }
.panel { min-height: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
.day-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.day-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--active-color,var(--red)); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.day-kicker::before { content: ""; width: 24px; height: 3px; background: currentColor; }
.day-head h2 { margin: 0; font-family: Georgia,"Times New Roman",serif; font-size: 29px; font-weight: 500; line-height: 1.08; letter-spacing: 0; }
.day-summary { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.52; }
.day-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 800; }
.day-meta span { display: inline-flex; align-items: center; gap: 6px; }
.day-meta svg { width: 15px; height: 15px; }
.notice { display: flex; gap: 10px; margin: 16px 24px 0; padding: 12px 13px; color: #503c16; background: #fff2cd; border-left: 4px solid var(--yellow); font-size: 12px; line-height: 1.45; }
.notice svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.cluster-list { padding: 18px 24px 34px; }
.cluster-block { position: relative; display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 12px; padding-bottom: 24px; }
.cluster-block:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 41px; bottom: 0; width: 2px; background: var(--active-color,var(--red)); opacity: .22; }
.cluster-number { display: grid; place-items: center; width: 40px; height: 40px; color: white; background: var(--active-color,var(--red)); border: 3px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--active-color,var(--red)); font-size: 14px; font-weight: 900; z-index: 1; }
.cluster-period { display: block; margin: 0 0 3px; color: var(--active-color,var(--red)); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.cluster-title { margin: 0; font-size: 17px; line-height: 1.25; letter-spacing: 0; }
.cluster-copy { margin: 6px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.48; }
.cluster-metrics { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 0 0 13px; color: #555750; font-size: 10px; font-weight: 800; }
.cluster-metrics span { display: inline-flex; align-items: center; gap: 4px; }
.cluster-metrics svg { width: 13px; height: 13px; color: var(--active-color,var(--red)); }
.place-group + .place-group { margin-top: 13px; }
.place-group-label { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.place-group-label::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.place-row { display: grid; grid-template-columns: 29px minmax(0,1fr) auto auto; align-items: center; gap: 7px; min-height: 42px; padding: 5px 4px; border-radius: 5px; cursor: pointer; }
.place-row:hover, .place-row:focus-visible { background: var(--paper); outline: none; }
.place-icon { display: grid; place-items: center; width: 29px; height: 29px; color: white; background: var(--cat-color); border-radius: 50%; }
.place-row.nearby .place-icon { color: var(--cat-color); background: white; border: 1px solid var(--cat-color); }
.place-row.unassigned .place-icon { color: white; background: #777a77; border: 1px solid #777a77; }
.place-icon svg { width: 15px; height: 15px; }
.place-name { min-width: 0; font-size: 12px; font-weight: 800; line-height: 1.25; }
.place-estimate { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; }
.place-estimate svg { width: 11px; height: 11px; }
.place-note { margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.map-link, .navigate-link { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.map-link:hover, .navigate-link:hover { color: var(--ink); background: var(--paper); }
.navigate-link { color: var(--blue); }
.map-link svg, .navigate-link svg { width: 15px; height: 15px; }
.fixed-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 5px; padding: 2px 5px; color: #8d3428; background: #fff0ec; border: 1px solid #e7aaa1; border-radius: 4px; font-size: 9px; font-weight: 900; white-space: nowrap; }
.map-wrap { position: relative; min-width: 0; min-height: 0; background: #d9ddd8; }
#map { width: 100%; height: 100%; }
.location-status { position: absolute; top: 12px; left: 50%; width: max-content; max-width: calc(100% - 28px); transform: translateX(-50%); padding: 9px 12px; color: white; background: rgba(32,33,31,.92); border-radius: 5px; box-shadow: var(--shadow); font-size: 11px; font-weight: 800; text-align: center; z-index: 800; }
.location-status.with-navigation { top: 82px; }
.location-status.error { background: #923b30; }
.navigation-panel { position: absolute; top: 12px; left: 12px; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 10px; width: min(560px,calc(100% - 24px)); padding: 10px; color: var(--ink); background: rgba(255,253,248,.97); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 6px; box-shadow: var(--shadow); z-index: 700; }
.navigation-icon { display: grid; place-items: center; width: 36px; height: 36px; color: white; background: var(--blue); border-radius: 50%; }
.navigation-icon svg { width: 18px; height: 18px; }
.navigation-copy { display: grid; min-width: 0; }
.navigation-copy span { color: var(--blue); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.navigation-copy strong { overflow: hidden; margin-top: 2px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.navigation-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.navigation-actions { display: flex; gap: 3px; }
.navigation-actions button, .navigation-actions a { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--ink); background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.navigation-actions button:hover, .navigation-actions a:hover { background: var(--paper); }
.navigation-actions svg { width: 16px; height: 16px; }
.user-location-marker { position: relative; display: grid; place-items: center; width: 28px; height: 28px; background: rgba(36,104,162,.2); border-radius: 50%; }
.user-location-marker::before { content: ""; position: absolute; inset: 1px; border: 2px solid rgba(36,104,162,.4); border-radius: 50%; animation: location-pulse 2s ease-out infinite; }
.user-location-marker span { width: 14px; height: 14px; background: #2468a2; border: 3px solid white; border-radius: 50%; box-shadow: 0 2px 7px rgba(0,0,0,.28); z-index: 1; }
@keyframes location-pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.45); opacity: 0; } }
.map-key { position: absolute; left: 12px; bottom: 24px; display: flex; flex-wrap: wrap; gap: 10px 14px; max-width: calc(100% - 82px); padding: 8px 10px; color: var(--muted); background: rgba(255,253,248,.95); border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--shadow); font-size: 10px; font-weight: 800; pointer-events: none; z-index: 500; }
.map-key span { display: inline-flex; align-items: center; gap: 6px; }
.key-dot { width: 14px; height: 14px; border-radius: 50%; }
.key-dot.planned { background: var(--red); border: 2px solid white; box-shadow: 0 0 0 1px var(--red); }
.key-dot.nearby { background: white; border: 1px solid var(--red); }
.key-dot.unassigned { background: #777a77; border: 2px solid white; box-shadow: 0 0 0 1px #777a77; }
.key-cluster { display: grid; place-items: center; width: 18px; height: 18px; color: white; background: var(--ink); border-radius: 50%; font-size: 9px; }
.category-marker { display: grid; place-items: center; width: 31px !important; height: 31px !important; margin: 0 !important; color: white; background: var(--cat-color); border: 3px solid white; border-radius: 50%; box-shadow: 0 3px 11px rgba(0,0,0,.25); }
.category-marker.nearby { color: var(--cat-color); background: rgba(255,253,248,.96); border: 1px solid var(--cat-color); opacity: .88; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.category-marker.unassigned { color: white; background: #777a77; border-color: white; opacity: .86; z-index: 1; }
.category-marker svg { width: 15px; height: 15px; }
.category-marker.fixed::after { content: ""; position: absolute; right: -2px; top: -2px; width: 8px; height: 8px; background: #fff; border: 3px solid var(--red); border-radius: 50%; }
.cluster-marker { display: grid; place-items: center; width: 38px !important; height: 38px !important; margin: 0 !important; color: white; background: var(--cluster-color); border: 3px solid white; border-radius: 50%; box-shadow: 0 5px 16px rgba(0,0,0,.28); font: 900 14px/1 Inter,ui-sans-serif,system-ui,sans-serif; }
.leaflet-popup-content-wrapper { border-radius: 6px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 13px 15px; font-family: Inter,ui-sans-serif,system-ui,sans-serif; }
.popup-kicker { color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.popup-title { margin: 3px 0 6px; font-size: 14px; font-weight: 900; }
.popup-note { margin-bottom: 7px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.popup-actions { display: flex; align-items: center; gap: 12px; }
.popup-navigate { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; color: white; background: var(--blue); border: 0; border-radius: 4px; font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
.popup-navigate svg { width: 13px; height: 13px; }
.popup-link { color: var(--ink); font-size: 11px; font-weight: 900; }
.overview { padding: 18px 24px 34px; }
.overview-intro { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.overview-day { display: grid; grid-template-columns: 54px minmax(0,1fr) 24px; align-items: start; gap: 11px; padding: 13px 0; border-top: 1px solid var(--line); cursor: pointer; }
.overview-date { color: var(--day-color); font-size: 12px; font-weight: 900; }
.overview-day h3 { margin: 0; font-size: 14px; }
.overview-day p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.overview-day > svg { width: 16px; height: 16px; color: var(--muted); margin-top: 3px; }
.decision { margin-top: 22px; padding-top: 18px; border-top: 2px solid var(--ink); }
.decision h3 { margin: 0 0 10px; font-family: Georgia,"Times New Roman",serif; font-size: 21px; font-weight: 500; }
.decision p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.unassigned-list { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.unassigned-list h3 { margin: 0 0 5px; font-size: 14px; }
.unassigned-list > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
@media (max-width:780px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto auto; }
  .topbar { padding: 11px 13px; }
  .top-actions { gap: 5px; }
  .icon-button { width: 36px; height: 36px; }
  #print-plan { display: none; }
  .brand h1 { font-size: 23px; }
  .brand p { font-size: 9px; }
  .day-tabs, .category-bar { padding: 7px 12px; }
  .category-label { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 44dvh auto; }
  .map-wrap { grid-row: 1; min-height: 330px; }
  .panel { grid-row: 2; overflow: visible; border-right: 0; }
  .day-head { padding: 19px 18px 15px; }
  .day-head h2 { font-size: 26px; }
  .notice { margin: 15px 18px 0; }
  .cluster-list, .overview { padding: 17px 18px 30px; }
  .map-key { left: 9px; bottom: 23px; gap: 7px 10px; padding: 7px 8px; }
  .navigation-panel { top: 9px; left: 9px; width: calc(100% - 18px); grid-template-columns: 32px minmax(0,1fr) auto; gap: 7px; padding: 8px; }
  .location-status.with-navigation { top: 76px; }
  .navigation-icon { width: 32px; height: 32px; }
  .navigation-actions button, .navigation-actions a { width: 29px; height: 29px; }
  .navigation-copy strong { font-size: 12px; }
}
@media print {
  body { overflow: visible; background: white; }
  .app { display: block; height: auto; }
  .top-actions, .day-tabs, .category-bar, .map-wrap { display: none; }
  .panel { overflow: visible; border: 0; }
  .topbar { border: 0; padding: 0 0 18px; }
  .day-head, .cluster-list { padding-left: 0; padding-right: 0; }
}
