* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

.view {
  display: none;
  height: 100vh;
}

.view.active {
  display: block;
}

.login-panel {
  max-width: 360px;
  margin: 15vh auto 0;
  padding: 2rem 2.5rem 2.5rem;
  background: radial-gradient(circle at top left, #1e3a8a, #020617);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.8);
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.login-panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.login-panel .subtitle {
  margin-bottom: 1.5rem;
  color: #9ca3af;
}

label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  border-radius: 0.375rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  background: #1f2937;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn.primary {
  width: 100%;
  margin-top: 0.5rem;
  background: linear-gradient(to right, #4f46e5, #22c55e);
  border-color: transparent;
}

.btn:hover {
  background: #374151;
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.error-msg {
  margin-top: 0.5rem;
  color: #f87171;
  min-height: 1.25rem;
}

.top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: #020617;
  border-bottom: 1px solid #1f2937;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.app-title {
  font-weight: 600;
  margin-right: 0.5rem;
}

.toolbar-user {
  font-size: 0.85rem;
  color: #9ca3af;
}

.tool-btn.active {
  background: #4f46e5;
}

#search-box {
  min-width: 220px;
  padding: 0.3rem 0.6rem;
  border-radius: 0.375rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  grid-template-rows: calc(100vh - 52px - 180px);
}

.panel {
  padding: 0.5rem;
  border-right: 1px solid #1f2937;
  background: #020617;
  overflow: auto;
}

.right-panel {
  border-left: 1px solid #1f2937;
  border-right: none;
}

.panel h2 {
  margin-top: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.map-container {
  position: relative;
}

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

.map-controls {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1000;
}

.map-control {
  width: 28px;
  height: 28px;
  border-radius: 0.375rem;
  border: none;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.85rem;
}

.mouse-coords {
  position: absolute;
  bottom: 0.4rem;
  left: 0.4rem;
  padding: 0.2rem 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 0.375rem;
  font-size: 0.75rem;
}

.bottom-panel {
  height: 180px;
  border-top: 1px solid #1f2937;
  background: #020617;
  display: flex;
  flex-direction: column;
}

.bottom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
}

.bottom-header h2 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.attribute-table-container {
  flex: 1;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #111827;
}

th {
  background: #020617;
  text-align: left;
  cursor: pointer;
}

tr.selected {
  background: rgba(79, 70, 229, 0.3);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-top: 1px solid #111827;
}

.layer-group {
  margin-bottom: 0.6rem;
}

.layer-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.85rem;
}

.layer-group-header span {
  font-weight: 500;
}

.layer-items {
  margin-top: 0.3rem;
  padding-left: 0.4rem;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.layer-item.identify-target {
  background: rgba(79, 70, 229, 0.28);
  border-radius: 0.375rem;
}

.layer-name-label {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.layer-item label {
  margin: 0;
}

.layer-legend {
  margin-left: 1.4rem;
  margin-bottom: 0.3rem;
}

.identify-list {
  max-height: 6rem;
  overflow: auto;
  margin-bottom: 0.5rem;
}

.identify-item {
  padding: 0.2rem 0.4rem;
  margin-bottom: 0.2rem;
  border-radius: 0.375rem;
  cursor: pointer;
}

.identify-item.active {
  background: rgba(79, 70, 229, 0.3);
}

.identify-details {
  font-size: 0.8rem;
  border-top: 1px solid #111827;
  padding-top: 0.4rem;
}

.identify-details dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0.15rem 0.5rem;
}

.identify-details dt {
  font-weight: 500;
  color: #9ca3af;
}

.identify-details dd {
  margin: 0;
}

@media (max-width: 992px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }
}

