:root {
  --paper: #121214;
  --panel: #1c1c1f;
  --panel-2: #232327;
  --line: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-2: rgba(255, 255, 255, 0.10);
  --field: #2a2a2e;
  --field-2: #303035;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --press: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --mono: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.003em;
  font-variant-numeric: tabular-nums;
}
header {
  border-bottom: 1px solid var(--hairline) !important;
}
header .brand-word { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
header .subtitle { font-family: var(--sans); letter-spacing: 0; font-size: 13px; }
header .divider { background: var(--hairline); }
.card, .result-card, .modal, .tile {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.28);
}
.tile { background: var(--panel-2); border-radius: 14px; box-shadow: none; }
.tile .t-value { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
.section-title { font-family: var(--display); font-weight: 700; letter-spacing: -0.015em; }
.field label, th { font-family: var(--sans) !important; letter-spacing: 0.01em; }
th { font-weight: 600; text-transform: none; font-size: 12px; }
.field select, .field input, select, input[type=date], input[type=number], input[type=text], input[type=search] {
  background-color: var(--field);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-family: var(--sans);
  transition: border-color .2s var(--press), box-shadow .2s var(--press), background .2s var(--press);
}
.field select:hover, .field input:hover { background-color: var(--field-2); }
.field select:focus, .field input:focus, select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.28);
}
input[type=checkbox] { accent-color: var(--accent); }
button, .btn {
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  transition: transform .16s var(--press), background-color .2s var(--press), box-shadow .2s var(--press), color .2s, opacity .2s;
}
button:active:not(:disabled), .btn:active:not(:disabled) { transform: scale(0.97); }
#showBtn, #loadFromDashboardBtn, .btn.primary, #refreshBtn, #reloadBtn {
  background: var(--accent);
  border: none;
  color: #1a0d00;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 16px rgba(255, 122, 26, 0.22);
}
#showBtn:hover, #loadFromDashboardBtn:hover, .btn.primary:hover, #refreshBtn:hover, #reloadBtn:hover {
  background: var(--accent-deep);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 22px rgba(255, 122, 26, 0.32);
}
.btn:not(.primary):not(.free):not(#refreshBtn), .reset-btn, .modal-close {
  background: var(--fill);
  border: 1px solid transparent;
  color: var(--ink);
}
.btn:not(.primary):not(.free):not(#refreshBtn):hover, .reset-btn:hover, .modal-close:hover {
  background: var(--fill-2);
  border-color: transparent;
  color: var(--ink);
}
.reset-btn { border-style: solid; color: var(--ink-soft); }
.modal-close { border-radius: 999px; }
.quick-btns, .quick, .toggle-group {
  display: inline-flex;
  gap: 0 !important;
  padding: 2px;
  background: var(--fill);
  border-radius: 10px;
  flex-wrap: nowrap;
}
.quick-btns button, .quick button, .toggle-btn {
  background: transparent !important;
  border: none !important;
  border-radius: 8px;
  color: var(--ink-soft) !important;
  font-weight: 600;
  box-shadow: none;
}
.quick-btns button { height: 40px !important; }
.quick-btns button:hover, .quick button:hover, .toggle-btn:hover { color: var(--ink) !important; }
.quick-btns button.seg-on, .quick button.seg-on, .toggle-btn.active {
  background: var(--accent) !important;
  color: #1a0d00 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
th, td { border-bottom-color: var(--hairline) !important; }
tbody tr { transition: background-color .2s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
#map { border-radius: 14px; border: 1px solid var(--hairline); }
.leaflet-bar { border: none !important; border-radius: 10px !important; overflow: hidden; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important; }
.points-banner { border-radius: 12px; }
.modal-bg {
  background: rgba(0, 0, 0, 0.45) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal { will-change: transform, opacity; }
html:not(.ap-js) .modal-bg:not(.hidden) { animation: ap-fade .25s ease-out; }
html:not(.ap-js) .modal-bg:not(.hidden) .modal { animation: ap-sheet-in .45s var(--spring); }
.modal { border-radius: 18px; position: relative; }
.modal-head { touch-action: none; }
@keyframes ap-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ap-fade-out { to { opacity: 0; } }
@keyframes ap-sheet-in { from { transform: translateY(40px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ap-sheet-out { to { transform: translateY(60px); opacity: 0; } }
.card.highlight { border-color: rgba(255, 122, 26, 0.35); }
details.settings > summary { cursor: pointer; }
.total-block { border-radius: 14px; }
@media (max-width: 720px), (pointer: coarse) and (max-width: 1000px), (max-height: 500px) and (max-width: 1000px) {
  .card { border-radius: 16px !important; }
  .quick-btns, .quick, .toggle-group { display: flex !important; width: 100%; }
  .quick-btns button, .quick button, .toggle-btn { flex: 1 1 0; width: auto !important; min-width: 0; padding: 0 4px; height: 40px; }
  table.m-cards tbody tr { border: 1px solid var(--hairline) !important; border-radius: 14px !important; background: var(--panel-2); }
  .modal-bg { align-items: flex-end !important; }
  .modal-head::before {
    content: ""; position: absolute; left: 50%; top: 6px;
    width: 36px; height: 5px; margin-left: -18px;
    border-radius: 3px; background: rgba(255, 255, 255, 0.22);
  }
  .modal { padding-top: 20px !important; }
}
@media (prefers-reduced-motion: reduce) {
  button:active, .btn:active { transform: none !important; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, 0.35); --hairline: rgba(255, 255, 255, 0.35); --ink-soft: #c9c7bf; }
  .modal-bg { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.8) !important; }
  .quick-btns, .quick, .toggle-group, .btn, .reset-btn { border: 1px solid var(--hairline) !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .modal-bg { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.pwa-back {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px; margin-right: 12px;
  border-radius: 999px; background: var(--fill); color: var(--accent);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: transform .16s var(--press), background-color .2s;
}
.pwa-back:active { transform: scale(0.96); background: var(--fill-2); }
html.pwa body { padding-top: max(12px, env(safe-area-inset-top)) !important; padding-bottom: max(40px, env(safe-area-inset-bottom)) !important; }
:root { color-scheme: dark; }
select { background-color: #2a2a2e; }
select:hover { background-color: #303035; }
select option, select optgroup { background-color: #1c1c1f; color: #f4f3ee; }
select option:checked { background-color: #ff7a1a; color: #1a0d00; }
select option:disabled { color: #6b6a64; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f4f3ee;
  -webkit-box-shadow: 0 0 0 1000px #2a2a2e inset;
  caret-color: #f4f3ee;
  transition: background-color 9999s;
}
* { scrollbar-color: rgba(255, 255, 255, 0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.3); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::selection { background: rgba(255, 122, 26, 0.4); }
.leaflet-popup-content-wrapper {
  background: rgba(30, 30, 34, 0.92) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: var(--ink) !important;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45) !important;
  padding: 0 !important;
}
.leaflet-popup-tip { background: rgba(30, 30, 34, 0.92) !important; box-shadow: none !important; border: 1px solid rgba(255, 255, 255, 0.10); }
.leaflet-popup-content { margin: 12px 14px !important; font: 13px/1.4 var(--sans) !important; min-width: 230px; max-width: 300px; }
.leaflet-popup-content p { margin: 0; }
.leaflet-container a.leaflet-popup-close-button {
  top: 8px !important; right: 8px !important; width: 24px !important; height: 24px !important;
  border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--ink-soft) !important;
  font: 16px/24px var(--sans) !important; text-align: center;
}
.leaflet-container a.leaflet-popup-close-button:hover { background: rgba(255, 255, 255, 0.16); color: var(--ink) !important; }
.leaflet-container a.leaflet-popup-close-button span { line-height: 24px; }
.mp { padding-right: 18px; }
.mp-title { font: 650 15px/1.3 var(--display); letter-spacing: -0.015em; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.mp-sub { color: var(--ink-soft); font-size: 12px; margin-top: 3px; }
.mp-title + .mp-order, .mp-sub + .mp-order { margin-top: 10px; }
.mp-order + .mp-order { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.mp-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.mp-cat {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.10); color: var(--ink);
}
.mp-pp { background: rgba(255, 122, 26, 0.18); color: #ffa057; }
.mp-sz { background: rgba(77, 163, 255, 0.18); color: #7dbbff; }
.mp-prof { background: rgba(52, 199, 89, 0.18); color: #5fd98a; }
.mp-sn { background: rgba(199, 125, 255, 0.18); color: #d6a4ff; }
.mp-nl { background: rgba(255, 214, 10, 0.16); color: #ffd84d; }
.mp-detected { margin-top: 6px; padding: 7px 9px; border-radius: 9px; background: rgba(255, 214, 10, 0.07); border: 1px solid rgba(255, 214, 10, 0.18);
  font-size: 12px; line-height: 1.45; white-space: pre-wrap; max-height: 170px; overflow-y: auto; color: #e7e5df; }
.mp-detected span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #ffd84d; margin-bottom: 2px; }
.mp-free { background: rgba(230, 0, 126, 0.22); color: #ff5cad; }
.mp-doc { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.mp-copy { cursor: copy; border-bottom: 1px dashed rgba(255, 255, 255, 0.35); }
.mp-copy:hover { color: #ffb070; border-bottom-color: #ffb070; }
.mp-copy.mp-copied { color: #5fd98a; border-bottom-color: transparent; }
.mp-time {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: 999px; background: var(--accent); color: #1a0d00; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mp-time::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid currentColor; box-sizing: border-box;
  background: linear-gradient(currentColor, currentColor) 50% 1.5px / 1.4px 3.4px no-repeat,
              linear-gradient(currentColor, currentColor) 3.6px 50% / 2.6px 1.4px no-repeat;
}
.mp-slot { margin-left: auto; font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.mp-addr { margin-top: 6px; font-weight: 600; color: var(--ink); }
.mp-type { margin-top: 2px; color: var(--ink-soft); font-size: 12px; }
.mp-note { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--ink-soft); font-size: 12px; }
.mp-person { margin-top: 6px; display: flex; align-items: center; gap: 7px; }
.mp-person i, .mp-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.mp-foot { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; }
.mp-status { display: inline-flex; height: 20px; align-items: center; padding: 0 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); color: var(--ink); font-weight: 600; }
.mp-muted { color: var(--ink-soft); font-weight: 400; }
.mp-warn { color: #ffb347; font-size: 12px; margin-top: 4px; }
.mp-section { margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.mp-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #1a0d00; font-size: 12px; font-weight: 800; flex: 0 0 auto;
}
@media (prefers-reduced-transparency: reduce) {
  .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1e1e22 !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.modal-bg { overflow: hidden !important; overscroll-behavior: contain; }
.modal {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px);
}
.modal-head, .modal-sub { flex: 0 0 auto; }
#detailBody {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; margin: 0 -20px; padding: 0 20px 6px;
}
html.ap-lock, html.ap-lock body { overflow: hidden !important; }
@media (max-width: 720px), (pointer: coarse) and (max-width: 1000px), (max-height: 500px) and (max-width: 1000px) {
  .modal-bg { padding: 0 !important; align-items: flex-end !important; }
  .modal {
    min-height: 0 !important; height: 92vh; height: 92dvh; max-height: none;
    border-radius: 18px 18px 0 0 !important; padding: 20px 12px 0 !important;
  }
  #detailBody { margin: 0 -12px; padding: 0 12px calc(16px + env(safe-area-inset-bottom)); }
}
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: ap-vt-out .18s ease-in both; }
::view-transition-new(root) { animation: ap-vt-in .28s cubic-bezier(0.32, 0.72, 0, 1) both; }
@keyframes ap-vt-out { to { opacity: 0; } }
@keyframes ap-vt-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; transform: none; }
}
.pwa-back span { font-size: 20px; line-height: 1; margin-right: 4px; margin-top: -2px; }
header .brand-icon { height: 30px; width: auto; display: block; margin-right: 8px; flex: 0 0 auto; }
.mp-shtk { display: inline-block; margin-top: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700;
  background: rgba(167, 123, 255, 0.18); color: #c4a5ff; }
