/* myJikita Web. Values mirror the mobile app (see docs/PARITY.md §2); the colours are the seeded
   Material 3 scheme from Theme/AppTheme.cs. Light theme only, like mobile. */

:root {
  --brand-blue: #0077A0;
  --brand-red: #EF4136;
  --primary: #1B6585;
  --on-primary: #FFFFFF;
  --primary-container: #C3E8FF;
  --on-primary-container: #001E2C;
  --tertiary: #605A7D;
  --tertiary-container: #E6DEFF;
  --on-tertiary-container: #1C1736;
  --error: #BA1A1A;
  --on-error: #FFFFFF;
  --surface: #F6FAFE;
  --surface-container: #EAEEF2;
  --surface-container-high: #E5E9ED;
  --on-surface: #171C1F;
  --on-surface-variant: #41484D;
  --outline: #71787D;
  --outline-variant: #C0C7CD;
  --attention: #B25E00;
  --live: #1B7F3B;
  --pin-sos: #D32F2F;
  --pin-overdue: #EF6C00;
  --pin-normal: #7B1FA2;
  --fab: 48px;            /* FloatingMapButton.standardSize */
  --gutter: 16px;
  --radius: 12px;
  --panel-width: 400px;
  --elevation-3: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 8px 3px rgba(0, 0, 0, .15);
}

html, body { height: 100%; margin: 0; background: var(--surface); color: var(--on-surface); }
body { font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.text-variant { color: var(--on-surface-variant); }
.preserve-lines { white-space: pre-line; }
.plain-list { margin: .5rem 0 0; padding-left: 1.25rem; }

/* ---------- Boot and error ---------- */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.boot-bar { width: 160px; height: 4px; border-radius: 2px; background: var(--primary-container); overflow: hidden; }
.boot-bar > div { width: 40%; height: 100%; background: var(--primary); animation: boot 1.2s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
#blazor-error-ui { display: none; position: fixed; inset: auto 0 0 0; z-index: 2000; padding: 12px 16px; gap: 16px;
  background: var(--error); color: var(--on-error); align-items: center; }
#blazor-error-ui a, #blazor-error-ui .dismiss { color: inherit; cursor: pointer; text-decoration: none; font-size: 1.2rem; }
.centered-progress { min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- Brand ---------- */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-lockup img { border-radius: 8px; }
.brand-lockup span { font-size: 22px; font-weight: 600; letter-spacing: -0.2px; color: var(--on-surface); }
.brand-lockup-large { flex-direction: column; gap: 12px; }
.brand-lockup-large img { border-radius: 16px; }
.brand-lockup-large span { font-size: 28px; }

/* ---------- Login ---------- */
.login-landing { min-height: 100vh; max-width: 420px; margin: 0 auto; padding: 32px var(--gutter);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; box-sizing: border-box; }
.login-tagline { color: var(--on-surface-variant); }
.login-intro { color: var(--on-surface-variant); max-width: 340px; }
.login-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* ---------- Secondary pages (mobile Scaffold + AppBar) ---------- */
.app-bar { border-bottom: 1px solid var(--outline-variant); }
.app-bar-title { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-page { padding-top: 64px; min-height: 100vh; box-sizing: border-box; }
.app-page-body { padding: 24px var(--gutter) 48px; }
.section-title { display: block; color: var(--primary); font-weight: 500; letter-spacing: .8px; margin: 0 0 8px 4px; }
.list-card { border-radius: var(--radius) !important; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.contact-row { padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); box-sizing: border-box; }
.contact-row:last-child { border-bottom: 0; }
.list-row-text { flex: 1; min-width: 0; }
.list-row-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.list-row-subtitle { font-size: 14px; color: var(--on-surface-variant); }
.empty-state { text-align: center; padding: 48px var(--gutter); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state-icon { color: var(--outline); }
.empty-state-body { color: var(--on-surface-variant); max-width: 420px; }
.profile-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; align-items: baseline; overflow-wrap: anywhere; }
.mud-button-root { border-radius: 20px; text-transform: none; letter-spacing: .1px; }

/* ---------- Map screen (mobile MapScreen) ---------- */
.map-shell { position: fixed; inset: 0; overflow: hidden; }
.map-view { position: absolute; inset: 0; }
.map-canvas { width: 100%; height: 100%; }
.map-failed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--gutter); }
.map-top-left { position: absolute; top: var(--gutter); left: var(--gutter); right: calc(var(--fab) + 2 * var(--gutter));
  display: flex; gap: 8px; align-items: center; z-index: 5; pointer-events: none; }
.map-top-left > * { pointer-events: auto; }
.map-rail { position: absolute; top: var(--gutter); right: var(--gutter); display: flex; flex-direction: column; gap: 12px; z-index: 5; }
.map-fab { width: var(--fab); height: var(--fab); flex: 0 0 var(--fab); border-radius: 50%; border: 0; background: var(--surface);
  color: var(--on-surface); box-shadow: var(--elevation-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.map-fab:hover { background: var(--surface-container); }
.map-fab:focus-visible, .hub-pill:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.maplibregl-ctrl-bottom-left { margin-left: 4px; }

/* "Shared with me" pill — tones from mobile WatchedHubTone. */
.hub-pill { height: var(--fab); max-width: 420px; min-width: 0; padding: 0 14px; border-radius: calc(var(--fab) / 2);
  display: inline-flex; align-items: center; gap: 9px; box-shadow: var(--elevation-3); border: 1px solid; cursor: pointer;
  font: inherit; font-size: 12px; line-height: 16px; }
.hub-pill-line { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.hub-critical { background: color-mix(in srgb, var(--error) 12%, var(--surface)); border-color: var(--error); color: var(--error); }
.hub-unread { background: var(--primary-container); border-color: var(--primary); color: var(--on-primary-container); }
.hub-attention { background: var(--tertiary-container); border-color: var(--tertiary); color: var(--on-tertiary-container); }
.hub-hidden { background: var(--surface); border-color: var(--outline); color: var(--on-surface-variant); }
.hub-calm { background: var(--surface); border-color: var(--outline-variant); color: var(--on-surface); }
.hub-empty { cursor: default; color: var(--on-surface-variant); }
.hub-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: var(--on-primary);
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.hub-critical .hub-count { background: var(--error); color: var(--on-error); }

.sos-banner { position: absolute; top: calc(var(--fab) + 2 * var(--gutter)); left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 20px; background: var(--error); color: var(--on-error);
  box-shadow: var(--elevation-3); font-weight: 500; animation: sos-pulse 1.6s ease-in-out infinite; }
@keyframes sos-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--error) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .sos-banner, .boot-bar > div { animation: none; } }

/* Sheets: modal bottom sheets on mobile; floating cards here. */
.sheet { position: absolute; z-index: 10; background: var(--surface); border-radius: 16px; box-shadow: var(--elevation-3);
  display: flex; flex-direction: column; max-height: calc(100% - 2 * var(--gutter) - var(--fab) - 16px); overflow: hidden; }
.sheet-header { display: flex; align-items: flex-start; gap: 4px; padding: 16px 8px 8px 16px; }
.sheet-body { overflow-y: auto; padding: 0 8px 12px; }
.roster-sheet { top: calc(var(--fab) + var(--gutter) + 8px); left: var(--gutter); width: min(440px, calc(100% - 2 * var(--gutter))); }
.layers-sheet { top: var(--gutter); right: calc(var(--fab) + 2 * var(--gutter)); width: min(380px, calc(100% - var(--fab) - 3 * var(--gutter))); }
.roster-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--outline-variant); }
.roster-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex: 0 0 14px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--outline-variant); }
.dot-sos { background: var(--pin-sos); } .dot-overdue { background: var(--pin-overdue); }
.dot-normal { background: var(--pin-normal); } .dot-muted { background: var(--outline-variant); }
.roster-text { flex: 1; min-width: 0; }
.roster-name { font-weight: 500; overflow-wrap: anywhere; }
.roster-subtitle { font-size: 13px; color: var(--on-surface-variant); }
.roster-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.layer-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 8px; border-top: 1px solid var(--outline-variant); }
.layer-text { flex: 1; min-width: 0; }
.layer-title { font-weight: 500; }
.layer-description { font-size: 13px; color: var(--on-surface-variant); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; font-size: 12px; color: var(--on-surface-variant); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-line { width: 18px; height: 4px; border-radius: 2px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); }

/* Status chips */
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.status-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px;
  font-weight: 500; letter-spacing: .4px; border: 1px solid var(--outline-variant); color: var(--on-surface-variant); white-space: nowrap; }
.chip-sos { background: var(--error); border-color: var(--error); color: var(--on-error); }
.chip-overdue { background: color-mix(in srgb, var(--attention) 14%, var(--surface)); border-color: var(--attention); color: var(--attention); }
.chip-live { background: color-mix(in srgb, var(--live) 12%, var(--surface)); border-color: var(--live); color: var(--live); }

/* Shared-outing panel: docked right on a wide screen, a bottom sheet on a phone. */
.panel { position: absolute; z-index: 8; background: var(--surface); box-shadow: var(--elevation-3); display: flex; flex-direction: column; }
.watched-panel { top: calc(var(--fab) + 2 * var(--gutter)); right: calc(var(--fab) + 2 * var(--gutter)); bottom: var(--gutter);
  width: var(--panel-width); border-radius: 16px; overflow: hidden; }
.panel-header { display: flex; align-items: flex-start; gap: 4px; padding: 16px 8px 8px 16px; border-bottom: 1px solid var(--outline-variant); }
.panel-title { flex: 1; min-width: 0; }
.panel-name { overflow-wrap: anywhere; }
.subtitle-sos { color: var(--error); font-weight: 500; }
.subtitle-overdue { color: var(--attention); font-weight: 500; }
.panel-body { overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.panel-section { display: flex; flex-direction: column; gap: 6px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact-label, .fact-heading { font-size: 11px !important; font-weight: 500 !important; text-transform: uppercase; letter-spacing: .8px !important;
  color: var(--on-surface-variant); }
.fact-value { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.track-windows { display: flex; flex-wrap: wrap; gap: 4px; }
.contact-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) {
  .watched-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-radius: 16px 16px 0 0; }
  .map-shell.has-panel .map-rail { display: none; }
}

/* Chat (mobile outing_chat_sheet: log-style, grouped by sender within a minute) */
.chat { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--outline-variant); padding-top: 12px; }
.chat-log { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.chat-older { align-self: center; }
.chat-empty { padding: 8px 0; }
.chat-message { align-self: flex-start; max-width: 85%; }
.chat-mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 12px; color: var(--on-surface-variant); margin: 6px 4px 2px; display: flex; gap: 8px; }
.chat-mine .chat-meta { justify-content: flex-end; }
.chat-sender { font-weight: 500; color: var(--on-surface); }
.chat-body { display: inline-block; padding: 8px 12px; border-radius: 16px; background: var(--surface-container);
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.chat-mine .chat-body { background: var(--primary-container); color: var(--on-primary-container); }
.chat-pending .chat-body { opacity: .7; }
.chat-failed { font-size: 12px; color: var(--error); display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.chat-system { align-self: center; font-size: 12px; font-style: italic; color: var(--on-surface-variant); text-align: center; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; }
.chat-composer .mud-input-control { flex: 1; }

/* Detail pages with a map (my outing, GPX library) */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 24px; align-items: start; }
.detail-grid.list-first { grid-template-columns: minmax(320px, 480px) minmax(0, 1fr); }
.upload-action, .upload-action .mud-input-control { margin: 0 !important; }
.detail-map { position: sticky; top: 88px; height: calc(100vh - 136px); min-height: 360px; }
.map-rounded { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--outline-variant); }
.detail-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.participant-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.participant-email { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .detail-grid, .detail-grid.list-first { grid-template-columns: 1fr; }
  .detail-map { position: relative; top: 0; height: 50vh; }
}

/* GPX library rows */
.gpx-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--outline-variant); }
.gpx-row:last-child { border-bottom: 0; }
.gpx-text { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; align-items: flex-start; background: none; border: 0; padding: 4px 0; font: inherit; color: inherit; cursor: pointer; }
.colour-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--outline); cursor: pointer; padding: 0; }
.colour-swatch.selected { box-shadow: 0 0 0 3px var(--on-surface); }
.palette { display: grid; grid-template-columns: repeat(3, 24px); gap: 12px; padding: 12px; }
