    /* ============================================================
   BASE RESET & TOKENS
============================================================ */
    .md-shell,
    .md-shell *,
    .md-shell *::before,
    .md-shell *::after {
      box-sizing: border-box;
    }

    :root {
      --bg: #f5fdf8;
      --surface: rgba(255, 255, 255, 0.97);
      --border: rgba(45, 158, 95, 0.12);
      --border-g: rgba(45, 158, 95, 0.28);
      --green: #2d9e5f;
      --green-d: #1e7a47;
      --text: #1a3d2b;
      --text-mid: rgba(45, 90, 61, 0.7);
      --text-dim: rgba(45, 90, 61, 0.45);
      --panel-w: 380px;
      --topbar-h: 56px;
      --font: 'Noto Sans Thai', 'Noto Sans', sans-serif;
    }

    body.map-draw-active {
      height: 100%;
      overflow: hidden;
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
    }

    /* ============================================================
   MAP FULL SCREEN
============================================================ */
    #map {
      position: fixed;
      inset: 0;
      top: 90px;
      z-index: 0;
      background: #ffffff;
    }

    /* MapLibre overrides for separated controls */
    .maplibregl-ctrl-bottom-right {
      display: flex;
      flex-direction: column;
      gap: 8px;
      bottom: 24px !important;
      right: 24px !important;
      align-items: flex-end;
      z-index: 100;
    }

    .maplibregl-ctrl-group {
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 0 !important;
    }

    .maplibregl-ctrl-group button {
      width: 38px !important;
      height: 38px !important;
      background: rgba(255, 255, 255, 0.98) !important;
      border: 1px solid rgba(0, 0, 0, 0.06) !important;
      border-radius: 8px !important;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
      transition: all 0.2s !important;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .maplibregl-ctrl-group button:hover {
      background: #ffffff !important;
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12) !important;
    }



    .maplibregl-ctrl-icon {
      transform: scale(0.75) !important;
      filter: opacity(0.65) !important;
    }

    .maplibregl-ctrl-bottom-left {
      bottom: 24px !important;
      left: 14px !important;
    }

    .maplibregl-ctrl-scale {
      background: rgba(255, 255, 255, 0.9) !important;
      border: 1px solid var(--border) !important;
      border-radius: 6px !important;
      color: var(--text-mid) !important;
      font-size: 10px !important;
      padding: 2px 8px !important;
      font-family: var(--font) !important;
    }

    .maplibregl-ctrl-attrib {
      display: none !important;
    }

    /* ============================================================
   TOP BAR (NEW)
============================================================ */
    #md-topbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 60px;
      z-index: 300;
      background: #ffffff;
      border-bottom: 1px solid #f0f0f0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
    }

    .topbar-left {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .topbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .icon-btn {
      width: 36px;
      height: 36px;
      background: #f8f9fa;
      border: 1px solid #e9ecef;
      border-radius: 8px;
      color: #555;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 14px;
      transition: all 0.2s;
    }

    .icon-btn:hover {
      background: #e9ecef;
      color: #000;
    }

    .topbar-title {
      font-size: 14px;
      font-weight: 600;
      color: #333;
    }

    /* ============================================================
   SIDEBAR (LEFT)
============================================================ */
    #md-sidebar-menu {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: 280px;
      background: #ffffff;
      z-index: 400;
      box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
      transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: column;
    }

    #md-sidebar-menu.open {
      transform: translateX(0);
    }

    .sidebar-header {
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      border-bottom: 1px solid #f0f0f0;
    }

    .sidebar-header .brand {
      font-weight: 700;
      color: #e65100;
      font-size: 16px;
    }

    .sidebar-header .version {
      font-size: 10px;
      background: #ffe0b2;
      color: #e65100;
      padding: 2px 6px;
      border-radius: 12px;
      margin-left: 8px;
    }

    .btn-close-sidebar {
      width: 28px;
      height: 28px;
      background: #ff5252;
      color: white;
      border: none;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      cursor: pointer;
    }

    .sidebar-nav {
      flex: 1;
      padding: 20px 0;
      overflow-y: auto;
    }

    .sidebar-nav-title {
      font-size: 11px;
      color: #999;
      padding: 0 24px;
      margin-bottom: 8px;
      margin-top: 16px;
    }

    .sidebar-nav a {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 24px;
      color: #555;
      text-decoration: none;
      font-size: 14px;
      font-weight: 500;
      transition: all 0.2s;
    }

    .sidebar-nav a i {
      font-size: 16px;
      width: 20px;
      text-align: center;
      color: #888;
    }

    .sidebar-nav a:hover {
      background: #f8f9fa;
      color: #333;
    }

    .sidebar-nav a.active {
      background: rgba(45, 158, 95, 0.08);
      color: var(--green);
      border-right: 3px solid var(--green);
    }

    .sidebar-nav a.active i {
      color: var(--green);
    }

    .sidebar-footer {
      padding: 20px;
      border-top: 1px solid #f0f0f0;
      text-align: center;
      font-size: 11px;
      color: #888;
    }

    /* BASEMAP CARD */
    #basemap-card {
      position: fixed;
      bottom: 24px;
      right: 70px;
      width: 220px;
      background: #ffffff;
      border-radius: 12px;
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
      z-index: 500;
      display: flex;
      flex-direction: column;
      padding: 16px;
      opacity: 0;
      transform: translateX(20px);
      pointer-events: none;
      transition: all 0.3s;
    }

    #basemap-card.open {
      opacity: 1;
      transform: translateX(0);
      pointer-events: auto;
    }

    .basemap-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      font-weight: 600;
      font-size: 14px;
      color: #333;
    }

    .basemap-option {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      margin-bottom: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      color: #64748b;
      transition: all 0.2s;
    }

    .basemap-option:hover {
      background: #f8fafc;
      border-color: #cbd5e1;
      color: #334155;
    }

    .basemap-option.active {
      background: rgba(45, 158, 95, 0.08);
      color: var(--green);
      border-color: var(--green);
      font-weight: 600;
    }

    .logo:hover {
      transform: translateY(-2px);
    }

    .logo .logo-img {
      max-height: 48px;
      width: auto;
      display: block;
      filter: drop-shadow(0 2px 4px rgba(45, 158, 95, 0.1));
      transition: all 0.3s ease;
      flex-shrink: 0;
    }

    .logo .logo-img:hover {
      filter: drop-shadow(0 4px 8px rgba(45, 158, 95, 0.2));
    }

    .logo .logo-icon {
      width: 32px;
      height: 32px;
      background: linear-gradient(135deg, var(--green), #0d9488);
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      color: white;
      flex-shrink: 0;
    }

    .logo .brand-text {
      font-size: 16px;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.4px;
      display: flex;
      align-items: center;
    }

    .logo .brand-text .keeper {
      color: var(--green);
      margin-right: 2px;
    }

    .logo .brand {
      font-size: 17px;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.4px;
    }

    .logo .brand span {
      color: var(--green);
    }

    .topnav {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 13px;
    }

    .topnav a {
      color: var(--text-mid);
      text-decoration: none;
      padding: 6px 12px;
      border-radius: 8px;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .topnav a:hover {
      background: rgba(45, 158, 95, 0.08);
      color: var(--green-d);
    }

    .topnav a.active {
      background: rgba(45, 158, 95, 0.1);
      color: var(--green);
      font-weight: 600;
    }

    .topbar-right {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    #nav-user {
      font-size: 12px;
      color: var(--text-mid);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 120px;
    }

    .btn-logout {
      font-size: 11px;
      color: rgba(192, 57, 43, 0.7);
      border: 1px solid rgba(192, 57, 43, 0.2);
      border-radius: 6px;
      padding: 4px 10px;
      background: none;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.2s;
      font-family: var(--font);
    }

    .btn-logout:hover {
      border-color: rgba(192, 57, 43, 0.4);
      color: rgba(192, 57, 43, 0.95);
    }

    /* Mobile menu toggle */
    #menu-toggle {
      display: none;
      background: rgba(45, 158, 95, 0.1);
      border: 1px solid var(--border-g);
      border-radius: 9px;
      width: 36px;
      height: 36px;
      align-items: center;
      justify-content: center;
      color: var(--green);
      font-size: 18px;
      cursor: pointer;
      margin-left: auto;
    }

    /* ============================================================
   DRAW TOOLBAR (floating left)
============================================================ */
    #draw-toolbar {
      position: fixed;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      z-index: 200;
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(16px);
      border: 1px solid rgba(45, 158, 95, 0.15);
      border-radius: 14px;
      padding: 7px 5px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      box-shadow: 0 4px 20px rgba(45, 158, 95, 0.1);
    }

    .tool-btn {
      width: 36px;
      height: 36px;
      border: none;
      border-radius: 9px;
      background: transparent;
      color: var(--text-mid);
      font-size: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s;
    }

    .tool-btn:hover {
      background: rgba(132, 169, 140, 0.16);
      color: var(--green);
    }

    .tool-btn.on {
      background: rgba(132, 169, 140, 0.22);
      color: var(--green);
    }

    .tool-divider {
      height: 1px;
      background: var(--border);
      margin: 3px 2px;
    }

    /* draw cursor */
    .drawing #map {
      cursor: crosshair !important;
    }

    /* vertex dot */
    .vdot {
      width: 10px;
      height: 10px;
      background: var(--green);
      border: 2px solid rgba(255, 255, 255, 0.9);
      border-radius: 50%;
      margin: -5px 0 0 -5px;
      cursor: pointer;
      box-shadow: 0 0 0 3px rgba(132, 169, 140, 0.22);
      transition: transform .15s;
    }

    .vdot:hover {
      transform: scale(1.5);
    }

    /* ============================================================
   SIDE PANEL (desktop left, mobile bottom sheet)
============================================================ */
    #panel {
      position: fixed;
      top: 114px;
      left: 24px;
      bottom: auto;
      max-height: calc(100vh - 138px);
      width: var(--panel-w);
      background: var(--surface);
      backdrop-filter: blur(28px) saturate(150%);
      -webkit-backdrop-filter: blur(28px) saturate(150%);
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
      z-index: 500;
      display: flex;
      flex-direction: column;
      padding: 0;
      overflow: hidden;
      transform: translateX(-120%);
      opacity: 0;
      pointer-events: none;
      transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #panel.open {
      transform: translateX(0);
      opacity: 1;
      pointer-events: auto;
    }

    #btn-open-panel {
      position: fixed;
      top: 114px;
      left: 24px;
      width: 48px;
      height: 48px;
      background: #ffffff;
      border: 1px solid #e9ecef;
      border-radius: 8px;
      color: #555;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      z-index: 200;
      transition: all 0.2s;
    }

    #btn-open-panel:hover {
      background: #f8f9fa;
      color: #000;
    }

    #btn-close-panel {
      position: absolute;
      top: 12px;
      right: 12px;
      background: transparent;
      border: none;
      font-size: 18px;
      color: var(--text-dim);
      cursor: pointer;
      z-index: 10;
    }

    #btn-close-panel:hover {
      color: var(--text);
    }

    .panel-inner {
      flex: 1;
      overflow-y: auto;
      padding: 0 20px 24px;
      overscroll-behavior: contain;
    }

    .panel-inner::-webkit-scrollbar {
      width: 3px;
    }

    .panel-inner::-webkit-scrollbar-thumb {
      background: rgba(132, 169, 140, 0.18);
      border-radius: 3px;
    }

    /* ============================================================
   STEP PROGRESS
============================================================ */
    .steps-bar {
      display: flex;
      align-items: center;
      padding: 12px 20px 14px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      gap: 0;
    }

    .step-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      flex: 1;
      position: relative;
    }

    .step-item:not(:last-child)::after {
      content: '';
      position: absolute;
      top: 12px;
      left: calc(50% + 13px);
      right: calc(-50% + 13px);
      height: 1.5px;
      background: var(--border);
      z-index: 0;
    }

    .step-item.done:not(:last-child)::after {
      background: rgba(132, 169, 140, 0.4);
    }

    .step-dot {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 1.5px solid var(--border);
      background: rgba(255, 255, 255, 0.04);
      color: var(--text-dim);
      font-size: 10px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1;
      transition: all 0.3s;
    }

    .step-item.current .step-dot {
      border-color: var(--green);
      background: rgba(132, 169, 140, 0.2);
      color: var(--green);
      box-shadow: 0 0 0 3px rgba(132, 169, 140, 0.1);
    }

    .step-item.done .step-dot {
      border-color: rgba(132, 169, 140, 0.5);
      background: rgba(132, 169, 140, 0.15);
      color: var(--green);
    }

    .step-lbl {
      font-size: 8.5px;
      font-weight: 500;
      color: var(--text-dim);
      margin-top: 3px;
      text-align: center;
      max-width: 48px;
      line-height: 1.3;
      letter-spacing: 0.1px;
    }

    /* ============================================================
   PANEL STEPS
============================================================ */
    .pstep {
      display: none;
      padding-top: 18px;
    }

    .pstep.active {
      display: block;
    }

    .step-title {
      margin-bottom: 16px;
    }

    .step-tag {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: rgba(132, 169, 140, 0.1);
      border: 1px solid rgba(132, 169, 140, 0.22);
      color: var(--green);
      font-size: 9.5px;
      font-weight: 600;
      padding: 2px 9px;
      border-radius: 20px;
      letter-spacing: 0.8px;
      text-transform: uppercase;
      margin-bottom: 8px;
    }

    .step-title h2 {
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
      letter-spacing: -0.3px;
      margin-bottom: 4px;
    }

    .step-title p {
      font-size: 12px;
      color: var(--text-dim);
      line-height: 1.6;
    }

    /* Method tabs */
    .tabs {
      display: flex;
      gap: 7px;
      margin-bottom: 16px;
    }

    .tab {
      flex: 1;
      padding: 9px 8px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text-dim);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      text-align: center;
      transition: all 0.22s;
      font-family: var(--font);
    }

    .tab i {
      display: block;
      font-size: 15px;
      margin-bottom: 3px;
    }

    .tab.active,
    .tab:hover {
      background: rgba(132, 169, 140, 0.14);
      border-color: rgba(132, 169, 140, 0.35);
      color: var(--green);
    }

    /* Info box */
    .info-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 13px;
      margin-bottom: 13px;
    }

    .info-box-title {
      font-size: 10px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.7px;
      margin-bottom: 8px;
    }

    .info-steps {
      list-style: none;
    }

    .info-steps li {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 5px 0;
      font-size: 12px;
      color: var(--text-mid);
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      line-height: 1.5;
    }

    .info-steps li:last-child {
      border-bottom: none;
    }

    .sn {
      min-width: 16px;
      height: 16px;
      background: rgba(132, 169, 140, 0.15);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 9px;
      font-weight: 700;
      color: var(--green);
      flex-shrink: 0;
      margin-top: 1px;
    }

    /* Draw status */
    .draw-done {
      display: none;
      background: rgba(45, 158, 95, 0.07);
      border: 1px solid rgba(45, 158, 95, 0.25);
      border-radius: 10px;
      padding: 11px 13px;
      margin-bottom: 12px;
      gap: 9px;
      align-items: flex-start;
    }

    .draw-done.show {
      display: flex;
    }

    .draw-done i {
      color: var(--green);
      font-size: 14px;
      margin-top: 1px;
    }

    .draw-done-text {
      font-size: 12px;
      color: var(--text-mid);
      line-height: 1.5;
    }

    .draw-done-text strong {
      color: var(--green);
      font-size: 13px;
      display: block;
    }

    /* SHP requirements */
    .req-box {
      background: rgba(255, 193, 7, 0.04);
      border: 1px solid rgba(255, 193, 7, 0.16);
      border-radius: 10px;
      padding: 12px 13px;
      margin-bottom: 12px;
    }

    .req-title {
      font-size: 10px;
      font-weight: 600;
      color: rgba(255, 193, 7, 0.7);
      text-transform: uppercase;
      letter-spacing: 0.7px;
      margin-bottom: 7px;
    }

    .req-item {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 11.5px;
      color: rgba(255, 193, 7, 0.6);
      padding: 3px 0;
    }

    .req-item i {
      font-size: 12px;
    }

    /* Fields */
    .field {
      margin-bottom: 13px;
    }

    .field label {
      display: block;
      font-size: 10.5px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.6px;
      margin-bottom: 6px;
    }

    .field input,
    .field select {
      width: 100%;
      padding: 10px 13px;
      background: rgba(255, 255, 255, 0.055);
      border: 1px solid rgba(255, 255, 255, 0.11);
      border-radius: 9px;
      color: var(--text);
      font-size: 13.5px;
      font-family: var(--font);
      outline: none;
      transition: all 0.2s;
      -webkit-appearance: none;
      appearance: none;
    }

    .field input::placeholder {
      color: rgba(200, 220, 210, 0.28);
    }

    .field input:focus {
      border-color: rgba(132, 169, 140, 0.5);
      background: rgba(132, 169, 140, 0.06);
      box-shadow: 0 0 0 3px rgba(132, 169, 140, 0.09);
      color: var(--text);
    }

    .field input[readonly] {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .field input[type="file"] {
      cursor: pointer;
      padding: 8px 12px;
    }

    /* SHP status */
    #shp-status {
      font-size: 11.5px;
      color: var(--text-dim);
      min-height: 16px;
      margin-bottom: 9px;
    }

    /* Metric card */
    .metric {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 13px;
      margin-bottom: 10px;
    }

    .metric-label {
      font-size: 9.5px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.7px;
      margin-bottom: 4px;
    }

    .metric-value {
      font-size: 20px;
      font-weight: 700;
      color: var(--green);
    }

    .metric-unit {
      font-size: 11px;
      color: var(--text-dim);
      margin-top: 1px;
    }

    /* Metrics grid */
    .metrics-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 10px;
    }

    .metrics-grid .metric {
      margin-bottom: 0;
    }

    .metrics-grid .metric .metric-value {
      font-size: 16px;
    }

    /* Big carbon card */
    .carbon-hero {
      background: linear-gradient(135deg, rgba(45, 158, 95, 0.08), rgba(30, 122, 71, 0.08));
      border: 1px solid rgba(45, 158, 95, 0.22);
      border-radius: 12px;
      padding: 18px;
      text-align: center;
      margin-bottom: 12px;
    }

    .carbon-hero-label {
      font-size: 10px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.8px;
      margin-bottom: 6px;
    }

    .carbon-hero-value {
      font-size: 34px;
      font-weight: 800;
      color: var(--green);
      letter-spacing: -1px;
      line-height: 1;
    }

    .carbon-hero-unit {
      font-size: 12px;
      color: var(--text-dim);
      margin-top: 4px;
    }

    /* Chart container */
    .chart-box {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 13px;
      margin-bottom: 12px;
    }

    .chart-box-title {
      font-size: 10px;
      font-weight: 600;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.6px;
      margin-bottom: 10px;
    }

    /* Year chips */
    .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      margin-bottom: 12px;
    }

    .chip {
      padding: 3px 9px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border);
      border-radius: 20px;
      font-size: 11px;
      color: var(--text-dim);
    }

    .chip.main {
      background: rgba(132, 169, 140, 0.15);
      border-color: rgba(132, 169, 140, 0.38);
      color: var(--green);
      font-weight: 600;
    }

    /* Analyzing */
    .analyzing {
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 28px 16px;
      text-align: center;
      gap: 12px;
    }

    .analyzing.show {
      display: flex;
    }

    .spin {
      width: 34px;
      height: 34px;
      border: 2.5px solid rgba(132, 169, 140, 0.15);
      border-top-color: var(--green);
      border-radius: 50%;
      animation: rot 0.8s linear infinite;
    }

    @keyframes rot {
      to {
        transform: rotate(360deg);
      }
    }

    .analyzing p {
      font-size: 12.5px;
      color: var(--text-dim);
      margin: 0;
    }

    /* Forecast year presets */
    .preset-wrap {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }

    /* Buttons */
    .btn {
      display: block;
      width: 100%;
      padding: 10px 14px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 600;
      font-family: var(--font);
      cursor: pointer;
      transition: all 0.22s;
      border: none;
      margin-bottom: 7px;
      text-align: center;
      letter-spacing: 0.1px;
    }

    .btn-primary {
      background: linear-gradient(135deg, #2d9e5f, #1e7a47);
      color: #ffffff;
    }

    .btn-primary:hover {
      background: linear-gradient(135deg, #38b26a, #2d9e5f);
      transform: translateY(-1px);
      box-shadow: 0 5px 18px rgba(45, 158, 95, 0.28);
    }

    .btn-primary:disabled {
      background: rgba(45, 158, 95, 0.12);
      color: rgba(45, 90, 61, 0.3);
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .btn-outline {
      background: #f5fdf8;
      border: 1px solid rgba(45, 158, 95, 0.18);
      color: var(--text-mid);
    }

    .btn-outline:hover {
      background: rgba(45, 158, 95, 0.08);
      border-color: rgba(45, 158, 95, 0.3);
      color: var(--text);
    }

    .btn-danger {
      background: transparent;
      border: 1px solid rgba(220, 53, 69, 0.18);
      color: rgba(192, 57, 43, 0.65);
    }

    .btn-danger:hover {
      background: rgba(220, 53, 69, 0.06);
      border-color: rgba(220, 53, 69, 0.3);
      color: #c0392b;
    }

    .btn-sm {
      width: auto;
      padding: 5px 11px;
      font-size: 11.5px;
      font-weight: 500;
      border-radius: 8px;
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-mid);
      cursor: pointer;
      font-family: var(--font);
      transition: all 0.2s;
    }

    .btn-sm:hover {
      background: rgba(132, 169, 140, 0.12);
      border-color: var(--border-g);
      color: var(--green);
    }

    /* ============================================================
   GEOM FLOATING PANEL
============================================================ */
    #geom-panel {
      position: fixed;
      bottom: 70px;
      left: 14px;
      z-index: 300;
      background: rgba(10, 30, 20, 0.93);
      backdrop-filter: blur(16px);
      border: 1px solid rgba(45, 158, 95, 0.4);
      border-radius: 12px;
      padding: 12px 14px;
      width: 300px;
      max-width: calc(100vw - 28px);
      display: none;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
      animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(10px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    #geom-panel.show {
      display: block;
    }

    #geom-panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }

    #geom-panel-title {
      font-size: 10px;
      font-weight: 700;
      color: var(--green);
      text-transform: uppercase;
      letter-spacing: 0.8px;
    }

    #geom-panel-close {
      background: none;
      border: none;
      color: var(--text-dim);
      cursor: pointer;
      font-size: 14px;
      padding: 0;
      line-height: 1;
    }

    #geom-copy-btn {
      margin-top: 8px;
      width: 100%;
      padding: 5px 0;
      background: rgba(45, 158, 95, 0.15);
      border: 1px solid rgba(45, 158, 95, 0.35);
      border-radius: 7px;
      color: var(--green);
      font-size: 11px;
      font-weight: 600;
      cursor: pointer;
      font-family: var(--font);
      transition: all 0.2s;
    }

    #geom-copy-btn:hover {
      background: rgba(45, 158, 95, 0.25);
    }

    #geom-output-pre {
      font-size: 9px;
      color: rgba(180, 220, 195, 0.85);
      max-height: 120px;
      overflow-y: auto;
      white-space: pre-wrap;
      word-break: break-all;
      line-height: 1.5;
      margin: 0;
      background: rgba(0, 0, 0, 0.2);
      border-radius: 6px;
      padding: 7px;
    }

    /* ============================================================
   SEARCH BAR
============================================================ */
    #search-container {
      display: none !important;
    }

    #search-box {
      display: flex;
      padding: 4px;
    }

    #loc-search {
      flex: 1;
      border: none;
      background: transparent;
      padding: 10px 14px;
      outline: none;
      font-size: 13.5px;
      font-family: var(--font);
      color: var(--text);
    }

    #loc-search::placeholder {
      color: var(--text-dim);
    }

    #search-btn {
      background: rgba(45, 158, 95, 0.1);
      border: none;
      color: var(--green);
      border-radius: 9px;
      width: 40px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    #search-btn:hover {
      background: rgba(45, 158, 95, 0.2);
    }

    #search-results {
      display: none;
      border-top: 1px solid var(--border);
      max-height: 220px;
      overflow-y: auto;
      background: rgba(255, 255, 255, 0.98);
    }

    #search-results::-webkit-scrollbar {
      width: 4px;
    }

    #search-results::-webkit-scrollbar-thumb {
      background: rgba(132, 169, 140, 0.3);
      border-radius: 4px;
    }

    .search-item {
      padding: 12px 14px;
      font-size: 12px;
      color: var(--text-mid);
      cursor: pointer;
      border-bottom: 1px solid rgba(0, 0, 0, 0.04);
      line-height: 1.4;
    }

    .search-item:last-child {
      border-bottom: none;
    }

    .search-item:hover {
      background: rgba(45, 158, 95, 0.06);
      color: var(--green);
    }

    /* ============================================================
   STATUS BAR (BOTTOM)
============================================================ */
    #statusbar {
      display: none !important;
    }

    .sdot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--green);
      flex-shrink: 0;
      animation: pulse 2.5s infinite;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: 0.3
      }
    }

    /* ============================================================
   MOBILE STYLES (≤ 768px)
============================================================ */
    @media (max-width: 768px) {
      :root {
        --panel-w: 0px;
      }

      .topnav {
        display: none !important;
      }

      #nav-user {
        display: none;
      }

      .btn-logout {
        display: none;
      }

      #menu-toggle {
        display: flex !important;
      }

      /* Draw toolbar: bottom-left small */
      #draw-toolbar {
        left: 10px;
        top: auto;
        bottom: 180px;
        transform: none;
        flex-direction: column;
        padding: 6px 5px;
        border-radius: 12px;
      }

      /* Panel: full-width bottom sheet */
      #panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 65vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 20px 20px 0 0;
        padding-top: 0;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        transform: translateY(calc(100% - 64px));
        /* collapsed: show only handle */
      }

      #panel.open {
        transform: translateY(0);
      }

      /* Drag handle */
      .panel-handle {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 10px;
        cursor: pointer;
        flex-shrink: 0;
      }

      .panel-handle-bar {
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 2px;
      }

      /* Collapsed header (visible when panel is closed) */
      .panel-collapsed-row {
        display: flex;
        align-items: center;
        padding: 0 16px 10px;
        gap: 10px;
        flex-shrink: 0;
        cursor: pointer;
      }

      .panel-collapsed-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
        flex: 1;
      }

      .panel-collapsed-step {
        font-size: 11px;
        color: var(--green);
        background: rgba(132, 169, 140, 0.12);
        border: 1px solid rgba(132, 169, 140, 0.25);
        border-radius: 20px;
        padding: 2px 10px;
      }

      .panel-toggle-btn {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: rgba(132, 169, 140, 0.12);
        border: 1px solid var(--border-g);
        color: var(--green);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        cursor: pointer;
      }

      /* Steps bar smaller on mobile */
      .steps-bar {
        padding: 8px 14px 10px;
      }

      .step-dot {
        width: 20px;
        height: 20px;
        font-size: 9px;
      }

      .step-lbl {
        font-size: 7.5px;
        max-width: 40px;
      }

      .panel-inner {
        padding: 0 16px 20px;
      }

      /* Status bar full width on mobile */
      #statusbar {
        left: 10px;
        right: 10px;
        bottom: calc(64px + 10px);
        /* above collapsed panel */
        font-size: 11px;
      }

      /* MapLibre controls */
      .maplibregl-ctrl-bottom-left {
        bottom: calc(64px + 90px) !important;
        left: 58px !important;
      }

      .maplibregl-ctrl-bottom-right {
        bottom: calc(64px + 10px) !important;
        right: 10px !important;
      }
    }

    /* ============================================================
   Desktop-only: hide mobile elements
============================================================ */
    @media (min-width: 769px) {
      .panel-handle {
        display: none;
      }

      .panel-collapsed-row {
        display: none;
      }

      #panel {
        transform: translateY(100%) !important;
      }

      #panel.open {
        transform: translateY(0) !important;
      }

      #menu-toggle {
        display: none !important;
      }
    }