:root {
  --bg-base: #090d16;
  --bg-surface: rgba(17, 24, 39, 0.75);
  --bg-surface-solid: #111827;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(168, 85, 247, 0.4);
  --primary: #a855f7;
  --primary-hover: #9333ea;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --radius: 12px;
  --enable-effects: 1;
  --window-bg: #0f172a;
}

/* CURSOR NATIVO OCULTO & EFEITO DA BOLINHA SUAVIZADO */
*, *:hover {
  cursor: none !important;
}

.custom-cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
  will-change: transform;
}

.custom-cursor-ring {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(168, 85, 247, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, border-color 0.2s;
  will-change: transform, width, height;
}

body.effects-disabled *, body.effects-disabled *:hover {
  cursor: auto !important;
}

body.effects-disabled .custom-cursor-dot,
body.effects-disabled .custom-cursor-ring {
  display: none !important;
}

/* NOTIFICAÇÃO TOAST NO CANTO INFERIOR DIREITO */
.toast-notification {
  position: fixed;
  bottom: 25px;
  right: -350px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-hover);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(168, 85, 247, 0.2);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  opacity: 0;
}

.toast-notification.show {
  right: 25px;
  opacity: 1;
}

.toast-notification.success {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(16, 185, 129, 0.2);
}

.toast-notification.success .toast-icon {
  color: #10b981;
}

.toast-icon {
  font-size: 16px;
}

/* TEMA BRANCO / CLARO */
body.light-theme {
  --bg-base: #f1f5f9;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-surface-solid: #ffffff;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(168, 85, 247, 0.5);
  --primary: #9333ea;
  --primary-hover: #7e22ce;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --window-bg: #ffffff;
}

body.light-theme {
  background-image: radial-gradient(circle at 50% 0%, #e2e8f0 0%, var(--bg-base) 70%) !important;
}

body.light-theme .login-box,
body.light-theme .sidebar,
body.light-theme .floating-window,
body.light-theme .dash-panel,
body.light-theme .kpi-card,
body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5,
body.light-theme h6,
body.light-theme p,
body.light-theme span:not(.btn *, .nav-btn *, .badge *, .kpi-value),
body.light-theme label,
body.light-theme th,
body.light-theme td {
  color: #1f2937 !important;
}

body.light-theme .text-muted,
body.light-theme p[style*="color: var(--text-muted)"],
body.light-theme span[style*="color: var(--text-muted)"] {
  color: var(--text-muted) !important;
}

body.light-theme .window-header {
  background: var(--window-bg) !important;
}

body.light-theme select option {
  background-color: #ffffff !important;
  color: #1f2937 !important;
}

body.light-theme input, 
body.light-theme select, 
body.light-theme textarea {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid var(--border-color);
}

body.light-theme input::placeholder, 
body.light-theme textarea::placeholder {
  color: #6b7280;
}

body.light-theme table th {
  background: #f1f5f9;
  color: #1f2937;
}

body.light-theme table td {
  color: #1f2937;
  border-bottom: 1px solid var(--border-color);
}

* { box-sizing: border-box; font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-base); color: var(--text-main); height: 100vh; overflow: hidden; display: flex; flex-direction: column; background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-base) 70%); position: relative; }

.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.95;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, rgba(168,85,247,0.95) 0%, rgba(56,189,248,0.4) 50%, transparent 100%);
  border-radius: 50%;
  animation: floatParticle 15s infinite linear;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

@keyframes floatParticle {
  0% { transform: translateY(105vh) translateX(0) scale(0.6); opacity: 0; }
  20% { opacity: 0.95; }
  80% { opacity: 0.95; }
  100% { transform: translateY(-10vh) translateX(60px) scale(1.4); opacity: 0; }
}

body.effects-disabled * {
  backdrop-filter: none !important;
  animation: none !important;
  transition: none !important;
  box-shadow: none !important;
}
body.effects-disabled .bg-particles { display: none !important; }
body.effects-disabled .login-box { background: #111827 !important; border: 1px solid var(--border-color) !important; }
body.effects-disabled .sidebar { background: #0f172a !important; }
body.effects-disabled .floating-window { background: #0f172a !important; }
body.effects-disabled .kpi-card { background: #111827 !important; }
body.effects-disabled .dash-panel { background: #111827 !important; }

.login-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(9, 13, 22, 0.85); backdrop-filter: blur(20px); z-index: 9999; display: flex; justify-content: center; align-items: center; padding: 20px; animation: fadeInOverlay 0.5s ease forwards; }

@keyframes fadeInOverlay {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(20px); }
}

.login-box { 
  background: rgba(17, 24, 39, 0.85); 
  border: 1px solid var(--border-color); 
  padding: 35px; 
  border-radius: 16px; 
  width: 100%; 
  max-width: 380px; 
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1); 
  text-align: center; 
  backdrop-filter: blur(12px); 
  animation: loginPopUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.login-box::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, var(--primary), transparent, #38bdf8, transparent, var(--primary));
  background-size: 400% 400%;
  z-index: -1;
  border-radius: 18px;
  opacity: 0.3;
  animation: borderGlow 6s ease infinite;
}

@keyframes loginPopUp {
  0% { opacity: 0; transform: scale(0.9) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-box h1 { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: 4px; margin-bottom: 4px; }
.login-box p { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-bottom: 30px; letter-spacing: 2px; text-transform: uppercase; }
.login-input { width: 100%; padding: 12px 16px; border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.03); color: #fff; border-radius: 8px; margin-bottom: 15px; font-size: 13px; outline: none; transition: all 0.2s; }
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
.btn-login { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3); }
.btn-login:hover { background: var(--primary-hover); transform: translateY(-1px); }

.app-container { flex: 1; display: flex; overflow: hidden; position: relative; z-index: 2; }

.mobile-header-bar { display: none; align-items: center; justify-content: space-between; background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); padding: 10px 15px; z-index: 150; }
.btn-mobile-menu { background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-color); width: 36px; height: 36px; border-radius: 8px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.sidebar { width: 220px; background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(16px); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 16px; justify-content: space-between; z-index: 1010; user-select: none; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s; position: relative; }
.sidebar.collapsed { width: 64px; padding: 16px 8px; }
.sidebar.collapsed .brand h1, .sidebar.collapsed .brand p, .sidebar.collapsed .nav-btn span, .sidebar.collapsed #lbl-usuario-logado, .sidebar.collapsed .dev-sig { display: none !important; }
.sidebar.collapsed .brand { margin-bottom: 12px; }
.sidebar.collapsed .nav-btn { justify-content: center; padding: 10px 0; gap: 0; width: 44px; margin: 0 auto; }
.sidebar.collapsed .btn-toggle-sidebar { margin: 0 auto 12px auto; }

.sidebar-top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.btn-toggle-sidebar { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-color); width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all 0.2s; }
.btn-toggle-sidebar:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.brand h1 { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 1.5px; }
.brand p { font-size: 9px; color: var(--text-muted); font-weight: 500; letter-spacing: 1px; }

.menu-group { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: calc(100vh - 160px); scrollbar-width: none; }
.menu-group::-webkit-scrollbar { display: none; }
.nav-btn { display: flex; align-items: center; gap: 10px; background: transparent; color: var(--text-muted); border: 1px solid transparent; padding: 10px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; transition: all 0.2s ease; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.04); color: #fff; border-color: var(--border-color); }
.nav-btn.active { background: rgba(168, 85, 247, 0.15); color: #fff; border-color: rgba(168, 85, 247, 0.4); }
.btn-logout { background: rgba(239, 68, 68, 0.08); color: #fca5a5; border-color: rgba(239, 68, 68, 0.15); margin-top: 10px; }
.btn-logout:hover { background: rgba(239, 68, 68, 0.2); color: #fff; }

.dev-sig { font-size: 9px; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border-color); padding-top: 10px; margin-top: 8px; opacity: 0.75; line-height: 1.3; font-weight: 500; }
.dev-sig span { color: var(--primary); font-weight: 600; display: block; }

.main-content { flex: 1; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; position: relative; }

.dashboard-container { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 20px; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; flex-wrap: wrap; gap: 10px; }
.dash-header h2 { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.dash-header p { font-size: 12px; color: var(--text-muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; }
.kpi-card { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 20px; border-radius: var(--radius); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); opacity: 0; transition: opacity 0.25s; }
.kpi-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 15px rgba(168, 85, 247, 0.1); }
.kpi-card:hover::before { opacity: 1; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kpi-title { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.kpi-value { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.kpi-sub { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.kpi-value, #chart-val-entradas, #chart-val-saidas {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-animating {
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
}

.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; }
.dash-panel { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 20px; border-radius: var(--radius); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.dash-panel h3 { font-size: 13px; color: #fff; font-weight: 700; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.chart-container { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.chart-bar-group { display: flex; flex-direction: column; gap: 4px; }
.chart-label-row { display: flex; justify-content: space-between; font-size: 11px; font-weight: 500; }
.chart-track { width: 100%; height: 10px; background: rgba(255,255,255,0.04); border-radius: 6px; overflow: hidden; border: 1px solid var(--border-color); position: relative; }

.chart-fill { 
  height: 100%; 
  border-radius: 6px; 
  width: 0%;
  position: relative;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); 
}

.chart-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: barShine 2.5s infinite;
}

@keyframes barShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.quick-actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.action-btn { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); padding: 12px; border-radius: 10px; color: var(--text-main); font-size: 11px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s; text-align: left; }
.action-btn:hover { background: rgba(168, 85, 247, 0.15); border-color: var(--border-hover); color: #fff; transform: translateY(-1px); }

.floating-window { 
  position: absolute; 
  background: var(--window-bg); 
  color: var(--text-main); 
  width: 92%; 
  max-width: 1050px; 
  max-height: 88vh; 
  border-radius: 16px; 
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08); 
  overflow-y: auto; 
  padding: 0 25px 25px 25px; 
  display: none; 
  z-index: 100; 
  top: 30px; 
  left: 230px; 
}

.floating-window.opening {
  animation: windowOpen 0.15s ease-out forwards;
}

@keyframes windowOpen {
  0% { opacity: 0; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

.floating-window.closing {
  animation: windowClose 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes windowClose {
  0% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0px); }
  100% { opacity: 0; transform: scale(0.88) translateY(20px); filter: blur(8px); }
}

.floating-window.maximized { top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 100% !important; border-radius: 0 !important; border: none !important; }

.window-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding: 18px 0 14px 0; margin-bottom: 20px; cursor: grab; position: sticky; top: 0; background: var(--window-bg); z-index: 20; user-select: none; }
.window-header:active { cursor: grabbing; }
.window-header h2 { color: var(--text-main); font-size: 15px; margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.5px; }
.window-controls { display: flex; gap: 6px; }
.control-btn { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-color); width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.control-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.control-btn.btn-close:hover { background: #ef4444; border-color: #ef4444; color: #fff; }

.doc-empresa-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; gap: 15px; }
.doc-empresa-header h1 { color: var(--text-main); font-size: 15px; margin: 0; text-transform: uppercase; font-weight: 800; letter-spacing: 1px; }
.doc-empresa-header span { font-size: 10px; color: var(--text-muted); font-weight: 500; }

.taskbar { height: 45px; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(16px); border-top: 1px solid var(--border-color); display: flex; align-items: center; padding: 0 15px; gap: 8px; z-index: 500; position: relative; }
.taskbar-item { background: rgba(255,255,255,0.04); color: var(--text-muted); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.taskbar-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.taskbar-item.active { background: rgba(168, 85, 247, 0.15); color: #fff; border-color: rgba(168, 85, 247, 0.4); }

.form-group { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.input-box { flex: 1; min-width: 150px; }
.input-box label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.input-box input, .input-box textarea, .input-box select { width: 100%; padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 12px; background: rgba(255, 255, 255, 0.03); color: var(--text-main); outline: none; transition: all 0.2s; }
.input-box input:focus, .input-box textarea:focus, .input-box select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }

.input-box select option, select option { background-color: var(--window-bg) !important; color: var(--text-main) !important; padding: 10px !important; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; background: rgba(255,255,255,0.02); padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); }
.perm-item { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.perm-item input { accent-color: var(--primary); width: 14px; height: 14px; }

.table-container { width: 100%; overflow-x: auto; margin-top: 10px; border: 1px solid var(--border-color); border-radius: 8px; background: rgba(0,0,0,0.15); }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { border-bottom: 1px solid var(--border-color); border-right: 1px solid rgba(255,255,255,0.03); padding: 8px 6px; text-align: center; font-size: 11px; }
th { background-color: rgba(255, 255, 255, 0.02); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.grid-input { width: 100%; padding: 6px 4px; border: 1px solid var(--border-color); border-radius: 6px; text-align: center; font-size: 11px; background: rgba(255,255,255,0.03); color: var(--text-main); }
.grid-input:focus { border-color: var(--primary); }

.btn { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; transition: all 0.2s; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2); }
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(168, 85, 247, 0.3); }
.btn-warning { background: #d97706; box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2); }
.btn-warning:hover { background: #b45309; }
.btn-success { background: #16a34a; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2); }
.btn-danger:hover { background: #b91c1c; }
.btn-info { background: #2563eb; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.btn-info:hover { background: #1d4ed8; }
td .btn { padding: 4px 8px; font-size: 10px; min-height: auto; }

#print-area-visualizar-fechamento, 
#print-area-visualizar-fechamento *, 
#print-area-visualizar-fechamento td, 
#print-area-visualizar-fechamento th,
#print-area-visualizar-fechamento span,
#print-area-visualizar-fechamento b {
  color: #000000 !important;
}
#print-area-visualizar-fechamento #vis-lbl-subtotal-valor,
#print-area-visualizar-fechamento #vis-lbl-total-geral-fech {
  color: #553c9a !important;
}

@media print {
  @page { size: portrait; margin: 10mm; }
  body * { visibility: hidden !important; }
  .floating-window, .floating-window * { visibility: hidden !important; }
  .floating-window[style*="display: block"] #print-area-ficha, 
  .floating-window[style*="display: block"] #print-area-ficha *,
  .floating-window[style*="display: block"] #print-area-fechamento, 
  .floating-window[style*="display: block"] #print-area-fechamento *,
  .floating-window[style*="display: block"] #print-area-visualizar-ficha, 
  .floating-window[style*="display: block"] #print-area-visualizar-ficha *,
  .floating-window[style*="display: block"] #print-area-visualizar-fechamento, 
  .floating-window[style*="display: block"] #print-area-visualizar-fechamento *,
  .floating-window[style*="display: block"] #print-area-relatorios, 
  .floating-window[style*="display: block"] #print-area-relatorios *,
  .floating-window[style*="display: block"] #visualizacao-impressao-nfse, 
  .floating-window[style*="display: block"] #visualizacao-impressao-nfse * { 
    visibility: visible !important; 
  }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  .floating-window[style*="display: block"],
  .floating-window[style*="display:block"] {
    position: absolute !important; left: 0 !important; top: 0 !important; display: block !important; width: 100% !important; height: auto !important; max-height: none !important; overflow: visible !important; box-shadow: none !important; border: none !important; background: #fff !important; padding: 0 !important; z-index: 999999 !important;
  }
  .table-container { overflow: visible !important; border: none !important; max-height: none !important; box-shadow: none !important; }
  table { width: 100% !important; min-width: 100% !important; font-size: 9px !important; page-break-inside: auto !important; }
  tr { page-break-inside: avoid !important; page-break-after: auto !important; }
  thead { display: table-header-group !important; }
  tfoot { display: table-row-group !important; page-break-inside: avoid !important; }
  th, td { padding: 5px 4px !important; border-color: #ccc !important; color: #000 !important; }
  th { background-color: #f1f5f9 !important; }
  .sidebar, .taskbar, .mobile-header-bar, .window-header, .window-controls, .no-print, #login-overlay, .sidebar-overlay, nav, header { display: none !important; }
}

@media (max-width: 1024px) {
  body { overflow: auto; }
  .mobile-header-bar { display: flex; }
  .app-container { flex-direction: column; overflow: visible; padding-bottom: 65px; }
  .sidebar { position: fixed !important; top: 0; left: -280px; height: 100vh; z-index: 2000 !important; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 10px 0 30px rgba(0,0,0,0.5); background: #0f172a !important; }
  .sidebar.mobile-open { left: 0 !important; }
  .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: transparent; z-index: 1500 !important; pointer-events: none !important; }
  .sidebar-overlay.active { display: block !important; pointer-events: none !important; }
  .main-content { padding: 15px; overflow-y: visible; }
  .dash-row { grid-template-columns: 1fr; }
  .floating-window { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: calc(100vh - 60px) !important; max-width: 100vw !important; max-height: none !important; border-radius: 0 !important; border: none !important; padding: 15px !important; z-index: 100 !important; }
  .taskbar { display: none; }
  .btn { width: 100%; margin-bottom: 8px; }
}