/* Map-specific fill and shell geometry. */
:root { --map-empty: #eee9df; --topbar-height: 64px; --sidebar-base-width: 340px; --sidebar-heading-inset: 20px; color-scheme: light; }
:root[data-theme=dark] { --map-empty: #253344; color-scheme: dark; }

* { box-sizing: border-box; }

body { margin: 0; color: var(--ui-text); font: var(--ui-text-body)/var(--ui-leading) var(--ui-font); background: var(--ui-surface-page); }
body.app-active { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
a { color: var(--ui-accent); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { a:hover { text-decoration: underline; } }
[hidden] { display: none !important; }
.muted { color: var(--ui-text-muted); }
.eyebrow { font-size: 11px; letter-spacing: .6px; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ui-accent); font-size: 30px; line-height: 1; text-decoration: none !important; }
.brand span { font-size: 15px; letter-spacing: 2.5px; font-weight: 700; }
.brand small { display: block; font-size: 8px; letter-spacing: 2px; margin-top: 5px; }
.test-stand-label { display: inline-block; padding: var(--ui-space-1) var(--ui-space-2); border-radius: var(--ui-radius-control); color: var(--ui-warning); background: var(--ui-warning-surface); font-size: var(--ui-text-caption); font-weight: 600; line-height: 1.25; }
.topbar .test-stand-label { margin-inline-end: auto; }
.login-copy .test-stand-label { margin-block-end: var(--ui-space-3); }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom)); }
.login-panel { width: 100%; max-width: 400px; }
#auth-content { padding: var(--ui-space-6); }
.login-copy { padding: var(--ui-space-6) 0 var(--ui-space-4); }
.login-copy h1 { font-size: clamp(28px, 5vw, 36px); line-height: 1.2; font-weight: 600; letter-spacing: -.8px; margin: 0 0 12px; }
.login-copy > .muted { margin: 0 0 32px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.password-row.ui-field-group { padding-inline-end: 0; border: 0; box-shadow: inset 0 0 0 1px var(--ui-border-control); }
.password-row > button {
  align-self: stretch;
  height: auto;
  padding: 0;
  line-height: 1;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  font-size: 23px;
}
.password-row > button:focus-visible { outline-color: var(--ui-on-accent); outline-offset: -4px; }
.password-input { overflow: hidden; }
.password-row .password-input { flex: 1; width: auto; border: 0; padding: 0; background: transparent; }
.password-row .password-input:focus-within { outline: none; }
.password-input.ui-field-group > input { flex: 1; width: 0; font-size: 16px; }
.password-input .password-toggle:focus-visible { outline-offset: -4px; }
.password-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#login-error { min-height: 18px; }
#login-error:empty { display: block; }
.login-foot { font-size: 11px; display: flex; flex-wrap: wrap; justify-content: space-between; color: var(--ui-text-muted); gap: 8px 20px; }
.telegram-button { width: 100%; margin: 0 0 20px; }
.login-alternative { display: none; align-items: center; gap: 12px; margin: 24px 0; color: var(--ui-text-muted); font-size: 12px; text-align: center; }
.login-methods:has(> button:not([hidden])) + .login-alternative { display: flex; }
.login-alternative::before, .login-alternative::after { content: ''; flex: 1; height: 1px; background: var(--ui-border); }
#username-field { margin-bottom: 16px; }
#username { font-size: 16px; }
#accounts-dialog { --ui-dialog-width: 520px; }
#account-error { color: var(--ui-danger); font-size: 14px; }
.account-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-user { border-top: 1px solid var(--ui-border); padding: 14px 0; }
.account-user summary { min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.account-user form > .ui-button--primary, #setup-account > .ui-button--primary, #change-password > .ui-button--primary { margin-top: 20px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
#accounts-dialog .checkbox-label input { width: 20px; height: 20px; }
.telegram-request { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--ui-border); }
.telegram-request strong { grid-column: 1 / -1; overflow-wrap: anywhere; }
.telegram-request select { grid-column: 1 / -1; }
button:disabled { opacity: .55; cursor: not-allowed; }
#application { height: 100dvh; display: flex; flex-direction: column; }
.topbar { min-height: calc(var(--topbar-height) + env(safe-area-inset-top)); flex: 0 0 auto; padding: env(safe-area-inset-top) 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--ui-border); background: var(--ui-surface-page); }
.top-actions { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.profile-dot { height: 6px; width: 6px; background: #829878; border-radius: 50%; }
.workspace { position: relative; display: flex; flex: 1; min-height: 0; }
.sidebar { position: relative; width: var(--sidebar-width, calc(var(--sidebar-base-width) * var(--sidebar-width-factor, 1))); flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; background: var(--ui-surface-page); border-right: 1px solid var(--ui-border); z-index: var(--ui-layer-sidebar); }
.side-head { overflow-y: auto; overscroll-behavior: contain; padding: 18px var(--sidebar-heading-inset); flex: 0 1 auto; }
.side-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--ui-space-2); margin-bottom: var(--ui-space-5); }
.side-head h1 { font-size: var(--ui-text-title); font-weight: 600; letter-spacing: -.5px; margin: 0; }
.city-filter { margin-bottom: 16px; }
.filter-label { display: block; margin: 0 0 var(--ui-space-2); color: var(--ui-text); font-size: var(--ui-text-caption); font-weight: 500; }

.search-box { margin-bottom: var(--ui-space-4); }

.chips { display: flex; flex-wrap: wrap; gap: var(--ui-space-2); }
.status-row { display: grid; gap: var(--ui-space-2); margin-top: var(--ui-space-4); }
.status-row > .filter-label { margin: 0; }
.list-heading { position: relative; padding: 12px 20px; flex: 0 0 auto; border-top: 1px solid var(--ui-border); border-bottom: 1px solid var(--ui-border); font-size: 12px; color: var(--ui-text-muted); }
.place-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-inline: 10px; }
:is(#places-panel, .side-head, .place-list) { scrollbar-width: none; }
:is(#places-panel, .side-head, .place-list)::-webkit-scrollbar { display: none; }
.sidebar-divider { display: none; }
.sidebar-divider--height { position: absolute; z-index: 1; inset-inline: 0; top: -7px; height: 13px; place-items: center; touch-action: none; user-select: none; cursor: row-resize; }
.sidebar-divider::before { content: ''; width: 28px; height: 4px; border-radius: var(--ui-radius-pill); background: color-mix(in srgb, var(--ui-text-muted) 55%, var(--ui-surface-page)); }
.sidebar-divider:is(:focus-visible, [data-dragging])::before { background: var(--ui-accent); }
@media (hover: hover) and (pointer: fine) { .sidebar-divider:hover::before { background: var(--ui-accent); } }
.sidebar-divider:focus-visible { outline: none; }
.sidebar-divider:focus-visible::before { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
.sidebar:has(.sidebar-divider[data-dragging]) { user-select: none; }

.place-icon { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--category) 14%, var(--ui-surface-panel)); color: var(--category); }
.place-icon svg { width: 20px; height: 20px; }
.place-card-content { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.place-name { display: block; font-weight: 600; font-size: 14px; line-height: 1.4; margin: 0 0 4px; overflow-wrap: anywhere; }
.place-meta { font-size: 11px; color: var(--ui-text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-dot { opacity: var(--status-opacity, 1); height: 14px; width: 14px; border-radius: 50%; display: inline-grid; place-items: center; vertical-align: middle; background: var(--status, #c5cbbf); color: var(--status-symbol, white); font: 700 9px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', sans-serif; }
.card-status { display: block; font-size: 11px; margin-top: 6px; color: var(--status-text, var(--status, var(--ui-text-muted))); }
.side-footer { padding: 14px 20px; flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; font-size: 10px; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); }
.side-footer a { white-space: nowrap; }
.map-area {
  --map-credit-height: 1rem;
  --map-credit-safe-bottom: env(safe-area-inset-bottom, 0px);
  --map-credit-bottom: var(--map-credit-safe-bottom);
  position: relative; flex: 1; min-width: 0; min-height: 0; background: var(--map-empty); overflow: hidden;
}
#map { --map-pin-border-width: 2px; position: relative; z-index: 0; height: 100%; width: 100%; background: var(--map-empty); }
.map-heading { position: absolute; z-index: 450; top: 20px; left: 20px; max-width: calc(100% - 410px); min-height: 42px; padding: 10px 14px; background: var(--ui-surface-overlay); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); display: flex; gap: 8px; align-items: center; font-size: 12px; box-shadow: var(--ui-shadow-panel); pointer-events: none; }
#map-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { height: 5px; width: 5px; flex: none; border-radius: 50%; background: #6b8a65; }
.map-tools { position: absolute; right: 20px; top: 20px; z-index: 450; display: flex; gap: 8px; }
.map-button { --ui-action-fill: var(--ui-button-fill); --ui-action-shadow: var(--ui-shadow-control-floating); display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--ui-button-border); border-radius: var(--ui-radius-control); min-width: 42px; min-height: 42px; padding: 8px 12px; font-size: 20px; color: var(--ui-button-ink); }
.map-button span { font-size: 12px; }
.map-compass { width: 44px; padding: 10px; }
.map-compass svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; transform: rotate(var(--north-bearing, 0deg)); }
.map-compass .compass-north { fill: var(--ui-danger); stroke: none; }
.map-compass .compass-south { fill: currentColor; stroke: none; opacity: .55; }

.pin { opacity: var(--status-opacity, 1); width: 40px; height: 40px; background: var(--category); color: white; border: var(--map-pin-border-width) solid #fffcf6; border-radius: 50%; box-shadow: 0 0 0 1px #172a3c66, 0 3px 9px #13283866; position: relative; display: grid; place-items: center; }
.pin svg { width: 19px; height: 19px; }
.pin .pin-state { position: absolute; top: -3px; right: -3px; height: 14px; width: 14px; display: grid; place-items: center; border-radius: 50%; border: 2px solid white; background: var(--status); color: var(--status-symbol, white); box-shadow: 0 1px 4px #273a3240; font: 700 8px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', sans-serif; }
.pin-count {
 position: absolute;
 top: -4px;
 left: -4px;
 min-width: 18px;
 min-height: 18px;
 padding-inline: var(--ui-space-1);
 display: grid;
 place-items: center;
 border: 1px solid var(--ui-border-control);
 border-radius: var(--ui-radius-pill);
 background: var(--ui-surface-panel);
 color: var(--ui-text);
 box-shadow: var(--ui-shadow-control);
 font-size: 11px;
 font-weight: 700;
 line-height: 1;
}
.place-group { --ui-sheet-width: 400px; max-height: min(65dvh, 480px); z-index: var(--ui-layer-detail); }
.place-group .ui-overlay-heading { border-bottom: 1px solid var(--ui-border-panel); }
.place-group .ui-overlay-title { font-size: var(--ui-text-section); }
.place-group .place-name { margin-bottom: 0; }
.place-group .card-status { margin-top: var(--ui-space-1); }
@media (max-width: 1000px) {
 .place-group.ui-sheet { left: var(--ui-sheet-mobile-left); right: var(--ui-sheet-mobile-right); width: auto; }
}
.map-area .detail { position: absolute; z-index: var(--ui-layer-detail); }
.detail .eyebrow { color: var(--ui-text-muted); margin: 0 0 var(--ui-space-1); font-size: var(--ui-text-caption); overflow-wrap: anywhere; }

.local-name { font-size: 12px; color: var(--ui-text-muted); margin: 0 0 18px; }
.detail-summary { font-size: 14px; line-height: 1.7; margin: 0; }
.detail-info { margin-top: var(--ui-space-4); font-size: 13px; line-height: 1.6; }
.detail-info strong { display: block; font-size: 11px; color: var(--ui-text-muted); font-weight: 500; margin-bottom: 4px; }
.detail-info p { margin: 4px 0 12px; }
.hours-note { color: var(--ui-text-muted); font-size: 12px; }
.tip { background: var(--ui-surface-soft); padding: 12px; font-size: 13px; line-height: 1.6; border-radius: var(--ui-radius-control); margin: var(--ui-space-4) 0; }

.detail label { margin: 16px 0 8px; font-size: 12px; color: var(--ui-text-muted); }

.place-links { margin-top: 6px; }
.place-links summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; color: var(--ui-accent); font-size: 12px; cursor: pointer; list-style: none; }
.place-links summary::-webkit-details-marker { display: none; }
.place-links summary svg { flex: none; width: 16px; height: 16px; }
.place-links[open] summary svg { transform: rotate(180deg); }
.detail-links { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: 12px; }
.detail-links a { display: inline-flex; align-items: center; min-height: 36px; overflow-wrap: anywhere; }
.google-link { margin: 0 0 6px; }
.verification { font-size: 11px; color: var(--ui-text-muted); line-height: 1.6; margin: 18px 0 0; }
.empty { padding: 28px 12px; text-align: center; color: var(--ui-text-muted); font-size: 13px; }
.map-status { position: absolute; bottom: 40px; left: 20px; z-index: 450; max-width: min(330px, calc(100% - 40px)); padding: 12px; background: var(--ui-warning-surface); color: var(--ui-warning); border-radius: 7px; font-size: 12px; }
dialog label { margin-top: 18px; }
dialog input[type=color] { width: 100%; height: 44px; border: 1px solid var(--ui-border); background: var(--ui-surface-panel); border-radius: 6px; }
dialog .ui-button--primary { width: 100%; }
.mobile-toggle.ui-button { display: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 1500px) {
  :root { --sidebar-base-width: 380px; --sidebar-heading-inset: 24px; }
}
@media (max-width: 1200px) {
  :root { --sidebar-base-width: 310px; }
  .map-button span { display: none; }
  .map-heading { max-width: calc(100% - 200px); }
}
@media (width > 1000px) {
  .side-head { height: var(--sidebar-filter-size, auto); max-height: var(--sidebar-filter-size, 60%); }
  .place-list { min-height: min(96px, 24dvh); }
  .sidebar .place-card { align-items: center; gap: var(--ui-space-2); padding-block: 10px; }
  .sidebar .place-icon { width: 32px; height: 32px; }
  .sidebar .place-icon svg { width: 18px; height: 18px; }
  .sidebar .place-name { margin-bottom: 2px; }
  .sidebar .card-status { margin-top: var(--ui-space-1); }
  .sidebar-divider { position: absolute; z-index: 1; display: grid; place-items: center; touch-action: none; user-select: none; }
  .sidebar-divider--width { inset-block: 0; left: 100%; width: 12px; cursor: col-resize; }
  .sidebar-divider--width::before { position: absolute; top: 50%; left: .5px; width: 4px; height: 28px; transform: translate(-50%, -50%); pointer-events: none; }
}
@media (max-width: 1000px) {
  :root { --topbar-height: 56px; }
  .topbar { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .brand { gap: 8px; font-size: 28px; }
  .brand span { font-size: 14px; }
  .profile-name, .profile-dot { display: none; }
  #logout { min-height: 44px; padding: 8px 0 8px 12px; font-size: 13px; }
  .sidebar { display: none; position: absolute; inset: 0; width: 100%; min-width: 0; border: 0; z-index: var(--ui-layer-mobile-sidebar); overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(88px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .sidebar.mobile-open { display: block; }
  .side-head { max-height: none; overflow: visible; padding: 14px max(16px, env(safe-area-inset-right)) 18px max(16px, env(safe-area-inset-left)); }
  .side-heading { margin-bottom: var(--ui-space-4); }

  .chips { gap: 8px; }
  .list-heading { padding: 12px 16px; }
  .place-list { flex: none; min-height: auto; overflow: visible; padding-inline: 8px; }

  .place-name { font-size: 15px; }
  .place-meta, .card-status { font-size: 12px; }
  .side-footer { font-size: 11px; padding: 16px; }
  .map-heading { top: 12px; left: max(12px, env(safe-area-inset-left)); padding: 10px; min-height: 44px; max-width: calc(100% - 196px); font-size: 11px; }
  .map-tools { top: 12px; right: max(12px, env(safe-area-inset-right)); gap: 8px; }
  .map-button { width: 44px; height: 44px; padding: 0; }
  .map-button span { display: none; }
  .mobile-toggle.ui-button { display: inline-grid; z-index: 700; }
  .mobile-toggle > span { grid-area: 1 / 1; }
 .mobile-toggle[aria-expanded=true] > .mobile-toggle-closed,
 .mobile-toggle[aria-expanded=false] > .mobile-toggle-open { visibility: hidden; }
  #application:is(.detail-open, :has(#place-group[open])) .mobile-toggle.ui-button { display: none; }
  .map-area .detail { position: fixed; inset: auto var(--ui-sheet-mobile-right) var(--map-credit-clearance,0px) var(--ui-sheet-mobile-left); width: auto; max-height: min(72dvh, calc(100dvh - var(--topbar-height) - env(safe-area-inset-top) - 72px)); }
  .detail-links a { min-height: 44px; }
  .map-status { bottom: calc(90px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; }
}
@media (max-width: 1000px) and (max-height: 500px) {
  .detail-open .map-heading { display: none; }
}
@media (max-width: 400px) {
  .login-screen { padding-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

#own-profile { margin-bottom: 28px; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
#accounts-dialog button:disabled, #accounts-dialog .checkbox-label:has(input:disabled) { opacity: .5; cursor: not-allowed; }

#help-dialog { --ui-dialog-width: 760px; }
#help-content { font-size: 14px; line-height: 1.6; }
#help-content h3 { font-size: 17px; line-height: 1.4; margin: 28px 0 14px; }
#help-content p { margin: 6px 0 12px; }
#help-content ol { padding-left: 22px; }
#help-content ol li { margin-bottom: 10px; }
.help-categories { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.help-categories li { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.help-categories strong { font-size: 13px; overflow-wrap: anywhere; }
#help-content .help-categories p { font-size: 12px; color: var(--ui-text-muted); line-height: 1.5; margin: 4px 0 0; }
.help-category-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; background: var(--ui-surface-soft); border-radius: var(--ui-radius-control); }
.help-category-icon svg { width: 20px; height: 20px; }
@media (max-width: 600px) {
 .help-categories { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}


.login-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.login-theme { display: flex; flex: none; }
.theme-control { flex: none; display: inline-flex; }
input::placeholder, textarea::placeholder { color: var(--ui-text-muted); opacity: 1; }
/* Autofill uses the whole field's surface, avoiding a seam before its icons. */
input:is(:autofill, :-webkit-autofill) { -webkit-text-fill-color: var(--ui-text); caret-color: var(--ui-text); box-shadow: 0 0 0 1000px var(--field-background, var(--ui-surface-soft)) inset; }
input[type=checkbox] { accent-color: var(--ui-accent); }
.tip { white-space: pre-line; }
.map-pin-button { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: none; }
@media (max-width: 1000px) {
 .map-pin-button:is([data-map-place], [data-map-group]) { -webkit-touch-callout: none; user-select: none; }
 .map-pin-button[data-quick-action] { z-index: 502 !important; }
 .map-pin-button[data-quick-action]::after { visibility: hidden; }
 .map-quick-actions, .map-quick-direction {
  position: absolute;
  inset: 0;
  pointer-events: none;
 }
 .map-quick-direction {
  --glow-length: 36px;
  --glow-opacity: .43;
 }
 .map-quick-direction[data-action=maps] {
  --glow-color: light-dark(#2c85ab, #8fcfe7);
  --hint-color: var(--ui-accent);
 }
 .map-quick-direction[data-action=visited] {
  --glow-color: light-dark(#439261, #9bd5ad);
  --hint-color: var(--ui-success);
 }
 .map-quick-direction::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(2 * (28px + var(--glow-length)));
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: conic-gradient(from -60deg, transparent, var(--glow-color) 8deg 112deg, transparent 120deg);
  mask-image: radial-gradient(circle, transparent 26px, black 29px, transparent calc(28px + var(--glow-length)));
  opacity: var(--glow-opacity);
 }
 @media (prefers-reduced-motion: no-preference) {
  .map-quick-direction::before { animation: map-quick-glow-in var(--ui-duration-feedback) var(--ui-ease); }
  @keyframes map-quick-glow-in { from { opacity: 0; } }
 }
 .map-quick-direction[data-action=visited]::before { rotate: 180deg; }
 .map-pin-button[data-quick-action=maps] .map-quick-direction[data-action=maps],
 .map-pin-button[data-quick-action=visited] .map-quick-direction[data-action=visited] {
  --glow-length: 41.4px;
  --glow-opacity: .86;
 }
 .map-pin-button[data-quick-action=maps] .map-quick-direction[data-action=visited],
 .map-pin-button[data-quick-action=visited] .map-quick-direction[data-action=maps] { --glow-opacity: .16; }
 .map-quick-hint {
  position: absolute;
  top: calc(50% + var(--map-quick-label-y));
  left: calc(50% + var(--map-quick-label-x));
  translate: -50% -50%;
  padding: var(--ui-space-1) var(--ui-space-2);
  border: 1px solid var(--ui-border-panel);
  border-radius: var(--ui-radius-control);
  background: var(--ui-surface-panel);
  color: var(--hint-color);
  box-shadow: var(--ui-shadow-panel);
  white-space: nowrap;
  font-size: var(--ui-text-caption);
 }
 .map-pin-button[data-quick-action=maps] [data-action=maps] .map-quick-hint,
 .map-pin-button[data-quick-action=visited] [data-action=visited] .map-quick-hint {
  background: color-mix(in srgb, var(--glow-color) 20%, var(--ui-surface-panel));
  border-color: var(--glow-color);
 }
}
.map-pin-button.has-stay::before {
 content: "";
 position: absolute;
 inset: -4px;
 border: 1px solid var(--ui-lodging-ring);
 border-radius: 50%;
 box-shadow: 0 0 7px 1px color-mix(in srgb,var(--ui-lodging-ring) 48%,transparent);
 pointer-events: none;
}
.map-pin-button.city-cluster { width: 45px; height: 45px; background: #456b53; color: white; display: grid; place-items: center; border: var(--map-pin-border-width) solid #f5f4e8; box-shadow: 0 2px 12px #273a3240; font-size: 17px; }
.map-pin-button::after { content: attr(data-label); pointer-events: none; position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 240px; padding: 6px 10px; border: 1px solid var(--ui-border); border-radius: 6px; background: var(--ui-surface-panel); color: var(--ui-text); box-shadow: var(--ui-shadow-panel); font: 12px/1.4 Inter, -apple-system, sans-serif; opacity: 0; visibility: hidden; white-space: normal; }
:where(:root:not([data-ui-touch])) .map-pin-button:focus-visible::after { opacity: 1; visibility: visible; }
@media (hover: hover) and (pointer: fine) { .map-pin-button:hover::after { opacity: 1; visibility: visible; } }
:where(:root:not([data-ui-touch])) .map-pin-button:focus-visible { z-index: 501 !important; }
@media (hover: hover) and (pointer: fine) { .map-pin-button:hover { z-index: 501 !important; } }
.map-status { bottom: auto; top: 78px; left: 20px; max-width: min(360px, calc(100% - 100px)); z-index: 451; border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-panel); background: var(--ui-surface-panel); color: var(--ui-text); }
.map-status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.map-status button { color: var(--ui-accent); text-decoration: underline; padding: 8px 0; min-height: 40px; text-align: left; }
.map-status-actions:has(button:not([hidden])) { margin-top: 4px; }
.maplibregl-ctrl-bottom-left:has(.maplibregl-ctrl-attrib) {
  left: env(safe-area-inset-left);
  right: env(safe-area-inset-right);
  bottom: var(--map-credit-bottom);
}
@media (max-width: 1000px) and (orientation: portrait) and (display-mode: standalone) {
  .map-area {
    --map-credit-bottom: min(var(--map-credit-safe-bottom), max(28px, calc(var(--map-credit-safe-bottom) - 6px)));
  }
}
.maplibregl-ctrl.maplibregl-ctrl-attrib {
  color: var(--ui-text-muted);
  background: var(--ui-surface-panel);
  font: 0.625rem/var(--map-credit-height) var(--ui-font);
  padding: 0 4px;
  border-radius: 0 6px 6px 0;
}
.maplibregl-ctrl-attrib a { color: var(--ui-accent); }
.maplibregl-ctrl-attrib a:is([href="https://openfreemap.org"],[href="https://openfreemap.org/"]) { display: none; }
.maplibregl-ctrl-bottom-left { max-width: 100%; z-index: 451; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0; }
.user-position { width: 18px; height: 18px; border: 3px solid #fff; background: #287ac9; border-radius: 50%; box-shadow: 0 0 0 2px #1c426e66; }
:root[data-theme=dark] .place-icon svg { color: color-mix(in srgb, currentColor 70%, white); }
:root[data-theme=dark] .detail .eyebrow { color: var(--ui-text); }
:root[data-theme=dark] .help-category-icon svg { color: color-mix(in srgb, currentColor 70%, white); }
@media (max-width: 1000px) {
 .topbar { gap: 8px; }

 .map-status { top: calc(var(--map-control-top) + var(--map-control-size) + 16px); left: max(12px, env(safe-area-inset-left)); right: auto; bottom: auto; max-width: calc(100% - 84px); }
 /* Keep the corner visible for OSM raster tiles and cards opened from a link. */
 .map-area:has(#map[data-provider=fallback],#detail[data-keep-map-credits]) {
  --map-credit-clearance: calc(var(--map-credit-bottom) + var(--map-credit-height));
 }
 .map-area:has(#map[data-provider=fallback],#detail[data-keep-map-credits]) .detail .ui-overlay-body {
  padding-bottom: var(--ui-overlay-padding);
 }
 .map-area:has(#detail:not([hidden]):not([data-keep-map-credits])) #map[data-provider=primary] .maplibregl-ctrl-attrib {
  visibility: hidden;
 }
}

/* One icon shows the action available from the current theme, before JS too. */
.theme-control svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top-actions .theme-control svg { width: 16px; height: 16px; }
/* Match the question glyph's visible height, including the sun's outer rays. */
.top-actions .theme-control .theme-sun { width: 14px; height: 14px; }
.theme-control .theme-sun, :root[data-theme=dark] .theme-control .theme-moon { display: none; }
:root[data-theme=dark] .theme-control .theme-sun { display: block; }
/* Center the complete composition in the visible, safe viewport on Safari and standalone. */
.auth-loading { position: fixed; inset: var(--loading-viewport-top,0px) 0 auto; height: var(--loading-viewport-height,100dvh); z-index: 2000; display: grid; place-items: center; padding: max(24px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left)); background: var(--ui-surface-page); color: var(--ui-text-muted); }
.auth-loading-content { display: flex; flex-direction: column; align-items: center; gap: 20px; width: min(360px,100%); max-height: 100%; min-height: 0; overflow: auto; }
.auth-loading-symbol { flex: none; width: 88px; height: 88px; color: var(--ui-accent); }
.auth-loading .brand-mark { display: block; width: 100%; height: 100%; transform-box: view-box; transform-origin: 50% 50%; animation: loading-star-turn 5.333333s linear infinite; }
.auth-loading-caption { flex: none; width: 100%; text-align: center; }
.auth-loading-wordmark { color: var(--ui-accent); font-size: 15px; line-height: 1; font-weight: 700; letter-spacing: 3px; }
.auth-loading-wordmark small { display: block; font-size: 8px; letter-spacing: 2.5px; margin-top: 8px; }
.auth-loading p { margin: 18px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.auth-loading .ui-button--quiet { margin-top: 12px; min-height: 44px; color: var(--ui-accent); }
.auth-loading[data-state=error] .brand-mark { animation-play-state: paused; }
@keyframes loading-star-turn { to { transform: rotate(360deg); } }
@media(prefers-reduced-motion: reduce) { .auth-loading .brand-mark { animation: none; } }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 0; padding-bottom: 0; min-height: 44px; }
#hidden-places-open { white-space: nowrap; }
.place-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; border-top: 1px solid var(--ui-border); padding-top: 12px; }
.place-actions > button { min-height: 44px; }
#hidden-places-dialog { --ui-dialog-width: 620px; }
#hidden-places-error { color: var(--ui-danger); }
.hidden-place { border-top: 1px solid var(--ui-border); padding: 18px 0; overflow-wrap: anywhere; }
.hidden-place h3 { margin: 0 0 6px; }
.hidden-place p { margin: 6px 0; }
.hidden-place-note { white-space: pre-wrap; }

/* Help belongs to the application header; map tools stay focused on location. */
.brand-mark { flex: none; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; }
.help-entry { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 8px; color: var(--ui-text-muted); font-size: var(--ui-text-caption); }
.help-entry .help-symbol { display: block; width: 20px; height: 22px; font: 500 18px/22px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
@media (max-width: 1000px) {
 .help-entry { width: 44px; padding: 0; }
 .help-entry > span { display: none; }
 .map-heading { max-width: calc(100% - 136px); }
 .map-area:has(.map-compass:not([hidden])) .map-heading { max-width: calc(100% - 188px); }
}
@media (max-width: 600px) {
 .topbar .brand { width: 32px; flex: none; }
 .topbar .brand > span { display: none; }
 .topbar .brand-mark { width: 28px; height: 28px; }
}

/* Supplemental tags stay in the card and filters, never on map markers. */
.tag-filters { margin-top: 16px; }
.detail-tags { margin-bottom: var(--ui-space-2); }
.detail-tags:empty { display: none; }
.place-tags { display: inline-flex; flex: none; flex-wrap: nowrap; gap: 6px; padding-top: 2px; color: var(--ui-text-muted); }
.place-tag { display: inline-flex; align-items: center; justify-content: center; width: 24px; min-height: 32px; padding: 0; color: inherit; border: 0; border-radius: 5px; }
.place-tag svg { width: 16px; height: 16px; }
.tag-details { border-top: 1px solid var(--ui-border); margin-top: 16px; padding-top: 14px; font-size: 13px; line-height: 1.6; }
.tag-details h3 { margin: 0 0 6px; font-size: 13px; }
.tag-details p { margin: 6px 0; }
.tag-details svg { width: 15px; height: 15px; flex: none; }
.place-schedule summary { cursor: pointer; list-style: none; color: var(--ui-accent); padding: 6px 0; }
.place-schedule summary::-webkit-details-marker { display: none; }
.schedule-show, .schedule-hide, .booking-link { display: inline-flex; gap: 6px; align-items: center; }
.schedule-hide, .place-schedule[open] .schedule-show { display: none; }
.place-schedule[open] .schedule-hide { display: inline-flex; }
.schedule-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.event-ended { color: var(--ui-text-muted); font-size: 12px; }

.tag-editor { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ui-border); }
.tag-editor h3 { margin: 0 0 10px; font-size: 13px; }
.tag-editor .tag-switches label { display: inline-flex; margin: 0; }
.tag-editor .tag-switches input { margin: 0; width: 14px; height: 14px; min-height: 0; flex: none; }
.tag-editor fieldset { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.tag-editor legend { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.tag-editor label { display: block; font-size: 12px; margin: 8px 0; }
.tag-editor :is(input[type=url],textarea) { margin-top: 6px; }
.tag-editor .tag-date-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tag-editor .tag-date-fields label { margin: 0 0 var(--ui-space-1); }
.schedule-editor { margin-top: 14px; min-width: 0; }
.schedule-editor summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; color: var(--ui-accent); font-size: 12px; min-height: 36px; }
.schedule-editor summary::-webkit-details-marker { display: none; }
.schedule-editor summary svg { flex: none; width: 15px; height: 15px; }
.schedule-editor[open] summary svg { transform: rotate(180deg); }
#state-form, #place-tag-editor, .tag-editor { min-width: 0; max-width: 100%; }
.tag-editor textarea { min-height: 90px; resize: vertical; }
.tag-editor .muted { margin: 6px 0; font-size: 11px; line-height: 1.5; }

@media (max-width: 379px) {
 .tag-editor .tag-date-fields { grid-template-columns: minmax(0, 1fr); }
}
.map-tool-icon { flex: none; width: 22px; height: 22px; stroke-width: 1.7; }
#fit .map-tool-icon { width: 24px; height: 24px; }

/* Plain-text copy actions preserve the card typography and support keyboard use. */
.copy-text { font: inherit; line-height: inherit; letter-spacing: inherit; color: inherit; text-align: left; padding: 0; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; cursor: copy; user-select: text; -webkit-user-select: text; border-radius: 3px; }
.local-name .copy-text { min-height: 28px; }
/* The location and zoom buttons share one size and one right edge. */
.map-area { --map-control-size: 44px; --map-control-right: 20px; --map-control-top: 20px; }
.map-tools { right: var(--map-control-right); top: var(--map-control-top); align-items: center; }
#locate { flex: none; width: var(--map-control-size); min-width: var(--map-control-size); height: var(--map-control-size); min-height: var(--map-control-size); padding: 0; }
#locate span { display: none; }
.map-zoom { display: flex; flex-direction: column; position: absolute; right: var(--map-control-right); top: calc(var(--map-control-top) + var(--map-control-size) + 16px); width: var(--map-control-size); z-index: 450; overflow: hidden; border: 1px solid var(--ui-button-border); border-radius: var(--ui-radius-control); background: var(--ui-button-fill); color: var(--ui-button-ink); box-shadow: var(--ui-shadow-control-floating); }
.map-zoom button { display: grid; place-items: center; width: 100%; height: var(--map-control-size); border: 0; padding: 0; font-size: 24px; line-height: 1; }
.map-zoom button + button { border-top: 1px solid var(--ui-border); }
.map-zoom button:focus-visible { outline-offset: -4px; }
@media (max-width: 1000px) {
 .map-area { --map-control-right: max(12px, env(safe-area-inset-right)); --map-control-top: 12px; }
}
@media (width > 1000px) {
 .map-area { --place-panel-width: clamp(380px, 32vw, 480px); }
 .detail-open .map-status { max-width: min(360px, calc(100% - var(--place-panel-width) - var(--map-control-right) - 40px)); }
 .detail.ui-panel {
  --ui-sheet-width: var(--place-panel-width);
  --ui-sheet-right: var(--map-control-right);
  /* Leave room above the card for the toolbar and both zoom buttons. */
  max-height: calc(100% - var(--map-control-top) - 3 * var(--map-control-size) - 32px);
 }
}
@media (width > 1000px) and (max-height: 480px) {
 .detail-open .map-zoom { right: calc(var(--map-control-right) + var(--place-panel-width) + 16px); }
 .detail.ui-panel { max-height: calc(100% - var(--map-control-top) - var(--map-control-size) - 16px); }
}

/* Calendar cross-links share the card theme and never decorate map pins. */
.map-planning-relations { border-top: 1px solid var(--ui-border); border-bottom: 1px solid var(--ui-border); margin: 20px 0; padding: 12px 0; }
.map-planning-relations h3 { font-size: 13px; margin: 0 0 8px; }
.map-planning-link { display: block; padding: 8px 0; }
.map-planning-link strong { font-size: 13px; }
.map-planning-link>span { display: block; font-size: var(--ui-text-caption); color: var(--ui-text-muted); }
.planning-status-conflict { background: var(--ui-warning-surface); color: var(--ui-warning); padding: 10px; border-radius: var(--ui-radius-control); }
.planning-status-conflict a { display: block; margin-top: 6px; }
.planning-nav { color: var(--ui-text-muted); white-space: nowrap; }
@media(max-width: 600px) {  .planning-nav { font-size: 11px; padding-inline: 2px; } }

.planning-nav { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.planning-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media(max-width:600px) { .planning-nav { justify-content: center; width: 30px; min-height: 40px; } .planning-nav span { display: none; } }

/* Shared header rhythm: identical text and hit-box spacing on both pages. */
.topbar .top-actions { display: flex; align-items: center; gap: 8px; flex: none; font-family: inherit; font-size: 12px; font-weight: 400; line-height: 20px; color: var(--ui-text-muted); }
.topbar .top-actions>.ui-button--quiet, .topbar .top-actions .theme-control button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 8px; font: inherit; color: inherit; white-space: nowrap; }
.topbar .top-actions>#logout { padding: 0 8px; font: inherit; }
.topbar .top-actions .theme-control button { width: 44px; height: 44px; }
.profile-summary { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; white-space: nowrap; }
.profile-summary .profile-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.profile-summary .profile-dot { flex: none; }
@media(max-width:1000px) {
 .topbar .top-actions { gap: 6px; font-size: 13px; }
 .profile-summary { display: none; }
}
@media(max-width:600px) {
 .topbar .top-actions { gap: 4px; }
 .topbar .top-actions>.ui-button--quiet, .topbar .top-actions .theme-control button { padding-inline: 6px; }
 .topbar .top-actions>#logout { padding-inline: 6px; }
 .topbar .top-actions>.planning-nav, .topbar .top-actions>.help-entry, .topbar .top-actions .theme-control button { width: 36px; min-width: 36px; padding: 0; }
 .topbar:has(.test-stand-label) { gap: var(--ui-space-1); }
 .topbar .test-stand-label { padding-inline: var(--ui-space-1); }
}
@media(max-width:359px) {
 .topbar .top-actions { flex-shrink: 1; min-width: 0; gap: 2px; font-size: 12px; }
 .topbar .top-actions>#accounts-open { white-space: normal; }
 .topbar .top-actions>.planning-nav, .topbar .top-actions>.help-entry, .topbar .top-actions .theme-control button { width: 32px; min-width: 32px; }
 .topbar:has(.test-stand-label) {
  padding-inline: max(var(--ui-space-2), env(safe-area-inset-left)) max(var(--ui-space-2), env(safe-area-inset-right));
 }
 .topbar:has(.test-stand-label) > .brand { display: none; }
 .topbar:has(.test-stand-label) .top-actions { flex-shrink: 0; }
 .topbar:has(.test-stand-label) .top-actions>#accounts-open { white-space: nowrap; }
}

/* Login overlays preserve the map camera, filters and the selected place. */
.login-screen.login-overlay { position: fixed; inset: 0; z-index: 900; overflow-y: auto; min-height: 100%; background: var(--ui-surface-page); }
.login-overlay .login-panel { margin-block: auto; }
#login-back { margin-bottom: 16px; }
.login-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.login-methods:not(:has(> button:not([hidden]))) { display: none; }
.login-methods:has(> button[hidden]) { grid-template-columns: minmax(0, 1fr); }
.quick-login-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 50px; padding: 12px; font-weight: 500; }
.quick-login-icon { flex: none; display: block; width: 20px; height: 20px; color: var(--ui-accent); }
.telegram-icon { fill: currentColor; }
.key-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 359px) { .login-methods { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.passkey-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ui-border); padding-block: 8px; }
.passkey-entry span { min-width: 0; overflow-wrap: anywhere; }
.passkey-entry small { display: block; color: var(--ui-text-muted); margin-top: 4px; }
@keyframes login-autofill { from { opacity: .999; } to { opacity: 1; } }
#login-form input:is(:autofill, :-webkit-autofill) { animation: login-autofill 1ms; }

/* Shared profile notification settings. */
.notification-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.notification-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.notification-actions .ui-button--quiet { padding-inline: 5px; }
.notification-pause { align-items: flex-start; gap: 8px; }
.notification-pause input { flex: none; }
.notification-device { padding: 4px 0; border-top: 1px solid var(--ui-border); overflow-wrap: anywhere; }
.notification-device summary { padding: 7px 0; }
.notification-device small { display: block; color: var(--ui-text-muted); font-size: 12px; }
.notification-device form { padding-bottom: 8px; }
.notification-feedback { color: var(--ui-success); font-size: var(--ui-text-caption); }
.notification-feedback:empty { display: none; }

/* Map layout adapters for the shared pilot components. */
#save-state { margin-top: var(--ui-space-3); }
#place-save-error { margin: var(--ui-space-2) 0 0; }
