:root {
  --ink: #092f34;
  --muted: #6c8184;
  --sea: #058b8f;
  --deep: #004f57;
  --foam: #e2f7f4;
  --sand: #f6f1e7;
  --paper: #fbfcfb;
  --line: #dce6e4;
  --danger: #ca4d48;
  --candidate: #ef6b5a;
  --existing: #0a8990;
  --edit: #f0ad26;
  --shadow: 0 18px 50px rgba(7, 48, 52, .10);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: #eef4f2; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.compact { font-size: 13px; line-height: 1.45; }
.eyebrow { margin: 0 0 5px; color: var(--sea); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.login-shell { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #c9efea, transparent 42%), linear-gradient(145deg, #f8fbfa, #e8f2f0); }
.login-card { width: min(460px, 100%); padding: 38px; border-radius: 30px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-card h1 { margin: 10px 0 12px; font-size: clamp(29px, 5vw, 42px); line-height: 1.04; }
.brand-mark { width: 72px; height: 72px; display: grid; place-items: center; color: white; background: var(--deep); border-radius: 22px; font-size: 35px; margin-bottom: 22px; }
label { display: grid; gap: 7px; margin-top: 16px; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; color: var(--ink); background: white; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(5,139,143,.13); }
.message { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }
.button { border: 0; border-radius: 13px; padding: 11px 15px; color: var(--ink); background: #edf2f1; font-weight: 800; transition: .15s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(.98); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.full { width: 100%; margin-top: 10px; }
.button.primary { color: white; background: var(--sea); }
.button.dark { color: white; background: var(--deep); }
.button.secondary { color: var(--deep); border: 1px solid #9ab2b0; background: white; }
.button.ghost { border: 1px solid #c9d6d4; background: transparent; padding: 9px 13px; }
.button.danger-soft { color: #9f312e; background: #fbe5e2; }
.app-shell { min-height: 100%; padding: 14px; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; }
.brand-inline { display: flex; align-items: center; gap: 12px; }
.brand-inline > span { width: 46px; height: 46px; display: grid; place-items: center; color: white; background: var(--deep); border-radius: 14px; font-size: 23px; }
.brand-inline strong, .brand-inline small { display: block; }
.brand-inline strong { font-size: 20px; }
.brand-inline small { color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.account-pill, .count-pill { padding: 8px 11px; border-radius: 999px; color: var(--deep); background: var(--foam); font-size: 12px; font-weight: 800; }
.workspace { height: calc(100vh - 98px); min-height: 650px; display: grid; grid-template-columns: minmax(265px, .8fr) minmax(430px, 1.65fr) minmax(360px, 1.15fr); gap: 12px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid rgba(8, 62, 67, .06); border-radius: 22px; background: var(--paper); box-shadow: 0 8px 28px rgba(8, 52, 56, .06); }
.candidate-pane, .review-pane { padding: 18px; overflow-y: auto; }
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pane-head h2 { margin: 0; font-size: 24px; }
.search-wrap { position: relative; margin: 16px 0 11px; }
.search-wrap input { padding-right: 42px; }
.search-wrap span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 22px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.filter-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 900; }
.filter-field select { min-width: 0; height: 42px; padding: 0 32px 0 11px; border-color: #c9d6d4; border-radius: 12px; color: var(--ink); background: var(--paper); font-size: 12px; font-weight: 800; }
.candidate-list { display: grid; gap: 8px; margin-top: 6px; }
.candidate-item { width: 100%; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 15px; padding: 11px; text-align: left; color: var(--ink); background: #f1f5f4; }
.candidate-item:hover, .candidate-item.active { border-color: #8bd2cc; background: #e7f7f4; }
.candidate-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--candidate); font-weight: 900; }
.published-record .candidate-icon { background: var(--existing); }
.candidate-icon.category-lighthouse { color: #064f57; background: #ffd45e; border-radius: 50%; }
.candidate-icon.category-rock { color: white; background: #a14f47; border-radius: 8px; }
.navigation-map-div-icon { background: transparent; border: 0; }
.navigation-map-marker { width: 30px; height: 30px; display: grid; place-items: center; box-sizing: border-box; border: 3px solid white; box-shadow: 0 2px 8px rgba(3,45,49,.38); font-size: 17px; font-weight: 950; line-height: 1; }
.navigation-map-marker.selected { width: 34px; height: 34px; border-width: 4px; box-shadow: 0 0 0 3px #004f57, 0 3px 10px rgba(3,45,49,.42); }
.navigation-map-marker.lighthouse-marker { color: #064f57; background: #ffd45e; border-radius: 50%; }
.navigation-map-marker.rock-marker { color: white; background: #a14f47; border-radius: 8px; }
.navigation-map-marker.candidate-navigation-marker { border-color: #ef6b5a; }
.candidate-item strong, .candidate-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.candidate-item small { color: var(--muted); margin-top: 3px; }
.mini-status { color: var(--muted); font-size: 10px; font-weight: 800; }
.map-pane { position: relative; }
#map { width: 100%; height: 100%; background: #cfe3df; }
#map .leaflet-pane, #map .leaflet-layer, #map .leaflet-zoom-animated { backface-visibility: hidden; }
.map-tools { position: absolute; z-index: 500; top: 14px; right: 14px; }
.map-button { width: 44px; height: 44px; border: 0; border-radius: 14px; color: var(--deep); background: white; box-shadow: 0 8px 20px rgba(0,0,0,.15); font-size: 22px; }
.map-hint { position: absolute; z-index: 500; left: 50%; top: 14px; transform: translateX(-50%); max-width: 70%; padding: 10px 14px; border-radius: 13px; color: white; background: rgba(0,79,87,.92); box-shadow: 0 8px 20px rgba(0,0,0,.12); text-align: center; font-size: 12px; font-weight: 800; }
.coordinate-toolbar { position: absolute; z-index: 600; left: 12px; right: 12px; bottom: 62px; display: grid; gap: 10px; padding: 14px; border: 2px solid var(--sea); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.coordinate-summary { min-width: 0; display: grid; gap: 5px; overflow-wrap: anywhere; }
.coordinate-summary strong { font-size: 14px; }.coordinate-summary span { color: var(--muted); font-size: 12px; }
.coordinate-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }.coordinate-actions .button { min-height: 44px; }
.legend { position: absolute; z-index: 500; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.92); font-size: 11px; font-weight: 800; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-symbol { width: 16px; height: 16px; display: grid; place-items: center; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,.2); font-style: normal; font-size: 10px; line-height: 1; }
.lighthouse-symbol { color: #064f57; background: #ffd45e; border-radius: 50%; }
.rock-symbol { color: white; background: #a14f47; border-radius: 4px; }
.dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.candidate-dot { background: var(--candidate); }.existing-dot { background: var(--existing); }.edit-dot { background: var(--edit); }
.empty-state { height: 100%; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-state > span { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 22px; color: var(--sea); background: var(--foam); font-size: 38px; }
.empty-state h2 { margin-bottom: 0; color: var(--ink); }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.standalone-record .comparison-grid { grid-template-columns: 1fr; }
.standalone-record .candidate-review-only { display: none !important; }
.standalone-record dl { font-size: 13px; gap: 9px 12px; }
.record-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.candidate-card { border-top: 4px solid var(--candidate); }.existing-card { border-top: 4px solid var(--existing); }
.record-label { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.record-card h3 { margin: 9px 0 10px; font-size: 17px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: 11px; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.section-title h3 { margin: 0; font-size: 15px; }.section-title small { color: var(--muted); text-align: right; font-size: 10px; }
.match-list { display: grid; gap: 7px; }
.match-item { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; border: 1px solid var(--line); border-radius: 13px; padding: 10px 11px; color: var(--ink); background: white; text-align: left; }
.match-item.active { border-color: var(--existing); background: #e7f7f4; }
.match-item strong, .match-item small { display: block; }.match-item small { color: var(--muted); margin-top: 3px; }
.match-score { align-self: center; padding: 6px 8px; border-radius: 999px; color: var(--deep); background: var(--foam); font-size: 10px; font-weight: 900; }
.note-field { margin-top: 14px; }.note-field textarea { resize: vertical; }
.check-row { grid-template-columns: 18px 1fr; align-items: start; gap: 8px; font-weight: 600; line-height: 1.35; }
.check-row input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--sea); }
.decision-grid { display: grid; grid-template-columns: 1.4fr 1.2fr .8fr; gap: 8px; margin-top: 14px; }
.status-badge { padding: 7px 9px; border-radius: 999px; color: var(--deep); background: var(--foam); font-size: 10px; font-weight: 900; }
.add-place-popup .leaflet-popup-content-wrapper { border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: 0 16px 40px rgba(0,0,0,.24); }
.add-place-popup .leaflet-popup-tip { background: var(--paper); }
.map-add-card { min-width: 215px; display: grid; gap: 10px; }
.map-add-card strong { color: var(--muted); font-size: 12px; }
.map-add-card button { border: 0; border-radius: 11px; padding: 11px 12px; color: white; background: var(--sea); font-weight: 800; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(560px, 90vw); padding: 13px 18px; border-radius: 14px; color: white; background: var(--deep); box-shadow: var(--shadow); font-weight: 800; }
.toast.error { background: #9f312e; }
.record-editor { width: min(900px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: hidden; border: 0; border-radius: 24px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
.record-editor::backdrop { background: rgba(4, 25, 28, .66); backdrop-filter: blur(4px); }
.record-editor form { max-height: calc(100vh - 28px); overflow-y: auto; padding: 24px; }
.editor-head { position: sticky; z-index: 2; top: -24px; display: flex; align-items: flex-start; justify-content: space-between; margin: -24px -24px 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
.editor-head h2 { margin: 0; font-size: 25px; }
.close-button { width: 40px; height: 40px; border: 0; border-radius: 12px; color: var(--ink); background: #e8efed; font-size: 28px; line-height: 1; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 13px; }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-grid label small { color: var(--muted); font-weight: 500; }
.active-row { grid-template-columns: 20px 1fr; align-items: center; align-self: end; min-height: 47px; }
.active-row input { width: 18px; height: 18px; accent-color: var(--sea); }
.editor-coordinate { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 14px; border-radius: 15px; background: var(--foam); }
.editor-coordinate strong, .editor-coordinate span { display: block; }.editor-coordinate span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.editor-actions .danger-delete { margin-right: auto; }
@media (max-width: 1180px) {
  .workspace { height: auto; grid-template-columns: 300px minmax(450px,1fr); }
  .review-pane { grid-column: 1 / -1; min-height: 480px; }
  .candidate-pane, .map-pane { height: 680px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 7px; }.topbar { align-items: flex-start; }.account-pill { display: none; }
  .workspace { display: block; }.candidate-pane, .map-pane, .review-pane { height: auto; margin-bottom: 9px; }
  .candidate-pane { max-height: 480px; }.map-pane { height: 60vh; min-height: 420px; }.review-pane { min-height: 0; }
  .comparison-grid, .decision-grid { grid-template-columns: 1fr; }.section-title { display: block; }.section-title small { display: block; margin-top: 5px; text-align: left; }
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e8f6f4; --muted: #9cb0ae; --paper: #0d2225; --line: #294044; --sand: #203235; }
  body { background: #07181a; }.login-shell { background: radial-gradient(circle at top left, #11484b, transparent 44%), #07181a; }.login-card { background: #10272a; }
  input, textarea, select, .record-card, .match-item, .candidate-item { color: var(--ink); background: #132b2e; }.candidate-item:hover, .candidate-item.active, .match-item.active { background: #123c3d; }
  .button.secondary { color: #79dcd5; border-color: #52706f; background: #10272a; }.button.ghost { color: var(--ink); border-color: #3f5556; }.legend { color: #153538; }
  .close-button { color: var(--ink); background: #20383b; }
}
@media (max-width: 620px) { .editor-grid { grid-template-columns: 1fr; }.editor-grid .wide { grid-column: auto; }.editor-coordinate { align-items: stretch; flex-direction: column; }.editor-actions { flex-wrap: wrap; }.editor-actions .danger-delete { width: 100%; margin-right: 0; } }
:root { --cover-preview-height: 180px; }
.cover-section { margin: 18px 0; padding: 16px; border: 1px solid #d5e3e4; border-radius: 16px; }
.cover-section h3 { margin-top: 0; }
.cover-preview { display: block; width: 100%; max-height: var(--cover-preview-height); object-fit: contain; border-radius: 10px; margin: 10px 0; background: #edf3f3; }
.cover-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-section .compact { font-size: 14px; line-height: 1.5; }
