/* ==========================================================
   Sound Routes visual polish
   A single, final presentation layer that keeps the existing
   earthy identity while making hierarchy and controls clearer.
   ========================================================== */

:root {
  --page: #e8f0f2;
  --surface: #ffffff;
  --surface-soft: #f7fafb;
  --surface-muted: #edf3f5;
  --line: #d6e1e6;
  --line-strong: #b9c9d2;
  --text: #26323b;
  --text-soft: #657481;
  --muted: #8a97a1;
  --shadow: 0 12px 32px rgba(37, 54, 65, .09);
  --shadow-soft: 0 4px 16px rgba(37, 54, 65, .055);
  --shadow-control: 0 2px 5px rgba(37, 54, 65, .06);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --field-radius: 12px;
  --button-radius: 13px;
  --action-size: 36px;
  --action-radius: 10px;
  --action-edit-start: #c79b49;
  --action-edit-end: #a97731;
  --action-delete-start: #ad705f;
  --action-delete-end: #8d554a;
}

html {
  color-scheme: light;
  background: var(--page);
}

body {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .76) 0, rgba(247, 250, 251, .42) 260px, transparent 610px),
    var(--page);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(46, 111, 152, .18);
  color: var(--text);
}

.screen {
  padding-top: clamp(14px, 2.4vw, 24px);
}

/* App banner */
.app-header,
.hero-media {
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
}

.app-header::after,
.hero-media::after {
  background: linear-gradient(90deg, rgba(15, 24, 31, .62), rgba(15, 24, 31, .30) 52%, rgba(15, 24, 31, .16));
}

.app-header-title-main,
.app-header-title-sub,
.app-header-brand p,
.hero-copy h1,
.hero-copy p {
  text-shadow: 0 2px 13px rgba(8, 16, 22, .48);
}

.app-header-title-main {
  line-height: 1.06;
}

.app-header-title-sub {
  line-height: 1.26;
  color: rgba(255, 255, 255, .93);
}

.app-header-version,
.eyebrow,
.section-title,
.panel-title-pill {
  border-color: rgba(188, 204, 214, .78);
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 5px 14px rgba(38, 53, 64, .08);
  letter-spacing: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-header-logo,
.intro-title-logo {
  outline: 1px solid rgba(255, 255, 255, .56);
  box-shadow: 0 12px 28px rgba(12, 24, 31, .23);
}

/* Blue-accented section identifiers stay distinct from body labels. */
.panel-title-pill {
  border-color: #bfd2dd !important;
  background: linear-gradient(180deg, #f5f9fb, #eaf3f7) !important;
  color: #2f6f98 !important;
}

.panel-title-pill .section-heading-icon,
.panel-title-pill svg {
  color: #2f6f98 !important;
  stroke: currentColor !important;
}

#mapFilterPanel .map-search-control > span[data-i18n] {
  color: #326f98 !important;
  font-weight: 750 !important;
}

.app-header-action {
  border: 1px solid rgba(255, 255, 255, .62);
  box-shadow: 0 8px 20px rgba(10, 20, 28, .16);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.app-header-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(10, 20, 28, .21);
}

.app-header-pill-row .group-summary-pill,
.group-summary-pill {
  border: 1px solid rgba(206, 217, 224, .9);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 28px rgba(16, 29, 37, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Main surfaces and tool areas */
.hero-content,
.auth-panel,
.ui-card,
.profile-main-card,
.panel-card,
.settings-panel,
.profile-page-panel {
  border-color: rgba(193, 208, 217, .82);
  background: rgba(255, 255, 255, .965);
  box-shadow: var(--shadow-soft);
}

.auth-panel,
.ui-section-card,
.signup-field-box,
.soundwalk-field-box,
.profile-edit-box,
.profile-description-field,
.password-panel,
.visibility-panel,
.groups-section,
.role-section,
.settings-card,
.settings-section,
.create-group-box {
  border-color: var(--line);
  background: var(--surface-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86);
}

.ui-section-card + .ui-section-card,
.settings-section + .settings-section,
.signup-field-box + .signup-field-box,
.soundwalk-field-box + .soundwalk-field-box {
  margin-top: 14px;
}

.panel-tabs,
.profile-hub-actions,
.app-action-bar,
.settings-profile-hub-actions {
  border: 1px solid rgba(193, 208, 217, .85);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.section-heading,
.settings-section-heading,
.auth-section-heading {
  color: var(--text);
  line-height: 1.25;
}

.section-heading svg,
.settings-section-heading svg,
.auth-section-heading svg,
.label-icon {
  color: var(--accent);
}

/* Fields */
.label-row,
.intro-field-label,
.auth-image-label {
  color: #46535e;
  font-weight: 750;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
select,
textarea {
  border-color: #cedae1;
  background: #fbfdfe;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(37, 54, 65, .025);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):hover,
select:hover,
textarea:hover {
  border-color: #afc2cd;
  background: #fff;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(46, 111, 152, .68);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(46, 111, 152, .105);
}

input::placeholder,
textarea::placeholder {
  color: #97a4ae;
  opacity: 1;
}

input[type="color"] {
  border-color: #cbd8df;
  background: #fff;
  box-shadow: var(--shadow-control);
}

/* Buttons */
.btn-icon,
.ui-button,
button[class*="btn-"] {
  border: 0;
  border-radius: var(--button-radius);
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11);
  letter-spacing: 0;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.btn-icon:hover,
.ui-button:hover,
button[class*="btn-"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(42, 55, 64, .16);
}

.btn-icon:active,
.ui-button:active,
button[class*="btn-"]:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(42, 55, 64, .11);
}

.btn-icon:disabled,
.ui-button:disabled,
button[class*="btn-"]:disabled {
  transform: none;
  box-shadow: none;
  filter: saturate(.55);
}

.app-header-action,
.photo-action-btn,
.preview-history-btn,
.photo-history-btn,
.library-page-btn,
.map-floating-control {
  border-radius: 11px;
}

/* Semantic action system: one size and one color meaning everywhere. */
.recording-action-btn,
.popup-mini-action-btn,
.popup-mini-audio-btn,
.profile-group-edit-btn,
.profile-group-delete-btn {
  width: var(--action-size) !important;
  height: var(--action-size) !important;
  min-width: var(--action-size) !important;
  min-height: var(--action-size) !important;
  max-width: var(--action-size) !important;
  max-height: var(--action-size) !important;
  flex: 0 0 var(--action-size) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--action-radius) !important;
}

.recording-action-btn svg,
.popup-mini-action-btn svg,
.popup-mini-audio-btn svg,
.profile-group-edit-btn svg,
.profile-group-delete-btn svg {
  width: 17px !important;
  height: 17px !important;
}

/* Play/stop share one optical baseline in every text and icon-only action. */
button.recording-action-btn:is(.play, .playing, .stop) > svg[data-sound-routes-icon],
button.popup-mini-audio-btn:is(.play, .stop) > svg[data-sound-routes-icon],
#playAudioBtn > svg[data-sound-routes-icon],
#stopAudioBtn > svg[data-sound-routes-icon] {
  display: block !important;
  position: static !important;
  align-self: center !important;
  justify-self: center !important;
  margin: 0 !important;
  transform: translateY(-1px) !important;
}

.recording-action-btn.edit,
.popup-mini-action-btn.edit,
.profile-title-edit-btn,
.profile-group-edit-btn,
#settingsProfileEditOpenBtn {
  background: linear-gradient(135deg, var(--action-edit-start), var(--action-edit-end)) !important;
  color: #fff !important;
}

.recording-action-btn.report,
.popup-mini-action-btn.report {
  background: linear-gradient(135deg, #4f83a8, #376b90) !important;
  color: #fff !important;
}

.recording-action-btn.report svg,
.popup-mini-action-btn.report svg {
  color: #fff !important;
  stroke: #fff !important;
}

.recording-action-btn.delete,
.popup-mini-action-btn.delete,
.profile-title-delete-btn,
.profile-group-delete-btn,
.preview-history-btn.delete,
.photo-history-btn.delete,
.btn-delete-user,
.btn-delete-all,
#deleteAllArchiveBtn {
  background: linear-gradient(135deg, var(--action-delete-start), var(--action-delete-end)) !important;
  color: #fff !important;
}

.recording-action-btn.edit svg,
.popup-mini-action-btn.edit svg,
.profile-title-edit-btn svg,
.profile-group-edit-btn svg,
#settingsProfileEditOpenBtn svg,
.recording-action-btn.delete svg,
.popup-mini-action-btn.delete svg,
.profile-title-delete-btn svg,
.profile-group-delete-btn svg,
.preview-history-btn.delete svg,
.photo-history-btn.delete svg,
.btn-delete-user svg,
.btn-delete-all svg,
#deleteAllArchiveBtn svg {
  color: #fff !important;
  stroke: #fff !important;
}

.recording-action-btn.locate {
  width: var(--action-size) !important;
  height: var(--action-size) !important;
  min-width: var(--action-size) !important;
  min-height: var(--action-size) !important;
  max-width: var(--action-size) !important;
  max-height: var(--action-size) !important;
  flex-basis: var(--action-size) !important;
  padding: 0 !important;
  border-radius: var(--action-radius) !important;
}

.entry-popup .popup-side-actions {
  gap: 5px !important;
}

.entry-popup .popup-side-actions > :is(.popup-mini-action-btn, .popup-mini-audio-btn),
.route-popup .popup-side-actions > .popup-mini-action-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  flex-basis: 32px !important;
  border-radius: 9px !important;
}

.entry-popup .popup-side-actions svg,
.route-popup .popup-side-actions svg {
  width: 15px !important;
  height: 15px !important;
}

.diagnostic-pill.hidden,
.diagnostic-pill[aria-hidden="true"] {
  display: none !important;
}

.role-picker-row,
.organization-entry-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
}

.role-picker-row > :is(select, input),
.organization-entry-row > :is(select, input) {
  width: 100% !important;
  min-width: 0 !important;
}

/* Choice cards and filters */
.choice-card-inner,
.gender-choice,
.soundmap-toggle,
.library-toggle,
.filter-control {
  border-color: #cfdae1;
  background: #f8fafb;
  box-shadow: 0 3px 9px rgba(38, 53, 64, .035);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.choice-card:hover .choice-card-inner,
.soundmap-toggle:hover,
.library-toggle:hover,
.filter-control:hover {
  border-color: #b7c8d2;
  background: #fff;
  box-shadow: 0 7px 18px rgba(38, 53, 64, .07);
}

.choice-card > input:checked + .choice-card-inner,
.choice-card:has(input:checked) .choice-card-inner,
.choice-card:has(input:checked) .gender-choice {
  border-color: rgba(46, 111, 152, .56);
  background: #edf5f8;
  box-shadow: inset 3px 0 0 rgba(46, 111, 152, .72), 0 8px 20px rgba(46, 111, 152, .105);
}

.choice-icon-button,
.choice-icon,
.toggle-icon {
  border-color: #c6d4dc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(38, 53, 64, .055);
}

.choice-icon-button:hover,
.choice-icon-button:focus-visible {
  background: #f4f8fa;
}

.choice-title {
  color: #34414b;
  font-weight: 800;
}

.choice-info {
  border-color: rgba(46, 111, 152, .20);
  background: #eef5f8;
  color: #5d6d79;
}

/* Repeated content cards */
.profile-overview-card,
.recording-item,
.group-card,
.soundwalk-card,
.profile-group-card,
.profile-soundwalk-card,
.profile-sound-card,
.library-item,
.saved-entry,
.map-popup-card {
  border-color: #d2dde3;
  background: #fbfcfd;
  box-shadow: 0 7px 18px rgba(37, 54, 65, .055);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.recording-item:hover,
.group-card:hover,
.soundwalk-card:hover,
.profile-group-card:hover,
.profile-soundwalk-card:hover,
.profile-sound-card:hover,
.library-item:hover,
.saved-entry:hover {
  border-color: #bccbd4;
  box-shadow: 0 11px 24px rgba(37, 54, 65, .085);
}

.profile-overview-grid > div {
  border: 1px solid #dde6ea;
  background: #f1f6f8;
}

.profile-overview-grid strong,
.profile-overview-description {
  color: #2f3b44;
}

/* Profile subviews sit on the same quiet surface instead of stacking white panels. */
#profileScreen .profile-main-card {
  background: rgba(247, 250, 251, .98) !important;
}

#profileScreen :is(#profileOverview, #profileSoundsPanel) {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#profileSoundsPanel .profile-sounds-list-box {
  background: var(--surface-soft) !important;
}

.diagnostic-pill,
.status-pill,
.member-pill,
.role-pill {
  border: 1px solid #d4dfe5;
  background: #f3f7f9;
  box-shadow: 0 3px 8px rgba(37, 54, 65, .04);
}

/* Image editors and faders */
.ui-image-editor,
.auth-avatar-editor,
.photo-crop-layout {
  border-color: #d6e1e6;
}

.auth-avatar-preview,
.photo-preview,
.ui-image-editor__preview {
  border: 1px solid #cddbe2;
  background: #eef4f6;
  box-shadow: 0 9px 22px rgba(37, 54, 65, .10);
}

.photo-adjust-control {
  border-color: #d5e0e5;
  border-radius: 13px;
  background: #fbfcfd;
  box-shadow: 0 4px 10px rgba(37, 54, 65, .04);
}

.photo-adjust-label {
  color: #3c4852;
}

.photo-adjust-control input[type="range"] {
  height: 24px;
  margin: 0;
}

.photo-adjust-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid #c8d4da;
  border-radius: 999px;
  background: #e6edf0;
}

.photo-adjust-control input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(37, 54, 65, .22);
}

.photo-adjust-control input[type="range"]::-moz-range-track {
  height: 6px;
  border: 1px solid #c8d4da;
  border-radius: 999px;
  background: #e6edf0;
}

.photo-adjust-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(37, 54, 65, .22);
}

button.photo-action-btn,
button.preview-history-btn,
button.btn-upload,
button.photo-history-btn {
  border: 1px solid rgba(255, 255, 255, .32);
  box-shadow: 0 5px 12px rgba(37, 54, 65, .11);
}

/* Four basemaps share the same choice-card family; credits remain readable. */
#settingsScreen .settings-map-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#settingsScreen .settings-map-grid .choice-card:has(input:disabled) .choice-card-inner {
  opacity: .6;
}

.leaflet-control-attribution {
  max-width: min(100%, 480px);
  white-space: normal;
  font: 400 10px/1.4 var(--font) !important;
  color: #25303a;
  background: rgba(255, 255, 255, .94) !important;
}

@media (max-width: 520px) {
  #settingsScreen .settings-map-grid { grid-template-columns: 1fr !important; }
}

/* The same left-hand visualization switch serves live, preview and saved audio. */
.audio-visualization { min-width: 0; }
.audio-visualization-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
:is(#mainScreen, #profileScreen, #adminScreen) .audio-visualization button.audio-visualization-toggle {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 8px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}
button.audio-visualization-toggle[aria-pressed="true"] {
  background: var(--ui-action-settings, #6a607d) !important;
  outline: 2px solid var(--ui-action-settings, #6a607d);
  outline-offset: 1px;
}
:is(#mainScreen, #profileScreen, #adminScreen) .audio-visualization-toggle svg {
  width: 18px !important; height: 18px !important;
  min-width: 18px !important; min-height: 18px !important; flex: none !important;
}
.audio-visualization .recording-mini-wave { margin-top: 0 !important; min-width: 0; height: 96px !important; min-height: 96px !important; box-sizing: border-box; }
.audio-visualization:has(.recording-mini-wave) { margin-top: 8px; }
.audio-spectrogram-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.audio-spectrogram-canvas[hidden], .audio-visualization-caption[hidden] { display: none !important; }
.audio-visualization.is-spectrogram .recording-mini-wave { padding: 0 !important; background: #10162c !important; }
.audio-visualization.is-spectrogram .recording-mini-wave::before,
.audio-visualization.is-spectrogram .recording-mini-wave-bar,
.audio-visualization.is-spectrogram .audio-visualization-empty { display: none !important; }
.audio-visualization.is-spectrogram .recording-mini-wave-progress { opacity: .15; }
.audio-visualization.is-spectrogram .recording-mini-wave-playhead { background: #fff !important; }
.audio-visualization-caption {
  margin: 6px 0 0 44px;
  color: var(--muted, #526470);
  font-size: 11px;
  line-height: 1.5;
}
.audio-visualization-empty { font-size: 11px; color: var(--muted, #526470); position: relative; z-index: 1; }
#recordingPanel #recordingVisualization .player-wave-wrap { height: 180px !important; min-height: 180px !important; }
#recordingPanel #recordingVisualization .waveform-canvas { height: 100% !important; }
#recordingPanel #recordingVisualization.is-spectrogram .player-progress-fill { opacity: .16; }
#recordingPanel #recordingVisualization.is-spectrogram .player-progress { background: #fff !important; }

/* Recorder surface and the two primary audio actions. */
#recordingPanel .recording-toolbox {
  scroll-margin-block-start: 16px;
}

#recordingPanel .recording-toolbox .audio-player {
  border: 1px solid #c4d3da !important;
  background: #edf3f5 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78), 0 7px 18px rgba(37, 54, 65, .06) !important;
}

#recordingPanel .recording-toolbox .player-wave-wrap {
  border: 1px solid #b9cbd4 !important;
  background: #e4ecef !important;
}

#recordingPanel .waveform-canvas {
  background: transparent !important;
}

.recording-mini-wave-progress {
  width: 100% !important;
  transform: scaleX(var(--wave-progress-ratio, 0)) !important;
  transform-origin: left center !important;
  will-change: transform !important;
}

.recording-mini-wave-playhead {
  left: var(--wave-progress-percent, 0%) !important;
  will-change: left !important;
}

#recordingPanel .player-progress,
#recordingPanel .player-progress-fill {
  will-change: left, width !important;
}

#recordingPanel .recording-controls {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(132px, 160px)) !important;
  grid-template-areas: none !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
}

#recordingPanel .recording-controls :is(#startRecBtn, #uploadAudioBtn) {
  grid-area: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 160px !important;
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;
  margin: 0 !important;
  font-size: .74rem !important;
}

#recordingPanel #startRecBtn svg {
  width: 18px !important;
  height: 18px !important;
}

#profileScreen :is(#profileTitleEditBtn, #profileTitleDeleteUserBtn) {
  width: var(--action-size) !important;
  min-width: var(--action-size) !important;
  max-width: var(--action-size) !important;
  height: var(--action-size) !important;
  min-height: var(--action-size) !important;
  max-height: var(--action-size) !important;
  padding: 0 !important;
  border-radius: var(--action-radius) !important;
}

/* Map, lists and pagination */
.map-shell,
.leaflet-container,
.library-list-box,
.profile-list-box,
.saved-filter-panel,
.map-filter-panel {
  border-color: #ccd9df;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
}

.library-pagination,
.pagination-controls {
  border-top-color: #dce5e9;
}

.library-page-btn,
.pagination-controls button {
  border: 1px solid #cbd8df;
  background: #fff;
  color: var(--brand);
  box-shadow: 0 3px 8px rgba(37, 54, 65, .055);
}

.library-page-btn.active,
.pagination-controls button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

/* Settings use the same muted label hierarchy as the rest of the app. */
#settingsScreen :is(.settings-section-heading, .settings-device-label, .settings-visibility-label) {
  color: #465762 !important;
  font-weight: 750 !important;
}

#settingsScreen :is(.settings-intro, .settings-section-note, .choice-info) {
  color: #687985 !important;
  font-size: .82rem !important;
  line-height: 1.42 !important;
}

#settingsScreen .language-choice-card > input:checked + .language-card-inner {
  border: 2px solid var(--toggle-accent, #4f83a8) !important;
  background: var(--language-card-bg, #e8f1f6) !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .72), 0 8px 18px rgba(37, 54, 65, .12) !important;
  transform: translateY(-1px);
}

#settingsScreen .language-choice-card > input:checked + .language-card-inner .language-flag {
  transform: scale(1.08);
  filter: saturate(1.12);
}

/* Messages */
.error-text:not(:empty),
.auth-message:not(:empty),
.status-message:not(:empty),
#recordingStatus:not(.hidden):not(:empty) {
  border-radius: 11px;
  box-shadow: 0 5px 14px rgba(37, 54, 65, .055);
}

.auth-message.auth-message-has-actions:not(:empty) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 0 !important;
  padding: 8px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #4d6473 !important;
  box-shadow: none !important;
}

.auth-message.auth-message-has-actions:not(:empty)::before {
  content: none !important;
}

.auth-message.auth-message-has-actions small {
  flex-basis: 100%;
  text-align: center;
}

.auth-message.auth-message-has-actions :is(a, button) {
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: center;
}

/* Visibility utilities must always win over component layout rules. */
html body .hidden,
html body [hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  :root {
    --control-h: 46px;
    --button-h: 46px;
    --button-radius: 12px;
  }

  body {
    font-size: 14px;
  }

  .screen {
    padding: 10px 8px 34px;
  }

  .hero-content,
  .auth-panel,
  .ui-card,
  .profile-main-card,
  .panel-card,
  .settings-panel {
    margin-top: 12px;
    padding: 14px;
    border-radius: 17px;
  }

  .panel-tabs,
  .profile-hub-actions,
  .app-action-bar,
  .settings-profile-hub-actions {
    border-radius: 15px;
  }

  .ui-section-card,
  .signup-field-box,
  .soundwalk-field-box,
  .profile-edit-box,
  .settings-section,
  .create-group-box {
    padding: 13px;
    border-radius: 13px;
  }

  .choice-card-inner,
  .gender-choice,
  .soundmap-toggle,
  .library-toggle {
    gap: 9px;
    min-height: 58px;
    padding: 10px;
    border-radius: 12px;
  }

  .choice-icon-button,
  .choice-icon,
  .toggle-icon {
    border-radius: 9px;
  }

  .btn-icon,
  .ui-button,
  button[class*="btn-"] {
    font-size: max(.72rem, 11px);
  }

  #recordingPanel .recording-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

}

@media (max-width: 360px) {
  #recordingPanel .card-content,
  #recordingPanel .meta-grid,
  #recordingPanel .meta-grid > *,
  #recordingPanel #coordinatesField,
  #recordingPanel #photoField {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #recordingPanel #coordinatesField .coordinate-row {
    grid-template-columns: minmax(0, 1fr) 34px 34px !important;
    gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #recordingPanel #coordinatesField :is(.coordinate-paste-btn, .coordinate-recenter-btn) {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }

  #authScreen #signupPanel .auth-image-field.ui-image-editor,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor,
  #mainScreen #recordingPanel #photoField,
  #introScreen .intro-soundwalk-image.ui-image-editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    column-gap: 8px !important;
  }

  #authScreen #signupPanel .auth-image-field.ui-image-editor .ui-image-editor__controls,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor .ui-image-editor__controls,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor .ui-image-editor__controls,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor .ui-image-editor__controls,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor .ui-image-editor__controls,
  #mainScreen #recordingPanel #photoField .ui-image-editor__controls,
  #introScreen .intro-soundwalk-image.ui-image-editor .ui-image-editor__controls,
  #authScreen #signupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #mainScreen #recordingPanel #photoField .ui-image-editor__preview-actions,
  #introScreen .intro-soundwalk-image.ui-image-editor .ui-image-editor__preview-actions {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  #authScreen #signupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions,
  #mainScreen #recordingPanel #photoField .ui-image-editor__preview-actions,
  #introScreen .intro-soundwalk-image.ui-image-editor .ui-image-editor__preview-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }

  #authScreen #signupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button,
  #mainScreen #recordingPanel #photoField .ui-image-editor__preview-actions button,
  #introScreen .intro-soundwalk-image.ui-image-editor .ui-image-editor__preview-actions button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 9px !important;
  }

  #authScreen #signupPanel :is(#signupPhotoBtn, #signupPhotoResetBtn, #signupPhotoRedoBtn, #signupPhotoClearBtn),
  #profileScreen #profileEditPanel :is(#profilePhotoBtn, #profilePhotoResetBtn, #profilePhotoRedoBtn, #profilePhotoClearBtn),
  #profileScreen #profileCreateGroupPanel :is(#createGroupImageBtn, #createGroupImageResetBtn, #createGroupImageRedoBtn, #createGroupImageClearBtn),
  #profileScreen #profileEditSoundPanel :is(#editSoundImageBtn, #editSoundImageResetBtn, #editSoundImageRedoBtn, #editSoundImageClearBtn),
  #profileScreen #profileEditSoundwalkPanel :is(#editSoundwalkImageBtn, #editSoundwalkImageResetBtn, #editSoundwalkImageRedoBtn, #editSoundwalkImageClearBtn),
  #introScreen #soundwalkDetailsBlock :is(#soundwalkUploadPhotoBtn, #soundwalkPhotoResetBtn, #soundwalkPhotoRedoBtn, #soundwalkClearPhotoBtn),
  #mainScreen #recordingPanel :is(#uploadPhotoBtn, #photoPrevBtn, #photoNextBtn, #clearPhotoBtn) {
    width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    min-height: 30px !important;
  }

  #authScreen #signupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button svg,
  #profileScreen #profileEditPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button svg,
  #profileScreen #profileCreateGroupPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button svg,
  #profileScreen #profileEditSoundPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button svg,
  #profileScreen #profileEditSoundwalkPanel .auth-image-field.ui-image-editor .ui-image-editor__preview-actions button svg,
  #mainScreen #recordingPanel #photoField .ui-image-editor__preview-actions button svg,
  #introScreen .intro-soundwalk-image.ui-image-editor .ui-image-editor__preview-actions button svg {
    width: 15px !important;
    height: 15px !important;
  }

  .auth-avatar-preview,
  .photo-preview,
  .ui-image-editor__preview {
    width: min(100%, 104px) !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 1;
  }
}

/* ==========================================================
   1.4.0 final consistency lock
   Keep page identifiers, filters and compact controls stable
   after the older migration and responsive layers.
   ========================================================== */

:root {
  --pill-icon-sounds: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h1.6'/%3E%3Cpath d='M7.2 12c.8 0 .8-5.4 1.8-5.4S10 18 11 18s1-12 2-12 1 12 2 12 1-8 2-8 .9 2 1.7 2H20'/%3E%3C/svg%3E");
  --pill-icon-soundwalks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s5.4-5.2 5.4-10.1A5.4 5.4 0 0 0 6.6 10.9C6.6 15.8 12 21 12 21Z'/%3E%3Cpath d='M9.5 11.2h.8'/%3E%3Cpath d='M11.2 11.2c.5 0 .5-2.2 1.1-2.2s.6 4.4 1.2 4.4.6-2.2 1.1-2.2h.7'/%3E%3C/svg%3E");
  --pill-icon-groups: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg%3E%3Ccircle cx='10' cy='8' r='3.2'/%3E%3Cpath d='M4.5 20c.7-4.1 2.55-6.15 5.5-6.15S14.8 15.9 15.5 20'/%3E%3C/g%3E%3Cg%3E%3Ccircle cx='18' cy='8' r='3.2'/%3E%3Cpath d='M12.5 20c.7-4.1 2.55-6.15 5.5-6.15S22.8 15.9 23.5 20'/%3E%3C/g%3E%3C/svg%3E");
}

/* Every page pill follows the View Profile language: ochre icon, blue copy. */
:is(
  .auth-section-heading > .eyebrow,
  .panel-title-pill,
  .page-title-pill,
  #profileScreen .profile-main-card .section-title,
  #settingsScreen .settings-page-title > .eyebrow
) {
  display: inline-flex !important;
  align-items: center !important;
  width: max-content !important;
  min-height: 30px !important;
  margin: 0 !important;
  padding: 6px 11px !important;
  gap: 8px !important;
  border-width: 1px !important;
  border-color: rgba(188, 204, 214, .78) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .91) !important;
  color: var(--sr-value-blue, #2f6f98) !important;
  font-family: var(--font) !important;
  font-size: .76rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: var(--ui-heading-pill-tracking) !important;
  text-transform: uppercase !important;
  box-shadow: 0 5px 14px rgba(38, 53, 64, .08) !important;
}

.page-title-pill > svg {
  display: block !important;
  flex: 0 0 16px;
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  color: var(--sr-icon-ochra, #c4872a) !important;
  stroke: currentColor !important;
}

.panel-title-pill .section-heading-icon,
.panel-title-pill .section-heading-icon svg,
.panel-title-pill > svg {
  color: var(--sr-icon-ochra, #c4872a) !important;
  stroke: currentColor !important;
}

#profileScreen .profile-main-card .section-title::before,
#settingsScreen .settings-page-title > .eyebrow::before {
  color: var(--sr-icon-ochra, #c4872a) !important;
  background-color: currentColor !important;
}

:is(
  #mapPanel,
  #recordingPanel,
  #savedPanel
) .section-description,
#profileScreen .profile-section-description,
#settingsScreen .settings-intro {
  width: min(100%, 760px) !important;
  margin: 9px 0 18px !important;
  color: #687783 !important;
  font-size: .88rem !important;
  font-weight: 520 !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
}

.profile-main-card[data-profile-mode="sounds"] .section-title::before,
.profile-main-card[data-profile-mode="edit-sound"] .section-title::before {
  -webkit-mask-image: var(--pill-icon-sounds) !important;
          mask-image: var(--pill-icon-sounds) !important;
}

.profile-main-card[data-profile-mode="soundwalks"] .section-title::before,
.profile-main-card[data-profile-mode="edit-soundwalk"] .section-title::before {
  -webkit-mask-image: var(--pill-icon-soundwalks) !important;
          mask-image: var(--pill-icon-soundwalks) !important;
}

.profile-main-card[data-profile-mode="groups"] .section-title::before,
.profile-main-card[data-profile-mode="view-group"] .section-title::before,
.profile-main-card[data-profile-mode="create-group"] .section-title::before {
  -webkit-mask-image: var(--pill-icon-groups) !important;
          mask-image: var(--pill-icon-groups) !important;
}

#mapFilterPanel .map-search-control > span[data-i18n] {
  color: #596873 !important;
  font-weight: 750 !important;
}

/* Keep advanced filters discoverable without turning them into another card. */
:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #savedPanel .library-more-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) {
  padding: 0 !important;
  border: 1px solid rgba(99, 122, 137, .24) !important;
  border-radius: 12px !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary,
:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary:hover,
:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary:focus-visible {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  min-height: 38px !important;
  padding: 8px 12px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #5f6f7f !important;
  cursor: pointer !important;
  filter: none !important;
  list-style: none !important;
  transform: none !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary::-webkit-details-marker {
  display: none !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary::marker {
  content: "" !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > summary::before {
  content: "" !important;
  width: 0 !important;
  height: 0 !important;
  flex: 0 0 auto !important;
  border-top: 5px solid transparent !important;
  border-bottom: 5px solid transparent !important;
  border-left: 7px solid currentColor !important;
  transform: rotate(0deg) !important;
  transform-origin: 45% 50% !important;
  transition: transform .18s ease !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
)[open] > summary::before {
  transform: rotate(90deg) !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
)[open] > summary {
  border-bottom: 1px solid rgba(99, 122, 137, .18) !important;
  background: rgba(244, 248, 249, .52) !important;
}

:is(
  #mapFilterPanel .map-more-filters,
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > :is(.soundmap-filter-grid, .saved-filter-grid) {
  padding: 12px !important;
}

:is(
  #savedPanel .saved-advanced-filters,
  #profileSoundsPanel .saved-advanced-filters,
  #profileSoundwalksPanel .profile-more-filters,
  #profileGroupsPanel .profile-more-filters
) > .clear-filters-btn {
  margin: 0 auto 12px !important;
}

:is(
  #mapFilterPanel .map-search-row,
  #mapFilterPanel .soundmap-filter-grid,
  #savedPanel .saved-search-row,
  #savedPanel .saved-filter-grid,
  #profileSoundsPanel .profile-list-tools,
  #profileSoundsPanel .saved-filter-grid,
  #profileSoundwalksPanel .profile-list-tools,
  #profileSoundwalksPanel .saved-filter-grid,
  #profileGroupsPanel .profile-list-tools,
  #profileGroupsPanel .saved-filter-grid
),
:is(
  #mapFilterPanel,
  #savedPanel,
  #profileSoundsPanel,
  #profileSoundwalksPanel,
  #profileGroupsPanel
) .filter-control,
:is(
  #mapFilterPanel,
  #savedPanel,
  #profileSoundsPanel,
  #profileSoundwalksPanel,
  #profileGroupsPanel
) .filter-control:hover,
:is(
  #mapFilterPanel,
  #savedPanel,
  #profileSoundsPanel,
  #profileSoundwalksPanel,
  #profileGroupsPanel
) .filter-control:focus-within {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

:is(
  #mapFilterPanel,
  #savedPanel,
  #profileSoundsPanel,
  #profileSoundwalksPanel,
  #profileGroupsPanel
) .filter-control {
  padding: 0 !important;
}

:is(
  #mapFilterPanel #mapClearFiltersBtn,
  #savedPanel #clearSavedFiltersBtn,
  #profileSoundsPanel #profileClearSoundFiltersBtn,
  #profileSoundwalksPanel #profileClearSoundwalkFiltersBtn,
  #profileGroupsPanel #profileClearGroupFiltersBtn
) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  align-self: center !important;
  width: 148px !important;
  min-width: 148px !important;
  max-width: 148px !important;
  min-height: 48px !important;
  height: 48px !important;
  max-height: 48px !important;
  margin: 0 auto 12px !important;
  padding: 0 12px !important;
  gap: 7px !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: var(--action-map-bg, linear-gradient(135deg, #5aa5b7, #397fa2)) !important;
  color: #fff !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  text-align: center !important;
  box-shadow: 0 9px 20px rgba(47, 119, 157, .14) !important;
}

:is(
  #mapFilterPanel #mapClearFiltersBtn,
  #savedPanel #clearSavedFiltersBtn,
  #profileSoundsPanel #profileClearSoundFiltersBtn,
  #profileSoundwalksPanel #profileClearSoundwalkFiltersBtn,
  #profileGroupsPanel #profileClearGroupFiltersBtn
) svg {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 16px !important;
  stroke: currentColor !important;
}

:is(
  #mapFilterPanel #mapClearFiltersBtn,
  #savedPanel #clearSavedFiltersBtn,
  #profileSoundsPanel #profileClearSoundFiltersBtn,
  #profileSoundwalksPanel #profileClearSoundwalkFiltersBtn,
  #profileGroupsPanel #profileClearGroupFiltersBtn
) > span:not([aria-hidden="true"]) {
  display: block !important;
  width: 76px !important;
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  font-size: .72rem !important;
  line-height: 1.12 !important;
  text-align: center !important;
}

/* My Groups keeps its borders, but no opaque wrapper sits behind the filters or list. */
#profileGroupsPanel,
#profileGroupsPanel .profile-groups-list-box,
#profileGroupsPanel #profileGroupsList {
  background: transparent !important;
  box-shadow: none !important;
}

#profileGroupsPanel #profileAddGroupPanel,
#profileGroupsPanel #profileAddGroupPanel .organization-entry-row,
#profileGroupsPanel #profileAddGroupPanel .organization-entry-row:hover,
#profileGroupsPanel #profileAddGroupPanel .organization-entry-row:focus-within {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
}

#profileGroupsPanel #profileAddGroupPanel .organization-entry-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 40px !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
  border: 0 !important;
}

#profileGroupsPanel #profileSendGroupRequestBtn {
  background: var(--ui-action-add, linear-gradient(135deg, #4d9a89, #347f73)) !important;
  color: #fff !important;
}

/* My Sounds must not introduce a second white panel inside the profile card. */
#profileSoundsPanel .profile-sounds-list-box {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* The play button becomes Stop itself; the old second Stop control stays hidden. */
#recordingPanel #stopAudioBtn {
  display: none !important;
}

#recordingPanel :is(#playAudioBtn, #startRecBtn, #uploadAudioBtn) {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  text-align: center !important;
}

#recordingPanel :is(#playAudioBtn, #startRecBtn, #uploadAudioBtn) > svg {
  display: block !important;
  flex: 0 0 18px !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  transform: none !important;
}

#recordingPanel :is(#playAudioBtn, #startRecBtn, #uploadAudioBtn) > span {
  display: block !important;
  min-width: 0 !important;
  line-height: 1.15 !important;
}

/* View Profile: keep copy/punctuation muted while preserving ochre SVGs. */
#profileScreen #profileOverview .profile-overview-grid #profileOverviewGroups :is(
  .profile-group-paren,
  .profile-group-separator,
  .profile-group-role,
  .profile-group-role span,
  .profile-group-role-label,
  .profile-group-role-line,
  .profile-group-count-role
) {
  color: var(--sr-label-muted, #6d7884) !important;
}

#profileScreen #profileOverview .profile-overview-grid #profileOverviewGroups :is(.profile-group-count-role, .profile-group-role) svg,
#profileScreen #profileOverview .profile-overview-grid #profileOverviewGroups :is(.profile-group-count-role, .profile-group-role) svg * {
  color: var(--sr-icon-ochra, #c4872a) !important;
  stroke: currentColor !important;
}

#profileScreen #profileOverview .profile-overview-grid #profileOverviewGroups .profile-group-count-number,
#profileScreen #profileOverview .profile-overview-grid #profileOverviewGroups .profile-group-chip-name {
  color: var(--sr-value-blue, #1f5e8c) !important;
}

/* Old list-specific rules used a larger mini-button for this one delete action. */
#profileScreen #profileGroupsPanel #profileGroupsList .profile-group-delete-btn,
#profileScreen #profileGroupsPanel #profileGroupsList .profile-group-edit-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--action-size) !important;
  min-width: var(--action-size) !important;
  max-width: var(--action-size) !important;
  height: var(--action-size) !important;
  min-height: var(--action-size) !important;
  max-height: var(--action-size) !important;
  flex: 0 0 var(--action-size) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--action-radius) !important;
}

#profileScreen #profileGroupsPanel #profileGroupsList .profile-group-delete-btn {
  background: linear-gradient(135deg, var(--action-delete-start), var(--action-delete-end)) !important;
  color: #fff !important;
}

#profileScreen #profileGroupsPanel #profileGroupsList .profile-group-edit-btn {
  background: linear-gradient(135deg, var(--action-edit-start), var(--action-edit-end)) !important;
  color: #fff !important;
}

#profileScreen #profileGroupsPanel #profileGroupsList :is(.profile-group-delete-btn, .profile-group-edit-btn) svg {
  display: block !important;
  width: 17px !important;
  height: 17px !important;
  color: #fff !important;
  stroke: currentColor !important;
}

.user-profile-popup .popup-side-actions > .popup-mini-action-btn,
.user-profile-popup .profile-popup-actions > .popup-mini-action-btn {
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  flex: 0 0 32px !important;
  padding: 0 !important;
  border-radius: 9px !important;
}

.user-profile-popup .popup-mini-action-btn svg {
  width: 15px !important;
  height: 15px !important;
}

.profile-title-follow-btn,
.popup-mini-action-btn.follow {
  background: linear-gradient(135deg, #4f83a8, #376b90) !important;
  color: #fff !important;
}

#profileScreen .profile-main-card .intro-title-lockup .profile-title-follow-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--mini-btn-size, 42px) !important;
  height: var(--mini-btn-size, 42px) !important;
  min-width: var(--mini-btn-size, 42px) !important;
  min-height: var(--mini-btn-size, 42px) !important;
  max-width: var(--mini-btn-size, 42px) !important;
  max-height: var(--mini-btn-size, 42px) !important;
  flex: 0 0 var(--mini-btn-size, 42px) !important;
  padding: 0 !important;
  border-radius: var(--mini-btn-radius, 14px) !important;
  overflow: hidden !important;
}

.profile-title-follow-btn.following,
.popup-mini-action-btn.follow.following {
  background: linear-gradient(135deg, #6b8f71, #4d7355) !important;
}

.profile-title-follow-btn svg,
.popup-mini-action-btn.follow svg {
  color: #fff !important;
  stroke: currentColor !important;
}

#profileScreen .profile-main-card .intro-title-lockup .profile-title-follow-btn svg {
  display: block !important;
  width: 17px !important;
  height: 17px !important;
  margin: 0 !important;
}

#profileScreen #profileConnectionsBox {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(79, 126, 168, .24);
  background: rgba(247, 250, 252, .9);
}

#profileScreen #profileConnectionsBox.hidden,
#profileScreen #profileConnectionsBox[hidden] {
  display: none !important;
}

#profileScreen #profileConnectionsBox > .profile-connections-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sr-label-muted, #6d7884);
  font-weight: 800;
}

#profileScreen #profileConnectionsBox > .profile-connections-heading svg,
#profileScreen #profileConnectionsBox .profile-connection-label svg {
  display: block;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--sr-icon-ochra, #c4872a);
  stroke: currentColor;
}

#profileScreen #profileConnectionsBox .profile-follow-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(79, 126, 168, .15);
}

#profileScreen #profileConnectionsBox .profile-follow-search.hidden,
#profileScreen #profileConnectionsBox .profile-follow-search[hidden] {
  display: none !important;
}

#profileScreen #profileConnectionsBox .profile-follow-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--mini-btn-size, 42px);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#profileScreen #profileConnectionsBox #profileFollowSearchInput {
  width: 100%;
  min-width: 0;
  min-height: var(--mini-btn-size, 42px);
  margin: 0;
}

#profileScreen #profileConnectionsBox #profileFollowSearchAddBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--mini-btn-size, 42px) !important;
  min-width: var(--mini-btn-size, 42px) !important;
  max-width: var(--mini-btn-size, 42px) !important;
  height: var(--mini-btn-size, 42px) !important;
  min-height: var(--mini-btn-size, 42px) !important;
  max-height: var(--mini-btn-size, 42px) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--mini-btn-radius, 14px) !important;
  background: linear-gradient(135deg, #4f83a8, #376b90) !important;
  color: #fff !important;
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11) !important;
}

#profileScreen #profileConnectionsBox #profileFollowSearchAddBtn svg {
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
  stroke: currentColor !important;
}

#profileScreen #profileConnectionsBox #profileFollowSearchAddBtn:is(:hover, :focus-visible) {
  transform: translateY(-1px) !important;
  outline: 0 !important;
  box-shadow: 0 11px 24px rgba(10, 20, 28, .21) !important;
}

#profileScreen #profileConnectionsBox .profile-follow-search-suggestions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  width: 100%;
  max-height: 224px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(79, 126, 168, .22);
  border-radius: 10px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 9px 22px rgba(42, 55, 64, .1);
  box-sizing: border-box;
}

#profileScreen #profileConnectionsBox .profile-follow-search-suggestions.hidden {
  display: none !important;
}

#profileScreen #profileConnectionsBox .profile-follow-search-suggestion {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #455362;
  text-align: left;
  box-shadow: none;
}

#profileScreen #profileConnectionsBox .profile-follow-search-suggestion:is(:hover, :focus-visible, .active) {
  border-color: rgba(79, 126, 168, .35);
  background: rgba(79, 126, 168, .08);
  outline: 0;
}

#profileScreen #profileConnectionsBox .profile-follow-search-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid rgba(79, 126, 168, .25);
  border-radius: 50%;
  background: #eef4f7;
}

#profileScreen #profileConnectionsBox .profile-follow-search-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#profileScreen #profileConnectionsBox .profile-follow-search-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

#profileScreen #profileConnectionsBox .profile-follow-search-copy :is(strong, small) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profileScreen #profileConnectionsBox .profile-follow-search-copy strong {
  color: var(--sr-value-blue, #1f5e8c);
  font-size: .84rem;
  font-weight: 850;
}

#profileScreen #profileConnectionsBox .profile-follow-search-copy small,
#profileScreen #profileConnectionsBox .profile-follow-search-empty {
  color: var(--sr-label-muted, #6d7884);
  font-size: .74rem;
  font-weight: 650;
}

#profileScreen #profileConnectionsBox .profile-follow-search-empty {
  padding: 8px;
}

#profileScreen #profileConnectionsBox .profile-connection-row {
  display: grid;
  grid-template-columns: minmax(112px, max-content) minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 9px 0 0;
  border-top: 1px solid rgba(79, 126, 168, .15);
}

#profileScreen #profileConnectionsBox .profile-connection-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--sr-label-muted, #6d7884);
  font-weight: 750;
}

#profileScreen #profileConnectionsBox .profile-connection-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--sr-value-blue, #1f5e8c);
}

#profileScreen .profile-connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  padding: 4px 10px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--connection-user-color) 35%, #d7e0e7);
  border-radius: 999px;
  background: #fff;
  color: #455362;
  box-shadow: 0 3px 9px rgba(42, 55, 64, .08);
}

#profileScreen .profile-connection-chip:hover,
#profileScreen .profile-connection-chip:focus-visible {
  border-color: var(--connection-user-color);
  box-shadow: 0 5px 12px color-mix(in srgb, var(--connection-user-color) 20%, transparent);
}

#profileScreen .profile-connection-chip-avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  overflow: hidden;
  border: 2px solid var(--connection-user-color);
  border-radius: 50%;
  background: color-mix(in srgb, var(--connection-user-color) 16%, #fff);
  color: var(--connection-user-color);
  font-size: 12px;
  font-weight: 850;
}

#profileScreen .profile-connection-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#profileScreen .profile-connection-chip-name {
  min-width: 0;
  overflow: hidden;
  color: var(--sr-value-blue, #1f5e8c);
  font-size: .92rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profileScreen .profile-connections-empty {
  align-self: center;
  min-height: 34px;
  padding: 7px 0;
  color: var(--sr-label-muted, #6d7884);
  font-weight: 650;
}

@media (max-width: 560px) {
  #profileScreen #profileConnectionsBox .profile-connection-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

#mapPanel #mapGroupsLegend {
  display: grid !important;
  grid-template-columns: max-content minmax(0, 1fr) !important;
  column-gap: 8px !important;
  row-gap: 8px !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

#mapPanel .map-legend-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 42px !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  margin: 4px 0 12px !important;
}

#mapPanel .map-legend-toolbar.hidden {
  display: none !important;
}

#mapPanel #mapGroupsLegend {
  margin: 0 !important;
  border-radius: 12px !important;
}

#mapGroupsLegend .map-legend-section {
  display: contents !important;
  align-items: start !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  text-align: left !important;
  width: 100% !important;
}

#mapGroupsLegend .map-legend-section-label {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  color: var(--sr-label-muted, #6d7884) !important;
  font-size: .75rem !important;
  font-weight: 760 !important;
  line-height: 1.2 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  min-height: 34px !important;
  align-self: start !important;
}

#mapGroupsLegend .map-legend-section-label-icon,
#mapGroupsLegend .map-legend-section-label-icon svg {
  width: 16px !important;
  height: 16px !important;
  color: var(--sr-icon-ochra, #c4872a) !important;
  stroke: currentColor !important;
}

#mapGroupsLegend .map-legend-section-pills {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  margin: 0 !important;
}

#mapGroupsLegend .map-legend-section-pills::-webkit-scrollbar {
  display: none !important;
}

#mapGroupsLegend .legend-group-pill {
  align-self: center !important;
  margin: 0 !important;
}

.group-position-icon.online-user {
  box-shadow:
    0 8px 18px rgba(15, 23, 32, .22),
    0 0 12px var(--group-position-glow-color, var(--group-position-color, #2e6f98)) !important;
}

.group-position-icon.online-user::before,
.group-position-icon.online-user::after {
  border-color: var(--group-position-glow-color, var(--group-position-color, #2e6f98)) !important;
  box-shadow: 0 0 10px var(--group-position-glow-color, var(--group-position-color, #2e6f98)) !important;
}

@media (prefers-reduced-motion: reduce) {
  #soundRoutesApp *,
  #soundRoutesApp *::before,
  #soundRoutesApp *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .group-position-icon.online-user::before,
  .group-position-icon.online-user::after {
    animation: none !important;
    opacity: .2 !important;
    transform: scale(1.28) !important;
  }
}

/* One image-editor system for signup, profile, groups, sounds and soundwalks. */
:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor {
  --editor-preview-size: clamp(104px, 18vw, 140px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--editor-preview-size) !important;
  grid-template-areas:
    "label label"
    "controls preview" !important;
  align-items: start !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid var(--line, #d6e1e6) !important;
  border-radius: var(--radius-md, 14px) !important;
  background: var(--surface-soft, #f7fafb) !important;
  box-shadow: none !important;
}

#profileScreen #profileCreateGroupPanel .create-group-image-section {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor > .auth-image-label {
  grid-area: label !important;
  margin: 0 !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor > .ui-image-editor__controls {
  grid-area: controls !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor > .ui-image-editor__preview-actions {
  grid-area: preview !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-areas:
    "preview preview preview preview"
    "upload undo redo clear" !important;
  align-items: center !important;
  gap: 6px !important;
  width: var(--editor-preview-size) !important;
  min-width: 0 !important;
  margin: 0 !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .auth-avatar-preview {
  grid-area: preview !important;
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
  max-width: var(--editor-preview-size) !important;
  height: var(--editor-preview-size) !important;
  min-height: var(--editor-preview-size) !important;
  max-height: var(--editor-preview-size) !important;
  aspect-ratio: 1 !important;
  margin: 0 !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > .photo-action-btn.upload {
  grid-area: upload !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > .preview-history-btn.reset:not(.redo) {
  grid-area: undo !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > .preview-history-btn.redo {
  grid-area: redo !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > .preview-history-btn.delete {
  grid-area: clear !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > button {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border-radius: 9px !important;
}

/* Older per-ID rules used different control sizes. These selectors keep the
   four image-history actions genuinely equal in every editor. */
#authScreen #signupPanel :is(#signupPhotoBtn, #signupPhotoResetBtn, #signupPhotoRedoBtn, #signupPhotoClearBtn),
#profileScreen #profileEditPanel :is(#profilePhotoBtn, #profilePhotoResetBtn, #profilePhotoRedoBtn, #profilePhotoClearBtn),
#profileScreen #profileCreateGroupPanel :is(#createGroupImageBtn, #createGroupImageResetBtn, #createGroupImageRedoBtn, #createGroupImageClearBtn),
#profileScreen #profileEditSoundPanel :is(#editSoundImageBtn, #editSoundImageResetBtn, #editSoundImageRedoBtn, #editSoundImageClearBtn),
#profileScreen #profileEditSoundwalkPanel :is(#editSoundwalkImageBtn, #editSoundwalkImageResetBtn, #editSoundwalkImageRedoBtn, #editSoundwalkImageClearBtn) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  justify-self: stretch !important;
}

#mainScreen #recordingPanel #photoField {
  --editor-preview-size: clamp(104px, 18vw, 140px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--editor-preview-size) !important;
  grid-template-areas:
    "label label"
    "controls preview" !important;
  align-items: start !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid var(--line, #d6e1e6) !important;
  border-radius: var(--radius-md, 14px) !important;
  background: var(--surface-soft, #f7fafb) !important;
  box-shadow: none !important;
}

#mainScreen #recordingPanel #photoField > label {
  grid-area: label !important;
  margin: 0 !important;
}

#mainScreen #recordingPanel #photoField > .photo-crop-layout.ui-image-editor {
  display: contents !important;
  width: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#mainScreen #recordingPanel #photoField .ui-image-editor__controls {
  grid-area: controls !important;
  width: 100% !important;
  min-width: 0 !important;
}

#mainScreen #recordingPanel #photoField .ui-image-editor__preview-actions {
  grid-area: preview !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-areas:
    "preview preview preview preview"
    "upload undo redo clear" !important;
  align-items: center !important;
  gap: 6px !important;
  width: var(--editor-preview-size) !important;
  min-width: 0 !important;
  margin: 0 !important;
}

#mainScreen #recordingPanel #photoField .photo-history-controls {
  display: contents !important;
  position: static !important;
  inset: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
}

#mainScreen #recordingPanel #photoField .photo-preview {
  grid-area: preview !important;
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
  max-width: var(--editor-preview-size) !important;
  height: var(--editor-preview-size) !important;
  min-height: var(--editor-preview-size) !important;
  max-height: var(--editor-preview-size) !important;
  aspect-ratio: 1 !important;
  margin: 0 !important;
}

#mainScreen #recordingPanel #photoField .photo-capture-actions {
  display: none !important;
}

#mainScreen #recordingPanel #photoField #uploadPhotoBtn { grid-area: upload !important; }
#mainScreen #recordingPanel #photoField #photoPrevBtn { grid-area: undo !important; }
#mainScreen #recordingPanel #photoField #photoNextBtn { grid-area: redo !important; }
#mainScreen #recordingPanel #photoField #clearPhotoBtn { grid-area: clear !important; }

#mainScreen #recordingPanel #photoField :is(#uploadPhotoBtn, #photoPrevBtn, #photoNextBtn, #clearPhotoBtn) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  justify-self: stretch !important;
}

#introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor {
  --editor-preview-size: clamp(104px, 18vw, 140px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--editor-preview-size) !important;
  grid-template-areas:
    "controls preview"
    "capture capture" !important;
  align-items: start !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid var(--line, #d6e1e6) !important;
  border-radius: var(--radius-md, 14px) !important;
  background: var(--surface-soft, #f7fafb) !important;
  box-shadow: none !important;
}

#introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor > .ui-image-editor__controls {
  grid-area: controls !important;
  width: 100% !important;
  min-width: 0 !important;
}

#introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor > .ui-image-editor__preview-actions {
  grid-area: preview !important;
  width: var(--editor-preview-size) !important;
  min-width: 0 !important;
}

#introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor > .photo-capture-actions {
  grid-area: capture !important;
  justify-self: center !important;
  margin: 0 !important;
}

#introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor .photo-preview {
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
  max-width: var(--editor-preview-size) !important;
  height: var(--editor-preview-size) !important;
  min-height: var(--editor-preview-size) !important;
  max-height: var(--editor-preview-size) !important;
  aspect-ratio: 1 !important;
}

#introScreen #soundwalkDetailsBlock .photo-history-controls {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
  width: var(--editor-preview-size) !important;
  min-width: 0 !important;
  max-width: var(--editor-preview-size) !important;
  margin: 6px 0 0 !important;
}

#introScreen #soundwalkDetailsBlock :is(#soundwalkUploadPhotoBtn, #soundwalkPhotoResetBtn, #soundwalkPhotoRedoBtn, #soundwalkClearPhotoBtn) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  justify-self: stretch !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel,
  #mainScreen #recordingPanel #photoField,
  #introScreen #soundwalkDetailsBlock
) .photo-adjustments {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-content: start !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel,
  #mainScreen #recordingPanel #photoField,
  #introScreen #soundwalkDetailsBlock
) .photo-adjust-control {
  display: grid !important;
  grid-template-rows: auto 24px !important;
  align-content: center !important;
  gap: 5px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 62px !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid #d5e0e5 !important;
  border-radius: 12px !important;
  background: #fbfcfd !important;
  box-shadow: 0 3px 8px rgba(37, 54, 65, .035) !important;
  overflow: visible !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel,
  #mainScreen #recordingPanel #photoField,
  #introScreen #soundwalkDetailsBlock
) .photo-adjust-label {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  color: #46535d !important;
  font-size: .72rem !important;
  font-weight: 780 !important;
  line-height: 1.1 !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel,
  #mainScreen #recordingPanel #photoField,
  #introScreen #soundwalkDetailsBlock
) .photo-adjust-control input[type="range"] {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 24px !important;
  margin: 0 !important;
  align-self: center !important;
}

/* Required signup fields mark the control only, never the label or icon. */
#authScreen #signupPanel .field-missing,
#authScreen #signupPanel .auth-grid > .field-missing,
#authScreen #signupPanel .auth-grid > label.field-missing,
#authScreen #signupPanel .auth-password-block.field-missing,
#authScreen #signupPanel .profile-description-field.field-missing {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#authScreen #signupPanel .field-missing :is(.label-row, .label-text) {
  color: var(--text, #26323b) !important;
}

#authScreen #signupPanel .field-missing .label-icon,
#authScreen #signupPanel .field-missing .label-icon svg,
#authScreen #signupPanel .signup-role-field .label-icon,
#authScreen #signupPanel .signup-role-field .label-icon svg {
  color: var(--sr-icon-ochra, #c4872a) !important;
  stroke: currentColor !important;
}

#authScreen #signupPanel .field-missing .required-mark {
  color: #b65752 !important;
}

#authScreen #signupPanel .field-missing :is(input, select, textarea),
#authScreen #signupPanel :is(input, select, textarea).field-missing {
  border-color: rgba(174, 94, 88, .78) !important;
  background: rgba(255, 248, 248, .98) !important;
  box-shadow: 0 0 0 3px rgba(174, 94, 88, .15) !important;
}

/* Ten stable metadata accents, reused by the Library dots. */
.choice-card.anthro { --toggle-accent: #c4872a !important; }
.choice-card.bio { --toggle-accent: #4f8c62 !important; }
.choice-card.geo { --toggle-accent: #4d8ca8 !important; }
.choice-card.open { --toggle-accent: #6f9ec5 !important; }
.choice-card.layered { --toggle-accent: #7b6aa4 !important; }
.choice-card.dense { --toggle-accent: #a76555 !important; }
.choice-card.quiet { --toggle-accent: #708a8b !important; }
.choice-card.keynote { --toggle-accent: #d2a63c !important; }
.choice-card.signal { --toggle-accent: #c75c6d !important; }
.choice-card.soundmark { --toggle-accent: #5f6caf !important; }

.dot.anthro { background: #c4872a !important; }
.dot.bio { background: #4f8c62 !important; }
.dot.geo { background: #4d8ca8 !important; }
.dot.open { background: #6f9ec5 !important; }
.dot.layered { background: #7b6aa4 !important; }
.dot.dense { background: #a76555 !important; }
.dot.quiet { background: #708a8b !important; }
.dot.keynote { background: #d2a63c !important; }
.dot.signal { background: #c75c6d !important; }
.dot.soundmark { background: #5f6caf !important; }

@media (max-width: 420px) {
  :is(
    #authScreen #signupPanel,
    #profileScreen #profileEditPanel,
    #profileScreen #profileCreateGroupPanel,
    #profileScreen #profileEditSoundPanel,
    #creationSetupScreen,
    #profileScreen #profileEditSoundwalkPanel
  ) .auth-image-field.ui-image-editor,
  #mainScreen #recordingPanel #photoField,
  #introScreen #soundwalkDetailsBlock .photo-crop-layout.ui-image-editor {
    --editor-preview-size: clamp(96px, 31vw, 112px);
    gap: 8px !important;
    padding: 10px !important;
  }

  :is(
    #authScreen #signupPanel,
    #profileScreen #profileEditPanel,
    #profileScreen #profileCreateGroupPanel,
    #profileScreen #profileEditSoundPanel,
    #creationSetupScreen,
    #profileScreen #profileEditSoundwalkPanel,
    #mainScreen #recordingPanel #photoField,
    #introScreen #soundwalkDetailsBlock
  ) .photo-adjust-control {
    min-height: 56px !important;
    padding: 6px 8px !important;
  }
}

/* Keep the intro soundwalk uploader on the same grid as the recording editor.
   The intro field wraps the editor, so the inner layout must participate in the
   outer grid instead of being squeezed into its first column. */
#introScreen #soundwalkDetailsBlock .intro-soundwalk-image {
  --editor-preview-size: clamp(112px, 18vw, 140px);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--editor-preview-size) !important;
  grid-template-areas:
    "label label"
    "controls preview" !important;
  align-items: start !important;
  justify-items: stretch !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image > .intro-field-label {
  grid-area: label !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image > .photo-crop-layout.ui-image-editor {
  --editor-preview-size: inherit !important;
  display: contents !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image .ui-image-editor__controls {
  grid-area: controls !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image .ui-image-editor__preview-actions {
  grid-area: preview !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-areas:
    "preview preview preview preview"
    "upload undo redo clear" !important;
  align-items: center !important;
  gap: 6px !important;
  width: var(--editor-preview-size) !important;
  min-width: 0 !important;
  max-width: var(--editor-preview-size) !important;
  margin: 0 !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image .photo-history-controls {
  display: contents !important;
  position: static !important;
  inset: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image .photo-preview {
  grid-area: preview !important;
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
  max-width: var(--editor-preview-size) !important;
  height: var(--editor-preview-size) !important;
  min-height: var(--editor-preview-size) !important;
  max-height: var(--editor-preview-size) !important;
  aspect-ratio: 1 !important;
  margin: 0 !important;
}

#introScreen #soundwalkDetailsBlock .intro-soundwalk-image :is(
  #soundwalkUploadPhotoBtn,
  #soundwalkPhotoResetBtn,
  #soundwalkPhotoRedoBtn,
  #soundwalkClearPhotoBtn
) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  justify-self: stretch !important;
}

@media (max-width: 520px) {
  #introScreen #soundwalkDetailsBlock .intro-soundwalk-image {
    --editor-preview-size: clamp(112px, 34vw, 136px);
    gap: 10px !important;
    padding: 14px !important;
  }

  #introScreen #soundwalkDetailsBlock .intro-soundwalk-image .photo-adjust-control {
    min-height: 58px !important;
    padding: 7px 9px !important;
  }
}

/* The sound-location map is available for both new recordings and saved-sound edits. */
#recordingPanel .coordinate-row {
  grid-template-columns: minmax(0, 1fr) repeat(3, var(--mini-btn-size, 42px)) !important;
}

#recordingPanel .sound-edit-map-toggle-btn {
  width: var(--mini-btn-size, 42px) !important;
  min-width: var(--mini-btn-size, 42px) !important;
  max-width: var(--mini-btn-size, 42px) !important;
  height: var(--mini-btn-size, 42px) !important;
  min-height: var(--mini-btn-size, 42px) !important;
  max-height: var(--mini-btn-size, 42px) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--mini-btn-radius, 13px) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, #bd913c, #946b24) !important;
  color: #fff !important;
  box-shadow: 0 9px 20px rgba(47, 119, 157, .16) !important;
}

#recordingPanel .sound-edit-map-toggle-btn.hidden,
#recordingPanel .sound-edit-map-toggle-btn[hidden] {
  display: none !important;
}

#recordingPanel .sound-edit-map-toggle-btn.is-active {
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, .5),
    0 9px 20px rgba(47, 119, 157, .16) !important;
}

#recordingPanel .sound-edit-map-toggle-btn:focus-visible {
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, .62),
    0 9px 20px rgba(47, 119, 157, .16) !important;
}

#recordingPanel .sound-edit-map-toggle-btn svg {
  display: block !important;
  width: var(--mini-btn-icon, 20px) !important;
  height: var(--mini-btn-icon, 20px) !important;
  stroke: currentColor !important;
}

.sound-edit-location-map-section {
  order: 72 !important;
  grid-column: 1 / -1 !important;
  display: grid !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 14px !important;
  margin: 0 !important;
}

.sound-edit-location-map-heading {
  margin: 0 !important;
  color: #303943 !important;
  font-weight: 800 !important;
}

.sound-edit-location-map-heading .label-icon {
  color: var(--accent) !important;
}

.sound-edit-location-map-heading .label-icon svg {
  display: block !important;
  width: var(--label-icon-size, 18px) !important;
  height: var(--label-icon-size, 18px) !important;
}

.sound-edit-location-map-section.hidden,
.sound-edit-location-map-section[hidden] {
  display: none !important;
}

.sound-edit-location-map {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border: 1px solid rgba(174, 195, 209, .88) !important;
  border-radius: 12px !important;
  background: #e9f0f3 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .62) !important;
}

.sound-edit-location-map .leaflet-control-zoom a {
  color: #33495a !important;
}

.sound-edit-location-map .leaflet-marker-draggable,
.sound-edit-location-map .sound-edit-location-marker-wrap {
  cursor: grab !important;
  touch-action: none !important;
}

.sound-edit-location-map .leaflet-marker-draggable:active,
.sound-edit-location-map .sound-edit-marker-dragging {
  cursor: grabbing !important;
}

@media (max-width: 360px) {
  #recordingPanel #coordinatesField .coordinate-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, 34px) !important;
  }

  #recordingPanel .sound-edit-map-toggle-btn {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }
}

@media (max-width: 360px) {
  #introScreen #soundwalkDetailsBlock .intro-soundwalk-image {
    --editor-preview-size: clamp(108px, 34vw, 122px);
    gap: 8px !important;
    padding: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* Hearing-distance control: compact, touch-friendly, and aligned with recording metadata. */
.hearing-distance-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: 100%;
  padding: clamp(12px, 1.8vw, 16px);
  border: 1px solid var(--safe-inner-box-border, rgba(213, 224, 231, .94));
  border-radius: var(--radius-md, 14px);
  background: var(--safe-inner-box-bg, rgba(246, 249, 251, .82));
  box-shadow: none;
  box-sizing: border-box;
}

.hearing-distance-field .label-row {
  align-items: center;
}

.hearing-distance-value {
  min-width: 58px;
  margin-inline-start: auto;
  padding: 4px 9px;
  border: 1px solid rgba(63, 91, 111, 0.16);
  border-radius: 6px;
  background: rgba(83, 112, 130, 0.08);
  color: #344b5a;
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.hearing-distance-field input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: #4f8fa7;
}

.leaflet-pane.leaflet-soundHearingDistance-pane {
  pointer-events: none;
}

.sound-hearing-distance-circle {
  pointer-events: none;
}

.sound-point-icon-wrap,
.leaflet-marker-icon.sound-point-icon-wrap {
  overflow: visible !important;
}

.sound-point-icon {
  position: relative !important;
  isolation: isolate !important;
  overflow: visible !important;
}

.sound-hearing-distance-halo {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: calc(var(--hearing-radius, 0px) * 2) !important;
  height: calc(var(--hearing-radius, 0px) * 2) !important;
  border-radius: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: var(--hearing-fill, rgba(92, 117, 255, .26)) !important;
  border: 1.5px solid var(--hearing-border, rgba(92, 117, 255, .52)) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 8px 24px rgba(15, 23, 32, .12) !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

.leaflet-container.map-hearing-distance-zooming .sound-hearing-distance-halo {
  opacity: 0 !important;
}

.leaflet-pane.leaflet-activeRoute-pane,
.leaflet-pane.leaflet-activeroute-pane {
  pointer-events: none;
}

/* Leaflet renderers size themselves beyond their zero-layout-width panes. */
.leaflet-pane > canvas,
.leaflet-pane > svg {
  max-width: none !important;
}

.leaflet-pane.leaflet-activeRoute-pane svg,
.leaflet-pane.leaflet-activeroute-pane svg {
  pointer-events: auto;
}

.leaflet-pane.leaflet-activeRoute-pane canvas,
.leaflet-pane.leaflet-activeroute-pane canvas {
  pointer-events: auto;
}

.active-soundwalk-route {
  filter:
    drop-shadow(0 0 1.5px rgba(255, 255, 255, .98))
    drop-shadow(0 1px 2.5px rgba(18, 34, 45, .58));
  pointer-events: stroke;
}

.sound-point-icon .sound-wave-mini {
  position: relative !important;
  z-index: 2 !important;
}

#syncStateIndicator.hidden,
#syncStateIndicator.sync-off,
#syncStateIndicator[hidden],
#syncStateIndicator[aria-hidden="true"],
#syncStateIndicator:empty {
  display: none !important;
  visibility: hidden !important;
}

/* Create-group validation belongs to the controls; labels and section shells stay neutral. */
#profileCreateGroupPanel :is(
  #createGroupNameInput,
  #createGroupTypeSelect,
  #createGroupDescriptionInput
).field-missing,
#creationSetupScreen #creationName.field-missing {
  border-color: rgba(174, 94, 88, .78) !important;
  background: rgba(255, 248, 248, .98) !important;
  box-shadow: 0 0 0 3px rgba(174, 94, 88, .16) !important;
}

#profileCreateGroupPanel .create-group-member-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--mini-btn-size) !important;
  gap: 10px !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
}

#profileCreateGroupPanel #createGroupMemberInput {
  grid-column: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
}

#profileCreateGroupPanel #createGroupMemberAddBtn {
  grid-column: 2 !important;
  justify-self: end !important;
  align-self: center !important;
}

/* Global status feedback: centered, semantic, and visible from every screen. */
html body #recordingStatus.app-status-overlay:not(.hidden) {
  position: fixed !important;
  inset: 0 !important;
  z-index: 12000 !important;
  display: grid !important;
  place-items: center !important;
  width: 100vw !important;
  max-width: none !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(16, 24, 32, .28) !important;
  color: #fff !important;
  box-shadow: none !important;
  backdrop-filter: blur(9px) saturate(.92);
  -webkit-backdrop-filter: blur(9px) saturate(.92);
  cursor: pointer;
  animation: app-status-backdrop-in .18s ease-out both;
  box-sizing: border-box !important;
}

html body #recordingStatus.app-status-overlay::before {
  content: none !important;
  display: none !important;
}

#recordingStatus .app-status-card {
  --status-surface: #1368ce;
  --status-edge: #0d4f9e;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  width: min(100%, 560px);
  min-height: 96px;
  padding: 22px 24px;
  border: 0;
  border-radius: 8px;
  background: var(--status-surface);
  color: #fff;
  box-shadow:
    0 6px 0 var(--status-edge),
    0 22px 52px rgba(15, 23, 32, .28);
  box-sizing: border-box;
  animation: app-status-card-in .2s ease-out both;
}

#recordingStatus[data-message-mode="good"] .app-status-card {
  --status-surface: #26890c;
  --status-edge: #1b6507;
}

#recordingStatus[data-message-mode="warning"] .app-status-card {
  --status-surface: #d89e00;
  --status-edge: #a57600;
}

#recordingStatus[data-message-mode="error"] .app-status-card {
  --status-surface: #e21b3c;
  --status-edge: #b1122c;
}

#recordingStatus[data-message-mode="info"] .app-status-card {
  --status-surface: #1368ce;
  --status-edge: #0d4f9e;
}

#recordingStatus .app-status-icon {
  justify-self: center;
  width: 42px;
  height: 42px;
  background: #fff;
  -webkit-mask: none !important;
  mask: none !important;
  clip-path: inset(0);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .12));
}

#recordingStatus[data-message-mode="error"] .app-status-icon {
  border-radius: 50%;
  clip-path: none;
}

#recordingStatus[data-message-mode="warning"] .app-status-icon {
  width: 48px;
  height: 42px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

#recordingStatus[data-message-mode="info"] .app-status-icon {
  border-radius: 2px;
  clip-path: none;
}

#recordingStatus[data-message-mode="good"] .app-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 2px;
  clip-path: none;
  transform: rotate(45deg);
}

#recordingStatus .app-status-text {
  min-width: 0;
  color: inherit;
  color: #fff;
  font-size: clamp(1rem, 2.5vw, 1.14rem);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

@keyframes app-status-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes app-status-card-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 420px) {
  #recordingStatus .app-status-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    min-height: 82px;
    padding: 17px 16px;
  }

  #recordingStatus .app-status-icon {
    width: 36px;
    height: 36px;
  }

  #recordingStatus[data-message-mode="warning"] .app-status-icon {
    width: 40px;
    height: 35px;
  }

  #recordingStatus[data-message-mode="good"] .app-status-icon {
    width: 31px;
    height: 31px;
  }

  #recordingStatus .app-status-text {
    font-size: .96rem;
  }
}

/* Final screen actions remain centered when narrow layouts wrap their buttons. */
:is(
  .button-bar:not(.recording-controls),
  .profile-ok-row,
  .profile-add-group-actions,
  .map-action-row,
  .summary-modal-actions,
  .confirm-modal-actions
) {
  justify-content: center !important;
  justify-items: center !important;
  align-items: center !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

@media (max-width: 620px) {
  :is(
    .button-bar:not(.recording-controls),
    .profile-ok-row,
    .profile-add-group-actions,
    .map-action-row,
    .summary-modal-actions,
    .confirm-modal-actions
  ) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  :is(
    .button-bar:not(.recording-controls),
    .profile-ok-row,
    .profile-add-group-actions,
    .map-action-row,
    .summary-modal-actions,
    .confirm-modal-actions
  ) > button {
    flex: 0 1 168px !important;
    width: min(100%, 168px) !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Modal actions grow vertically for translated labels instead of clipping them. */
:is(.summary-modal-actions, .confirm-modal-actions) > button {
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 44px !important;
  height: auto !important;
  padding: 10px 14px !important;
  line-height: 1.18 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  text-align: center !important;
}

:is(.summary-modal-actions, .confirm-modal-actions) > button > span {
  min-width: 0;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

@media (max-width: 420px) {
  :is(.summary-modal-actions, .confirm-modal-actions) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  :is(.summary-modal-actions, .confirm-modal-actions) > button {
    width: 100% !important;
    min-height: 48px !important;
  }
}

@media (max-width: 340px) {
  :is(.summary-modal-actions, .confirm-modal-actions) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Stop has a square glyph, so keep its optical center consistent in every audio control. */
html body button.recording-action-btn:is(.playing, .stop) > svg[data-sound-routes-icon="stop"],
html body button.popup-mini-audio-btn.stop > svg[data-sound-routes-icon="stop"],
html body #recordingPanel #playAudioBtn.playing > svg[data-sound-routes-icon="stop"],
html body #recordingPanel #startRecBtn.recording-active > svg[data-sound-routes-icon="stop"],
html body #recordingPanel #stopAudioBtn > svg {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  align-self: center !important;
  justify-self: center !important;
  margin: 0 !important;
  transform: translate3d(0, -2px, 0) !important;
  transform-origin: 50% 50% !important;
}

/* Soundwalk progress and GPS quality use the same semantic traffic-light scale. */
#mapCaptureArea .map-progress-status-stack {
  display: flex !important;
  flex: 0 1 auto !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  max-width: min(48%, 310px) !important;
  pointer-events: none !important;
}

#mapCaptureArea .map-progress-status-stack .diagnostic-pill {
  width: max-content !important;
  max-width: 100% !important;
}

#mapCaptureArea .map-location-strip .map-status-metric.good .diagnostic-value {
  color: #2f8a62 !important;
}

#mapCaptureArea .map-location-strip .map-status-metric.approximate .diagnostic-value {
  color: #c48718 !important;
}

#mapCaptureArea .map-location-strip .map-status-metric:is(.error, .weak) .diagnostic-value {
  color: #c6534b !important;
}

#mapCaptureArea .map-location-strip .map-status-metric .map-status-icon {
  color: var(--sr-map-blue, #4f7ea8) !important;
  stroke: currentColor !important;
}

#mapGroupsLegend .map-legend-section,
#mapGroupsLegend .map-legend-section-label {
  align-items: center !important;
}

#mapGroupsLegend .map-legend-section-label {
  align-self: center !important;
}

#mapGroupsLegend .map-legend-section-label-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 16px !important;
}

#mapPanel #mapQuickRecordBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(132, 73, 64, .5) !important;
  border-radius: 9px !important;
  background: #b9655a !important;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(145, 76, 68, .24) !important;
  cursor: pointer !important;
}

#mapPanel #mapQuickRecordBtn:is(:hover, :focus-visible) {
  background: #a8564d !important;
  transform: translateY(-1px) !important;
}

#mapPanel #mapQuickRecordBtn svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
}

.soundwalk-map-preview-card {
  width: min(94vw, 980px) !important;
  max-height: calc(100dvh - 36px) !important;
  overflow: hidden !important;
  border: 1px solid rgba(184, 201, 214, .95) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, .98) !important;
  box-shadow: 0 24px 72px rgba(20, 32, 43, .28) !important;
}

.soundwalk-map-preview-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 13px 14px 11px 18px !important;
  border-bottom: 1px solid rgba(195, 208, 218, .78) !important;
}

.soundwalk-map-preview-head h4 {
  margin: 0 !important;
  color: #3b4855 !important;
  font-size: 1rem !important;
  font-weight: 850 !important;
}

.soundwalk-map-preview-body {
  display: grid !important;
  place-items: center !important;
  padding: 14px !important;
  background: #eef4f6 !important;
}

.soundwalk-map-preview-body img {
  display: block !important;
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  object-fit: cover !important;
  border: 1px solid rgba(181, 199, 211, .9) !important;
  border-radius: 10px !important;
}

.soundwalk-map-preview-loading {
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  min-height: min(52vw, 480px) !important;
  color: #596a78 !important;
  font-weight: 800 !important;
}

.profile-soundwalk-group-line {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 7px !important;
}

.profile-soundwalk-group-line > strong {
  color: var(--safe-profile-label, #526574) !important;
}

.profile-edit-soundwalk-map-section {
  display: grid !important;
  gap: 10px !important;
  padding: 14px !important;
}

.profile-edit-soundwalk-map-heading {
  color: #46535e !important;
  font-weight: 750 !important;
}

.profile-edit-soundwalk-map-heading .label-icon {
  color: var(--accent) !important;
}

.profile-edit-soundwalk-map-heading .label-icon svg {
  display: block !important;
  width: 19px !important;
  height: 19px !important;
}

.profile-edit-soundwalk-route-map {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: clamp(260px, 48vw, 460px) !important;
  min-height: 260px !important;
  overflow: hidden !important;
  border: 1px solid rgba(174, 195, 209, .88) !important;
  border-radius: 12px !important;
  background: #e9f0f3 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .62) !important;
}

.profile-edit-soundwalk-map-empty {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
  color: #60717f !important;
  font-weight: 750 !important;
  text-align: center !important;
}

.profile-edit-soundwalk-route-map .leaflet-control-zoom a {
  color: #33495a !important;
}

.profile-edit-route-point {
  pointer-events: none !important;
}

.profile-edit-route-point-icon-wrap {
  display: grid !important;
  place-items: center !important;
  background: transparent !important;
  border: 0 !important;
}

.profile-edit-route-point-marker {
  display: block !important;
  width: 15px !important;
  height: 15px !important;
  border: 2.5px solid #fff !important;
  border-radius: 999px !important;
  background: var(--route-point-color, var(--accent)) !important;
  box-shadow: 0 3px 9px rgba(25, 35, 44, .28) !important;
}

.profile-edit-route-point-selected .profile-edit-route-point-marker,
.profile-edit-route-point-selected .route-endpoint-icon {
  background: color-mix(in srgb, var(--route-point-color, var(--route-endpoint-color, var(--accent))) 72%, #17212a) !important;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .94), 0 5px 14px rgba(23, 33, 42, .34) !important;
}

.profile-edit-route-point-selected .profile-edit-route-point-marker {
  transform: scale(1.16) !important;
}

.profile-edit-route-point-selected .route-endpoint-icon {
  transform: scale(1.08) !important;
}

.profile-edit-soundwalk-route-map .leaflet-marker-draggable,
.profile-edit-soundwalk-route-map .profile-edit-route-point-icon-wrap,
.profile-edit-soundwalk-route-map .route-endpoint-icon-wrap {
  cursor: grab !important;
  touch-action: none !important;
}

.profile-edit-soundwalk-route-map .leaflet-marker-draggable:active,
.profile-edit-soundwalk-route-map .route-marker-dragging {
  cursor: grabbing !important;
}

@media (max-width: 520px) {
  .profile-edit-soundwalk-route-map {
    height: 280px !important;
    min-height: 280px !important;
  }
}

@media (max-width: 420px) {
  #mapCaptureArea .map-progress-status-stack {
    gap: 5px !important;
    max-width: 46% !important;
  }

  #mapCaptureArea .map-progress-status-stack .diagnostic-pill {
    padding: 5px 8px !important;
  }
}

/* Main sound map: fixed cinematic frame and explicit direction-follow state. */
#mapCaptureArea {
  width: min(100%, 960px) !important;
  max-width: 960px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
}

#mapCaptureArea #map {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
}

.map-floating-btn.app-header-action.compass {
  background: linear-gradient(135deg, #5f8b81, #47736b) !important;
}

.map-floating-btn.app-header-action.compass.is-active {
  background: linear-gradient(135deg, #3e8f7e, #2a6d61) !important;
  outline: 0 !important;
  outline-offset: 0 !important;
}

.map-compass-follow-active .leaflet-map-pane {
  transition: none !important;
  will-change: transform !important;
}

.map-compass-follow-active .leaflet-marker-icon,
.map-compass-follow-active .leaflet-tooltip,
.map-compass-follow-active .leaflet-popup {
  rotate: var(--map-compass-counter-rotation, 0deg) !important;
}

.map-compass-follow-active .leaflet-popup {
  transform-origin: 50% 100% !important;
}

/* Group owners review join requests directly above their group list. */
#profileGroupsPanel .organization-requests-panel {
  display: grid;
  gap: 0;
  width: 100%;
  margin-top: 14px;
  border: 1px solid #dfc27a;
  border-left: 4px solid #c4932f;
  border-radius: 8px;
  background: #fffaf0;
  overflow: hidden;
}

#profileGroupsPanel .organization-requests-panel.hidden {
  display: none !important;
}

#profileGroupsPanel .organization-requests-title {
  padding: 13px 15px;
  color: #6f5320;
  background: #fff3d7;
  border-bottom: 1px solid #ead8ad;
  font-weight: 800;
}

#profileGroupsPanel .organization-requests-title .label-row {
  margin: 0;
}

#profileGroupsPanel .organization-requests-title .label-icon {
  color: #b47b14;
}

#profileGroupsPanel .organization-request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 15px;
}

#profileGroupsPanel .organization-request-card + .organization-request-card {
  border-top: 1px solid #eadfca;
}

#profileGroupsPanel .organization-request-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#profileGroupsPanel .organization-request-user img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px #d9caa9;
}

#profileGroupsPanel .organization-request-user > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#profileGroupsPanel .organization-request-user strong,
#profileGroupsPanel .organization-request-user small {
  overflow-wrap: anywhere;
}

#profileGroupsPanel .organization-request-user strong {
  color: #344553;
  font-size: .94rem;
}

#profileGroupsPanel .organization-request-user small {
  color: #66737d;
  font-size: .78rem;
  line-height: 1.35;
}

#profileGroupsPanel .organization-request-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#profileGroupsPanel .organization-request-action.btn-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  width: auto !important;
  min-width: 78px !important;
  min-height: 42px !important;
  height: 42px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-weight: 800 !important;
}

#profileGroupsPanel .organization-request-action.approve {
  background: #4f8c63 !important;
}

#profileGroupsPanel .organization-request-action.reject {
  background: #a65f54 !important;
}

#profileGroupsPanel .organization-request-action svg,
#profileGroupsPanel .organization-request-action svg * {
  width: 17px !important;
  height: 17px !important;
  color: #fff !important;
  stroke: #fff !important;
}

#profileGroupsPanel .organization-request-action:disabled {
  opacity: .58 !important;
  cursor: wait !important;
}

@media (max-width: 560px) {
  #profileGroupsPanel .organization-request-card {
    grid-template-columns: minmax(0, 1fr);
  }

  #profileGroupsPanel .organization-request-actions {
    justify-content: flex-end;
  }
}

/* 1.4.5 follow, notifications, map legend and touch-map UI corrections. */
#profileScreen .profile-main-card .intro-title-lockup .profile-title-actions > :is(
  .profile-title-follow-btn,
  .profile-title-edit-btn,
  .profile-title-delete-btn
) {
  box-sizing: border-box !important;
  width: var(--action-size, 36px) !important;
  min-width: var(--action-size, 36px) !important;
  max-width: var(--action-size, 36px) !important;
  height: var(--action-size, 36px) !important;
  min-height: var(--action-size, 36px) !important;
  max-height: var(--action-size, 36px) !important;
  flex: 0 0 var(--action-size, 36px) !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: var(--action-radius, 10px) !important;
}

#profileScreen #profileTitleFollowBtn,
#profileScreen #profileTitleEditBtn,
#profileScreen #profileTitleDeleteUserBtn {
  width: var(--action-size, 36px) !important;
  min-width: var(--action-size, 36px) !important;
  max-width: var(--action-size, 36px) !important;
  height: var(--action-size, 36px) !important;
  min-height: var(--action-size, 36px) !important;
  max-height: var(--action-size, 36px) !important;
  flex: 0 0 var(--action-size, 36px) !important;
  border-radius: var(--action-radius, 10px) !important;
}

#profileScreen .profile-main-card .intro-title-lockup .profile-title-actions > :is(
  .profile-title-follow-btn,
  .profile-title-edit-btn,
  .profile-title-delete-btn
) svg {
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
}

#profileScreen .profile-main-card .intro-title-lockup .profile-title-follow-btn.hidden,
#profileScreen .profile-main-card .intro-title-lockup .profile-title-follow-btn[hidden] {
  display: none !important;
}

#profileScreen .profile-overview-groups-cell > span:first-child {
  display: flex !important;
  width: 100% !important;
  padding-bottom: 9px !important;
  border-bottom: 1px solid rgba(79, 126, 168, .15) !important;
}

#profileScreen .profile-overview-groups-cell > #profileOverviewGroups {
  margin-top: 9px !important;
}

#profileScreen #profileConnectionsBox .profile-connection-row {
  align-items: center !important;
}

#profileScreen .profile-connections-empty {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 34px !important;
  padding: 0 !important;
  line-height: 1 !important;
}

#notificationsBtn.app-header-action,
#notificationsBtn.app-header-action > svg {
  box-sizing: border-box !important;
}

#notificationsBtn.app-header-action > svg {
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  min-width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  min-height: var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
  overflow: visible !important;
  color: #fff !important;
  stroke: currentColor !important;
}

.app-header-actions > :is(
  #modeBtn,
  #profileBtn,
  #notificationsBtn,
  #settingsBtn,
  #logoutBtn
),
#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
) {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--mini-btn-size, 42px) !important;
  min-width: var(--mini-btn-size, 42px) !important;
  max-width: var(--mini-btn-size, 42px) !important;
  height: var(--mini-btn-size, 42px) !important;
  min-height: var(--mini-btn-size, 42px) !important;
  max-height: var(--mini-btn-size, 42px) !important;
  flex: 0 0 var(--mini-btn-size, 42px) !important;
  margin: 0 !important;
  padding: 0 !important;
  border-width: 1px !important;
  border-radius: var(--mini-btn-radius, 14px) !important;
  gap: 0 !important;
  line-height: 1 !important;
}

.app-header-actions > :is(
  #modeBtn,
  #profileBtn,
  #notificationsBtn,
  #settingsBtn,
  #logoutBtn
) > svg,
#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
) > svg {
  box-sizing: border-box !important;
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  min-width: var(--mini-btn-icon, 19px) !important;
  max-width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  min-height: var(--mini-btn-icon, 19px) !important;
  max-height: var(--mini-btn-icon, 19px) !important;
  flex: 0 0 var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
}

#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
) {
  border: 0 !important;
  color: #fff !important;
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11) !important;
  backdrop-filter: none !important;
}

#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
):is(:hover, :focus, :focus-visible, .is-active) {
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11) !important;
}

#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
):is(:hover, :focus-visible) {
  transform: translateY(-1px) !important;
  box-shadow: 0 11px 24px rgba(10, 20, 28, .21) !important;
}

#mapPanel :is(
  #mapQuickRecordBtn,
  #recenterMapBtn,
  #mapCompassFollowBtn,
  #mapLayerBtn
):active {
  transform: translateY(0) scale(.98) !important;
}

.notifications-section-description {
  width: min(100%, 760px) !important;
  margin: 0 !important;
  color: #687783 !important;
  font-size: .88rem !important;
  font-weight: 520 !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
}

.sound-cluster-entry.has-image {
  grid-template-columns: 30px minmax(0, 1fr) !important;
  align-items: center !important;
  column-gap: 8px !important;
}

.sound-cluster-entry-thumb {
  display: block !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  overflow: hidden !important;
  border: 1px solid rgba(137, 164, 184, .34) !important;
  border-radius: 7px !important;
  background: #eef4f7 !important;
}

.sound-cluster-entry-thumb img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.sound-cluster-entry-copy {
  display: grid !important;
  gap: 2px !important;
  min-width: 0 !important;
}

.sound-cluster-entry-title,
.sound-cluster-entry-copy small {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

.sound-cluster-entry:hover,
.sound-cluster-entry:focus-visible {
  border-color: rgba(79, 126, 168, .52) !important;
  background: #fff !important;
  box-shadow: 0 5px 12px rgba(42, 55, 64, .09) !important;
}

#recordingPanel #coordinatesField .coordinate-row > :is(
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn
),
#mainScreen #recordingPanel #photoField :is(
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
) {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--mini-btn-size, 42px) !important;
  min-width: var(--mini-btn-size, 42px) !important;
  max-width: var(--mini-btn-size, 42px) !important;
  height: var(--mini-btn-size, 42px) !important;
  min-height: var(--mini-btn-size, 42px) !important;
  max-height: var(--mini-btn-size, 42px) !important;
  flex: 0 0 var(--mini-btn-size, 42px) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--mini-btn-radius, 14px) !important;
  gap: 0 !important;
  line-height: 1 !important;
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11) !important;
  justify-self: center !important;
}

#recordingPanel #coordinatesField .coordinate-row {
  grid-template-columns: minmax(0, 1fr) repeat(3, var(--mini-btn-size, 42px)) !important;
}

#recordingPanel #photoField .photo-preview-shell {
  grid-template-columns: repeat(4, var(--mini-btn-size, 42px)) !important;
}

#recordingPanel #coordinatesField .coordinate-row > :is(
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn
) > svg,
#mainScreen #recordingPanel #photoField :is(
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
) > svg {
  box-sizing: border-box !important;
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  min-width: var(--mini-btn-icon, 19px) !important;
  max-width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  min-height: var(--mini-btn-icon, 19px) !important;
  max-height: var(--mini-btn-icon, 19px) !important;
  flex: 0 0 var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
  stroke: currentColor !important;
}

#recordingPanel #coordinatesField .coordinate-row > :is(
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn
):is(:hover, :focus-visible),
#mainScreen #recordingPanel #photoField :is(
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
):is(:hover, :focus-visible) {
  transform: translateY(-1px) !important;
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: 0 11px 24px rgba(10, 20, 28, .21) !important;
}

#recordingPanel #coordinatesField .coordinate-row > :is(
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn
):active,
#mainScreen #recordingPanel #photoField :is(
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
):active {
  transform: translateY(0) scale(.98) !important;
}

#recordingPanel #coordinatesField #editSoundLocationMapToggleBtn.is-active {
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: 0 6px 15px rgba(42, 55, 64, .11) !important;
}

#mainScreen #recordingPanel #photoField :is(
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
):disabled {
  opacity: .45 !important;
  filter: saturate(.72) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================
   1.4.5 application-wide visual consistency lock
   Shared contracts for labels, icons, buttons, pills, choices,
   language controls, image tools and range faders.
   ========================================================== */
:root {
  --ui-header-action-size: 42px;
  --ui-context-action-size: 36px;
  --ui-image-action-size: 32px;
  --ui-add-action-size: 40px;
  --ui-choice-icon-size: 42px;
  --ui-label-size: .875rem;
  --ui-pill-size: .78rem;
  --ui-heading-pill-tracking: .05em;
  --ui-label-color: #5f6f7f;
  --ui-description-color: #687783;
  --ui-label-icon-color: #bd8429;
  --ui-fader-zoom: #7b6aa4;
  --ui-fader-brightness: #c4913e;
  --ui-fader-saturation: #4d9aaa;
  --ui-fader-distance: #4f83a8;
}

/* Labels use one baseline, one icon box and sentence-style capitalization. */
.label-row,
.intro-field-label,
.auth-image-label,
.settings-section-heading,
.settings-device-label,
.settings-visibility-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 24px !important;
  max-width: 100% !important;
  margin-top: 0 !important;
  color: var(--ui-label-color) !important;
  font-family: var(--font) !important;
  font-size: var(--ui-label-size) !important;
  font-weight: 750 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

:is(
  .label-row,
  .intro-field-label,
  .auth-image-label,
  .settings-section-heading,
  .settings-device-label,
  .settings-visibility-label
) :is(.label-icon, .settings-device-label-icon, .section-heading-icon) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ui-label-icon-color) !important;
  box-shadow: none !important;
}

:is(
  .label-row,
  .intro-field-label,
  .auth-image-label,
  .settings-section-heading,
  .settings-device-label,
  .settings-visibility-label
) :is(.label-icon, .settings-device-label-icon, .section-heading-icon) > svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  color: currentColor !important;
  stroke: currentColor !important;
}

.section-description,
.profile-section-description,
.settings-intro,
.notifications-section-description,
.auth-section-heading > p,
.login-section-heading > p {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  color: var(--ui-description-color) !important;
  font-family: var(--font) !important;
  font-size: .84rem !important;
  font-weight: 600 !important;
  line-height: 1.58 !important;
  letter-spacing: 0 !important;
}

/* Pills share typography and density while retaining their semantic accents. */
:is(
  .role-chip,
  .organization-chip,
  .member-chip,
  .pill-chip,
  .member-pill,
  .role-pill,
  .profile-group-chip,
  .profile-group-member-chip,
  .profile-connection-chip,
  .recording-card-chip,
  .map-popup-group-pill,
  .legend-group-pill,
  .meta-value-chip,
  .group-summary-pill
) {
  font-family: var(--font) !important;
  font-size: var(--ui-pill-size) !important;
  font-weight: 750 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

/* Icon geometry is stable even when older rules target individual SVGs. */
button > svg,
[role="button"] > svg {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  color: currentColor;
  stroke: currentColor;
}

.app-header-actions > :is(
  #profileBtn,
  #notificationsBtn,
  #settingsBtn,
  #logoutBtn,
  .app-header-action
),
.map-floating-controls > .map-floating-btn {
  width: var(--ui-header-action-size) !important;
  height: var(--ui-header-action-size) !important;
  min-width: var(--ui-header-action-size) !important;
  min-height: var(--ui-header-action-size) !important;
  max-width: var(--ui-header-action-size) !important;
  max-height: var(--ui-header-action-size) !important;
  flex: 0 0 var(--ui-header-action-size) !important;
  padding: 0 !important;
  border-radius: 13px !important;
}

:is(
  .recording-action-btn,
  .popup-mini-action-btn,
  .popup-mini-audio-btn,
  .profile-group-edit-btn,
  .profile-group-delete-btn,
  .profile-title-edit-btn,
  .profile-title-delete-btn
) {
  width: var(--ui-context-action-size) !important;
  height: var(--ui-context-action-size) !important;
  min-width: var(--ui-context-action-size) !important;
  min-height: var(--ui-context-action-size) !important;
  max-width: var(--ui-context-action-size) !important;
  max-height: var(--ui-context-action-size) !important;
  flex: 0 0 var(--ui-context-action-size) !important;
  padding: 0 !important;
  border-radius: 10px !important;
}

.entry-popup .popup-side-actions > :is(.popup-mini-action-btn, .popup-mini-audio-btn),
.route-popup .popup-side-actions > .popup-mini-action-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  flex-basis: 32px !important;
  border-radius: 9px !important;
}

:is(
  .choice-card .choice-icon-button,
  .choice-card .choice-icon,
  .choice-card .toggle-icon,
  .archive-toggle-icon,
  .soundmap-toggle-icon,
  .library-toggle-icon,
  .settings-map-grid .choice-card .choice-icon-button
) {
  width: var(--ui-choice-icon-size) !important;
  height: var(--ui-choice-icon-size) !important;
  min-width: var(--ui-choice-icon-size) !important;
  min-height: var(--ui-choice-icon-size) !important;
  max-width: var(--ui-choice-icon-size) !important;
  max-height: var(--ui-choice-icon-size) !important;
  flex: 0 0 var(--ui-choice-icon-size) !important;
  padding: 0 !important;
  border-radius: 12px !important;
}

.choice-card-inner,
.gender-choice,
.archive-toggle,
.soundmap-toggle,
.library-toggle {
  min-height: 60px;
  border-radius: 12px !important;
  letter-spacing: 0 !important;
}

.choice-title,
.toggle-title {
  font-family: var(--font) !important;
  font-size: .84rem !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
}

.choice-info,
.toggle-info {
  font-family: var(--font) !important;
  font-size: .78rem !important;
  line-height: 1.38 !important;
  letter-spacing: 0 !important;
}

/* One semantic color per action, independent of the page using it. */
:is(.recording-action-btn.play, .popup-mini-audio-btn.play) {
  background: var(--ui-action-play) !important;
}

:is(.recording-action-btn.record, .recording-action-btn.stop, .recording-action-btn.playing, .popup-mini-audio-btn.record, .popup-mini-audio-btn.stop) {
  background: var(--ui-action-audio) !important;
}

:is(.recording-action-btn.edit, .popup-mini-action-btn.edit, .profile-title-edit-btn, .profile-group-edit-btn, #settingsProfileEditOpenBtn) {
  background: var(--ui-action-edit) !important;
}

:is(.recording-action-btn.delete, .popup-mini-action-btn.delete, .profile-title-delete-btn, .profile-group-delete-btn, .preview-history-btn.delete, .photo-history-btn.delete) {
  background: var(--ui-action-delete) !important;
}

:is(.recording-action-btn.details, .recording-action-btn.report, .popup-mini-action-btn.view, .popup-mini-action-btn.report, .popup-mini-action-btn.route-detail-btn) {
  background: var(--ui-action-info) !important;
}

:is(.recording-action-btn.locate, .recording-action-btn.map, .coordinate-recenter-btn, #useCurrentCoordinatesBtn) {
  background: var(--ui-action-map) !important;
}

:is(.recording-action-btn.download, .popup-mini-action-btn.download, .preview-history-btn.reset, .preview-history-btn.redo, .preview-history-btn.nav, .photo-history-btn.reset, .photo-history-btn.redo, .photo-history-btn.nav, .coordinate-paste-btn, #pasteCoordinatesBtn) {
  background: var(--ui-action-neutral) !important;
}

:is(.photo-action-btn.upload, .btn-upload) {
  background: var(--ui-action-media) !important;
}

.clear-filters-btn {
  background: var(--ui-action-clear) !important;
}

/* Play triangles need horizontal optical correction; stop stays mathematically centered. */
button.recording-action-btn:is(.stop, .playing) > svg[data-sound-routes-icon],
button.popup-mini-audio-btn.stop > svg[data-sound-routes-icon],
#stopAudioBtn > svg[data-sound-routes-icon] {
  position: static !important;
  margin: 0 !important;
  transform: none !important;
}

button.recording-action-btn.play > svg[data-sound-routes-icon],
button.popup-mini-audio-btn.play > svg[data-sound-routes-icon],
#playAudioBtn > svg[data-sound-routes-icon] {
  position: static !important;
  margin: 0 !important;
  transform: translateX(1px) !important;
}

/* Image tools are square and cannot collapse into fractional grid columns. */
:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor {
  --editor-preview-size: 146px;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor > .ui-image-editor__preview-actions {
  grid-template-columns: repeat(4, var(--ui-image-action-size)) !important;
  justify-content: center !important;
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > :is(.photo-action-btn, .preview-history-btn, .photo-history-btn) {
  width: var(--ui-image-action-size) !important;
  height: var(--ui-image-action-size) !important;
  min-width: var(--ui-image-action-size) !important;
  min-height: var(--ui-image-action-size) !important;
  max-width: var(--ui-image-action-size) !important;
  max-height: var(--ui-image-action-size) !important;
  justify-self: center !important;
  padding: 0 !important;
  border-radius: 9px !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor .ui-image-editor__preview-actions > :is(.photo-action-btn, .preview-history-btn, .photo-history-btn) > svg {
  width: 16px !important;
  height: 16px !important;
}

/* Every range control shares one geometry; its function supplies the color. */
.photo-zoom-control { --ui-fader-color: var(--ui-fader-zoom); }
.photo-brightness-control { --ui-fader-color: var(--ui-fader-brightness); }
.photo-saturation-control { --ui-fader-color: var(--ui-fader-saturation); }
#hearingDistanceInput { --ui-fader-color: var(--ui-fader-distance); }

.photo-adjust-control input[type="range"],
#hearingDistanceInput {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  accent-color: var(--ui-fader-color) !important;
  cursor: pointer;
}

.photo-adjust-control input[type="range"]::-webkit-slider-runnable-track,
#hearingDistanceInput::-webkit-slider-runnable-track {
  height: 6px !important;
  border: 1px solid color-mix(in srgb, var(--ui-fader-color) 30%, #c8d4da) !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-fader-color) 32%, white), color-mix(in srgb, var(--ui-fader-color) 8%, white)) !important;
}

.photo-adjust-control input[type="range"]::-webkit-slider-thumb,
#hearingDistanceInput::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  margin-top: -8px !important;
  border: 3px solid #fff !important;
  border-radius: 50% !important;
  background: var(--ui-fader-color) !important;
  box-shadow: 0 2px 8px rgba(37, 54, 65, .22) !important;
}

.photo-adjust-control input[type="range"]::-moz-range-track,
#hearingDistanceInput::-moz-range-track {
  height: 6px !important;
  border: 1px solid color-mix(in srgb, var(--ui-fader-color) 30%, #c8d4da) !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-fader-color) 32%, white), color-mix(in srgb, var(--ui-fader-color) 8%, white)) !important;
}

.photo-adjust-control input[type="range"]::-moz-range-progress,
#hearingDistanceInput::-moz-range-progress {
  height: 6px !important;
  border-radius: 999px !important;
  background: var(--ui-fader-color) !important;
}

.photo-adjust-control input[type="range"]::-moz-range-thumb,
#hearingDistanceInput::-moz-range-thumb {
  width: 14px !important;
  height: 14px !important;
  border: 3px solid #fff !important;
  border-radius: 50% !important;
  background: var(--ui-fader-color) !important;
  box-shadow: 0 2px 8px rgba(37, 54, 65, .22) !important;
}

.photo-adjust-control input[type="range"]:focus-visible,
#hearingDistanceInput:focus-visible {
  outline: 0 !important;
}

.photo-adjust-control input[type="range"]:focus-visible::-webkit-slider-thumb,
#hearingDistanceInput:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-fader-color) 22%, transparent), 0 2px 8px rgba(37, 54, 65, .22) !important;
}

/* Language cards remain five equal, stable choices at every viewport. */
#settingsScreen .settings-language-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  gap: 8px !important;
}

#settingsScreen .settings-language-grid .language-choice-card,
#settingsScreen .settings-language-grid .language-card-inner {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 54px !important;
  box-sizing: border-box !important;
}

#settingsScreen .settings-language-grid .language-card-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px !important;
  border-radius: 12px !important;
  transform: none !important;
}

#settingsScreen .settings-language-grid .language-flag {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 26px !important;
  min-width: 30px !important;
  min-height: 26px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-size: 1.5rem !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

#settingsScreen .language-choice-card:has(input:checked) .language-card-inner {
  transform: none !important;
}

@media (max-width: 620px) {
  :root {
    --ui-label-size: .84rem;
    --ui-pill-size: .76rem;
  }

  #settingsScreen .settings-language-grid {
    gap: 6px !important;
  }

  #settingsScreen .settings-language-grid .language-card-inner {
    min-height: 50px !important;
    padding: 6px !important;
  }

  :is(
    #authScreen #signupPanel,
    #profileScreen #profileEditPanel,
    #profileScreen #profileCreateGroupPanel,
    #profileScreen #profileEditSoundPanel,
    #creationSetupScreen,
    #profileScreen #profileEditSoundwalkPanel
  ) .auth-image-field.ui-image-editor {
    --editor-preview-size: 146px;
  }
}

/* Screen-level legacy rules used IDs, so these final selectors keep the
   shared label and add-button contracts authoritative. */
:is(#authScreen, #profileScreen, #settingsScreen, #introScreen, #mainScreen, #notificationsScreen) :is(
  .label-row,
  .intro-field-label,
  .auth-image-label,
  .settings-section-heading,
  .settings-device-label,
  .settings-visibility-label
) {
  color: var(--ui-label-color) !important;
  font-family: var(--font) !important;
  font-size: var(--ui-label-size) !important;
  font-weight: 750 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

/* ==========================================================
   Role contracts
   Elements that perform the same job share the same geometry,
   typography and semantic color across every screen.
   ========================================================== */
:root {
  --ui-field-height: 48px;
  --ui-field-radius: 12px;
  --ui-field-font-size: .9375rem;
  --ui-field-font-weight: 400;
  --ui-search-font-weight: 600;
  --ui-filter-font-weight: 800;
  --ui-command-width: 148px;
  --ui-command-height: 46px;
  --ui-command-radius: 14px;
  --ui-command-icon-size: 16px;
  --sr-text-action-height: 46px;
  --ui-toolbar-action-size: 42px;
  --ui-toolbar-action-radius: 13px;
  --ui-toolbar-icon-size: 19px;
  --ui-image-action-size: 32px;
  --ui-image-action-radius: 9px;
  --ui-image-action-icon-size: 16px;
  --ui-pagination-size: 38px;
  --ui-inline-info-size: 22px;
}

/* Form controls: one standard field and one deliberately compact pager. */
:is(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  input:not([type]),
  select,
  textarea
) {
  box-sizing: border-box !important;
  border-radius: var(--ui-field-radius) !important;
  font-family: var(--font) !important;
  font-size: var(--ui-field-font-size) !important;
  font-weight: var(--ui-field-font-weight) !important;
  letter-spacing: 0 !important;
}

:is(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  input:not([type]),
  select
):not(#signupGenderSelect):not(#profileGenderSelect):not([id$="PageSizeSelect"]) {
  min-height: var(--ui-field-height) !important;
  height: var(--ui-field-height) !important;
  background-color: #fbfdfe !important;
}

textarea {
  min-height: 104px !important;
  background-color: #fbfdfe !important;
}

input[type="search"] {
  font-weight: var(--ui-search-font-weight) !important;
}

:is(
  #mapFilterPanel,
  #savedPanel,
  #profileSoundsPanel,
  #profileSoundwalksPanel,
  #profileGroupsPanel
) select:not([id$="PageSizeSelect"]),
:is(#recordingOrganizationSelect, #recordingSoundwalkSelect, #allGroupsToggle) {
  font-weight: var(--ui-filter-font-weight) !important;
}

select[id$="PageSizeSelect"] {
  width: auto !important;
  min-width: var(--ui-pagination-size) !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
  font-weight: var(--ui-filter-font-weight) !important;
}

input[type="color"] {
  box-sizing: border-box !important;
  width: 50px !important;
  height: 44px !important;
  min-width: 50px !important;
  min-height: 44px !important;
  border-radius: var(--ui-field-radius) !important;
  background: #fbfdfe !important;
}

/* Labels and introductory copy use one baseline on every screen. */
:is(#authScreen, #profileScreen, #settingsScreen, #introScreen, #mainScreen, #notificationsScreen) :is(
  .label-row,
  .intro-field-label,
  .auth-image-label,
  .settings-section-heading,
  .settings-device-label,
  .settings-visibility-label
) {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 24px !important;
  max-width: 100% !important;
  margin-top: 0 !important;
}

:is(#mapPanel, #recordingPanel, #savedPanel) .section-description,
#profileScreen .profile-section-description,
#settingsScreen .settings-intro,
#notificationsScreen .notifications-section-description,
#authScreen :is(.auth-section-heading, .login-section-heading) > p,
#introScreen .auth-section-heading > p {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
  color: var(--ui-description-color) !important;
  font-family: var(--font) !important;
  font-size: .84rem !important;
  font-weight: 600 !important;
  line-height: 1.58 !important;
  letter-spacing: 0 !important;
}

/* Choice cards keep identical icon and container geometry. */
#settingsScreen .settings-map-grid .choice-card-inner,
#settingsScreen .settings-device-grid .choice-card-inner,
.choice-card-inner,
.gender-choice,
.archive-toggle,
.soundmap-toggle,
.library-toggle {
  min-height: 60px !important;
  border-radius: 12px !important;
}

/* Header and map toolbars are the same control family. */
.app-header-actions > button,
.map-floating-controls > .map-floating-btn {
  width: var(--ui-toolbar-action-size) !important;
  height: var(--ui-toolbar-action-size) !important;
  min-width: var(--ui-toolbar-action-size) !important;
  min-height: var(--ui-toolbar-action-size) !important;
  max-width: var(--ui-toolbar-action-size) !important;
  max-height: var(--ui-toolbar-action-size) !important;
  flex: 0 0 var(--ui-toolbar-action-size) !important;
  padding: 0 !important;
  border-radius: var(--ui-toolbar-action-radius) !important;
}

.app-header-actions > button > svg,
.map-floating-controls > .map-floating-btn > svg {
  width: var(--ui-toolbar-icon-size) !important;
  height: var(--ui-toolbar-icon-size) !important;
  min-width: var(--ui-toolbar-icon-size) !important;
  min-height: var(--ui-toolbar-icon-size) !important;
}

/* Temporary, owner-only demo tools: one compact family with semantic actions. */
.app-header-demo-actions {
  justify-self: start !important;
  justify-content: flex-start !important;
  gap: clamp(5px, .8vw, 8px) !important;
}

.app-header-demo-actions[hidden] {
  display: none !important;
}

#demoSeedBtn.demo-seed-btn {
  background: var(--ui-action-info) !important;
  color: #fff !important;
}

#demoSeedBtn.demo-seed-btn.is-replace {
  background: var(--ui-action-clear) !important;
}

#demoSeedAppendBtn.demo-append-btn {
  background: var(--ui-action-add) !important;
  color: #fff !important;
}

#demoSeedRemoveBtn.demo-remove-btn {
  background: var(--ui-action-delete) !important;
  color: #fff !important;
}

.app-header-demo-actions > .demo-data-btn.is-loading > svg {
  animation: demo-data-control-pulse .8s ease-in-out infinite alternate;
}

@keyframes demo-data-control-pulse {
  from { opacity: .45; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

body[data-auth-state="logged-out"] .app-header-demo-actions {
  display: none !important;
}

/* At phone widths the two header toolbars use separate lines, avoiding overlap. */
@media (max-width: 430px) {
  body[data-demo-tools="visible"] .app-header {
    grid-template-rows: 94px minmax(0, 1fr) auto !important;
    min-height: clamp(268px, 82vw, 300px) !important;
  }

  body[data-demo-tools="visible"] .app-header > .app-header-actions:not(.app-header-demo-actions) {
    align-self: start !important;
  }

  body[data-demo-tools="visible"] .app-header-demo-actions {
    align-self: end !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-header-demo-actions > .demo-data-btn.is-loading > svg {
    animation: none !important;
    opacity: .7;
  }
}

#mainScreen #mapPanel .map-floating-controls > .map-floating-btn {
  border-radius: var(--ui-toolbar-action-radius) !important;
}

#mainScreen #mapPanel .map-floating-controls > .map-floating-btn > svg {
  width: var(--ui-toolbar-icon-size) !important;
  height: var(--ui-toolbar-icon-size) !important;
  min-width: var(--ui-toolbar-icon-size) !important;
  min-height: var(--ui-toolbar-icon-size) !important;
}

/* All plus/add controls share one touch target, icon and action color. */
#authScreen :is(#signupAddUserTypeBtn, #signupAddOrganizationBtn).compact-add-btn,
#profileScreen :is(
  #profileAddUserTypeBtn,
  #profileSendGroupRequestBtn,
  #profileCreateGroupFromGroupsBtn,
  #profileAddGroupFromGroupsBtn,
  #createGroupMemberAddBtn
).compact-add-btn,
.compact-add-btn {
  width: var(--ui-add-action-size) !important;
  height: var(--ui-add-action-size) !important;
  min-width: var(--ui-add-action-size) !important;
  min-height: var(--ui-add-action-size) !important;
  max-width: var(--ui-add-action-size) !important;
  max-height: var(--ui-add-action-size) !important;
  flex: 0 0 var(--ui-add-action-size) !important;
  padding: 0 !important;
  border-radius: 12px !important;
  background: var(--ui-action-add) !important;
  color: #fff !important;
}

#authScreen :is(#signupAddUserTypeBtn, #signupAddOrganizationBtn).compact-add-btn > svg,
#profileScreen :is(
  #profileAddUserTypeBtn,
  #profileSendGroupRequestBtn,
  #profileCreateGroupFromGroupsBtn,
  #profileAddGroupFromGroupsBtn,
  #createGroupMemberAddBtn
).compact-add-btn > svg,
.compact-add-btn > svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
}

#profileScreen #profileAddGroupFromGroupsBtn {
  background: var(--ui-action-add) !important;
}

#profileScreen #profileAddGroupPanel #profileSendGroupRequestBtn.compact-add-btn {
  width: var(--ui-add-action-size) !important;
  height: var(--ui-add-action-size) !important;
  min-width: var(--ui-add-action-size) !important;
  min-height: var(--ui-add-action-size) !important;
  max-width: var(--ui-add-action-size) !important;
  max-height: var(--ui-add-action-size) !important;
  flex: 0 0 var(--ui-add-action-size) !important;
  border-radius: 12px !important;
  background: var(--ui-action-add) !important;
}

#profileScreen #profileAddGroupPanel #profileSendGroupRequestBtn.compact-add-btn > svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
}

/* Image-history actions form a compact, equal four-button editor row. */
.ui-image-editor__preview-actions {
  gap: 8px !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor {
  --editor-preview-size: 146px;
}

:is(
  .ui-image-editor__preview-actions > .photo-action-btn,
  .ui-image-editor__preview-actions > .preview-history-btn,
  .ui-image-editor__preview-actions > .photo-history-btn
) {
  width: var(--ui-image-action-size) !important;
  height: var(--ui-image-action-size) !important;
  min-width: var(--ui-image-action-size) !important;
  min-height: var(--ui-image-action-size) !important;
  max-width: var(--ui-image-action-size) !important;
  max-height: var(--ui-image-action-size) !important;
  flex: 0 0 var(--ui-image-action-size) !important;
  padding: 0 !important;
  border-radius: var(--ui-image-action-radius) !important;
}

:is(
  .ui-image-editor__preview-actions > .photo-action-btn,
  .ui-image-editor__preview-actions > .preview-history-btn,
  .ui-image-editor__preview-actions > .photo-history-btn
) > svg {
  width: var(--ui-image-action-icon-size) !important;
  height: var(--ui-image-action-icon-size) !important;
  min-width: var(--ui-image-action-icon-size) !important;
  min-height: var(--ui-image-action-icon-size) !important;
}

:is(#soundwalkCapturePhotoBtn, #capturePhotoBtn) {
  width: var(--ui-toolbar-action-size) !important;
  height: var(--ui-toolbar-action-size) !important;
  min-width: var(--ui-toolbar-action-size) !important;
  min-height: var(--ui-toolbar-action-size) !important;
  max-width: var(--ui-toolbar-action-size) !important;
  max-height: var(--ui-toolbar-action-size) !important;
  border-radius: var(--ui-toolbar-action-radius) !important;
}

:is(#soundwalkCapturePhotoBtn, #capturePhotoBtn) > svg {
  width: var(--ui-toolbar-icon-size) !important;
  height: var(--ui-toolbar-icon-size) !important;
}

:is(
  #authScreen #signupPanel,
  #profileScreen #profileEditPanel,
  #profileScreen #profileCreateGroupPanel,
  #profileScreen #profileEditSoundPanel,
  #creationSetupScreen,
  #profileScreen #profileEditSoundwalkPanel
) .auth-image-field.ui-image-editor > .ui-image-editor__preview-actions {
  grid-template-columns: repeat(4, var(--ui-image-action-size)) !important;
  width: var(--editor-preview-size) !important;
  min-width: var(--editor-preview-size) !important;
}

/* Main text actions share a real, non-conflicting height contract. */
:is(
  .button-bar,
  .form-actions,
  .save-entry-actions,
  .auth-login-actions,
  .auth-reset-actions,
  .profile-ok-row,
  .settings-ok-row,
  #adminScreen .admin-title-actions,
  #adminScreen .admin-editor-actions,
  #adminScreen .admin-operation-actions,
  #messagesScreen .messages-title-actions
) > .btn-icon:not(.recording-action-btn):not(.preview-history-btn):not(.photo-action-btn):not(.photo-history-btn):not(.choice-icon-button):not(.compact-add-btn),
.saved-actions-bar > .btn-icon:not(#libraryDetailsToggleBtn):not(#deleteAllArchiveBtn):not(.library-page-btn) {
  width: var(--ui-command-width) !important;
  min-width: 128px !important;
  max-width: var(--ui-command-width) !important;
  height: var(--ui-command-height) !important;
  min-height: var(--ui-command-height) !important;
  max-height: var(--ui-command-height) !important;
  padding: 0 10px !important;
  border-radius: var(--ui-command-radius) !important;
}

:is(
  .button-bar,
  .form-actions,
  .save-entry-actions,
  .auth-login-actions,
  .auth-reset-actions,
  .profile-ok-row,
  .settings-ok-row,
  #adminScreen .admin-title-actions,
  #adminScreen .admin-editor-actions,
  #adminScreen .admin-operation-actions,
  #messagesScreen .messages-title-actions
) > .btn-icon:not(.recording-action-btn):not(.preview-history-btn):not(.photo-action-btn):not(.photo-history-btn):not(.choice-icon-button):not(.compact-add-btn) > svg,
.saved-actions-bar > .btn-icon:not(#libraryDetailsToggleBtn):not(#deleteAllArchiveBtn):not(.library-page-btn) > svg {
  width: var(--ui-command-icon-size) !important;
  height: var(--ui-command-icon-size) !important;
  min-width: var(--ui-command-icon-size) !important;
  min-height: var(--ui-command-icon-size) !important;
}

:is(
  #resetCancelBtn,
  #profileAbortBtn,
  #profileEditSoundAbortBtn,
  #profileEditSoundwalkAbortBtn,
  #createGroupAbortBtn,
  #confirmModalCancelBtn
) {
  background: var(--ui-action-cancel) !important;
  color: #fff !important;
}

/* Older control groups use ID-heavy selectors; these role selectors remove
   their contradictory 42/46px height declarations. */
:is(
  #loginBtn,
  #forgotPasswordBtn,
  #sendResetEmailBtn,
  #resetBackToLoginBtn,
  #confirmResetPasswordBtn,
  #resetCancelBtn,
  #signupBtn,
  #profileOverviewOkBtn,
  #profileSoundsOkBtn,
  #profileUpdateBtn,
  #profileAbortBtn,
  #profileGroupsOkBtn,
  #profileSoundwalksOkBtn,
  #profileEditSoundSaveBtn,
  #profileEditSoundAbortBtn,
  #profileEditSoundwalkSaveBtn,
  #profileEditSoundwalkAbortBtn,
  #createGroupSaveBtn,
  #createGroupAbortBtn,
  #settingsOkBtn,
  #notificationsOkBtn,
  #startWalkBtn,
  #startRecBtn,
  #uploadAudioBtn,
  #saveEntryBtn,
  #abortEditBtn,
  #exportGroupArchiveBtn,
  #exportReportBtn
) {
  height: var(--ui-command-height) !important;
  min-height: var(--ui-command-height) !important;
  max-height: var(--ui-command-height) !important;
  border-radius: var(--ui-command-radius) !important;
}

#mainScreen #mapFilterPanel :is(
  #ownPreviousRoutesToggle,
  #ownRecordingsMapToggle,
  #allGroupsMapRoutesToggle,
  #allGroupsMapEntriesToggle,
  #liveRoutesToggle,
  #soundDistanceMapToggle
) {
  border-radius: var(--ui-field-radius) !important;
}

#authScreen #signupPanel #signupProfileDescriptionInput {
  background-color: #fbfdfe !important;
}

/* Semantic action colors remain identical even under legacy per-screen IDs. */
#authScreen #signupPanel :is(#signupPhotoClearBtn),
#profileScreen :is(
  #profileTitleDeleteUserBtn,
  #profilePhotoClearBtn,
  #editSoundImageClearBtn,
  #editSoundwalkImageClearBtn,
  #createGroupImageClearBtn
),
#introScreen #soundwalkDetailsBlock #soundwalkClearPhotoBtn,
#mainScreen #recordingPanel :is(#clearPhotoBtn, #previewDeleteBtn) {
  background: var(--ui-action-delete) !important;
  color: #fff !important;
}

#authScreen #signupPanel :is(#signupPhotoResetBtn, #signupPhotoRedoBtn),
#profileScreen :is(
  #profilePhotoResetBtn,
  #profilePhotoRedoBtn,
  #editSoundImageResetBtn,
  #editSoundImageRedoBtn,
  #editSoundwalkImageResetBtn,
  #editSoundwalkImageRedoBtn,
  #createGroupImageResetBtn,
  #createGroupImageRedoBtn
),
#introScreen #soundwalkDetailsBlock :is(#soundwalkPhotoResetBtn, #soundwalkPhotoRedoBtn),
#mainScreen #recordingPanel :is(#photoPrevBtn, #photoNextBtn, #previewPrevBtn, #previewNextBtn) {
  background: var(--ui-action-neutral) !important;
  color: #fff !important;
}

#authScreen #signupPanel #signupPhotoBtn,
#profileScreen :is(#profilePhotoBtn, #editSoundImageBtn, #editSoundwalkImageBtn, #createGroupImageBtn),
#introScreen #soundwalkDetailsBlock #soundwalkUploadPhotoBtn,
#mainScreen #recordingPanel :is(#uploadPhotoBtn, #uploadAudioBtn) {
  background: var(--ui-action-media) !important;
  color: #fff !important;
}

/* Supporting copy inside equivalent choice cards uses one text system. */
:is(#authScreen, #profileScreen, #settingsScreen, #introScreen, #mainScreen) .choice-info,
:is(#authScreen, #profileScreen, #settingsScreen, #introScreen, #mainScreen) .toggle-info {
  color: #657481 !important;
  font-family: var(--font) !important;
  font-size: .78rem !important;
  font-weight: 800 !important;
  line-height: 1.38 !important;
  letter-spacing: 0 !important;
}

/* Pills keep semantic borders and colors, but share type and density. */
:is(#authScreen, #profileScreen, #settingsScreen, #introScreen, #mainScreen) :is(
  .role-chip,
  .organization-chip,
  .member-chip,
  .pill-chip,
  .member-pill,
  .role-pill,
  .profile-group-chip,
  .profile-group-member-chip,
  .profile-connection-chip,
  .recording-card-chip,
  .map-popup-group-pill,
  .legend-group-pill,
  .meta-value-chip,
  .group-summary-pill
) {
  font-family: var(--font) !important;
  font-size: var(--ui-pill-size) !important;
  font-weight: 750 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

/* Hub navigation is one family even when rendered on another screen. */
:is(#profileHubActions, .settings-profile-hub-actions) > button.btn-icon {
  min-height: 52px !important;
  height: 52px !important;
  max-height: 52px !important;
  border-radius: 14px !important;
}

:is(#profileHubActions, .settings-profile-hub-actions) > button.btn-icon > svg {
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  min-height: 17px !important;
}

/* Inline help icons are smaller by role, but identical to one another. */
:is(#settingsMicrophoneInfoBtn, #settingsCameraInfoBtn) {
  width: var(--ui-inline-info-size) !important;
  height: var(--ui-inline-info-size) !important;
  min-width: var(--ui-inline-info-size) !important;
  min-height: var(--ui-inline-info-size) !important;
  max-width: var(--ui-inline-info-size) !important;
  max-height: var(--ui-inline-info-size) !important;
  padding: 0 !important;
  border-radius: 7px !important;
}

:is(#settingsMicrophoneInfoBtn, #settingsCameraInfoBtn) > svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
}

/* Shared interaction states complete each control family. */
:is(button, [role="button"], input, select, textarea, a[href]):focus-visible {
  outline: 2px solid var(--ui-focus-color) !important;
  outline-offset: 3px !important;
}

:is(input, select, textarea):focus-visible {
  box-shadow: none !important;
}

:is(button, [role="button"]):disabled,
:is(button, [role="button"])[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: .46 !important;
  filter: saturate(.72) !important;
  transform: none !important;
}

/* ==========================================================
   1.4.6 unified interaction system
   One label contract, one geometry per control family, and
   flat semantic colors instead of unrelated glossy gradients.
   ========================================================== */
:root {
  --ui-button-label-size: .8125rem;
  --ui-button-label-weight: 700;
  --ui-button-label-line-height: 1.25;
  --ui-focus-color: #245e82;
  --ui-micro-label-size: .72rem;
  --ui-command-radius: 14px;
  --ui-toolbar-action-radius: 12px;
  --ui-image-action-radius: 10px;
  --ui-action-primary: #5f7b58;
  --ui-action-play: #58785f;
  --ui-action-audio: #a85f65;
  --ui-action-edit: #986b2c;
  --ui-action-add: #3b796e;
  --ui-action-delete: #a75750;
  --ui-action-info: #4d7292;
  --ui-action-map: #3b7886;
  --ui-action-settings: #6a607d;
  --ui-action-neutral: #667680;
  --ui-action-media: #3b7886;
  --ui-action-clear: #986b2c;
  --ui-action-cancel: #756f70;
  --ui-control-shadow: 0 1px 3px rgba(39, 49, 61, .10);
  --ui-control-shadow-hover: 0 2px 6px rgba(39, 49, 61, .13);

  /* Older selectors resolve these aliases at computed-value time. */
  --action-save-bg: var(--ui-action-primary);
  --action-audio-bg: var(--ui-action-audio);
  --action-edit-bg: var(--ui-action-edit);
  --action-info-bg: var(--ui-action-info);
  --action-map-bg: var(--ui-action-map);
  --action-settings-bg: var(--ui-action-settings);
  --action-neutral-bg: var(--ui-action-neutral);
  --action-danger-bg: var(--ui-action-delete);
}

/* All button labels now use exactly the same type metrics. */
body :is(
  #appHeader,
  #authScreen, #creationSetupScreen,
  #profileScreen,
  #settingsScreen,
  #notificationsScreen,
  #introScreen,
  #mainScreen,
  #confirmModal,
  #soundwalkSummaryModal,
  #soundwalkMapPreviewModal
) button,
body :is(
  #appHeader,
  #authScreen, #creationSetupScreen,
  #profileScreen,
  #settingsScreen,
  #notificationsScreen,
  #introScreen,
  #mainScreen,
  #confirmModal,
  #soundwalkSummaryModal,
  #soundwalkMapPreviewModal
) button > :is(span, .tab-btn-content, .choice-title) {
  font-family: var(--font) !important;
  font-size: var(--ui-button-label-size) !important;
  font-weight: var(--ui-button-label-weight) !important;
  line-height: var(--ui-button-label-line-height) !important;
  letter-spacing: 0 !important;
}

/* Main field labels remain one family; secondary editor labels use one
   deliberately smaller family instead of four almost-identical sizes. */
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(
  .label-row,
  .intro-field-label,
  .auth-image-label,
  .settings-section-heading,
  .settings-device-label,
  .settings-visibility-label,
  .list-section-label,
  .profile-connection-label,
  .library-list-label,
  .profile-sounds-label
) {
  color: var(--ui-label-color) !important;
  font-family: var(--font) !important;
  font-size: var(--ui-label-size) !important;
  font-weight: 750 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(
  .photo-adjust-label,
  .audio-effect-label,
  .trim-label,
  .compact-label,
  .mode-label
) {
  font-family: var(--font) !important;
  font-size: var(--ui-micro-label-size) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

/* Filled actions share a flat surface, subtle depth and the same interaction
   feedback. Their color is assigned below by semantic purpose. */
:is(#appHeader, #authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(
  .btn-save,
  .btn-record,
  .btn-settings,
  .btn-earth,
  .btn-rename,
  .btn-follow,
  .btn-delete-user,
  .btn-abort-edit,
  .btn-stop,
  .btn-upload,
  .btn-export,
  .btn-report,
  .btn-delete-all,
  .clear-filters-btn,
  .library-page-btn,
  .photo-action-btn,
  .preview-history-btn,
  .map-floating-btn,
  .map-quick-record-btn,
  .sound-edit-map-toggle-btn,
  .compact-add-btn
) {
  background-image: none !important;
  border: 1px solid rgba(20, 31, 40, .08) !important;
  color: #fff !important;
  box-shadow: var(--ui-control-shadow) !important;
  text-shadow: none !important;
}

:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .btn-save {
  background-color: var(--ui-action-primary) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .btn-record {
  background-color: var(--ui-action-audio) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .btn-settings {
  background-color: var(--ui-action-settings) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .btn-earth {
  background-color: var(--ui-action-info) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .btn-rename {
  background-color: var(--ui-action-edit) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-follow, .compact-add-btn) {
  background-color: var(--ui-action-add) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-delete-user, .btn-delete-all) {
  background-color: var(--ui-action-delete) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-abort-edit, .clear-filters-btn, .library-page-btn) {
  background-color: var(--ui-action-neutral) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-upload, .photo-action-btn) {
  background-color: var(--ui-action-media) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-export, .btn-report, .map-floating-btn, .sound-edit-map-toggle-btn) {
  background-color: var(--ui-action-info) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(.btn-stop, .map-quick-record-btn) {
  background-color: var(--ui-action-audio) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .preview-history-btn {
  background-color: var(--ui-action-neutral) !important;
}
:is(#authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) .preview-history-btn.delete {
  background-color: var(--ui-action-delete) !important;
}

/* Correct overloaded legacy classes by what each control actually does. */
:is(#loginBtn, #sendResetEmailBtn, #confirmResetPasswordBtn, #signupBtn,
  #profileUpdateBtn, #profileCreateGroupFromGroupsBtn, #profileGroupsOkBtn,
  #profileSoundwalksOkBtn, #profileEditSoundSaveBtn, #profileEditSoundwalkSaveBtn,
  #createGroupSaveBtn, #profileOverviewOkBtn, #profileSoundsOkBtn, #settingsOkBtn,
  #notificationsOkBtn, #startWalkBtn, #completeSoundwalkBtn, #draftRestoreBtn,
  #saveEntryBtn, #summaryOkBtn) {
  background: var(--ui-action-primary) !important;
}

:is(#resetBackToLoginBtn, #resetCancelBtn, #profileAbortBtn,
  #profileCancelAddGroupBtn, #profileEditSoundAbortBtn,
  #profileEditSoundwalkAbortBtn, #createGroupAbortBtn, #abortEditBtn) {
  background: var(--ui-action-neutral) !important;
}

:is(#profileEditOpenBtn, #settingsProfileEditOpenBtn, #profileTitleEditBtn) {
  background: var(--ui-action-edit) !important;
}

:is(#profileCreateGroupOpenBtn, #settingsProfileGroupsOpenBtn,
  #profileAddGroupFromGroupsBtn, #profileSendGroupRequestBtn,
  #signupAddUserTypeBtn, #signupAddOrganizationBtn, #profileAddUserTypeBtn,
  #createGroupMemberAddBtn) {
  background: var(--ui-action-add) !important;
}

:is(#forgotPasswordBtn, #profileSoundwalksOpenBtn, #settingsProfileSoundwalksOpenBtn,
  #profileToggleGroupsInfoBtn, #profileSoundDetailsToggleBtn,
  #libraryDetailsToggleBtn, #notificationsMarkAllReadBtn,
  #exportGroupArchiveBtn, #exportReportBtn) {
  background: var(--ui-action-info) !important;
}

:is(#startRecBtn, #stopAudioBtn, #mapQuickRecordBtn) {
  background: var(--ui-action-audio) !important;
}

#playAudioBtn {
  background: var(--ui-action-play) !important;
}

:is(#uploadAudioBtn, #signupPhotoBtn, #profilePhotoBtn, #editSoundImageBtn,
  #editSoundwalkImageBtn, #createGroupImageBtn, #soundwalkCapturePhotoBtn,
  #soundwalkUploadPhotoBtn, #capturePhotoBtn, #uploadPhotoBtn) {
  background: var(--ui-action-media) !important;
}

:is(#draftDiscardBtn, #profileTitleDeleteUserBtn, #deleteAllArchiveBtn,
  #signupPhotoClearBtn, #profilePhotoClearBtn, #editSoundImageClearBtn,
  #editSoundwalkImageClearBtn, #createGroupImageClearBtn,
  #soundwalkClearPhotoBtn, #clearPhotoBtn, #previewDeleteBtn) {
  background: var(--ui-action-delete) !important;
}

:is(#signupPhotoResetBtn, #signupPhotoRedoBtn, #profilePhotoResetBtn,
  #profilePhotoRedoBtn, #editSoundImageResetBtn, #editSoundImageRedoBtn,
  #editSoundwalkImageResetBtn, #editSoundwalkImageRedoBtn,
  #createGroupImageResetBtn, #createGroupImageRedoBtn,
  #soundwalkPhotoResetBtn, #soundwalkPhotoRedoBtn,
  #photoPrevBtn, #photoNextBtn, #previewPrevBtn, #previewNextBtn,
  #profileClearSoundFiltersBtn, #profileClearGroupFiltersBtn,
  #profileClearSoundwalkFiltersBtn, #mapClearFiltersBtn, #clearSavedFiltersBtn) {
  background: var(--ui-action-neutral) !important;
}

/* Header actions and the three temporary database tools are one 42px family. */
#appHeader > .app-header-actions {
  grid-column: 1 / -1 !important;
}

#appHeader .app-header-actions > button {
  border-radius: var(--ui-toolbar-action-radius) !important;
  background-image: none !important;
  box-shadow: var(--ui-control-shadow) !important;
}

#appHeader #modeBtn { background-color: var(--ui-action-neutral) !important; }
#appHeader #profileBtn { background-color: var(--ui-action-info) !important; }
#appHeader #notificationsBtn { background-color: var(--ui-action-map) !important; }
#appHeader #settingsBtn { background-color: var(--ui-action-settings) !important; }
#appHeader #logoutBtn { background-color: var(--ui-action-delete) !important; }
#appHeader #demoSeedBtn { background-color: var(--ui-action-info) !important; }
#appHeader #demoSeedBtn.is-replace { background-color: var(--ui-action-edit) !important; }
#appHeader #demoSeedAppendBtn { background-color: var(--ui-action-add) !important; }
#appHeader #demoSeedRemoveBtn { background-color: var(--ui-action-delete) !important; }

#mainScreen #recenterMapBtn,
#mainScreen #mapCompassFollowBtn {
  background: var(--ui-action-info) !important;
}

#mainScreen #mapLayerBtn {
  background: var(--ui-action-map) !important;
}

/* Navigation tabs stay color-coded, but use flat fills and equal depth. */
#mainScreen .tab-btn {
  border-radius: var(--ui-command-radius) !important;
  background-image: none !important;
  box-shadow: var(--ui-control-shadow) !important;
}
#mainScreen .tab-btn[data-panel="mapPanel"] { background-color: var(--ui-action-info) !important; }
#mainScreen .tab-btn[data-panel="recordingPanel"] { background-color: var(--ui-action-audio) !important; }
#mainScreen .tab-btn[data-panel="savedPanel"] { background-color: var(--ui-action-add) !important; }

/* Option buttons are intentionally quiet surfaces, including their selected
   state, so they no longer look glossier than command buttons. */
.choice-icon-button,
.notifications-filter-btn,
.map-layer-menu button {
  background-image: none !important;
  box-shadow: none !important;
}

.notifications-filter-btn {
  border-radius: 10px !important;
}

.notifications-filter-btn.active {
  background-color: #fff !important;
  box-shadow: 0 2px 7px rgba(39, 49, 61, .10) !important;
}

.map-layer-menu button.active,
.choice-card:has(input:checked) .choice-card-inner,
.choice-card > input:checked + .choice-card-inner {
  background-image: none !important;
  box-shadow: 0 3px 9px rgba(39, 49, 61, .09) !important;
}

#confirmModal .confirm-modal-actions > button {
  border-radius: var(--ui-command-radius) !important;
  background-image: none !important;
  box-shadow: var(--ui-control-shadow) !important;
}
#confirmModal #confirmModalCancelBtn { background-color: var(--ui-action-neutral) !important; }
#confirmModal[data-intent="primary"] #confirmModalOkBtn { background-color: var(--ui-action-primary) !important; }
#confirmModal[data-intent="danger"] #confirmModalOkBtn { background-color: var(--ui-action-delete) !important; }

@media (hover: hover) {
  :is(#appHeader, #authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) :is(
    .btn-save, .btn-record, .btn-settings, .btn-earth, .btn-rename, .btn-follow,
    .btn-delete-user, .btn-abort-edit, .btn-stop, .btn-upload, .btn-export,
    .btn-report, .btn-delete-all, .clear-filters-btn, .library-page-btn,
    .photo-action-btn, .preview-history-btn, .map-floating-btn,
    .map-quick-record-btn, .sound-edit-map-toggle-btn, .compact-add-btn
  ):not(:disabled):hover,
  #confirmModal .confirm-modal-actions > button:not(:disabled):hover {
    box-shadow: var(--ui-control-shadow-hover) !important;
    filter: brightness(1.04) !important;
    transform: translateY(-1px) !important;
  }
}

:is(#appHeader, #authScreen, #creationSetupScreen, #profileScreen, #settingsScreen, #notificationsScreen, #introScreen, #mainScreen) button:active:not(:disabled),
#confirmModal .confirm-modal-actions > button:active:not(:disabled) {
  transform: translateY(0) !important;
}

:is(button, [role="button"]):disabled,
:is(button, [role="button"])[aria-disabled="true"] {
  box-shadow: none !important;
}

/* Stable 1.4.6 cascade boundary. The application id deliberately gives the
   unified system precedence over older screen-specific declarations without
   relying on brittle per-button exceptions. */
#soundRoutesApp #soundRoutesRoot :is(
  #appHeader,
  .screen,
  #confirmModal,
  #soundwalkSummaryModal,
  #soundwalkMapPreviewModal
) button,
#soundRoutesApp #soundRoutesRoot :is(
  #appHeader,
  .screen,
  #confirmModal,
  #soundwalkSummaryModal,
  #soundwalkMapPreviewModal
) button > :is(span, .tab-btn-content, .choice-title) {
  font-family: var(--font) !important;
  font-size: var(--ui-button-label-size) !important;
  font-weight: var(--ui-button-label-weight) !important;
  line-height: var(--ui-button-label-line-height) !important;
  letter-spacing: 0 !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader,
  .screen,
  #confirmModal,
  #soundwalkSummaryModal,
  #soundwalkMapPreviewModal
) button {
  background-image: none !important;
  text-shadow: none !important;
}

/* Role removal needs a solid surface: the shared flat-button contract removes
   legacy gradients, which otherwise leaves a white cross on a transparent chip. */
#soundRoutesApp #soundRoutesRoot :is(#authScreen, #profileScreen) .role-chip > [data-role-remove] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 24px !important;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background-color: var(--ui-action-delete) !important;
  color: #fff !important;
  box-shadow: none !important;
}

#soundRoutesApp #soundRoutesRoot :is(#authScreen, #profileScreen) .role-chip > [data-role-remove] > svg {
  display: block !important;
  flex: 0 0 12px !important;
  width: 12px !important;
  height: 12px !important;
  stroke: currentColor !important;
  stroke-width: 2.6 !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #authScreen,
  #creationSetupScreen,
  #profileScreen,
  #settingsScreen,
  #notificationsScreen,
  #introScreen,
  #mainScreen
) :is(.photo-adjust-label, .audio-effect-label, .trim-label, .compact-label, .mode-label) {
  font-family: var(--font) !important;
  font-size: var(--ui-micro-label-size) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

/* Semantic colors are locked by purpose, so reused legacy utility classes do
   not make equivalent actions look unrelated. */
#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #loginBtn, #sendResetEmailBtn, #confirmResetPasswordBtn, #signupBtn,
  #profileUpdateBtn, #profileCreateGroupFromGroupsBtn, #profileGroupsOkBtn,
  #profileSoundwalksOkBtn, #profileEditSoundSaveBtn, #profileEditSoundwalkSaveBtn,
  #createGroupSaveBtn, #profileOverviewOkBtn, #profileSoundsOkBtn, #settingsOkBtn,
  #notificationsOkBtn, #startWalkBtn, #completeSoundwalkBtn, #draftRestoreBtn,
  #saveEntryBtn, #summaryOkBtn
) {
  background-color: var(--ui-action-primary) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #resetBackToLoginBtn, #resetCancelBtn, #profileAbortBtn,
  #profileCancelAddGroupBtn, #profileEditSoundAbortBtn,
  #profileEditSoundwalkAbortBtn, #createGroupAbortBtn, #abortEditBtn,
  #signupPhotoResetBtn, #signupPhotoRedoBtn, #profilePhotoResetBtn,
  #profilePhotoRedoBtn, #editSoundImageResetBtn, #editSoundImageRedoBtn,
  #editSoundwalkImageResetBtn, #editSoundwalkImageRedoBtn,
  #createGroupImageResetBtn, #createGroupImageRedoBtn,
  #soundwalkPhotoResetBtn, #soundwalkPhotoRedoBtn, #photoPrevBtn, #photoNextBtn,
  #previewPrevBtn, #previewNextBtn, #profileClearSoundFiltersBtn,
  #profileClearGroupFiltersBtn, #profileClearSoundwalkFiltersBtn,
  #mapClearFiltersBtn, #clearSavedFiltersBtn
) {
  background-color: var(--ui-action-neutral) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(#profileEditOpenBtn, #settingsProfileEditOpenBtn, #profileTitleEditBtn) {
  background-color: var(--ui-action-edit) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #profileCreateGroupOpenBtn, #settingsProfileGroupsOpenBtn,
  #profileAddGroupFromGroupsBtn, #profileSendGroupRequestBtn,
  #signupAddUserTypeBtn, #signupAddOrganizationBtn, #profileAddUserTypeBtn,
  #createGroupMemberAddBtn, #profileFollowSearchAddBtn, #creationNewBtn
) {
  background-color: var(--ui-action-add) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #forgotPasswordBtn, #profileSoundwalksOpenBtn, #settingsProfileSoundwalksOpenBtn,
  #profileToggleGroupsInfoBtn, #profileSoundDetailsToggleBtn,
  #libraryDetailsToggleBtn, #notificationsMarkAllReadBtn,
  #exportGroupArchiveBtn, #exportReportBtn, #summaryReportBtn
) {
  background-color: var(--ui-action-info) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(#startRecBtn, #stopAudioBtn, #mapQuickRecordBtn) {
  background-color: var(--ui-action-audio) !important;
}

#soundRoutesApp #soundRoutesRoot #mainScreen #playAudioBtn {
  background-color: var(--ui-action-play) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #uploadAudioBtn, #signupPhotoBtn, #profilePhotoBtn, #editSoundImageBtn,
  #editSoundwalkImageBtn, #createGroupImageBtn, #soundwalkCapturePhotoBtn,
  #soundwalkUploadPhotoBtn, #capturePhotoBtn, #uploadPhotoBtn
) {
  background-color: var(--ui-action-media) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #appHeader, #authScreen, #profileScreen, #settingsScreen,
  #notificationsScreen, #introScreen, #mainScreen
) :is(
  #draftDiscardBtn, #profileTitleDeleteUserBtn, #deleteAllArchiveBtn,
  #signupPhotoClearBtn, #profilePhotoClearBtn, #editSoundImageClearBtn,
  #editSoundwalkImageClearBtn, #createGroupImageClearBtn,
  #soundwalkClearPhotoBtn, #clearPhotoBtn, #previewDeleteBtn
) {
  background-color: var(--ui-action-delete) !important;
}

#soundRoutesApp #soundRoutesRoot #appHeader #modeBtn { background-color: var(--ui-action-neutral) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #profileBtn { background-color: var(--ui-action-info) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #notificationsBtn { background-color: var(--ui-action-map) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #settingsBtn { background-color: var(--ui-action-settings) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #logoutBtn { background-color: var(--ui-action-delete) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #logoutBtn[data-header-action="auth-signup"],
#soundRoutesApp #soundRoutesRoot #authScreen #authSignupOpenBtn { background-color: var(--ui-action-add) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #logoutBtn[data-header-action="auth-login"] { background-color: var(--ui-action-info) !important; }
#soundRoutesApp #soundRoutesRoot #authScreen #authLoginOpenBtn { background-color: var(--ui-action-neutral) !important; }

#authScreen .auth-login-actions,
#authScreen .signup-button-bar {
  flex-wrap: wrap !important;
  gap: 12px !important;
}

#soundRoutesApp #authScreen .auth-message:empty {
  display: none !important;
}

#soundRoutesApp #soundRoutesRoot #authScreen .button-bar > .btn-icon {
  width: var(--ui-command-width) !important;
  min-width: var(--ui-command-width) !important;
  max-width: var(--ui-command-width) !important;
  height: var(--ui-command-height) !important;
  white-space: normal !important;
}

@media (max-width: 560px) {
  #soundRoutesApp #soundRoutesRoot #authScreen #loginPanel {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  #soundRoutesApp #soundRoutesRoot #authScreen .button-bar > .btn-icon {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* Current location remains visible without relying only on a color change. */
#appHeader [data-header-action][aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 30%;
  right: 30%;
  height: 3px;
  border-radius: 2px;
  background: #fff;
  pointer-events: none;
}
#soundRoutesApp #soundRoutesRoot #appHeader #demoSeedBtn { background-color: var(--ui-action-info) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #demoSeedBtn.is-replace { background-color: var(--ui-action-edit) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #demoSeedAppendBtn { background-color: var(--ui-action-add) !important; }
#soundRoutesApp #soundRoutesRoot #appHeader #demoSeedRemoveBtn { background-color: var(--ui-action-delete) !important; }

#soundRoutesApp #soundRoutesRoot #mainScreen :is(
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn,
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
) {
  line-height: var(--ui-button-label-line-height) !important;
}

/* Summary modals live beside the application root rather than inside it. */
#soundRoutesApp #soundwalkSummaryModal #summaryReportBtn {
  background-color: var(--ui-action-info) !important;
  background-image: none !important;
  text-shadow: none !important;
}

/* Geometry groups: 42px tools, image tools, commands, and compact menus each
   keep one deliberate radius instead of inheriting near-duplicate legacy values. */
#soundRoutesApp #soundRoutesRoot :is(#profileScreen, #mainScreen) :is(
  #profileFollowSearchAddBtn,
  #mapQuickRecordBtn,
  #mapLayerBtn,
  #pasteCoordinatesBtn,
  #useCurrentCoordinatesBtn,
  #editSoundLocationMapToggleBtn,
  #uploadPhotoBtn,
  #photoPrevBtn,
  #photoNextBtn,
  #clearPhotoBtn
) {
  border-radius: var(--ui-toolbar-action-radius) !important;
}

#soundRoutesApp #soundRoutesRoot :is(
  #authScreen,
  #creationSetupScreen,
  #profileScreen,
  #introScreen,
  #mainScreen
) .ui-image-editor__preview-actions :is(.photo-action-btn, .preview-history-btn, .photo-history-btn) {
  border-radius: var(--ui-image-action-radius) !important;
  box-shadow: var(--ui-control-shadow) !important;
}

#soundRoutesApp #soundRoutesRoot #mainScreen :is(#playAudioBtn, #stopAudioBtn) {
  border-radius: var(--ui-command-radius) !important;
}

#soundRoutesApp #soundRoutesRoot #mainScreen .map-layer-menu button {
  border-radius: 10px !important;
}

#soundRoutesApp #soundRoutesRoot #settingsScreen :is(#settingsMicrophoneInfoBtn, #settingsCameraInfoBtn) {
  border-radius: 7px !important;
}

/* Direct messages use the same quiet, flat interface vocabulary as the
   notification centre while keeping the thread itself easy to scan. */
#messagesScreen {
  display: none;
}

#messagesScreen.active {
  display: block;
}

#messagesScreen .messages-card {
  width: 100%;
}

#messagesScreen .messages-content {
  display: grid;
  gap: 16px;
}

#messagesScreen .messages-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#messagesScreen .messages-title-actions,
#messagesScreen .message-composer-actions,
#messagesScreen .messages-load-more-row,
#messagesScreen .message-conversation-older-row,
#messagesScreen .messages-ok-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#messagesScreen .messages-title-actions {
  justify-content: flex-end;
}

#messagesScreen .messages-title-actions > button,
#messagesScreen .message-composer-actions > button,
#messagesScreen .messages-load-more-row > button,
#messagesScreen .message-conversation-older-row > button {
  width: auto !important;
  min-width: 0 !important;
}

#messagesScreen .messages-section-description {
  margin: -4px 0 0;
}

#messagesScreen .messages-filter-tabs {
  display: inline-flex;
  align-items: stretch;
  justify-self: start;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line, #d5e0e6);
  border-radius: 10px;
  background: #edf3f6;
}

#messagesScreen .messages-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 112px;
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent !important;
  box-shadow: none !important;
  color: #536778;
}

#messagesScreen .messages-filter-btn.active {
  background-color: #fff !important;
  color: #285f7c;
  box-shadow: 0 2px 7px rgba(39, 49, 61, .10) !important;
}

#messagesScreen .messages-filter-btn strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d9485f;
  color: #fff;
  font-family: var(--font);
  font-size: .7rem;
  font-weight: 900;
  line-height: 1;
}

#messagesScreen .messages-inline-status,
#messagesScreen .message-composer-meta > [role="status"] {
  min-height: 1.25em;
  color: var(--text-soft, #5f6f7f);
  font-size: .82rem;
  font-weight: 750;
  line-height: 1.35;
}

#messagesScreen .messages-inline-status[data-tone="error"],
#messagesScreen .message-composer-meta > [role="status"][data-tone="error"] {
  color: #a43f4f;
}

#messagesScreen .messages-inline-status[data-tone="success"],
#messagesScreen .message-composer-meta > [role="status"][data-tone="success"] {
  color: #376d52;
}

#messagesScreen .messages-list {
  display: grid;
  gap: 10px;
}

#messagesScreen .message-list-row {
  min-width: 0;
  border: 1px solid #d5e0e6;
  border-left: 4px solid #8eaab9;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(47, 72, 87, .06);
  overflow: hidden;
}

#messagesScreen .message-list-row.is-unread {
  border-color: #b8ceda;
  border-left-color: var(--ui-action-info, #4d7292);
  background: #f4f9fc;
}

#messagesScreen .message-list-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 11px;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: #344858;
  text-align: left;
}

#messagesScreen .message-list-avatar,
#messagesScreen .message-peer-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 2px solid #c2d2dc;
  border-radius: 50%;
  background: #eef4f7;
  object-fit: cover;
}

#messagesScreen .message-list-copy,
#messagesScreen .message-conversation-heading-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

#messagesScreen .message-list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
}

#messagesScreen .message-list-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #2f566d;
  font-size: .92rem;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesScreen .message-list-heading time,
#messagesScreen .message-bubble footer,
#messagesScreen .message-list-state {
  flex: 0 0 auto;
  color: #71818e;
  font-size: .73rem;
  font-weight: 750;
  line-height: 1.25;
}

#messagesScreen .message-list-preview {
  display: block;
  overflow: hidden;
  color: #536778;
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.38;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesScreen .message-list-row.is-unread .message-list-preview,
#messagesScreen .message-list-row.is-unread .message-list-state {
  color: #285f7c;
  font-weight: 800;
}

#messagesScreen .messages-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px 18px;
  border: 1px dashed #bfd0da;
  border-radius: 12px;
  background: #f7fafb;
  color: #607382;
  text-align: center;
}

#messagesScreen .messages-empty svg {
  width: 28px;
  height: 28px;
  color: #5f8297;
}

#messagesScreen .messages-empty strong {
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.35;
}

#messagesScreen :is(.messages-empty, .messages-load-more-row, .message-conversation-older-row).hidden,
#messagesScreen :is(.messages-empty, .messages-load-more-row, .message-conversation-older-row)[hidden],
#messagesScreen .message-conversation-view.hidden,
#messagesScreen .message-conversation-view[hidden],
#messagesScreen .message-peer-avatar.hidden,
#messagesScreen .message-peer-avatar[hidden],
#messagesScreen .message-recipient-suggestions.hidden,
#messagesScreen .message-recipient-suggestions[hidden] {
  display: none !important;
}

#messagesScreen .messages-load-more-row,
#messagesScreen .message-conversation-older-row {
  justify-content: center;
}

#messagesScreen .message-conversation-view {
  display: grid;
  gap: 13px;
}

#messagesScreen .message-conversation-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 11px;
  border: 1px solid #d5e0e6;
  border-radius: 12px;
  background: #f7fafb;
}

#messagesScreen .message-back-btn {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 10px !important;
}

#messagesScreen .message-conversation-heading-copy > span {
  color: #71818e;
  font-size: .74rem;
  font-weight: 800;
  line-height: 1.15;
}

#messagesScreen .message-conversation-heading-copy > strong {
  overflow: hidden;
  color: #315d74;
  font-size: .96rem;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesScreen .message-recipient-field {
  position: relative;
  display: grid;
  gap: 7px;
}

#messagesScreen .message-recipient-field input,
#messagesScreen #messageBodyInput {
  width: 100%;
  min-width: 0;
  border: 1px solid #bfd0da;
  border-radius: 10px;
  background: #fff;
  color: #344858;
  box-shadow: none;
}

#messagesScreen .message-recipient-field input {
  min-height: 42px;
  padding: 10px 12px;
}

#messagesScreen .message-recipient-field input:focus,
#messagesScreen #messageBodyInput:focus {
  border-color: #5f8297;
  outline: 3px solid rgba(77, 114, 146, .16);
  outline-offset: 1px;
}

#messagesScreen .message-recipient-suggestions {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  z-index: 12;
  display: grid;
  max-height: 250px;
  overflow: auto;
  padding: 5px;
  border: 1px solid #b9ccd7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 25px rgba(39, 58, 71, .14);
}

#messagesScreen .message-recipient-suggestion {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent !important;
  box-shadow: none !important;
  color: #344858;
  text-align: left;
}

#messagesScreen .message-recipient-suggestion.active,
#messagesScreen .message-recipient-suggestion:hover {
  background-color: #edf5f8 !important;
}

#messagesScreen .message-recipient-suggestion img {
  width: 30px;
  height: 30px;
  border: 1px solid #c1d2dc;
  border-radius: 50%;
  object-fit: cover;
}

#messagesScreen .message-recipient-suggestion > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

#messagesScreen .message-recipient-suggestion strong,
#messagesScreen .message-recipient-suggestion small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesScreen .message-recipient-suggestion strong {
  color: #315d74;
  font-size: .84rem;
  font-weight: 850;
}

#messagesScreen .message-recipient-suggestion small,
#messagesScreen .message-recipient-empty {
  color: #71818e;
  font-size: .75rem;
  font-weight: 700;
}

#messagesScreen .message-recipient-empty {
  padding: 10px;
}

#messagesScreen .message-conversation-list {
  display: grid;
  align-content: start;
  gap: 9px;
  max-height: min(48vh, 520px);
  overflow: auto;
  padding: 4px;
  scrollbar-color: #9eb4c1 transparent;
}

#messagesScreen .message-bubble-row {
  display: grid;
  min-width: 0;
}

#messagesScreen .message-bubble {
  width: fit-content;
  max-width: min(82%, 620px);
  padding: 10px 12px;
  border: 1px solid #cfdee5;
  border-radius: 12px;
  background: #fff;
  color: #344858;
  box-shadow: 0 2px 7px rgba(47, 72, 87, .05);
}

#messagesScreen .message-bubble-row.is-outgoing .message-bubble {
  justify-self: end;
  border-color: var(--ui-action-info, #4d7292);
  background: var(--ui-action-info, #4d7292);
  color: #fff;
  box-shadow: none;
}

#messagesScreen .message-bubble-author {
  display: block;
  margin-bottom: 4px;
  color: #315d74;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.2;
}

#messagesScreen .message-bubble-row.is-outgoing .message-bubble-author {
  color: rgba(255, 255, 255, .9);
}

#messagesScreen .message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.45;
  white-space: pre-wrap;
}

#messagesScreen .message-bubble footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

#messagesScreen .message-bubble-row.is-outgoing .message-bubble footer {
  color: rgba(255, 255, 255, .82);
}

#messagesScreen .message-composer {
  display: grid;
  gap: 8px;
  padding-top: 13px;
  border-top: 1px solid #d5e0e6;
}

#messagesScreen #messageBodyInput {
  min-height: 110px;
  padding: 11px 12px;
  resize: vertical;
}

#messagesScreen .message-composer-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
}

#messagesScreen #messageBodyCounter {
  flex: 0 0 auto;
  color: #71818e;
  font-size: .74rem;
  font-weight: 750;
}

#messagesScreen .messages-ok-row {
  justify-content: flex-end;
  padding-top: 2px;
}

#soundRoutesApp #soundRoutesRoot #messagesScreen #messagesComposeBtn {
  background-color: var(--ui-action-add) !important;
}

#soundRoutesApp #soundRoutesRoot #messagesScreen #messagesMarkAllReadBtn {
  background-color: var(--ui-action-info) !important;
}

#soundRoutesApp #soundRoutesRoot #messagesScreen #messageSendBtn,
#soundRoutesApp #soundRoutesRoot #messagesScreen #messagesOkBtn {
  background-color: var(--ui-action-primary) !important;
}

#soundRoutesApp #soundRoutesRoot #messagesScreen :is(
  #messagesBackBtn,
  #messagesLoadMoreBtn,
  #messageConversationOlderBtn
) {
  background-color: var(--ui-action-neutral) !important;
}

#soundRoutesApp #soundRoutesRoot #appHeader #messagesBtn,
#soundRoutesApp #soundRoutesRoot #profileScreen #profileTitleMessageBtn {
  background-color: var(--ui-action-info) !important;
}

#profileScreen #profileTitleMessageBtn {
  box-sizing: border-box !important;
  width: var(--action-size, 36px) !important;
  min-width: var(--action-size, 36px) !important;
  max-width: var(--action-size, 36px) !important;
  height: var(--action-size, 36px) !important;
  min-height: var(--action-size, 36px) !important;
  max-height: var(--action-size, 36px) !important;
  flex: 0 0 var(--action-size, 36px) !important;
  padding: 0 !important;
  border-radius: var(--action-radius, 10px) !important;
}

#profileScreen #profileTitleMessageBtn svg {
  display: block !important;
  width: var(--mini-btn-icon, 19px) !important;
  height: var(--mini-btn-icon, 19px) !important;
  margin: 0 !important;
}

#profileScreen #profileTitleMessageBtn.hidden,
#profileScreen #profileTitleMessageBtn[hidden] {
  display: none !important;
}

@media (hover: hover) {
  #messagesScreen :is(
    #messagesComposeBtn,
    #messagesMarkAllReadBtn,
    #messagesBackBtn,
    #messagesLoadMoreBtn,
    #messageConversationOlderBtn,
    #messageSendBtn,
    #messagesOkBtn,
    .message-list-item,
    .message-recipient-suggestion
  ):not(:disabled):hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
  }
}

@media (max-width: 680px) {
  #messagesScreen .messages-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  #messagesScreen .messages-title-actions {
    justify-content: flex-start;
  }

  #messagesScreen .message-bubble {
    max-width: 92%;
  }
}

@media (max-width: 420px) {
  #messagesScreen .messages-filter-tabs {
    width: 100%;
  }

  #messagesScreen .messages-filter-btn {
    min-width: 0;
    flex: 1 1 0;
  }

  #messagesScreen .message-list-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  #messagesScreen .message-composer-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* ==========================================================
   Protected administration console
   A compact, flat management workspace built from the same
   label, field and semantic-action contracts as the app shell.
   ========================================================== */
#adminScreen {
  display: none;
}

#adminScreen.active {
  display: block;
}

#soundRoutesApp #soundRoutesRoot #appHeader #adminBtn {
  background-image: none !important;
  background-color: #685a7d !important;
  border: 1px solid rgba(255, 255, 255, .2) !important;
  color: #fff !important;
  box-shadow: var(--ui-control-shadow) !important;
}

#soundRoutesApp #soundRoutesRoot #appHeader #adminBtn[hidden],
#soundRoutesApp #soundRoutesRoot #appHeader #adminBtn[aria-hidden="true"] {
  display: none !important;
}

#adminScreen .admin-card {
  width: 100%;
}

#adminScreen .admin-content {
  display: grid;
  gap: 16px;
}

#adminScreen .admin-title-row,
#adminScreen .admin-editor-heading,
#adminScreen .admin-list-heading-row,
#adminScreen .admin-list-row,
#adminScreen .admin-role-control,
#adminScreen .admin-danger-content,
#adminScreen .admin-operation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#adminScreen .admin-title-row {
  align-items: flex-start;
}

#adminScreen .admin-section-description {
  width: 100%;
  margin: 9px 0 0;
  color: #687783;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 520;
  line-height: 1.5;
}

#adminScreen .admin-title-actions,
#adminScreen .admin-list-row-actions,
#adminScreen .admin-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#adminScreen .admin-title-actions {
  justify-content: flex-end;
}

#adminScreen :is(.admin-title-actions, .admin-editor-actions) > button,
#adminScreen .admin-create-btn,
#adminScreen .admin-role-control > button,
#adminScreen .admin-operation-actions > button,
#adminScreen #adminResetAllBtn {
  min-height: var(--ui-command-height, 46px) !important;
  font-family: var(--font) !important;
  font-size: var(--button-font, .82rem) !important;
  font-weight: 800 !important;
}

#adminScreen .admin-header-action {
  min-width: 42px;
}

#adminScreen .admin-status,
#adminScreen .admin-editor-status,
#adminScreen .admin-danger-status,
#adminScreen .admin-operation-status {
  min-height: 20px;
  margin: 0;
  color: #687783;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.4;
}

#adminScreen .admin-status:empty {
  min-height: 0;
}

#adminScreen :is(.admin-status, .admin-editor-status, .admin-danger-status, .admin-operation-status).good { color: #49764e; }
#adminScreen :is(.admin-status, .admin-editor-status, .admin-danger-status, .admin-operation-status).warning { color: #916b2d; }
#adminScreen :is(.admin-status, .admin-editor-status, .admin-danger-status, .admin-operation-status).error { color: #a34d48; }
#adminScreen :is(.admin-status, .admin-editor-status, .admin-danger-status, .admin-operation-status).info { color: #426f8e; }

#adminScreen .admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#adminScreen .admin-summary-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 2px 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

#adminScreen .admin-summary-icon {
  display: grid;
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: #e3edf2;
  color: var(--ui-action-info, #4d7292);
}

#adminScreen .admin-summary-icon svg {
  width: 17px;
  height: 17px;
}

#adminScreen .admin-summary-card strong {
  overflow: hidden;
  color: #344352;
  font-size: 1.08rem;
  font-weight: 820;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#adminScreen .admin-summary-card > span:last-child {
  overflow: hidden;
  color: #6b7b87;
  font-size: .72rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#adminScreen .admin-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid rgba(193, 208, 217, .85);
  border-radius: 14px;
  background: var(--surface-soft);
}

#adminScreen .admin-tab {
  min-width: max-content;
  gap: 8px;
  white-space: nowrap;
  border-radius: 10px !important;
}

#adminScreen .admin-tab > svg {
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: currentColor;
}

#adminScreen .admin-workspace,
#adminScreen .admin-list-view,
#adminScreen .admin-editor {
  min-width: 0;
}

#adminScreen .admin-list-view,
#adminScreen .admin-editor {
  padding: clamp(13px, 2vw, 17px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

#adminScreen .admin-list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

#adminScreen .admin-search-field,
#adminScreen .admin-page-size,
#adminScreen .admin-field,
#adminScreen .admin-danger-fields label,
#adminScreen .admin-operation-dialog label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--ui-label-color, #46535e);
  font-family: var(--font);
  font-size: var(--ui-label-size, .94rem);
  font-weight: 750;
  line-height: 1.35;
}

#adminScreen .admin-page-size {
  grid-template-columns: auto auto;
  align-items: center;
  align-self: end;
  gap: 8px;
  color: var(--text-soft);
  font-size: var(--ui-label-size, .94rem);
  font-weight: 750;
}

#adminScreen .admin-page-size select {
  width: auto;
  min-width: 64px;
  height: 34px;
  min-height: 34px;
  padding: 0 24px 0 10px;
  border-radius: 10px;
  font-size: var(--ui-field-font-size, .9375rem) !important;
  font-weight: 400 !important;
}

#adminScreen :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
  border-radius: var(--ui-field-radius, 12px);
  font-family: var(--font);
  font-size: var(--ui-field-font-size, .9375rem);
  font-weight: 400;
  letter-spacing: 0;
}

#adminScreen :is(input:not([type="checkbox"]):not([type="radio"]), select) {
  min-height: var(--ui-field-height, 48px);
  height: var(--ui-field-height, 48px);
  background-color: #fbfdfe;
}

#adminScreen textarea {
  min-height: 104px;
  resize: vertical;
  background-color: #fbfdfe;
}

#adminScreen input[type="search"] {
  font-weight: 600;
}

#adminScreen .admin-list-heading-row {
  margin: 4px 0 8px;
}

#adminScreen .admin-list-heading-row h3,
#adminScreen .admin-editor-heading h3,
#adminScreen .admin-danger-content h3,
#adminScreen .admin-form-section h4 {
  margin: 0;
  color: #3e4d59;
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: 0;
}

#adminScreen .admin-list-heading-row h3,
#adminScreen .admin-editor-heading h3,
#adminScreen .admin-danger-content h3 {
  font-size: .96rem;
}

#adminScreen .admin-list-heading-row > span,
#adminScreen .admin-editor-heading p {
  margin: 0;
  color: #70808b;
  font-size: .76rem;
  font-weight: 700;
}

#adminScreen .admin-list {
  display: grid;
  gap: 8px;
}

#adminScreen .admin-list-row {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #d9e3e8;
  border-radius: 13px;
  background: #fff;
}

#adminScreen .admin-list-row-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

#adminScreen .admin-list-row-copy > strong {
  overflow: hidden;
  color: #354351;
  font-size: .86rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#adminScreen .admin-list-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 7px;
  color: #71818d;
  font-size: .74rem;
  font-weight: 650;
  line-height: 1.35;
}

#adminScreen .admin-list-row-meta > span:not(:last-child)::after {
  margin-left: 7px;
  color: #b0bdc5;
  content: "·";
}

#adminScreen .admin-list-row-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

#adminScreen .admin-row-action {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 10px !important;
}

#adminScreen .admin-row-action svg {
  width: 16px;
  height: 16px;
}

#adminScreen .admin-row-tag {
  padding: 4px 7px;
  border: 1px solid #c5d8e4;
  border-radius: 999px;
  background: #edf5f9;
  color: #46728e;
  font-size: .68rem;
  font-weight: 820;
}

#adminScreen .admin-empty-state {
  display: grid;
  min-height: 150px;
  place-content: center;
  gap: 9px;
  padding: 20px;
  color: #6f808c;
  text-align: center;
}

#adminScreen .admin-empty-state svg {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  color: #8ba0ad;
}

#adminScreen .admin-empty-state strong {
  font-size: .82rem;
  font-weight: 760;
}

#adminScreen .admin-pagination {
  margin-top: 13px;
}

#adminScreen .admin-dashboard-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

#adminScreen .admin-dashboard-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid #d6e1e7;
  border-radius: 13px;
  background: #fff;
  box-shadow: none;
  color: #4a5b68;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 780;
  text-align: left;
}

#adminScreen .admin-dashboard-link strong {
  color: #356583;
  font-size: 1rem;
  font-weight: 820;
}

#adminScreen .admin-dashboard-link svg {
  width: 17px;
  height: 17px;
  color: #7c8e9a;
}

#adminScreen .admin-dashboard-link:hover,
#adminScreen .admin-dashboard-link:focus-visible {
  border-color: #b4c9d5;
  background: #fbfdfe;
  box-shadow: 0 4px 10px rgba(39, 49, 61, .08);
  filter: none;
  transform: none;
}

#adminScreen .admin-editor-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

#adminScreen .admin-editor-heading > div {
  display: grid;
  gap: 5px;
}

#adminScreen .admin-editor-heading > button {
  min-width: 42px;
}

#adminScreen .admin-editor-form {
  display: grid;
  gap: 13px;
}

#adminScreen .admin-form-section {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #d7e2e8;
  border-radius: 13px;
  background: #fff;
}

#adminScreen .admin-form-section h4 {
  color: #51616d;
  font-size: .78rem;
}

#adminScreen .admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#adminScreen .admin-form-grid-full {
  grid-template-columns: minmax(0, 1fr);
}

#adminScreen .admin-field small {
  color: #778792;
  font-size: .71rem;
  font-weight: 650;
  line-height: 1.35;
}

#adminScreen .admin-user-types {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--ui-field-radius, 12px);
}

#adminScreen .admin-user-types legend,
#adminScreen .admin-checkbox {
  color: var(--ui-label-color, #46535e);
  font: 750 var(--ui-label-size, .94rem)/1.35 var(--font);
}

#adminScreen .admin-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

#adminScreen .admin-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

#adminScreen input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ui-action-primary, #5f7b58);
}

#adminScreen .admin-user-types small,
#adminScreen .admin-member-row small {
  display: block;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: .78rem;
  font-weight: 500;
}

#adminScreen .admin-member-list { display: grid; gap: 10px; }
#adminScreen .admin-media-grid { display: flex; align-items: start; flex-wrap: wrap; gap: 16px; }
#adminScreen .admin-media-preview figure { margin: 0; max-width: min(100%, 320px); }
#adminScreen .admin-media-preview img { display: block; max-width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; }
#adminScreen .admin-media-preview figcaption,
#adminScreen .admin-preview-note { margin: 6px 0 0; color: var(--text-soft); font-size: .8rem; line-height: 1.45; }
#adminScreen .admin-audio-preview { display: grid; gap: 10px; max-width: 100%; }
#adminScreen .admin-audio-preview audio { display: block; width: min(360px, 100%); }
#adminScreen .admin-route-preview { width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); overflow: hidden; z-index: 0; }
#adminScreen .admin-route-preview .leaflet-control-attribution { font: 400 10px/1.4 var(--font); }
#adminScreen .admin-member-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--ui-field-radius, 12px);
}

#adminScreen .admin-member-row > strong { overflow-wrap: anywhere; }
#adminScreen input[type="color"] { padding: 5px; }
#adminScreen :is(input[readonly], select:disabled) { background: var(--surface-soft); color: var(--text-soft); }
#adminScreen .admin-operation-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }

@media (max-width: 760px) {
  #adminScreen .admin-member-row { grid-template-columns: minmax(0, 1fr); }
}

#adminScreen .admin-role-control,
#adminScreen .admin-self-protection {
  margin: 13px 0 0;
  padding: 12px;
  border: 1px solid #d4dee5;
  border-radius: 13px;
  background: #f6f9fb;
}

#adminScreen .admin-role-control > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

#adminScreen .admin-role-control strong {
  color: #465762;
  font-size: .8rem;
  font-weight: 800;
}

#adminScreen .admin-role-control span,
#adminScreen .admin-self-protection {
  color: #6d7d88;
  font-size: .75rem;
  font-weight: 650;
  line-height: 1.42;
}

#adminScreen .admin-self-protection {
  color: #76623b;
  border-color: #e4d6b7;
  background: #fbf7ed;
}

#adminScreen .admin-editor-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

#adminScreen .admin-danger-zone {
  overflow: hidden;
  border: 1px solid #e0c3bf;
  border-radius: 14px;
  background: #fdf8f7;
}

#adminScreen .admin-danger-zone > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  color: #87534d;
  cursor: pointer;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 820;
  list-style: none;
}

#adminScreen .admin-danger-zone > summary::-webkit-details-marker { display: none; }
#adminScreen .admin-danger-zone > summary::marker { content: ""; }
#adminScreen .admin-danger-zone > summary svg { width: 17px; height: 17px; }

#adminScreen .admin-danger-content {
  align-items: flex-start;
  padding: 14px;
  border-top: 1px solid #ead6d2;
  gap: 16px;
}

#adminScreen .admin-danger-content > div:first-child {
  display: grid;
  max-width: 440px;
  gap: 6px;
}

#adminScreen .admin-danger-content p {
  margin: 0;
  color: #7f6b68;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.45;
}

#adminScreen .admin-danger-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  flex: 1 1 390px;
  gap: 10px;
}

#adminScreen .admin-danger-fields label,
#adminScreen .admin-operation-dialog label {
  color: #76534e;
  font-size: .74rem;
  font-weight: 780;
}

#adminScreen #adminResetAllBtn {
  align-self: end;
  white-space: nowrap;
}

#adminScreen .admin-operation-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 40, 49, .44);
}

#adminScreen .admin-operation-dialog {
  display: grid;
  width: min(100%, 440px);
  gap: 13px;
  padding: 18px;
  border: 1px solid #d2dfe6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(26, 39, 48, .25);
}

#adminScreen .admin-operation-dialog h3 {
  margin: 0;
  color: #445560;
  font-size: .96rem;
  font-weight: 820;
}

#adminScreen .admin-operation-dialog p {
  margin: 0;
  color: #6b7b87;
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.45;
}

#adminScreen .admin-operation-actions {
  justify-content: flex-end;
}

/* Administration actions deliberately use the shared, flat semantic palette. */
#adminScreen :is(.btn-save, .btn-rename, .btn-delete-user, .btn-delete-all, .btn-abort-edit, .btn-earth, .library-page-btn) {
  background-image: none !important;
  border: 1px solid rgba(20, 31, 40, .08) !important;
  color: #fff !important;
  box-shadow: var(--ui-control-shadow) !important;
  text-shadow: none !important;
}

#adminScreen :is(.btn-save, .btn-earth) { background-color: var(--ui-action-primary, #5f7b58) !important; }
#adminScreen .admin-create-btn { background-color: var(--ui-action-add, #3b796e) !important; }
#adminScreen .btn-rename { background-color: var(--ui-action-edit, #986b2c) !important; }
#adminScreen :is(.btn-delete-user, .btn-delete-all) { background-color: var(--ui-action-delete, #a75750) !important; }
#adminScreen :is(.btn-abort-edit, .library-page-btn) { background-color: var(--ui-action-neutral, #667680) !important; }

@media (hover: hover) {
  #adminScreen :is(.btn-save, .btn-rename, .btn-delete-user, .btn-delete-all, .btn-abort-edit, .btn-earth, .library-page-btn):not(:disabled):hover,
  #soundRoutesApp #soundRoutesRoot #appHeader #adminBtn:not(:disabled):hover {
    box-shadow: var(--ui-control-shadow-hover) !important;
    filter: brightness(1.04);
    transform: translateY(-1px);
  }
}

@media (max-width: 760px) {
  #adminScreen .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #adminScreen .admin-list-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  #adminScreen .admin-create-btn { grid-column: 1 / -1; justify-self: start; }
  #adminScreen .admin-danger-content { display: grid; }
  #adminScreen .admin-danger-fields { width: 100%; }
  #adminScreen #adminResetAllBtn { justify-self: start; }
}

@media (max-width: 580px) {
  #adminScreen .admin-title-row,
  #adminScreen .admin-editor-heading,
  #adminScreen .admin-list-row,
  #adminScreen .admin-role-control {
    align-items: stretch;
    flex-direction: column;
  }

  #adminScreen .admin-title-actions,
  #adminScreen .admin-list-row-actions,
  #adminScreen .admin-editor-actions,
  #adminScreen .admin-operation-actions {
    justify-content: flex-start;
  }

  #adminScreen .admin-list-toolbar,
  #adminScreen .admin-form-grid,
  #adminScreen .admin-danger-fields,
  #adminScreen .admin-dashboard-links {
    grid-template-columns: minmax(0, 1fr);
  }

  #adminScreen .admin-page-size { justify-content: start; }
  #adminScreen .admin-create-btn { grid-column: auto; }
  #adminScreen .admin-list-row-actions { justify-content: flex-start; }
}
/* Compact, sorted multi-select effects dropdown with on-demand help. */
#recordingPanel #audioEffectsPanel {
  display: flex !important; flex-direction: column; width: 100% !important; max-width: none;
  gap: 8px !important; margin: 12px 0 0 !important; text-align: left;
}
#recordingPanel #audioEffectsPanel.hidden,
#recordingPanel #audioEffectsPanel [hidden] { display: none !important; }
#recordingPanel #audioEffectsPanel .effect-dropdown-toggle {
  width: 100% !important; max-width: none !important; min-height: 44px !important;
  display: flex !important; align-items: center !important; gap: 8px !important;
  padding: 9px 12px !important; border: 1px solid #b9c9d2 !important;
  border-radius: 10px !important; background: #fff !important; color: #3f4750 !important;
  box-shadow: none !important; font-family: inherit; font-size: 13px !important; font-weight: 700 !important;
}
#recordingPanel #audioEffectsPanel .effect-dropdown-toggle svg { display: block !important; flex: 0 0 18px; width: 18px !important; height: 18px !important; color: inherit !important; stroke: currentColor !important; }
#recordingPanel #audioEffectsPanel .effect-dropdown-toggle svg * { color: inherit !important; stroke: currentColor !important; }
#audioEffectsPanel .effect-count { margin-left: auto; color: #526470; font-size: 12px; white-space: nowrap; }
#audioEffectsPanel .effect-dropdown-toggle[aria-expanded="true"] .effect-dropdown-chevron { transform: rotate(180deg); }
#audioEffectsPanel .effect-dropdown-menu {
  max-height: min(400px, 55vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; border: 1px solid #b9c9d2; border-radius: 10px; background: #fff; scrollbar-gutter: stable;
}
#audioEffectsPanel .effect-section-title {
  margin: 4px 8px 6px; font-family: inherit; font-size: 11px; font-weight: 700;
  line-height: 1.5; letter-spacing: .035em; color: #526470;
}
#audioEffectsPanel .effect-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 12px; }
#audioEffectsPanel .audio-effect-option {
  min-width: 0; padding: 3px 8px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; box-shadow: none; color: #3f4750;
}
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="fadeIn"] { --effect-color: #287348; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="fadeOut"] { --effect-color: #9a591c; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="normalize"] { --effect-color: #3569a5; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="lowCut"] { --effect-color: #79701b; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="softTreble"] { --effect-color: #007b83; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="compress"] { --effect-color: #665499; }
:is(#audioEffectsPanel, #studioScreen) :is([data-effect-name="eq"],[data-effect-name="graphicEq"]) { --effect-color: var(--ui-action-primary); }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="reverb"] { --effect-color: #904c9d; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="distortion"] { --effect-color: #ad423a; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="echo"] { --effect-color: #247f9b; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="chorus"] { --effect-color: #ad4878; }
:is(#audioEffectsPanel, #studioScreen) [data-effect-name="tremolo"] { --effect-color: #636ab5; }
#studioScreen [data-effect-name="bandPass"] { --effect-color:#776519; }
#studioScreen [data-effect-name="notch"] { --effect-color:#2b7e7e; }
#studioScreen [data-effect-name="multiTap"] { --effect-color:#547598; }
#studioScreen [data-effect-name="flanger"] { --effect-color:#945f93; }
#studioScreen [data-effect-name="ringMod"] { --effect-color:#9a6549; }
#studioScreen [data-effect-name="harmonizer"] { --effect-color:#4c749e; }
#studioScreen [data-effect-name="granular"] { --effect-color:#746a99; }
#audioEffectsPanel .audio-effect-option.checked {
  background: color-mix(in srgb, var(--effect-color) 8%, white);
  border-color: color-mix(in srgb, var(--effect-color) 32%, white);
}
#audioEffectsPanel .effect-option-row { display: flex; gap: 8px; align-items: center; }
#audioEffectsPanel .effect-choice {
  display: flex; flex: 1; align-items: center; gap: 10px; min-height: 38px;
  margin: 0; padding: 0; cursor: pointer;
}
#audioEffectsPanel input[type="checkbox"] {
  appearance: auto; position: static; opacity: 1; width: 18px; height: 18px;
  flex: 0 0 18px; margin: 0; accent-color: var(--effect-color, #4f7ea8);
}
#recordingPanel #audioEffectsPanel .effect-info-button {
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 32px !important; min-width: 32px !important; max-width: 32px !important;
  height: 32px !important; min-height: 32px !important; padding: 6px !important;
  border: 1px solid #cbd8df !important; border-radius: 8px !important; margin: 0 !important;
  color: var(--effect-color, #4f7ea8) !important; background: #fff !important; box-shadow: none !important;
}
#recordingPanel #audioEffectsPanel .effect-info-button[aria-expanded="true"] { background: color-mix(in srgb, var(--effect-color) 12%, white) !important; border-color: var(--effect-color) !important; }
#recordingPanel #audioEffectsPanel .effect-info-button svg { width: 18px !important; height: 18px !important; }
#audioEffectsPanel :is(.effect-name, .effect-duration label, .effect-duration output) {
  font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.4; letter-spacing: normal; white-space: normal;
}
#audioEffectsPanel :is(.effect-description, .effect-hint, .effect-warning, .effect-status, .effect-selection) {
  margin: 0; font-family: inherit; font-size: 12px; font-weight: 400; line-height: 1.6; color: #596672; white-space: normal;
}
#audioEffectsPanel .effect-selection { display: flex; flex-wrap: wrap; gap: 6px; }
#audioEffectsPanel .effect-selected-icon {
  display: inline-flex; position: relative; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; color: var(--effect-color);
  background: color-mix(in srgb, var(--effect-color) 9%, white);
  border: 1px solid color-mix(in srgb, var(--effect-color) 32%, white);
}
#audioEffectsPanel .effect-selected-icon svg { width: 18px; height: 18px; }
#audioEffectsPanel .effect-selected-icon:focus-visible { outline: 2px solid var(--effect-color); outline-offset: 2px; }
#audioEffectsPanel .effect-selected-icon:focus-visible::after {
  content: attr(aria-label); position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 10;
  padding: 4px 8px; border-radius: 6px; background: #263540; color: white; white-space: nowrap;
}
#audioEffectsPanel .effect-description { padding: 4px 0 8px 28px; }
#audioEffectsPanel .effect-duration { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; padding: 0 0 8px 28px; }
#audioEffectsPanel .effect-duration label { margin: 0; }
#audioEffectsPanel .effect-duration output { font-variant-numeric: tabular-nums; color: #315f86; }
#audioEffectsPanel input[type="range"] { grid-column: 1 / -1; width: 100%; height: 28px; margin: 0; padding: 0; accent-color: #4f7ea8; cursor: pointer; }
#audioEffectsPanel input:disabled { opacity: .45; cursor: default; }
#audioEffectsPanel :is(input, button):focus-visible { outline: 2px solid #315f86; outline-offset: 2px; }
#audioEffectsPanel .effect-warning { padding: 8px 10px; border: 1px solid #e4d1a6; border-radius: 10px; background: #fcf8ed; color: #76551e; }
#audioEffectsPanel .effect-status { color: #315f86; }
