:root {
    --bg: #ffffff;
    --surface: #f5f5f7;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --border: #d2d2d7;
    --accent: #007aff;
    --sidebar-width: 340px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1c1e;
        --surface: #2c2c2e;
        --text: #f5f5f7;
        --muted: #98989d;
        --border: #3a3a3c;
        --accent: #0a84ff;
    }
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 600;
    font-size: 17px;
    color: inherit;
    text-decoration: none;
}

.button {
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.button:disabled { opacity: 0.6; cursor: default; }
.button.secondary { background: var(--border); color: var(--text); }

.public-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 4px;
}

.sign-in-dialog {
    max-width: 320px;
    padding: 20px;
    border: 0;
    border-radius: 14px;
    background: var(--bg);
    color: var(--text);
    text-align: center;
}

.sign-in-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.sign-in-dialog p { margin: 0 0 16px; }
.sign-in-dialog form { margin-top: 12px; }
#sign-in-dialog-slot { display: flex; justify-content: center; }

.layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sidebar {
    width: var(--sidebar-width);
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.map {
    flex: 1;
    min-height: 300px;
}

.status {
    padding: 16px;
    color: var(--muted);
}

.status[hidden] { display: none; }

.public-header { padding: 16px 16px 8px; }
.public-header h1 { margin: 0 0 4px; font-size: 22px; }

.notes {
    margin: 0 0 8px;
    white-space: pre-line;
}

.category { border-bottom: 1px solid var(--border); }

.category summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
}

.category .notes { padding: 0 16px; font-size: 14px; }

.category-name { flex: 1; }
.category-meta { color: var(--muted); font-weight: 400; font-size: 13px; margin: 0; }

.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--border);
    color: var(--text);
    text-decoration: none;
}

.places {
    list-style: none;
    margin: 0;
    padding: 0 0 8px;
}

.place {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.place:hover { background: var(--border); }

.dot {
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
}

.place-text { display: flex; flex-direction: column; min-width: 0; }
.place-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-address { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.popup { max-width: 260px; }
.popup p { margin: 6px 0; white-space: pre-line; }
.popup-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.config-warning {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    padding: 12px 16px;
    border-radius: 10px;
    background: #ffcc00;
    color: #1d1d1f;
}

@media (max-width: 700px) {
    .layout { flex-direction: column-reverse; }
    .sidebar { width: auto; max-height: 45vh; border-right: 0; border-top: 1px solid var(--border); }
}

.optional-logo {
    display: block;
    width: 96px;
    margin: 24px auto;
    color: var(--muted);
}

.optional-logo:hover { color: var(--text); }
.optional-logo-mark { display: block; width: 100%; height: auto; }

.mac-app-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.mac-app-banner[hidden] { display: none; }

.mac-app-banner-close {
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.mac-app-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.mac-app-banner-text span { color: var(--muted); }
.mac-app-banner .button { text-decoration: none; }
