:root {
  --bg-main: #0b0f19;
  --bg-card: #151d2f;
  --bg-card-hover: #1c273e;
  --bg-toolbar: rgba(15, 23, 42, 0.85);
  --border-color: #243049;
  --border-highlight: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-stl: #3b82f6;
  --accent-stl-glow: rgba(59, 130, 246, 0.25);
  --accent-3mf: #10b981;
  --accent-3mf-glow: rgba(16, 185, 129, 0.25);
  --accent-cyan: #06b6d4;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.dashboard-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Lateral Esquerda */
.dashboard-sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  background: #0d121f;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.25s ease, margin-left 0.25s ease, opacity 0.25s ease;
  user-select: none;
  overflow-x: hidden;
}

.sidebar-header {
  height: 64px;
  box-sizing: border-box;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Ação Primária da Sidebar */
.sidebar-actions-wrap {
  padding: 1rem 1.25rem 0.5rem;
}

.sidebar-btn-add {
  width: 100%;
  justify-content: center;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* Conteúdo Rolável da Sidebar */
.sidebar-scrollable-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-scrollable-content::-webkit-scrollbar,
.sidebar-folders-list::-webkit-scrollbar {
  width: 5px;
  height: 0px;
}

.sidebar-scrollable-content::-webkit-scrollbar-track,
.sidebar-folders-list::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scrollable-content::-webkit-scrollbar-thumb,
.sidebar-folders-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.sidebar-scrollable-content::-webkit-scrollbar-thumb:hover,
.sidebar-folders-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Seções da Sidebar */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.4rem;
  margin-bottom: 0.2rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: #1e273e;
  border-color: rgba(59, 130, 246, 0.35);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav-item.active .nav-badge {
  background: #2563eb;
  color: #ffffff;
  border-color: transparent;
}

.nav-badge.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Grupo de Formatos da Sidebar */
.sidebar-format-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: #111624;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.sidebar-format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.45rem 0.25rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-width: 0;
}

.sidebar-format-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-format-btn.active {
  background: #1e293b;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.format-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.format-dot.stl {
  background: #3b82f6;
  box-shadow: 0 0 6px #3b82f6;
}

.format-dot.tmf {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* Pastas Conectadas na Sidebar */
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.4rem;
  margin-bottom: 0.2rem;
}

.sidebar-folders-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 9999px;
}

.sidebar-folders-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.sidebar-folders-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.6rem 0.5rem;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: #131a2a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  transition: var(--transition);
  min-width: 0;
}

.sidebar-folder-item:hover {
  border-color: rgba(56, 189, 248, 0.3);
  background: #182236;
}

.sidebar-folder-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.sidebar-folder-name {
  color: #38bdf8;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-folder-count {
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.btn-remove-sidebar-folder {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: var(--transition);
  font-size: 0.85rem;
  line-height: 1;
}

.sidebar-folder-item:hover .btn-remove-sidebar-folder {
  opacity: 1;
}

.btn-remove-sidebar-folder:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Rodapé da Sidebar */
.sidebar-footer {
  padding: 0.85rem 1.25rem;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  overflow-x: hidden;
}

.sidebar-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.stats-label {
  color: var(--text-muted);
}

.stats-val {
  color: var(--text-primary);
  font-weight: 700;
}

.sidebar-stats-bars {
  display: flex;
  gap: 0.4rem;
}

.stats-badge {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.stats-badge.stl {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.stats-badge.tmf {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Área Principal do Dashboard */
.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
}

/* Topbar do Dashboard */
.dashboard-topbar {
  height: 64px;
  background: rgba(13, 18, 31, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-sidebar-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sidebar-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Estado de colapso e responsividade da Sidebar */
.dashboard-sidebar.collapsed {
  margin-left: -280px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .dashboard-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    margin-left: -280px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
  }
  .dashboard-sidebar.mobile-open {
    margin-left: 0;
    opacity: 1;
    pointer-events: auto;
  }
}

.topbar-heading {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.topbar-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.topbar-center {
  flex: 1;
  max-width: 480px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Seletor de Ordenação no Topbar */
.sort-control-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sort-label svg {
  color: #a78bfa;
}

.custom-select-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #f1f5f9;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 28px 6px 11px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.sort-select:hover {
  background-color: rgba(51, 65, 85, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.sort-select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
  background-color: #1e293b;
}

.sort-select option {
  background: #0f172a;
  color: #f1f5f9;
  padding: 8px;
}

@media (max-width: 768px) {
  .sort-label span {
    display: none;
  }
}

.top-page-size-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botão de Ativar Modo Seleção no Topbar */
.btn-toggle-select {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-toggle-select:hover {
  color: #fff;
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-toggle-select.active {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff;
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  color: #fff;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--border-highlight);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 15px;
  height: 15px;
}

/* Buttons Globais */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #1e293b;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #283548;
  border-color: #3b82f6;
}

/* Selo de Duplicata no Card */
.badge-duplicate {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(245, 158, 11, 0.7);
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: help;
  transition: all 0.2s ease;
}

.badge-duplicate:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

/* Informações detalhadas de duplicata no Card */
.card-duplicate-info {
  font-size: 0.72rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.35);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.35rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.35;
  word-break: break-word;
}

.card-duplicate-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Badge de duplicata no cabeçalho do Modal */
.modal-duplicate-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Banner de alerta no modal */
.modal-duplicate-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.85rem;
  color: #fef3c7;
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  line-height: 1.4;
}

/* Selos e Estilos de Projeto Multi-peças no Card */
.badge-format.project,
.badge-project {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(126, 34, 206, 0.45));
  border: 1px solid rgba(192, 132, 252, 0.6);
  color: #f3e8ff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.card-project-parts-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(192, 132, 252, 0.45);
  color: #e9d5ff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.model-card.is-project {
  border-color: rgba(168, 85, 247, 0.25);
}

.model-card.is-project:hover {
  border-color: rgba(192, 132, 252, 0.6);
  box-shadow: 0 12px 32px rgba(147, 51, 234, 0.16), 0 0 0 1px rgba(192, 132, 252, 0.25);
}

.card-title-project {
  color: #c084fc !important;
  font-weight: 700;
}

/* Main Container */
.main-content {
  max-width: 1440px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
  flex: 1;
  width: 100%;
}

/* Empty State / Dropzone */
.empty-state {
  border: 2px dashed #243049;
  border-radius: var(--radius-lg);
  padding: 5rem 2rem;
  text-align: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.4) 0%, rgba(11, 15, 25, 0) 70%);
  transition: var(--transition);
  margin-top: 1rem;
}

.empty-state.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  transform: scale(1.005);
}

/* Card de Reconexão de Pastas Salvas */
.saved-folders-reconnect-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(10px);
}

.reconnect-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.reconnect-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #60a5fa;
  flex-shrink: 0;
}

.reconnect-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.reconnect-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.saved-folders-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  max-height: 170px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.saved-folder-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.saved-folder-name {
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-folder-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.reconnect-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reconnect-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reconnect-divider::before,
.reconnect-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.reconnect-divider span {
  padding: 0 0.75rem;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  padding: 18px;
  border-radius: 50%;
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-desc {
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 1.75rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.empty-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Seções da Galeria (Favoritos e Todos) */
.gallery-section {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-icon {
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Grid de Modelos */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

/* Card do Modelo */
.model-card {
  background: #141721;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  padding: 7px;
}

.model-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.45);
  background: #1c2232;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.15);
}

.card-thumbnail-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
}

.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.model-card:hover .card-thumbnail {
  transform: scale(1.05);
}

.badge-format {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.badge-sliced-card {
  position: absolute;
  top: 10px;
  left: 62px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Botão de Favorito no Card */
.btn-favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  opacity: 0.5;
}

.model-card:hover .btn-favorite {
  opacity: 1;
}

.btn-favorite:hover {
  transform: scale(1.15);
  background: rgba(15, 23, 42, 0.95);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

.btn-favorite.active {
  opacity: 1;
  color: #fbbf24;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.btn-favorite.active svg {
  fill: #fbbf24;
  stroke: #fbbf24;
}

.btn-favorite:active {
  transform: scale(0.9);
}

.badge-format.stl,
.badge-format.format-stl {
  background: var(--accent-stl);
  color: #ffffff;
  box-shadow: 0 0 10px var(--accent-stl-glow);
}

.badge-format.\33 mf,
.badge-format[class*="3mf"],
.badge-format.format-3mf {
  background: #10b981;
  background: var(--accent-3mf);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 10px var(--accent-3mf-glow);
}

.card-quick-preview {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: var(--transition);
}

.model-card:hover .card-quick-preview {
  opacity: 1;
  transform: translateY(0);
}

.card-body {
  padding: 0.65rem 0.4rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 28px;
  position: relative;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  user-select: none;
}

.card-title-base {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title-ext {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 1px;
  flex-shrink: 0;
}

.btn-card-rename {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.2s, color 0.2s, background-color 0.2s;
  flex-shrink: 0;
}

.model-card:hover .btn-card-rename {
  opacity: 0.85;
}

.btn-card-rename:hover {
  opacity: 1 !important;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

/* Modo de edição de nome no Card */
.card-rename-box {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.card-rename-input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1.5px solid #38bdf8;
  border-radius: 6px;
  padding: 2px 4px 2px 8px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.card-rename-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 3px 0;
  font-family: inherit;
}

.card-rename-ext-locked {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: lowercase;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  user-select: none;
  pointer-events: none;
  margin-left: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.card-rename-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.btn-rename-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.btn-rename-confirm {
  color: #10b981;
}

.btn-rename-confirm:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: scale(1.1);
}

.btn-rename-cancel {
  color: #ef4444;
}

/* Rodapé do Card: Ações & Botão Abrir no Fatiador */
.card-footer-actions {
  margin-top: auto;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-open-slicer {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-decoration: none;
}

.btn-open-slicer:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-open-slicer:active {
  transform: translateY(0);
}

.btn-open-slicer.loading {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}

.spinner-tiny {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Modal: Botão Abrir no Fatiador Fixo no Rodapé */
.modal-sidebar-footer {
  padding: 0.85rem 1rem;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  position: sticky;
  bottom: 0;
  z-index: 20;
  flex-shrink: 0;
}

.btn-modal-slicer-footer {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 0.2px;
  user-select: none;
}

.btn-modal-slicer-footer:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #93c5fd;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
  transform: translateY(-2px);
}

.btn-modal-slicer-footer:active {
  transform: translateY(0);
}

.btn-modal-slicer-footer.loading {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}

/* Barra de Paginação da Galeria */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 2.25rem;
  padding: 0.9rem 1.25rem;
  background: #111624;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.pagination-size-wrap,
.section-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pagination-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.page-size-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #0b0f19;
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.page-size-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.page-size-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.page-size-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.4);
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pagination-info strong {
  color: var(--text-primary);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.page-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #1c2436;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.page-nav-btn:hover:not(:disabled) {
  background: #26334d;
  border-color: #3b82f6;
  color: #fff;
}

.page-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-num-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #161e30;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.page-num-btn:hover:not(.active):not(.ellipsis) {
  background: #222d46;
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.page-num-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.page-num-btn.ellipsis {
  background: transparent;
  border: none;
  cursor: default;
  color: var(--text-muted);
  min-width: 20px;
}

/* Sistema de Notificações Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2);
  border-left: 4px solid #38bdf8;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  pointer-events: auto;
  max-width: 420px;
}

.toast-item.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-item.toast-success {
  border-left-color: #10b981;
  background: #064e3b;
  color: #d1fae5;
}

.toast-item.toast-error {
  border-left-color: #ef4444;
  background: #450a0a;
  color: #fee2e2;
}

.toast-item.toast-warning {
  border-left-color: #f59e0b;
  background: #451a03;
  color: #fef3c7;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-text {
  line-height: 1.4;
  word-break: break-word;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.card-dimensions {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Informações de Fatiamento no Card */
.card-slicer-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.2);
  margin-top: 4px;
}

.badge-sliced-card {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(16, 185, 129, 0.9);
  color: #022c22;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Seção de Fatiamento no Modal Sidebar */
.slicer-section {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  border-radius: var(--radius-md);
  padding: 0.85rem !important;
}

.slicer-header-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.slicer-header-badge h4 {
  margin-bottom: 0 !important;
  color: #34d399 !important;
  font-weight: 700;
}

.badge-status-sliced {
  background: #065f46;
  color: #6ee7b7;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.slicer-val-time {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}

.slicer-val-weight {
  color: #fbbf24 !important;
  font-weight: 700 !important;
}

/* Spinner / Skeleton */
.thumb-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 3D Modal Viewer */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1050px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-header {
  padding: 1rem 1.5rem;
  background: #162032;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.modal-title-wrap .badge-format {
  position: static;
}

.modal-title-path-wrap {
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.modal-title {
  font-size: 0.96rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  line-height: 1.3;
  min-width: 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.modal-title:hover {
  opacity: 0.92;
}

.modal-path-folder {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58vw;
}

.modal-path-name {
  color: #60a5fa;
  font-weight: 700;
  font-size: 0.96rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-copy-path {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-copy-path:hover {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
  transform: translateY(-1px);
}

.btn-copy-path:active {
  transform: translateY(0);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.modal-content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.canvas-container {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  height: 100%;
  background: radial-gradient(circle at center, #1e293b 0%, #0b0f19 100%);
  overflow: hidden;
}

.viewer-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Imagem da Mesa de Impressão (Modo 2D rápido) */
.viewer-plate-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: radial-gradient(circle at center, #1b2438 0%, #0d121f 100%);
  user-select: none;
}

/* Overlay de Carregamento da Malha 3D */
.viewer-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  z-index: 10;
  color: #93c5fd;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Botão Flutuante 'Visualizar 3D' e 'Ver Foto da Mesa' sobre a imagem expandida */
.btn-floating-view {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border: 1.5px solid #3b82f6;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(59, 130, 246, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 0.3px;
}

.btn-floating-view:hover {
  background: #2563eb;
  border-color: #60a5fa;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
  transform: translateY(-2px);
}

.btn-floating-view svg {
  color: #60a5fa;
  transition: transform 0.2s ease;
}

.btn-floating-view:hover svg {
  color: #ffffff;
  transform: scale(1.1);
}

.btn-floating-view.btn-back-plate {
  border-color: #10b981;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(16, 185, 129, 0.35);
}

.btn-floating-view.btn-back-plate:hover {
  background: #059669;
  border-color: #34d399;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-floating-view.btn-back-plate svg {
  color: #34d399;
}

/* Seção de Mesas de Impressão na Barra Lateral */
.plates-section {
  background: transparent;
  border: none !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Grade 3 por linha com espaçamento nítido e sem barra de scroll interna */
.plates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  overflow: visible;
  max-height: none;
  padding: 2px 2px 8px 2px;
}

/* Card Quadrado de cada Mesa com dimensões fixas garantidas para nunca achatar */
.plate-square-card {
  position: relative;
  width: 100%;
  height: 96px;
  min-height: 96px;
  max-height: 96px;
  background: #111827;
  border: 2px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.plate-square-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.3);
}

.plate-square-card.active {
  border-color: #10b981;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
}

.plate-square-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: radial-gradient(circle at center, #1e293b 0%, #0d121f 100%);
  display: block;
}

.plate-square-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0d121f 100%);
  color: #64748b;
  font-size: 1.5rem;
}

.plate-square-num {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.plate-square-card.active .plate-square-num {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(6, 95, 70, 0.9);
}

.plate-square-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #f1f5f9;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 3px 4px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-sidebar {
  width: 350px;
  min-width: 350px;
  flex-shrink: 0;
  background: #141c2e;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.modal-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(15, 23, 42, 0.4);
}

.modal-sidebar-scroll::-webkit-scrollbar {
  width: 8px;
}

.modal-sidebar-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 4px;
}

.modal-sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

.modal-sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.38);
}

.modal-info-list {
  display: flex;
  flex-direction: column;
  background: #0f1626;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
}

.sidebar-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.info-label {
  color: var(--text-secondary);
}

.info-val {
  color: #fff;
  font-weight: 600;
  font-family: monospace;
}

.viewer-controls-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.viewer-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.viewer-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 860px) {
  .modal-content {
    flex-direction: column;
  }
  .modal-sidebar {
    width: 100%;
    height: 180px;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
}

/* ==========================================
   Modo de Seleção Múltipla & Projetos Manuais
   ========================================== */

/* Checkbox no Card de Modelo */
.card-select-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.selection-mode-active .card-select-checkbox {
  display: flex;
}

.card-select-checkbox:hover {
  border-color: #a78bfa;
  background: rgba(30, 41, 59, 0.9);
  transform: scale(1.1);
}

.model-card.is-selected .card-select-checkbox {
  background: #7c3aed;
  border-color: #c084fc;
}

.card-select-checkbox svg {
  display: none;
  color: #ffffff;
}

.model-card.is-selected .card-select-checkbox svg {
  display: block;
}

.model-card.is-selected {
  outline: 2px solid #8b5cf6 !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4) !important;
  transform: translateY(-2px);
}

/* Barra Flutuante de Ação no Rodapé */
.selection-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(124, 58, 237, 0.25);
  padding: 8px 16px 8px 20px;
  border-radius: 9999px;
  animation: slideUpFloat 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFloat {
  from {
    opacity: 0;
    transform: translate(-50%, 30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.selection-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 0.88rem;
  font-weight: 500;
}

.selection-badge-count {
  background: #7c3aed;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.selection-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-selection-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
}

.btn-selection-action.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-selection-action.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-selection-action.secondary.is-deselect {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-selection-action.secondary.is-deselect:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-selection-action.primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
}

.btn-selection-action.primary:hover {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}

.btn-selection-action.ghost {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 2px 8px;
  border-radius: 50%;
  line-height: 1;
}

.btn-selection-action.ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Modal de Criação de Projeto */
.create-project-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.create-project-modal.active {
  display: flex;
}

.create-project-card {
  position: relative;
  background: #0f172a;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(124, 58, 237, 0.2);
  z-index: 2;
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.create-project-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.create-project-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.create-project-header-text h3 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.create-project-header-text p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.create-project-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.create-project-close:hover {
  color: #fff;
}

.create-project-body {
  padding: 1.25rem 1.5rem;
}

.project-form-group {
  margin-bottom: 1.25rem;
}

.project-form-group label {
  display: block;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.project-name-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.project-name-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.project-summary-box {
  display: flex;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.project-summary-box .summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-summary-box .summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.project-summary-box .summary-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: #c084fc;
  font-family: monospace;
}

/* Seção de Escolha de Capa no Modal de Projeto */
.project-cover-section {
  margin-bottom: 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
}

.project-cover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.project-cover-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
}

.project-cover-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-cover-hint {
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-upload-cover {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c084fc;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-upload-cover:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
  border-color: #a855f7;
  transform: translateY(-1px);
}

.project-cover-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px 2px;
  min-height: 86px;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.project-cover-grid::-webkit-scrollbar {
  height: 6px;
}

.project-cover-grid::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}

.project-cover-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.project-cover-card {
  position: relative;
  width: 78px;
  min-width: 78px;
  height: 78px;
  background: #111827;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-cover-card:hover {
  border-color: #8b5cf6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.project-cover-card.selected {
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
  transform: scale(1.03);
}

.project-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: radial-gradient(circle at center, #1e293b 0%, #0d121f 100%);
  display: block;
}

.project-cover-badge {
  display: none;
  position: absolute;
  top: 3px;
  right: 3px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.project-cover-card.selected .project-cover-badge {
  display: block;
}

.project-cover-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #f1f5f9;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2;
}

.project-cover-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
  padding: 1rem 0;
}

.project-parts-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-parts-preview-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.project-parts-preview {
  max-height: 140px;
  overflow-y: auto;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-part-item {
  font-size: 0.78rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.project-part-item:last-child {
  border-bottom: none;
}

.create-project-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-project-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-project-cancel:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.btn-project-confirm {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
}

.btn-project-confirm:hover {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.5);
}

/* Botão de Desagrupar no Topo do Card do Projeto (ao lado do Favorito) */
.btn-dissolve-card {
  position: absolute;
  top: 8px;
  right: 46px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  opacity: 0.5;
}

.model-card:hover .btn-dissolve-card {
  opacity: 1;
}

.btn-dissolve-card:hover {
  transform: scale(1.15);
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.btn-dissolve-card:active {
  transform: scale(0.9);
}

/* ==========================================================================
   Autenticação & Magic Link (Supabase)
   ========================================================================== */
.auth-container {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #151e34 0%, #0b0f19 80%);
  padding: 20px;
  overflow-y: auto;
}

.auth-glow-bg {
  position: absolute;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(14, 165, 233, 0.08) 50%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(40px);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgba(18, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.12);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeInAuth 0.35s ease-out;
}

@keyframes fadeInAuth {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.auth-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-bottom: 10px;
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
  max-width: 360px;
}

.auth-alert-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
  text-align: center;
  animation: shakeError 0.3s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.auth-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.2s;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 12px 42px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #f8fafc;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.auth-input:focus + .auth-input-icon,
.auth-input-wrapper:focus-within .auth-input-icon {
  color: #818cf8;
}

.btn-auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.auth-success-banner {
  text-align: center;
  padding: 10px 0;
  animation: fadeInAuth 0.3s ease-out;
}

.auth-success-icon-wrap {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-success-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px;
}

.auth-success-desc {
  font-size: 0.92rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 20px;
}

.auth-success-desc strong {
  color: #38bdf8;
  word-break: break-all;
}

/* Caixa de Código Numérico OTP */
.auth-otp-box {
  margin: 16px 0 20px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  text-align: left;
}

.auth-otp-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.auth-otp-row {
  display: flex;
  gap: 8px;
}

.auth-otp-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
  transition: all 0.2s;
}

.auth-otp-input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.btn-verify-otp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-verify-otp:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.btn-verify-otp:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-otp-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.auth-otp-error {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #f87171;
  line-height: 1.4;
}

.auth-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-auth-secondary {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-auth-text {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.btn-auth-text:hover {
  color: #e2e8f0;
}

.auth-config-notice {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.82rem;
  color: #94a3b8;
}

.auth-config-notice p {
  margin: 0 0 8px;
}

.auth-config-notice code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  color: #cbd5e1;
}

.btn-auth-config {
  background: transparent;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  color: #818cf8;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-config:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: #6366f1;
}

/* Modal de Configuração do Supabase */
.auth-config-card {
  position: relative;
  width: 90%;
  max-width: 480px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 10000;
}

.auth-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.auth-config-header-text h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: #ffffff;
}

.auth-config-header-text p {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.auth-config-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

/* Badge do Usuário e Logout na Topbar */
.topbar-user-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 6px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 0.82rem;
  max-width: 200px;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  flex-shrink: 0;
}

.user-email-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn-logout:active {
  transform: translateY(0);
}

/* ==========================================================================
   Modais Genéricos, Backdrop e Modal de Permissão de Pasta
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  cursor: pointer;
}

.folder-permission-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeInModalOverlay 0.2s ease-out;
}

@keyframes fadeInModalOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.folder-permission-card {
  position: relative;
  width: 92%;
  max-width: 520px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.85), 0 0 40px rgba(56, 189, 248, 0.18);
  z-index: 2;
  animation: scaleUpCard 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUpCard {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.folder-permission-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

.folder-permission-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-permission-header-text {
  flex: 1;
}

.folder-permission-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 6px;
}

.folder-permission-header-text h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: #ffffff;
}

.folder-permission-header-text p {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.folder-permission-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.permission-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.permission-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.permission-item-icon.check {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.permission-item-content h4 {
  margin: 0 0 3px;
  font-size: 0.92rem;
  color: #f1f5f9;
}

.permission-item-content p {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.4;
}

.permission-notice-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.permission-notice-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 6px;
}

.permission-notice-box p {
  margin: 0;
  font-size: 0.82rem;
  color: #d1d5db;
  line-height: 1.45;
}

.permission-notice-box em {
  font-style: normal;
  color: #fcd34d;
  font-weight: 600;
}

.folder-permission-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.permission-dont-ask-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #94a3b8;
  user-select: none;
}

.permission-dont-ask-label input[type="checkbox"] {
  accent-color: #6366f1;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.btn-proceed-folder {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
  white-space: nowrap;
}

.btn-proceed-folder:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

.privacy-local-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 18px;
}


