:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17212b;
  background: #eef3f6;
  --blue: #176987;
  --border: #d5dfe5;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 2px 0 0; color: #64717c; font-size: 13px; }
.account-actions, .row { display: flex; align-items: center; gap: 8px; }
#userName { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout { height: calc(100vh - 72px); display: grid; grid-template-columns: 320px 1fr; }
.sidebar { overflow-y: auto; padding: 16px; background: #fff; border-right: 1px solid var(--border); }
.sidebar > section { margin-top: 24px; }
h2 { margin: 0 0 12px; font-size: 18px; }

.button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: #17212b;
}
.button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button.secondary { background: #f7f9fa; }
.button.danger { border-color: #a83333; background: #a83333; color: #fff; }
#addButton { width: 100%; }

.notice { margin: 12px 0 0; padding: 10px; border-radius: 6px; background: #edf6f8; color: #28596b; font-size: 14px; line-height: 1.4; }
.layer-list { margin: 0 -8px; border-top: 1px solid var(--border); }
.layer { margin: 0; border-bottom: 1px solid var(--border); }
.layer.disabled { opacity: .55; }
.layer-row { min-height: 43px; display: flex; align-items: center; gap: 4px; }
.layer-row > input { width: 16px; height: 16px; margin: 0 3px 0 7px; flex: none; }
.layer-toggle { min-width: 0; flex: 1; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 16px; align-items: center; gap: 7px; padding: 7px 4px; border: 0; background: transparent; text-align: left; }
.layer-toggle:hover, .object-row:hover { background: #f2f6f8; }
.layer-symbol { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
.layer-name, .object-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-name { font-size: 14px; font-weight: 600; }
.layer-count { min-width: 22px; color: #71808a; font-size: 12px; text-align: right; }
.layer-chevron { color: #71808a; font-size: 20px; line-height: 1; }
.layer-items { padding: 0 0 5px 42px; }
.layer-empty { margin: 0; padding: 6px 8px; color: #7a8790; font-size: 12px; }
.object-row { width: 100%; min-width: 0; height: 30px; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; text-align: left; }
.object-row.selected { background: #e7f2f6; color: var(--blue); }
.object-dot { width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #b8c4ca; flex: none; }
.object-name { font-size: 13px; }
.muted { color: #687680; }

.map-wrap { position: relative; min-width: 0; }
#map { width: 100%; height: 100%; background: #dce8ee; }
#map.placing { cursor: crosshair; }
.map-status { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); z-index: 5; padding: 14px 18px; border-radius: 8px; background: #fff; box-shadow: 0 5px 20px #24313c33; }
.map-marker { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 3px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 2px 7px #0005; color: #fff; font-size: 15px; font-weight: 700; line-height: 1; }
.map-marker.draft { width: 28px; height: 28px; }
.object-details { position: absolute; left: 16px; bottom: 16px; z-index: 5; width: min(380px, calc(100% - 32px)); padding: 14px 44px 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 5px 22px #24313c33; }
.object-details .icon-button { position: absolute; top: 3px; right: 3px; }
.object-details h2 { margin: 0 0 5px; font-size: 16px; }
.object-details p { margin: 4px 0 0; font-size: 13px; line-height: 1.4; white-space: pre-line; }
.object-details .detail-meta { font-size: 12px; font-weight: 600; }

dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 40px); padding: 20px; border: 0; border-radius: 10px; box-shadow: 0 20px 60px #1c2d3c44; }
dialog::backdrop { background: #16263388; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; }
.icon-button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 28px; color: #64717c; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #bfcbd2; border-radius: 6px; background: #fff; color: #17212b; }
textarea { resize: vertical; }
.switcher { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.switcher button { padding: 10px; border: 0; border-bottom: 3px solid transparent; background: #fff; }
.switcher button.active { border-bottom-color: var(--blue); color: var(--blue); font-weight: 700; }
.form-error { min-height: 20px; margin: 0; color: #a12d2d; font-size: 14px; }
.dialog-list { display: grid; gap: 12px; margin-top: 16px; overflow-y: auto; }
.submission { padding: 14px; border: 1px solid var(--border); border-radius: 7px; }
.submission h3, .submission p { margin: 0 0 8px; }
.moderation-comment { padding: 8px; background: #fff4df; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 7px; background: #17212b; color: #fff; opacity: 0; pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  body { overflow: auto; }
  .topbar { height: auto; align-items: flex-start; padding: 10px; }
  .topbar p, #userName { display: none; }
  .account-actions { flex-wrap: wrap; justify-content: flex-end; }
  .account-actions .button { min-height: 36px; padding: 6px 9px; font-size: 13px; }
  .layout { height: auto; min-height: calc(100vh - 65px); display: flex; flex-direction: column-reverse; }
  .map-wrap { height: 58vh; min-height: 380px; }
  .sidebar { border-top: 1px solid var(--border); border-right: 0; }
}
