/* * Lyra DESIGN SYSTEM v4.5 (Stateful Router + Global Gestures)
         * Architecture: Utility-First + Component-Based
         * Status: Inline-CSS Free | Pixel-Matched
         */

/* --- 1. VARIABLES (THEME TOKENS) --- */
:root {
  /* Palette */
  --primary: #000000;
  --purple: #6366f1;
  --purple-dark: #4f46e5;
  --secondary: #a6aabd;
  --accent: #8b5cf6;
  --blue: #066fd1;
  --cyan: #17a2b8;
  --azure: #4299e1;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e9edf3;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Spacing Scale */
  --space-0: 0px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-12: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 40px;

  /* Radius */
  --radius-sm: 8px;
  --radius-10: 10px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-round: 50%;

  /* Effects */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-card:
    0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-float:
    0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --blur-glass: blur(12px);

  /* Transitions */
  --trans-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --trans-smooth: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

::-webkit-scrollbar {
  width: 0px;
}

.ph-eye,
.ph-eye-slash {
  font-size: 16px;
}

/* --- 2. RESET & BASE --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  outline: rgba(0, 0, 0, 0) !important;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  height: 100vh;
  /* Fallback para navegadores antigos */
  height: 100dvh;
  /* A altura real visível no iPhone */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.linkGeral {
  color: var(--purple) !important;
  font-weight: 500;
  text-decoration: none;
  transition: var(--trans-fast);
}

.linkGeral:hover {
  color: var(--purple-dark) !important;
  text-decoration: underline;
  transition: var(--trans-fast);
}

/* --- 3. UTILITIES --- */
/* Flexbox */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.gap-xs {
  gap: var(--space-xs);
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-12 {
  gap: var(--space-12);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.flex-1 {
  flex: 1;
}

.shrink-0 {
  flex-shrink: 0;
}

/* Grid */
.grid-2-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Spacing */
.mt-0 {
  margin-top: 0;
}

.mt-xs {
  margin-top: var(--space-xs);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-xs {
  margin-bottom: var(--space-xs);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.pe-md {
  padding-right: var(--space-md);
}

.py-0 {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.p-md {
  padding: var(--space-md);
}

.pt-0 {
  padding-top: 0 !important;
}

.pb-0 {
  padding-bottom: 0 !important;
}

/* Text Utilities */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Typography Scale (Explicit) */
.text-xs {
  font-size: 12px;
}

.text-sm {
  font-size: 13px;
}

.text-base {
  font-size: 16px;
}

.text-lg {
  font-size: 20px;
}

.text-xl {
  font-size: 24px !important;
}

/* Color Utilities */
.text-primary {
  color: var(--primary);
}

.text-purple {
  color: var(--purple);
}

.text-secondary {
  color: var(--secondary);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-blue {
  color: var(--blue);
}

.text-cyan {
  color: var(--cyan);
}

.text-azure {
  color: var(--azure);
}

.text-accent {
  color: var(--accent);
}

.text-muted {
  color: var(--text-muted);
}

.text-white {
  color: white !important;
}

.bg-white {
  background-color: var(--bg-surface);
}

.bg-body {
  background-color: var(--bg-body);
}

.bg-primary {
  background-color: var(--primary);
}

.bg-purple {
  background-color: var(--purple);
}

.bg-cyan {
  background-color: var(--cyan);
}

.bg-azure {
  background-color: var(--azure);
}

.bg-secondary {
  background-color: var(--secondary);
}

.bg-danger {
  background-color: var(--danger);
}

.bg-warning {
  background-color: var(--warning);
}

.bg-transparent {
  background: transparent;
}

/* Borders & Radius */
.border-none {
  border: none;
}

.border-danger {
  border-color: var(--danger);
}

.rounded-full {
  border-radius: var(--radius-round);
}

.rounded-md {
  border-radius: var(--radius-md);
}

/* Width/Height/Interaction */
.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.h-full {
  height: 100%;
}

.cursor-pointer {
  cursor: pointer;
}

.inline-block {
  display: inline-block;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

/* --- 4. TYPOGRAPHY COMPONENTS --- */
.h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.h3 {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.caption {
  font-size: 12px;
  color: var(--text-muted);
}

.caption-white {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* --- 5. UI COMPONENTS --- */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition:
    transform 0.1s ease,
    background 0.2s;
  width: 100%;
}

.btn-circle {
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  font-weight: 500;
  font-size: 17px;
  cursor: pointer;
  border: none;
  transition:
    transform 0.1s ease,
    background 0.2s;
  width: 40px;
  height: 40px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:disabled:active {
  transform: none;
}

.btn-auto {
  width: auto;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: 2px solid var(--primary);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-main);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 2px solid rgba(239, 68, 68, 0.1);
}

.btn-ghost {
  position: relative;
  background: transparent;
  color: var(--text-muted);
  width: auto;
  padding: 8px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost.danger {
  color: var(--danger);
}

.btn-camera-float {
  font-size: 18px;
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-camera-float i {
  padding-top: 2px;
  padding-left: 2px;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
}

.card-list {
  padding: 0 var(--space-md);
}

.card-primary {
  background: var(--primary);
  color: white;
  border: none;
}

.card-secondary {
  background: var(--secondary);
  color: white;
  border: none;
}

.card-gradient {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: white;
}

.profile-card-mini {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: background 0.2s;
}

/* Lists */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.list-item:last-child {
  border-bottom: none;
}

/* Avatars & Visuals */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  object-fit: cover;
  background: #e2e8f0;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-lg {
  width: 100px;
  height: 100px;
  border: 4px solid white;
  box-shadow: var(--shadow-card);
}

.avatar-placeholder {
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.avatar-initials {
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 18px;
  text-transform: uppercase;
}

.avatar-initials.avatar-sm {
  font-size: 12px;
}

.avatar-initials.avatar-lg {
  font-size: 36px;
}

.dot-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.product-placeholder {
  height: 80px;
  border-radius: 8px;
  background: #f1f5f9;
  margin-bottom: 8px;
}

/* Badges */
.badge {
  min-width: 60px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-primary {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.badge-muted {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

/* Icons */
.icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white !important;
  flex-shrink: 0;
}

.icon-md {
  font-size: 20px;
}

.icon-lg {
  font-size: 24px;
}

.icon-xl {
  font-size: 40px;
}

/* Form Controls */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  background: var(--bg-body);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Input Group (Wrapper para Input + Olho) */
.input-group-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-eye {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 18px;
}

.btn-eye:hover {
  color: var(--primary);
}

.input-bare {
  font-size: 16px;
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  padding: 4px;
  font-family: inherit;
  color: var(--text-main);
  box-shadow: none;
  /* Remove sombras residuais */
}

.input-select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-body);
  appearance: none;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23666" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Range Slider */
input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #e2e8f02c;
  border-radius: 5px;
  outline: none;
  padding: 0;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
  border: 2px solid white;
}

/* Progress Bars */
.progress-container {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-primary {
  background: var(--primary);
}

/* Search Bar */
.search-bar {
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

/* Localize na seção 5. UI COMPONENTS */
/* Search Bar Fix */
.search-bar {
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

/* Lyra FIX: Aumentamos a especificidade usando o seletor pai (.search-bar)
           Isso vence o input[type="text"] global. */
.search-bar .search-input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  padding: 4px;
  font-family: inherit;
  color: var(--text-main);
  box-shadow: none;
  /* Remove sombras residuais */
}

/* Garante que não apareça borda ao clicar */
.search-bar .search-input:focus {
  border: none;
  box-shadow: none;
}

/* Accordion */
.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--text-main);
}

.accordion-header-end {
  padding: 24px 0 12px 0 !important;
}

.accordion-header .arrow,
.sidebar-link .arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 16px;
  color: var(--text-muted);
}

.accordion-header.expanded .arrow,
.sidebar-link.expanded .arrow {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-inner {
  padding-bottom: 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- 6. LAYOUT --- */
header {
  display: block;
  width: 100%;
  padding: 0 var(--space-md);
  padding-top: max(16px, env(safe-area-inset-top));
  background: var(--bg-body);
  position: fixed;
  top: 0;
  z-index: 10;
}

/* Header inner container for desktop alignment */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-md) 100px var(--space-md);
  scroll-behavior: smooth;
}

.container {
  max-width: 1000px;
  margin-top: calc(90px + env(safe-area-inset-top));
  margin-right: auto;
  margin-bottom: 20px;
  margin-left: auto;
  display: block;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading Spinner */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.btn-spinner {
  animation: spin 1s linear infinite;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: 24px;
}

.dashboard-grid-modules {
  grid-template-columns: 1fr 1fr;
}

/* Stat Cards */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card.cursor-pointer {
  transition: transform 0.2s;
}

.stat-card.cursor-pointer:active {
  transform: scale(0.98);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon-purple {
  /* background: rgba(131, 40, 192, 0.114); */
  color: rgb(121, 35, 179);
}

.stat-icon-success {
  /* background: rgba(34, 197, 94, 0.1); */
  color: var(--success);
}

.stat-icon-warning {
  /* background: rgba(245, 158, 11, 0.1); */
  color: var(--warning);
}

.stat-icon-default {
  /* background: rgba(99, 102, 241, 0.1); */
  color: var(--purple);
}

.stat-icon-blue {
  /* background: rgba(99, 102, 241, 0.1); */
  color: var(--blue);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--border);
  margin-top: 10px;
  margin-left: 8px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--primary);
}

/* Progress Circle */
.progress-circle {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px auto;
}

.progress-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-circle circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.bg-ring {
  stroke: var(--border);
}

.progress-ring {
  stroke: var(--success);
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.1s linear;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 20px;
}

/* Module Card */
.module-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  /* flex-direction: column; */
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition:
    transform 0.2s,
    border-color 0.2s;
}

.module-card:active {
  transform: scale(0.98);
}

.module-card .icon-box {
  border-radius: var(--radius-10);
}

/* --- 7. NAVIGATION --- */
.bottom-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  box-shadow: var(--shadow-float);
  z-index: 100;
}

.nav-item {
  display: flex;
  margin: 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition:
    color 0.3s,
    transform 0.2s;
  position: relative;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

/* --- 8. OFFCANVAS & OVERLAYS --- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
}

.overlay.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 24px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1001;
}

.sheet.open {
  transform: translateY(0);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 70%;
  max-width: 300px;
  background: var(--bg-surface);
  z-index: 1002;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 20px 24px 24px 24px;
  background: var(--bg-surface);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sidebar-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px !important;
  padding: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  cursor: pointer;

  /* --- FIX MOBILE GESTURES --- */
  user-select: none;
  /* Impede seleção de texto ao arrastar */
  -webkit-user-select: none;
  /* Safari */
  touch-action: pan-y;
  /* Melhora a detecção de rolagem vertical */
  -webkit-tap-highlight-color: transparent;
  /* Remove flash azul padrão do Android */

  /* Transição suave padrão */
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}

/* ESTADO ATIVO (Página Atual - Fixo) */
.sidebar-link.active {
  background: var(--border);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-link i {
  font-size: 20px;
}

/* --- 1. MOUSE (Desktop) --- */
/* O Hover só existe se o dispositivo tiver um mouse real */
@media (hover: hover) {
  .sidebar-link:hover {
    background: var(--border);
    color: var(--primary);
  }
}

/* --- 2. TOUCH (Mobile - Interação Controlada) --- */
/* Removemos o :active nativo para evitar flashes ao rolar */

/* Estado "Pressionado" simulado via JS */
.sidebar-link.pressed {
  background: var(--border) !important;
  transform: scale(0.96);
  transition:
    transform 0.05s,
    background-color 0.05s;
}

/* Mantém o :hover APENAS para quem tem mouse (Desktop) */
@media (hover: hover) {
  .sidebar-link:hover {
    background: var(--border);
    color: var(--primary);
  }

  /* No desktop, o active nativo ainda é útil para cliques rápidos */
  .sidebar-link:active {
    background: var(--border);
    transform: scale(0.96);
  }
}

/* --- 3. SCROLL CLEANUP (Segurança) --- */
/* Se o JS detectar rolagem, forçamos a limpeza de qualquer estilo ativo imediatamente */
.is-scrolling .sidebar-link,
.is-scrolling .sidebar-link:active,
.is-scrolling .sidebar-link:hover {
  background: transparent !important;
  color: var(--text-muted) !important;
  transform: none !important;
  pointer-events: none;
  /* Desativa cliques enquanto rola */
}

.drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: -10px auto 20px auto;
  touch-action: none;
}

/* Dropdown */
.dropdown-menu {
  display: none;
  position: absolute;
  right: 15px;
  top: 60px;
  font-size: 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 8px 0;
  width: 310px;
  z-index: 50;
  overflow: hidden;
}

.dropdown-header-action {
  font-size: 14px !important;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.dropdown-scroll {
  min-height: 60px;
  max-height: 280px;
  overflow-y: auto;
}

.dropdown-scroll::-webkit-scrollbar {
  width: 4px;
}

.dropdown-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.dropdown-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.dropdown-item {
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background var(--trans-fast);
}

.dropdown-item i {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--bg-body);
}

.dropdown-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropdown-empty i {
  font-size: 40px;
  opacity: 0.3;
}

/* Notification Badge */
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.notif-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  border-radius: 10px;
  border: 2px solid var(--bg-body);
  opacity: 0;
  transform: scale(0);
  transition:
    opacity 0.2s,
    transform 0.2s;
  will-change: box-shadow;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  padding: 0 4px;
  line-height: 1;
}

.notif-badge.active {
  opacity: 1;
  transform: scale(1);
  animation: pulse-ring 2s ease-out infinite !important;
}

/* --- 9. TOASTS --- */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: auto;
  max-width: 320px;
  white-space: nowrap;
}

.toast {
  background: rgba(30, 41, 59, 0.95);
  color: white;
  padding: 12px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideDownFade 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
}

.toast i {
  font-size: 16px;
}

.toast.hiding {
  animation: slideUpFadeOut 0.3s ease forwards;
}

@keyframes slideDownFade {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideUpFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
}

/* --- LYRA DESKTOP SIDEBAR ADAPTER --- */
@media (min-width: 1024px) {
  header {
    display: block;
    width: 100%;
    padding: 0 var(--space-xl);
    padding-top: max(16px, env(safe-area-inset-top));
    background: var(--bg-body);
    position: fixed;
    top: 0;
    z-index: 10;
  }

  .sheet {
    /* 1. Reposicionamento para o Centro */
    top: 50%;
    left: 50%;
    bottom: auto;
    /* Anula o bottom: 0 do mobile */

    /* 2. Dimensões de Modal */
    width: 100%;
    max-width: 480px;
    /* Largura confortável para leitura */
    max-height: 90vh;
    /* Evita que estoure a altura da tela */
    overflow-y: auto;
    /* Scroll interno se o conteúdo for grande */

    /* 3. Estética */
    border-radius: var(--radius-lg);
    /* Arredonda todos os cantos */
    box-shadow: var(--shadow-float);
    /* Sombra mais profunda para dar destaque */

    /* 4. Estado Inicial (Fechado - Desktop) */
    opacity: 0;
    visibility: hidden;
    /* Começa um pouco abaixo e menor (efeito pop-up) */
    transform: translate(-50%, -45%) scale(0.95);

    /* Redefine a transição para incluir opacidade e transform */
    transition:
      opacity 0.3s ease,
      transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0.3s;
  }

  .sheet.open {
    /* 5. Estado Final (Aberto - Desktop) */
    opacity: 1;
    visibility: visible;
    /* Centraliza perfeitamente e volta ao tamanho original */
    transform: translate(-50%, -50%) scale(1);
  }

  /* 6. Remove elementos visuais exclusivos do mobile */
  .sheet .drag-handle {
    display: none;
  }

  .sidebar-link:hover {
    background: var(--border);
    color: var(--primary);
    font-weight: 500;
  }

  .dropdown-menu {
    display: none;
    position: absolute;
    right: 24px;
    top: 60px;
    font-size: 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 8px 0;
    width: 310px;
    z-index: 50;
    overflow: hidden;
  }
}
