:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --border-color: #ccc;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --sidebar-width: 460px;
}

* {
    box-sizing: border-box;
}

body {
    display: flex;
    margin: 0;
    height: 100vh;
    font-family: 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: #e6f0fa;
    position: relative;
}

body.sidebar-resizing {
    cursor: col-resize;
    user-select: none;
}

body.sidebar-resizing * {
    cursor: col-resize !important;
}

/* Keep splitter drag visually immediate by disabling width transitions while dragging */
body.sidebar-resizing #sidebar,
body.sidebar-resizing #sidebarResizer {
    transition: none !important;
}

#globalToolbar {
    position: absolute;
    top: 16px;
    left: 16px;
    right: auto;
    max-width: calc(100vw - var(--sidebar-width) - 40px);
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 90;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}

#globalToolbar button {
    width: auto;
    margin: 0;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 11px;
    color: #1b2a39;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    scroll-snap-align: start;
}

#globalToolbar button:hover {
    background: rgba(255, 255, 255, 0.32);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#globalToolbar button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#globalToolbar button:disabled:hover {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#globalToolbar button.secondary,
#globalToolbar button.info,
#globalToolbar button.success,
#globalToolbar button.btn-outline {
    color: #172635;
}

#globalToolbar #btnDrawMode.is-drawing {
    border-color: rgba(85, 255, 175, 0.55);
    background: rgba(52, 211, 153, 0.28);
    color: #07271a;
}

body.no-plan-image #globalToolbar button {
    border-color: rgba(18, 34, 50, 0.26);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 255, 0.92));
    color: #0f2233;
    box-shadow: 0 4px 14px rgba(11, 26, 45, 0.17), inset 0 0 0 1px rgba(255, 255, 255, 0.82);
}

body.no-plan-image #globalToolbar button:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(242, 248, 255, 0.95));
    box-shadow: 0 6px 18px rgba(11, 26, 45, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.88);
}

body.no-plan-image #globalToolbar button:disabled,
body.no-plan-image #globalToolbar button:disabled:hover {
    border-color: rgba(18, 34, 50, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 248, 252, 0.8));
    box-shadow: 0 2px 8px rgba(11, 26, 45, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.toolbar-hidden-input {
    display: none;
}

/* Import/Export vertical pill */
#sideActions {
    position: absolute;
    top: 72px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 90;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.58), rgba(232, 244, 255, 0.32));
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 13px;
    backdrop-filter: saturate(185%) blur(14px);
    -webkit-backdrop-filter: saturate(185%) blur(14px);
    box-shadow: 0 4px 18px rgba(31, 64, 104, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.64);
    padding: 4px;
    overflow: hidden;
}

#sideActions button {
    width: 40px;
    margin: 0;
    padding: 7px 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    border: none;
    border-radius: 9px;
    color: #1b2a39;
    background: transparent;
    transition: background 0.2s ease;
    cursor: pointer;
}

#sideActions button + button {
    margin-top: 2px;
}

#sideActions button:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}

#sideActions button:hover {
    background: rgba(255, 255, 255, 0.48);
}

body.no-plan-image #sideActions {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 255, 0.88));
    border-color: rgba(18, 34, 50, 0.18);
    box-shadow: 0 4px 14px rgba(11, 26, 45, 0.17), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.no-plan-image #sideActions button {
    color: #0f2233;
}

/* 左侧画布区 */
#canvas-wrapper {
    flex: 1;
    width: 100vw;
    background: #dde3e8;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#canvas-wrapper.grabbing {
    cursor: grabbing;
}

#canvas-wrapper.drag-over {
    outline: 3px dashed #4a9eff;
    outline-offset: -3px;
    background: #d0e8ff;
}

#canvas-wrapper.drag-over::after {
    content: attr(data-drag-label);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(74, 158, 255, 0.92);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    padding: 16px 32px;
    border-radius: 10px;
    pointer-events: none;
    white-space: pre-line;
    text-align: center;
    z-index: 100;
}

canvas {
    background: #eef1f4;
    display: block;
    transform-origin: 0 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#empty-tip {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 18px;
    pointer-events: none;
}

#zoom-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

/* 右侧边栏 */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(241, 248, 255, 0.48));
    border-left: 1px solid rgba(255, 255, 255, 0.44);
    padding: 16px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: -4px 0 32px rgba(31, 64, 104, 0.16), inset 1px 0 0 rgba(255, 255, 255, 0.62);
    backdrop-filter: saturate(175%) blur(16px);
    -webkit-backdrop-filter: saturate(175%) blur(16px);
    overflow: hidden;
    gap: 8px;
    transition: width .28s ease, min-width .28s ease, max-width .28s ease, flex-basis .28s ease, padding .28s ease, box-shadow .28s ease, max-height .3s ease;
}

#sidebarResizer {
    width: 12px;
    flex: 0 0 12px;
    position: absolute;
    top: 0;
    right: var(--sidebar-width);
    bottom: 0;
    cursor: col-resize;
    touch-action: none;
    background: linear-gradient(180deg, rgba(221, 227, 232, 0.55), rgba(248, 249, 250, 0.8));
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    z-index: 11;
}

#sidebarResizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 56px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(100, 116, 139, 0.24), rgba(100, 116, 139, 0.58));
    box-shadow: -3px 0 0 rgba(255, 255, 255, 0.72), 3px 0 0 rgba(255, 255, 255, 0.72);
}

#sidebarResizer:hover,
body.sidebar-resizing #sidebarResizer {
    background: linear-gradient(180deg, rgba(203, 213, 225, 0.78), rgba(241, 245, 249, 0.95));
}

body.sidebar-resizing #sidebarResizer::before,
#sidebarResizer:hover::before {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.42), rgba(37, 99, 235, 0.82));
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sidebar-header h3 {
    flex: 1;
    min-width: 0;
}

.page-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dbe8f5;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(241, 247, 253, 0.92));
}

.page-nav-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-nav-label {
    font-size: 12px;
    font-weight: 700;
    color: #1d4f8c;
}

.page-nav-hint {
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
}

.page-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #d1e3f7;
    background: rgba(255, 255, 255, 0.92);
    color: #24507f;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.page-nav-link:hover {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 6px 14px rgba(31, 64, 104, 0.08);
}

.page-nav-link.is-current {
    border-color: rgba(30, 91, 196, 0.22);
    background: linear-gradient(180deg, #eef5ff 0%, #e2efff 100%);
    color: #0f5ed0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

#sidebar .sidebar-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: rgba(255, 255, 255, 0.72);
    color: #1f2d3d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    cursor: pointer;
}

#sidebar .sidebar-toggle::before {
    content: '×';
    font-size: 22px;
    line-height: 1;
}

#sidebar.collapsed .sidebar-toggle::before {
    content: '◀';
    font-size: 13px;
}

#sidebar.collapsed {
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    flex: 0 0 34px;
    height: 34px;
    top: 12px;
    right: 12px;
    bottom: auto;
    padding: 0;
    gap: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
}

#sidebar.collapsed .sidebar-header {
    height: 100%;
    justify-content: center;
    align-items: center;
    gap: 0;
}

#sidebar.collapsed .sidebar-header h3,
#sidebar.collapsed .lang-switcher,
#sidebar.collapsed .page-nav,
#sidebar.collapsed .sidebar-tabs,
#sidebar.collapsed #sidebarContent {
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

#sidebar .sidebar-header h3,
#sidebar .lang-switcher,
#sidebar .page-nav,
#sidebar .sidebar-tabs,
#sidebar #sidebarContent {
    transition: opacity .2s ease;
}

#sidebar.collapsed .sidebar-toggle {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.82), rgba(232, 244, 255, 0.56));
    backdrop-filter: saturate(175%) blur(12px);
    -webkit-backdrop-filter: saturate(175%) blur(12px);
    box-shadow: 0 4px 14px rgba(31, 64, 104, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    border: 1px solid #dbe3ea;
    border-radius: 10px;
    background: #eef3f7;
}

.sidebar-tab-btn {
    width: auto;
    margin: 0;
    padding: 9px 10px;
    border-radius: 8px;
    background: transparent;
    color: #556371;
    font-size: 13px;
    font-weight: 700;
}

.sidebar-tab-btn:hover {
    background: rgba(255, 255, 255, 0.65);
    color: #2c3e50;
}

.sidebar-tab-btn.active {
    background: #ffffff;
    color: #0056b3;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

#sidebarContent {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
}

.sidebar-tab-panel {
    display: none;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.sidebar-tab-panel.active {
    display: flex;
    flex-direction: column;
}

/* 上半部分 */
#topPane {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.52);
    padding: 10px;
}

/* 下半部分 */
#bottomPane {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

h3 {
    margin: 0 0 10px;
    color: #333;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* 步骤卡片 */
.step {
    margin-bottom: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

.step.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

#sidebar label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 13px;
}

input[type="text"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.inline-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.inline-inputs .field {
    display: flex;
    flex-direction: column;
}

.inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.inline-row input[type="checkbox"] {
    transform: scale(1.1);
}

.muted {
    color: #666;
    font-size: 12px;
    margin-bottom: 4px;
}

.plan-layer-card {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.72);
}

.plan-layer-title {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #243647;
}

#planImageStatus.loaded,
#overlayStatus.loaded {
    color: #1b5e20;
}

.overlay-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.36);
}

.overlay-actions {
    margin-top: 8px;
}

.overlay-actions button {
    width: auto;
    margin: 0;
    flex: 1;
}

.overlay-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.overlay-inputs .field,
.overlay-controls .field {
    display: flex;
    flex-direction: column;
}

.overlay-inputs input,
.overlay-controls input[type="range"] {
    margin-bottom: 0;
}

/* 按钮样式 */
button {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: #0069d9;
}

button.secondary {
    background: var(--secondary-color);
}

button.secondary:hover {
    background: #5a6268;
}

button.info {
    background: var(--info-color);
}

button.info:hover {
    background: #138496;
}

button.success {
    background: var(--success-color);
}

button.success:hover {
    background: #218838;
}

.btn-outline {
    background: transparent;
    border: 1px solid #b8c4d2;
    color: #2c3e50;
}

.btn-outline:hover {
    background: rgba(0, 123, 255, 0.08);
}

.btn-outline.active {
    background: rgba(0, 123, 255, 0.12);
    border-color: #80bdff;
    color: #0056b3;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.modal {
    width: min(860px, 95vw);
    max-height: calc(100vh - 32px);
    height: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e9ecef;
    background: #fbfcfd;
}

.modal-title {
    font-size: 15px;
    font-weight: 800;
    color: #2c3e50;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #ffffff;
    color: #2c3e50;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.modal-close:hover {
    background: #f3f6fa;
}

.modal-body {
    padding: 10px 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.modal-row-top {
    align-items: flex-start;
}

.modal-field {
    min-width: 150px;
    flex: 1;
}

.modal-label {
    font-size: 12px;
    color: #56616d;
    margin-bottom: 4px;
}

.modal-text {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #2c3e50;
}

.modal-actions {
    align-items: center;
}

.modal-actions button {
    width: auto;
    margin: 0;
    padding: 8px 10px;
}

.split-bar-wrap {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
}
.split-angle-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 280px;
}

.split-angle-label {
    font-size: 12px;
    color: #56616d;
    white-space: nowrap;
}

.split-angle-slider {
    flex: 1;
    min-width: 120px;
}

.split-angle-input {
    width: 88px;
    margin: 0;
}

.split-preview-wrap {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 10px;
    padding: 10px;
}

.split-preview-canvas {
    width: 100%;
    height: 220px;
    display: block;
    border-radius: 8px;
    background: #fbfcfd;
    border: 1px solid rgba(44, 62, 80, 0.12);
    touch-action: none;
}

.split-handle.active {
    background: rgba(231, 76, 60, 0.9);
}

.split-bar {
    position: relative;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(90deg, #fdeccf 0%, #f9d29d 50%, #f4b27d 100%);
    border: 1px solid rgba(44, 62, 80, 0.14);
}

.split-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    border-right: 1px solid rgba(44, 62, 80, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(44, 62, 80, 0.85);
    font-weight: 700;
    font-size: 13px;
    user-select: none;
}

.split-handle {
    position: absolute;
    top: -8px;
    width: 12px;
    height: 80px;
    margin-left: -6px;
    cursor: ew-resize;
    background: rgba(44, 62, 80, 0.75);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    touch-action: none;
}

.split-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 22px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 6px 0 0 rgba(255, 255, 255, 0.5), -6px 0 0 rgba(255, 255, 255, 0.5);
}

.split-table-wrap {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: visible;
    background: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.split-table-scroll {
    max-height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
}

.split-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f6;
    background: #fbfcfd;
}

.split-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.split-table th,
.split-table td {
    border-bottom: 1px solid #eef2f6;
    padding: 8px 10px;
    text-align: left;
}

.split-table th {
    background: #fbfcfd;
    color: #2c3e50;
    font-weight: 800;
}

.split-table input[type="number"] {
    width: 100%;
    margin: 0;
    padding: 6px 8px;
    font-size: 13px;
}

.split-seg {
    flex-direction: column;
    gap: 2px;
}

.split-seg .seg-idx {
    font-size: 13px;
    font-weight: 800;
}

.split-seg .seg-pct {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.85;
}

.split-seg .seg-area {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.85;
}

.split-areas-panel {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 10px;
    padding: 10px;
}

.areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.area-item {
    border: 1px solid #eef2f6;
    background: #fbfcfd;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-item .area-label {
    font-size: 12px;
    color: #56616d;
}

.area-item input[type="number"] {
    margin: 0;
    padding: 8px 10px;
    font-size: 13px;
}

button.warning {
    background: var(--warning-color);
    color: #333;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid #80bdff;
}

.btn-outline:hover {
    background: #e7f1ff;
}

/* 位置/纬度配置区 */
.location-config {
    background: #f1f8ff;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid #d0e3ff;
}

.location-config label {
    color: #0056b3;
    font-weight: bold;
    margin-bottom: 8px;
}

.location-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.location-row .field {
    flex: 1;
}

.location-row select,
.location-row input {
    margin-bottom: 0;
}

/* 表格区 */
#step-table {
    margin: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: var(--bg-white);
}

#table-wrapper {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-x: scroll;
    overflow-y: auto;
    scrollbar-gutter: stable;
    border: 1px solid #eee;
    border-radius: 6px;
    background: var(--bg-white);
}

#buildingsTable {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 12px;
}

#buildingsTable thead th {
    position: sticky;
    top: 0;
    background: #f1f3f5;
    z-index: 1;
}

#buildingsTable th,
#buildingsTable td {
    border-bottom: 1px solid #eee;
    padding: 6px;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

#buildingsTable tbody tr {
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

#buildingsTable tbody tr.is-hovered {
    background: rgba(245, 158, 11, 0.12);
}

#buildingsTable tbody tr.is-selected {
    background: rgba(21, 128, 61, 0.12);
    box-shadow: inset 3px 0 0 #15803d;
}

#buildingsTable tbody tr.is-selected.is-hovered {
    background: rgba(21, 128, 61, 0.18);
}

#buildingsTable td input[type="text"],
#buildingsTable td input[type="number"] {
    width: 100%;
    min-width: 0;
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

#buildingsTable td input[type="checkbox"] {
    margin: 0;
}

#buildingsTable .btn-mini {
    width: auto;
    margin: 0 6px 0 0;
    vertical-align: middle;
}

#buildingsTable .btn-mini:last-child {
    margin-right: 0;
}

#buildingsTable td .btn-mini {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

#buildingsTable td .btn-mini.btn-outline {
    border: 1px solid #b8c4d2;
    background: transparent;
    color: #2c3e50;
}

#buildingsTable td .btn-mini.btn-outline:hover {
    background: rgba(0, 123, 255, 0.08);
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

/* 响应式 */
@media (max-width: 768px) {
    #sideActions {
        top: 58px;
        left: 8px;
    }

    #sideActions button {
        width: 44px;
        padding: 6px 4px;
    }

    #globalToolbar {
        top: 8px;
        left: 8px;
        width: max-content;
        max-width: calc(100vw - 16px);
        padding: 4px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.4);
        backdrop-filter: saturate(170%) blur(10px);
    }

    #globalToolbar button {
        padding: 7px 10px;
        font-size: 11px;
    }

    #sidebar {
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
        flex: 0 0 100vw;
        position: absolute;
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        height: auto;
        max-height: 60vh;
        overflow: hidden;
    }

    #sidebarResizer {
        display: none;
    }

    /* On mobile, collapsed sidebar becomes a small floating toggle button */
    #sidebar.collapsed {
        width: 52px;
        min-width: 52px;
        max-width: 52px;
        flex-basis: 52px;
        height: 52px;
        max-height: 52px;
        left: auto;
        right: 12px;
        bottom: 12px;
        top: auto;
        border-radius: 14px;
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(232, 244, 255, 0.45));
        border: 1px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: saturate(180%) blur(14px);
        -webkit-backdrop-filter: saturate(180%) blur(14px);
        box-shadow: 0 6px 20px rgba(31, 64, 104, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    }

    #sidebar.collapsed .sidebar-header {
        height: 100%;
        justify-content: center;
    }

    #sidebar.collapsed .sidebar-toggle::before {
        content: '▲';
        font-size: 12px;
    }

    #sidebarContent {
        min-height: 0;
    }

    .sidebar-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overlay-inputs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #globalToolbar {
        left: 8px;
        right: 8px;
        max-width: none;
    }
    #sideActions {
        top: 56px;
        left: 6px;
    }
    #sideActions button {
        width: 40px;
        font-size: 10px;
    }

    .overlay-actions {
        flex-direction: column;
    }
}

/* 语言切换按钮 */
.lang-switcher {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px;
    border-radius: 6px;
}

.lang-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.lang-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.lang-btn.active {
    background: white;
    color: #007bff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
