/* Compact map controls. Status messages appear only when action or waiting is needed. */
#sidebar {
    font-weight:600;
    --side-bg: #242a32;
    --side-card: #2d3540;
    --side-line: #3b4552;
    --side-text: #edf2f7;
    --side-muted: #b6c2d1;
    --side-selected: #3b4758;
}
body.light-mode #sidebar {
    --side-bg: #fff;
    --side-card: #f3f5f8;
    --side-line: #e4e8ee;
    --side-text: #29303a;
    --side-muted: #657185;
    --side-selected: #fff;
}
#sidebar .sidebar-header { padding:14px 12px; border-color:var(--side-line); font-size:14px; line-height:1.5; }
#sidebar .sidebar-header button { background:transparent !important; color:var(--side-muted) !important; min-height:40px; padding:6px !important; font:inherit; }
#sidebarTitle { min-width:0; text-align:left !important; overflow-wrap:anywhere; }
#sidebar .weather-widget { justify-content:flex-start; padding:12px 18px 4px; gap:10px; border:0; }
#sidebar .weather-icon { font-size:26px; }
#sidebar .weather-info { flex:1; display:grid; grid-template-columns:1fr auto; gap:2px 10px; align-items:center; }
#sidebar .weather-location { color:var(--side-muted); font-size:12px; font-weight:600; margin:0; }
#sidebar .weather-temp { grid-column:2; grid-row:1 / 3; font-size:22px; margin:0; }
#sidebar .weather-desc { font-size:13px; }
#sidebar .add-form { padding:12px 16px 0; gap:16px; border:0; }
#sidebar .theme-toggle { gap:4px; padding:3px; border:0; border-radius:9px; background:var(--side-card); }
#sidebar .theme-toggle button { min-height:36px; padding:6px; border-radius:7px; font-size:13px; font-weight:600; }
#sidebar .theme-toggle button.active { background:var(--side-selected); color:var(--side-text); box-shadow:none; }
#sidebar .viewer-mode-control { border:0; padding:0; gap:9px; background:transparent; }
#sidebar .viewer-mode-title { color:var(--side-text); font-size:13px; font-weight:600; }
#sidebar .viewer-mode-buttons { gap:3px; padding:3px; border-radius:9px; background:var(--side-card); }
#sidebar .viewer-mode-buttons button { min-height:40px; border:0; background:transparent; padding:7px 1px; font-size:12px; font-weight:600; color:var(--side-muted); }
#sidebar .viewer-mode-buttons button.active { background:#2f6bff; color:white; box-shadow:none; }
#sidebar .cad-overlay-control { border:0; border-top:1px solid var(--side-line); padding-top:8px; border-radius:0; background:transparent; }
#sidebar .cad-overlay-toggle { min-height:40px; padding:0; font-size:13px; font-weight:600; }
#sidebar .cad-overlay-toggle small { font-size:12px; font-weight:600; color:var(--side-muted); }
#sidebar .cad-favorites-launch { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:40px; margin:4px 0 0; padding:8px 10px; border:0; background:var(--side-card); border-radius:8px; font-family:inherit; font-size:13px; line-height:1.4; font-weight:600; }
#sidebar .cad-favorites-launch span { float:none; font-size:12px; color:var(--side-muted); font-variant-numeric:tabular-nums; }
#sidebar .cad-overlay-body { border:0; padding:10px 0 0; gap:10px; }
#sidebar .cad-overlay-display-options { gap:8px; }
#sidebar .cad-overlay-display-options span { min-height:40px; font-size:12px; font-weight:600; border-color:var(--side-line); background:var(--side-card); }
#sidebar .cad-overlay-display-options input:checked + span { background:transparent; border-color:#678ff5; color:var(--side-text); box-shadow:none; }
#sidebar .cad-overlay-display-options input:checked + span::before { content:'✓'; margin-right:6px; color:#678ff5; font-weight:bold; }
#sidebar .cad-overlay-advanced { padding-top:0; border:0; }
#sidebar .cad-overlay-advanced summary { min-height:36px; padding:0; font-size:12px; }
#sidebar .cad-overlay-status { font-size:12px; padding:8px; border:0; }
#sidebar #storageDxfStatus[data-state="idle"],
#sidebar #storageDxfStatus[data-state="ready"],
#sidebar #cadCoverageStatus[data-state="ready"],
#sidebar #onlineSyncStatus[data-state="idle"],
#sidebar #onlineSyncStatus[data-state="ready"],
#sidebar .record-sync-panel:has(.record-sync-status[data-state="synced"]) { display:none; }
#sidebar #storageDxfStatus[data-state="error"], #sidebar #cadCoverageStatus[data-state="error"] { color:var(--cad-danger); }
#sidebar .sidebar-record-heading { display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--side-line); padding-top:8px; font-size:13px; font-weight:600; }
#sidebar #btnRefreshOnlineJson { min-height:40px; padding:6px 0 6px 10px; border:0; background:transparent; color:var(--side-muted); font:600 12px/1.4 sans-serif; cursor:pointer; }
#sidebar #btnRefreshOnlineJson:disabled { opacity:.6; cursor:wait; }
#sidebar #onlineSyncStatus, #sidebar .record-sync-panel { margin-top:-8px; padding:8px 10px; border:0; border-radius:7px; background:var(--side-card); font-size:12px; line-height:1.5; }
#sidebar .record-sync-error { white-space:normal; overflow-wrap:anywhere; }
#sidebar .record-sync-actions:empty { display:none; }
#sidebar .record-list { padding:4px 16px 12px; gap:6px; }
#sidebar .folder-container { border-radius:8px; }
#sidebar .folder-header { width:100%; min-height:48px; padding:12px; border:0; border-radius:8px; background:var(--side-card); color:var(--side-text); text-align:left; font-family:inherit; font-size:14px; font-weight:700; gap:10px; }
#sidebar .folder-header > span:first-child { min-width:0; overflow-wrap:anywhere; }
#sidebar .folder-count { margin-left:5px; color:var(--side-muted); font-size:12px; font-weight:600; }
#sidebar .folder-chevron { flex-shrink:0; width:6px; height:6px; border-right:1.5px solid var(--side-muted); border-bottom:1.5px solid var(--side-muted); transform:rotate(45deg); margin-right:3px; }
#sidebar .folder-header[aria-expanded="true"] .folder-chevron { transform:rotate(225deg); }
#sidebar .bottom-toolbar { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:10px 12px max(10px,env(safe-area-inset-bottom)); border-color:var(--side-line); }
#sidebar .btn-tools { min-width:0; min-height:44px; padding:8px 2px; border:1px solid var(--side-line); border-radius:8px; background:var(--side-card); color:var(--side-text); font-family:inherit; font-size:12px; font-weight:600; }
#sidebar .btn-tools:active { border-color:#678ff5; background:var(--side-selected); }
#sidebar button:focus-visible, #sidebar summary:focus-visible { outline:2px solid #678ff5; outline-offset:-2px; }
@media (hover:hover) {
    #sidebar .folder-header:hover, #sidebar .cad-favorites-launch:hover, #sidebar .btn-tools:hover { background:var(--side-selected); }
}
@media (max-height:650px) {
    #sidebar .weather-widget { display:none; }
    #sidebar .add-form { gap:10px; padding-top:8px; }
    #sidebar .sidebar-header { padding:6px 12px; }
}
@media (max-height:520px) {
    #sidebar .add-form { max-height:calc(100vh - 210px); overflow-y:auto; scrollbar-width:thin; }
    #sidebar .record-list { min-height:64px; }
}
