* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #070b1a;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  background: #07183d;
  padding: 16px 22px;
  border-bottom: 1px solid #132a63;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
}

.topbar p {
  margin: 5px 0 0;
  color: #aab6d6;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions button {
  width: auto;
  min-width: 145px;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 78px);
}

.panel {
  background: #0b1530;
  padding: 18px;
  border-right: 1px solid #18264d;
}

.panel h2 {
  margin: 14px 0 12px;
  font-size: 17px;
}

label {
  display: block;
  margin-top: 12px;
  color: #cdd6f6;
  font-weight: bold;
}

input,
select,
button,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #263869;
  padding: 12px;
  font-size: 15px;
}

input,
select,
textarea {
  background: #071126;
  color: #ffffff;
}

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

button {
  background: #295cf6;
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: #1f4fe0;
}

.secondary {
  margin-top: 8px;
  background: #111f45;
}

.secondary:hover {
  background: #1b2e63;
}

.danger {
  background: #9f1239;
}

.danger:hover {
  background: #be123c;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 95px;
  gap: 8px;
  margin-top: 8px;
}

.check {
  background: #101d3d;
  padding: 12px;
  border-radius: 10px;
  margin-top: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check input {
  width: auto;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.argos { background: #d71920; }
.smyths { background: #159947; }
.tesco { background: #00539f; }
.asda { background: #6db33f; }
.waterstones { background: #ffffff; }
.lgs { background: #7c3aed; }
.cards { background: #f59e0b; }
.hot-dot { background: #ffd166; }
.restock-dot { background: #22d3ee; }

.hint {
  margin-top: 20px;
  color: #99a6cc;
  font-size: 14px;
  line-height: 1.5;
}

.map-area {
  display: flex;
  flex-direction: column;
}

#map {
  height: 60vh;
  width: 100%;
  background: #111111;
}

.results-bar {
  padding: 12px 18px;
  background: #08132d;
  border-top: 1px solid #18264d;
  border-bottom: 1px solid #18264d;
  color: #aab6d6;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.store-list {
  padding: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
}

.store-card,
.route-card {
  background: #0f1c3c;
  border: 1px solid #22335f;
  border-radius: 14px;
  padding: 14px;
}

.store-card.top-result {
  border-color: #ffd166;
}

.store-card.note-hot {
  border-color: #22c55e;
}

.store-card.note-avoid {
  opacity: .72;
  border-color: #be123c;
}

.store-card h3,
.route-card h3 {
  margin: 0 0 6px;
}

.badge,
.note-badge,
.tag {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  margin: 0 5px 8px 0;
  font-weight: bold;
}

.note-badge {
  background: #334155;
}

.hot-note { background: #16a34a; }
.worth-note { background: #2563eb; }
.avoid-note { background: #be123c; }

.position {
  color: #ffd166;
  font-size: 13px;
  font-weight: bold;
}

.prediction-box {
  background: #082f49;
  border: 1px solid #0ea5e9;
  border-radius: 10px;
  padding: 9px;
  margin-top: 8px;
  color: #e0f2fe !important;
}

.personal-note {
  background: #071126;
  border: 1px solid #263869;
  border-radius: 10px;
  padding: 9px;
  margin-top: 8px;
  color: #dbeafe !important;
}

.store-card p,
.route-card p {
  color: #b7c2e2;
  margin: 6px 0;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.actions a,
.actions button {
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background: #173b91;
  padding: 10px;
  border-radius: 10px;
  font-weight: bold;
  border: none;
  font-size: 14px;
}

.actions a:hover,
.actions button:hover {
  background: #2454c9;
}

.route-panel {
  background: #09142f;
  border-bottom: 1px solid #18264d;
  padding: 14px;
}

.hidden {
  display: none !important;
}

.route-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.route-head h2 {
  margin: 0;
}

.route-head button {
  width: auto;
  padding: 9px 14px;
}

#routeList {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 18px;
}

.modal-card {
  width: min(560px, 100%);
  background: #0b1530;
  border: 1px solid #22335f;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 70px rgba(0,0,0,.55);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
}

.modal-head button {
  width: 46px;
  font-size: 24px;
  padding: 6px;
  background: #111f45;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 850px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions button {
    flex: 1;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid #18264d;
  }

  #map {
    height: 55vh;
  }
}
