@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@500;600;700;800&display=swap");

:root {
  --navy-950: #041127;
  --navy-900: #071a36;
  --navy-850: #0a2345;
  --navy-800: #10305c;
  --orange-500: #ff8f1f;
  --orange-600: #ea7800;
  --blue-300: #7cc8ff;
  --line: rgba(255, 255, 255, 0.16);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-soft: rgba(231, 242, 255, 0.86);
  --shadow: 0 16px 30px rgba(2, 10, 21, 0.4);
}

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

html,
body,
#root {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Barlow", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(124, 200, 255, 0.18), transparent 38%),
    radial-gradient(circle at 86% 2%, rgba(255, 143, 31, 0.2), transparent 34%),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 36%, var(--navy-950) 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.route-app {
  min-height: 100vh;
  padding: 10px 10px 14px;
}

.route-frame {
  width: min(780px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 8px;
}

.work-header {
  border: 1px solid var(--line);
  background: rgba(4, 17, 39, 0.82);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 9px;
  display: grid;
  gap: 7px;
}

.work-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(208, 229, 250, 0.92);
  font-weight: 700;
}

.title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  align-items: center;
}

.route-name {
  width: 100%;
  border: 1px solid var(--line-soft);
  background: rgba(9, 34, 66, 0.86);
  color: var(--text);
  border-radius: 9px;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 8px 10px;
  min-height: 40px;
}

.route-name::placeholder {
  color: rgba(223, 240, 255, 0.55);
}

.route-name:focus {
  outline: 2px solid rgba(255, 143, 31, 0.75);
  outline-offset: 1px;
}

.tiny-button {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 700;
  font-size: 0.87rem;
  white-space: nowrap;
}

.tiny-button:active {
  transform: translateY(1px);
}

.route-stats {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-soft);
  font-weight: 600;
}

.screen-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.screen-switch button {
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 6px;
}

.screen-switch button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.screen-switch button.is-active {
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  border-color: rgba(255, 143, 31, 0.9);
}

.card {
  border: 1px solid var(--line);
  background: rgba(4, 17, 39, 0.84);
  box-shadow: var(--shadow);
  border-radius: 12px;
}

.compact-card {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.compact-card h2,
.compact-card h3 {
  margin: 0;
}

.compact-card h2 {
  font-size: 1.02rem;
}

.compact-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.route-input {
  width: 100%;
  min-height: 130px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 37, 72, 0.9);
  color: var(--text);
  padding: 9px 10px;
  font-size: 0.95rem;
  line-height: 1.35;
  resize: vertical;
}

.route-input::placeholder {
  color: rgba(220, 239, 255, 0.53);
}

.route-input:focus {
  outline: 2px solid rgba(255, 143, 31, 0.75);
  outline-offset: 1px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.primary-action {
  min-height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.primary-action:active {
  transform: translateY(1px);
}

.small-note {
  margin: 0;
  font-size: 0.76rem;
  color: rgba(214, 231, 249, 0.85);
}

.sticky-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(4, 17, 39, 0.97);
  padding-bottom: 2px;
}

.cluster-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cluster-tab {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
}

.cluster-tab.is-active {
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  border-color: rgba(255, 143, 31, 0.9);
}

.overview-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.cluster-overview {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(9, 34, 66, 0.7);
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.cluster-overview:focus {
  outline: 2px solid rgba(255, 143, 31, 0.75);
  outline-offset: 1px;
}

.cluster-overview.is-active {
  border-color: rgba(255, 143, 31, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 143, 31, 0.5);
}

.cluster-overview h3 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.cluster-overview ul {
  margin: 0;
  padding: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.street-line {
  list-style: none;
  display: grid;
  gap: 3px;
  background: rgba(10, 35, 68, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 5px 6px;
}

.street-meta {
  margin: 0;
  color: rgba(236, 245, 255, 0.95);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.2;
}

.street-numbers {
  margin: 0;
  color: rgba(214, 231, 249, 0.92);
  font-size: 0.76rem;
  line-height: 1.2;
}

.street-line.is-duplicate {
  border-color: rgba(255, 143, 31, 0.7);
  background: linear-gradient(145deg, rgba(255, 143, 31, 0.12), rgba(9, 34, 66, 0.76));
  box-shadow: inset 2px 0 0 rgba(255, 143, 31, 0.7);
}

.overlap-pill {
  flex: 0 0 auto;
  justify-self: start;
  border: 1px solid rgba(255, 143, 31, 0.65);
  background: rgba(255, 143, 31, 0.18);
  color: #ffd9b0;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.cluster-detail h3 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.detail-list {
  display: grid;
  gap: 5px;
}

.detail-row {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(9, 34, 66, 0.7);
  padding: 6px 7px;
  display: grid;
  gap: 2px;
}

.detail-row.is-duplicate {
  border-color: rgba(255, 143, 31, 0.72);
  background: linear-gradient(145deg, rgba(255, 143, 31, 0.13), rgba(9, 34, 66, 0.78));
  box-shadow: inset 3px 0 0 rgba(255, 143, 31, 0.72);
}

.detail-street {
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-street span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-duplicate-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 143, 31, 0.68);
  background: rgba(255, 143, 31, 0.2);
  color: #ffd9b0;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.detail-numbers {
  margin: 0;
  color: rgba(214, 231, 249, 0.94);
  font-size: 0.77rem;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .route-app {
    padding: 14px;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .street-meta {
    font-size: 0.78rem;
  }
}
