:root {
  --bg: #0d110c;
  --panel: #161b14;
  --panel-2: #1d241a;
  --line: #34402e;
  --text: #ecf0df;
  --muted: #aeb9a3;
  --accent: #c9a227;
  --accent-2: #72a86b;
  --danger: #be5b45;
  --terrain: #7fc46b;
  --shop: #d7b85a;
  --event: #de765f;
  --shadow: rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
select:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 12, .94);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #111;
  font-weight: 800;
  background: var(--accent);
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 6px;
}

.brand strong, .brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.session-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,.035);
}

.primary, .ghost {
  min-height: 40px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.primary {
  color: #111;
  font-weight: 700;
  border-color: var(--accent);
  background: var(--accent);
}

.workspace {
  flex: 1;
  position: relative;
  display: block;
  min-height: 0;
}

.control-panel {
  position: fixed;
  left: 18px;
  top: 154px;
  bottom: 18px;
  z-index: 850;
  width: min(340px, calc(100vw - 78px));
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13,17,12,.96);
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  transform: translateX(calc(-100% - 28px));
  transition: transform .22s ease;
}

.panel-close {
  display: none;
  position: sticky;
  top: 0;
  margin-left: auto;
  width: 36px;
  height: 36px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e130d;
  font-size: 24px;
  line-height: 1;
  z-index: 2;
}

body.filters-open .control-panel {
  transform: translateX(0);
}

.panel-toggle {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 900;
  display: grid;
  gap: 4px;
  place-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13,17,12,.9);
  box-shadow: 0 14px 34px rgba(0,0,0,.42);
}

body.filters-open .panel-toggle {
  left: min(376px, calc(100vw - 54px));
}

.panel-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.leaflet-top.leaflet-right {
  top: 18px;
  right: 18px;
}

.leaflet-top .leaflet-control {
  margin-top: 0;
}

.leaflet-right .leaflet-control {
  margin-right: 0;
}

.leaflet-tile-pane > .leaflet-layer:nth-child(-n+3) {
  display: none;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--accent);
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.filter-block, .intel {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}

label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.filter-block label:has(input[type="checkbox"]) {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 12px;
  background: #0e130d;
}

label:has([name="drone"]) {
  display: none !important;
}

.radius-control {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.radius-control label {
  margin-bottom: 0;
}

.radius-control strong {
  color: var(--accent);
}

.compact-button {
  min-height: 34px;
  justify-self: start;
}

textarea {
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.segmented button {
  min-height: 38px;
  color: var(--muted);
  background: #0e130d;
  border-right: 1px solid var(--line);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented .active {
  color: #111;
  font-weight: 700;
  background: var(--accent);
}

.upcoming-list {
  display: grid;
  gap: 10px;
}

.upcoming-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
}

.upcoming-card strong, .upcoming-card span {
  display: block;
}

.upcoming-card span {
  color: var(--muted);
  font-size: 13px;
}

.map-zone {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  height: 100%;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted);
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-chip span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 14px var(--accent-2);
}

.ops-map {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    radial-gradient(circle at 30% 20%, rgba(114,168,107,.22), transparent 28%),
    radial-gradient(circle at 75% 65%, rgba(201,162,39,.16), transparent 30%),
    linear-gradient(135deg, #202a1e, #0d130c 68%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.48), 0 24px 70px var(--shadow);
}

.leaflet-container {
  font: inherit;
  background: #10140f;
}

.leaflet-control-attribution {
  padding: 1px 4px !important;
  color: var(--muted);
  background: rgba(13,17,12,.78) !important;
  font-size: 8px !important;
  line-height: 1.15 !important;
  opacity: .72;
}

.leaflet-control-attribution a {
  font-size: inherit;
}

.leaflet-control-zoom a {
  color: var(--text) !important;
  border-color: var(--line) !important;
  background: var(--panel) !important;
}

.marker {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #111;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(236,240,223,.18), 0 0 22px currentColor;
}

.marker::after {
  content: attr(data-label);
  position: absolute;
  left: 28px;
  top: -8px;
  min-width: 130px;
  max-width: 180px;
  padding: 5px 7px;
  color: var(--text);
  border: 1px solid rgba(236,240,223,.18);
  border-radius: 3px;
  background: rgba(13,17,12,.82);
  font-size: 12px;
  text-align: left;
}

.marker.terrain { color: var(--terrain); background: var(--terrain); }
.marker.shop { color: var(--shop); background: var(--shop); }
.marker.event { color: var(--event); background: var(--event); }

.map-pin {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid #111;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(236,240,223,.18), 0 0 22px currentColor;
}

.map-pin.terrain { color: var(--terrain); background: var(--terrain); }
.map-pin.shop { color: var(--shop); background: var(--shop); }
.map-pin.event { color: var(--event); background: var(--event); }
.map-pin.team { color: #70a8d8; background: #70a8d8; }

.empty-state, .admin-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
}

.admin-panel {
  padding: 14px;
  margin-top: 18px;
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 6px;
  background: rgba(201,162,39,.08);
}

.admin-inbox {
  display: grid;
  gap: 10px;
}

.admin-card strong,
.admin-card span {
  display: block;
}

.admin-card {
  position: relative;
  padding-right: 42px;
}

.notification-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0e130d;
  font-size: 18px;
  line-height: 1;
}

.notification-close:hover {
  color: var(--text);
  border-color: var(--danger);
}

.admin-card strong {
  color: var(--text);
}

.admin-card span {
  margin-top: 4px;
  font-size: 13px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.assign-owner {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 6px;
  background: rgba(201,162,39,.08);
}

.danger {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: rgba(190,91,69,.22);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.notification-button {
  position: relative;
}

.notification-button span {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-item {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}

.notification-item.unread {
  border-color: var(--accent);
}

.notification-item p {
  margin: 6px 0;
}

.notification-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.notification-item.notification-like {
  padding-block: 16px;
}

.notification-item.notification-like strong {
  display: block;
}

.notification-item.notification-like .notification-actions {
  display: none;
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notification-actions:empty {
  display: none;
}

.photo-like {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.photo-like.liked {
  border-color: #e75b72;
  color: #ff8094;
  background: rgba(231, 91, 114, .12);
}

.photo-like:disabled {
  cursor: default;
  opacity: .65;
}

.map-notification {
  position: relative;
}

.public-page {
  min-height: 100vh;
  padding: 32px 16px;
  background: var(--bg);
}

.public-card {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: var(--panel);
}

.public-card h1 {
  margin: 18px 0;
}

.public-hero {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(0, 0, 0, .25);
}

.modal {
  width: min(560px, calc(100vw - 24px));
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0,0,0,.65);
}

.modal.wide {
  width: min(960px, calc(100vw - 24px));
}

.modal.notification-modal {
  width: min(680px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow: auto;
}

.notification-center {
  padding: 28px;
}

.notification-header {
  padding-right: 44px;
  margin-bottom: 20px;
}

.notification-header h1 {
  margin: 0 0 6px;
  line-height: 1.15;
}

.notification-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.notification-modal > .close {
  z-index: 2;
  top: 16px;
  right: 16px;
}

.modal.photo-modal {
  width: min(1100px, calc(100vw - 24px));
  background: #080c0b;
}

.modal::backdrop {
  background: rgba(0,0,0,.72);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0e130d;
  font-size: 22px;
}

.stacked-form, .detail {
  padding: 26px;
  padding-right: 62px;
}

.detail-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.badge {
  align-self: start;
  justify-self: end;
  padding: 7px 10px;
  color: #111;
  border-radius: 3px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.field {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.external-link {
  color: var(--accent);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.external-link:hover,
.external-link:focus-visible {
  color: var(--text);
}

.media-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.photo {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(127,196,107,.2), rgba(201,162,39,.16)),
    repeating-linear-gradient(-45deg, rgba(236,240,223,.06) 0 6px, transparent 6px 12px);
}

.photo-real {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
}

.profile-photo-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 3;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 50%;
  background: rgba(120,25,20,.88);
  box-shadow: 0 4px 14px rgba(0,0,0,.55);
  font-size: 20px;
  line-height: 1;
}

.profile-photo-delete:hover {
  background: var(--danger);
  transform: scale(1.06);
}

.photo-real img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
}

.photo-viewer {
  margin: 0;
  padding: 22px;
}

.photo-viewer img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  border-radius: 6px;
  background: #050706;
}

.photo-viewer figcaption {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  color: var(--muted);
}

.photo-viewer figcaption strong {
  color: var(--text);
}

.photo-real figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}

.admin-tools {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 6px;
  background: rgba(201,162,39,.08);
}

.admin-console {
  padding: 26px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.admin-popup-form {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 8px;
}

.admin-popup-toggle {
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.site-popup-dialog {
  width: min(620px, calc(100vw - 24px));
  border-color: rgba(201,162,39,.75);
}

.site-popup-content {
  padding: 38px 54px 34px 30px;
}

.site-popup-content h2 {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: clamp(24px, 4vw, 34px);
}

.site-popup-content p {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 620px) {
  .admin-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

.admin-tabs button {
  min-height: 40px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0e130d;
}

.admin-tabs button.active {
  color: #111;
  border-color: var(--accent);
  background: var(--accent);
  font-weight: 800;
}

.admin-user-list {
  display: grid;
  gap: 6px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.admin-member-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(190px, 1.6fr) 110px 90px;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,.035);
  text-align: left;
}

.admin-member-row:hover {
  border-color: rgba(201,162,39,.7);
  background: rgba(201,162,39,.08);
}

.admin-member-row span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-member-row strong {
  color: var(--text);
}

.member-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.member-identity img,
.member-avatar-placeholder {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
}

.member-avatar-placeholder {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.admin-member-editor {
  max-height: min(78vh, 760px);
  overflow: auto;
}

.admin-listing-picker {
  display: grid;
  gap: 8px;
}

.admin-listing-picker strong {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.admin-listing-picker label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  margin: 0;
}

.admin-listing-tools {
  display: grid;
  gap: 12px;
}

.admin-listing-results,
.admin-notification-list {
  display: grid;
  gap: 12px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.admin-listing-card,
.admin-notification-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
}

.admin-listing-card strong,
.admin-listing-card span,
.admin-notification-card strong,
.admin-notification-card span {
  display: block;
}

.admin-listing-card span,
.admin-notification-card span,
.admin-notification-card p {
  color: var(--muted);
}

.admin-notification-card p {
  margin-bottom: 6px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.tool-form label:has(textarea),
.tool-form h2,
.tool-form button,
.tool-form .form-message {
  grid-column: 1 / -1;
}

.compact-form {
  grid-template-columns: 1fr;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.events-table th, .events-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.events-table th {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.event-row {
  cursor: pointer;
}

.event-row:hover {
  background: rgba(255,255,255,.035);
}

.link-button {
  min-height: 0;
  padding: 0;
  color: var(--accent);
  border: 0;
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  margin: 2px 4px 2px 0;
  padding: 2px 8px 2px 4px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,.035);
}

.profile-pill img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
}

.team-name-badge,
.person-main .team-name-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 20px;
  margin: 0;
  padding: 2px 7px;
  color: var(--accent);
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 999px;
  background: rgba(201,162,39,.1);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.profile-view {
  padding: 26px;
}

.profile-banner {
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(127,196,107,.22), rgba(201,162,39,.18)),
    #0e130d;
  background-size: cover;
  background-position: center;
}

.profile-head {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: end;
  margin: -38px 0 18px 18px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border: 3px solid var(--panel);
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-contact-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 18px;
}

.photo-real figcaption strong,
.photo-real figcaption span {
  display: block;
}

.photo-real figcaption strong {
  color: var(--text);
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--accent-2);
}

@media (max-width: 860px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100%;
    overflow: hidden;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    min-height: 62px;
    padding: 8px 12px;
    background: rgba(13,17,12,.88);
    backdrop-filter: blur(10px);
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand span {
    display: none;
  }

  .actions {
    position: fixed;
    top: 70px;
    right: 10px;
    z-index: 1100;
    display: grid;
    width: min(280px, calc(100vw - 20px));
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13,17,12,.96);
    box-shadow: 0 18px 54px rgba(0,0,0,.55);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
  }

  body.menu-open .actions {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .actions button,
  .actions .session-status {
    width: 100%;
    justify-content: center;
  }

  .workspace {
    display: block;
    height: 100%;
  }

  .map-zone {
    height: 100%;
    padding: 0;
  }

  .map-toolbar {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    z-index: 800;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13,17,12,.82);
    backdrop-filter: blur(8px);
    font-size: 13px;
  }

  .ops-map {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .control-panel {
    position: fixed;
    left: 10px;
    top: 128px;
    bottom: 14px;
    z-index: 1050;
    width: min(330px, calc(100vw - 24px));
    max-height: none;
    padding: 16px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(13,17,12,.97);
    box-shadow: 0 18px 60px rgba(0,0,0,.6);
    transform: translateX(calc(-100% - 24px));
    transition: transform .22s ease;
  }

  .panel-close {
    display: grid;
    place-items: center;
    margin-bottom: 8px;
  }

  body.filters-open .control-panel {
    transform: translateX(0);
  }

  .panel-toggle {
    left: 12px;
    top: 132px;
    width: 40px;
    height: 40px;
  }

  body.filters-open .panel-toggle {
    display: none;
  }

  .leaflet-top.leaflet-right {
    top: 132px;
    right: 12px;
  }

  .leaflet-control-attribution {
    max-width: 70vw;
    padding: 1px 3px !important;
    font-size: 7px !important;
  }

  .control-panel > section:first-child {
    display: none;
  }

  .filter-block,
  .intel,
  .admin-panel {
    margin-top: 12px;
    padding-top: 12px;
  }

  .mobile-fab {
    position: static;
    z-index: auto;
    display: block;
    width: auto;
    margin-left: auto;
  }

  .mobile-fab button {
    min-height: 40px;
    box-shadow: none;
  }

  .detail-grid, .media-strip {
    grid-template-columns: 1fr;
  }

  .modal,
  .modal.wide {
    width: min(100vw - 16px, 720px);
    max-height: calc(100dvh - 16px);
  }

  .stacked-form, .detail {
    padding-right: 54px;
  }

  #detailDialog {
    height: auto;
    overflow: hidden;
  }

  #detailDialog[open] {
    display: flex;
    flex-direction: column;
  }

  #detailDialog .close {
    z-index: 10;
    top: 8px;
    right: 8px;
    flex: 0 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.65);
  }

  #detailContent {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .admin-member-row,
  .admin-listing-card,
  .admin-notification-card {
    grid-template-columns: 1fr;
  }

  .marker::after {
    min-width: 112px;
    max-width: 132px;
  }
}

@media (min-width: 861px) {
  .mobile-fab {
    display: none;
  }
}

.action-dropdown { position: relative; }
.action-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1300;
  display: grid;
  width: 210px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(13,17,12,.98);
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.action-dropdown-menu button { width: 100%; text-align: left; }
.social-navigation { display: grid; gap: 8px; }
.social-navigation h2 { margin-bottom: 4px; }
.social-navigation button { width: 100%; }
.social-dialog-content {
  max-height: min(760px, calc(100vh - 40px));
  padding: 26px 62px 26px 26px;
  overflow: auto;
}
.social-page, .people-list, .social-search { display: grid; gap: 12px; }
.social-page h1, .social-page h2 { margin-bottom: 0; }
.social-search {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.025);
}
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
}
.person-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.person-main img, .team-header img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.person-main span { margin-left: auto; color: var(--muted); font-size: 12px; }
.person-main .team-name-badge { margin-left: 0; color: var(--accent); font-size: 11px; }
.pending-member { border-color: rgba(201,162,39,.55); border-style: dashed; }
.team-member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.team-header { display: flex; align-items: center; gap: 16px; }
.team-detail-hero {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at top left, rgba(201,162,39,.13), transparent 42%),
    rgba(255,255,255,.025);
}
.team-detail-logo,
.team-header .team-detail-logo {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  padding: 7px;
  border: 2px solid rgba(201,162,39,.65);
  border-radius: 50%;
  object-fit: contain;
  background: #f4f4ef;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.team-detail-logo-placeholder {
  color: #111;
  background: var(--accent);
  font-size: 34px;
  font-weight: 800;
}
.team-detail-identity {
  min-width: 0;
}
.team-detail-identity h1 {
  margin: 3px 0 6px;
  line-height: 1.1;
}
.team-detail-identity p {
  margin: 0;
  color: var(--muted);
}
.team-detail-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.team-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.team-detail-meta .field {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.team-detail-actions {
  padding: 14px 0 2px;
  border-top: 1px solid var(--line);
}
.team-members-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.team-members-section h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
}
.team-members-section h2 span {
  display: grid;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  place-items: center;
  color: #111;
  border-radius: 999px;
  background: var(--accent);
  font-size: 12px;
}
.team-members-section .people-list {
  display: grid;
  gap: 9px;
}
.team-description {
  margin: 2px 0 0;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: rgba(255,255,255,.025);
  line-height: 1.65;
  white-space: pre-line;
}
.team-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.team-photo-gallery figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.team-photo-gallery img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.team-photo-gallery figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .team-detail-hero {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .team-detail-logo,
  .team-header .team-detail-logo {
    width: 76px;
    height: 76px;
    padding: 6px;
  }

  .team-detail-identity h1 {
    font-size: 24px;
  }
}
.team-management-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.team-recommendation,
.team-create-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.025);
}
.team-recommendation p { margin-bottom: 0; }
.team-recommendation > button,
.team-create-block > button { justify-self: start; }
.team-discovery-results {
  display: grid;
  gap: 8px;
}
.team-discovery-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  text-align: left;
}
.team-discovery-card:hover {
  border-color: var(--accent);
  background: rgba(201,162,39,.09);
}
.team-discovery-card img,
.team-photo-placeholder {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  object-fit: cover;
  color: #111;
  background: var(--accent);
  font-weight: 800;
}
.team-discovery-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.team-discovery-copy span,
.team-discovery-copy small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.embedded-form { padding: 0; }
.map-notification {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1500;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(13,17,12,.98);
  box-shadow: 0 24px 80px rgba(0,0,0,.72);
  transform: translate(-50%, -50%);
}
.map-notification strong, .map-notification span { display: block; }
.map-notification span { margin-top: 6px; color: var(--muted); }
.chat-dock { position: fixed; right: 18px; bottom: 18px; z-index: 1250; }
.chat-toggle {
  position: relative;
  min-height: 46px;
  padding: 0 18px;
  color: #111;
  border: 1px solid var(--accent);
  border-radius: 24px;
  background: var(--accent);
  box-shadow: 0 15px 45px rgba(0,0,0,.55);
  font-weight: 800;
}
#chatBadge {
  position: absolute;
  top: -8px;
  left: -8px;
  display: grid;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  place-items: center;
  color: #fff;
  border: 2px solid #171b15;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 4px 14px rgba(220, 38, 38, .55);
  font-size: 12px;
  line-height: 1;
  animation: unread-message-pulse 1s ease-in-out infinite;
}
#chatBadge[hidden] { display: none; }
@keyframes unread-message-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .58; transform: scale(1.12); }
}
.chat-panel {
  position: absolute;
  right: 0;
  bottom: 58px;
  display: grid;
  grid-template-columns: 240px minmax(320px, 420px);
  width: min(680px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 130px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13,17,12,.98);
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
}
.chat-list-pane, .chat-thread-pane { min-height: 0; }
.chat-list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.chat-list-header, .chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.chat-thread-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.conversation-list { flex: 1; overflow: auto; }
.conversation-row {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(52,64,46,.6);
  background: transparent;
  text-align: left;
}
.conversation-row.active { background: rgba(201,162,39,.14); }
.conversation-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-row .conversation-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: inherit;
}
.conversation-row-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-row .conversation-unread {
  display: grid;
  flex: 0 0 auto;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  place-items: center;
  color: #fff;
  border-radius: 999px;
  background: #dc2626;
  font-size: 11px;
  line-height: 1;
}
.chat-thread-pane { display: flex; flex-direction: column; }
.message-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  overflow: auto;
}
.message-bubble {
  align-self: flex-start;
  display: grid;
  max-width: 82%;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 2px;
  background: var(--panel-2);
}
.message-bubble.mine {
  align-self: flex-end;
  border-color: rgba(201,162,39,.55);
  border-radius: 10px 10px 2px 10px;
  background: rgba(201,162,39,.15);
}
.message-bubble strong, .message-bubble time { color: var(--muted); font-size: 11px; }
.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.chat-placeholder { display: grid; height: 100%; place-items: center; color: var(--muted); }

@media (max-width: 860px) {
  .action-dropdown { width: 100%; }
  .action-dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
  }
  .chat-dock { right: 10px; bottom: 72px; }
  .chat-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 128px;
    grid-template-columns: 132px 1fr;
    width: auto;
    height: min(520px, calc(100vh - 150px));
  }
  .chat-list-header { align-items: stretch; flex-direction: column; }
  .conversation-row { padding: 9px; }
  .chat-compose { grid-template-columns: 1fr; }
}
