/*
 * Theme tokens (UI "Theme"). Plain file, not built by Vite, so offline.html shares it.
 * light-dark() picks by color-scheme: System follows prefers-color-scheme; <html data-theme> (set server-side
 * from the profile) forces one. Every pair below meets WCAG AA in its theme.
 */
:root {
    color-scheme: light dark;

    --app-width: 560px; /* the phone column: on wider screens the app stays this wide, centered */

    --accent: light-dark(#c2410c, #fb923c); /* provisional (UI open item); also manifest theme_color */
    --on-accent: light-dark(#fff, #1c1917);
    --accent-text: light-dark(#c2410c, #fdba74);

    --bg: light-dark(#f4f5f7, #121417);
    --surface: light-dark(#fff, #1e2227); /* sheet, editor, cards, dialog, menu */
    --text: light-dark(#1f2933, #e6e9ed);
    --text-muted: light-dark(#5b6670, #a3adb8);
    --border: light-dark(#c5cbd3, #4a525c);
    --divider: light-dark(#e3e7eb, #2e343b);
    --disabled-bg: light-dark(#c5cbd3, #3a4048);
    --disabled-text: light-dark(#4a5560, #b4bcc5);
    --danger: light-dark(#c62828, #f87171);
    --on-danger: light-dark(#fff, #1c1917);
    --danger-bg: light-dark(#fdecea, #3b1d1d);
    --danger-text: light-dark(#8a1c13, #fca5a5);
    --link: light-dark(#1a5fd0, #8ab4f8);
    --focus: light-dark(#1a5fd0, #8ab4f8);
    --toast-bg: light-dark(#1f2933, #e6e9ed);
    --toast-text: light-dark(#fff, #1f2933);
    --shadow: light-dark(#0004, #000a);
    --backdrop: #0008;

    /* Map overlays sit on light tiles in both themes. */
    --pin-accent: #34d07a; /* a lighter shade of the unlocked pin's green; the in-range glow */
    --pin-muted: #9aa1a9;
    --pin-outline: #1f2933;
    --pin-halo: #fff;
    --geo-user: #1a73e8;
    --geo-ring: var(--accent); /* the open ring */
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

html, body, #app { height: 100%; margin: 0; }
* { touch-action: manipulation; } /* no double-tap zoom (iOS ignores user-scalable=no); class rules like Leaflet's still win */
body { background: var(--bg); color: var(--text); font: 15px system-ui, sans-serif; }
button, input, select, textarea { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* The phone column (AppShell). Beside it the page is a shade darker, so the column reads as the app. */
.app-column { box-sizing: border-box; max-width: var(--app-width); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); box-shadow: 0 0 0 1px var(--divider), 0 0 24px var(--shadow); }
/* Page fills what the nav bar leaves, so a page can pin content to the bottom. */
.app-column > .page { flex: 1; }
body:has(.app-column) { background: color-mix(in srgb, var(--bg), black 8%); }

/* Full pages: login, settings, offline. */
.page { box-sizing: border-box; max-width: var(--app-width); min-height: 100%; margin: 0 auto; padding: 24px 16px; }
.page h1 { margin: 0 0 8px; font-size: 1.6rem; }
.page .muted { color: var(--text-muted); }
.btn {
    min-height: 44px; padding: 0 20px; border: 0; border-radius: 8px;
    background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer;
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn:disabled { background: var(--disabled-bg); color: var(--disabled-text); }
.btn--plain { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: normal; }
.center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.alert { padding: 10px 14px; border-radius: 8px; background: var(--danger-bg); color: var(--danger-text); }
.back-pill { display: inline-flex; align-items: center; min-height: 36px; line-height: 1; padding: 0 14px 0 10px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; }
.back-pill:active { background: color-mix(in srgb, var(--accent), black 15%); }
.back-pill__chevron { margin-right: 4px; font-size: 1.5em; line-height: 1; }

/* A rendered note body (markup.render): Single Note and Admin Note. */
.note__body { line-height: 1.5; overflow-wrap: anywhere; }
.note__body h3 { font-size: 1.05rem; margin: 1em 0 0.4em; }
.note__body ul { padding-left: 1.3em; }
.note__body a { color: var(--link); }
