:root {
    --bg: #0f1419;
    --panel: #171d24;
    --panel-border: #2a3441;
    --text: #e7edf4;
    --muted: #8b98a5;
    --accent: #f59e0b;
    --accent-soft: rgba(245, 158, 11, 0.15);
    --blm: #d97706;
    --reviewed: #22c55e;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.hidden {
    display: none !important;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.auth-card h1 {
    margin: 0 0 0.5rem;
}

.auth-card p {
    color: var(--muted);
    margin: 0 0 1.5rem;
}

#google-sign-in {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font-weight: 600;
    cursor: pointer;
}

.auth-error {
    margin: 1rem 0 0;
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 1.2rem;
}

.auth-setup {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: left;
}

.auth-setup a {
    color: var(--accent);
}

.hosted-banner {
    grid-column: 1 / -1;
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text);
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    line-height: 1.45;
}

.hosted-banner code {
    font-size: 0.8rem;
}

.layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

.sidebar {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--panel);
    border-right: 1px solid var(--panel-border);
    overflow: hidden;
}

.header-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.35rem;
}

.sidebar-header p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.user-label {
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.ghost-btn {
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--text);
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.stat {
    background: var(--bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 0.75rem;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    font-size: 0.75rem;
}

.filters {
    display: grid;
    gap: 0.75rem;
}

.filters label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.filters select,
.filters input[type="search"] {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--bg);
    color: var(--text);
}

.checkbox-row {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    color: var(--text) !important;
}

#refresh-btn {
    padding: 0.65rem 0.85rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #111;
    font-weight: 600;
    cursor: pointer;
}

#refresh-btn:hover {
    filter: brightness(1.05);
}

.list-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.list-header h2 {
    margin: 0;
    font-size: 1rem;
}

#list-count {
    color: var(--muted);
    font-size: 0.85rem;
}

.sightings-list {
    overflow: auto;
    display: grid;
    gap: 0.5rem;
    padding-right: 0.25rem;
}

.sighting-card {
    background: var(--bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sighting-card:hover,
.sighting-card.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.sighting-card.reviewed {
    border-left: 3px solid var(--reviewed);
}

.sighting-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.sighting-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.sighting-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.sighting-actions button {
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.sighting-actions button.primary {
    border-color: var(--reviewed);
    color: var(--reviewed);
}

.map-panel {
    grid-row: 2;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.map-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 500;
    background: rgba(15, 20, 25, 0.9);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--panel);
    color: var(--text);
}

.popup-title {
    margin: 0 0 0.35rem;
    font-weight: 700;
}

.popup-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.45;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: 45vh 55vh;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--panel-border);
    }
}
