/* ==========================================================================
   Meu Aquário — Dashboard
   ========================================================================== */

:root {
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

.img {
  filter: contrast(1.04) brightness(1.05) saturate(1.02);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-page);
  color: var(--text-dark);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html {
  scrollbar-gutter: stable;
}

html.android-webview body {
  padding-top: max(24px, env(safe-area-inset-top));
}

html.android-webview .sidebar {
  background: #042f2e;
  background: var(--sidebar-bg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

html.android-webview .app-shell {
  min-height: calc(100vh - max(24px, env(safe-area-inset-top)));
}

.page-kicker {
  margin: 0 0 5px;
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-label-row[hidden] {
  display: none;
}

.field-label-row>label {
  margin-bottom: 0;
}

.field-help {
  position: relative;
  flex: 0 0 auto;
}

.field-help__trigger {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  cursor: help;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  list-style: none;
}

.field-help__trigger::-webkit-details-marker {
  display: none;
}

.field-help__trigger:hover,
.field-help__trigger:focus-visible {
  border-color: var(--brand-green);
  color: var(--brand-green);
}

.field-help__trigger:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.field-help__popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: none;
  width: 240px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
  color: var(--text-dark);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.field-help__popover ul {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.field-help__popover li+li {
  margin-top: 3px;
}

.field-help[open] .field-help__popover,
.field-help:hover .field-help__popover,
.field-help:focus-within .field-help__popover {
  display: block;
}

svg {
  width: 100%;
  height: 100%;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------------------------- Sidebar ---------------------------------- */

.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.2s ease;
}

/* Recolhida: só ícones, texto escondido */
.sidebar.sidebar--collapsed {
  width: 84px;
  padding-left: 14px;
  padding-right: 14px;
}

.sidebar.sidebar--collapsed .brand {
  justify-content: center;
  padding: 4px 0;
}

.sidebar.sidebar--collapsed .brand-name,
.sidebar.sidebar--collapsed .btn-label,
.sidebar.sidebar--collapsed .nav-link span,
.sidebar.sidebar--collapsed .sidebar-collapse span {
  display: none;
}

.sidebar.sidebar--collapsed .brand-icon img {
  visibility: hidden;
}

.sidebar.sidebar--collapsed .btn-new-process {
  padding: 12px;
}

.sidebar.sidebar--collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}

.sidebar.sidebar--collapsed .sidebar-collapse {
  justify-content: center;
}

.sidebar.sidebar--collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.brand-icon img {
  /*width: 60px;*/
  height: 210px;
  border-radius: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  flex-shrink: 0;
}

.brand-name {
  color: var(--sidebar-text-strong);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.btn-new-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  transition: filter 0.15s ease;
}

.btn-new-process svg {
  width: 17px;
  height: 17px;
}

.btn-new-process:hover {
  filter: brightness(1.08);
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--sidebar-text);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2.2;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-strong);
  font-weight: 700;
}

.nav-link:hover svg,
.nav-link.active svg {
  transform: scale(1.04);
}

.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-top: 1px solid var(--sidebar-border);
  color: var(--text-faint);
  font-size: 13.5px;
  padding: 16px 12px 4px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
}

.sidebar-version {
  width: 100%;
  border: 0;
  background: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  opacity: 0.8;
  overflow-wrap: anywhere;
  padding: 8px 0;
  text-align: center;
}

.sidebar-version:hover,
.sidebar-version:focus-visible {
  color: var(--sidebar-text-strong);
  opacity: 1;
  text-decoration: underline;
}

.sidebar-collapse svg {
  width: 16px;
  height: 16px;
}

.sidebar-collapse:hover {
  color: var(--sidebar-text-strong);
}

/* ---------------------------------- Main area ---------------------------------- */

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-page);
  position: relative;
  z-index: 1;
}

.topbar:has(.search-form:focus-within) {
  z-index: 30;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 22, 14, 0.4);
  z-index: 15;
}

.sidebar-backdrop.is-visible {
  display: block;
}

.menu-toggle-btn {
  display: none;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dark);
}

.menu-toggle-btn svg {
  width: 20px;
  height: 20px;
}

.menu-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.search-form {
  --search-entry-x: 0px;
  --search-entry-y: -80px;
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eae7db;
  border-radius: 999px;
  padding: 10px 16px;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, width 160ms ease;
  position: relative;
  z-index: 2;
}

.search-form:focus-within {
  position: fixed;
  top: 25%;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  transform: translate(-50%, -50%) scale(1.03);
  animation: search-focus-in 180ms ease-out both;
  background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--focus-ring-search);
}

html:not(.android-webview) .search-form:focus-within {
  top: 40%;
}

html.android-webview .search-form:focus-within {
  right: auto;
  left: max(16px, calc((100vw - 720px) / 2));
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  margin: 0;
  transform: none;
  animation: search-focus-in-webview 180ms ease-out both;
}

html:not(.android-webview):has(.search-form:focus-within),
html:not(.android-webview) body:has(.search-form:focus-within) {
  overflow: hidden;
  overscroll-behavior: none;
}

html.android-webview:has(.search-form:focus-within),
html.android-webview body:has(.search-form:focus-within) {
  overscroll-behavior: none;
  touch-action: none;
}

@keyframes search-focus-in {
  from {
    opacity: 0.7;
    transform: translate(calc(-50% + var(--search-entry-x)),
        calc(-50% + var(--search-entry-y))) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.03);
  }
}

@keyframes search-focus-in-webview {
  from {
    opacity: 0.7;
    transform: translateY(-80px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.search-form .search-icon {
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: color 160ms ease;
}

.search-form:focus-within .search-icon {
  color: var(--brand-green);
}

.app-shell:has(.search-form:focus-within) .sidebar,
.app-shell:has(.search-form:focus-within) .content,
.app-shell:has(.search-form:focus-within) .topbar> :not(.search-form) {
  filter: blur(5px);
  opacity: 0.52;
  pointer-events: none;
  transition: filter 160ms ease, opacity 160ms ease;
}

.search-form input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--text-dark);
  font-family: inherit;
}

.search-form input::placeholder {
  color: var(--text-faint);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.tutorial-launcher svg {
  width: 24px;
  height: 24px;
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0483d;
  border: 2px solid var(--bg-page);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
}

.user-menu:hover {
  background: rgba(0, 0, 0, 0.05);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  font-size: 14.5px;
}

.chevron {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ---------------------------------- Dropdowns ---------------------------------- */

.dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  min-width: 240px;
  border: 1px solid var(--dropdown-panel-border);
  background: var(--dropdown-panel-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--dropdown-panel-shadow);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  z-index: 30;
}

.dropdown-panel--right {
  right: 0;
}

.dropdown-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notifications-panel {
  width: min(420px, 90vw);
}

.notifications-panel .dropdown-header {
  padding: 10px 12px;
  font-size: 15px;
}

.notifications-panel .dropdown-list {
  gap: 8px;
  max-height: min(420px, var(--app-notifications-list-limit, 420px));
  padding: 2px;
}

.notifications-panel .notification-item {
  position: relative;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  padding: 12px;
  overflow-wrap: anywhere;
}

.notification-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.notification-item-footer .dropdown-item-time {
  margin: 0;
}

.notification-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--warning-fg);
  cursor: pointer;
}

.notification-delete:hover {
  background: var(--surface-subtle);
}

.notification-delete:focus-visible {
  outline: 2px solid var(--warning-fg);
  outline-offset: 2px;
}

.notification-delete svg {
  width: 17px;
  height: 17px;
  color: var(--warning-fg);
  stroke: var(--warning-fg);
}

.notification-delete:disabled {
  cursor: wait;
  opacity: 0.55;
}

.notifications-panel .notification-item--unread {
  border-left: 3px solid var(--brand-green);
  background: var(--surface-subtle);
}

.notifications-panel .notification-item:hover {
  background: var(--surface-subtle);
}

.notification-item .dropdown-item-title {
  font-weight: 700;
  padding-right: 72px;
}

.notification-message {
  margin: 6px 0;
  color: var(--text-dark);
  line-height: 1.45;
  white-space: pre-line;
}

.notification-item .dropdown-item--link {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 0;
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.notification-item .dropdown-item--link:hover,
.notification-item .dropdown-item--link:focus {
  background: transparent;
}

.notification-item .dropdown-item--link:hover {
  text-decoration: underline;
}

.notification-item .dropdown-item--link:focus-visible {
  outline: 2px solid var(--brand-green);
  outline-offset: 2px;
}

.dropdown-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  padding: 8px 10px 6px;
}

.dropdown-theme-group {
  margin: 8px 0;
  padding: 0 2px;
}

.dropdown-theme-options {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.dropdown-theme-option {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.dropdown-theme-option svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.dropdown-theme-option:hover,
.dropdown-theme-option:focus-visible {
  background: var(--surface-subtle);
  color: var(--text-dark);
}

.dropdown-theme-option[aria-checked="true"] {
  background: var(--surface-subtle);
  color: var(--brand-green);
}

.dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-dark);
}

li.dropdown-item {
  cursor: default;
}

.dropdown-item--link {
  cursor: pointer;
}

.dropdown-item--with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item--with-icon svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.dropdown-item--link:hover,
li.dropdown-item:hover {
  background: var(--bg-page);
}

.dropdown-item--danger {
  color: var(--warning-fg);
}

.dropdown-item-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dark);
}

.dropdown-item-time {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.dropdown-empty {
  padding: 16px 10px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.dropdown-logout-form {
  margin: 0;
}

.dropdown-logout-form .dropdown-item {
  width: 100%;
}

.content {
  padding: 28px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.floating-mobile-menu {
  display: none;
}

/* ---------------------------------- Info banner ---------------------------------- */

.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-green-100);
  color: var(--accent-green-700);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
}

.info-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------------------------------- Page header ---------------------------------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  /* margin-bottom: 28px; */
}

.page-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.page-header .page-header-actions> :only-child:not(.view-toggle) {
  margin-left: auto;
}

.page-header-actions>.action-link,
.page-header-actions>.default-back-link,
.page-header-actions>.listing-filter-toggle {
  box-sizing: border-box;
  gap: 7px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.page-header-actions>.default-back-link {
  box-shadow: none;
}

.page-header-actions>.action-link svg,
.page-header-actions>.default-back-link svg,
.page-header-actions>.listing-filter-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.page-header-actions .toggle-btn {
  box-sizing: border-box;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
  line-height: 1.2;
}

.page-header h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid #e5e4dc;
  border-radius: 999px;
  background: #eeede7;
}

.filter-toggle {
  width: fit-content;
  margin: 0 auto 24px;
}

.filter-toggle .toggle-btn {
  white-space: nowrap;
}

.toggle-btn {
  display: inline-flex;
  min-width: 112px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  color: #686f69;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.toggle-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.toggle-btn.active {
  background: #fff;
  color: var(--accent-green-700);
  box-shadow: 0 1px 3px rgba(20, 30, 20, .12);
}

.toggle-btn:not(.active):hover,
.toggle-btn:not(.active):focus-visible {
  color: var(--text-dark);
  background: rgba(255, 255, 255, .55);
}

.toggle-btn:focus-visible {
  outline: 2px solid var(--accent-green-500);
  outline-offset: 2px;
}

.section-subtitle {
  margin: 4px 0 20px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ---------------------------------- Water page ---------------------------------- */

.page-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

.action-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
}

.action-group-label {
  padding: 0 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.action-group-links {
  display: flex;
  gap: 5px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.action-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.action-link--primary {
  border: 0;
  background: var(--brand-green);
  color: var(--text-on-accent);
}

.action-link--secondary {
  background: var(--card-bg);
  color: var(--accent-green-700);
  border: 1px solid var(--border-subtle);
}

.action-link--card {
  background: var(--card-bg);
  color: var(--brand-green);
}

.action-link:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.parameter-metrics {
  padding-top: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.parameter-metric {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border-left: 4px solid var(--parameter-color, var(--accent-green-500));
}

.parameter-metric--temperatura {
  --parameter-color: var(--parameter-color-temperatura);
}

.parameter-metric--ph {
  --parameter-color: var(--parameter-color-ph);
}

.parameter-metric--gh {
  --parameter-color: var(--parameter-color-gh);
}

.parameter-metric--kh {
  --parameter-color: var(--parameter-color-kh);
}

.parameter-metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 7px;
}

.parameter-metric strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.parameter-metric small {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 3px;
  font-weight: 600;
}

.parameter-note {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  padding: 24px 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state p {
  margin: 0;
}

/* ---------------------------------- Pipeline ---------------------------------- */

.pipeline {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
}

.pipeline-stage {
  flex: 1;
  min-width: 130px;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-count {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.pipeline-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
}

.pipeline-arrow {
  flex-shrink: 0;
  width: 18px;
  align-self: center;
  color: var(--text-faint);
}

.stage-1 {
  background: var(--accent-green-100);
  color: #134e4a;
}

.stage-2 {
  background: var(--accent-green-200);
  color: #134e4a;
}

.stage-3 {
  background: #5eead4;
  color: #134e4a;
}

.stage-4 {
  background: #2dd4bf;
  color: #134e4a;
}

.stage-5 {
  background: #0d9488;
  color: #ffffff;
}

.stage-6 {
  background: #134e4a;
  color: #ffffff;
}

/* ---------------------------------- Bottom grid ---------------------------------- */

.bottom-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

/* Distribution donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.donut {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.donut-hole {
  position: absolute;
  inset: 22px;
  background: var(--card-bg);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-hole strong {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.donut-hole span {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 160px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
}

.legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: var(--text-dark);
}

.legend-value {
  font-weight: 700;
}

.ring-wrap {
  margin: 10px 0 4px;
}

.ring {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  position: relative;
}

.ring-hole {
  position: absolute;
  inset: 20px;
  background: var(--card-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-hole strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-green-700);
}

.ring-caption {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsibility gaps */
.gap-boxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.gap-box {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gap-box svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.gap-box strong {
  font-size: 24px;
  font-weight: 800;
}

.gap-box span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------------------------------- Responsive ---------------------------------- */

@media (min-width: 768px) and (max-width: 1365px) {
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px 24px;
  }

  .content {
    padding: 20px 24px 48px;
    gap: 16px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-subtitle {
    font-size: 13px;
  }
}

@media (max-width: 1023px) {
  body.sidebar-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .user-name,
  .chevron {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: auto;
    z-index: 20;
    height: var(--app-visible-viewport-height, 100vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
    padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 22px));
    transform: translateX(-100%);
    -webkit-transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  html.android-webview .sidebar {
    background: #042f2e;
  }

  .sidebar.is-open {
    transform: translateX(0);
    -webkit-transform: translateX(0);
  }

  .sidebar.sidebar--collapsed {
    width: 270px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .sidebar.sidebar--collapsed .brand-name,
  .sidebar.sidebar--collapsed .btn-label,
  .sidebar.sidebar--collapsed .nav-link span,
  .sidebar.sidebar--collapsed .sidebar-collapse span {
    display: block;
  }

  .sidebar.sidebar--collapsed .nav-link,
  .sidebar.sidebar--collapsed .brand {
    justify-content: flex-start;
  }

  .sidebar-collapse {
    display: none;
  }

  .menu-toggle-btn {
    display: flex;
  }

  .page-actions {
    width: 100%;
  }

  .action-group {
    flex: 1 1 240px;
  }

  .parameter-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    padding: 16px;
    gap: 12px;
  }

  .content {
    padding: 20px 16px 64px;
  }

  .search-form {
    max-width: none;
  }

  .dropdown-panel {
    min-width: 210px;
  }

  .page-header {
    flex-direction: column;
    gap: 14px;
  }

  .page-header-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
  }

  .page-header-actions>.action-link,
  .page-header-actions>.default-back-link,
  .page-header-actions>.listing-filter-toggle {
    flex: 1 1 auto;
    width: auto;
    margin-bottom: 0;
  }

  .view-toggle {
    width: 100%;
  }

  .toggle-btn {
    flex: 1 1 0;
    min-width: 0;
  }

}

@media (max-width: 767px) {
  .field-label-row {
    position: relative;
  }

  .field-help {
    position: static;
  }

  .field-help__popover {
    left: 0;
    max-width: calc(100vw - 64px);
  }

  [data-notificacoes-url] {
    position: static;
  }

  .notifications-panel {
    left: 5vw;
    right: auto;
    width: 90vw;
    min-width: 0;
  }

  .main-area:has([data-floating-menu]) .content {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .floating-mobile-menu {
    position: fixed;
    z-index: 20;
    right: 12px;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
    left: 12px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    width: min(440px, calc(100% - 24px));
    margin: 0 auto;
    padding: 6px 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--card-bg);
    box-shadow: var(--shadow-card), 0 8px 28px rgba(20, 30, 20, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  }

  .floating-mobile-menu.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .floating-mobile-menu__button {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 160ms ease, color 160ms ease;
  }

  .floating-mobile-menu__button.is-active {
    background: var(--surface-subtle);
    color: var(--brand-green);
  }

  .floating-mobile-menu__button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
  }

  .floating-mobile-menu__button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  .floating-mobile-menu__button span {
    overflow: hidden;
    max-width: 100%;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-header-actions {
    gap: 10px;
  }

  .page-header-actions>.action-link,
  .page-header-actions>.default-back-link,
  .page-header-actions>.listing-filter-toggle {
    flex: 0 0 calc((100% - 10px) / 2);
    width: calc((100% - 10px) / 2);
    min-width: 0;
  }

  .page-header-actions>.listing-filter-toggle {
    order: 0;
  }

  .page-header-actions>.action-link--primary {
    order: 1;
  }

  .page-header-actions>.default-back-link {
    order: 0;
  }

  .page-header-actions:has(> .listing-filter-toggle)>.default-back-link {
    order: 2;
  }


  .page-header .page-header-actions> :only-child:not(.view-toggle) {
    flex-basis: 50%;
    width: 50%;
  }
}

/* Tablet: 768px to 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .topbar {
    padding: 18px 24px;
  }

  .content {
    padding: 24px 24px 56px;
  }

  .page-actions {
    width: auto;
  }

  .action-group {
    flex: 0 1 auto;
  }

  .parameter-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-form {
    max-width: 420px;
  }
}

.default-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--accent-green-700);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.default-back-link svg {
  width: 17px;
  height: 17px;
}

.default-back-link:hover,
.default-back-link:focus-visible {
  border-color: #c7e7e1;
  background: var(--accent-green-100);
}

.default-back-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgb(0 0 0 / 90%);
  pointer-events: none;
}

.lightbox.is-open {
  display: flex;
  pointer-events: auto;
}

body.lightbox-open {
  overflow: hidden;
  touch-action: none;
}

.lightbox [data-lightbox-content] {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

.lightbox [data-lightbox-close] {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: white;
  background: transparent;
  border: 0;
  font-size: 2rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {

  .floating-mobile-menu,
  .floating-mobile-menu__button {
    transition: none;
  }

  html.android-webview .search-form:focus-within {
    animation: none;
  }
}