:root {
    --brand: #157c72;
    --primary-color: #157c72;
    --success-color: #157c72;
    --border-color: #d5dcda;
    --text: #263430;
    --radius: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    color: var(--text);
    letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
input, select, textarea { box-sizing: border-box; min-width: 0; }
#controls input[type="text"] { width: 100%; border: 1px solid #d5dcda; border-radius: 5px; padding: 8px 10px; font-size: 13px; background: #fff; }
button, a, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid #157c72; }
.indoor-inline { display: flex; gap: 7px; margin: 8px 0; align-items: end; }
.indoor-inline > * { flex: 1; min-width: 0; }
#indoorProjectControls select, #indoorProjectControls input { box-sizing: border-box; width: 100%; padding: 7px; border: 1px solid #c6d3cb; border-radius: 4px; background: white; }
#indoorProjectControls button { min-height: 36px; border: 1px solid #b9cec5; border-radius: 5px; background: #edf3f0; color: #236a60; cursor: pointer; }
#saveUnifiedProject { width: 100%; cursor: pointer; }
#indoorManager { width: min(1120px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #b9cec5; border-radius: 10px; color: #263430; background: #fafcfb; }
#indoorManager::backdrop { background: #152e2466; }
#indoorManager .manager-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #d5dcda; }
#indoorManager h2 { margin: 0; font-size: 18px; }
#indoorManager h3 { margin: 18px 0 10px; font-size: 14px; }
#indoorManager p { font-size: 12px; line-height: 1.6; margin: 6px 0; color: #63736c; }
#indoorManager button { min-height: 36px; padding: 7px 10px; color: #236a60; background: #edf3f0; border: 1px solid #b9cec5; border-radius: 5px; cursor: pointer; }
#indoorManager button:hover { background: #e0ece6; }
#indoorManager button:disabled { opacity: .45; cursor: not-allowed; }
#indoorManager input, #indoorManager select { font: inherit; width: 100%; margin-top: 5px; padding: 7px; border: 1px solid #c6d3cb; border-radius: 4px; background: white; }
#indoorManager label { display: block; font-size: 12px; margin: 8px 0; }
#indoorManager .manager-checkbox { display: flex; align-items: center; gap: 8px; }
#indoorManager input[type="checkbox"] { width: auto; margin: 0; }
.manager-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.manager-fields { padding: 0 18px 20px; max-height: calc(100dvh - 160px); overflow: auto; border-right: 1px solid #d5dcda; }
.manager-preview { padding: 0 18px 18px; min-width: 0; }
.placement-wrap { height: min(55dvh, 540px); min-height: 260px; background: #e8eeea; border: 1px solid #d5dcda; border-radius: 5px; }
.placement-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 10px 0; }
.placement-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.placement-zoom output { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.placement-zoom span { font-size: 12px; color: #63736c; }
.editor-workflow-hint { margin: 0 0 10px; color: #236a60; font-size: 12px; line-height: 1.6; }
.editor-indoor-actions { display: flex; gap: 6px; }
#sidebar .editor-indoor-actions button { padding: 7px; flex: 1; }
#editorIndoorStatus { margin: 6px 0 0; color: #63736c; font-size: 12px; line-height: 1.5; }
#tableBody .building-indoor-button { background: #e1efeb; color: #157c72; margin-bottom: 4px; white-space: nowrap; }
#buildingIndoorDialog, #inlinePlanDialog { width: calc(100vw - 24px); height: calc(100dvh - 24px); max-width: none; max-height: none; padding: 0; border: 1px solid #b9cec5; border-radius: 8px; background: #fafcfb; }
#buildingIndoorDialog[open], #inlinePlanDialog[open] { display: flex; flex-direction: column; }
#buildingIndoorDialog::backdrop, #inlinePlanDialog::backdrop { background: #152e2480; }
.building-indoor-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid #d5dcda; }
.building-indoor-header h2 { margin: 0; font-size: 16px; }
.building-indoor-header p { margin: 4px 0 0; color: #63736c; font-size: 12px; }
.building-indoor-header button { width: auto; padding: 8px 12px; border: 1px solid #b9cec5; border-radius: 5px; background: #edf3f0; color: #236a60; cursor: pointer; }
#buildingIndoorFrame, #inlinePlanFrame { width: 100%; flex: 1; min-height: 0; border: 0; background: #eef2ef; }
.embedded-building-manager > #controls, .embedded-building-manager > .github-link, .embedded-building-manager > .scene-navigation, .embedded-building-manager > #canvas-container, .embedded-building-manager > #timeDock { display: none !important; }
.embedded-building-manager #indoorManager { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; margin: 0; }
.embedded-building-manager #indoorManager .manager-header { padding: 10px 18px; }
.embedded-building-manager #indoorManager .manager-header > div { display: none; }
.embedded-building-manager #indoorManager .manager-header { justify-content: flex-end; padding: 6px 18px; }
.embedded-building-manager #indoorManager .manager-fields { max-height: calc(100dvh - 110px); }
#indoorManager .placement-toolbar label { flex: 1 1 120px; max-width: 160px; margin: 0; }
#indoorManager .placement-toolbar .manager-primary { width: auto; }
#indoorPlacement { display: block; width: 100%; height: 100%; touch-action: none; cursor: move; }
#indoorManager .manager-primary { width: 100%; background: #157c72; color: white; }
#indoorManager .placement-error { color: #a63932; }
#indoorManager .placement-ok { color: #157c72; }
@media (max-width: 700px) { .manager-layout { grid-template-columns: minmax(0,1fr); } .manager-fields { max-height: 38dvh; border-right: 0; border-bottom: 1px solid #d5dcda; } .placement-wrap { height: 32dvh; min-height: 220px; } #indoorManager .manager-header { padding: 10px; } }
button { font-size: 13px; font-weight: 600; }
button:disabled { cursor: not-allowed; }
input[type="checkbox"], input[type="range"] { accent-color: #157c72; }

.github-link { width: 36px; height: 36px; border-radius: 6px; box-shadow: 0 1px 5px #26343018; }
.github-link svg { width: 21px; height: 21px; }
.github-link:hover { transform: none; }
.scene-navigation {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 4px;
    padding: 5px;
    border: 1px solid #d5dcda;
    border-radius: 8px;
    background: #fafcfb;
    box-shadow: 0 2px 12px #26343018;
}
.scene-navigation button { min-width: 64px; min-height: 40px; padding: 8px 14px; border: 0; border-radius: 5px; background: transparent; color: #36574a; cursor: pointer; }
.scene-navigation button:hover { background: #e0ece6; }
.scene-navigation button[aria-pressed="true"] { background: #157c72; color: #fff; }
@media (max-width: 600px) { .scene-navigation { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.lang-switcher { gap: 2px; flex-shrink: 0; }
.lang-btn { border-radius: 4px; font-size: 12px; }
.lang-btn.active { background: #e1efeb; color: #176b61; }

#controls {
    box-sizing: border-box;
    top: 12px;
    right: 12px;
    width: 352px;
    padding: 48px 18px 12px;
    border: 1px solid #d5dcda;
    box-shadow: 0 8px 32px #26343018;
    background: #fafcfb;
}
.panel-content { max-height: calc(100dvh - 100px); scrollbar-width: thin; scrollbar-color: #bdccc5 transparent; }
h2, h3 { font-size: 16px; line-height: 1.5; color: #263430; text-align: left; border: 0; padding: 0; }
#controls .control-group { padding: 14px 0; margin: 0; border-top: 1px solid #e0e6e3; }
#controls label { font-size: 13px; font-weight: 600; }
#controls .location-config, .sunlight-analysis .analysis-config {
    background: transparent; border: 0; border-radius: 0; padding: 0;
}
#controls .file-upload-btn { background: #edf3f0; color: #236a60; border: 1px solid #b9cec5; }
#controls .file-upload-btn:hover { background: #e0ece6; }
#controls .editor-entry {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #b9cec5;
    border-radius: 5px;
    color: #236a60;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}
#controls .editor-entry:hover { background: #e0ece6; }
#controls .editor-entry-hint { margin: 6px 0 0; color: #63736c; font-size: 12px; line-height: 1.5; }
.calc-btn { background: #157c72; box-shadow: none; border-radius: 5px; }
.calc-btn:hover:not(:disabled) { background: #10655c; transform: none; box-shadow: none; }
.time-display { font-variant-numeric: tabular-nums; letter-spacing: 0; color: #263430; }
.lat-display { color: #63736c; font-size: 12px; }
.sunlight-stats { border: 0; border-radius: 0; background: #f0f4f2; padding: 12px; }
.sunlight-stats .stat-value { font-variant-numeric: tabular-nums; }
.sidebar-toggle { background: #edf3f0; box-shadow: none; border: 1px solid #d5dcda; border-radius: 5px; }
.unit-info-panel { border: 1px solid #d5dcda; border-radius: 6px; box-shadow: 0 6px 24px #26343020; }
.unit-info-header { background: #edf3f0; color: #263430; }
#timeDock { border-radius: 6px; }

#canvas-wrapper { background: #e5eae7; }
#editorCanvas { box-shadow: 0 2px 20px #26343025; }
#sidebar { background: #fafcfb; padding: 16px; border-color: #d5dcda; box-shadow: none; }
#sidebar > div:first-child, #sidebar > button, #bottomPane > button { flex-shrink: 0; }
#topPane { border: 0; border-radius: 0; background: transparent; padding: 0 6px 0 0; scrollbar-width: thin; }
.step { border: 0; border-radius: 0; border-top: 1px solid #dce4df; background: transparent; padding: 12px 0; margin-bottom: 0; }
.step.active { border-color: #dce4df; box-shadow: none; }
#sidebar .location-config { border: 0; background: #f0f4f2; border-radius: 0; }
#sidebar input, #sidebar select, #sidebar textarea { border-color: #d5dcda; }
#sidebar button.secondary, #sidebar button.info { background: #e8efeb; color: #36574a; }
#sidebar button.secondary:hover, #sidebar button.info:hover { background: #d8e5dd; }
#sidebar button.success { background: #157c72; }
#sidebar .btn-outline { color: #236a60; border-color: #b9cec5; }
.resizer { height: 6px; border-radius: 0; background: #e0e6e3; box-shadow: none; }
.resizer:hover { background: #aec8ba; }
#table-wrapper { border-color: #d5dcda; border-radius: 0; }
#bottomPane { min-height: 0; }
#bottomPane > .step, #bottomPane > .resizer { flex-shrink: 0; }
#bottomPane #table-wrapper { flex: 1 1 auto; min-height: 60px; }
#btnExport { min-height: 38px; }
th { background: #edf3f0; color: #52695c; font-size: 12px; }
td { border-color: #e0e6e3; }
#empty-tip { color: #64756b; max-width: 80%; text-align: center; line-height: 1.6; }

@media (max-width: 600px) {
    #controls { width: 300px; max-width: calc(100vw - 64px); top: 8px; right: 8px; padding: 48px 14px 12px; }
    .panel-content { max-height: calc(100dvh - 164px); }
    #controls.collapsed { padding: 6px; width: 48px; }
    .github-link { top: 8px; left: 8px; }
}

@media (max-width: 768px) {
    #canvas-wrapper { height: 40dvh; flex: none; width: 100%; }
    #sidebar { height: 60dvh; max-height: 60dvh; }
    #topPane { min-height: 130px; height: 24dvh !important; flex: 0 1 24dvh; }
    #bottomPane { flex: 1 1 0; }
    #table-wrapper th { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
