:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-raised: #0b1728;
  --surface: rgba(15, 29, 49, 0.72);
  --surface-strong: rgba(18, 35, 58, 0.92);
  --surface-soft: rgba(148, 163, 184, 0.08);
  --border: rgba(203, 213, 225, 0.16);
  --border-strong: rgba(251, 146, 60, 0.5);
  --text: #f8fafc;
  --text-muted: #a9b8cc;
  --text-subtle: #71829a;
  --accent: #fb923c;
  --accent-strong: #f97316;
  --accent-soft: rgba(251, 146, 60, 0.15);
  --success: #4ade80;
  --warning: #facc15;
  --danger: #fb7185;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 22px 70px rgba(0, 0, 0, 0.36);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --topbar-height: 72px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-raised: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(194, 65, 12, 0.48);
  --text: #172033;
  --text-muted: #52627a;
  --text-subtle: #6b7a90;
  --accent: #c2410c;
  --accent-strong: #ea580c;
  --accent-soft: rgba(194, 65, 12, 0.1);
  --success: #15803d;
  --warning: #a16207;
  --danger: #be123c;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(251, 146, 60, .12), transparent 34rem),
    radial-gradient(circle at 92% 76%, rgba(14, 165, 233, .1), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .005em;
  overflow-x: hidden;
}

body, button, input, select, textarea { color: var(--text); }

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.bg-video { opacity: .13; filter: saturate(.7) contrast(1.1); }

.sidebar,
.right-sidebar,
.profile-panel,
.fieldrecorder-sidebar,
.modal-content,
.welcome-panel,
.georadio-panel,
.georadio-card,
#tourTooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.sidebar {
  width: 286px;
  padding: 22px 18px 32px;
  background: var(--surface);
  border-width: 0 1px 0 0;
  transition: transform .35s var(--ease), background .25s ease;
}

.logo { max-width: 170px; height: auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); }

.main-content {
  margin-left: 286px;
  margin-right: 322px;
  padding: calc(var(--topbar-height) + 22px) 30px 116px;
  background: transparent;
  transition: margin .35s var(--ease), padding .25s ease;
}

.top-bar {
  left: 286px;
  right: 322px;
  height: var(--topbar-height);
  padding: 0 24px;
  background: linear-gradient(to bottom, rgba(7,17,31,.88), transparent);
  pointer-events: none;
}

html[data-theme="light"] .top-bar { background: linear-gradient(to bottom, rgba(238,243,248,.9), transparent); }

.profile-icon,
.theme-toggle,
.mobile-menu-btn,
.sidebar-toggle-btn,
#openSidebarBtn,
.close,
.close-profile,
.close-welcome {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.profile-icon:hover,
.theme-toggle:hover,
.mobile-menu-btn:hover,
.sidebar-toggle-btn:hover,
#openSidebarBtn:hover,
.close:hover,
.close-profile:hover,
.close-welcome:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--accent-soft); }

.profile-icon { width: 40px; height: 40px; color: var(--accent); }

.theme-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  margin-right: 10px;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  font-size: 15px;
  line-height: 1;
}

.profile-panel {
  top: calc(var(--topbar-height) - 2px);
  right: 22px;
  width: min(300px, calc(100vw - 32px));
  padding: 20px;
  border-radius: var(--radius-md);
  z-index: 40;
}

.profile-panel h3,
.right-sidebar h3,
.fieldrecorder-header h3 { color: var(--text); }

.right-sidebar {
  top: 18px;
  right: 18px;
  width: 290px;
  height: calc(100vh - 36px);
  padding: 20px;
  border-radius: var(--radius-lg);
  overflow-x: hidden;
  transition: transform .35s var(--ease), opacity .35s ease;
}

.right-sidebar h3 { margin: 20px 0 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.right-sidebar small { color: var(--text-muted); line-height: 1.45; }
.ai-badge { color: var(--accent); letter-spacing: .08em; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.ai-section { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); }

button,
input,
select,
textarea { font: inherit; }

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1b120a;
  font-weight: 750;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s ease, filter .2s ease, background .2s ease;
}

button[onclick="openFieldRecorderFromModal()"] { color: #f8fafc; }

button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(249,115,22,.2); filter: saturate(1.1); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { cursor: not-allowed; opacity: .48; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible {
  outline: 3px solid rgba(56, 189, 248, .72);
  outline-offset: 3px;
}

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, .28);
  color: var(--text);
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: rgba(255,255,255,.82); }

html[data-theme="light"] .calendar-weekdays span,
html[data-theme="light"] .calendar-day-number,
html[data-theme="light"] .challenge p,
html[data-theme="light"] .challenge small,
html[data-theme="light"] .profile-panel label,
html[data-theme="light"] .fieldrecorder-body,
html[data-theme="light"] .ai-status,
html[data-theme="light"] .georadio-info,
html[data-theme="light"] .georadio-marquee,
html[data-theme="light"] .bottom-nav button {
  color: var(--text-muted) !important;
}

html[data-theme="light"] .calendar-day,
html[data-theme="light"] .tracker-day { color: var(--text); }
html[data-theme="light"] .georadio-dropup select { color: var(--text); }
html[data-theme="light"] .georadio-dropup select option { background: #fff; color: var(--text); }

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { min-height: 180px; resize: vertical; line-height: 1.6; }

#progress,
#completedDaysIndicator,
.challenge,
.calendar-month,
.tracker-day,
.example-box,
.learning-objectives,
.completion-requirements,
.input-section,
.fc-meta,
.ar-meta,
.ai-course-option {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

#progress { margin-top: 22px; padding: 16px; color: var(--text-muted); }
#progress span, #completedDaysIndicator span { color: var(--accent); font-weight: 800; }
#completedDaysIndicator { padding: 12px; color: var(--text-muted); font-size: 12px; }

.challenge {
  position: relative;
  margin: 9px 0;
  padding: 13px 14px 13px 18px;
  color: var(--text-muted);
  overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s ease, background .2s ease;
}
.challenge::before { background: var(--accent); width: 3px; }
.challenge:hover { transform: translateX(3px); border-color: var(--border-strong); background: var(--accent-soft); }
.challenge h2 { color: var(--text); font-size: 13px; line-height: 1.35; }
.challenge .status-label { color: var(--text-subtle); }
.challenge.completed { background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .28); }
.challenge.completed .status-label { color: var(--success); }

.calendar-header { margin-bottom: 20px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.calendar-header span:first-child { color: var(--text); font-size: 20px; font-weight: 800; }
.calendar-header span:last-child { color: var(--text-muted); }
.calendar-grid { gap: 16px; }
.calendar-month { padding: 14px; }
.calendar-month h3 { color: var(--accent); }
.calendar-day { border-radius: 8px; border-color: var(--border); background: rgba(148,163,184,.04); }
.calendar-day:hover { border-color: var(--accent); }
.calendar-day.today { border: 2px solid var(--accent); }

.modal { background: rgba(2, 6, 23, .78); backdrop-filter: blur(8px); }
.modal-content { width: min(760px, calc(100vw - 32px)); margin: 5vh auto; padding: 28px; border-radius: var(--radius-lg); }
.modal-content h2 { color: var(--text); font-size: clamp(20px, 3vw, 30px); line-height: 1.15; }
.modal-hero { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.close { top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; padding: 0; line-height: 1; }
.welcome-panel-backdrop { background: rgba(2,6,23,.76); backdrop-filter: blur(12px); }
.welcome-panel { width: min(520px, calc(100vw - 32px)); padding: 30px; border-radius: var(--radius-lg); }
.welcome-panel h1 { color: var(--text); font-size: clamp(24px, 4vw, 34px); line-height: 1.05; }
.welcome-panel p, .welcome-panel li { color: var(--text-muted); }

.welcome-section {
  width: 100%;
  min-height: calc(100vh - var(--topbar-height) - 138px);
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 56px);
}
.welcome-section[hidden] { display: none !important; }
body.initial-welcome-visible #calendarView { display: none; }
.welcome-card {
  width: min(900px, 100%);
  padding: clamp(24px, 4vw, 46px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(251, 146, 60, .1), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.welcome-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.welcome-eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .13em;
}
.welcome-dismiss {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}
.welcome-card h1 {
  max-width: 720px;
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4.2vw, 52px);
  line-height: 1.05;
  letter-spacing: -.035em;
}
.welcome-intro {
  max-width: 750px;
  margin: 16px 0 26px;
  color: var(--text-muted);
  font-size: clamp(14px, 1.7vw, 18px);
}
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.welcome-step {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.welcome-step > span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}
.welcome-step strong,
.welcome-step small { display: block; }
.welcome-step strong { color: var(--text); font-size: 14px; }
.welcome-step small { margin-top: 5px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.welcome-tools {
  margin: 0 0 24px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-size: 13px;
}
.welcome-tools strong { color: var(--text); }
.welcome-action { width: auto; min-width: 220px; padding: 11px 20px; }

@media (max-width: 760px) {
  .welcome-section { min-height: calc(100vh - 126px); padding: 10px 0 28px; place-items: start stretch; }
  .welcome-card { border-radius: var(--radius-md); }
  .welcome-steps { grid-template-columns: 1fr; }
  .welcome-step { padding: 13px; }
  .welcome-action { width: 100%; }
}

.fieldrecorder-sidebar { width: min(360px, 100vw); padding: 20px; }
.fieldrecorder-toggle-tab, .ai-sidebar-toggle-tab, .georadio-toggle-tab { border-color: var(--border); background: var(--surface-strong); color: var(--text-muted); box-shadow: var(--shadow-sm); }
.fieldrecorder-tab { min-height: 40px; padding: 10px; color: var(--text-muted); }
.fieldrecorder-tab.active { color: var(--accent); border-color: var(--accent); }
.fc-video-container { min-height: 220px; border: 1px solid var(--border); }
.fc-photo-preview { display: grid; gap: 10px; margin-top: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.fc-photo-preview[hidden] { display: none; }
.fc-photo-preview img { width: 100%; max-height: 220px; object-fit: contain; border-radius: 10px; }
.fc-btn, .ar-btn, .georadio-btn, .georadio-thumbnail-btn { border-color: var(--border); background: var(--surface-soft); color: var(--text); }
.fc-btn:hover:not(:disabled), .ar-btn:hover:not(:disabled), .georadio-btn:hover:not(:disabled), .georadio-thumbnail-btn:hover:not(:disabled) { background: var(--accent-soft); }
.evidence-label { margin: 14px 0 6px; color: var(--text-muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.draft-button { background: var(--surface-soft); border-color: var(--border); color: var(--text-muted); }

.georadio-footer { display: none; left: 18px; right: 18px; bottom: 18px; }
.georadio-footer.is-visible { display: flex; }
.georadio-dropup { border-color: var(--border); background: var(--surface-strong); box-shadow: var(--shadow-sm); }
.georadio-panel { bottom: 92px; border-radius: var(--radius-lg); }
.georadio-modal { background: rgba(2,6,23,.78); backdrop-filter: blur(8px); }

#tourOverlay { background: rgba(2,6,23,.74); backdrop-filter: blur(8px); }
#tourTooltip { border-radius: var(--radius-md); }

body.sidebar-collapsed .main-content { margin-left: 0; }
body.ai-sidebar-collapsed .main-content { margin-right: 0; }

@media (max-width: 1100px) {
  .right-sidebar { width: 270px; }
  .main-content { margin-right: 300px; }
  .top-bar { right: 300px; }
}

@media (max-width: 768px) {
  :root { --topbar-height: 58px; }
  .bg-video { display: none; }
  .sidebar { width: min(300px, 84vw); height: 100dvh; max-height: 100dvh; padding: 64px 14px 72px; border-radius: 0 20px 20px 0; background: var(--surface-strong); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .sidebar .logo { max-width: 104px; margin: 0 auto; }
  .sidebar.open .logo { max-width: 104px; }
  .sidebar #sidebarState { display: none; }
  .main-content { margin: 0; padding: calc(var(--topbar-height) + 18px) 14px 96px; }
  .top-bar { left: 0; right: 0; padding: 0 14px; background: var(--surface-strong); border-bottom: 1px solid var(--border); }
  .top-logo { height: 30px; }
  .profile-icon { width: 34px; height: 34px; }
  .mobile-menu-btn { order: 0; width: 32px; min-height: 32px; margin: 0 5px 0 0; padding: 0; border: 0 !important; border-radius: 50%; background: transparent !important; color: #f7b733; text-shadow: 0 2px 8px rgba(247,183,51,.75); box-shadow: none !important; }
  .top-logo { order: 1; margin-left: 0; margin-right: auto; max-width: 92px; }
  .top-bar .mobile-state-select { order: 2; width: min(122px, 31vw); min-height: 32px; margin: 0 5px 0 4px; padding: 4px 22px 4px 8px; border: 1px solid rgba(247,183,51,.48); border-radius: 999px; background: rgba(247,183,51,.1); color: var(--text); font-size: 11px; }
  .top-bar .mobile-state-select[hidden] { display: none; }
  .top-bar .theme-toggle { order: 3; }
  .top-bar .profile-icon { order: 4; }
  .theme-toggle { width: 28px; min-width: 28px; height: 28px; margin-right: 6px; padding: 0; border-radius: 50%; font-size: 14px; line-height: 1; }
  .right-sidebar { display: none; }
  .fieldrecorder-sidebar { display: block; width: 100%; height: min(82dvh, 720px); max-height: calc(100dvh - 16px); top: auto; bottom: 0; padding: 68px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .35s var(--ease); }
  .fieldrecorder-sidebar.open { transform: translateY(0); }
  .fieldrecorder-sidebar.fullscreen { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .fieldrecorder-toggle-tab { display: flex; bottom: 42px; top: auto; transform: none; }
  .modal-content { margin: 3vh auto; padding: 22px 16px; }
  .modal-content h2 { padding-right: 30px; }
  .welcome-panel { padding: 24px 20px; }
  .bottom-nav { height: calc(32px + env(safe-area-inset-bottom)); min-height: 32px; padding-bottom: env(safe-area-inset-bottom); background: var(--surface-strong); border-color: var(--border); }
  .bottom-nav button { min-height: 32px; height: 32px; padding: 0; color: var(--text-muted); font-size: 11px; line-height: 1; }
  .bottom-nav button.active { background: var(--accent); color: #1b120a; }
  .georadio-footer { left: 8px; right: 8px; bottom: 42px; }
  .georadio-panel { bottom: 82px; }
  .georadio-dropup { max-width: calc(100vw - 16px); }
  .georadio-dropup select { min-width: 0; }
}

/* Native toolbar / workspace integration */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sidebar { z-index: 12; }
.sidebar > .sidebar-toggle-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}
.native-tab-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;
  margin: 14px 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(2, 6, 23, .26);
}
.native-tab {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: none;
}
.native-tab:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; background: var(--surface-soft); }
.native-tab.active { border-color: rgba(251, 146, 60, .45); background: var(--accent-soft); color: var(--text); }
.native-tab-icon { color: var(--accent); font-size: 17px; line-height: 1; }
.native-tab-kicker { margin: 0 2px 9px; color: var(--text-subtle); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.native-tab-panel[hidden] { display: none !important; }
.native-tab-panel.active { display: block; }
.native-tab-panel button { width: 100%; }

.map-sidebar-intro,
.tools-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text);
}
.map-sidebar-intro { justify-content: flex-start; }
.map-sidebar-intro strong,
.tools-panel-heading strong { display: block; font-size: 14px; }
.map-sidebar-intro small,
.tools-panel-heading small { display: block; margin-top: 1px; color: var(--text-muted); font-size: 11px; }
.map-status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(74, 222, 128, .12); }
.map-layer-list { display: grid; gap: 5px; }
.map-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.map-layer-row:hover { border-color: var(--border); background: var(--surface-soft); color: var(--text); }
.map-layer-row input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.layer-swatch { width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-soft); }
.contour-swatch { background: repeating-linear-gradient(18deg, transparent 0 4px, #f97316 4px 5px, transparent 5px 8px); }
.satellite-swatch { background: linear-gradient(135deg, #315d4b, #76925b 48%, #355b73); }
.topo-swatch { background: repeating-linear-gradient(135deg, #967c56 0 2px, #c5a875 2px 4px); }
.property-swatch { background: linear-gradient(45deg, transparent 42%, #facc15 43% 51%, transparent 52%); }
.point-swatch { background: radial-gradient(circle, #fb923c 0 3px, transparent 4px); }
.utility-swatch { background: repeating-linear-gradient(90deg, transparent 0 4px, #38bdf8 4px 6px); }
.lidar-swatch { background: radial-gradient(circle at 25% 35%, #4ade80 0 1px, transparent 2px), radial-gradient(circle at 70% 65%, #a78bfa 0 1px, transparent 2px), #293449; }
.flood-swatch { background: #2563eb80; }
.zoning-swatch { background: #a855f780; }
.map-sidebar-divider { height: 1px; margin: 14px 0; background: var(--border); }
.map-tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.map-tool-button {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
  text-align: left;
}
.map-tool-button span { color: var(--accent); font-size: 16px; line-height: 1; }
.map-tool-button:hover:not(:disabled), .map-tool-button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.map-coordinate-card { margin-top: 16px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .2); color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.map-coordinate-card span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.mini-tracker {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}
.mini-tracker-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.mini-tracker-heading strong { color: var(--text); font-size: 11px; }
.mini-tracker-heading span { color: var(--accent); font-size: 10px; font-weight: 850; }
.mini-tracker-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.mini-tracker-day {
  display: grid;
  width: auto !important;
  min-width: 0;
  min-height: 27px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(148, 163, 184, .06);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  box-shadow: none;
}
.mini-tracker-day:hover:not(:disabled) { transform: translateY(-1px); box-shadow: none; }
.mini-tracker-day.completed { border-color: rgba(74, 222, 128, .55); background: rgba(74, 222, 128, .14); color: var(--success); }
.mini-tracker-day.next-day { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 2px rgba(251, 146, 60, .12); }
.tools-count { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.tool-card-grid { display: grid; gap: 9px; }
.tool-card {
  display: grid;
  grid-template-columns: 48px 1fr 18px;
  align-items: center;
  gap: 9px;
  min-height: 70px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}
.tool-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--border-strong); background: var(--accent-soft); }
.tool-card-art { display: grid; width: 48px; height: 52px; align-content: center; justify-items: center; border-radius: 8px; color: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.tool-card-art span { font-size: 15px; font-weight: 950; line-height: 1; }
.tool-card-art i { margin-top: 4px; font-size: 7px; font-style: normal; letter-spacing: .08em; opacity: .75; }
.tool-art-pincushion { background: linear-gradient(135deg, #f97316, #7c2d12); }
.tool-art-calculator { background: linear-gradient(135deg, #2563eb, #172554); }
.tool-art-pls { background: linear-gradient(135deg, #a855f7, #4c1d95); }
.tool-art-wtf { background: linear-gradient(135deg, #22c55e, #064e3b); }
.tool-card-copy { min-width: 0; }
.tool-card-copy strong, .tool-card-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card-copy strong { font-size: 12px; }
.tool-card-copy small { margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.tool-card-arrow { color: var(--accent); font-size: 18px; }

.native-workspace { position: fixed; inset: 0; margin-left: 286px; z-index: 1; overflow: hidden; background: #0b1728; }
.native-workspace[hidden] { display: none !important; }
.map-workspace { position: relative; width: 100%; height: 100%; overflow: hidden; background: #203546; }
.map-workspace[hidden], .tool-embed-workspace[hidden] { display: none !important; }
.native-map { position: absolute; inset: 0; z-index: 0; background: #3b5564; }
.native-map .leaflet-tile { filter: saturate(.78) contrast(1.02) brightness(.82); }
.native-map .leaflet-control-zoom { margin: 86px 15px 0 0; border: 0; box-shadow: var(--shadow-sm); }
.native-map .leaflet-control-zoom a { width: 34px; height: 34px; line-height: 32px; border: 1px solid rgba(255,255,255,.16); background: rgba(9, 26, 43, .82); color: white; }
.native-map .leaflet-control-attribution { background: rgba(9, 26, 43, .68); color: rgba(255,255,255,.7); }
.native-map .leaflet-control-attribution a { color: #fbbf24; }
.map-toolbar { position: absolute; inset: 0 0 auto 0; z-index: 5; display: flex; gap: 8px; align-items: center; min-height: 62px; padding: 9px 14px; background: linear-gradient(180deg, rgba(7, 23, 39, .97), rgba(7, 23, 39, .79)); border-bottom: 1px solid rgba(255,255,255,.12); overflow-x: auto; }
.map-toolbar-button { display: inline-flex; width: auto !important; min-width: max-content; min-height: 40px; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid rgba(148, 163, 184, .14); border-radius: 8px; background: rgba(65, 91, 114, .58); color: #f8fafc; font-size: 12px; }
.map-toolbar-button span { color: #fb923c; font-size: 17px; line-height: 1; }
.map-toolbar-button:hover:not(:disabled) { transform: translateY(-1px); background: rgba(79, 108, 133, .82); box-shadow: none; filter: none; }
.map-toolbar-primary { background: rgba(76, 108, 137, .75); }
.map-top-readout { position: absolute; z-index: 5; top: 76px; left: 50%; display: flex; align-items: center; gap: 7px; padding: 9px 11px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(9, 26, 43, .82); box-shadow: var(--shadow-sm); color: #dbeafe; }
.map-top-readout span { color: #dbeafe; font-size: 12px; }
.map-top-readout input { width: 86px; min-height: 32px; padding: 4px 7px; border-radius: 5px; background: rgba(248,250,252,.96); color: #172033; }
.map-mini-button { display: grid; width: 32px !important; min-width: 32px; min-height: 32px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; background: rgba(65, 91, 114, .75); color: white; }
.map-mini-button:hover:not(:disabled) { box-shadow: none; filter: none; transform: none; background: var(--accent); }
.map-floating-layers { position: absolute; top: 82px; right: 18px; z-index: 4; width: 242px; padding: 17px; border: 1px solid rgba(255,255,255,.13); border-radius: 10px; background: rgba(13, 35, 57, .86); box-shadow: var(--shadow-lg); color: white; }
.floating-panel-title { display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 850; }
.live-pill { display: inline-flex; align-items: center; gap: 4px; color: #86efac; font-size: 9px; letter-spacing: .1em; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }
#mapFloatingLayerSummary { margin: 5px 0 10px; color: #a9b8cc; font-size: 11px; }
.floating-layer-toggle { display: flex; width: auto !important; min-height: 30px; align-items: center; gap: 7px; padding: 5px 8px; background: rgba(255,255,255,.08); color: #cbd5e1; font-size: 10px; }
.floating-layer-toggle:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; }
.floating-layer-toggle span { color: var(--accent); }
.map-floating-tools { position: absolute; left: 16px; bottom: 50px; z-index: 4; display: grid; gap: 7px; width: 125px; padding: 9px; border-radius: 9px; background: rgba(13, 35, 57, .86); box-shadow: var(--shadow-lg); }
.map-floating-tools button { display: flex; width: 100% !important; min-height: 38px; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid rgba(255,255,255,.05); border-radius: 6px; background: rgba(65,91,114,.58); color: white; font-size: 11px; text-align: left; }
.map-floating-tools button:hover:not(:disabled), .map-floating-tools button.is-active { transform: none; box-shadow: none; filter: none; background: rgba(251,146,60,.25); }
.map-floating-tools button span { width: 18px; color: #fbbf24; font-size: 16px; text-align: center; }
.map-location-card { position: absolute; right: 30px; bottom: 32px; z-index: 4; display: grid; gap: 1px; min-width: 208px; padding: 12px 16px; border-radius: 8px; background: rgba(13, 35, 57, .84); box-shadow: var(--shadow-lg); color: white; }
.location-card-label { margin-bottom: 3px; color: #fbbf24; font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.map-location-card strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.map-location-card small { margin-top: 5px; color: #a9b8cc; font-size: 10px; }
.map-crs-control { position: absolute; left: 16px; bottom: 10px; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; background: rgba(13, 35, 57, .86); color: #cbd5e1; font-size: 10px; }
.map-crs-control select { min-height: 30px; padding: 4px 24px 4px 7px; border-radius: 5px; background: #f8fafc; color: #172033; font-size: 11px; }
.map-status-toast { position: absolute; left: 50%; bottom: 18px; z-index: 6; max-width: min(460px, 70vw); padding: 9px 13px; transform: translate(-50%, 20px); border: 1px solid rgba(251,146,60,.45); border-radius: 999px; background: rgba(13,35,57,.94); color: #fed7aa; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.map-status-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.tool-embed-workspace { display: flex; width: 100%; height: 100%; flex-direction: column; background: #07111f; }
.tool-embed-bar { display: flex; min-height: 62px; align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--border); background: rgba(7,17,31,.96); color: var(--text); }
.tool-embed-bar > div { min-width: 0; flex: 1; }
.tool-embed-bar strong, .tool-embed-bar small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-embed-bar small { margin-top: 2px; color: var(--text-muted); font-size: 10px; }
.tool-embed-back { display: inline-flex; width: auto !important; min-height: 36px; align-items: center; gap: 6px; padding: 6px 11px; background: var(--accent-soft); color: var(--text); }
.tool-embed-back:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; }
.tool-embed-back span { color: var(--accent); font-size: 18px; }
.tool-embed-bar a { color: var(--accent); font-size: 11px; white-space: nowrap; }
#toolEmbedFrame { width: 100%; height: 100%; flex: 1; border: 0; background: white; }

/* Challenge progress states */
.challenge { overflow: visible; }
.challenge::after { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; opacity: 0; pointer-events: none; transition: opacity .2s ease, box-shadow .2s ease; }
.challenge.completed { border-color: rgba(74, 222, 128, .55); background: linear-gradient(135deg, rgba(74,222,128,.14), rgba(74,222,128,.035)); }
.challenge.completed::after { opacity: 1; box-shadow: 0 0 0 1px rgba(74,222,128,.18), 0 10px 28px rgba(34,197,94,.1); }
.challenge.next-day { border-color: rgba(251, 146, 60, .85); background: linear-gradient(135deg, rgba(251,146,60,.2), rgba(251,146,60,.045)); box-shadow: 0 0 0 1px rgba(251,146,60,.12), 0 10px 30px rgba(249,115,22,.13); }
.challenge.next-day::before { width: 4px; background: var(--accent); box-shadow: 0 0 14px rgba(251,146,60,.8); }
.challenge.next-day .status-label { color: var(--accent); font-weight: 850; opacity: 1; }
.day-progress-badge { display: inline-flex; min-height: 21px; align-items: center; padding: 3px 7px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-subtle); font-size: 9px; font-weight: 900; letter-spacing: .12em; line-height: 1; }
.day-progress-badge.is-complete { border-color: rgba(74,222,128,.42); background: rgba(74,222,128,.12); color: var(--success); }
.day-progress-badge.is-next { border-color: rgba(251,146,60,.5); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 12px rgba(251,146,60,.12); }
.day-progress-badge.is-open { background: rgba(148,163,184,.05); }
.tracker-day { display: grid; min-height: 76px; place-items: center; align-content: center; gap: 4px; }
.tracker-day-number { font-size: 18px; line-height: 1; }
.tracker-day-badge { color: var(--text-subtle); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tracker-day.completed { border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.14); box-shadow: 0 0 0 1px rgba(74,222,128,.1); }
.tracker-day.completed .tracker-day-badge { color: var(--success); }
.tracker-day.next-day { border-color: rgba(251,146,60,.9); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(251,146,60,.15), 0 8px 20px rgba(249,115,22,.15); }
.tracker-day.next-day .tracker-day-badge { color: var(--accent); }
body.native-map-mode .main-content,
body.native-embed-mode .main-content { display: none; }
body.native-map-mode .right-sidebar,
body.native-embed-mode .right-sidebar,
body.native-map-mode #aiSidebarToggleTab,
body.native-embed-mode #aiSidebarToggleTab,
body.native-map-mode #fieldRecorderToggleTab,
body.native-embed-mode #fieldRecorderToggleTab,
body.native-map-mode #georadioToggleTab,
body.native-embed-mode #georadioToggleTab,
body.native-map-mode #bottomNav,
body.native-embed-mode #bottomNav { display: none !important; }
body.native-map-mode .top-bar,
body.native-embed-mode .top-bar { left: 286px; right: 0; z-index: 14; }
body.native-map-mode .native-workspace,
body.native-embed-mode .native-workspace { display: block; }
body.native-embed-mode .native-workspace { margin-left: 0; }
body.native-embed-mode.sidebar-collapsed .top-bar { left: 0; }
body.native-map-mode .sidebar { transform: none; }
body.native-embed-mode .sidebar-collapsed .sidebar { transform: translateX(-100%); }

@media (max-width: 900px) {
  .map-toolbar { padding-right: 8px; }
  .map-toolbar-button { padding-inline: 10px; }
  .map-floating-layers { width: 210px; }
}
@media (max-width: 768px) {
  .native-workspace { inset: 58px 0 44px; margin-left: 0; }
  body.native-map-mode .top-bar, body.native-embed-mode .top-bar { left: 0; right: 0; }
  body.native-map-mode .sidebar { transform: translateX(-100%); }
  body.native-map-mode .sidebar.open { transform: translateX(0); }
  body.native-embed-mode .sidebar { transform: translateX(-100%); }
  body.native-embed-mode .sidebar.open { transform: translateX(0); }
  .map-toolbar { min-height: 52px; padding: 6px 8px; gap: 5px; }
  .map-toolbar-button { min-height: 35px; padding: 6px 9px; font-size: 10px; }
  .map-toolbar-button:nth-child(n+5) { display: none; }
  .map-top-readout { top: 62px; left: 14px; transform: none; }
  .map-floating-layers { top: 62px; right: 8px; width: 160px; padding: 11px; }
  .map-floating-layers .floating-panel-title { font-size: 14px; }
  .map-floating-tools { left: 8px; bottom: 46px; width: 112px; padding: 6px; gap: 4px; }
  .map-floating-tools button { min-height: 32px; font-size: 10px; }
  .map-floating-tools button:nth-child(n+5) { display: none; }
  .map-location-card { right: 8px; bottom: 8px; min-width: 164px; padding: 9px 11px; }
  .map-crs-control { left: 8px; bottom: 8px; }
  .map-status-toast { bottom: 12px; max-width: 62vw; }
  .tool-embed-bar { min-height: 54px; padding: 7px 10px; gap: 8px; }
  .tool-embed-bar a { display: none; }
  .tool-embed-back { min-height: 34px; padding: 5px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .sidebar, .right-sidebar, .profile-panel, .fieldrecorder-sidebar, .modal-content, .welcome-panel, .georadio-panel, .georadio-card, #tourTooltip { background: var(--surface-strong); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Federated LSU toolbar — scoped from the source toolbar project so it can
   live above every workspace without changing legacy feature controls. */
:root { --toolbar-height: 46px; }
.top-bar {
  left: 0 !important;
  right: 0 !important;
  top: 0;
  height: var(--toolbar-height);
  padding: 0;
  z-index: 1000;
  pointer-events: auto;
  background: #0f1419;
  border-bottom: 1px solid rgba(255,255,255,.1);
  backdrop-filter: none;
}
.lsu-toolbar { display: flex; width: 100%; height: 100%; align-items: center; gap: 7px; padding: 0 8px; color: #fff; background: linear-gradient(to right, #0f1419, #1a202c); font-size: 13px; }
.toolbar-left, .toolbar-right, .toolbar-center { display: flex; min-width: 0; align-items: center; }
.toolbar-left, .toolbar-right { flex: 0 0 auto; }
.toolbar-center { flex: 1 1 auto; justify-content: center; gap: 10px; }
.toolbar-scroll { display: flex; min-width: 0; align-items: center; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.toolbar-scroll::-webkit-scrollbar { display: none; }
.toolbar-icon { display: grid; width: 30px; height: 30px; min-width: 30px; min-height: 30px; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #fff; opacity: .78; font-size: 13px; box-shadow: none; }
.toolbar-icon:hover:not(:disabled), .toolbar-icon:focus-visible { transform: none; background: rgba(255,255,255,.1); color: #fff; opacity: 1; box-shadow: none; filter: none; }
.toolbar-icon i { font-size: 13px; }
.toolbar-icon.home-btn { width: 30px; min-width: 30px; }
.toolbar-icon.home-btn img { width: 24px; height: 24px; object-fit: contain; }
.toolbar-search { position: relative; display: block; width: min(760px, 100%); min-width: 90px; }
.toolbar-search i { position: absolute; top: 50%; left: 11px; z-index: 1; transform: translateY(-50%); color: #9ca3af; font-size: 13px; pointer-events: none; }
.toolbar-search input { width: 100%; height: 32px; padding: 0 12px 0 33px; border: 1px solid rgba(255,255,255,.04); border-radius: 6px; outline: none; background: rgba(255,255,255,.055); color: #fff; font-size: 14px; }
.toolbar-search input::placeholder { color: #9ca3af; }
.toolbar-search input:focus { border-color: rgba(251,146,60,.58); box-shadow: 0 0 0 3px rgba(251,146,60,.12); }
.toolbar-state-select { width: 132px; min-width: 110px; height: 32px; padding: 0 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; background: rgba(255,255,255,.07); color: #f8fafc; font-size: 11px; }
.toolbar-state-select[hidden] { display: none; }
.toolbar-profile { border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: #1f2937; color: var(--accent); font-weight: 850; }
.toolbar-profile:hover:not(:disabled) { background: #263449; }
.theme-toggle { width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0 1px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #fff; font-size: 14px; }
.theme-toggle:hover:not(:disabled) { transform: none; box-shadow: none; background: rgba(255,255,255,.1); }
.federated-search-results { position: fixed; top: calc(var(--toolbar-height) + 6px); left: 50%; z-index: 1100; width: min(660px, calc(100vw - 24px)); max-height: min(70vh, 540px); overflow-y: auto; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.13); border-radius: 10px; background: rgba(13,24,38,.98); box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.federated-search-results[hidden] { display: none; }
.federated-search-heading { padding: 10px 14px 8px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.federated-result { display: block; width: 100%; min-height: 0; padding: 10px 14px; border: 0; border-top: 1px solid rgba(255,255,255,.07); border-radius: 0; background: transparent; color: #f8fafc; text-align: left; box-shadow: none; }
.federated-result:hover:not(:disabled), .federated-result:focus-visible { transform: none; background: rgba(251,146,60,.12); box-shadow: none; filter: none; }
.federated-result strong, .federated-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.federated-result strong { font-size: 13px; }
.federated-result small { margin-top: 3px; color: #a9b8cc; font-size: 10px; }
.sidebar { padding-top: calc(22px + var(--toolbar-height)); }
body.native-map-mode .top-bar, body.native-embed-mode .top-bar { left: 0 !important; right: 0 !important; }
body.native-map-mode .sidebar, body.native-embed-mode .sidebar { padding-top: calc(22px + var(--toolbar-height)); }

/* Additional tool-card thumbnail treatments */
.tool-art-smarker { background: linear-gradient(135deg, #f59e0b, #78350f); }
.tool-art-earth { background: linear-gradient(135deg, #0ea5e9, #164e63); }
.tool-art-community { background: linear-gradient(135deg, #a855f7, #3b0764); }
.tool-art-checklist { background: linear-gradient(135deg, #14b8a6, #134e4a); }

@media (max-width: 768px) {
  :root { --toolbar-height: 48px; }
  .top-bar { height: var(--toolbar-height); }
  .lsu-toolbar { gap: 2px; padding: 0 4px; }
  .toolbar-left { max-width: 126px; }
  .toolbar-right { max-width: 220px; }
  .toolbar-center { gap: 4px; }
  .toolbar-scroll { gap: 1px; }
  .toolbar-icon { width: 30px; min-width: 30px; height: 32px; min-height: 32px; }
  .toolbar-center .toolbar-search { width: 34px; min-width: 34px; }
  .toolbar-search input { display: none; }
  .toolbar-search { height: 32px; }
  .toolbar-search i { left: 10px; font-size: 15px; color: #fff; }
  .toolbar-state-select { position: absolute; top: calc(var(--toolbar-height) + 6px); right: 6px; width: 126px; min-width: 126px; background: #172236; }
  .sidebar { padding-top: calc(64px + var(--toolbar-height)); }
  body.native-map-mode .sidebar, body.native-embed-mode .sidebar { padding-top: calc(64px + var(--toolbar-height)); }
  .federated-search-results { top: calc(var(--toolbar-height) + 4px); }
}

/* Mobile search sheet and compact icon navigation */
.mobile-search-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 12px; background: rgba(2,6,23,.78); backdrop-filter: blur(12px); }
.mobile-search-modal[hidden] { display: none; }
.mobile-search-sheet { width: min(620px, 100%); margin-top: max(8px, env(safe-area-inset-top)); overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-strong); box-shadow: var(--shadow-lg); }
.mobile-search-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; }
.mobile-search-eyebrow { color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.mobile-search-header h2 { margin: 3px 0 0; color: var(--text); font-size: 22px; line-height: 1.1; }
.mobile-search-close { display: grid; width: 34px !important; min-width: 34px; height: 34px; min-height: 34px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-soft); color: var(--text); font-size: 22px; }
.mobile-search-close:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; background: var(--accent-soft); }
.mobile-search-field { position: relative; display: block; margin: 0 16px 12px; }
.mobile-search-field i { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: var(--accent); pointer-events: none; }
.mobile-search-field input { width: 100%; height: 48px; padding: 0 14px 0 40px; border: 1px solid var(--border-strong); border-radius: 12px; background: rgba(2,6,23,.28); color: var(--text); outline: none; }
.mobile-search-field input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.mobile-search-results { max-height: min(62vh, 520px); overflow-y: auto; padding: 0 4px 8px; }
.mobile-search-results:empty::before { display: block; padding: 16px; color: var(--text-subtle); content: "Search challenges, tools, maps, and resources"; font-size: 12px; text-align: center; }
.mobile-search-results .federated-search-heading { padding-inline: 14px; }
.mobile-search-results .federated-result { border-top-color: var(--border); }

@media (max-width: 768px) {
  .native-workspace { inset: var(--toolbar-height) 0 calc(60px + env(safe-area-inset-bottom)); }
  body.native-map-mode #bottomNav, body.native-embed-mode #bottomNav { display: flex !important; }
  .bottom-nav {
    display: flex !important;
    position: fixed;
    inset: auto 0 0;
    z-index: 1200;
    height: calc(60px + env(safe-area-inset-bottom));
    min-height: 60px;
    align-items: flex-start;
    padding: 4px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: rgba(9, 20, 34, .96);
    backdrop-filter: blur(18px);
  }
  .bottom-nav button {
    position: relative;
    display: grid;
    flex: 1 1 25%;
    width: auto;
    min-width: 0;
    height: 52px;
    min-height: 52px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    box-shadow: none;
  }
  .bottom-nav button:hover:not(:disabled), .bottom-nav button:focus-visible { transform: none; background: var(--surface-soft); color: var(--text); box-shadow: none; filter: none; }
  .bottom-nav button.active { border-color: rgba(251,146,60,.4); background: var(--accent-soft); color: var(--accent); }
  .bottom-nav button i { font-size: 18px; }
  .bottom-nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bottom-nav button::after { position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 4; width: max-content; max-width: 150px; padding: 5px 8px; transform: translate(-50%, 3px); border: 1px solid var(--border); border-radius: 7px; background: #0d1826; color: var(--text); content: attr(data-tooltip); font-size: 10px; font-weight: 800; line-height: 1; opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
  .bottom-nav button:hover::after, .bottom-nav button:focus-visible::after { transform: translate(-50%, 0); opacity: 1; }
  .mobile-search-modal { padding: 8px; }
  .mobile-search-header { padding: 16px 14px 10px; }
  .mobile-search-field { margin-inline: 12px; }
}

/* Calendar: keep the present day visible and make each date easy to tap. */
#calendarView { scroll-margin-top: calc(var(--toolbar-height) + 12px); }
.calendar-month.current-month {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(251, 146, 60, .18), var(--shadow-sm);
}
.calendar-day.today {
  position: relative;
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(251, 146, 60, .12);
}
.calendar-day.today::after {
  position: absolute;
  top: 3px;
  right: 4px;
  color: var(--accent);
  content: "TODAY";
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .06em;
}
.calendar-day.today .calendar-day-number { color: var(--accent); font-weight: 900; }
.calendar-focus-pulse { animation: calendar-focus-pulse .9s ease-out; }
@keyframes calendar-focus-pulse {
  0% { box-shadow: 0 0 0 0 rgba(251, 146, 60, .55); }
  100% { box-shadow: 0 0 0 12px rgba(251, 146, 60, 0); }
}

@media (max-width: 768px) {
  #calendarView {
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom));
  }
  .calendar-header {
    display: block;
    margin-bottom: 12px;
    padding: 14px;
  }
  .calendar-header span { display: block; }
  .calendar-header span:first-child { font-size: 22px; line-height: 1.15; }
  .calendar-header span:last-child { margin-top: 4px; font-size: 12px; }
  .calendar-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .calendar-month {
    padding: 12px;
    border-radius: 14px;
  }
  .calendar-month.current-month { order: -1; }
  .calendar-month h3 { margin-bottom: 9px; font-size: 15px; }
  .calendar-weekdays,
  .calendar-days { gap: 4px; font-size: 11px; }
  .calendar-weekdays { margin-bottom: 4px; }
  .calendar-day {
    min-height: 44px;
    padding: 5px;
    border: 1px solid transparent;
  }
  .calendar-day-number { font-size: 12px; line-height: 1.2; }
  .calendar-day.today::after { top: 4px; right: 5px; font-size: 6px; }
  .calendar-media-thumb { height: 18px; margin-top: 4px; }
  .calendar-media-count { font-size: 9px; }
}
