:root {
  font-family: "Segoe UI", Roboto, sans-serif;
  color: #111;
  background: #f4f5f7;
}

body {
  margin: 0;
  background: #f4f5f7;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.05);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.settings-toggle {
  background: transparent;
  border: 1px solid #cfd4dc;
  color: #0059b3;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.settings-toggle:hover {
  border-color: #0059b3;
  color: #004999;
}

.settings-card.collapsed .settings-body {
  display: none;
}

.settings-summary {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.settings-summary p {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #6dd5ed;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(9, 30, 48, 0.08), rgba(44, 118, 173, 0.1));
  color: #09304a;
  position: relative;
  box-shadow: 0 0 12px rgba(109, 213, 237, 0.35), inset 0 0 18px rgba(109, 213, 237, 0.2);
}

.settings-summary p::before,
.settings-summary p::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(109, 213, 237, 0.6);
  border-radius: 10px;
  pointer-events: none;
}

.settings-summary p::after {
  inset: 2px;
  border-style: solid;
  border-width: 1px 0;
  opacity: 0.5;
}

.settings-card.collapsed .settings-summary {
  display: grid;
}

form {
  display: grid;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.quick-line {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.quick-line input {
  flex: 1;
}

.help-text {
  margin: 0.4rem 0 0;
  color: #6b7280;
  font-size: 0.85rem;
}

label {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

input,
select,
textarea {
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid #cfd4dc;
  font-size: 1rem;
}

button[type="submit"],
#refresh-btn,
#export-btn,
#import-btn {
  background: #0059b3;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
}

button[type="submit"]:hover,
#refresh-btn:hover,
#export-btn:hover,
#import-btn:hover {
  background: #004999;
}

.ghost {
  background: transparent;
  color: #0059b3;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.ghost.danger {
  color: #c0392b;
}

.ghost:hover {
  color: #004999;
}

.ghost.danger:hover {
  color: #96281b;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  border: 1px solid #cfd4dc;
  background: #f8fafc;
  color: #1f2933;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 90px;
}

.action-btn:hover {
  background: #e6f0ff;
  border-color: #86b5e5;
}

.action-btn--delete {
  background: #fff2f0;
  border-color: #f0b0a4;
  color: #b42318;
}

.action-btn--delete:hover {
  background: #ffe3de;
  border-color: #e07f6f;
}

#form-message,
#settings-message {
  min-height: 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.table-wrapper {
  overflow-x: auto;
}

.map-card h2 {
  margin-bottom: 0.4rem;
}

.map-meta {
  margin: 0 0 1rem;
  color: #4b5563;
  font-size: 0.95rem;
}

.map-wrapper {
  width: 100%;
  overflow: hidden;
}

.map-layer {
  position: relative;
  width: 100%;
}

.map-layer img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
}

#connections-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 20px;
}

.map-link {
  stroke: #ff9800;
  stroke-width: 2;
  opacity: 0.65;
}

.map-point {
  stroke: #fff;
  stroke-width: 1.5;
}

.map-point--me {
  fill: #0059b3;
}

.map-point--remote {
  fill: #d94633;
}

.map-point--bounds {
  fill: #000;
}

.map-point--calibration {
  fill: #c00000;
}

.map-message {
  min-height: 1rem;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: #4b5563;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid #e1e5eb;
}

tr:last-child td {
  border-bottom: none;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.table-actions {
  display: flex;
  gap: 0.6rem;
}

#import-input {
  display: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  background: #e8f1ff;
  color: #0059b3;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip:hover {
  background: #d2e4ff;
}

.suggestions h3 {
  margin-bottom: 0.4rem;
}

@media (min-width: 768px) {
  form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-group.full-width {
    grid-column: span 2;
  }
  .form-actions,
  button[type="submit"],
  #form-message,
  #settings-message {
    grid-column: span 2;
  }
}
.highlight-distance {
  border-left: 4px solid #ff9800;
  background: #fff8e1;
}
