/* ==========================================================================
   ASPasqualotto Manager — Premium Minimalist Enterprise UI (v53)
   Identidade: Linear / Vercel / Stripe Dashboard (Dark Edition)
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-main: #07080A;
  --bg-surface: #0B0D11;
  --bg-card: #0F1217;
  --bg-card-hover: #141820;
  --bg-elevated: #171B24;
  --bg-glass: rgba(7, 8, 10, 0.90);

  --border-subtle: rgba(255, 255, 255, 0.058);
  --border-muted: rgba(255, 255, 255, 0.095);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #D4A84F;
  --border-gold-subtle: rgba(212, 168, 79, 0.28);

  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --text-tertiary: #4B5563;

  --primary: #D4A84F;
  --primary-hover: #E2BA63;
  --primary-active: #C2943B;
  --primary-light: rgba(212, 168, 79, 0.09);
  --primary-glow: rgba(212, 168, 79, 0.20);
  --primary-contrast: #07080A;

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.09);
  --success-border: rgba(16, 185, 129, 0.22);

  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.09);
  --warning-border: rgba(245, 158, 11, 0.22);

  --danger: #F43F5E;
  --danger-bg: rgba(244, 63, 94, 0.09);
  --danger-border: rgba(244, 63, 94, 0.22);

  --info: #38BDF8;
  --info-bg: rgba(56, 189, 248, 0.09);
  --info-border: rgba(56, 189, 248, 0.22);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 22px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 36px -8px rgba(0, 0, 0, 0.75);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --motion-fast: 120ms;
  --motion-normal: 180ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 240px;
  --topbar-height: 56px;
}

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

html, body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14.6px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes drawerSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-fade { animation: pageEnter var(--motion-normal) var(--ease-standard) forwards; }

.sidebar-layout-switcher,
.topbar-layout-pills,
.horizontal-topnav,
.topnav-brand-badge,
#custom-nav-layout-banner {
  display: none !important;
}

/* Neutralização de tons legados chamativos */
.text-blue-400, .text-blue-300 { color: #E5E7EB !important; }
td.font-mono.text-blue-400, .asset-patrimony-pill { color: var(--primary) !important; }
.bg-blue-600 { background-color: var(--primary) !important; color: #07080A !important; }
.bg-blue-600:hover, .hover\:bg-blue-500:hover { background-color: var(--primary-hover) !important; color: #07080A !important; }
.bg-gradient-to-r.from-slate-900 { background: var(--bg-surface) !important; }

/* Sidebar */
.app-container { display: flex; min-height: 100vh; position: relative; background-color: var(--bg-main); width: 100%; }

.sidebar {
  width: var(--sidebar-width);
  background-color: #08090C;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform var(--motion-normal) var(--ease-smooth);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex; align-items: center; padding: 0 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.7rem;
}

.brand-logo-mark {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--primary-light); border: 1px solid var(--border-gold-subtle);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-family: var(--font-heading); font-weight: 700; font-size: 0.9rem; letter-spacing: -0.02em; color: var(--text-primary); }
.brand-subtitle { font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 0.75rem 0.55rem;
  display: flex; flex-direction: column; gap: 0.12rem;
}

.nav-section-group { margin-bottom: 0.25rem; }
.nav-section-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: transparent; border: none; cursor: pointer; padding: 0.36rem 0.6rem;
  border-radius: var(--radius-xs); user-select: none;
}
.nav-section-toggle:hover { background-color: rgba(255, 255, 255, 0.02); }
.nav-section-toggle .nav-section-title { font-size: 0.61rem; font-weight: 700; text-transform: uppercase; color: #525A68; letter-spacing: 0.08em; }
.nav-section-arrow { font-size: 0.5rem; color: #525A68; transition: transform var(--motion-normal) var(--ease-smooth); }
.nav-section-content { display: flex; flex-direction: column; gap: 0.06rem; overflow: hidden; max-height: 800px; opacity: 1; transition: max-height var(--motion-normal) var(--ease-smooth), opacity var(--motion-fast); }
.nav-section-group.collapsed .nav-section-content { max-height: 0; opacity: 0; pointer-events: none; }
.nav-section-group.collapsed .nav-section-arrow { transform: rotate(-90deg); }

.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.68rem; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; position: relative; transition: background-color var(--motion-fast), color var(--motion-fast); white-space: nowrap;
}
.nav-item:hover { background-color: rgba(255, 255, 255, 0.035); color: var(--text-primary); }
.nav-item.active { background: rgba(255, 255, 255, 0.045); color: #FFFFFF; font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 2.5px;
  border-radius: 0 3px 3px 0; background-color: var(--primary);
}
.nav-item .nav-icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-secondary); }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-badge { margin-left: auto; font-size: 0.62rem; padding: 0.06rem 0.36rem; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); font-weight: 600; font-family: var(--font-mono); }

.sidebar-footer { padding: 0.7rem 0.9rem; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; background: #060709; }
.user-mini-card { display: flex; align-items: center; gap: 0.55rem; overflow: hidden; }
.avatar { width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--bg-elevated); border: 1px solid var(--border-muted); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.7rem; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.63rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Topbar */
.main-wrapper { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; background-color: var(--bg-main); }
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.35rem; gap: 0.75rem;
}
.topbar-left { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.store-selector-wrapper { display: flex; align-items: center; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.28rem 0.65rem; gap: 0.4rem; flex-shrink: 0; min-width: 185px; max-width: 260px; }
.store-select { background: transparent; border: none; color: var(--text-primary); font-size: 0.79rem; font-weight: 600; cursor: pointer; outline: none; font-family: inherit; width: 100%; text-overflow: ellipsis; }
.store-select option { background: #0E1015; color: var(--text-primary); }

.global-search-btn { display: flex; align-items: center; gap: 0.5rem; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.3rem 0.7rem; color: var(--text-secondary); font-size: 0.77rem; cursor: pointer; min-width: 245px; max-width: 350px; width: 100%; }
.topbar-search-input { background: transparent; border: none; outline: none; color: var(--text-primary); font-size: 0.76rem; font-family: inherit; flex: 1; min-width: 0; cursor: pointer; text-overflow: ellipsis; }
.kbd-shortcut { flex-shrink: 0; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--border-subtle); border-radius: var(--radius-xs); padding: 0.05rem 0.35rem; font-size: 0.62rem; color: var(--text-muted); font-family: var(--font-mono); }
.topbar-right { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border-subtle); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--motion-fast); font-size: 0.82rem; }
.icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }

/* Conteúdo, Cards & Tabelas */
.content-body { padding: 1.25rem 1.5rem; flex: 1; width: 100%; max-width: 1640px; margin: 0 auto; }
.enterprise-breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.45rem; font-weight: 500; }
.enterprise-breadcrumb span.bc-current { color: var(--text-secondary); font-weight: 600; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.15rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; gap: 0.75rem; }
.page-title-group h1 { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.page-title-group p { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.12rem; }
.action-group { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.38rem; padding: 0.4rem 0.82rem; font-size: 0.78rem; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: all var(--motion-fast); text-decoration: none; font-family: inherit; user-select: none; white-space: nowrap; }
.btn-primary { background: var(--primary) !important; color: var(--primary-contrast, #07080A) !important; border-color: transparent !important; }
.btn-primary:hover { background: var(--primary-hover) !important; }
.btn-secondary { background: var(--bg-card); border-color: var(--border-muted); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-hover); color: #FFFFFF; }
.btn-danger { background: var(--danger-bg); border-color: var(--danger-border); color: #FDA4AF; }
.btn-success { background: var(--success-bg); border-color: var(--success-border); color: #6EE7B7; }
.btn-sm { padding: 0.26rem 0.56rem; font-size: 0.72rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 0; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); margin-bottom: 1.2rem; overflow: hidden; }
.kpi-card { background: transparent; border: none; border-right: 1px solid var(--border-subtle); padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.2rem; }
.kpi-card:last-child { border-right: none; }
.kpi-header { display: flex; align-items: center; justify-content: space-between; }
.kpi-title { font-size: 0.63rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi-value { font-family: var(--font-heading); font-size: 1.55rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1.2; }

.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.15rem; }
.card-header { padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; background: rgba(255, 255, 255, 0.008); }
.card-title { font-family: var(--font-heading); font-size: 0.86rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.42rem; }
.card-body { padding: 1.05rem; }

.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.8rem; }
.table th { background: rgba(255, 255, 255, 0.015); padding: 0.56rem 0.88rem; color: var(--text-muted); font-size: 0.63rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.table td { padding: 0.64rem 0.88rem; border-bottom: 1px solid rgba(255, 255, 255, 0.035); color: var(--text-primary); vertical-align: middle; }
.table tbody tr:hover { background-color: rgba(255, 255, 255, 0.02); }

.badge { display: inline-flex; align-items: center; gap: 0.26rem; padding: 0.13rem 0.48rem; border-radius: var(--radius-full); font-size: 0.67rem; font-weight: 600; white-space: nowrap; }
.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid var(--border-gold-subtle); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }

/* Menu Contextual & Drawer */
.ctx-action-wrapper { position: relative; display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.35rem; }
.ctx-more-btn { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border-muted); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 700; }
.ctx-dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 175px; background: #11141B; border: 1px solid var(--border-muted); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 0.3rem; z-index: 85; display: none; flex-direction: column; gap: 2px; }
.ctx-dropdown-menu.open { display: flex; }
.ctx-dropdown-menu button { width: 100% !important; justify-content: flex-start !important; background: transparent !important; border: none !important; padding: 0.42rem 0.65rem !important; font-size: 0.75rem !important; color: var(--text-primary) !important; text-align: left !important; }
.ctx-dropdown-menu button:hover { background: rgba(255, 255, 255, 0.06) !important; color: var(--primary) !important; }

.enterprise-drawer-backdrop { position: fixed; inset: 0; background: rgba(3, 4, 6, 0.65); backdrop-filter: blur(4px); z-index: 120; display: flex; justify-content: flex-end; }
.enterprise-drawer-panel { width: 100%; max-width: 480px; height: 100vh; background: #0B0D12; border-left: 1px solid var(--border-muted); box-shadow: -12px 0 40px rgba(0,0,0,0.75); display: flex; flex-direction: column; animation: drawerSlideIn 180ms var(--ease-standard) forwards; }
.enterprise-drawer-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.enterprise-drawer-body { padding: 1.25rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 1.1rem; }
.drawer-section { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.9rem; }
.drawer-section-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.65rem; }

/* Cards de Ativos */
.assets-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(325px, 1fr)); gap: 1.05rem; align-items: stretch; }
.asset-item-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1rem; display: flex; flex-direction: column; gap: 0.68rem; transition: border-color var(--motion-fast); height: 100%; }
.asset-item-card:hover { border-color: var(--border-hover); }
.asset-card-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0.48rem 0.6rem; font-size: 0.74rem; background: var(--bg-card); padding: 0.7rem; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); flex: 1; }
.detail-item[style*="flex-wrap"] { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 5px !important; }

/* Modais e Toasts */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 4, 6, 0.78); backdrop-filter: blur(8px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; pointer-events: none; transition: opacity var(--motion-normal); }
.modal-backdrop.active { opacity: 1; pointer-events: auto; }
.modal-dialog { background: #0D0F14; border: 1px solid var(--border-muted); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 0.95rem 1.25rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.85rem 1.25rem; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 0.55rem; }

.form-input, .form-select, .form-textarea { background: var(--bg-card); border: 1px solid var(--border-muted); border-radius: var(--radius-sm); padding: 0.46rem 0.7rem; color: var(--text-primary); font-size: 0.81rem; outline: none; width: 100%; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--primary-light); }

.toast-container { position: fixed; top: 1.1rem; right: 1.1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.45rem; }
.toast { background: rgba(13, 15, 20, 0.96); backdrop-filter: blur(12px); border: 1px solid var(--border-muted); border-radius: var(--radius-md); padding: 0.7rem 0.95rem; color: var(--text-primary); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 0.65rem; border-left: 3px solid var(--primary); }

.mobile-menu-btn, .mobile-bottom-nav, .mobile-search-btn { display: none; }
@media (max-width: 868px) {
  .sidebar { transform: translateX(-100%); width: 240px !important; }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .mobile-menu-btn { display: flex; }
}
@media (max-width: 768px) {
  .desktop-only-search, .topbar-search-box, .desktop-only-action { display: none !important; }
  .mobile-search-btn { display: flex !important; }
  .kpi-grid { grid-template-columns: 1fr !important; }
  .assets-card-grid { grid-template-columns: 1fr !important; }
  .mobile-bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 56px; background: rgba(8, 9, 12, 0.96); backdrop-filter: blur(16px); border-top: 1px solid var(--border-subtle); z-index: 60; align-items: center; justify-content: space-around; padding: 0 4px; }
  .mobile-nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-muted); font-size: 10px; font-weight: 600; cursor: pointer; flex: 1; height: 100%; gap: 2px; }
  .mobile-nav-btn.active { color: var(--primary) !important; }
  .mobile-nav-scanner-circle { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #07080A; display: flex; align-items: center; justify-content: center; margin-top: -14px; border: 3px solid #08090C; }
}

@media print {
  @page { size: A4 portrait; margin: 7mm !important; }
  html, body { background: #FFFFFF !important; color: #000000 !important; height: auto !important; margin: 0 !important; padding: 0 !important; }
  .app-container, #sidebar, .sidebar, .topbar, #page-container, .main-wrapper, .modal-header, .modal-footer, .btn, button, .mobile-bottom-nav, #toast-container { display: none !important; }
  .modal-backdrop.active { display: block !important; position: static !important; background: #FFFFFF !important; width: 100% !important; height: auto !important; }
  .modal-dialog, .modal-body { display: block !important; position: static !important; width: 100% !important; background: #FFFFFF !important; }
}