:root {
  --bg: #07151c;
  --panel: #0b2029;
  --panel2: #102a34;
  --border: #294752;
  --text: #eef6f8;
  --muted: #a6bac2;
  --green: #77cf4f;
  --green2: #8dde66;
  --blue: #1a4757;
  --warning: #e0a438;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #3c5b67;
  border-radius: 8px;
  background: #071820;
  color: white;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 700;
  touch-action: manipulation;
}

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

.primary {
  background: var(--green);
  color: #07120b;
}

.secondary {
  background: var(--blue);
  color: white;
  border: 1px solid #396574;
}

.warning {
  background: var(--warning);
  color: #171000;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 76px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(7, 21, 28, .97);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.brand {
  font-size: 29px;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}

.subtitle {
  margin-top: 5px;
  color: #bfd0d6;
  font-size: 13px;
}

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

.top-action {
  width: auto;
  background: #102a34;
  color: white;
  border: 1px solid #35515c;
}

.content {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 17px;
}

.card-title {
  color: var(--green2);
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 14px;
}

label {
  display: block;
  margin: 9px 0 5px;
  color: #bfd0d6;
  font-size: 13px;
}

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

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

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

.actions button {
  flex: 1 1 180px;
}

.status-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 9px;
  border: 1px solid #294b57;
  background: #071820;
  color: #c2d4da;
  font-size: 13px;
  line-height: 1.7;
}

.badge {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-weight: 700;
}

.badge-approx {
  background: #665817;
  color: #ffe98a;
}

.metric-big {
  color: var(--green);
  font-size: 26px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.map-card {
  padding: 0;
  overflow: hidden;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}

.map-head-title {
  color: var(--green2);
  font-weight: 800;
}

.map-preview {
  position: relative;
  width: 100%;
  height: 330px;
}

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

.map-overlay-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 900;
  display: flex;
  gap: 8px;
}

.map-overlay-actions button {
  width: auto;
  min-width: 46px;
  background: rgba(7,24,32,.94);
  color: white;
  border: 1px solid #35515c;
}

.map-status {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 800;
  max-width: calc(100% - 24px);
  background: rgba(7,24,32,.93);
  border: 1px solid #35515c;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  color: #d4e2e7;
  pointer-events: none;
}

.system-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #c2d4da;
  font-size: 13px;
}

.system-status span::before {
  content: "✓ ";
  color: var(--green);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(7,21,28,.98);
  border-top: 1px solid var(--border);
}

.bottom-nav button {
  border-radius: 0;
  background: transparent;
  color: #aabcc3;
  min-height: 62px;
  padding: 7px 4px;
  font-size: 12px;
}

.bottom-nav button.active {
  color: var(--green);
}

.bottom-nav .add-main {
  font-size: 26px;
  color: white;
}

.fullscreen-map {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
}

.fullscreen-map.open {
  display: block;
}

.fullscreen-map-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3200;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.fullscreen-map-header button {
  width: auto;
  pointer-events: auto;
  background: rgba(7,24,32,.94);
  color: white;
  border: 1px solid #35515c;
}

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

@media (min-width: 1000px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 390px;
    align-items: start;
  }

  .left-column,
  .right-column {
    display: grid;
    gap: 16px;
  }

  .map-preview {
    height: 360px;
  }

  .bottom-nav {
    display: none;
  }

  .app-shell {
    padding-bottom: 0;
  }
}

@media (max-width: 767px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand {
    font-size: 25px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-action {
    padding: 8px 10px;
  }

  .content {
    width: calc(100% - 20px);
    margin-top: 10px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 18px;
  }

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

  .map-preview {
    height: 250px;
  }

  .map-head {
    padding: 12px 14px;
  }
}

@media (max-width: 380px) {
  .content {
    width: calc(100% - 14px);
  }

  .card {
    padding: 12px;
  }
}
