* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #111827; -webkit-tap-highlight-color: transparent; }
#map { position: fixed !important; inset: 0; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 8px 8px; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.spacer { flex: 1; }
.search { flex: 1; min-width: 0; display: flex; gap: 6px; }
.search:not(.hidden) + .spacer { display: none; }
.search form { flex: 1; min-width: 0; display: flex; gap: 6px; background: #fff; border-radius: 12px; padding: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.search input { margin: 0; border: 0; padding: 8px; min-width: 0; flex: 1; -webkit-appearance: none; }
.search input:focus { outline: none; }
.search form button { padding: 0 16px; font-weight: 700; }

.icon-btn { width: 40px; height: 40px; flex: none; background: #fff; font-size: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.menu { position: fixed; top: calc(env(safe-area-inset-top) + 56px); right: 8px; background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.25); overflow: hidden; z-index: 5; }
.menu button { display: block; width: 100%; padding: 14px 18px; text-align: left; background: #fff; border-radius: 0; border-bottom: 1px solid #f3f4f6; }

.fab { position: fixed; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 64px); width: 52px; height: 52px; border-radius: 50%; background: #fff; color: #1a73e8; box-shadow: 0 2px 8px rgba(0,0,0,.3); display: grid; place-items: center; }
.hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px); background: rgba(17,24,39,.85); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 14px; pointer-events: none; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.25); padding: 14px 14px calc(env(safe-area-inset-bottom) + 14px); max-height: 75vh; overflow-y: auto; z-index: 4; }
.sheet-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.sheet-title { flex: 1; min-width: 0; }
.sheet .icon-btn { box-shadow: none; background: #f3f4f6; width: 36px; height: 36px; font-size: 16px; }
.address { font-weight: 700; font-size: 17px; }
.meta { color: #6b7280; font-size: 13px; margin-top: 2px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-btn { padding: 14px 8px; font-weight: 700; font-size: 15px; color: #fff; opacity: .55; border: 3px solid transparent; }
.status-btn.active { opacity: 1; border-color: #111827; }
.status-btn:last-child:nth-child(odd) { grid-column: span 2; }

details { margin-top: 12px; }
summary { padding: 8px 0; color: #374151; font-weight: 600; }
input, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px; margin-top: 8px; border: 1px solid #d1d5db; border-radius: 10px; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row button { flex: 1; padding: 12px; font-weight: 600; }
.primary { background: #0f766e; color: #fff; }
.primary:disabled { background: #d1d5db; color: #6b7280; cursor: default; }
.wide { width: 100%; padding: 13px; font-weight: 700; }

.panel { position: fixed; inset: 0; background: #fff; z-index: 8; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 12px) 18px calc(env(safe-area-inset-bottom) + 24px); line-height: 1.5; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h2 { margin: 0; color: #0f766e; font-size: 21px; }
.panel h3 { margin: 22px 0 4px; font-size: 16px; }
.panel ol, .panel ul { padding-left: 22px; margin: 4px 0; }
.panel li { margin-bottom: 6px; }
.panel a { color: #0f766e; font-weight: 600; }
.panel pre { background: #f3f4f6; padding: 10px; border-radius: 8px; font-size: 13px; overflow-x: auto; margin: 6px 0; }
.panel .url { font-weight: 700; word-break: break-all; margin: 4px 0 10px; }
.panel .icon-btn { box-shadow: none; background: #f3f4f6; }
.danger { background: #fee2e2; color: #b91c1c; }

.overlay { position: fixed; inset: 0; background: rgba(15,118,110,.95); display: grid; place-items: center; z-index: 10; padding: 20px; }
.card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 360px; line-height: 1.5; }
.card h1 { margin: 0 0 8px; color: #0f766e; }
.card button { width: 100%; padding: 13px; margin-top: 14px; font-weight: 700; }
.card p { margin: 6px 0; }
.card .sub { color: #4b5563; font-size: 14px; }
.links { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.card .links button, .link { width: auto; margin: 0; padding: 6px 0; background: none; color: #0f766e; font-weight: 600; font-size: 14px; }
.menu-org { padding: 12px 18px 8px; font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.team-list { list-style: none; padding: 0; margin: 12px 0; }
.team-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.team-list .who { font-weight: 600; word-break: break-all; }
.team-list .role { color: #6b7280; font-size: 13px; align-self: center; }
.team-list .actions { grid-column: span 2; display: flex; gap: 8px; }
.team-list .actions button { padding: 6px 10px; font-size: 13px; background: #f3f4f6; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 15px; }
.check input { width: auto; margin: 0; }
.small { font-size: 13px; color: #6b7280; }
#addMemberForm .wide, #createOrgForm .wide { margin-top: 4px; }
.error { color: #b91c1c; min-height: 1em; margin: 10px 0 0; font-size: 14px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 60px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 90vw; text-align: center; }
