@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-sidebar: #f0f2f5;
    --panel-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #059669;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
body { background-color: #f8fafc; color: var(--text-main); overflow: hidden; }

#app { display: flex; height: 100vh; width: 100vw; position: relative; }

/* Sidebar */
.sidebar {
    width: 380px;
    min-width: 380px;
    height: 100%;
    z-index: 10;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--bg-sidebar);
    transition: width 0.25s ease, min-width 0.25s ease, padding 0.25s ease, opacity 0.25s ease;
}
.sidebar-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-right: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: absolute;
    left: 380px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 24px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--border);
    border-left: none;
    background: var(--panel-bg);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.25s ease;
    box-shadow: 2px 0 6px rgba(0,0,0,0.08);
}
.sidebar-toggle:hover { background: #f1f5f9; }
.sidebar-collapsed ~ .sidebar-toggle { left: 0; }

.header h1 { font-size: 20px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.header p { font-size: 12px; color: var(--text-muted); }

.auth-status {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.auth-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.auth-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(37, 99, 235, 0.18);
    object-fit: cover;
    flex-shrink: 0;
}
.auth-user-meta {
    min-width: 0;
}
.auth-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.auth-user-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.auth-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Control Groups */
.control-group {
    background: var(--panel-bg);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.control-group h3 {
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    font-weight: 600;
}

/* Radio rows */
.radio-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.radio-row label {
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

/* Coordinate inputs */
.coord-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.coord-row label { width: 30px; font-size: 12px; color: var(--text-muted); }
.coord-sm {
    width: 48px;
    padding: 4px 4px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    text-align: center;
}
.coord-md {
    width: 58px;
    padding: 4px 4px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    text-align: center;
}
.coord-sm:focus, .coord-md:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
select.coord-sm {
    width: 42px;
    padding: 3px 2px;
    appearance: auto;
}

/* Input rows */
.input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.input-row:last-child { margin-bottom: 0; }
.input-row label { font-size: 12px; color: var(--text-muted); }
.input-row input[type="number"] {
    width: 80px;
    padding: 5px 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    text-align: right;
    transition: all 0.2s;
}
.input-row input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.compact-select {
    width: 120px;
    padding: 4px 28px 4px 8px;
    background-color: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    line-height: 1.3;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) calc(50% - 2px),
        calc(100% - 8px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.compact-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.compact-select:disabled {
    opacity: 1;
    color: #64748b;
    background-color: #eef2f7;
    cursor: not-allowed;
}

/* Target heights */
.target-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.target-cb { cursor: pointer; }
.color-pick {
    width: 28px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    background: none;
}
.target-val {
    width: 80px;
    padding: 4px 6px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    text-align: right;
}
.target-val:focus {
    outline: none;
    border-color: var(--primary);
}

/* Slider */
.slider-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.slider-row label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

/* Badge */
.badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.badge-sm {
    background: rgba(37,99,235,0.1);
    color: var(--primary);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}

/* Radar List */
.radar-list {
    max-height: 260px;
    overflow-y: auto;
}
.radar-item-wrap {
    margin-bottom: 2px;
}
.radar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 5px;
    cursor: default;
    transition: background 0.15s;
    border: 1px solid transparent;
}
.radar-item:hover { background: rgba(37,99,235,0.04); }
.radar-item-sel {
    background: rgba(37,99,235,0.08);
    border-color: var(--primary) !important;
}
.radar-vis-cb {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
}
.radar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.radar-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.radar-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}
.btn-icon {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-icon:hover { background: rgba(37,99,235,0.08); }
.btn-icon-danger { color: #ef4444; }
.btn-icon-danger:hover { background: rgba(239,68,68,0.08); }
.btn-active {
    background: rgba(239,68,68,0.1) !important;
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}
.text-muted-msg {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 0;
}

/* Inline Radar Progress */
.radar-progress {
    padding: 4px 8px 6px 24px;
}
.radar-progress .progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.radar-progress .progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Buttons */
button {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background: rgba(37, 99, 235, 0.05); }
.btn-sm { padding: 6px 10px; font-size: 11px; }

/* Footer */
.footer {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}
.btn-footer {
    flex: 1;
    padding: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
}
.btn-footer:hover { background: #f1f5f9; }

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,0.18), transparent 30%),
        linear-gradient(135deg, rgba(15,23,42,0.86), rgba(30,41,59,0.8));
    backdrop-filter: blur(4px);
}
.auth-card {
    width: min(420px, 100%);
    padding: 28px;
    border-radius: 18px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 28px 60px rgba(15,23,42,0.28);
}
.auth-kicker {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}
.auth-card h2 {
    font-size: 28px;
    line-height: 1.1;
    margin-bottom: 10px;
    color: #0f172a;
}
.auth-message {
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
}
.auth-message.auth-error {
    color: #b91c1c;
}
.auth-hint {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}
.google-login-container {
    min-height: 44px;
}
.auth-overlay-actions {
    margin-top: 14px;
}

.admin-panel {
    position: fixed;
    inset: 0;
    z-index: 2400;
    padding: 20px;
    background: rgba(15,23,42,0.5);
    overflow-y: auto;
}
.admin-panel-dialog {
    width: min(1180px, 100%);
    margin: 0 auto;
    background: #f8fafc;
    border-radius: 18px;
    border: 1px solid rgba(148,163,184,0.35);
    box-shadow: 0 20px 50px rgba(15,23,42,0.22);
    padding: 22px;
}
.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.admin-panel-header h2 {
    font-size: 24px;
    color: #0f172a;
}
.admin-kicker {
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}
.admin-panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.admin-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.admin-tab {
    width: auto;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(37,99,235,0.2);
    background: rgba(255,255,255,0.92);
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.admin-tab:hover {
    background: rgba(37,99,235,0.06);
}
.admin-tab.is-active {
    background: rgba(37,99,235,0.12);
    border-color: rgba(37,99,235,0.35);
    color: var(--primary);
}
.admin-tab-panel {
    width: 100%;
}
.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.admin-stat-card {
    padding: 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(148,163,184,0.3);
}
.admin-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.admin-stat-value {
    margin-top: 6px;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}
.admin-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 16px;
    margin-bottom: 16px;
}
.admin-section {
    background: #ffffff;
    border: 1px solid rgba(148,163,184,0.3);
    border-radius: 14px;
    padding: 16px;
}
.admin-section-full {
    width: 100%;
}
.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.admin-section-header h3 {
    font-size: 14px;
    color: #0f172a;
}
.admin-table-wrap {
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th,
.admin-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(226,232,240,0.9);
    text-align: left;
    font-size: 12px;
    vertical-align: top;
}
.admin-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}
.admin-table tr:last-child td {
    border-bottom: none;
}
.admin-empty {
    padding: 14px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.admin-user-name {
    font-weight: 600;
    color: var(--text-main);
}
.admin-user-email {
    color: var(--text-muted);
}
.admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37,99,235,0.08);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
}
.admin-pill.admin-pill-warn {
    background: rgba(249,115,22,0.12);
    color: #c2410c;
}
.admin-pill.admin-pill-neutral {
    background: rgba(148,163,184,0.16);
    color: #475569;
}
.admin-detail {
    color: var(--text-muted);
    font-size: 11px;
    word-break: break-word;
}
.admin-danger-btn {
    width: auto;
    padding: 6px 10px;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    background: rgba(239,68,68,0.08);
    color: #b91c1c;
    font-size: 11px;
    font-weight: 600;
}
.admin-danger-btn:hover {
    background: rgba(239,68,68,0.14);
}
.admin-danger-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Map */
#map-container { flex-grow: 1; position: relative; }
#map { width: 100%; height: 100%; }
.leaflet-container {
    width: 100%;
    height: 100%;
    background: #dbeafe;
    font: inherit;
}

/* Legend */
#legend {
    position: absolute;
    bottom: 24px;
    left: 16px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px 14px;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    min-width: 140px;
}
#legend h4 {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 2px 0;
    color: #333;
}
.legend-color {
    width: 20px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* Utility */
.hidden { display: none !important; }

/* Search Box */
.search-box {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    width: 360px;
    max-width: calc(100% - 40px);
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    color: var(--text-main);
    outline: none;
    transition: box-shadow 0.2s;
}
.search-box input:focus {
    box-shadow: 0 2px 16px rgba(37,99,235,0.25);
}
.search-results {
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
}

.leaflet-control-container {
    z-index: 950;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
}
.search-result-item:hover {
    background: #f1f5f9;
}
.search-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.search-main {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}
.search-sub {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Checkbox styling */
input[type="checkbox"] {
    accent-color: var(--primary);
}
input[type="radio"] {
    accent-color: var(--primary);
}

/* Coverage Stats */
.coverage-stats {
    margin-top: 8px;
    padding: 8px 0 0;
    border-top: 1px solid var(--border);
}
.stats-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.stats-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 11px;
}
.stats-color {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.stats-label {
    flex: 1;
    color: var(--text-muted);
}
.stats-value {
    font-weight: 600;
    color: var(--text-main);
}

/* Dark Mode */
body.dark-mode {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --bg-sidebar: #1e293b;
    --panel-bg: #0f172a;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent: #34d399;
    background-color: #0f172a;
    color: #e2e8f0;
}
body.dark-mode .sidebar { background: var(--bg-sidebar); }
body.dark-mode .control-group { background: var(--panel-bg); border-color: var(--border); }
body.dark-mode .sidebar-toggle { background: var(--panel-bg); color: var(--text-muted); border-color: var(--border); }
body.dark-mode .sidebar-toggle:hover { background: #1e293b; }
body.dark-mode .btn-footer { background: var(--panel-bg); border-color: var(--border); color: var(--text-muted); }
body.dark-mode .btn-footer:hover { background: #1e293b; }
body.dark-mode .btn-secondary { color: var(--primary); border-color: var(--primary); }
body.dark-mode .btn-icon { background: var(--panel-bg); border-color: var(--border); }
body.dark-mode .coord-sm, body.dark-mode .coord-md, body.dark-mode .target-val,
body.dark-mode .input-row input[type="number"], body.dark-mode .project-name-input {
    background: #1e293b;
    color: var(--text-main);
    border-color: var(--border);
}
body.dark-mode select { background: #1e293b; color: var(--text-main); border-color: var(--border); }
body.dark-mode .compact-select {
    background-color: #1e293b;
    color: #f8fafc;
    border-color: #475569;
    background-image:
        linear-gradient(45deg, transparent 50%, #cbd5e1 50%),
        linear-gradient(135deg, #cbd5e1 50%, transparent 50%);
}
body.dark-mode .compact-select:disabled {
    background-color: #162032;
    color: #cbd5e1;
    border-color: #334155;
}
body.dark-mode #legend { background: rgba(15,23,42,0.92); border-color: var(--border); }
body.dark-mode #legend h4, body.dark-mode .legend-item { color: var(--text-main); }
body.dark-mode .search-box input { background: #1e293b; color: var(--text-main); box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
body.dark-mode .search-results { background: #1e293b; }
body.dark-mode .search-result-item:hover { background: #334155; }
body.dark-mode .search-main { color: var(--text-main); }
body.dark-mode .radar-item:hover { background: rgba(96,165,250,0.08); }
body.dark-mode .radar-item-sel { background: rgba(96,165,250,0.15); border-color: var(--primary) !important; }
body.dark-mode .project-item:hover { background: rgba(96,165,250,0.08); }
body.dark-mode .project-item-current { background: rgba(96,165,250,0.15); border-color: var(--primary); }
body.dark-mode .auth-status {
    background: rgba(15,23,42,0.72);
    border-color: var(--border);
}
body.dark-mode .auth-card {
    background: rgba(15,23,42,0.96);
    border-color: rgba(51,65,85,0.85);
}
body.dark-mode .auth-card h2,
body.dark-mode .admin-panel-header h2,
body.dark-mode .admin-section-header h3,
body.dark-mode .admin-stat-value {
    color: #f8fafc;
}
body.dark-mode .admin-tab {
    background: rgba(15,23,42,0.92);
    border-color: rgba(96,165,250,0.2);
    color: #cbd5e1;
}
body.dark-mode .admin-tab:hover {
    background: rgba(96,165,250,0.1);
}
body.dark-mode .admin-tab.is-active {
    background: rgba(96,165,250,0.18);
    border-color: rgba(96,165,250,0.4);
    color: #bfdbfe;
}
body.dark-mode .auth-message {
    color: #cbd5e1;
}
body.dark-mode .auth-hint {
    color: #94a3b8;
}
body.dark-mode .admin-panel-dialog,
body.dark-mode .admin-section,
body.dark-mode .admin-stat-card {
    background: #0f172a;
    border-color: #334155;
}
body.dark-mode .admin-table th,
body.dark-mode .admin-table td {
    border-bottom-color: rgba(51,65,85,0.9);
}
body.dark-mode .admin-empty,
body.dark-mode .admin-detail,
body.dark-mode .admin-user-email,
body.dark-mode .admin-table th,
body.dark-mode .admin-stat-label {
    color: #94a3b8;
}
body.dark-mode .admin-user-name {
    color: #e2e8f0;
}
body.dark-mode .admin-danger-btn {
    background: rgba(239,68,68,0.14);
    border-color: rgba(239,68,68,0.28);
    color: #fecaca;
}
body.dark-mode .admin-pill.admin-pill-neutral {
    background: rgba(148,163,184,0.16);
    color: #cbd5e1;
}

/* Elevation Profile Panel */
.profile-panel {
    position: absolute;
    bottom: 24px;
    right: 16px;
    background: rgba(255,255,255,0.96);
    border: 1px solid #ccc;
    border-radius: 10px;
    z-index: 1200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 440px;
    max-width: 480px;
}
body.dark-mode .profile-panel {
    background: rgba(15,23,42,0.96);
    border-color: var(--border);
}

/* Project Management */
.project-name-input {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: #f8fafc;
    color: var(--text-main);
}
.project-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.project-list {
    max-height: 150px;
    overflow-y: auto;
}
.project-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    margin-bottom: 2px;
    transition: background 0.15s;
}
.project-item:hover { background: rgba(37,99,235,0.04); }
.project-item-current {
    background: rgba(37,99,235,0.08);
    border-color: var(--primary);
}
.project-info {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
}
.project-item-name {
    font-size: 12px;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-date {
    font-size: 10px;
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .admin-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .auth-status {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-actions {
        justify-content: flex-start;
    }

    .admin-panel {
        padding: 10px;
    }

    .admin-panel-dialog {
        padding: 16px;
    }

    .admin-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-panel {
        min-width: 0;
        width: calc(100% - 24px);
        right: 12px;
        bottom: 12px;
    }
}
