    /* ─── MD3 Design Tokens ─────────────────────────────────────────── */
    :root {
      --md-primary:            #006A60;
      --md-on-primary:         #FFFFFF;
      --md-primary-container:  #9EF2E4;
      --md-on-primary-container: #00201C;
      --md-secondary:          #4A6361;
      --md-secondary-container: #CCE8E5;
      --md-on-secondary-container: #051F1E;
      --md-tertiary:           #006783;
      --md-tertiary-container: #BCE9FF;
      --md-surface:            #F4FBFA;
      --md-surface-variant:    #DAE5E3;
      --md-surface-container-lowest: #FFFFFF;
      --md-surface-container-low:    #EEF5F4;
      --md-surface-container:        #E8F2F1;
      --md-surface-container-high:   #E2ECEA;
      --md-surface-container-highest:#DCE7E6;
      --md-on-surface:         #161D1D;
      --md-on-surface-variant: #3F4948;
      --md-outline:            #6F7978;
      --md-outline-variant:    #BEC9C8;
      --md-error:              #BA1A1A;
      --md-error-container:    #FFDAD6;
      --md-on-error-container: #410002;
      --md-success:            #006E26;
      --md-success-container:  #95F7A5;

      --md-elevation-1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14);
      --md-elevation-2: 0 2px 6px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.14);
      --md-elevation-3: 0 4px 12px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.14);

      --panel-width: 340px;
      --appbar-height: 60px;
    }

    /* ─── Reset & Base ──────────────────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html, body { height: 100%; overflow: hidden; font-family: 'Roboto', sans-serif; background: var(--md-surface); color: var(--md-on-surface); }

    /* ─── App Bar ───────────────────────────────────────────────────── */
    #appbar {
      position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
      height: var(--appbar-height);
      background: var(--md-surface-container-lowest);
      border-bottom: 1px solid var(--md-outline-variant);
      box-shadow: var(--md-elevation-1);
      display: flex; align-items: center; padding: 0 20px; gap: 14px;
    }
    #appbar .app-icon {
      width: 36px; height: 36px;
      display: flex; align-items: center; justify-content: center;
      font-size: 20px;
    }
    #appbar .app-icon img { width: 36px; height: 36px; object-fit: contain; }
    #appbar .app-title { font-size: 18px; font-weight: 700; color: var(--md-primary); letter-spacing: -0.3px; }
    #appbar .app-subtitle { font-size: 12px; color: var(--md-on-surface-variant); font-weight: 400; margin-top: 1px; }
    #appbar .service-status {
      display: flex; align-items: center; gap: 7px;
      font-size: 12px; color: var(--md-on-surface-variant);
    }
    #status-dot {
      width: 8px; height: 8px; border-radius: 50%; background: var(--md-outline-variant);
      transition: background .3s;
    }
    #status-dot.online { background: var(--md-success); }
    #status-dot.error  { background: var(--md-error); }

    /* ─── User chip (app bar) ──────────────────────────────────────── */
    #user-chip {
      display: none; align-items: center; gap: 8px;
      margin-left: auto; padding: 4px 12px 4px 4px;
      border-radius: 20px; border: 1.5px solid var(--md-outline-variant);
      background: var(--md-surface-container-low);
      cursor: default;
    }
    #user-chip.visible { display: flex; }
    #user-avatar {
      width: 28px; height: 28px; border-radius: 50%;
      object-fit: cover; flex-shrink: 0;
    }
    #user-avatar-initials {
      width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
      background: var(--md-primary); color: var(--md-on-primary);
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
    }
    #user-name { font-size: 13px; font-weight: 500; color: var(--md-on-surface); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #user-email { font-size: 11px; color: var(--md-on-surface-variant); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #btn-logout {
      margin-left: 4px; height: 26px; padding: 0 10px;
      border: none; border-radius: 13px;
      background: var(--md-surface-container-high); cursor: pointer;
      font-family: 'Roboto', sans-serif; font-size: 12px; font-weight: 500;
      color: var(--md-on-surface-variant); transition: background .15s;
    }
    #btn-logout:hover { background: var(--md-error-container); color: var(--md-on-error-container); }

    /* ─── Login overlay ─────────────────────────────────────────────── */
    #login-overlay {
      display: none; position: fixed; inset: 0; z-index: 9000;
      background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
      align-items: center; justify-content: center;
    }
    #login-overlay.visible { display: flex; }
    #login-card {
      background: var(--md-surface-container-lowest);
      border-radius: 24px; box-shadow: 0 8px 48px rgba(0,0,0,.28);
      width: 380px; max-width: calc(100vw - 40px);
      padding: 40px 36px 36px; display: flex; flex-direction: column;
      align-items: center; gap: 0;
    }
    #login-logo {
      display: flex; align-items: center; justify-content: center;
      margin-bottom: 20px;
    }
    #login-logo img { width: 56px; height: 56px; object-fit: contain; }
    #login-card h1 { font-size: 22px; font-weight: 800; color: var(--md-on-surface); margin: 0 0 6px; text-align: center; }
    #login-card p  { font-size: 14px; color: var(--md-on-surface-variant); margin: 0 0 32px; text-align: center; line-height: 1.5; }
    #btn-google-signin {
      display: flex; align-items: center; gap: 12px;
      width: 100%; padding: 12px 20px; border-radius: 12px;
      background: #fff; border: 1.5px solid #dadce0;
      cursor: pointer; transition: box-shadow .2s, background .15s;
      font-family: 'Roboto', sans-serif; font-size: 15px; font-weight: 500;
      color: #3c4043; box-shadow: 0 1px 3px rgba(0,0,0,.08);
      justify-content: center;
    }
    #btn-google-signin:hover { box-shadow: 0 2px 8px rgba(0,0,0,.14); background: #f8f9fa; }
    #btn-google-signin svg { width: 20px; height: 20px; flex-shrink: 0; }
    #login-terms { font-size: 11px; color: var(--md-on-surface-variant); margin-top: 20px; text-align: center; line-height: 1.5; }

    /* ─── Feedback button ───────────────────────────────────────────── */
    #btn-feedback {
      margin-left: 10px; height: 34px; padding: 0 14px;
      border: 1.5px solid var(--md-outline-variant); border-radius: 17px;
      background: transparent; cursor: pointer;
      display: flex; align-items: center; gap: 5px;
      font-family: 'Roboto', sans-serif; font-size: 13px; font-weight: 500;
      color: var(--md-on-surface-variant); transition: background .15s, border-color .15s;
    }
    #btn-feedback:hover { background: var(--md-surface-container); border-color: var(--md-outline); }
    #btn-feedback .material-icons-round { font-size: 16px; }

    /* ─── Feedback Modal ────────────────────────────────────────────── */
    #feedback-backdrop {
      display: none; position: fixed; inset: 0; z-index: 3000;
      background: rgba(0,0,0,.45); align-items: center; justify-content: center;
    }
    #feedback-backdrop.open { display: flex; }
    #feedback-dialog {
      background: var(--md-surface-container-lowest);
      border-radius: 16px; box-shadow: var(--md-elevation-3);
      width: 400px; max-width: calc(100vw - 32px);
      padding: 24px; display: flex; flex-direction: column; gap: 14px;
    }
    #feedback-dialog h2 {
      font-size: 17px; font-weight: 700; color: var(--md-on-surface);
      display: flex; align-items: center; gap: 8px; margin: 0;
    }
    #feedback-dialog h2 .material-icons-round { color: var(--md-primary); font-size: 20px; }
    #fb-message {
      width: 100%; min-height: 120px; resize: vertical;
      border: 1.5px solid var(--md-outline-variant); border-radius: 8px;
      background: var(--md-surface-container-low);
      font-family: 'Roboto', sans-serif; font-size: 14px; color: var(--md-on-surface);
      padding: 10px 12px; transition: border-color .2s;
    }
    #fb-message:focus { outline: none; border-color: var(--md-primary); }
    .fb-actions { display: flex; justify-content: flex-end; gap: 10px; }

    /* ─── Download Type Modal ───────────────────────────────────────── */
    #dl-type-backdrop {
      display: none; position: fixed; inset: 0; z-index: 3000;
      background: rgba(0,0,0,.45); align-items: center; justify-content: center;
    }
    #dl-type-backdrop.open { display: flex; }
    #dl-type-dialog {
      background: var(--md-surface-container-lowest);
      border-radius: 16px; box-shadow: var(--md-elevation-3);
      width: 340px; max-width: calc(100vw - 32px);
      padding: 24px; display: flex; flex-direction: column; gap: 14px;
    }
    #dl-type-dialog h2 {
      font-size: 17px; font-weight: 700; color: var(--md-on-surface);
      display: flex; align-items: center; gap: 8px; margin: 0;
    }
    #dl-type-dialog h2 .material-icons-round { color: var(--md-primary); font-size: 20px; }

    /* ─── Save Config Modal ─────────────────────────────────────────── */
    #save-config-backdrop {
      display: none; position: fixed; inset: 0; z-index: 3000;
      background: rgba(0,0,0,.45); align-items: center; justify-content: center;
    }
    #save-config-backdrop.open { display: flex; }
    #save-config-dialog {
      background: var(--md-surface-container-lowest);
      border-radius: 16px; box-shadow: var(--md-elevation-3);
      width: 420px; max-width: calc(100vw - 32px);
      padding: 24px; display: flex; flex-direction: column; gap: 14px;
    }
    #save-config-dialog h2 {
      font-size: 17px; font-weight: 700; color: var(--md-on-surface);
      display: flex; align-items: center; gap: 8px; margin: 0;
    }
    #save-config-dialog h2 .material-icons-round { color: var(--md-primary); font-size: 20px; }
    #save-config-dialog p { font-size: 13px; color: var(--md-on-surface-variant); margin: 0; }
    #save-config-name {
      width: 100%; box-sizing: border-box;
      border: 1.5px solid var(--md-outline-variant); border-radius: 8px;
      background: var(--md-surface-container-low);
      font-family: 'Roboto', sans-serif; font-size: 14px; color: var(--md-on-surface);
      padding: 10px 12px; transition: border-color .2s;
    }
    #save-config-name:focus { outline: none; border-color: var(--md-primary); }
    .sc-actions { display: flex; justify-content: flex-end; gap: 10px; }

    /* ─── Layout ────────────────────────────────────────────────────── */
    #layout {
      position: fixed;
      top: var(--appbar-height); bottom: 0; left: 0; right: 0;
      display: flex;
    }

    /* ─── Left Panel ────────────────────────────────────────────────── */
    #panel {
      width: var(--panel-width);
      min-width: var(--panel-width);
      background: var(--md-surface-container-low);
      border-right: 1px solid var(--md-outline-variant);
      display: flex; flex-direction: column;
      overflow: hidden;
    }
    /* Sticky top zone: GEE Mapping + Progress always visible */
    #panel-sticky {
      flex-shrink: 0;
      background: var(--md-surface-container-low);
      border-bottom: 2px solid var(--md-outline-variant);
      box-shadow: 0 2px 6px rgba(0,0,0,.08);
      z-index: 10;
    }
    /* Scrollable zone: everything else */
    #panel-scroll {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
    }
    #panel-scroll::-webkit-scrollbar { width: 4px; }
    #panel-scroll::-webkit-scrollbar-thumb { background: var(--md-outline-variant); border-radius: 2px; }

    .panel-section {
      padding: 18px 18px 14px;
      border-bottom: 1px solid var(--md-outline-variant);
    }
    .panel-section:last-child { border-bottom: none; }

    .section-label {
      font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
      text-transform: uppercase; color: var(--md-secondary);
      margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
    }
    .section-label .material-icons-round { font-size: 15px; }

    /* ─── Buttons ───────────────────────────────────────────────────── */
    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 7px;
      height: 40px; padding: 0 20px; border: none; border-radius: 20px;
      font-family: 'Roboto', sans-serif; font-size: 14px; font-weight: 500;
      cursor: pointer; transition: box-shadow .2s, background .15s, opacity .2s;
      letter-spacing: 0.2px; white-space: nowrap;
    }
    .btn .material-icons-round { font-size: 18px; }
    .btn:disabled { opacity: 0.38; cursor: not-allowed; }

    .btn-filled {
      background: var(--md-primary); color: var(--md-on-primary);
      box-shadow: var(--md-elevation-1);
    }
    .btn-filled:not(:disabled):hover { box-shadow: var(--md-elevation-2); background: #00584f; }
    .btn-filled:not(:disabled):active { box-shadow: none; background: #004a43; }

    .btn-tonal {
      background: var(--md-secondary-container); color: var(--md-on-secondary-container);
    }
    .btn-tonal:not(:disabled):hover { background: #baded7; }
    .btn-tonal.active { background: var(--md-primary-container); color: var(--md-on-primary-container); }

    .btn-outlined {
      background: transparent; color: var(--md-primary);
      border: 1.5px solid var(--md-outline);
    }
    .btn-outlined:not(:disabled):hover { background: rgba(0,106,96,.08); }

    .btn-full { width: 100%; }

    /* ─── Coordinate Grid ───────────────────────────────────────────── */
    .coord-hint {
      font-size: 12px; color: var(--md-on-surface-variant);
      margin-bottom: 10px; line-height: 1.5;
    }
    .coord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
    .coord-field { display: flex; flex-direction: column; gap: 3px; }
    .coord-field label { font-size: 11px; color: var(--md-on-surface-variant); font-weight: 500; }
    .coord-field input {
      height: 36px; padding: 0 10px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 6px; background: var(--md-surface-container-lowest);
      font-family: 'Roboto Mono', monospace; font-size: 12px;
      color: var(--md-on-surface); transition: border-color .2s;
    }
    .coord-field input:focus { outline: none; border-color: var(--md-primary); }
    .coord-field input.filled { border-color: var(--md-primary); color: var(--md-primary); background: rgba(0,106,96,.04); }

    /* ─── Option Toggle Row ────────────────────────────────────────────── */
    .option-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 8px 0; border-top: 1px solid var(--md-outline-variant);
      margin-top: 10px;
    }
    .option-row:first-of-type { border-top: none; margin-top: 6px; }
    .option-row-label {
      display: flex; align-items: center; gap: 6px;
      font-size: 13px; color: var(--md-on-surface); user-select: none;
    }
    .option-row-label .material-icons-round { font-size: 16px; color: var(--md-on-surface-variant); }
    /* MD3-style toggle switch */
    .toggle-switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; }
    .toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
    .toggle-track {
      position: absolute; inset: 0;
      background: var(--md-outline);
      border-radius: 12px; cursor: pointer;
      transition: background .2s;
    }
    .toggle-track::after {
      content: ''; position: absolute;
      width: 16px; height: 16px; border-radius: 50%;
      background: #fff; top: 4px; left: 4px;
      transition: transform .2s;
    }
    .toggle-switch input:checked + .toggle-track { background: var(--md-primary); }
    .toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

    /* ─── Sample Data Selector ──────────────────────────────────────── */
    .sample-select-wrap { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
    .sample-select-wrap label { font-size: 12px; color: var(--md-on-surface-variant); font-weight: 500; }
    .sample-select-wrap select {
      height: 40px; padding: 0 12px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 8px; background: var(--md-surface-container-lowest);
      font-family: 'Roboto', sans-serif; font-size: 13px;
      color: var(--md-on-surface); width: 100%;
      cursor: pointer; transition: border-color .2s; appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%233F4948'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 10px center;
      padding-right: 32px;
    }
    .sample-select-wrap select:focus { outline: none; border-color: var(--md-primary); }
    .sample-select-wrap select:disabled { opacity: 0.5; cursor: default; }

    /* ─── Date Row ──────────────────────────────────────────────────── */
    .date-row { display: flex; flex-direction: column; gap: 10px; }
    .date-field { display: flex; flex-direction: column; gap: 4px; }
    .date-field label { font-size: 12px; color: var(--md-on-surface-variant); font-weight: 500; }
    .date-field input[type="date"] {
      height: 40px; padding: 0 12px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 8px; background: var(--md-surface-container-lowest);
      font-family: 'Roboto', sans-serif; font-size: 14px;
      color: var(--md-on-surface); width: 100%;
      transition: border-color .2s;
    }
    .date-field input[type="date"]:focus { outline: none; border-color: var(--md-primary); }

    /* ─── Progress ──────────────────────────────────────────────────── */
    #progress-section { display: none; }
    .progress-step-label {
      font-size: 13px; color: var(--md-on-surface-variant);
      margin-bottom: 8px; min-height: 18px;
    }
    .linear-progress {
      height: 6px; border-radius: 3px;
      background: var(--md-surface-container-high);
      overflow: hidden; position: relative;
    }
    .linear-progress-bar {
      height: 100%; border-radius: 3px;
      background: var(--md-primary);
      transition: width .4s ease;
      width: 0%;
    }
    .linear-progress-indeterminate .linear-progress-bar {
      width: 40%; animation: indeterminate 1.5s infinite ease-in-out;
    }
    @keyframes indeterminate {
      0%   { transform: translateX(-100%); }
      100% { transform: translateX(350%); }
    }
    .progress-pct {
      font-size: 11px; font-family: 'Roboto Mono', monospace;
      color: var(--md-on-surface-variant); text-align: right; margin-top: 4px;
    }

    #jobs-list > div:last-child { border-bottom: none !important; }

    /* ─── Results Section ───────────────────────────────────────────── */
    #results-section { display: none; }
    .result-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
    .chip {
      display: inline-flex; align-items: center; gap: 5px;
      height: 30px; padding: 0 12px; border-radius: 15px;
      font-size: 12px; font-weight: 500;
    }
    .chip-success { background: var(--md-success-container); color: var(--md-success); }
    .chip-info    { background: var(--md-tertiary-container); color: var(--md-tertiary); }
    .chip-neutral { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
    .result-message {
      font-size: 12px; color: var(--md-on-surface-variant);
      background: var(--md-surface-container); border-radius: 8px;
      padding: 10px 12px; line-height: 1.6;
    }
    .result-message strong { color: var(--md-on-surface); }

    /* ─── Error / Info Banners ──────────────────────────────────────── */
    .banner {
      display: none; padding: 10px 14px; border-radius: 8px;
      font-size: 13px; line-height: 1.5; margin-top: 10px;
      gap: 8px; align-items: flex-start;
    }
    .banner.visible { display: flex; }
    .banner .material-icons-round { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
    .banner-error   { background: var(--md-error-container); color: var(--md-on-error-container); }
    .banner-warning { background: #FFF8E1; color: #5D4037; }

    /* ─── Map Container ─────────────────────────────────────────────── */
    #map-wrapper { flex: 1; position: relative; }
    #map { width: 100%; height: 100%; }

    /* ─── Legend (floating bottom-left of map) ──────────────────────── */
    #legend {
      display: none;
      position: absolute; bottom: 28px; left: 12px; z-index: 500;
      background: var(--md-surface-container-lowest);
      border-radius: 12px; box-shadow: var(--md-elevation-2);
      padding: 12px 14px; min-width: 170px;
      border: 1px solid var(--md-outline-variant);
    }
    #legend.visible { display: block; }
    .legend-title { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--md-on-surface-variant); margin-bottom: 8px; }
    .legend-gradient {
      height: 12px; border-radius: 6px; width: 100%;
      background: linear-gradient(to right, #440154, #3B528B, #21908C, #5EC962, #FDE725);
      margin-bottom: 5px;
    }
    .legend-labels { display: flex; justify-content: space-between; font-size: 10px; font-family: 'Roboto Mono', monospace; color: var(--md-on-surface-variant); }
    .legend-divider { border: none; border-top: 1px solid var(--md-outline-variant); margin: 8px 0; }
    .legend-sg { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--md-on-surface); }
    .legend-swatch { width: 14px; height: 14px; border-radius: 3px; background: #00ff00; border: 1px solid rgba(0,0,0,.12); flex-shrink: 0; }

    /* ─── Leaflet layer control overrides ───────────────────────────── */
    .leaflet-control-layers {
      border-radius: 10px !important;
      border: 1px solid var(--md-outline-variant) !important;
      box-shadow: var(--md-elevation-2) !important;
      font-family: 'Roboto', sans-serif !important;
      font-size: 13px !important;
    }
    .leaflet-draw-toolbar a { border-radius: 8px !important; }

    /* ─── Logs panel ──────────────────────────────────────────────── */
    #log-panel {
      position: fixed;
      bottom: 0; left: 380px; right: 0;
      height: 220px;
      background: #1a1f1e;
      color: #cdd8d7;
      font-family: 'Roboto Mono', monospace;
      font-size: 12px;
      display: none;
      flex-direction: column;
      z-index: 1500;
      border-top: 2px solid var(--md-primary);
    }
    #log-panel.open { display: flex; }
    #log-panel-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 4px 12px;
      background: #0f1413;
      flex-shrink: 0;
    }
    #log-panel-header span { font-size: 12px; font-weight: 600; color: #9ef2e4; letter-spacing: .5px; }
    #log-panel-toolbar { display: flex; gap: 6px; align-items: center; }
    #log-panel-toolbar button {
      background: none; border: none; cursor: pointer; color: #9ef2e4;
      font-family: 'Roboto', sans-serif; font-size: 11px; font-weight: 600;
      padding: 2px 8px; border-radius: 8px; transition: background .15s;
    }
    #log-panel-toolbar button:hover { background: rgba(158,242,228,.12); }
    #log-body {
      flex: 1; overflow-y: auto; padding: 6px 12px;
      display: flex; flex-direction: column; gap: 1px;
    }
    .log-line {
      white-space: pre-wrap; word-break: break-all; line-height: 1.55;
    }
    .log-line.INFO    { color: #cdd8d7; }
    .log-line.WARNING { color: #f9c93e; }
    .log-line.ERROR   { color: #ff6b6b; }
    .log-line.CRITICAL{ color: #ff6b6b; font-weight: 700; }
    .log-line .log-ts  { color: #537069; margin-right: 4px; }
    .log-line .log-lvl { font-weight: 600; margin-right: 4px; }
    .log-line.INFO    .log-lvl { color: #9ef2e4; }
    .log-line.WARNING .log-lvl { color: #f9c93e; }
    .log-line.ERROR   .log-lvl { color: #ff6b6b; }
    #btn-logs.log-active { background: var(--md-primary); color: var(--md-on-primary); }

    /* ─── Snackbar ──────────────────────────────────────────────────── */
    #snackbar {
      position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
      z-index: 2000; min-width: 280px; max-width: 480px;
      background: var(--md-on-surface); color: var(--md-surface);
      border-radius: 10px; padding: 13px 18px;
      font-size: 14px; font-weight: 400;
      box-shadow: var(--md-elevation-3);
      display: none; align-items: center; gap: 12px;
      transition: opacity .3s;
    }
    #snackbar.show { display: flex; }
    #snackbar .snack-icon { font-size: 18px; flex-shrink: 0; }
    #snackbar.snack-error  { background: var(--md-error); }
    #snackbar.snack-success { background: var(--md-success); }
    #snackbar.snack-info   { background: var(--md-primary); }
    #snack-dismiss {
      margin-left: auto; background: none; border: none;
      cursor: pointer; color: rgba(255,255,255,.8);
      font-family: 'Roboto', sans-serif; font-size: 13px; font-weight: 600;
    }

    /* ─── Point Annotation ──────────────────────────────────────────── */
    #map.annotation-mode { cursor: crosshair; }
    .annotation-popup { min-width: 190px; }
    .annotation-popup p { font-size: 13px; margin-bottom: 5px; color: #161D1D; font-weight: 500; }
    .annotation-popup .ann-coords { font-size: 11px; color: #3F4948; font-family: 'Roboto Mono', monospace; margin-bottom: 10px; }
    .annotation-popup-btns { display: flex; gap: 8px; }
    .annotation-popup-btns button {
      flex: 1; height: 34px; border: none; border-radius: 17px;
      font-size: 12px; font-weight: 600; cursor: pointer;
      font-family: 'Roboto', sans-serif; transition: opacity .15s;
    }
    .annotation-popup-btns button:hover { opacity: 0.85; }
    .btn-ann-sg { background: #95F7A5; color: #006E26; }
    .btn-ann-no { background: #FFDAD6; color: #BA1A1A; }
    .ann-legend-row { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
    .ann-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--md-on-surface-variant); }
    .ann-dot { width: 10px; height: 10px; transform: rotate(45deg); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); flex-shrink: 0; }
    .ann-dot-sg { background: #2e7d32; }
    .ann-dot-no { background: #c62828; }
    .annotation-dialog-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
    .annotation-dialog-popup .leaflet-popup-content { margin: 14px 16px; }

    /* ─── ACA Pixel Review ────────────────────────────────────────── */
    .aca-count-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
    .aca-count-chip {
      display: flex; align-items: center; gap: 5px;
      background: var(--md-surface-container-high);
      border-radius: 12px; padding: 3px 10px; font-size: 12px;
      color: var(--md-on-surface-variant);
    }
    .aca-count-chip strong { color: var(--md-on-surface); }
    .aca-sample-row { display: flex; gap: 8px; margin-top: 6px; }
    .aca-sample-field { flex: 1; display: flex; flex-direction: column; gap: 3px; }
    .aca-sample-field label { font-size: 11px; color: var(--md-on-surface-variant); font-weight: 500; }
    .aca-sample-field input {
      height: 34px; padding: 0 8px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 6px; background: var(--md-surface-container-lowest);
      font-family: 'Roboto Mono', monospace; font-size: 12px;
      color: var(--md-on-surface); width: 100%; text-align: center;
      transition: border-color .2s;
    }
    .aca-sample-field input:focus { outline: none; border-color: var(--md-primary); }
    .aca-legend-row { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
    .aca-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--md-on-surface-variant); }
    .aca-sq { width: 10px; height: 10px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); flex-shrink: 0; }
    .aca-sq-no { background: #e65100; }   /* orange square = ACA non-seagrass */

    /* ─── Train / Test split point dots ─────────────────────────── */
    /* Colour convention:
       Train seagrass    #2e7d32  (green, circle)
       Train no-seagrass #c62828  (red,   circle)
       Test  seagrass    #2e7d32  (green, triangle)
       Test  no-seagrass #c62828  (red,   triangle)
    */
    .split-dot {
      width: 9px; height: 9px;
      border: 1.5px solid rgba(255,255,255,0.85);
      box-shadow: 0 0 0 1px rgba(0,0,0,.3);
    }
    .split-dot-circle   { border-radius: 50%; }
    .split-dot-diamond  { transform: rotate(45deg); border-radius: 2px; }
    .split-dot-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); border-radius: 0; box-shadow: none; }

    /* ─── NDTI Turbidity Layer ──────────────────────────────────── */
    .ndti-status-text {
      font-size: 12px; color: var(--md-on-surface-variant);
      margin-top: 4px; min-height: 16px;
    }
    /* NDTI legend strip inside the layer-control tooltip */
    .ndti-legend {
      display: flex; align-items: center; gap: 6px;
      font-size: 10px; color: var(--md-on-surface-variant); margin-top: 2px;
    }
    .ndti-legend-bar {
      width: 80px; height: 8px; border-radius: 3px;
      background: linear-gradient(to right, #ffffcc, #feb24c, #e31a1c);
      flex-shrink: 0;
    }

    /* ─── GeoTIFF Export ─────────────────────────────────────────── */
    #geotiff-export-section { margin-top: 14px; }
    #geotiff-export-section .section-sub {
      font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
      text-transform: uppercase; color: var(--md-secondary);
      margin-bottom: 6px; display: flex; align-items: center; gap: 5px;
    }
    .geotiff-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
    .geotiff-field label { font-size: 11px; color: var(--md-on-surface-variant); font-weight: 500; }
    .geotiff-field input {
      height: 34px; padding: 0 10px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 6px; background: var(--md-surface-container-lowest);
      font-family: 'Roboto Mono', monospace; font-size: 12px;
      color: var(--md-on-surface); width: 100%;
      transition: border-color .2s; box-sizing: border-box;
    }
    .geotiff-field input:focus { outline: none; border-color: var(--md-primary); }

    /* ─── Mapping Presets & Export Results ─────────────────────────── */
    .export-row {
      display: flex; align-items: center; gap: 8px;
      padding: 6px 0; border-bottom: 1px solid var(--md-outline-variant);
      font-size: 12px; color: var(--md-on-surface);
    }
    .export-row:last-child { border-bottom: none; }
    .export-row input[type="checkbox"] { flex-shrink: 0; accent-color: var(--md-primary); cursor: pointer; }
    .export-row .export-row-name {
      flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      cursor: pointer;
    }
    .export-row .export-row-icon {
      font-size: 16px; cursor: pointer; color: var(--md-on-surface-variant); flex-shrink: 0;
    }
    .export-row .export-row-icon:hover { color: var(--md-primary); }
    .export-row .export-row-status { font-size: 14px; flex-shrink: 0; }
    .export-row--loaded { border-left: 3px solid var(--md-primary); padding-left: 5px; }
    .export-row--error  { border-left: 3px solid var(--md-error);   padding-left: 5px; }
    #export-results-list:empty::after {
      content: 'No exports yet for this collection.';
      font-size: 12px; color: var(--md-on-surface-variant); display: block; padding: 4px 0;
    }

    #geotiff-status {
      font-size: 12px; color: var(--md-on-surface-variant);
      min-height: 16px; margin-top: 6px;
    }
    #geotiff-result {
      display: none; margin-top: 8px;
      background: var(--md-surface-container); border-radius: 8px;
      padding: 10px 12px; font-size: 11.5px; line-height: 1.8;
      color: var(--md-on-surface-variant); word-break: break-all;
    }
    #geotiff-result strong { color: var(--md-on-surface); }
    #geotiff-result .gcs-uri {
      font-family: 'Roboto Mono', monospace; font-size: 11px;
      color: var(--md-primary);
    }

    /* ─── CSV Training Data markers ─────────────────────────────────── */
    .csv-dot-sg { background: #2e7d32; }   /* dark green = seagrass training point */
    .csv-dot-no { background: #c62828; }   /* dark red = non-seagrass training point */

    /* ─── Polygon Sampling ──────────────────────────────────────────── */
    .poly-label-select {
      height: 36px; padding: 0 32px 0 10px;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 6px; background: var(--md-surface-container-lowest);
      font-size: 13px; color: var(--md-on-surface);
      font-family: 'Roboto', sans-serif; cursor: pointer; width: 100%;
      transition: border-color .2s; appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%233F4948'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 10px center;
    }
    .poly-label-select:focus { outline: none; border-color: var(--md-primary); }

    /* ─── Threshold Selector ─────────────────────────────────────── */
    .threshold-btn-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
    .threshold-btn {
      flex: 1; min-width: 34px;
      height: 30px; padding: 0;
      border: 1.5px solid var(--md-outline-variant);
      border-radius: 6px;
      background: var(--md-surface-container-lowest);
      font-family: 'Roboto Mono', monospace; font-size: 12px; font-weight: 600;
      color: var(--md-on-surface-variant); cursor: pointer;
      transition: background .15s, color .15s, border-color .15s;
    }
    .threshold-btn.active {
      background: var(--md-primary); color: var(--md-on-primary);
      border-color: var(--md-primary);
    }
    .threshold-btn:disabled {
      opacity: 0.38; cursor: not-allowed; pointer-events: none;
    }
    .threshold-btn:hover:not(.active):not(:disabled) {
      background: var(--md-surface-container-high);
      border-color: var(--md-outline);
    }

    /* ─── Evaluate Button & Metrics Card ─────────────────────────────── */
    #btn-evaluate {
      margin-top: 10px; width: 100%;
      display: flex; align-items: center; justify-content: center; gap: 5px;
      padding: 7px 12px; border-radius: 8px; border: none; cursor: pointer;
      background: var(--md-secondary-container); color: var(--md-on-secondary-container);
      font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
      transition: opacity .15s;
    }
    #btn-evaluate:disabled { opacity: 0.42; cursor: not-allowed; }
    #btn-evaluate:not(:disabled):hover { opacity: 0.85; }
    .eval-card {
      margin-top: 10px; padding: 10px 12px;
      background: var(--md-surface-container-low);
      border-radius: 10px; border: 1px solid var(--md-outline-variant);
      font-size: 12px;
    }
    .eval-card-title {
      font-size: 13px; font-weight: 700; letter-spacing: 0.6px;
      text-transform: uppercase; color: var(--md-secondary); margin-bottom: 8px;
      display: flex; align-items: center; gap: 4px;
    }
    .eval-metrics-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    }
    .eval-metric {
      background: var(--md-surface-container);
      border-radius: 7px; padding: 6px 8px;
      display: flex; flex-direction: column; gap: 2px;
    }
    .eval-metric-label { font-size: 10px; color: var(--md-on-surface-variant); text-transform: uppercase; letter-spacing: 0.6px; }
    .eval-metric-value { font-size: 18px; font-weight: 700; color: var(--md-on-surface); font-family: 'Roboto Mono', monospace; }
    .eval-conf-matrix {
      margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    }
    .eval-cell {
      border-radius: 6px; padding: 5px 6px; text-align: center; font-size: 11px;
    }
    .eval-cell-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.5; }
    .eval-cell-val   { font-size: 16px; font-weight: 700; font-family: 'Roboto Mono', monospace; }
    .eval-cell.tp { background: #c8e6c9; color: #1b5e20; }
    .eval-cell.fp { background: #ffccbc; color: #bf360c; }
    .eval-cell.fn { background: #ffe0b2; color: #e65100; }
    .eval-cell.tn { background: #e3f2fd; color: #0d47a1; }
    /* ─ Health Scorecard ────────────────────────────────── */
    /* Compact badge in results section */
    #health-badge {
      display: none; margin-top: 10px; padding: 8px 12px;
      border-radius: 10px; border: 1.5px solid var(--md-outline-variant);
      background: var(--md-surface-container-low);
      cursor: pointer; transition: background .15s;
    }
    #health-badge:hover { background: var(--md-surface-container); }
    #health-badge-inner { display: flex; align-items: center; gap: 8px; }
    #health-score-circle {
      width: 38px; height: 38px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 13px; font-weight: 800; flex-shrink: 0;
      transition: background .3s, color .3s;
    }
    #health-score-circle.grade-A { background: #c8e6c9; color: #1b5e20; }
    #health-score-circle.grade-B { background: #dcedc8; color: #33691e; }
    #health-score-circle.grade-C { background: #fff9c4; color: #f57f17; }
    #health-score-circle.grade-D { background: #ffe0b2; color: #e65100; }
    #health-score-circle.grade-F { background: #ffcdd2; color: #b71c1c; }
    #health-badge-text { flex: 1; }
    #health-badge-title { font-size: 12px; font-weight: 700; color: var(--md-on-surface); }
    #health-badge-sub   { font-size: 11px; color: var(--md-on-surface-variant); margin-top: 1px; }
    #health-pending     { font-size: 11px; color: var(--md-on-surface-variant); font-style: italic; }

    /* Full health modal */
    #health-modal {
      display: none; position: fixed; inset: 0; z-index: 4000;
      background: rgba(0,0,0,.5); align-items: flex-start; justify-content: center;
      padding: 20px;
      overflow-y: auto;
    }
    #health-modal.open { display: flex; }
    #health-dialog {
      background: var(--md-surface-container-lowest);
      border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,.2);
      width: 520px; max-width: calc(100vw - 32px);
      padding: 28px 24px 20px; display: flex; flex-direction: column; gap: 16px;
      margin: auto;
    }
    #health-dialog-header { display: flex; align-items: center; gap: 10px; }
    #health-dialog-header .material-icons-round { font-size: 22px; color: var(--md-primary); }
    #health-dialog-title { font-size: 18px; font-weight: 800; color: var(--md-on-surface); flex: 1; }
    #health-overall {
      display: flex; align-items: center; gap: 14px;
      padding: 14px 18px; border-radius: 14px; background: var(--md-surface-container-low);
      border: 1px solid var(--md-outline-variant);
    }
    #health-overall-circle {
      width: 56px; height: 56px; border-radius: 50%;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      font-weight: 800; flex-shrink: 0; transition: background .3s;
    }
    #health-overall-circle .hoc-score { font-size: 20px; line-height: 1.1; }
    #health-overall-circle .hoc-grade { font-size: 11px; letter-spacing: .5px; }
    #health-overall-circle.grade-A { background: #c8e6c9; color: #1b5e20; }
    #health-overall-circle.grade-B { background: #dcedc8; color: #33691e; }
    #health-overall-circle.grade-C { background: #fff9c4; color: #f57f17; }
    #health-overall-circle.grade-D { background: #ffe0b2; color: #e65100; }
    #health-overall-circle.grade-F { background: #ffcdd2; color: #b71c1c; }
    #health-overall-text { flex: 1; }
    #health-overall-label { font-size: 14px; font-weight: 700; color: var(--md-on-surface); }
    #health-overall-desc  { font-size: 12px; color: var(--md-on-surface-variant); margin-top: 3px; }
    .health-metric {
      padding: 12px 14px; border-radius: 12px;
      border: 1px solid var(--md-outline-variant);
      background: var(--md-surface-container-lowest);
      display: flex; flex-direction: column; gap: 6px;
    }
    .hm-header { display: flex; align-items: center; gap: 8px; }
    .hm-dot {
      width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
      transition: background .3s;
    }
    .hm-dot.green { background: #4caf50; }
    .hm-dot.yellow { background: #ffc107; }
    .hm-dot.red { background: #f44336; }
    .hm-dot.pending { background: #bdbdbd; }
    .hm-name { font-size: 13px; font-weight: 700; color: var(--md-on-surface); flex: 1; }
    .hm-score-pill {
      font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
    }
    .hm-score-pill.green  { background: #c8e6c9; color: #1b5e20; }
    .hm-score-pill.yellow { background: #fff9c4; color: #f57f17; }
    .hm-score-pill.red    { background: #ffcdd2; color: #b71c1c; }
    .hm-score-pill.pending{ background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
    .hm-bar-track {
      height: 4px; background: var(--md-surface-container-high); border-radius: 2px; overflow: hidden;
    }
    .hm-bar-fill { height: 100%; border-radius: 2px; transition: width .5s ease, background .3s; }
    .hm-detail { font-size: 11.5px; color: var(--md-on-surface-variant); line-height: 1.5; }
    .hm-feedback {
      font-size: 11px; padding: 6px 10px; border-radius: 8px;
      background: var(--md-surface-container-low); color: var(--md-on-surface);
      border-left: 3px solid #ffc107; line-height: 1.5;
    }
    .hm-feedback.bad { border-left-color: #f44336; }
    .hm-feedback.good { border-left-color: #4caf50; }
    .hm-ref { font-size: 10.5px; color: var(--md-on-surface-variant); margin-top: 2px; }
    .hm-ref a { color: var(--md-primary); text-decoration: none; }
    .hm-ref a:hover { text-decoration: underline; }
    #health-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
