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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    height: 100vh;
}

#map {
    flex: 1;
    height: 100%;
}

/* Toolbar - sits above the map in top-left */
#toolbar {
    position: fixed;
    top: 10px;
    left: 60px;
    z-index: 1001;
    display: flex;
    gap: 6px;
}

#toolbar button {
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #fff;
    border: none;
    border-radius: 3px;
    background: #007bff;
}

#toolbar .btn-danger {
    background: #dc3545;
}

/* Device sidebar (right edge) */
#sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    height: 100%;
    overflow-y: auto;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    padding: 16px;
    display: none;
    z-index: 1002;
}

#sidebar.open { display: block; }

#sidebar h2 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}

#sidebar .meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}

#sidebar table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

#sidebar th, #sidebar td {
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1px solid #dee2e6;
}

#sidebar th { font-weight: 600; color: #555; }

#close-sidebar {
    float: right;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
}

.btn-range {
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    color: #333;
}
.btn-range.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Activity log panel (bottom) */
#log-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 280px;
    background: #fff;
    border-top: 2px solid #dee2e6;
    z-index: 999;
    display: none;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    flex-direction: column;
}

#log-panel.open { display: flex; }

#log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#log-header h2 {
    font-size: 14px;
    margin: 0;
}

#log-header button {
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
}

.btn-log-clear {
    background: #dc3545;
    color: #fff;
    border: none;
    margin-right: 4px;
}

.btn-log-close {
    background: none;
    border: 1px solid #999;
    color: #333;
    font-size: 16px !important;
    padding: 2px 8px !important;
}

#log-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

#log-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

#log-panel th {
    text-align: left;
    padding: 6px 6px;
    border-bottom: 2px solid #ccc;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    background: #fff;
}

#log-panel td {
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}

#log-panel td.mono {
    font-family: monospace;
    font-size: 10px;
}

#log-panel td.detail {
    font-size: 10px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Viewer settings panel (centered modal) */
#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 460px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    z-index: 1003;
    display: none;
}

#settings-panel.open { display: block; }

#settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}

#settings-header h2 {
    font-size: 14px;
    margin: 0;
}

#settings-body {
    padding: 14px;
    font-size: 13px;
}

#settings-body label {
    display: block;
    margin-bottom: 6px;
}

#settings-body input[type="datetime-local"] {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-bottom: 6px;
}

#settings-body small {
    display: block;
    color: #666;
    font-size: 11px;
    margin-bottom: 12px;
}

.settings-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.settings-actions button {
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
}

.settings-actions .btn-primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    margin-left: auto;
}

#settings-status {
    font-size: 11px;
    color: #555;
    font-style: italic;
}
