*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #10161a;
  color: #f5f8fa;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1014;
  padding: 24px;
}

.access-gate[hidden] {
  display: none !important;
}

.access-gate-panel {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: #182026;
  border: 1px solid #30404d;
  border-radius: 4px;
}

.access-gate-panel h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.access-gate-error {
  color: #ff7373;
  font-size: 13px;
  margin: 8px 0 0;
}

.access-gate-config {
  color: #f5b041;
  font-size: 13px;
  line-height: 1.45;
}

#app.is-locked {
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

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

.load-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: #ff7373;
  line-height: 1.5;
}

.map-controls {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-controls.bottom-left {
  left: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(100%, 320px);
}

.map-controls.top-right {
  top: 10px;
  right: 10px;
}

.map-toolbar {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.app-readonly .editable-only {
  pointer-events: none;
  opacity: 0.45;
}

.sidebar-readonly .editable-only {
  pointer-events: none;
  opacity: 0.45;
}

.anatel-status {
  margin: 8px 0;
  padding: 8px 10px;
  background: #1e2d3d;
  border: 1px solid #30404d;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.45;
}

.anatel-filters {
  margin-top: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 8px 0;
  cursor: pointer;
}

.radar-tipos-panel {
  margin: 6px 0 4px 1.25rem;
  padding: 8px 10px;
  border-left: 2px solid #3d5a73;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 0 2px 2px 0;
}

.radar-tipos-hint {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.35;
}

.radar-tipos-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: #48aff0;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}

.btn-link:hover {
  color: #7ec8f7;
}

.radar-tipos-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.radar-tipo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  margin: 0;
}

.lucide-icon {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  flex-shrink: 0;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-map.btn-with-icon span {
  font-size: 13px;
}

.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
}

.btn-icon .lucide-icon,
.btn-icon-svg {
  width: 18px;
  height: 18px;
}

.tipo-icon {
  width: 16px;
  height: 16px;
  color: #8a9ba8;
}

.radar-tipo-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.radar-tipo-lucide {
  width: 13px;
  height: 13px;
  opacity: 0.88;
}

.radar-tipo-row .tipo-count {
  margin-left: auto;
  color: #8a9ba8;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.catalog-banner {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #243442;
  border: 1px solid #3d5a73;
  border-radius: 2px;
  font-size: 12px;
}

.catalog-banner a {
  color: #48aff0;
}

.info-attrib {
  font-size: 11px;
  opacity: 0.85;
}

.maparadar-attribution {
  font-size: 11px;
}

.share-url {
  width: 100%;
  margin-top: 8px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  background: #0d1318;
  color: #a7b6c2;
  border: 1px solid #30404d;
  border-radius: 2px;
  padding: 8px;
  resize: vertical;
}

.btn-map {
  padding: 10px 12px;
  background: #30404d;
  color: #f5f8fa;
  border: 1px solid #182026;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  font-size: 13px;
}

.btn-map:hover {
  background: #394b59;
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: min(420px, calc(100% - 20px));
  max-width: 100%;
  background: #293742;
  border: 1px solid #30404d;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  z-index: 10;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #30404d;
  background: #1f2d3d;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
}

.section-title {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #a7b6c2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-title:first-child {
  margin-top: 0;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 12px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  background: #106ba3;
  color: #fff;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  background: #394b59;
  color: #f5f8fa;
}

.btn.success {
  background: #0f9960;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}

.btn-icon.danger {
  color: #ff7373;
}

textarea,
input[type='text'],
input[type='number'] {
  width: 100%;
  padding: 8px;
  border: 1px solid #394b59;
  border-radius: 3px;
  background: #182026;
  color: #f5f8fa;
  font-size: 13px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row .field {
  flex: 1;
}

label {
  display: block;
  font-size: 12px;
  color: #a7b6c2;
  margin-bottom: 4px;
}

.field {
  margin-bottom: 12px;
}

.empty-list {
  text-align: center;
  color: #8a9ba8;
  font-size: 13px;
  padding: 12px;
}

.points-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.points-table th,
.points-table td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.points-table .coords {
  opacity: 0.85;
}

.coords-sub {
  font-size: 10px;
  color: #8a9ba8;
}

.actions {
  white-space: nowrap;
}

#import-errors {
  margin-top: 10px;
  padding: 10px;
  background: rgba(219, 55, 55, 0.15);
  border: 1px solid #db3737;
  border-radius: 3px;
  font-size: 12px;
}

#import-errors ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.hint {
  font-size: 12px;
  color: #8a9ba8;
  margin-top: 8px;
}

hr.divider {
  border: none;
  border-top: 1px solid #5c7080;
  margin: 20px 0;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-panel {
  position: relative;
  width: min(480px, calc(100% - 32px));
  background: #293742;
  border: 1px solid #30404d;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #30404d;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #30404d;
}

/* Google InfoWindow */
.info-window {
  color: #182026;
  min-width: 160px;
}

.info-window h4 {
  margin: 0 0 6px;
}

.info-meta {
  margin: 0 0 8px;
  font-size: 12px;
}

.info-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-actions button {
  font-size: 12px;
  cursor: pointer;
}

.info-actions button.danger {
  color: #c23030;
}