:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(15, 23, 42, 0.96);
  --bg-glass: rgba(15, 23, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.12);
  --border-focus: #10b981;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-blue: #38bdf8;
  --accent-gold: #f59e0b;
  --danger: #ef4444;
  --drawer-width: 480px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: #000;
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ==================== Fullscreen Map ==================== */
.fullscreen-map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background: #000;
}

/* ==================== Minimalist Floating Top Bar ==================== */
.floating-top-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 44px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  gap: 8px;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-logo {
  font-size: 1.2rem;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.brand-badge-live {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.58rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* Compact Dropdowns */
.compact-dropdowns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 780px;
}

.mini-select {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  flex: 1;
  min-width: 85px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-select:focus {
  border-color: var(--accent-green);
}

.mini-select option {
  background: #0f172a;
  color: #fff;
}

.mini-khasra-search {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1.3;
}

.khasra-dropdown {
  flex: 1.2;
}

.mini-input {
  width: 70px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  outline: none;
}

.mini-input:focus {
  border-color: var(--accent-green);
}

.mini-btn-go {
  background: var(--accent-green);
  color: #042f2e;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 700;
}

/* Top Actions */
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.icon-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-gps {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.btn-record-drawer {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: #a7f3d0;
  position: relative;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #34d399;
}

/* ==================== Map Floating Controls (Top Right) ==================== */
.map-floating-widget {
  position: absolute;
  top: 65px;
  right: 12px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 190px;
}

.opacity-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.opacity-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 3px;
}

.custom-slider {
  width: 100%;
  accent-color: var(--accent-green);
  cursor: pointer;
}

.layer-selector {
  display: flex;
  gap: 3px;
  background: var(--bg-glass);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.layer-pill {
  flex: 1;
  padding: 4px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.layer-pill.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ==================== Draggable Calibration Box ==================== */
.draggable-calib-box {
  position: absolute;
  top: 75px;
  left: 16px;
  z-index: 800;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 16px 35px rgba(0,0,0,0.7);
  backdrop-filter: blur(16px);
  border-radius: 14px;
  width: 240px;
  user-select: none;
}

.draggable-calib-box.hidden {
  display: none;
}

.calib-drag-handle {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 12px 12px 0 0;
}

.calib-drag-handle:active {
  cursor: grabbing;
}

.drag-icon {
  font-size: 0.85rem;
  color: var(--accent-gold);
  margin-right: 4px;
}

.calib-drag-handle strong {
  font-size: 0.78rem;
  color: var(--accent-gold);
  flex: 1;
}

.btn-close-calib {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.calib-body {
  padding: 10px;
}

.calib-hint {
  font-size: 0.62rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-bottom: 8px;
}

.d-pad-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 8px;
}

.d-pad-middle {
  display: flex;
  gap: 3px;
}

.d-btn {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.d-btn:hover {
  background: var(--accent-gold);
  color: #000;
}

.calib-extra-row {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.calib-mini-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #e2e8f0;
  padding: 4px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.calib-status-text {
  font-size: 0.62rem;
  color: var(--accent-green);
  text-align: center;
  font-weight: 700;
  background: rgba(0,0,0,0.3);
  padding: 3px;
  border-radius: 5px;
}

/* ==================== Sliding Side Drawer ==================== */
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--drawer-width);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.75);
}

.side-drawer.collapsed {
  transform: translateX(100%);
}

.drawer-header {
  height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-header h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Khasra Card */
.khasra-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1.5px solid var(--accent-gold);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.khasra-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-khasra {
  background: var(--accent-gold);
  color: #451a03;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 3px 10px;
  border-radius: 6px;
}

.badge-status-green {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

/* Official Hectare Box */
.official-hectare-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 78, 59, 0.35));
  border: 1px solid var(--accent-green);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.official-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #a7f3d0;
  text-transform: uppercase;
}

.hectare-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hectare-number {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  color: #10b981;
  line-height: 1;
}

.hectare-unit {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.official-sub-note {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.conversion-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.khasra-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px;
  border-radius: 8px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item.highlight-item {
  background: rgba(16, 185, 129, 0.15);
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.detail-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
}

.highlight-item .detail-val {
  color: #34d399;
  font-size: 0.9rem;
}

/* ==================== Vertices & Side Lengths Table (User Request) ==================== */
.vertices-section {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vertices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
}

.badge-sides {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 800;
}

.vertices-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.vertices-table-wrapper {
  max-height: 220px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.vertices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  text-align: left;
}

.vertices-table th {
  background: rgba(30, 41, 59, 0.98);
  color: #94a3b8;
  padding: 6px 8px;
  font-size: 0.62rem;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}

.vertices-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.vertices-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.side-name-cell {
  font-weight: 700;
  color: #f59e0b;
}

.kadi-cell {
  color: #cbd5e1;
  font-weight: 600;
}

.meter-cell {
  color: #34d399;
  font-weight: 700;
}

.feet-cell {
  color: #38bdf8;
  font-weight: 700;
}

.gps-coord-cell {
  font-family: monospace;
  font-size: 0.6rem;
  color: #94a3b8;
}

.total-perimeter-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.total-perimeter-banner strong {
  color: #fff;
}

/* Conversion Formula Note Box */
.conversion-formula-note {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.65rem;
  color: #bae6fd;
  line-height: 1.4;
}

.conversion-formula-note strong {
  display: block;
  color: #38bdf8;
  margin-bottom: 4px;
}

.conversion-formula-note ul {
  padding-left: 14px;
}

.conversion-formula-note li {
  margin-bottom: 2px;
}

/* Settlement Landmarks Box */
.settlement-features-box {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settlement-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
}

.landmark-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.landmark-icon {
  font-size: 1.1rem;
}

.landmark-info {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
}

.landmark-info strong {
  color: #f8fafc;
}

.landmark-info span {
  color: var(--text-secondary);
  font-size: 0.65rem;
}

/* Revenue Meta */
.revenue-meta-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.meta-row strong {
  color: #fff;
}

.khasra-action-btns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 2px;
}

.btn-khasra-action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.btn-jamabandi-action {
  background: var(--accent-green);
  color: #042f2e;
}

.btn-jamabandi-action:hover {
  background: #059669;
  color: #fff;
}

.btn-naksha-action {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-color);
}

/* 2-Way Converter */
.card-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #f1f5f9;
}

.converter-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.converter-input-row {
  display: flex;
  gap: 6px;
}

.conv-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  outline: none;
}

.conv-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  outline: none;
}

.conv-equals {
  text-align: center;
  font-size: 0.68rem;
  color: var(--accent-green);
  font-weight: 700;
}

.conv-results-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.conv-chip {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.conv-chip strong {
  color: var(--accent-green);
}

/* ==================== Map Numbered Vertex Badges ==================== */
/* Crisp, clean numbered vertex circle on map (①, ②, ③...) with zero visual clutter */
.vertex-marker-pill {
  width: 22px;
  height: 22px;
  background: #0284c7;
  color: #fff;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  pointer-events: none;
}

/* Responsive */
@media (max-width: 900px) {
  .floating-top-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 8px;
    gap: 4px;
  }

  .compact-dropdowns {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .side-drawer {
    width: 100%;
    height: 70vh;
    top: auto;
    bottom: 0;
    border-radius: 16px 16px 0 0;
  }

  .side-drawer.collapsed {
    transform: translateY(100%);
  }
}
