@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --ink: #18332c;
  --teal: #197052;
  --teal-soft: #e3f5eb;
  --muted: #647470;
  --line: #e3ece8;
  --done: #24885f;
  --pending: #d96b43;
  --purple: #7c3aed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

main {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Sidebar Overlay Drawer Modal sobre o Mapa */
aside#sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 2000;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}

aside#sidebar.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  aside#sidebar {
    top: 12px;
    left: 12px;
    bottom: auto;
    width: calc(100vw - 24px);
    max-width: 380px;
    max-height: 80dvh;
    max-height: 80vh;
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  }
}

.side-head {
  padding: 20px 22px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

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

.mark {
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.side-head h1 {
  font: 600 20px Fraunces;
  margin: 2px 0 0;
}

.eyebrow {
  font-size: 9px;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--teal);
  margin: 0;
}

.btn-close-sidebar {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.btn-close-sidebar:hover {
  background: #f0f5f3;
  color: var(--ink);
}

/* Sidebar Token Authentication Card */
.sidebar-auth-card {
  padding: 14px 18px;
  background: #f4f8f6;
  border-bottom: 1px solid #d5e5e0;
  display: grid;
  gap: 8px;
}

.auth-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
}

.sidebar-auth-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: bold;
}

.sidebar-auth-badge.authenticated {
  background: #d1fae5;
  color: #065f46;
}

.sidebar-auth-form {
  display: flex;
  gap: 6px;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.password-input-wrap input {
  width: 100%;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.btn-toggle-eye {
  position: absolute;
  right: 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  user-select: none;
  border-radius: 4px;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.btn-toggle-eye:hover {
  opacity: 1;
}

.btn-sidebar-auth {
  background: var(--teal);
  color: #fff;
  border: 0;
  padding: 7px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sidebar-auth:hover {
  background: #135840;
}

/* Filters Section */
.filters {
  padding: 16px 22px;
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.filters label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.filters input[type="search"], .filters select {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.filters input[type="search"]:focus, .filters select:focus {
  border-color: var(--teal);
}

.checks {
  margin-top: 6px;
  display: grid;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.checks label {
  font-size: 12px;
  color: var(--ink);
  text-transform: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.clear {
  color: var(--teal);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-weight: 600;
  font-size: 12px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 12px 18px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.metric {
  background: #f4f8f6;
  border-radius: 8px;
  padding: 8px 10px;
}

.metric b {
  display: block;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.export-box, .registros-box {
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
}

.btn-export-zip, .btn-open-registros {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.btn-export-zip {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid #c2e9d7;
}

.btn-export-zip:hover {
  background: var(--teal);
  color: #fff;
}

.btn-open-registros {
  background: #18332c;
  color: #fff;
  border: 1px solid #18332c;
}

.btn-open-registros:hover {
  background: #0f231e;
  border-color: #0f231e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.services {
  padding: 16px 12px;
}

.list-title {
  display: flex;
  justify-content: space-between;
  padding: 0 10px 10px;
}

.list-title span {
  color: var(--muted);
  font-size: 12px;
}

.service {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 11px 10px;
  margin: 2px 0;
  color: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.service:hover, .service.selected {
  background: #f3f8f6;
  border-color: #cee0da;
}

.service-top {
  display: flex;
  justify-content: space-between;
  gap: 5px;
}

.service strong {
  font-size: 12px;
}

.service p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: #fff0eb;
  color: #bd4d30;
  white-space: nowrap;
}

.tag.done {
  background: #e3f5eb;
  color: #197052;
}

/* Keyboard Hints Section in Sidebar */
.keyboard-hints-card {
  padding: 16px 18px;
  background: #fafbfb;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.keyboard-hints-card h4 {
  font-size: 12px;
  margin: 0 0 10px;
  color: var(--ink);
}

.keyboard-hints-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.keyboard-hints-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-tag {
  background: #fff;
  border: 1px solid #cbdcd7;
  padding: 3px 7px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 10px;
  font-weight: bold;
  color: var(--ink);
  white-space: nowrap;
}

/* Map Area (Full Screen) */
.map-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100%;
  background: #dce9e5;
}

/* Floating Menu Button on Top-Left of Map */
.btn-floating-menu {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(24, 51, 44, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-floating-menu:hover {
  background: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(24, 51, 44, 0.35);
}

.hamburger-icon {
  font-size: 16px;
}

/* Map Top-Right Controls */
.leaflet-top.leaflet-right {
  top: 14px !important;
  right: 14px !important;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 3px 14px rgba(24, 51, 44, 0.15) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: #fff !important;
  color: var(--ink) !important;
  font-weight: bold;
}

.map-tools {
  position: absolute;
  top: 14px;
  right: 80px;
  z-index: 1000;
  background: #fff;
  border-radius: 8px;
  padding: 3px;
  box-shadow: 0 3px 14px rgba(24, 51, 44, 0.15);
  display: flex;
  gap: 2px;
}

.map-tools button {
  padding: 6px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-tools button.active {
  background: var(--ink);
  color: #fff;
}

.map-tools button.btn-drag-toggle.active {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.legend {
  position: absolute;
  right: 16px;
  bottom: 25px;
  z-index: 500;
  background: #fff;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 3px 14px rgba(24, 51, 44, 0.15);

}

.legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin: 0 4px 0 8px;
}

.legend .dot.pending { background: var(--pending); }
.legend .dot.done { background: var(--done); }

/* Custom Markers & Drag State */
.marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pending);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marker.done {
  background: var(--done);
}

.marker.draggable-active {
  background: var(--purple) !important;
  border-color: #fff;
  transform: scale(1.3);
  animation: pulse-drag 1.2s infinite alternate;
  cursor: grab;
}

@keyframes pulse-drag {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
}

/* Modals */
dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  max-width: 620px;
  width: 92vw;
  box-shadow: 0 15px 40px rgba(12, 28, 24, 0.25);
  background: #fff;
}

dialog::backdrop {
  background: rgba(14, 31, 26, 0.5);
  backdrop-filter: blur(3px);
}

#modal form {
  padding: 24px;
}

.x {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f1f6f4;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.modal-header {
  margin-bottom: 16px;
}

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

.title-row h2 {
  font: 600 22px Fraunces;
  margin: 0;
}

.edit-hint-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #78350f;
}

.edit-hint-banner.unlocked {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group {
  display: grid;
  gap: 4px;
}

.field-group.full {
  grid-column: span 2;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.field-group input, .field-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;

}

.field-group input:disabled, .field-group textarea:disabled {
  background: #f8faf9;
  color: #555;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-status {
  background: var(--done);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-status.is-done {
  background: var(--pending);
}

.btn-save {
  background: var(--teal);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.secondary {
  background: #edf3f0;
  color: var(--ink);
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.photo-box {
  background: #f8faf9;
  border: 1px dashed #c0d4ce;
  padding: 12px;
  border-radius: 10px;
  display: grid;
  gap: 8px;
}

.export-box {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.btn-export-zip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #f0f7f4;
  border: 1px solid #c2ded7;
  color: var(--teal);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-export-zip:hover {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.photo-box {
  background: #f8faf9;
  border: 1px solid #d8e5e1;
  padding: 14px;
  border-radius: 12px;
  display: grid;
  gap: 10px;
}

.photo-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carousel-count-badge {
  background: var(--teal-soft);
  color: var(--teal);
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.photo-preview-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  background: #ffffff;
  border-radius: 10px;
  border: 1.5px dashed #c4d7d1;
  overflow: hidden;
  transition: all 0.2s ease;
}

.photo-preview-container.has-photo {
  border-style: solid;
  border-color: #d1e2dd;
  background: #0f1c18;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(24, 51, 44, 0.78);
  color: #fff;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 12;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  user-select: none;
}

.carousel-arrow:hover {
  background: var(--teal);
  transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.left {
  left: 10px;
}

.carousel-arrow.right {
  right: 10px;
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 12;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-dot.active {
  background: #ffffff;
  width: 16px;
  border-radius: 10px;
}

.photo-preview-container img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.btn-delete-photo {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
  border: 0;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  z-index: 10;
}

.btn-delete-photo:hover {
  background: #dc2626;
  transform: scale(1.04);
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
}

.photo-placeholder .ph-icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.photo-placeholder .ph-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.photo-placeholder .ph-sub {
  font-size: 11px;
  color: var(--muted);
}

.btn-photo {
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-photo:hover:not(:disabled) {
  background: var(--teal);
}

/* Modal Token Manager */
.modal-tokens-content {
  padding: 26px;
  position: relative;
  max-width: 540px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 16px;
}

.token-create-section h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.token-create-form {
  background: #fdfcf7;
  border: 1px solid #e7e2d0;
  padding: 14px;
  border-radius: 10px;
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-create-token {
  background: var(--teal);
  color: #fff;
  border: 0;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.tokens-list-container h3 {
  font-size: 14px;
  margin: 0 0 10px;
}

.tokens-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.token-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 8px;
}

.token-info strong {
  display: block;
  font-size: 13px;
}

.token-info code {
  background: #edf5f2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--teal);
  font-weight: bold;
}

.token-item-actions {
  display: flex;
  gap: 6px;
}

.btn-copy-token-code {
  background: #edf5f2;
  color: var(--teal);
  border: 1px solid #c2ded7;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-revoke {
  background: #fee2e2;
  color: #991b1b;
  border: 0;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error {
  color: var(--pending);
  font-size: 12px;
  margin-top: 8px;
}
