* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    overflow: hidden;
    height: 100vh;
}

#main-canvas {
    display: block;
    width: 100vw;
    height: calc(100vh - 60px);
    cursor: grab;
    position: absolute;
    top: 60px;
    left: 0;
    z-index: 1;
}

.esri-view-root {
    width: 100% !important;
    height: 100% !important;
}

#main-canvas:active {
    cursor: grabbing;
}

#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

#top-bar-center {
    display: flex;
    align-items: center;
    gap: 24px;
}

#app-title {
    color: white;
    font-size: 20px;
    font-weight: 600;
}

#mode-indicator {
    color: #4CAF50;
    font-size: 14px;
    font-weight: 500;
}

#left-panel {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 280px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 14px;
    color: white;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
#left-panel::-webkit-scrollbar { width: 6px; }
#left-panel::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
#left-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
#left-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }


.panel-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 10px;
    margin-top: 0;
    color: #81c784;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.section-title.section-spaced {
    margin-top: 14px;
}

.section-title.section-spaced:first-child {
    margin-top: 0;
}

.button {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 6px;
    text-align: center;
}

.button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    background: rgba(255, 255, 255, 0.03);
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.button.loading:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: #b0b0b0;
}

.button.primary {
    background: rgba(76, 175, 80, 0.35);
    color: #fff;
}
.button.primary:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.5);
}
.button.primary:disabled {
    background: rgba(76, 175, 80, 0.15);
    color: #9e9e9e;
}

.button.loading-progress .apply-loading-label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.9);
}
.button.loading-progress .apply-progress-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}
.button.loading-progress .apply-progress-wrap.indeterminate .apply-progress-fill {
    width: 40% !important;
    animation: apply-progress-indeterminate 1.2s ease-in-out infinite;
}
@keyframes apply-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
.button.loading-progress .apply-progress-fill {
    height: 100%;
    background: #81c784;
    border-radius: 3px;
    transition: width 0.15s ease-out;
}
.terrain-load-error {
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(200, 60, 60, 0.9);
    color: #fff;
    font-size: 13px;
    max-width: 320px;
}
.terrain-load-error.hidden {
    display: none !important;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #81c784;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loading-spin 0.7s linear infinite;
}

.select-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 14px;
    outline: none;
    margin-bottom: 8px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select-input option {
    background: #2d2d2d;
    color: #e0e0e0;
}

input.select-input[type="number"],
.number-input {
    cursor: text;
    background-image: none;
    padding: 4px 6px;
    padding-right: 6px;
    width: 38px;
    min-width: 38px;
    font-size: 13px;
    box-sizing: border-box;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}
.number-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: #2d2d2d;
}
.number-stepper input {
    border: none;
    border-radius: 6px 0 0 6px;
    background: transparent;
}
.number-stepper-btns {
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.number-stepper-btn {
    width: 18px;
    height: 14px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #ccc;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.number-stepper-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
}
.number-stepper-btn:first-child { border-radius: 0 6px 0 0; }
.number-stepper-btn:last-child { border-radius: 0 0 6px 0; }
.number-stepper-btn + .number-stepper-btn { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.search-box {
    margin-bottom: 12px;
}
.search-box arcgis-search {
    display: block;
    width: 100%;
}

.status-text {
    font-size: 12px;
    color: #ccc;
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #4CAF50;
}

.print-mode-block {
    margin-bottom: 4px;
}
#print-mode-options {
    margin-top: 14px;
}
.print-mode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.print-mode-row:last-child { margin-bottom: 0; }
.print-mode-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
}
.print-mode-radio input { margin: 0; }
.mosaic-options-block {
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
}
.mosaic-options-block .print-mode-row { margin-bottom: 6px; }
.mosaic-options-block .print-mode-row:last-child { margin-bottom: 0; }
.mosaic-grid-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.mosaic-field {
    display: flex;
    align-items: center;
    gap: 5px;
}
.mosaic-field label {
    font-size: 11px;
    color: #888;
    margin: 0;
    white-space: nowrap;
}
.mosaic-field .number-stepper input { width: 30px; min-width: 30px; }
.mosaic-parts-badge {
    font-size: 11px;
    color: #81c784;
    font-weight: 500;
}

.status-text.error {
    border-left-color: #f44336;
    color: #ffcdd2;
}

.control-group {
    margin-bottom: 8px;
}

.control-label {
    display: block;
    font-size: 11px;
    color: #b0b0b0;
    margin-bottom: 4px;
    font-weight: 400;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.value-display {
    font-size: 11px;
    color: #4CAF50;
    font-weight: 500;
}

.hint {
    color: #888;
    font-size: 0.9em;
}

.help-tooltip {
    position: relative;
    display: inline-flex;
}
.help-tooltip-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.1);
    color: #aaa;
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.help-tooltip-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.help-tooltip-text {
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, 0);
    margin-top: 0;
    padding: 10px 12px;
    background: rgba(0,0,0,0.95);
    color: #e0e0e0;
    font-size: 11px;
    line-height: 1.4;
    border-radius: 6px;
    white-space: normal;
    width: 260px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 10000;
}
.help-tooltip-text.help-tooltip-visible {
    opacity: 1;
    visibility: visible;
}

.terrain-building-overlay {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: white;
    font-size: 18px;
    z-index: 5;
}
.terrain-building-overlay.hidden { display: none; }
.building-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: building-spin 0.8s linear infinite;
}
@keyframes building-spin {
    to { transform: rotate(360deg); }
}

#right-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 280px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    color: white;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.scale-bar-overlay {
    position: absolute;
    left: 20px;
    bottom: 52px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.75);
    padding: 6px 10px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: #ccc;
    pointer-events: none;
}
.scale-bar-overlay.hidden { display: none !important; }
.scale-bar-track {
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin-bottom: 4px;
    overflow: hidden;
}
.scale-bar-fill {
    height: 100%;
    width: 100px;
    background: linear-gradient(90deg, #4CAF50, #81c784);
    border-radius: 2px;
}
.scale-bar-labels {
    display: flex;
    justify-content: space-between;
    width: 100px;
    margin-top: 2px;
}

#table-ruler-labels {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    pointer-events: none;
    z-index: 5;
}
#table-ruler-labels.hidden { display: none !important; }
.table-ruler-label {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 400;
    color: #fff;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

#bottom-info {
    position: absolute;
    bottom: 20px;
    right: 20px;
    max-width: min(520px, calc(100vw - 40px));
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-size: 12px;
    z-index: 10;
}

#bottom-info .terrain-flat-hint {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 400;
    color: #e8c96b;
    line-height: 1.35;
    white-space: normal;
}

/* Radial knob between labels — typography matches .control-label */
.terrain-knob-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.terrain-knob-side {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 400;
    color: #b0b0b0;
    line-height: 1.35;
    text-align: center;
    transition: color 0.2s;
}
.terrain-knob-row:has(.terrain-knob-input:not(:checked)) .terrain-knob-left {
    color: #e8e8e8;
}
.terrain-knob-row:has(.terrain-knob-input:checked) .terrain-knob-right {
    color: #e8e8e8;
}
.terrain-knob-track {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 18px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.terrain-knob-track:hover {
    background: rgba(255, 255, 255, 0.14);
}
.terrain-knob-row:has(.terrain-knob-input:checked) .terrain-knob-track {
    background: rgba(76, 175, 80, 0.35);
    border-color: rgba(129, 199, 132, 0.45);
}
.terrain-knob-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}
.terrain-knob-thumb {
    position: absolute;
    top: 50%;
    left: 2px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border-radius: 50%;
    background: #f0f0f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: transform 0.22s ease;
    pointer-events: none;
    z-index: 1;
}
.terrain-knob-row:has(.terrain-knob-input:checked) .terrain-knob-thumb {
    transform: translateX(18px);
}

.shape-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}
.shape-mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.shape-mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.shape-mode-btn.active {
    background: rgba(76, 175, 80, 0.35);
    color: #fff;
}
.vertical-exag-toggle {
    margin-bottom: 0;
}
.vertical-exag-toggle .shape-mode-btn {
    padding: 2px 10px;
    font-size: 14px;
    min-width: 32px;
}

/* Keep the Altitude-based Off/On toggle compact like ×/% (not full-width). */
.alt-exag-toggle .shape-mode-btn {
    flex: 0 0 auto;
    padding: 2px 10px;
    font-size: 14px;
    min-width: 32px;
}
.shape-panel.hidden { display: none !important; }

.shape-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 6px;
}

.shape-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shape-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.shape-btn:active {
    transform: translateY(0);
}

.shape-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.shape-btn.clear-btn {
    width: auto;
    min-width: 38px;
    padding: 0 10px;
    gap: 4px;
}

.shape-btn.clear-btn svg {
    width: 14px;
    height: 14px;
}

.hidden {
    display: none !important;
}

#print-mode-options.unavailable {
    opacity: 0.5;
    pointer-events: none;
}

/* Migrated from inline style attributes in index.html */
#mode-indicator a {
    color: inherit;
    text-decoration: underline;
}

#shape-draw-panel > .control-label:first-child {
    margin-bottom: 6px;
}

#clear-shape-btn {
    margin-top: 8px;
}

#line-options {
    margin-top: 8px;
}

#line-buffer-miles {
    margin-bottom: 0;
}

#line-options > .hint {
    margin-top: 4px;
    font-size: 11px;
}

#edit-line-btn {
    margin-top: 8px;
}

#clip-status {
    margin-top: 6px;
}

#mosaic-split-options .print-mode-row > .control-label {
    font-size: 11px;
    color: #888;
    margin: 0;
}

#mosaic-cols,
#mosaic-rows,
#mosaic-density {
    margin: 0;
}

#geojson-feature-selector {
    margin-top: 10px;
}

#geojson-feature-select,
#geojson-feature-select-3d {
    width: 100%;
    margin-top: 4px;
}

#load-terrain-btn {
    margin-top: 12px;
    margin-bottom: 0;
}

#map-section.panel-section {
    margin-bottom: 0;
}

#geojson-feature-selector-3d {
    margin-top: 12px;
}

#geojson-feature-selector-3d > .hint {
    margin-top: 6px;
    font-size: 11px;
}

.text-muted {
    color: #888;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.control-row-compact {
    margin-top: 10px;
    margin-bottom: 0;
}

.control-row > .control-label {
    margin-bottom: 0;
}

.control-row .vertical-exag-toggle {
    flex-shrink: 0;
}

.alt-exag-controls {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.alt-exag-pivot-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: nowrap;
}

.alt-exag-pivot-row .control-label {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
    flex: 0 0 auto;
}

.alt-exag-pivot-row .alt-exag-pivot-units {
    margin: 0;
    font-size: 11px;
    font-weight: 400;
    color: #b0b0b0;
    line-height: 1.35;
}

.alt-exag-pivot-row input.select-input[type="number"] {
    /* Fit 7 digits nicely (e.g. 1000000). */
    width: 7ch;
    min-width: 7ch;
    margin-bottom: 0;
    padding: 4px 6px;
    padding-right: 6px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 6px;
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-image: none;
    appearance: textfield;
    -webkit-appearance: none;
    text-align: right;
}

.alt-exag-pivot-row .text-muted {
    white-space: nowrap;
    flex: 0 0 auto;
}

.control-group-inner + .control-group-inner {
    margin-top: 10px;
}

#total-size-mm {
    width: 100%;
}

.scale-bar-labels .unit-mm {
    color: #81c784;
}
