:root {
  color: #222222;
  background: #ffffff;
  font-family: "Noto Sans KR", Circular, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --border: #dddddd;
  --border-soft: #ebebeb;
  --muted: #6a6a6a;
  --muted-soft: #929292;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --surface-strong: #f2f2f2;
  --ink: #222222;
  --body: #3f3f3f;
  --accent: #ff385c;
  --accent-active: #e00b41;
  --accent-soft: #fff0f3;
  --good: #19744b;
  --company: #ff385c;
  --shadow-soft: rgba(0, 0, 0, 0.02) 0 0 0 1px, rgba(0, 0, 0, 0.04) 0 2px 6px 0, rgba(0, 0, 0, 0.10) 0 4px 8px 0;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 34, 34, 0.28) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(34, 34, 34, 0.24);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 34, 34, 0.38);
  background-clip: padding-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #ffffff;
}

button, input { font: inherit; }
button { letter-spacing: 0; }
select, textarea { font: inherit; }
body.modal-open { overflow: hidden; }

.topbar {
  min-height: 80px;
  padding: 12px clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  background: #ffffff;
  border-bottom: 1px solid var(--border-soft);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.23;
}

.brand-block { min-width: 220px; }
.brand-block h1,
.brand-block p {
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.brand-block .is-updating {
  opacity: 0.35;
  transform: translateY(2px);
}

.banner-company-switch {
  min-width: 330px;
  height: 64px;
  padding: 7px 8px 7px 22px;
  display: grid;
  grid-template-columns: auto minmax(190px, 260px);
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.banner-company-switch > span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
}

.summary {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 13px;
}

.summary span { color: var(--muted); }
.summary strong {
  min-width: 58px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 9999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.ranking-toggle {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.ranking-toggle:hover,
.ranking-toggle.is-active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}
.ranking-toggle svg { width: 16px; }

.mobile-filter-toggle {
  height: 44px;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.mobile-filter-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}
.mobile-filter-toggle svg { width: 16px; }

.filter-drawer-header { display: none; }
.filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.28);
}
.filter-backdrop[hidden] { display: none; }
body.filter-open { overflow: hidden; }

main { width: 100%; }

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 316px) minmax(0, 1fr);
  min-height: 740px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-soft);
}

.filters {
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
  background: #ffffff;
}

.search-field {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.search-field:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.search-field svg { width: 18px; color: var(--accent); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; }

.filter-group { margin-top: 24px; }
.filter-group h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
  background: var(--surface-soft);
}

.segmented button {
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 9999px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.segmented button:last-child { border-right: 0; }
.segmented button.is-active { color: #ffffff; background: var(--accent); font-weight: 600; }
.company-toggle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.company-toggle button { height: 42px; }

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
}

.check-list-single { grid-template-columns: 1fr; }

.check-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--body);
  font-size: 13px;
  cursor: pointer;
}

.check-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.check-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.command-button {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.command-button svg { width: 16px; }
.command-button:hover { background: var(--surface-soft); }
.command-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}
.command-button:disabled:hover { background: #ffffff; }
.command-button + .command-button { margin-top: 10px; }
.command-button-accent {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}
.command-button-accent:hover {
  border-color: var(--accent-active);
  background: var(--accent-active);
}
.command-button-soft {
  border-color: var(--border);
  color: var(--ink);
  background: var(--accent-soft);
}
.command-button-soft:hover {
  border-color: var(--accent);
  background: #ffe4ea;
}

.map-shell {
  position: relative;
  min-width: 0;
  height: clamp(740px, 78vh, 940px);
  overflow: hidden;
  border-left: 1px solid var(--border-soft);
}
#map { width: 100%; height: 100%; background: #e8ebed; }

.legend {
  position: absolute;
  z-index: 500;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  font-size: 11px;
}

.legend-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.detail-panel {
  position: absolute;
  z-index: 600;
  top: 12px;
  right: 12px;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: visible;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.detail-close svg { width: 18px; }
.detail-panel h3 { margin: 0 34px 5px 0; font-size: 18px; letter-spacing: 0; }
.detail-panel .detail-category {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.source-badge.is-jarong {
  border-color: #ffc0cb;
  color: var(--accent-active);
  background: var(--accent-soft);
}
.source-badge.is-tmap {
  border-color: #edc56d;
  color: #8c5a00;
  background: #fff7e2;
}
.detail-panel dl { margin: 14px 0; display: grid; grid-template-columns: 64px 1fr; gap: 7px 10px; font-size: 12px; }
.detail-panel dt { color: var(--muted); }
.detail-panel dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions a,
.detail-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #cbd1d6;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.detail-actions button:first-child { border-color: var(--accent); color: #ffffff; background: var(--accent); }
.detail-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.detail-actions svg { width: 14px; }

.route-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  max-height: clamp(180px, calc(100vh - 360px), 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.route-detail[hidden] { display: none; }
.route-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}
.route-detail-header span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}
.route-detail-header h4 {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}
.route-detail-header button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}
.route-detail-header svg { width: 16px; }
.route-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.route-chip {
  min-width: 0;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-soft);
}
.route-chip small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.route-chip b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.route-step-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  list-style: none;
}
.route-step {
  --line-color: var(--accent);
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 6px 10px 2px;
  background: transparent;
}
.route-step::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 26px;
  bottom: -6px;
  width: 2px;
  border-radius: 999px;
  background: var(--line-color);
  opacity: 0.18;
}
.route-step:last-child::before {
  display: none;
}
.route-step-dot {
  width: 10px;
  height: 10px;
  margin: 5px 0 0 2px;
  border-radius: 50%;
  background: var(--line-color);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--line-color) 28%, transparent);
}
.route-step div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.route-step b,
.route-step span,
.route-step small {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.route-step b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.route-step span {
  color: var(--body);
  font-size: 12px;
}
.route-step small {
  color: var(--muted);
  font-size: 11px;
}
.route-step.is-walk,
.route-step.is-walk .route-step-dot {
  --line-color: var(--accent);
}
.route-detail-note,
.route-detail-empty {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.map-pin {
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  pointer-events: auto;
}
.map-pin.is-ranking {
  width: 22px;
  height: 22px;
  border-color: #fff7e2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32), 0 0 0 3px rgba(213, 154, 31, 0.18);
}

.transit-stop-marker {
  --line-color: #2f6fab;
  min-width: 132px;
  max-width: 190px;
  display: grid;
  grid-template-columns: 14px minmax(0, auto);
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transform: translateY(-2px);
}
.transit-stop-dot {
  width: 12px;
  height: 12px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--line-color);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
}
.transit-stop-body {
  min-width: 0;
  padding: 5px 8px 6px;
  display: grid;
  gap: 1px;
  border: 1px solid color-mix(in srgb, var(--line-color) 42%, #ffffff);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}
.transit-stop-body b,
.transit-stop-body small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.18;
}
.transit-stop-body b {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}
.transit-stop-body small {
  color: var(--muted);
  font-size: 10px;
}
.transit-stop-marker.is-alight .transit-stop-body {
  border-style: dashed;
}

.ranking-panel {
  position: absolute;
  z-index: 590;
  right: 12px;
  bottom: 12px;
  width: min(390px, calc(100% - 24px));
  max-height: min(560px, calc(100% - 120px));
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-soft);
}
.ranking-panel[hidden] { display: none; }
.ranking-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.ranking-panel-header span {
  color: #8c5a00;
  font-size: 12px;
  font-weight: 800;
}
.ranking-panel-header h2 {
  margin: 2px 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}
.ranking-panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.ranking-panel-header button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.ranking-panel-header svg { width: 18px; }
.ranking-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-top: 10px;
}
.ranking-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}
.ranking-item:hover { border-color: var(--border); background: var(--surface-soft); }
.ranking-item > strong {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #8c5a00;
  background: #fff7e2;
  font-size: 13px;
  font-weight: 800;
}
.ranking-item span { min-width: 0; display: grid; gap: 2px; }
.ranking-item b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.ranking-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.company-pin {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 14px;
  background: var(--company);
  box-shadow: 0 5px 14px rgba(120, 20, 16, 0.38);
  transform: rotate(-45deg);
}
.company-pin span,
.company-pin img {
  transform: rotate(45deg);
}
.company-pin span {
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}
.company-pin img {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: contain;
  background: #ffffff;
}
.company-pin-payletter {
  background: #222222;
}

.situations { padding: 32px clamp(20px, 4vw, 48px) 48px; background: #ffffff; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: 0; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.section-toggle {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.section-toggle:hover { background: var(--surface-soft); }
.situations.is-collapsed { padding-bottom: 24px; }
.situations.is-collapsed .situation-board { display: none; }
.situation-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.situation-column {
  min-width: 0;
  max-height: 560px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.situation-column-header {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.situation-column-header h3 { margin: 0; min-width: 0; font-size: 16px; font-weight: 600; letter-spacing: 0; }
.situation-column-header span {
  flex: none;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-strong);
  font-size: 11px;
  font-weight: 700;
}
.situation-column > p { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.recommendation-list {
  min-height: 0;
  display: grid;
  grid-auto-rows: minmax(68px, auto);
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}
.recommendation {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 4px 8px;
  align-items: start;
  padding: 11px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  text-align: left;
  color: inherit;
  background: #ffffff;
  cursor: pointer;
  line-height: 1.35;
  box-sizing: border-box;
}
.recommendation:hover { border-color: var(--border); background: var(--surface-soft); box-shadow: var(--shadow-soft); }
.recommendation strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; line-height: 1.35; }
.recommendation span { color: var(--muted); font-size: 12px; line-height: 1.35; white-space: nowrap; }
.recommendation small { grid-column: 1 / -1; color: #596168; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.4; }
.empty-state { color: var(--muted); font-size: 12px; }

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.34);
}
.modal-shell[hidden] { display: none; }

.restaurant-form {
  width: min(820px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  overscroll-behavior: contain;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}
.modal-header p {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.modal-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}
.modal-subtitle {
  display: block;
  margin-top: 6px;
  color: var(--body);
  font-size: 13px;
}
.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-soft); }
.icon-button svg { width: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}
.form-grid label,
.form-grid fieldset {
  min-width: 0;
  margin: 0;
}
.form-grid label {
  display: grid;
  gap: 5px;
}
.form-grid label > span,
.situation-picks legend {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}
.form-grid input:not([type="checkbox"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline: 0;
  font-size: 13px;
}
.form-grid textarea {
  min-height: 66px;
  max-height: 66px;
  resize: none;
  line-height: 1.45;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 56, 92, 0.10);
}
.form-wide { grid-column: 1 / -1; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.checkbox-line {
  min-height: 40px;
  align-self: end;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  padding: 0 2px;
}
.checkbox-line input,
.situation-picks input {
  accent-color: var(--accent);
}
.situation-picks {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.situation-picks legend { padding: 0 4px; }
.situation-picks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--body);
  font-size: 11px;
  white-space: nowrap;
}
.consent-box {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}
.consent-box label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--body);
  font-size: 12px;
  line-height: 1.45;
}
.consent-box input { margin-top: 2px; accent-color: var(--accent); }
.consent-box a { color: var(--accent); font-weight: 800; text-decoration: none; }
.form-message {
  min-height: 16px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.form-message[data-tone="error"] { color: var(--accent-active); }
.form-message[data-tone="success"] { color: var(--good); }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.form-actions button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.secondary-action {
  border: 1px solid var(--border);
  color: var(--ink);
  background: #ffffff;
}
.primary-action {
  border: 1px solid var(--accent);
  color: #ffffff;
  background: var(--accent);
}
.primary-action:disabled {
  opacity: 0.58;
  cursor: wait;
}

.random-panel {
  width: min(560px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.random-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.random-meal-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.random-spin-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.random-spin-button svg { width: 16px; }

.slot-machine {
  margin-top: 18px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}
.slot-window {
  position: relative;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.slot-window::before,
.slot-window::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
}
.slot-window::before {
  top: 0;
  background: linear-gradient(#ffffff, rgba(255, 255, 255, 0));
}
.slot-window::after {
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0), #ffffff);
}
.slot-reel {
  will-change: transform;
}
.slot-reel.is-done .slot-name:last-child strong {
  color: var(--accent);
}
.slot-name {
  height: 56px;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 16px;
  color: var(--ink);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}
.slot-name strong,
.slot-name small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-name small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.random-result {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}
.random-result span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.random-result h3 {
  margin: 4px 0 5px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}
.random-result p,
.random-result small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.random-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.random-result-actions a,
.random-result-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #cbd1d6;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.random-result-actions button {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}
.random-result-actions svg { width: 14px; }

.leaflet-control-attribution { font-size: 9px; }
.leaflet-div-icon { border: 0; background: transparent; }

@media (max-width: 1050px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .brand-block { flex: 1 1 260px; }
  .ranking-toggle { margin-left: auto; }
  .banner-company-switch {
    order: 3;
    width: 100%;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .situation-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: auto;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 8px 10px;
  }
  .topbar h1 { font-size: 16px; }
  .topbar p { display: none; }
  .brand-block {
    flex: 1 1 calc(100% - 132px);
    min-width: 0;
  }
  .summary {
    order: 2;
    margin-left: 0;
  }
  .summary span { display: none; }
  .summary strong { height: 34px; min-width: 50px; padding: 0 11px; }
  .ranking-toggle,
  .mobile-filter-toggle {
    height: 36px;
    padding: 0 11px;
    font-size: 12px;
  }
  .mobile-filter-toggle { display: inline-flex; }
  .ranking-toggle { margin-left: auto; }
  .banner-company-switch {
    order: 4;
    width: 100%;
    height: auto;
    min-height: 50px;
    padding: 6px 7px 6px 14px;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
  }
  .banner-company-switch > span { font-size: 12px; }
  .company-toggle button {
    height: 36px;
    font-size: 12px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 118px);
  }
  .filter-backdrop { z-index: 1280; }
  .filter-drawer-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -2px -2px 12px;
    padding: 2px 0 10px;
    border-bottom: 1px solid var(--border-soft);
    background: #ffffff;
  }
  .filter-drawer-header strong {
    font-size: 16px;
    font-weight: 800;
  }
  .filters {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1350;
    max-height: min(82dvh, 680px);
    overflow-y: auto;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-bottom: 0;
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.18);
    transform: translateY(calc(100% + 16px));
    transition: transform 0.22s ease;
    overscroll-behavior: contain;
  }
  body.filter-open .filters {
    transform: translateY(0);
  }
  .filter-group { margin-top: 14px; }
  .filter-group:nth-of-type(n+3) { display: block; }
  .command-button {
    display: flex;
    min-height: 44px;
    margin-top: 12px;
  }
  .map-shell {
    height: calc(100dvh - 156px);
    min-height: 500px;
    border-top: 1px solid var(--border-soft);
    border-left: 0;
  }
  .legend {
    top: 12px;
    right: 12px;
    bottom: auto;
    left: 12px;
    max-width: calc(100% - 24px);
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .detail-panel {
    top: auto;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    max-height: min(70dvh, 560px);
    overflow: hidden;
    padding: 18px 14px 14px;
    border-radius: 18px;
  }
  .detail-panel::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #d7d7d7;
    transform: translateX(-50%);
  }
  .detail-panel h3 {
    margin-right: 38px;
    font-size: 17px;
    line-height: 1.25;
  }
  .detail-close {
    top: 10px;
    right: 10px;
  }
  .detail-panel dl {
    margin: 10px 0;
    grid-template-columns: 54px 1fr;
    gap: 6px 8px;
  }
  .detail-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding-top: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 28%);
  }
  .detail-actions a,
  .detail-actions button {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-height: 40px;
  }
  .route-detail {
    max-height: min(34dvh, 300px);
    margin-top: 10px;
    padding-top: 10px;
  }
  .route-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-panel {
    top: auto;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    max-height: min(62dvh, 520px);
    border-radius: 18px;
  }
  .detail-panel:not([hidden]) + .ranking-panel {
    display: none;
  }
  .situations { padding: 22px 14px 32px; }
  .section-heading {
    align-items: start;
    gap: 12px;
  }
  .section-heading h2 { font-size: 18px; }
  .situation-board { grid-template-columns: 1fr; }
  .situation-column { max-height: 520px; }
  .modal-shell {
    align-items: end;
    padding: 10px;
  }
  .restaurant-form {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 16px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 10px 10px;
  }
  .random-panel {
    width: 100%;
    padding: 18px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 10px 10px;
  }
  .random-controls {
    grid-template-columns: 1fr;
  }
  .random-spin-button {
    justify-content: center;
  }
  .form-grid { grid-template-columns: 1fr; }
  .field-span-2,
  .field-span-3,
  .form-wide { grid-column: 1 / -1; }
  .situation-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-actions {
    position: sticky;
    bottom: -1px;
    padding-top: 8px;
    background: #ffffff;
  }
  .form-actions button { flex: 1; }
}

@media (max-width: 420px) {
  .brand-block {
    flex-basis: 100%;
  }
  .summary {
    order: 1;
    margin-left: auto;
  }
  .map-shell {
    height: calc(100dvh - 174px);
    min-height: 460px;
  }
  .ranking-toggle span,
  .mobile-filter-toggle span {
    display: none;
  }
  .detail-panel {
    max-height: min(72dvh, 560px);
  }
  .route-detail {
    max-height: min(36dvh, 320px);
  }
}
