:root {
  color-scheme: light;
  --bg: #f7f8ff;
  --surface: #ffffff;
  --surface-strong: #eef0ff;
  --text: #171638;
  --muted: #69708b;
  --line: #dfe3f1;
  --brand-blue: #2826a8;
  --brand-blue-dark: #19147c;
  --brand-magenta: #f00670;
  --brand-purple: #7b1fb2;
  --brand-soft: #f3f0ff;
  --teal: var(--brand-blue);
  --teal-dark: var(--brand-blue-dark);
  --amber: #b45309;
  --red: #b91c1c;
  --green: #15803d;
  --blue: #2826a8;
  --shadow: 0 12px 28px rgba(40, 38, 168, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(40, 38, 168, 0.08), rgba(240, 6, 112, 0.08)),
    #ffffff;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.splash-card {
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(420px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(23, 22, 56, 0.14);
  padding: 28px;
}

.splash-xlsmart {
  width: min(270px, 72vw);
  height: auto;
}

.splash-wj {
  width: min(180px, 45vw);
  height: auto;
}

.loading-bar {
  width: min(260px, 68vw);
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceffd;
}

.loading-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-magenta));
  animation: loading-slide 1s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(260%);
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.primary-logo {
  width: clamp(116px, 16vw, 190px);
  max-height: 42px;
}

.mark-logo {
  width: 52px;
  max-height: 52px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-magenta);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.secondary-button,
.primary-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
}

.icon-button {
  min-width: 48px;
  padding: 0 10px;
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.secondary-button {
  padding: 0 14px;
}

.primary-button {
  width: 100%;
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  color: #ffffff;
  padding: 0 16px;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: #b5b8ee;
  background: #fbfbff;
}

.primary-button:hover {
  background: var(--brand-blue-dark);
}

main {
  padding: 18px clamp(12px, 3vw, 28px) 32px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(320px, 1fr) minmax(300px, 420px);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.control-panel,
.tower-panel,
.status-panel,
.poi-panel,
.form-panel,
.transactions-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tower-panel {
  min-height: 430px;
}

.transactions-panel {
  grid-column: 2 / 4;
}

.admin-grid {
  grid-template-columns: minmax(260px, 340px) minmax(520px, 1fr);
}

.admin-table-panel {
  grid-column: auto;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: 0;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.step-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--brand-blue-dark);
  font-size: 13px;
  font-weight: 850;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: #3d4260;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.inline-label {
  margin-bottom: 0;
  white-space: nowrap;
}

.text-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

textarea.text-input {
  resize: vertical;
  min-height: 76px;
}

.text-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(40, 38, 168, 0.14);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar .text-input {
  flex: 1 1 220px;
}

.summary-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
  padding: 12px;
  line-height: 1.35;
}

.summary-strip strong {
  font-size: 15px;
}

.summary-strip span {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
  padding: 10px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.tower-list,
.poi-list,
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poi-panel .poi-list {
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}

.tower-list {
  max-height: 620px;
  overflow: auto;
  padding-right: 2px;
}

.tower-card,
.poi-item,
.transaction-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
}

.tower-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  text-align: left;
}

.tower-card:hover,
.tower-card.is-selected {
  border-color: var(--brand-blue);
  background: #f3f0ff;
}

.tower-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
}

.tower-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tag-stack {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef0ff;
  color: #30346d;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.good {
  background: #e9f7ee;
  color: var(--green);
}

.tag.warn {
  background: #fff3df;
  color: var(--amber);
}

.tag.bad {
  background: #fdecec;
  color: var(--red);
}

.lock-layout {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 16px;
  align-items: center;
}

.radar {
  display: grid;
  place-items: center;
  min-height: 138px;
}

.radius-ring {
  position: relative;
  width: 128px;
  height: 128px;
  border: 2px solid rgba(40, 38, 168, 0.46);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49%, rgba(40, 38, 168, 0.12) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(240, 6, 112, 0.12) 50%, transparent 51%),
    #f8f7ff;
}

.tower-dot,
.user-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.tower-dot {
  left: 50%;
  top: 50%;
  background: var(--brand-magenta);
  box-shadow: 0 0 0 7px rgba(240, 6, 112, 0.14);
}

.user-dot {
  left: 50%;
  top: 50%;
  background: var(--brand-blue);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.14);
}

.lock-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.status-pill {
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #eef0ff;
  color: #30346d;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.status-pill.good {
  background: #e9f7ee;
  color: var(--green);
}

.status-pill.warn {
  background: #fff3df;
  color: var(--amber);
}

.status-pill.bad {
  background: #fdecec;
  color: var(--red);
}

.detail-list {
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #eef0fa;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.lock-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
  padding: 12px;
}

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

.map-head strong {
  font-size: 14px;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.bts {
  background: var(--brand-magenta);
}

.legend-dot.market {
  background: #f59e0b;
}

.legend-dot.school {
  background: #2563eb;
}

.legend-dot.mosque {
  background: #16a34a;
}

.legend-dot.crowd {
  background: #7b1fb2;
}

.poi-map {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 1px solid #cfd5ee;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(240, 6, 112, 0.09), transparent 28%),
    linear-gradient(135deg, #f9f7ff, #eef0ff);
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(40, 38, 168, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 38, 168, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}

.map-radius {
  position: absolute;
  left: 8%;
  top: 8%;
  width: 84%;
  height: 84%;
  border: 2px solid rgba(40, 38, 168, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
}

.map-cross {
  position: absolute;
  background: rgba(40, 38, 168, 0.16);
}

.map-cross.horizontal {
  left: 8%;
  top: 50%;
  width: 84%;
  height: 1px;
}

.map-cross.vertical {
  left: 50%;
  top: 8%;
  width: 1px;
  height: 84%;
}

.map-empty {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(82%, 300px);
  border: 1px solid rgba(40, 38, 168, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  padding: 8px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.map-marker {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(23, 22, 56, 0.22);
  transform: translate(-50%, -50%);
  padding: 0;
}

.map-marker span {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  max-width: 72px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.map-marker.bts {
  z-index: 4;
  width: 24px;
  height: 24px;
  background: var(--brand-magenta);
  box-shadow: 0 0 0 8px rgba(240, 6, 112, 0.14), 0 12px 24px rgba(23, 22, 56, 0.24);
}

.map-marker.market {
  background: #f59e0b;
}

.map-marker.school {
  background: #2563eb;
}

.map-marker.mosque {
  background: #16a34a;
}

.map-marker.crowd {
  background: #7b1fb2;
}

.map-marker.other {
  background: #7b1fb2;
}

.poi-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.poi-item button {
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0 10px;
  font-weight: 800;
}

.poi-name {
  display: block;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.poi-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.poi-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.poi-summary-item,
.poi-summary-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
  padding: 10px;
}

.poi-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.poi-summary-item strong {
  display: block;
  margin-top: 5px;
  color: var(--brand-blue);
  font-size: 17px;
}

.poi-summary-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.poi-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.crowd-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 850;
}

.crowd-badge.high {
  background: #fdecec;
  color: var(--red);
}

.crowd-badge.medium {
  background: #fff3df;
  color: var(--amber);
}

.crowd-badge.low {
  background: #eef0ff;
  color: #30346d;
}

.poi-link {
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.poi-link:hover {
  text-decoration: underline;
}

.sales-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbff;
  padding: 12px;
}

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

.section-title strong {
  font-size: 14px;
}

.section-title span {
  color: var(--brand-magenta);
  font-size: 12px;
  font-weight: 800;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.speedtest-grid {
  grid-template-columns: repeat(3, 1fr);
}

.file-input {
  width: 100%;
  min-height: 42px;
  border: 1px dashed #b5b8ee;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
}

.file-input::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid var(--brand-blue);
  border-radius: 8px;
  background: var(--brand-blue);
  color: #ffffff;
  font-weight: 800;
}

.validation-text {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.validation-text.bad {
  color: var(--red);
}

.validation-text.good {
  color: var(--green);
}

.transaction-item {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.4fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.transaction-item strong {
  display: block;
  font-size: 14px;
}

.transaction-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  background: #ffffff;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #eef0fa;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.35;
}

.admin-table th {
  position: sticky;
  top: 0;
  background: #eef0ff;
  color: #30346d;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.admin-table td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-link {
  color: var(--brand-blue);
  font-weight: 850;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: minmax(280px, 360px) 1fr;
  }

  .status-panel,
  .poi-panel,
  .form-panel {
    grid-column: auto;
  }

  .transactions-panel {
    grid-column: 1 / 3;
  }
}

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

  .brand-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .primary-logo {
    width: 132px;
  }

  .mark-logo {
    width: 46px;
    max-height: 46px;
  }

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

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

  .transactions-panel {
    grid-column: auto;
  }

  .lock-layout,
  .transaction-item {
    grid-template-columns: 1fr;
  }

  .radar {
    min-height: 110px;
  }

  .radius-ring {
    width: 108px;
    height: 108px;
  }

  .form-row,
  .speedtest-grid {
    grid-template-columns: 1fr;
  }

  .map-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .poi-map {
    min-height: 220px;
  }

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

@media (max-width: 420px) {
  .topbar {
    flex-direction: column;
  }

  .brand-row {
    width: 100%;
  }

  .primary-logo {
    width: min(160px, 58vw);
  }

  .topbar-actions,
  .topbar-actions .icon-button {
    width: 100%;
  }

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

  .poi-summary {
    grid-template-columns: 1fr;
  }
}
